diff --git a/.changeset/gorgeous-squids-speak.md b/.changeset/gorgeous-squids-speak.md new file mode 100644 index 000000000000..8c81ec300edb --- /dev/null +++ b/.changeset/gorgeous-squids-speak.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Add system addresses for nightly goerli diff --git a/l2geth/rollup/rcfg/system_address.go b/l2geth/rollup/rcfg/system_address.go index 32100ed0546f..e82b68e469aa 100644 --- a/l2geth/rollup/rcfg/system_address.go +++ b/l2geth/rollup/rcfg/system_address.go @@ -66,6 +66,12 @@ var SystemAddressDeployers = map[uint64]SystemAddressDeployer{ common.HexToAddress("0xc30276833798867c1dbc5c468bf51ca900b44e4c"), common.HexToAddress("0x5c679a57e018f5f146838138d3e032ef4913d551"), }, + + // Goerli nightly + 421: { + common.HexToAddress("0xc30276833798867c1dbc5c468bf51ca900b44e4c"), + common.HexToAddress("0x5c679a57e018f5f146838138d3e032ef4913d551"), + }, } var envSystemAddressDeployer SystemAddressDeployer diff --git a/l2geth/rollup/rcfg/system_address_test.go b/l2geth/rollup/rcfg/system_address_test.go index 821b30faa918..69ef0ab59ad7 100644 --- a/l2geth/rollup/rcfg/system_address_test.go +++ b/l2geth/rollup/rcfg/system_address_test.go @@ -31,6 +31,11 @@ func TestSystemAddressFor(t *testing.T) { common.HexToAddress("0x5c679a57e018f5f146838138d3e032ef4913d551"), 420, }, + { + common.HexToAddress("0xc30276833798867c1dbc5c468bf51ca900b44e4c"), + common.HexToAddress("0x5c679a57e018f5f146838138d3e032ef4913d551"), + 421, + }, } for _, tt := range tests { chainID := big.NewInt(tt.chainId) diff --git a/packages/contracts/deployments/goerli-nightly/AddressDictator.json b/packages/contracts/deployments/goerli-nightly/AddressDictator.json index 1147b115534c..2d1e2d1fadc3 100644 --- a/packages/contracts/deployments/goerli-nightly/AddressDictator.json +++ b/packages/contracts/deployments/goerli-nightly/AddressDictator.json @@ -1,5 +1,5 @@ { - "address": "0x8e28E04969EC242D806BE0a7f21Fe617110DaF12", + "address": "0x8F37259c017B03c18bFd95c5ef708635245Af23C", "abi": [ { "inputs": [ @@ -93,24 +93,24 @@ "type": "function" } ], - "transactionHash": "0xe733ac7c40fb863ccc5b0c37f0606ab9010e4c6ddcf7754c700bf78055ffd49c", + "transactionHash": "0x192469508df728c4c6db3748bffe38354d513be425e09210b839a173b272fef1", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x8e28E04969EC242D806BE0a7f21Fe617110DaF12", - "transactionIndex": 14, + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x8F37259c017B03c18bFd95c5ef708635245Af23C", + "transactionIndex": 4, "gasUsed": "1222250", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x3c1c800b6e2ec4f41aa3e6f239a8283a3d27065869482edc8c30504eeaf7bcb9", - "transactionHash": "0xe733ac7c40fb863ccc5b0c37f0606ab9010e4c6ddcf7754c700bf78055ffd49c", + "blockHash": "0xa09d9a5107459511f3c7393aedde930493bf188c82abbc01c61a1d55d8884654", + "transactionHash": "0x192469508df728c4c6db3748bffe38354d513be425e09210b839a173b272fef1", "logs": [], - "blockNumber": 6680752, - "cumulativeGasUsed": "3817480", + "blockNumber": 6754203, + "cumulativeGasUsed": "4950064", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "0x2E8234de112b3d020D4310820B8e253056A90D9F", "0x4F3F400c20448D33ECc12E7d289F49dA7fC51736", [ "ChainStorageContainer-CTC-batches", @@ -126,20 +126,20 @@ "OVM_Proposer" ], [ - "0x3Fde63307FBc24f6762EE0506f6e1601ACcAF344", - "0x3eFade32F8430fb8FA93123A924a7572903507bc", - "0x3063D837484Bd37E4B7c24CDB05DF030782432eE", - "0xd1a3a355Cd384106883823E667fbb1f30AB843A3", - "0x43EF4BA085D7B8Fb01271C02cE1C2B0cbD109498", - "0x74CF0044A6A384fafEf9Ab3474D578345Aba9a32", - "0x84a374C4082252FCEc215C242513c15551b15976", - "0xe352dDE5d101BB422f78C3eD77f2cD8f0b9B0f82", + "0xB9dB55d2c06457fD873476E3e57D792BCdFBe983", + "0x9FBeFbC8Ae66e2a32200D5C1267AAD2B4e517044", + "0x517c8c9C11586A99fF28fe97f6fe168d4f9f9989", + "0x0F4d7B946A53D0Ebc8a427Bde033C8BF3FF02Baa", + "0xf96b1d80afed620da371682EA138aB778c7aD301", + "0x7E7F3df6aCc8f1f97047116b1c468BCBE7a0A794", + "0x497cdD0F36b3D3012C1fEa605332E77E942C494a", + "0x4600216A9C733658A48Ef83Ad218BA221514894E", "0x4200000000000000000000000000000000000007", "0xba517B809d22D5e27F607c03dEBDe09d5Ad27049", "0x69fe6dE5b2Cd205FfC6D0c9F26df681b262A91dd" ] ], - "solcInputHash": "fe8f11a27fedbac07dcc3c9879e50c98", + "solcInputHash": "85ebee1fe613cdbb58dec7dd9504e627", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"_manager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_finalOwner\",\"type\":\"address\"},{\"internalType\":\"string[]\",\"name\":\"_names\",\"type\":\"string[]\"},{\"internalType\":\"address[]\",\"name\":\"_addresses\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"finalOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNamedAddresses\",\"outputs\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"internalType\":\"struct AddressDictator.NamedAddress[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"returnOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"setAddresses\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The AddressDictator (glory to Arstotzka) is a contract that allows us to safely manipulate many different addresses in the AddressManager without transferring ownership of the AddressManager to a hot wallet or hardware wallet.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_addresses\":\"Array of addresses to associate with the name.\",\"_finalOwner\":\"Address to transfer AddressManager ownership to afterwards.\",\"_manager\":\"Address of the AddressManager contract.\",\"_names\":\"Array of names to associate an address with.\"}}},\"title\":\"AddressDictator\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getNamedAddresses()\":{\"notice\":\"Returns the full namedAddresses array.\"},\"returnOwnership()\":{\"notice\":\"Transfers ownership of this contract to the finalOwner. Only callable by the Final Owner, which is intended to be our multisig. This function shouldn't be necessary, but it gives a sense of reassurance that we can recover if something really surprising goes wrong.\"},\"setAddresses()\":{\"notice\":\"Called to finalize the transfer, this function is callable by anyone, but will only result in an upgrade if this contract is the owner Address Manager.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1/deployment/AddressDictator.sol\":\"AddressDictator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/deployment/AddressDictator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\nimport { Lib_AddressManager } from \\\"../../libraries/resolver/Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title AddressDictator\\n * @dev The AddressDictator (glory to Arstotzka) is a contract that allows us to safely manipulate\\n * many different addresses in the AddressManager without transferring ownership of the\\n * AddressManager to a hot wallet or hardware wallet.\\n */\\ncontract AddressDictator {\\n /*********\\n * Types *\\n *********/\\n\\n struct NamedAddress {\\n string name;\\n address addr;\\n }\\n\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public manager;\\n address public finalOwner;\\n NamedAddress[] namedAddresses;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _manager Address of the AddressManager contract.\\n * @param _finalOwner Address to transfer AddressManager ownership to afterwards.\\n * @param _names Array of names to associate an address with.\\n * @param _addresses Array of addresses to associate with the name.\\n */\\n constructor(\\n Lib_AddressManager _manager,\\n address _finalOwner,\\n string[] memory _names,\\n address[] memory _addresses\\n ) {\\n manager = _manager;\\n finalOwner = _finalOwner;\\n require(\\n _names.length == _addresses.length,\\n \\\"AddressDictator: Must provide an equal number of names and addresses.\\\"\\n );\\n for (uint256 i = 0; i < _names.length; i++) {\\n namedAddresses.push(NamedAddress({ name: _names[i], addr: _addresses[i] }));\\n }\\n }\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Called to finalize the transfer, this function is callable by anyone, but will only result in\\n * an upgrade if this contract is the owner Address Manager.\\n */\\n // slither-disable-next-line calls-loop\\n function setAddresses() external {\\n for (uint256 i = 0; i < namedAddresses.length; i++) {\\n manager.setAddress(namedAddresses[i].name, namedAddresses[i].addr);\\n }\\n // note that this will revert if _finalOwner == currentOwner\\n manager.transferOwnership(finalOwner);\\n }\\n\\n /**\\n * Transfers ownership of this contract to the finalOwner.\\n * Only callable by the Final Owner, which is intended to be our multisig.\\n * This function shouldn't be necessary, but it gives a sense of reassurance that we can recover\\n * if something really surprising goes wrong.\\n */\\n function returnOwnership() external {\\n require(msg.sender == finalOwner, \\\"AddressDictator: only callable by finalOwner\\\");\\n manager.transferOwnership(finalOwner);\\n }\\n\\n /******************\\n * View Functions *\\n ******************/\\n\\n /**\\n * Returns the full namedAddresses array.\\n */\\n function getNamedAddresses() external view returns (NamedAddress[] memory) {\\n return namedAddresses;\\n }\\n}\\n\",\"keccak256\":\"0xd67a7b7ca6d5554bca411d64c6b2d633dfe62ab74480494b99cefff2c672d06a\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x60806040523480156200001157600080fd5b5060405162000d5e38038062000d5e83398101604081905262000034916200037a565b600080546001600160a01b038087166001600160a01b03199283161790925560018054928616929091169190911790558051825114620000ee5760405162461bcd60e51b815260206004820152604560248201527f416464726573734469637461746f723a204d7573742070726f7669646520616e60448201527f20657175616c206e756d626572206f66206e616d657320616e6420616464726560648201526439b9b2b99760d91b608482015260a40160405180910390fd5b60005b8251811015620001c357600260405180604001604052808584815181106200011d576200011d62000505565b602002602001015181526020018484815181106200013f576200013f62000505565b6020908102919091018101516001600160a01b0316909152825460018101845560009384529281902082518051939460020290910192620001849284920190620001ce565b5060209190910151600190910180546001600160a01b0319166001600160a01b0390921691909117905580620001ba816200051b565b915050620000f1565b505050505062000582565b828054620001dc9062000545565b90600052602060002090601f0160209004810192826200020057600085556200024b565b82601f106200021b57805160ff19168380011785556200024b565b828001600101855582156200024b579182015b828111156200024b5782518255916020019190600101906200022e565b50620002599291506200025d565b5090565b5b808211156200025957600081556001016200025e565b6001600160a01b03811681146200028a57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620002ce57620002ce6200028d565b604052919050565b60006001600160401b03821115620002f257620002f26200028d565b5060051b60200190565b600082601f8301126200030e57600080fd5b81516020620003276200032183620002d6565b620002a3565b82815260059290921b840181019181810190868411156200034757600080fd5b8286015b848110156200036f578051620003618162000274565b83529183019183016200034b565b509695505050505050565b600080600080608085870312156200039157600080fd5b84516200039e8162000274565b80945050602080860151620003b38162000274565b60408701519094506001600160401b0380821115620003d157600080fd5b818801915088601f830112620003e657600080fd5b8151620003f76200032182620002d6565b81815260059190911b8301840190848101908b8311156200041757600080fd5b8585015b83811015620004ce57805185811115620004355760008081fd5b8601603f81018e13620004485760008081fd5b87810151868111156200045f576200045f6200028d565b62000473601f8201601f19168a01620002a3565b8181528f60408385010111156200048a5760008081fd5b60005b82811015620004ab57838101604001518282018c01528a016200048d565b82811115620004bd5760008b84840101525b50855250509186019186016200041b565b5060608b01519097509450505080831115620004e957600080fd5b5050620004f987828801620002fc565b91505092959194509250565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200053e57634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200055a57607f821691505b602082108114156200057c57634e487b7160e01b600052602260045260246000fd5b50919050565b6107cc80620005926000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80633ccad6fc116100505780633ccad6fc146100c0578063481c6a75146100d5578063bc3a429b146100f557600080fd5b806317ad94ec1461006c578063297d1a34146100b6575b600080fd5b60015461008c9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100be6100fd565b005b6100c8610232565b6040516100ad91906104af565b60005461008c9073ffffffffffffffffffffffffffffffffffffffff1681565b6100be610343565b60015473ffffffffffffffffffffffffffffffffffffffff1633146101a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f416464726573734469637461746f723a206f6e6c792063616c6c61626c65206260448201527f792066696e616c4f776e65720000000000000000000000000000000000000000606482015260840160405180910390fd5b6000546001546040517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015291169063f2fde38b906024015b600060405180830381600087803b15801561021857600080fd5b505af115801561022c573d6000803e3d6000fd5b50505050565b60606002805480602002602001604051908101604052809291908181526020016000905b8282101561033a5783829060005260206000209060020201604051806040016040529081600082018054610289906105ae565b80601f01602080910402602001604051908101604052809291908181526020018280546102b5906105ae565b80156103025780601f106102d757610100808354040283529160200191610302565b820191906000526020600020905b8154815290600101906020018083116102e557829003601f168201915b505050918352505060019182015473ffffffffffffffffffffffffffffffffffffffff16602091820152918352929092019101610256565b50505050905090565b60005b600254811015610454576000546002805473ffffffffffffffffffffffffffffffffffffffff90921691639b2ea4bd91908490811061038757610387610602565b9060005260206000209060020201600001600284815481106103ab576103ab610602565b60009182526020909120600160029092020101546040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815261040f929173ffffffffffffffffffffffffffffffffffffffff1690600401610631565b600060405180830381600087803b15801561042957600080fd5b505af115801561043d573d6000803e3d6000fd5b50505050808061044c90610736565b915050610346565b506000546001546040517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015291169063f2fde38b906024016101fe565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b8481101561059f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08a8503018652825180518886528051808a880152845b81811015610532578281018c0151888201606001528b01610516565b8181111561054357856060838a0101525b50918a015173ffffffffffffffffffffffffffffffffffffffff16868b01525095880195601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690930160600192918701916001016104d7565b50919998505050505050505050565b600181811c908216806105c257607f821691505b602082108114156105fc577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60408152600080845481600182811c91508083168061065157607f831692505b602080841082141561068a577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b60408801849052606088018280156106a957600181146106d857610703565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00871682528282019750610703565b60008c81526020902060005b878110156106fd578154848201529086019084016106e4565b83019850505b50508596506107298189018a73ffffffffffffffffffffffffffffffffffffffff169052565b5050505050509392505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561078f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea26469706673582212207993fbd341ec4f9e20c9ca42c43294b14f2a103fa8da10fc05d197e3abc8766164736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80633ccad6fc116100505780633ccad6fc146100c0578063481c6a75146100d5578063bc3a429b146100f557600080fd5b806317ad94ec1461006c578063297d1a34146100b6575b600080fd5b60015461008c9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100be6100fd565b005b6100c8610232565b6040516100ad91906104af565b60005461008c9073ffffffffffffffffffffffffffffffffffffffff1681565b6100be610343565b60015473ffffffffffffffffffffffffffffffffffffffff1633146101a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f416464726573734469637461746f723a206f6e6c792063616c6c61626c65206260448201527f792066696e616c4f776e65720000000000000000000000000000000000000000606482015260840160405180910390fd5b6000546001546040517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015291169063f2fde38b906024015b600060405180830381600087803b15801561021857600080fd5b505af115801561022c573d6000803e3d6000fd5b50505050565b60606002805480602002602001604051908101604052809291908181526020016000905b8282101561033a5783829060005260206000209060020201604051806040016040529081600082018054610289906105ae565b80601f01602080910402602001604051908101604052809291908181526020018280546102b5906105ae565b80156103025780601f106102d757610100808354040283529160200191610302565b820191906000526020600020905b8154815290600101906020018083116102e557829003601f168201915b505050918352505060019182015473ffffffffffffffffffffffffffffffffffffffff16602091820152918352929092019101610256565b50505050905090565b60005b600254811015610454576000546002805473ffffffffffffffffffffffffffffffffffffffff90921691639b2ea4bd91908490811061038757610387610602565b9060005260206000209060020201600001600284815481106103ab576103ab610602565b60009182526020909120600160029092020101546040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815261040f929173ffffffffffffffffffffffffffffffffffffffff1690600401610631565b600060405180830381600087803b15801561042957600080fd5b505af115801561043d573d6000803e3d6000fd5b50505050808061044c90610736565b915050610346565b506000546001546040517ff2fde38b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015291169063f2fde38b906024016101fe565b60006020808301818452808551808352604092508286019150828160051b8701018488016000805b8481101561059f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08a8503018652825180518886528051808a880152845b81811015610532578281018c0151888201606001528b01610516565b8181111561054357856060838a0101525b50918a015173ffffffffffffffffffffffffffffffffffffffff16868b01525095880195601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690930160600192918701916001016104d7565b50919998505050505050505050565b600181811c908216806105c257607f821691505b602082108114156105fc577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60408152600080845481600182811c91508083168061065157607f831692505b602080841082141561068a577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b60408801849052606088018280156106a957600181146106d857610703565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00871682528282019750610703565b60008c81526020902060005b878110156106fd578154848201529086019084016106e4565b83019850505b50508596506107298189018a73ffffffffffffffffffffffffffffffffffffffff169052565b5050505050509392505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561078f577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea26469706673582212207993fbd341ec4f9e20c9ca42c43294b14f2a103fa8da10fc05d197e3abc8766164736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/BondManager.json b/packages/contracts/deployments/goerli-nightly/BondManager.json index 7a3e12af029a..9d5e01fe103d 100644 --- a/packages/contracts/deployments/goerli-nightly/BondManager.json +++ b/packages/contracts/deployments/goerli-nightly/BondManager.json @@ -1,5 +1,5 @@ { - "address": "0x43EF4BA085D7B8Fb01271C02cE1C2B0cbD109498", + "address": "0xf96b1d80afed620da371682EA138aB778c7aD301", "abi": [ { "inputs": [ @@ -64,26 +64,26 @@ "type": "function" } ], - "transactionHash": "0xa0c9c1fb804968eebfc3aaf90f145b0c6846ae344ad457b31f7fb8193b9b7935", + "transactionHash": "0x1a3094f836e99e21b73981ec5f46ec41044cd292041152eefa2ad85c27157a29", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x43EF4BA085D7B8Fb01271C02cE1C2B0cbD109498", - "transactionIndex": 3, - "gasUsed": "295562", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0xf96b1d80afed620da371682EA138aB778c7aD301", + "transactionIndex": 6, + "gasUsed": "295574", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa3a1e9be6e23a7d93cfb9dbd0f29d73646220b67ebfa7fc07313a40a63fe0b1f", - "transactionHash": "0xa0c9c1fb804968eebfc3aaf90f145b0c6846ae344ad457b31f7fb8193b9b7935", + "blockHash": "0xc657ae74bae81f63dd5633e5fe75149b649bf4ecce452a714c15454f8a5a8daa", + "transactionHash": "0x1a3094f836e99e21b73981ec5f46ec41044cd292041152eefa2ad85c27157a29", "logs": [], - "blockNumber": 6680730, - "cumulativeGasUsed": "521342", + "blockNumber": 6754180, + "cumulativeGasUsed": "4118415", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89" + "0x2E8234de112b3d020D4310820B8e253056A90D9F" ], - "solcInputHash": "851ead2506cb170c280352cdcfc619e3", + "solcInputHash": "2453276f0fd3d335163681e9ac1b451f", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"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\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"This contract is, for now, a stub of the \\\"real\\\" BondManager that does nothing but allow the \\\"OVM_Proposer\\\" to submit state root batches.\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_libAddressManager\":\"Address of the Address Manager.\"}},\"isCollateralized(address)\":{\"params\":{\"_who\":\"Address to check.\"},\"returns\":{\"_0\":\"true if the address is properly collateralized, false otherwise.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"BondManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"isCollateralized(address)\":{\"notice\":\"Checks whether a given address is properly collateralized and can perform actions within the system.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1/verification/BondManager.sol\":\"BondManager\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/verification/BondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Interface Imports */\\nimport { IBondManager } from \\\"./IBondManager.sol\\\";\\n\\n/* Contract Imports */\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/**\\n * @title BondManager\\n * @dev This contract is, for now, a stub of the \\\"real\\\" BondManager that does nothing but\\n * allow the \\\"OVM_Proposer\\\" to submit state root batches.\\n *\\n */\\ncontract BondManager is IBondManager, Lib_AddressResolver {\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) {}\\n\\n /**\\n * Checks whether a given address is properly collateralized and can perform actions within\\n * the system.\\n * @param _who Address to check.\\n * @return true if the address is properly collateralized, false otherwise.\\n */\\n // slither-disable-next-line external-function\\n function isCollateralized(address _who) public view returns (bool) {\\n // Only authenticate sequencer to submit state root batches.\\n return _who == resolve(\\\"OVM_Proposer\\\");\\n }\\n}\\n\",\"keccak256\":\"0x34bc15756ccd896c32cd20248da3f95a2be8f9b8382674b42bf896b928984380\",\"license\":\"MIT\"},\"contracts/L1/verification/IBondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title IBondManager\\n */\\ninterface IBondManager {\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isCollateralized(address _who) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4ae2dc7bf175626d2930299e73d50a7ba936171d07810497ef71fa38a4e246a7\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\nabstract contract Lib_AddressResolver {\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(address _libAddressManager) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\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(string memory _name) public view returns (address) {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x515c4db671a28e2fe180201f6d11c0208c05f582ca3489fb6b8e81c27659bc62\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5060405161048838038061048883398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6103f5806100936000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806302ad4d2a14610046578063299ca4781461006e578063461a4478146100b3575b600080fd5b61005961005436600461020d565b6100c6565b60405190151581526020015b60405180910390f35b60005461008e9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610065565b61008e6100c1366004610260565b61013b565b60006101066040518060400160405280600c81526020017f4f564d5f50726f706f736572000000000000000000000000000000000000000081525061013b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061019290859060040161032f565b60206040518083038186803b1580156101aa57600080fd5b505afa1580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e291906103a2565b92915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461020a57600080fd5b50565b60006020828403121561021f57600080fd5b813561022a816101e8565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561027257600080fd5b813567ffffffffffffffff8082111561028a57600080fd5b818401915084601f83011261029e57600080fd5b8135818111156102b0576102b0610231565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156102f6576102f6610231565b8160405282815287602084870101111561030f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b8181101561035c57858101830151858201604001528201610340565b8181111561036e576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000602082840312156103b457600080fd5b815161022a816101e856fea264697066735822122087d4cb97cd5a4456c2b8ab23d1374b6ac6874a5b854a207714f5b3768ca6d73a64736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c806302ad4d2a14610046578063299ca4781461006e578063461a4478146100b3575b600080fd5b61005961005436600461020d565b6100c6565b60405190151581526020015b60405180910390f35b60005461008e9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610065565b61008e6100c1366004610260565b61013b565b60006101066040518060400160405280600c81526020017f4f564d5f50726f706f736572000000000000000000000000000000000000000081525061013b565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061019290859060040161032f565b60206040518083038186803b1580156101aa57600080fd5b505afa1580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e291906103a2565b92915050565b73ffffffffffffffffffffffffffffffffffffffff8116811461020a57600080fd5b50565b60006020828403121561021f57600080fd5b813561022a816101e8565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561027257600080fd5b813567ffffffffffffffff8082111561028a57600080fd5b818401915084601f83011261029e57600080fd5b8135818111156102b0576102b0610231565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156102f6576102f6610231565b8160405282815287602084870101111561030f57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b8181101561035c57858101830151858201604001528201610340565b8181111561036e576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000602082840312156103b457600080fd5b815161022a816101e856fea264697066735822122087d4cb97cd5a4456c2b8ab23d1374b6ac6874a5b854a207714f5b3768ca6d73a64736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/CanonicalTransactionChain.json b/packages/contracts/deployments/goerli-nightly/CanonicalTransactionChain.json index a25760d038d3..341a2cb56012 100644 --- a/packages/contracts/deployments/goerli-nightly/CanonicalTransactionChain.json +++ b/packages/contracts/deployments/goerli-nightly/CanonicalTransactionChain.json @@ -1,5 +1,5 @@ { - "address": "0x3063D837484Bd37E4B7c24CDB05DF030782432eE", + "address": "0x517c8c9C11586A99fF28fe97f6fe168d4f9f9989", "abi": [ { "inputs": [ @@ -481,29 +481,29 @@ "type": "function" } ], - "transactionHash": "0x772e9704c7061e5b564ce7a8b1eab3410e8089fcfbb17f027f85ae1925a2364b", + "transactionHash": "0xd9b7c0102fbb973b767499779b3200b3d71f5b5ac84992c7b2155f691e1ed535", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x3063D837484Bd37E4B7c24CDB05DF030782432eE", - "transactionIndex": 7, - "gasUsed": "1577238", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x517c8c9C11586A99fF28fe97f6fe168d4f9f9989", + "transactionIndex": 43, + "gasUsed": "1577250", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xedd5d11a856a3c2e133784eb48f30724c113ddf8e1310f38f1221be1d2bfd56a", - "transactionHash": "0x772e9704c7061e5b564ce7a8b1eab3410e8089fcfbb17f027f85ae1925a2364b", + "blockHash": "0x1d8a6f86306699b354fc96877da5a4b07274ee014629e9356780083671cbcd16", + "transactionHash": "0xd9b7c0102fbb973b767499779b3200b3d71f5b5ac84992c7b2155f691e1ed535", "logs": [], - "blockNumber": 6680721, - "cumulativeGasUsed": "2093018", + "blockNumber": 6754171, + "cumulativeGasUsed": "10481311", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "0x2E8234de112b3d020D4310820B8e253056A90D9F", 15000000, 32, 60000 ], - "solcInputHash": "4a53c0dd06fca16c6fdd29a0c129b9a0", + "solcInputHash": "999646fff997914eb7b90b0ed773b33a", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_maxTransactionGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_l2GasDiscountDivisor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_enqueueGasCost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l2GasDiscountDivisor\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"enqueueGasCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"enqueueL2GasPrepaid\",\"type\":\"uint256\"}],\"name\":\"L2GasParamsUpdated\",\"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\":\"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\":true,\"internalType\":\"address\",\"name\":\"_l1TxOrigin\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_timestamp\",\"type\":\"uint256\"}],\"name\":\"TransactionEnqueued\",\"type\":\"event\"},{\"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\":[],\"name\":\"appendSequencerBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batches\",\"outputs\":[{\"internalType\":\"contract IChainStorageContainer\",\"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\":\"enqueueGasCost\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enqueueL2GasPrepaid\",\"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\":\"l2GasDiscountDivisor\",\"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\":\"maxTransactionGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"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\":[{\"internalType\":\"uint256\",\"name\":\"_l2GasDiscountDivisor\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_enqueueGasCost\",\"type\":\"uint256\"}],\"name\":\"setGasParams\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"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.\",\"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.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}}},\"title\":\"CanonicalTransactionChain\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"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.\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"setGasParams(uint256,uint256)\":{\"notice\":\"Allows the Burn Admin to update the parameters which determine the amount of gas to burn. The value of enqueueL2GasPrepaid is immediately updated as well.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1/rollup/CanonicalTransactionChain.sol\":\"CanonicalTransactionChain\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/rollup/CanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { AddressAliasHelper } from \\\"../../standards/AddressAliasHelper.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { ICanonicalTransactionChain } from \\\"./ICanonicalTransactionChain.sol\\\";\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title 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\\n * Sequencer will eventually append it to the rollup state.\\n *\\n */\\ncontract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressResolver {\\n /*************\\n * Constants *\\n *************/\\n\\n // L2 tx gas-related\\n uint256 public constant MIN_ROLLUP_TX_GAS = 100000;\\n uint256 public constant MAX_ROLLUP_TX_SIZE = 50000;\\n\\n // The approximate cost of calling the enqueue function\\n uint256 public enqueueGasCost;\\n // The ratio of the cost of L1 gas to the cost of L2 gas\\n uint256 public l2GasDiscountDivisor;\\n // The amount of L2 gas which can be forwarded to L2 without spam prevention via 'gas burn'.\\n // Calculated as the product of l2GasDiscountDivisor * enqueueGasCost.\\n // See comments in enqueue() for further detail.\\n uint256 public enqueueL2GasPrepaid;\\n\\n // Encoding-related (all in bytes)\\n uint256 internal constant BATCH_CONTEXT_SIZE = 16;\\n // slither-disable-next-line unused-state\\n uint256 internal constant BATCH_CONTEXT_LENGTH_POS = 12;\\n uint256 internal constant BATCH_CONTEXT_START_POS = 15;\\n // slither-disable-next-line unused-state\\n uint256 internal constant TX_DATA_HEADER_SIZE = 3;\\n // slither-disable-next-line unused-state\\n uint256 internal constant BYTES_TILL_TX_DATA = 65;\\n\\n /*************\\n * Variables *\\n *************/\\n\\n uint256 public maxTransactionGasLimit;\\n\\n /***************\\n * Queue State *\\n ***************/\\n\\n uint40 private _nextQueueIndex; // index of the first queue element not yet included\\n Lib_OVMCodec.QueueElement[] queueElements;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n constructor(\\n address _libAddressManager,\\n uint256 _maxTransactionGasLimit,\\n uint256 _l2GasDiscountDivisor,\\n uint256 _enqueueGasCost\\n ) Lib_AddressResolver(_libAddressManager) {\\n maxTransactionGasLimit = _maxTransactionGasLimit;\\n l2GasDiscountDivisor = _l2GasDiscountDivisor;\\n enqueueGasCost = _enqueueGasCost;\\n enqueueL2GasPrepaid = _l2GasDiscountDivisor * _enqueueGasCost;\\n }\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Modifier to enforce that, if configured, only the Burn Admin may\\n * successfully call a method.\\n */\\n modifier onlyBurnAdmin() {\\n require(msg.sender == libAddressManager.owner(), \\\"Only callable by the Burn Admin.\\\");\\n _;\\n }\\n\\n /*******************************\\n * Authorized Setter Functions *\\n *******************************/\\n\\n /**\\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\\n * The value of enqueueL2GasPrepaid is immediately updated as well.\\n */\\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost)\\n external\\n onlyBurnAdmin\\n {\\n enqueueGasCost = _enqueueGasCost;\\n l2GasDiscountDivisor = _l2GasDiscountDivisor;\\n // See the comment in enqueue() for the rationale behind this formula.\\n enqueueL2GasPrepaid = _l2GasDiscountDivisor * _enqueueGasCost;\\n\\n emit L2GasParamsUpdated(l2GasDiscountDivisor, enqueueGasCost, enqueueL2GasPrepaid);\\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() public view returns (IChainStorageContainer) {\\n return IChainStorageContainer(resolve(\\\"ChainStorageContainer-CTC-batches\\\"));\\n }\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements() public view returns (uint256 _totalElements) {\\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 // slither-disable-next-line external-function\\n function getTotalBatches() public view returns (uint256 _totalBatches) {\\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 // slither-disable-next-line external-function\\n function getNextQueueIndex() public view returns (uint40) {\\n return _nextQueueIndex;\\n }\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n // slither-disable-next-line external-function\\n function getLastTimestamp() public view returns (uint40) {\\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 // slither-disable-next-line external-function\\n function getLastBlockNumber() public view returns (uint40) {\\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 // slither-disable-next-line external-function\\n function getQueueElement(uint256 _index)\\n public\\n view\\n returns (Lib_OVMCodec.QueueElement memory _element)\\n {\\n return queueElements[_index];\\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 // slither-disable-next-line external-function\\n function getNumPendingQueueElements() public view returns (uint40) {\\n return uint40(queueElements.length) - _nextQueueIndex;\\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 // slither-disable-next-line external-function\\n function getQueueLength() public view returns (uint40) {\\n return uint40(queueElements.length);\\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 ) external {\\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(_gasLimit >= MIN_ROLLUP_TX_GAS, \\\"Transaction gas limit too low to enqueue.\\\");\\n\\n // Transactions submitted to the queue lack a method for paying gas fees to the Sequencer.\\n // So we need to prevent spam attacks by ensuring that the cost of enqueueing a transaction\\n // from L1 to L2 is not underpriced. For transaction with a high L2 gas limit, we do this by\\n // burning some extra gas on L1. Of course there is also some intrinsic cost to enqueueing a\\n // transaction, so we want to make sure not to over-charge (by burning too much L1 gas).\\n // Therefore, we define 'enqueueL2GasPrepaid' as the L2 gas limit above which we must burn\\n // additional gas on L1. This threshold is the product of two inputs:\\n // 1. enqueueGasCost: the base cost of calling this function.\\n // 2. l2GasDiscountDivisor: the ratio between the cost of gas on L1 and L2. This is a\\n // positive integer, meaning we assume L2 gas is always less costly.\\n // The calculation below for gasToConsume can be seen as converting the difference (between\\n // the specified L2 gas limit and the prepaid L2 gas limit) to an L1 gas amount.\\n if (_gasLimit > enqueueL2GasPrepaid) {\\n uint256 gasToConsume = (_gasLimit - enqueueL2GasPrepaid) / l2GasDiscountDivisor;\\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(startingGas > gasToConsume, \\\"Insufficient gas for L2 rate limiting burn.\\\");\\n\\n uint256 i;\\n while (startingGas - gasleft() < gasToConsume) {\\n i++;\\n }\\n }\\n\\n // Apply an aliasing unless msg.sender == tx.origin. This prevents an attack in which a\\n // contract on L1 has the same address as a contract on L2 but doesn't have the same code.\\n // We can safely ignore this for EOAs because they're guaranteed to have the same \\\"code\\\"\\n // (i.e. no code at all). This also makes it possible for users to interact with contracts\\n // on L2 even when the Sequencer is down.\\n address sender;\\n if (msg.sender == tx.origin) {\\n sender = msg.sender;\\n } else {\\n sender = AddressAliasHelper.applyL1ToL2Alias(msg.sender);\\n }\\n\\n bytes32 transactionHash = keccak256(abi.encode(sender, _target, _gasLimit, _data));\\n\\n queueElements.push(\\n Lib_OVMCodec.QueueElement({\\n transactionHash: transactionHash,\\n timestamp: uint40(block.timestamp),\\n blockNumber: uint40(block.number)\\n })\\n );\\n uint256 queueIndex = queueElements.length - 1;\\n emit TransactionEnqueued(sender, _target, _gasLimit, _data, queueIndex, block.timestamp);\\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() external {\\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 uint40 nextTransactionPtr = uint40(\\n BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts\\n );\\n\\n require(msg.data.length >= nextTransactionPtr, \\\"Not enough BatchContexts provided.\\\");\\n\\n // Counter for number of sequencer transactions appended so far.\\n uint32 numSequencerTransactions = 0;\\n\\n // Cache the _nextQueueIndex storage variable to a temporary stack variable.\\n // This is safe as long as nothing reads or writes to the storage variable\\n // until it is updated by the temp variable.\\n uint40 nextQueueIndex = _nextQueueIndex;\\n\\n BatchContext memory curContext;\\n for (uint32 i = 0; i < numContexts; i++) {\\n BatchContext memory nextContext = _getBatchContext(i);\\n\\n // Now we can update our current context.\\n curContext = nextContext;\\n\\n // Process sequencer transactions first.\\n numSequencerTransactions += uint32(curContext.numSequencedTransactions);\\n\\n // Now process any subsequent queue transactions.\\n nextQueueIndex += uint40(curContext.numSubsequentQueueTransactions);\\n }\\n\\n require(\\n nextQueueIndex <= queueElements.length,\\n \\\"Attempted to append more elements than are available in the queue.\\\"\\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\\n // 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\\n // queue element.\\n // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at\\n // least one queue element. We increment nextQueueIndex after processing each queue\\n // element, so the index of the last element we processed is nextQueueIndex - 1.\\n Lib_OVMCodec.QueueElement memory lastElement = queueElements[nextQueueIndex - 1];\\n\\n blockTimestamp = lastElement.timestamp;\\n blockNumber = lastElement.blockNumber;\\n }\\n\\n // Cache the previous blockhash to ensure all transaction data can be retrieved efficiently.\\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\\n _appendBatch(\\n blockhash(block.number - 1),\\n totalElementsToAppend,\\n numQueuedTransactions,\\n blockTimestamp,\\n blockNumber\\n );\\n\\n // slither-disable-next-line reentrancy-events\\n emit SequencerBatchAppended(\\n nextQueueIndex - numQueuedTransactions,\\n numQueuedTransactions,\\n getTotalElements()\\n );\\n\\n // Update the _nextQueueIndex storage variable.\\n // slither-disable-next-line reentrancy-no-eth\\n _nextQueueIndex = nextQueueIndex;\\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(uint256 _index) internal pure returns (BatchContext memory) {\\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\\n // slither-disable-next-line similar-names\\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\\n 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\\n // solhint-disable max-line-length\\n assembly {\\n extraData := shr(40, extraData)\\n totalElements := and(\\n extraData,\\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\\n )\\n nextQueueIndex := shr(\\n 40,\\n and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000)\\n )\\n lastTimestamp := shr(\\n 80,\\n and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000)\\n )\\n lastBlockNumber := shr(\\n 120,\\n and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000)\\n )\\n }\\n // solhint-enable max-line-length\\n\\n return (totalElements, nextQueueIndex, lastTimestamp, lastBlockNumber);\\n }\\n\\n /**\\n * Encodes the batch context for the extra data.\\n * @param _totalElements Total number of elements submitted.\\n * @param _nextQueueIdx 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 _nextQueueIdx,\\n uint40 _timestamp,\\n uint40 _blockNumber\\n ) internal pure returns (bytes27) {\\n bytes27 extraData;\\n assembly {\\n extraData := _totalElements\\n extraData := or(extraData, shl(40, _nextQueueIdx))\\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 * 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 ) internal {\\n IChainStorageContainer 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 // slither-disable-next-line reentrancy-no-eth, reentrancy-events\\n batchesRef.push(batchHeaderHash, latestBatchContext);\\n }\\n}\\n\",\"keccak256\":\"0x3a0a468d84c4131b574b57649106adecffcc78848aeb3f43ceef13ce83851311\",\"license\":\"MIT\"},\"contracts/L1/rollup/ICanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title ICanonicalTransactionChain\\n */\\ninterface ICanonicalTransactionChain {\\n /**********\\n * Events *\\n **********/\\n\\n event L2GasParamsUpdated(\\n uint256 l2GasDiscountDivisor,\\n uint256 enqueueGasCost,\\n uint256 enqueueL2GasPrepaid\\n );\\n\\n event TransactionEnqueued(\\n address indexed _l1TxOrigin,\\n address indexed _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 indexed _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 * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n /*******************************\\n * Authorized Setter Functions *\\n *******************************/\\n\\n /**\\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\\n * The value of enqueueL2GasPrepaid is immediately updated as well.\\n */\\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost) external;\\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() external view returns (IChainStorageContainer);\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements() external view returns (uint256 _totalElements);\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches() external view returns (uint256 _totalBatches);\\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() external view returns (uint40);\\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(uint256 _index)\\n external\\n view\\n returns (Lib_OVMCodec.QueueElement memory _element);\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp() external view returns (uint40);\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber() external view returns (uint40);\\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() external view returns (uint40);\\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() external view returns (uint40);\\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 ) 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 ) external;\\n}\\n\",\"keccak256\":\"0xa534e90efd57e3c36053cb4aabba63ef8f53e35e3a4ce3d0f127ec2d0af1f618\",\"license\":\"MIT\"},\"contracts/L1/rollup/IChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IChainStorageContainer\\n */\\ninterface IChainStorageContainer {\\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(bytes27 _globalMetadata) external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata() external view returns (bytes27);\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length() external view returns (uint256);\\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\\n}\\n\",\"keccak256\":\"0xe55ad72572ec47dc09a02228d0c5a438571c76a41d16d92b35add057811977ce\",\"license\":\"MIT\"},\"contracts/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Enums *\\n *********/\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n /***********\\n * Structs *\\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 * 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(Transaction memory _transaction)\\n internal\\n pure\\n returns (bytes memory)\\n {\\n return\\n 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(Transaction memory _transaction) internal pure returns (bytes32) {\\n return keccak256(encodeTransaction(_transaction));\\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(bytes memory _encoded) internal pure returns (EVMAccount memory) {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return\\n 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n internal\\n pure\\n returns (bytes32)\\n {\\n return\\n keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb5009ac1e0617e0b3b2fb917f08f8e8a7ae706034cc3a675258bc3d91978525e\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\nabstract contract Lib_AddressResolver {\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(address _libAddressManager) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\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(string memory _name) public view returns (address) {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x515c4db671a28e2fe180201f6d11c0208c05f582ca3489fb6b8e81c27659bc62\",\"license\":\"MIT\"},\"contracts/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 internal constant MAX_LIST_LENGTH = 32;\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\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(bytes memory _in) internal pure returns (RLPItem memory) {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({ length: _in.length, ptr: ptr });\\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(RLPItem memory _in) internal pure returns (RLPItem[] memory) {\\n (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.LIST_ITEM, \\\"Invalid RLP list value.\\\");\\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(itemCount < MAX_LIST_LENGTH, \\\"Provided RLP list exceeds max list length.\\\");\\n\\n (uint256 itemOffset, uint256 itemLength, ) = _decodeLength(\\n RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })\\n );\\n\\n out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset });\\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(bytes memory _in) internal pure returns (RLPItem[] memory) {\\n return readList(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes memory) {\\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.DATA_ITEM, \\\"Invalid RLP bytes value.\\\");\\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(bytes memory _in) internal pure returns (bytes memory) {\\n return readBytes(toRLPItem(_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(RLPItem memory _in) internal pure returns (string memory) {\\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(bytes memory _in) internal pure returns (string memory) {\\n return readString(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes32) {\\n require(_in.length <= 33, \\\"Invalid RLP bytes32 value.\\\");\\n\\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.DATA_ITEM, \\\"Invalid RLP bytes32 value.\\\");\\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(bytes memory _in) internal pure returns (bytes32) {\\n return readBytes32(toRLPItem(_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(RLPItem memory _in) internal pure returns (uint256) {\\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(bytes memory _in) internal pure returns (uint256) {\\n return readUint256(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bool) {\\n require(_in.length == 1, \\\"Invalid RLP boolean value.\\\");\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n require(out == 0 || out == 1, \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\");\\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(bytes memory _in) internal pure returns (bool) {\\n return readBool(toRLPItem(_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(RLPItem memory _in) internal pure returns (address) {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(_in.length == 21, \\\"Invalid RLP address value.\\\");\\n\\n return address(uint160(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(bytes memory _in) internal pure returns (address) {\\n return readAddress(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes memory) {\\n return _copy(_in);\\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(RLPItem memory _in)\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(_in.length > 0, \\\"RLP item cannot be null.\\\");\\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 // slither-disable-next-line variable-scope\\n uint256 strLen = prefix - 0x80;\\n\\n require(_in.length > strLen, \\\"Invalid RLP short string.\\\");\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(_in.length > lenOfStrLen, \\\"Invalid RLP long string length.\\\");\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))\\n }\\n\\n require(_in.length > lenOfStrLen + strLen, \\\"Invalid RLP long string.\\\");\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n // slither-disable-next-line variable-scope\\n uint256 listLen = prefix - 0xc0;\\n\\n require(_in.length > listLen, \\\"Invalid RLP short list.\\\");\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(_in.length > lenOfListLen, \\\"Invalid RLP long list length.\\\");\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))\\n }\\n\\n require(_in.length > lenOfListLen + listLen, \\\"Invalid RLP long list.\\\");\\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 ) private pure returns (bytes memory) {\\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;\\n unchecked {\\n mask = 256**(32 - (_length % 32)) - 1;\\n }\\n\\n assembly {\\n mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))\\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(RLPItem memory _in) private pure returns (bytes memory) {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xd794d1b32c6e31d40e2526b5e519de1b4e8d14d6933889f9b916e69c5d1848c6\",\"license\":\"MIT\"},\"contracts/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\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(bytes memory _in) internal pure returns (bytes memory) {\\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(bytes[] memory _in) internal pure returns (bytes memory) {\\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(string memory _in) internal pure returns (bytes memory) {\\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(address _in) internal pure returns (bytes memory) {\\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(uint256 _in) internal pure returns (bytes memory) {\\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(bool _in) internal pure returns (bytes memory) {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\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(uint256 _len, uint256 _offset) private pure returns (bytes memory) {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = bytes1(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] = bytes1(uint8(lenLen) + uint8(_offset) + 55);\\n for (i = 1; i <= lenLen; i++) {\\n encoded[i] = bytes1(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(uint256 _x) private pure returns (bytes memory) {\\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 ) private pure {\\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;\\n unchecked {\\n mask = 256**(32 - len) - 1;\\n }\\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(bytes[] memory _list) private pure returns (bytes memory) {\\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 {\\n flattenedPtr := add(flattened, 0x20)\\n }\\n\\n for (i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly {\\n listPtr := add(item, 0x20)\\n }\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\\n\",\"keccak256\":\"0x215b90672ce126effc3f2df61ca0cdf52d2b1cc9be602877e637829b0bf229fd\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\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(bytes32 _in) internal pure returns (bool) {\\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(bool _in) internal pure returns (bytes32) {\\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(bytes32 _in) internal pure returns (address) {\\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(address _in) internal pure returns (bytes32) {\\n return bytes32(uint256(uint160(_in)));\\n }\\n}\\n\",\"keccak256\":\"0xf2d1a526f2529e51fc2fffccf093c1691e291cbbb6de8a3da7d7f80024a9a234\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n ) internal pure returns (bytes memory) {\\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(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) {\\n if (_start >= _bytes.length) {\\n return bytes(\\\"\\\");\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {\\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(bytes memory _bytes) internal pure returns (uint256) {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) {\\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(bytes memory _bytes) internal pure returns (bytes memory) {\\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(bytes memory _bytes, bytes memory _other) internal pure returns (bool) {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xc39ee13f97e4ccfbc72a5aac571deb3c1aff882fca2dd18be794d43ac5de0a30\",\"license\":\"MIT\"},\"contracts/standards/AddressAliasHelper.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2019-2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity ^0.8.7;\\n\\nlibrary AddressAliasHelper {\\n uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);\\n\\n /// @notice Utility function that converts the address in the L1 that submitted a tx to\\n /// the inbox to the msg.sender viewed in the L2\\n /// @param l1Address the address in the L1 that triggered the tx to L2\\n /// @return l2Address L2 address as viewed in msg.sender\\n function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\\n unchecked {\\n l2Address = address(uint160(l1Address) + offset);\\n }\\n }\\n\\n /// @notice Utility function that converts the msg.sender viewed in the L2 to the\\n /// address in the L1 that submitted a tx to the inbox\\n /// @param l2Address L2 address as viewed in msg.sender\\n /// @return l1Address the address in the L1 that triggered the tx to L2\\n function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\\n unchecked {\\n l1Address = address(uint160(l2Address) - offset);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf330061b0ad081dd4d35a3efaeb3acd0a926c23ebb1ce7115007dac406d61b3f\",\"license\":\"Apache-2.0\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5060405162001a9838038062001a9883398101604081905261003191610072565b600080546001600160a01b0319166001600160a01b03861617905560048390556002829055600181905561006581836100bd565b600355506100ea92505050565b6000806000806080858703121561008857600080fd5b84516001600160a01b038116811461009f57600080fd5b60208601516040870151606090970151919890975090945092505050565b60008160001904831182151516156100e557634e487b7160e01b600052601160045260246000fd5b500290565b61199e80620000fa6000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c8063876ed5cb116100cd578063d0f8934411610081578063e654b1fb11610066578063e654b1fb146102c0578063edcc4a45146102c9578063f722b41a146102dc57600080fd5b8063d0f89344146102b0578063e561dddc146102b857600080fd5b8063b8f77005116100b2578063b8f7700514610297578063ccf987c81461029f578063cfdf677e146102a857600080fd5b8063876ed5cb146102855780638d38c6c11461028e57600080fd5b80635ae6256d1161012457806378f4b2f21161010957806378f4b2f2146102645780637a167a8a1461026e5780637aa63a861461027d57600080fd5b80635ae6256d146102475780636fee07e01461024f57600080fd5b80632a7f18be116101555780632a7f18be146101d25780633789977014610216578063461a44781461023457600080fd5b80630b3dfa9714610171578063299ca4781461018d575b600080fd5b61017a60035481565b6040519081526020015b60405180910390f35b6000546101ad9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610184565b6101e56101e03660046113e5565b6102e4565b604080518251815260208084015164ffffffffff908116918301919091529282015190921690820152606001610184565b61021e610362565b60405164ffffffffff9091168152602001610184565b6101ad6102423660046114c1565b610376565b61021e610423565b61026261025d366004611537565b610437565b005b61017a620186a081565b60055464ffffffffff1661021e565b61017a610899565b61017a61c35081565b61017a60045481565b60065461021e565b61017a60025481565b6101ad6108b4565b6102626108dc565b61017a610df8565b61017a60015481565b6102626102d73660046115a4565b610e7f565b61021e611016565b604080516060810182526000808252602082018190529181019190915260068281548110610314576103146115c6565b6000918252602091829020604080516060810182526002909302909101805483526001015464ffffffffff808216948401949094526501000000000090049092169181019190915292915050565b60008061036d611032565b50949350505050565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac1906103cd908590600401611660565b60206040518083038186803b1580156103e557600080fd5b505afa1580156103f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041d919061167a565b92915050565b60008061042e611032565b95945050505050565b61c350815111156104cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160448201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e00000060648201526084015b60405180910390fd5b600454821115610561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160448201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e00000060648201526084016104c6565b620186a08210156105f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f60448201527f20656e71756575652e000000000000000000000000000000000000000000000060648201526084016104c6565b6003548211156106dc5760006002546003548461061191906116c6565b61061b91906116dd565b905060005a90508181116106b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60448201527f6974696e67206275726e2e00000000000000000000000000000000000000000060648201526084016104c6565b60005b825a6106c090846116c6565b10156106d857806106d081611718565b9150506106b4565b5050505b6000333214156106ed575033610706565b5033731111000000000000000000000000000000001111015b60008185858560405160200161071f9493929190611751565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012060608401835280845264ffffffffff42811692850192835243811693850193845260068054600181810183556000838152975160029092027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f81019290925594517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4090910180549651841665010000000000027fffffffffffffffffffffffffffffffffffffffffffff0000000000000000000090971691909316179490941790559154919350610825916116c6565b9050808673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb58888426040516108899392919061179a565b60405180910390a4505050505050565b6000806108a4611032565b50505064ffffffffff1692915050565b60006108d760405180606001604052806021815260200161194860219139610376565b905090565b60043560d81c60093560e890811c90600c35901c6108f8610899565b8364ffffffffff161461098d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60448201527f74206d6174636820657870656374656420737461727420696e6465782e00000060648201526084016104c6565b6109cb6040518060400160405280600d81526020017f4f564d5f53657175656e63657200000000000000000000000000000000000000815250610376565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460448201527f68652053657175656e6365722e0000000000000000000000000000000000000060648201526084016104c6565b6000610a9762ffffff831660106117c3565b610aa290600f611800565b905064ffffffffff8116361015610b3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f7669646560448201527f642e00000000000000000000000000000000000000000000000000000000000060648201526084016104c6565b6005546040805160808101825260008082526020820181905291810182905260608101829052909164ffffffffff169060005b8562ffffff168163ffffffff161015610bcc576000610b928263ffffffff166110ed565b8051909350839150610ba49086611818565b9450826020015184610bb69190611840565b9350508080610bc490611860565b915050610b6e565b5060065464ffffffffff83161115610c8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f417474656d7074656420746f20617070656e64206d6f726520656c656d656e7460448201527f73207468616e2061726520617661696c61626c6520696e20746865207175657560648201527f652e000000000000000000000000000000000000000000000000000000000000608482015260a4016104c6565b6000610c9d8462ffffff8916611884565b63ffffffff169050600080836020015160001415610cc657505060408201516060830151610d37565b60006006610cd56001886118a9565b64ffffffffff1681548110610cec57610cec6115c6565b6000918252602091829020604080516060810182526002909302909101805483526001015464ffffffffff808216948401859052650100000000009091041691018190529093509150505b610d5b610d456001436116c6565b408a62ffffff168564ffffffffff168585611174565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f899610d8684876118a9565b84610d8f610899565b6040805164ffffffffff94851681529390921660208401529082015260600160405180910390a15050600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000001664ffffffffff949094169390931790925550505050505050565b6000610e026108b4565b73ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4757600080fd5b505afa158015610e5b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d791906118c7565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ee557600080fd5b505afa158015610ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1d919061167a565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f6e6c792063616c6c61626c6520627920746865204275726e2041646d696e2e60448201526064016104c6565b60018190556002829055610fc581836117c3565b60038190556002546001546040805192835260208301919091528101919091527fc6ed75e96b8b18b71edc1a6e82a9d677f8268c774a262c624eeb2cf0a8b3e07e9060600160405180910390a15050565b6005546006546000916108d79164ffffffffff909116906118a9565b60008060008060006110426108b4565b73ffffffffffffffffffffffffffffffffffffffff1663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561108757600080fd5b505afa15801561109b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bf91906118e0565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b6111186040518060800160405280600081526020016000815260200160008152602001600081525090565b60006111256010846117c3565b61113090600f611800565b60408051608081018252823560e890811c82526003840135901c6020820152600683013560d890811c92820192909252600b90920135901c60608201529392505050565b600061117e6108b4565b905060008061118b611032565b50509150915060006040518060a001604052808573ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156111e457600080fd5b505afa1580156111f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121c91906118c7565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e82602001518360400151846060015185608001516040516112999493929190611922565b60405180910390a260006112ac8261139f565b905060006112e78360400151866112c39190611840565b6112cd8b87611840565b602890811b9190911760508b901b1760788a901b17901b90565b6040517f2015276c000000000000000000000000000000000000000000000000000000008152600481018490527fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008216602482015290915073ffffffffffffffffffffffffffffffffffffffff871690632015276c90604401600060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b505050505050505050505050505050565b600081602001518260400151836060015184608001516040516020016113c89493929190611922565b604051602081830303815290604052805190602001209050919050565b6000602082840312156113f757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115611448576114486113fe565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561148e5761148e6113fe565b816040528093508581528686860111156114a757600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156114d357600080fd5b813567ffffffffffffffff8111156114ea57600080fd5b8201601f810184136114fb57600080fd5b61150a8482356020840161142d565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461153457600080fd5b50565b60008060006060848603121561154c57600080fd5b833561155781611512565b925060208401359150604084013567ffffffffffffffff81111561157a57600080fd5b8401601f8101861361158b57600080fd5b61159a8682356020840161142d565b9150509250925092565b600080604083850312156115b757600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815180845260005b8181101561161b576020818501810151868301820152016115ff565b8181111561162d576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061167360208301846115f5565b9392505050565b60006020828403121561168c57600080fd5b815161167381611512565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000828210156116d8576116d8611697565b500390565b600082611713577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561174a5761174a611697565b5060010190565b600073ffffffffffffffffffffffffffffffffffffffff80871683528086166020840152508360408301526080606083015261179060808301846115f5565b9695505050505050565b8381526060602082015260006117b360608301856115f5565b9050826040830152949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156117fb576117fb611697565b500290565b6000821982111561181357611813611697565b500190565b600063ffffffff80831681851680830382111561183757611837611697565b01949350505050565b600064ffffffffff80831681851680830382111561183757611837611697565b600063ffffffff8083168181141561187a5761187a611697565b6001019392505050565b600063ffffffff838116908316818110156118a1576118a1611697565b039392505050565b600064ffffffffff838116908316818110156118a1576118a1611697565b6000602082840312156118d957600080fd5b5051919050565b6000602082840312156118f257600080fd5b81517fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008116811461167357600080fd5b84815283602082015282604082015260806060820152600061179060808301846115f556fe436861696e53746f72616765436f6e7461696e65722d4354432d62617463686573a2646970667358221220c8d6d671bb1ae3bd0434364664f960f2eb1e1515f336e3260e4ce79fceb2110764736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061016c5760003560e01c8063876ed5cb116100cd578063d0f8934411610081578063e654b1fb11610066578063e654b1fb146102c0578063edcc4a45146102c9578063f722b41a146102dc57600080fd5b8063d0f89344146102b0578063e561dddc146102b857600080fd5b8063b8f77005116100b2578063b8f7700514610297578063ccf987c81461029f578063cfdf677e146102a857600080fd5b8063876ed5cb146102855780638d38c6c11461028e57600080fd5b80635ae6256d1161012457806378f4b2f21161010957806378f4b2f2146102645780637a167a8a1461026e5780637aa63a861461027d57600080fd5b80635ae6256d146102475780636fee07e01461024f57600080fd5b80632a7f18be116101555780632a7f18be146101d25780633789977014610216578063461a44781461023457600080fd5b80630b3dfa9714610171578063299ca4781461018d575b600080fd5b61017a60035481565b6040519081526020015b60405180910390f35b6000546101ad9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610184565b6101e56101e03660046113e5565b6102e4565b604080518251815260208084015164ffffffffff908116918301919091529282015190921690820152606001610184565b61021e610362565b60405164ffffffffff9091168152602001610184565b6101ad6102423660046114c1565b610376565b61021e610423565b61026261025d366004611537565b610437565b005b61017a620186a081565b60055464ffffffffff1661021e565b61017a610899565b61017a61c35081565b61017a60045481565b60065461021e565b61017a60025481565b6101ad6108b4565b6102626108dc565b61017a610df8565b61017a60015481565b6102626102d73660046115a4565b610e7f565b61021e611016565b604080516060810182526000808252602082018190529181019190915260068281548110610314576103146115c6565b6000918252602091829020604080516060810182526002909302909101805483526001015464ffffffffff808216948401949094526501000000000090049092169181019190915292915050565b60008061036d611032565b50949350505050565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac1906103cd908590600401611660565b60206040518083038186803b1580156103e557600080fd5b505afa1580156103f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041d919061167a565b92915050565b60008061042e611032565b95945050505050565b61c350815111156104cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f5472616e73616374696f6e20646174612073697a652065786365656473206d6160448201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e00000060648201526084015b60405180910390fd5b600454821115610561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f5472616e73616374696f6e20676173206c696d69742065786365656473206d6160448201527f78696d756d20666f7220726f6c6c7570207472616e73616374696f6e2e00000060648201526084016104c6565b620186a08210156105f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5472616e73616374696f6e20676173206c696d697420746f6f206c6f7720746f60448201527f20656e71756575652e000000000000000000000000000000000000000000000060648201526084016104c6565b6003548211156106dc5760006002546003548461061191906116c6565b61061b91906116dd565b905060005a90508181116106b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e73756666696369656e742067617320666f72204c322072617465206c696d60448201527f6974696e67206275726e2e00000000000000000000000000000000000000000060648201526084016104c6565b60005b825a6106c090846116c6565b10156106d857806106d081611718565b9150506106b4565b5050505b6000333214156106ed575033610706565b5033731111000000000000000000000000000000001111015b60008185858560405160200161071f9493929190611751565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252805160209182012060608401835280845264ffffffffff42811692850192835243811693850193845260068054600181810183556000838152975160029092027ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f81019290925594517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4090910180549651841665010000000000027fffffffffffffffffffffffffffffffffffffffffffff0000000000000000000090971691909316179490941790559154919350610825916116c6565b9050808673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f4b388aecf9fa6cc92253704e5975a6129a4f735bdbd99567df4ed0094ee4ceb58888426040516108899392919061179a565b60405180910390a4505050505050565b6000806108a4611032565b50505064ffffffffff1692915050565b60006108d760405180606001604052806021815260200161194860219139610376565b905090565b60043560d81c60093560e890811c90600c35901c6108f8610899565b8364ffffffffff161461098d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60448201527f74206d6174636820657870656374656420737461727420696e6465782e00000060648201526084016104c6565b6109cb6040518060400160405280600d81526020017f4f564d5f53657175656e63657200000000000000000000000000000000000000815250610376565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f46756e6374696f6e2063616e206f6e6c792062652063616c6c6564206279207460448201527f68652053657175656e6365722e0000000000000000000000000000000000000060648201526084016104c6565b6000610a9762ffffff831660106117c3565b610aa290600f611800565b905064ffffffffff8116361015610b3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4e6f7420656e6f756768204261746368436f6e74657874732070726f7669646560448201527f642e00000000000000000000000000000000000000000000000000000000000060648201526084016104c6565b6005546040805160808101825260008082526020820181905291810182905260608101829052909164ffffffffff169060005b8562ffffff168163ffffffff161015610bcc576000610b928263ffffffff166110ed565b8051909350839150610ba49086611818565b9450826020015184610bb69190611840565b9350508080610bc490611860565b915050610b6e565b5060065464ffffffffff83161115610c8c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f417474656d7074656420746f20617070656e64206d6f726520656c656d656e7460448201527f73207468616e2061726520617661696c61626c6520696e20746865207175657560648201527f652e000000000000000000000000000000000000000000000000000000000000608482015260a4016104c6565b6000610c9d8462ffffff8916611884565b63ffffffff169050600080836020015160001415610cc657505060408201516060830151610d37565b60006006610cd56001886118a9565b64ffffffffff1681548110610cec57610cec6115c6565b6000918252602091829020604080516060810182526002909302909101805483526001015464ffffffffff808216948401859052650100000000009091041691018190529093509150505b610d5b610d456001436116c6565b408a62ffffff168564ffffffffff168585611174565b7f602f1aeac0ca2e7a13e281a9ef0ad7838542712ce16780fa2ecffd351f05f899610d8684876118a9565b84610d8f610899565b6040805164ffffffffff94851681529390921660208401529082015260600160405180910390a15050600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000001664ffffffffff949094169390931790925550505050505050565b6000610e026108b4565b73ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4757600080fd5b505afa158015610e5b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d791906118c7565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ee557600080fd5b505afa158015610ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1d919061167a565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f6e6c792063616c6c61626c6520627920746865204275726e2041646d696e2e60448201526064016104c6565b60018190556002829055610fc581836117c3565b60038190556002546001546040805192835260208301919091528101919091527fc6ed75e96b8b18b71edc1a6e82a9d677f8268c774a262c624eeb2cf0a8b3e07e9060600160405180910390a15050565b6005546006546000916108d79164ffffffffff909116906118a9565b60008060008060006110426108b4565b73ffffffffffffffffffffffffffffffffffffffff1663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561108757600080fd5b505afa15801561109b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bf91906118e0565b64ffffffffff602882901c811697605083901c82169750607883901c8216965060a09290921c169350915050565b6111186040518060800160405280600081526020016000815260200160008152602001600081525090565b60006111256010846117c3565b61113090600f611800565b60408051608081018252823560e890811c82526003840135901c6020820152600683013560d890811c92820192909252600b90920135901c60608201529392505050565b600061117e6108b4565b905060008061118b611032565b50509150915060006040518060a001604052808573ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b1580156111e457600080fd5b505afa1580156111f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121c91906118c7565b81526020018a81526020018981526020018464ffffffffff16815260200160405180602001604052806000815250815250905080600001517f127186556e7be68c7e31263195225b4de02820707889540969f62c05cf73525e82602001518360400151846060015185608001516040516112999493929190611922565b60405180910390a260006112ac8261139f565b905060006112e78360400151866112c39190611840565b6112cd8b87611840565b602890811b9190911760508b901b1760788a901b17901b90565b6040517f2015276c000000000000000000000000000000000000000000000000000000008152600481018490527fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008216602482015290915073ffffffffffffffffffffffffffffffffffffffff871690632015276c90604401600060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b505050505050505050505050505050565b600081602001518260400151836060015184608001516040516020016113c89493929190611922565b604051602081830303815290604052805190602001209050919050565b6000602082840312156113f757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115611448576114486113fe565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561148e5761148e6113fe565b816040528093508581528686860111156114a757600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156114d357600080fd5b813567ffffffffffffffff8111156114ea57600080fd5b8201601f810184136114fb57600080fd5b61150a8482356020840161142d565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461153457600080fd5b50565b60008060006060848603121561154c57600080fd5b833561155781611512565b925060208401359150604084013567ffffffffffffffff81111561157a57600080fd5b8401601f8101861361158b57600080fd5b61159a8682356020840161142d565b9150509250925092565b600080604083850312156115b757600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815180845260005b8181101561161b576020818501810151868301820152016115ff565b8181111561162d576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061167360208301846115f5565b9392505050565b60006020828403121561168c57600080fd5b815161167381611512565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000828210156116d8576116d8611697565b500390565b600082611713577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561174a5761174a611697565b5060010190565b600073ffffffffffffffffffffffffffffffffffffffff80871683528086166020840152508360408301526080606083015261179060808301846115f5565b9695505050505050565b8381526060602082015260006117b360608301856115f5565b9050826040830152949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156117fb576117fb611697565b500290565b6000821982111561181357611813611697565b500190565b600063ffffffff80831681851680830382111561183757611837611697565b01949350505050565b600064ffffffffff80831681851680830382111561183757611837611697565b600063ffffffff8083168181141561187a5761187a611697565b6001019392505050565b600063ffffffff838116908316818110156118a1576118a1611697565b039392505050565b600064ffffffffff838116908316818110156118a1576118a1611697565b6000602082840312156118d957600080fd5b5051919050565b6000602082840312156118f257600080fd5b81517fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008116811461167357600080fd5b84815283602082015282604082015260806060820152600061179060808301846115f556fe436861696e53746f72616765436f6e7461696e65722d4354432d62617463686573a2646970667358221220c8d6d671bb1ae3bd0434364664f960f2eb1e1515f336e3260e4ce79fceb2110764736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-CTC-batches.json b/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-CTC-batches.json index 6074054cb39f..9211ba5f0490 100644 --- a/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-CTC-batches.json +++ b/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-CTC-batches.json @@ -1,5 +1,5 @@ { - "address": "0x3Fde63307FBc24f6762EE0506f6e1601ACcAF344", + "address": "0xB9dB55d2c06457fD873476E3e57D792BCdFBe983", "abi": [ { "inputs": [ @@ -183,27 +183,27 @@ "type": "function" } ], - "transactionHash": "0xfbb19391d6bff9bd57eae39064d9b89b2e8d519faac671928b1ec2073d93ba53", + "transactionHash": "0xbcd0378f9524d4b82c0769055f49917dc45c3061bf3f4edafcc8089de4067ac1", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x3Fde63307FBc24f6762EE0506f6e1601ACcAF344", - "transactionIndex": 16, - "gasUsed": "946978", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0xB9dB55d2c06457fD873476E3e57D792BCdFBe983", + "transactionIndex": 55, + "gasUsed": "946990", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6e76fb26a960ffceeda7b120843b6adac9d98ad515a9524ef1e2a6cdf7220e4c", - "transactionHash": "0xfbb19391d6bff9bd57eae39064d9b89b2e8d519faac671928b1ec2073d93ba53", + "blockHash": "0x891cfae757167cbd9d758e27d124be546485463c4ea3b4370f92b533b52b8ed0", + "transactionHash": "0xbcd0378f9524d4b82c0769055f49917dc45c3061bf3f4edafcc8089de4067ac1", "logs": [], - "blockNumber": 6680714, - "cumulativeGasUsed": "6036332", + "blockNumber": 6754104, + "cumulativeGasUsed": "28027107", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "0x2E8234de112b3d020D4310820B8e253056A90D9F", "CanonicalTransactionChain" ], - "solcInputHash": "ad04ab9565e42a9370aa7f055041028d", + "solcInputHash": "9b223da611bcb371fb03d40e6b1620c7", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three distinct Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain\",\"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\":\"ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1/rollup/ChainStorageContainer.sol\":\"ChainStorageContainer\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/rollup/ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_Buffer } from \\\"../../libraries/utils/Lib_Buffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete\\n * functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which\\n * can no longer be used in a fraud proof due to the fraud window having passed, and the associated\\n * chain state or 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 */\\ncontract ChainStorageContainer is IChainStorageContainer, Lib_AddressResolver {\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Lib_Buffer.Buffer;\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer internal buffer;\\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(address _libAddressManager, string memory _owner)\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function setGlobalMetadata(bytes27 _globalMetadata) public onlyOwner {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function getGlobalMetadata() public view returns (bytes27) {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function length() public view returns (uint256) {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function push(bytes32 _object) public onlyOwner {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function push(bytes32 _object, bytes27 _globalMetadata) public onlyOwner {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function get(uint256 _index) public view returns (bytes32) {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function deleteElementsAfterInclusive(uint256 _index) public onlyOwner {\\n buffer.deleteElementsAfterInclusive(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function deleteElementsAfterInclusive(uint256 _index, bytes27 _globalMetadata)\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(uint40(_index), _globalMetadata);\\n }\\n}\\n\",\"keccak256\":\"0x5acd889488ab8eab50d5527d1b18b00214a3242acbf9d89fbeaf188322f81a58\",\"license\":\"MIT\"},\"contracts/L1/rollup/IChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IChainStorageContainer\\n */\\ninterface IChainStorageContainer {\\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(bytes27 _globalMetadata) external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata() external view returns (bytes27);\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length() external view returns (uint256);\\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\\n}\\n\",\"keccak256\":\"0xe55ad72572ec47dc09a02228d0c5a438571c76a41d16d92b35add057811977ce\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\nabstract contract Lib_AddressResolver {\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(address _libAddressManager) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\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(string memory _name) public view returns (address) {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x515c4db671a28e2fe180201f6d11c0208c05f582ca3489fb6b8e81c27659bc62\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping(uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n ) internal {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(Buffer storage _self, bytes32 _value) internal {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(_value, ctx.extraData);\\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(Buffer storage _self, uint256 _index) internal view returns (bytes32) {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(_index < ctx.length, \\\"Index out of bounds.\\\");\\n\\n return _self.buf[_index];\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n ) internal {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(_index < ctx.length, \\\"Index out of bounds.\\\");\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(Buffer storage _self, uint40 _index) internal {\\n BufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(_index, ctx.extraData);\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(Buffer storage _self) internal view returns (uint40) {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(Buffer storage _self, bytes27 _extraData) internal {\\n BufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(Buffer storage _self) internal view returns (bytes27) {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(Buffer storage _self, BufferContext memory _ctx) internal {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(Buffer storage _self) internal view returns (BufferContext memory) {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(\\n context,\\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\\n )\\n extraData := and(\\n context,\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000\\n )\\n }\\n\\n return BufferContext({ length: length, extraData: extraData });\\n }\\n}\\n\",\"keccak256\":\"0x38917b618db448e356c76c999ce9aaca094541eb1f9bc65b06b8d4d84308f056\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x60806040523480156200001157600080fd5b50604051620011b3380380620011b3833981016040819052620000349162000129565b600080546001600160a01b0319166001600160a01b0384161790558051620000649060019060208401906200006d565b50505062000266565b8280546200007b9062000229565b90600052602060002090601f0160209004810192826200009f5760008555620000ea565b82601f10620000ba57805160ff1916838001178555620000ea565b82800160010185558215620000ea579182015b82811115620000ea578251825591602001919060010190620000cd565b50620000f8929150620000fc565b5090565b5b80821115620000f85760008155600101620000fd565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156200013d57600080fd5b82516001600160a01b03811681146200015557600080fd5b602084810151919350906001600160401b03808211156200017557600080fd5b818601915086601f8301126200018a57600080fd5b8151818111156200019f576200019f62000113565b604051601f8201601f19908116603f01168101908382118183101715620001ca57620001ca62000113565b816040528281528986848701011115620001e357600080fd5b600093505b82841015620002075784840186015181850187015292850192620001e8565b82841115620002195760008684830101525b8096505050505050509250929050565b600181811c908216806200023e57607f821691505b602082108114156200026057634e487b7160e01b600052602260045260246000fd5b50919050565b610f3d80620002766000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063461a4478116100815780639507d39a1161005b5780639507d39a146101a4578063b298e36b146101b7578063ccf8f969146101ca57600080fd5b8063461a4478146101695780634651d91e1461017c5780638da5cb5b1461018f57600080fd5b80632015276c116100b25780632015276c146100fe57806329061de214610111578063299ca4781461012457600080fd5b8063167fd681146100ce5780631f7b6d32146100e3575b600080fd5b6100e16100dc366004610c59565b6101e9565b005b6100eb61034d565b6040519081526020015b60405180910390f35b6100e161010c366004610c59565b610365565b6100e161011f366004610c85565b61043d565b6000546101449073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f5565b610144610177366004610cd6565b610517565b6100e161018a366004610da5565b6105c4565b61019761069b565b6040516100f59190610dbe565b6100eb6101b2366004610da5565b610729565b6100e16101c5366004610da5565b61073d565b6101d2610814565b60405164ffffffffff1990911681526020016100f5565b61027c600180546101f990610e31565b80601f016020809104026020016040519081016040528092919081815260200182805461022590610e31565b80156102725780601f1061024757610100808354040283529160200191610272565b820191906000526020600020905b81548152906001019060200180831161025557829003601f168201915b5050505050610517565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461033d57604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e60648201526084015b60405180910390fd5b61034960028383610825565b5050565b6000610359600261090c565b64ffffffffff16905090565b610375600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043157604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b61034960028383610957565b61044d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461050957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b6105146002826109e6565b50565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061056e908590600401610dbe565b60206040518083038186803b15801561058657600080fd5b505afa15801561059a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105be9190610e85565b92915050565b6105d4600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461069057604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610a47565b600180546106a890610e31565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490610e31565b80156107215780601f106106f657610100808354040283529160200191610721565b820191906000526020600020905b81548152906001019060200180831161070457829003601f168201915b505050505081565b60006105be600264ffffffffff8416610aa4565b61074d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461080957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610b73565b60006108206002610bd0565b905090565b600061086784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050806000015164ffffffffff168364ffffffffff16106108e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b64ffffffffff8316815264ffffffffff19821660208201526109068482610c1e565b50505050565b60008061094f83604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b519392505050565b600061099984604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805164ffffffffff16600090815260018601602052604090208490558051909150816109c482610ebb565b64ffffffffff1690525064ffffffffff19821660208201526109068482610c1e565b6000610a2883604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b64ffffffffff19831660208201529050610a428382610c1e565b505050565b6000610a8983604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856108259092919063ffffffff16565b600080610ae784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805190915064ffffffffff168310610b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b50506000908152600191909101602052604090205490565b6000610bb583604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856109579092919063ffffffff16565b600080610c1383604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b602001519392505050565b8051602082015183548183179291908314610c37578285555b5050505050565b803564ffffffffff1981168114610c5457600080fd5b919050565b60008060408385031215610c6c57600080fd5b82359150610c7c60208401610c3e565b90509250929050565b600060208284031215610c9757600080fd5b610ca082610c3e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610ce857600080fd5b813567ffffffffffffffff80821115610d0057600080fd5b818401915084601f830112610d1457600080fd5b813581811115610d2657610d26610ca7565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d6c57610d6c610ca7565b81604052828152876020848701011115610d8557600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208284031215610db757600080fd5b5035919050565b600060208083528351808285015260005b81811015610deb57858101830151858201604001528201610dcf565b81811115610dfd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600181811c90821680610e4557607f821691505b60208210811415610e7f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215610e9757600080fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610ca057600080fd5b600064ffffffffff80831681811415610efd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600101939250505056fea2646970667358221220e1995ee56c4c5e67de41c56ad510b16704727d3ab1fa5bb2e3c62b0bd7c0597564736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063461a4478116100815780639507d39a1161005b5780639507d39a146101a4578063b298e36b146101b7578063ccf8f969146101ca57600080fd5b8063461a4478146101695780634651d91e1461017c5780638da5cb5b1461018f57600080fd5b80632015276c116100b25780632015276c146100fe57806329061de214610111578063299ca4781461012457600080fd5b8063167fd681146100ce5780631f7b6d32146100e3575b600080fd5b6100e16100dc366004610c59565b6101e9565b005b6100eb61034d565b6040519081526020015b60405180910390f35b6100e161010c366004610c59565b610365565b6100e161011f366004610c85565b61043d565b6000546101449073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f5565b610144610177366004610cd6565b610517565b6100e161018a366004610da5565b6105c4565b61019761069b565b6040516100f59190610dbe565b6100eb6101b2366004610da5565b610729565b6100e16101c5366004610da5565b61073d565b6101d2610814565b60405164ffffffffff1990911681526020016100f5565b61027c600180546101f990610e31565b80601f016020809104026020016040519081016040528092919081815260200182805461022590610e31565b80156102725780601f1061024757610100808354040283529160200191610272565b820191906000526020600020905b81548152906001019060200180831161025557829003601f168201915b5050505050610517565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461033d57604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e60648201526084015b60405180910390fd5b61034960028383610825565b5050565b6000610359600261090c565b64ffffffffff16905090565b610375600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043157604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b61034960028383610957565b61044d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461050957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b6105146002826109e6565b50565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061056e908590600401610dbe565b60206040518083038186803b15801561058657600080fd5b505afa15801561059a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105be9190610e85565b92915050565b6105d4600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461069057604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610a47565b600180546106a890610e31565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490610e31565b80156107215780601f106106f657610100808354040283529160200191610721565b820191906000526020600020905b81548152906001019060200180831161070457829003601f168201915b505050505081565b60006105be600264ffffffffff8416610aa4565b61074d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461080957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610b73565b60006108206002610bd0565b905090565b600061086784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050806000015164ffffffffff168364ffffffffff16106108e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b64ffffffffff8316815264ffffffffff19821660208201526109068482610c1e565b50505050565b60008061094f83604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b519392505050565b600061099984604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805164ffffffffff16600090815260018601602052604090208490558051909150816109c482610ebb565b64ffffffffff1690525064ffffffffff19821660208201526109068482610c1e565b6000610a2883604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b64ffffffffff19831660208201529050610a428382610c1e565b505050565b6000610a8983604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856108259092919063ffffffff16565b600080610ae784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805190915064ffffffffff168310610b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b50506000908152600191909101602052604090205490565b6000610bb583604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856109579092919063ffffffff16565b600080610c1383604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b602001519392505050565b8051602082015183548183179291908314610c37578285555b5050505050565b803564ffffffffff1981168114610c5457600080fd5b919050565b60008060408385031215610c6c57600080fd5b82359150610c7c60208401610c3e565b90509250929050565b600060208284031215610c9757600080fd5b610ca082610c3e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610ce857600080fd5b813567ffffffffffffffff80821115610d0057600080fd5b818401915084601f830112610d1457600080fd5b813581811115610d2657610d26610ca7565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d6c57610d6c610ca7565b81604052828152876020848701011115610d8557600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208284031215610db757600080fd5b5035919050565b600060208083528351808285015260005b81811015610deb57858101830151858201604001528201610dcf565b81811115610dfd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600181811c90821680610e4557607f821691505b60208210811415610e7f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215610e9757600080fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610ca057600080fd5b600064ffffffffff80831681811415610efd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600101939250505056fea2646970667358221220e1995ee56c4c5e67de41c56ad510b16704727d3ab1fa5bb2e3c62b0bd7c0597564736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-SCC-batches.json b/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-SCC-batches.json index 03f70cdff303..ce4728cc9de8 100644 --- a/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-SCC-batches.json +++ b/packages/contracts/deployments/goerli-nightly/ChainStorageContainer-SCC-batches.json @@ -1,5 +1,5 @@ { - "address": "0x3eFade32F8430fb8FA93123A924a7572903507bc", + "address": "0x9FBeFbC8Ae66e2a32200D5C1267AAD2B4e517044", "abi": [ { "inputs": [ @@ -183,27 +183,27 @@ "type": "function" } ], - "transactionHash": "0xae2b7fb2ec41826a0b68861234d3913f3ec3afbfb1538b9d7c9f45c1b7ebc007", + "transactionHash": "0x095fdbcdcb6220d91ad98827643ace2d2ae0a2032dcd2c3131b473b44723a613", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x3eFade32F8430fb8FA93123A924a7572903507bc", - "transactionIndex": 1, - "gasUsed": "946918", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x9FBeFbC8Ae66e2a32200D5C1267AAD2B4e517044", + "transactionIndex": 19, + "gasUsed": "946930", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd84546c3c8d03885829f43947f8d9ad3ff424612cf3cfdf7370cc00250949aa4", - "transactionHash": "0xae2b7fb2ec41826a0b68861234d3913f3ec3afbfb1538b9d7c9f45c1b7ebc007", + "blockHash": "0x64859ec62d47de4496165eb11a07f9a254330c372b22caabdc4c864ed038f438", + "transactionHash": "0x095fdbcdcb6220d91ad98827643ace2d2ae0a2032dcd2c3131b473b44723a613", "logs": [], - "blockNumber": 6680718, - "cumulativeGasUsed": "1095328", + "blockNumber": 6754167, + "cumulativeGasUsed": "7145563", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "0x2E8234de112b3d020D4310820B8e253056A90D9F", "StateCommitmentChain" ], - "solcInputHash": "0be4bc8d116b632300d43e314f15da0c", + "solcInputHash": "44cb02469758083657d0b22a42632103", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_owner\",\"type\":\"string\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"deleteElementsAfterInclusive\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getGlobalMetadata\",\"outputs\":[{\"internalType\":\"bytes27\",\"name\":\"\",\"type\":\"bytes27\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"length\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"},{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_object\",\"type\":\"bytes32\"}],\"name\":\"push\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes27\",\"name\":\"_globalMetadata\",\"type\":\"bytes27\"}],\"name\":\"setGlobalMetadata\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The Chain Storage Container provides its owner contract with read, write and delete functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which can no longer be used in a fraud proof due to the fraud window having passed, and the associated chain state or transactions being finalized. Three distinct Chain Storage Containers will be deployed on Layer 1: 1. Stores transaction batches for the Canonical Transaction Chain 2. Stores queued transactions for the Canonical Transaction Chain 3. Stores chain state batches for the State Commitment Chain\",\"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\":\"ChainStorageContainer\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"deleteElementsAfterInclusive(uint256)\":{\"notice\":\"Removes all objects after and including a given index.\"},\"deleteElementsAfterInclusive(uint256,bytes27)\":{\"notice\":\"Removes all objects after and including a given index. Also allows setting the global metadata field.\"},\"get(uint256)\":{\"notice\":\"Retrieves an object from the container.\"},\"getGlobalMetadata()\":{\"notice\":\"Retrieves the container's global metadata field.\"},\"length()\":{\"notice\":\"Retrieves the number of objects stored in the container.\"},\"push(bytes32)\":{\"notice\":\"Pushes an object into the container.\"},\"push(bytes32,bytes27)\":{\"notice\":\"Pushes an object into the container. Function allows setting the global metadata since we'll need to touch the \\\"length\\\" storage slot anyway, which also contains the global metadata (it's an optimization).\"},\"resolve(string)\":{\"notice\":\"Resolves the address associated with a given name.\"},\"setGlobalMetadata(bytes27)\":{\"notice\":\"Sets the container's global metadata field. We're using `bytes27` here because we use five bytes to maintain the length of the underlying data structure, meaning we have an extra 27 bytes to store arbitrary data.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1/rollup/ChainStorageContainer.sol\":\"ChainStorageContainer\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/rollup/ChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_Buffer } from \\\"../../libraries/utils/Lib_Buffer.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\n\\n/* Interface Imports */\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title ChainStorageContainer\\n * @dev The Chain Storage Container provides its owner contract with read, write and delete\\n * functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which\\n * can no longer be used in a fraud proof due to the fraud window having passed, and the associated\\n * chain state or 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 */\\ncontract ChainStorageContainer is IChainStorageContainer, Lib_AddressResolver {\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Lib_Buffer.Buffer;\\n\\n /*************\\n * Variables *\\n *************/\\n\\n string public owner;\\n Lib_Buffer.Buffer internal buffer;\\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(address _libAddressManager, string memory _owner)\\n Lib_AddressResolver(_libAddressManager)\\n {\\n owner = _owner;\\n }\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n modifier onlyOwner() {\\n require(\\n msg.sender == resolve(owner),\\n \\\"ChainStorageContainer: Function can only be called by the owner.\\\"\\n );\\n _;\\n }\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function setGlobalMetadata(bytes27 _globalMetadata) public onlyOwner {\\n return buffer.setExtraData(_globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function getGlobalMetadata() public view returns (bytes27) {\\n return buffer.getExtraData();\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function length() public view returns (uint256) {\\n return uint256(buffer.getLength());\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function push(bytes32 _object) public onlyOwner {\\n buffer.push(_object);\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function push(bytes32 _object, bytes27 _globalMetadata) public onlyOwner {\\n buffer.push(_object, _globalMetadata);\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function get(uint256 _index) public view returns (bytes32) {\\n return buffer.get(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function deleteElementsAfterInclusive(uint256 _index) public onlyOwner {\\n buffer.deleteElementsAfterInclusive(uint40(_index));\\n }\\n\\n /**\\n * @inheritdoc IChainStorageContainer\\n */\\n // slither-disable-next-line external-function\\n function deleteElementsAfterInclusive(uint256 _index, bytes27 _globalMetadata)\\n public\\n onlyOwner\\n {\\n buffer.deleteElementsAfterInclusive(uint40(_index), _globalMetadata);\\n }\\n}\\n\",\"keccak256\":\"0x5acd889488ab8eab50d5527d1b18b00214a3242acbf9d89fbeaf188322f81a58\",\"license\":\"MIT\"},\"contracts/L1/rollup/IChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IChainStorageContainer\\n */\\ninterface IChainStorageContainer {\\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(bytes27 _globalMetadata) external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata() external view returns (bytes27);\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length() external view returns (uint256);\\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\\n}\\n\",\"keccak256\":\"0xe55ad72572ec47dc09a02228d0c5a438571c76a41d16d92b35add057811977ce\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\nabstract contract Lib_AddressResolver {\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(address _libAddressManager) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\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(string memory _name) public view returns (address) {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x515c4db671a28e2fe180201f6d11c0208c05f582ca3489fb6b8e81c27659bc62\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_Buffer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_Buffer\\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\\n * overwritable \\\"extra data\\\" field so we can store more information with a single SSTORE.\\n */\\nlibrary Lib_Buffer {\\n /*************\\n * Libraries *\\n *************/\\n\\n using Lib_Buffer for Buffer;\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct Buffer {\\n bytes32 context;\\n mapping(uint256 => bytes32) buf;\\n }\\n\\n struct BufferContext {\\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\\n // need in an array and we get an extra 27 bytes of extra data to play with.\\n uint40 length;\\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\\n // squeezing out some gas optimizations.\\n bytes27 extraData;\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n * @param _extraData Global extra data.\\n */\\n function push(\\n Buffer storage _self,\\n bytes32 _value,\\n bytes27 _extraData\\n ) internal {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.buf[ctx.length] = _value;\\n\\n // Bump the global index and insert our extra data, then save the context.\\n ctx.length++;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Pushes a single element to the buffer.\\n * @param _self Buffer to access.\\n * @param _value Value to push to the buffer.\\n */\\n function push(Buffer storage _self, bytes32 _value) internal {\\n BufferContext memory ctx = _self.getContext();\\n\\n _self.push(_value, ctx.extraData);\\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(Buffer storage _self, uint256 _index) internal view returns (bytes32) {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(_index < ctx.length, \\\"Index out of bounds.\\\");\\n\\n return _self.buf[_index];\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n * @param _extraData Optional global extra data.\\n */\\n function deleteElementsAfterInclusive(\\n Buffer storage _self,\\n uint40 _index,\\n bytes27 _extraData\\n ) internal {\\n BufferContext memory ctx = _self.getContext();\\n\\n require(_index < ctx.length, \\\"Index out of bounds.\\\");\\n\\n // Set our length and extra data, save the context.\\n ctx.length = _index;\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Deletes all elements after (and including) a given index.\\n * @param _self Buffer to access.\\n * @param _index Index of the element to delete from (inclusive).\\n */\\n function deleteElementsAfterInclusive(Buffer storage _self, uint40 _index) internal {\\n BufferContext memory ctx = _self.getContext();\\n _self.deleteElementsAfterInclusive(_index, ctx.extraData);\\n }\\n\\n /**\\n * Retrieves the current global index.\\n * @param _self Buffer to access.\\n * @return Current global index.\\n */\\n function getLength(Buffer storage _self) internal view returns (uint40) {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.length;\\n }\\n\\n /**\\n * Changes current global extra data.\\n * @param _self Buffer to access.\\n * @param _extraData New global extra data.\\n */\\n function setExtraData(Buffer storage _self, bytes27 _extraData) internal {\\n BufferContext memory ctx = _self.getContext();\\n ctx.extraData = _extraData;\\n _self.setContext(ctx);\\n }\\n\\n /**\\n * Retrieves the current global extra data.\\n * @param _self Buffer to access.\\n * @return Current global extra data.\\n */\\n function getExtraData(Buffer storage _self) internal view returns (bytes27) {\\n BufferContext memory ctx = _self.getContext();\\n return ctx.extraData;\\n }\\n\\n /**\\n * Sets the current buffer context.\\n * @param _self Buffer to access.\\n * @param _ctx Current buffer context.\\n */\\n function setContext(Buffer storage _self, BufferContext memory _ctx) internal {\\n bytes32 context;\\n uint40 length = _ctx.length;\\n bytes27 extraData = _ctx.extraData;\\n assembly {\\n context := length\\n context := or(context, extraData)\\n }\\n\\n if (_self.context != context) {\\n _self.context = context;\\n }\\n }\\n\\n /**\\n * Retrieves the current buffer context.\\n * @param _self Buffer to access.\\n * @return Current buffer context.\\n */\\n function getContext(Buffer storage _self) internal view returns (BufferContext memory) {\\n bytes32 context = _self.context;\\n uint40 length;\\n bytes27 extraData;\\n assembly {\\n length := and(\\n context,\\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\\n )\\n extraData := and(\\n context,\\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000\\n )\\n }\\n\\n return BufferContext({ length: length, extraData: extraData });\\n }\\n}\\n\",\"keccak256\":\"0x38917b618db448e356c76c999ce9aaca094541eb1f9bc65b06b8d4d84308f056\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x60806040523480156200001157600080fd5b50604051620011b3380380620011b3833981016040819052620000349162000129565b600080546001600160a01b0319166001600160a01b0384161790558051620000649060019060208401906200006d565b50505062000266565b8280546200007b9062000229565b90600052602060002090601f0160209004810192826200009f5760008555620000ea565b82601f10620000ba57805160ff1916838001178555620000ea565b82800160010185558215620000ea579182015b82811115620000ea578251825591602001919060010190620000cd565b50620000f8929150620000fc565b5090565b5b80821115620000f85760008155600101620000fd565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156200013d57600080fd5b82516001600160a01b03811681146200015557600080fd5b602084810151919350906001600160401b03808211156200017557600080fd5b818601915086601f8301126200018a57600080fd5b8151818111156200019f576200019f62000113565b604051601f8201601f19908116603f01168101908382118183101715620001ca57620001ca62000113565b816040528281528986848701011115620001e357600080fd5b600093505b82841015620002075784840186015181850187015292850192620001e8565b82841115620002195760008684830101525b8096505050505050509250929050565b600181811c908216806200023e57607f821691505b602082108114156200026057634e487b7160e01b600052602260045260246000fd5b50919050565b610f3d80620002766000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063461a4478116100815780639507d39a1161005b5780639507d39a146101a4578063b298e36b146101b7578063ccf8f969146101ca57600080fd5b8063461a4478146101695780634651d91e1461017c5780638da5cb5b1461018f57600080fd5b80632015276c116100b25780632015276c146100fe57806329061de214610111578063299ca4781461012457600080fd5b8063167fd681146100ce5780631f7b6d32146100e3575b600080fd5b6100e16100dc366004610c59565b6101e9565b005b6100eb61034d565b6040519081526020015b60405180910390f35b6100e161010c366004610c59565b610365565b6100e161011f366004610c85565b61043d565b6000546101449073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f5565b610144610177366004610cd6565b610517565b6100e161018a366004610da5565b6105c4565b61019761069b565b6040516100f59190610dbe565b6100eb6101b2366004610da5565b610729565b6100e16101c5366004610da5565b61073d565b6101d2610814565b60405164ffffffffff1990911681526020016100f5565b61027c600180546101f990610e31565b80601f016020809104026020016040519081016040528092919081815260200182805461022590610e31565b80156102725780601f1061024757610100808354040283529160200191610272565b820191906000526020600020905b81548152906001019060200180831161025557829003601f168201915b5050505050610517565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461033d57604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e60648201526084015b60405180910390fd5b61034960028383610825565b5050565b6000610359600261090c565b64ffffffffff16905090565b610375600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043157604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b61034960028383610957565b61044d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461050957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b6105146002826109e6565b50565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061056e908590600401610dbe565b60206040518083038186803b15801561058657600080fd5b505afa15801561059a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105be9190610e85565b92915050565b6105d4600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461069057604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610a47565b600180546106a890610e31565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490610e31565b80156107215780601f106106f657610100808354040283529160200191610721565b820191906000526020600020905b81548152906001019060200180831161070457829003601f168201915b505050505081565b60006105be600264ffffffffff8416610aa4565b61074d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461080957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610b73565b60006108206002610bd0565b905090565b600061086784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050806000015164ffffffffff168364ffffffffff16106108e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b64ffffffffff8316815264ffffffffff19821660208201526109068482610c1e565b50505050565b60008061094f83604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b519392505050565b600061099984604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805164ffffffffff16600090815260018601602052604090208490558051909150816109c482610ebb565b64ffffffffff1690525064ffffffffff19821660208201526109068482610c1e565b6000610a2883604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b64ffffffffff19831660208201529050610a428382610c1e565b505050565b6000610a8983604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856108259092919063ffffffff16565b600080610ae784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805190915064ffffffffff168310610b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b50506000908152600191909101602052604090205490565b6000610bb583604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856109579092919063ffffffff16565b600080610c1383604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b602001519392505050565b8051602082015183548183179291908314610c37578285555b5050505050565b803564ffffffffff1981168114610c5457600080fd5b919050565b60008060408385031215610c6c57600080fd5b82359150610c7c60208401610c3e565b90509250929050565b600060208284031215610c9757600080fd5b610ca082610c3e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610ce857600080fd5b813567ffffffffffffffff80821115610d0057600080fd5b818401915084601f830112610d1457600080fd5b813581811115610d2657610d26610ca7565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d6c57610d6c610ca7565b81604052828152876020848701011115610d8557600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208284031215610db757600080fd5b5035919050565b600060208083528351808285015260005b81811015610deb57858101830151858201604001528201610dcf565b81811115610dfd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600181811c90821680610e4557607f821691505b60208210811415610e7f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215610e9757600080fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610ca057600080fd5b600064ffffffffff80831681811415610efd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600101939250505056fea2646970667358221220e1995ee56c4c5e67de41c56ad510b16704727d3ab1fa5bb2e3c62b0bd7c0597564736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063461a4478116100815780639507d39a1161005b5780639507d39a146101a4578063b298e36b146101b7578063ccf8f969146101ca57600080fd5b8063461a4478146101695780634651d91e1461017c5780638da5cb5b1461018f57600080fd5b80632015276c116100b25780632015276c146100fe57806329061de214610111578063299ca4781461012457600080fd5b8063167fd681146100ce5780631f7b6d32146100e3575b600080fd5b6100e16100dc366004610c59565b6101e9565b005b6100eb61034d565b6040519081526020015b60405180910390f35b6100e161010c366004610c59565b610365565b6100e161011f366004610c85565b61043d565b6000546101449073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f5565b610144610177366004610cd6565b610517565b6100e161018a366004610da5565b6105c4565b61019761069b565b6040516100f59190610dbe565b6100eb6101b2366004610da5565b610729565b6100e16101c5366004610da5565b61073d565b6101d2610814565b60405164ffffffffff1990911681526020016100f5565b61027c600180546101f990610e31565b80601f016020809104026020016040519081016040528092919081815260200182805461022590610e31565b80156102725780601f1061024757610100808354040283529160200191610272565b820191906000526020600020905b81548152906001019060200180831161025557829003601f168201915b5050505050610517565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461033d57604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e60648201526084015b60405180910390fd5b61034960028383610825565b5050565b6000610359600261090c565b64ffffffffff16905090565b610375600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043157604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b61034960028383610957565b61044d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461050957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b6105146002826109e6565b50565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061056e908590600401610dbe565b60206040518083038186803b15801561058657600080fd5b505afa15801561059a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105be9190610e85565b92915050565b6105d4600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461069057604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610a47565b600180546106a890610e31565b80601f01602080910402602001604051908101604052809291908181526020018280546106d490610e31565b80156107215780601f106106f657610100808354040283529160200191610721565b820191906000526020600020905b81548152906001019060200180831161070457829003601f168201915b505050505081565b60006105be600264ffffffffff8416610aa4565b61074d600180546101f990610e31565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461080957604080517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260248101919091527f436861696e53746f72616765436f6e7461696e65723a2046756e6374696f6e2060448201527f63616e206f6e6c792062652063616c6c656420627920746865206f776e65722e6064820152608401610334565b610514600282610b73565b60006108206002610bd0565b905090565b600061086784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050806000015164ffffffffff168364ffffffffff16106108e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b64ffffffffff8316815264ffffffffff19821660208201526109068482610c1e565b50505050565b60008061094f83604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b519392505050565b600061099984604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805164ffffffffff16600090815260018601602052604090208490558051909150816109c482610ebb565b64ffffffffff1690525064ffffffffff19821660208201526109068482610c1e565b6000610a2883604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b64ffffffffff19831660208201529050610a428382610c1e565b505050565b6000610a8983604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856108259092919063ffffffff16565b600080610ae784604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b805190915064ffffffffff168310610b5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e646578206f7574206f6620626f756e64732e0000000000000000000000006044820152606401610334565b50506000908152600191909101602052604090205490565b6000610bb583604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b9050610a42828260200151856109579092919063ffffffff16565b600080610c1383604080518082019091526000808252602082015250546040805180820190915264ffffffffff8216815264ffffffffff19909116602082015290565b602001519392505050565b8051602082015183548183179291908314610c37578285555b5050505050565b803564ffffffffff1981168114610c5457600080fd5b919050565b60008060408385031215610c6c57600080fd5b82359150610c7c60208401610c3e565b90509250929050565b600060208284031215610c9757600080fd5b610ca082610c3e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610ce857600080fd5b813567ffffffffffffffff80821115610d0057600080fd5b818401915084601f830112610d1457600080fd5b813581811115610d2657610d26610ca7565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610d6c57610d6c610ca7565b81604052828152876020848701011115610d8557600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208284031215610db757600080fd5b5035919050565b600060208083528351808285015260005b81811015610deb57858101830151858201604001528201610dcf565b81811115610dfd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600181811c90821680610e4557607f821691505b60208210811415610e7f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215610e9757600080fd5b815173ffffffffffffffffffffffffffffffffffffffff81168114610ca057600080fd5b600064ffffffffff80831681811415610efd577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600101939250505056fea2646970667358221220e1995ee56c4c5e67de41c56ad510b16704727d3ab1fa5bb2e3c62b0bd7c0597564736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/ChugSplashDictator.json b/packages/contracts/deployments/goerli-nightly/ChugSplashDictator.json index 046cb821c69f..e7fbad908a58 100644 --- a/packages/contracts/deployments/goerli-nightly/ChugSplashDictator.json +++ b/packages/contracts/deployments/goerli-nightly/ChugSplashDictator.json @@ -1,5 +1,5 @@ { - "address": "0xf2b91614E8826f7A01b13dF8AeC5501403C9B0Fd", + "address": "0x2523d13F455531446950DB9C3a88c06431997D97", "abi": [ { "inputs": [ @@ -167,28 +167,28 @@ "type": "function" } ], - "transactionHash": "0x7def186f652eda213f178ca0f287217030cdee226893ebdc6b0ccc0405a14edc", + "transactionHash": "0x2a9a6a33e3601ab2bca01f16f0c2c21f23cc0e39a142b7d218de42fdc2caa0a4", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0xf2b91614E8826f7A01b13dF8AeC5501403C9B0Fd", - "transactionIndex": 7, - "gasUsed": "600252", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x2523d13F455531446950DB9C3a88c06431997D97", + "transactionIndex": 23, + "gasUsed": "600240", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb557f1dcb15b221968f0c33b0f9bcbf0dee42374f9fd00aeb51c64a962bfe5c1", - "transactionHash": "0x7def186f652eda213f178ca0f287217030cdee226893ebdc6b0ccc0405a14edc", + "blockHash": "0xed27d12347f019f5ac699739ca67d6d0ef56ff54b49f8955ed171000288580f9", + "transactionHash": "0x2a9a6a33e3601ab2bca01f16f0c2c21f23cc0e39a142b7d218de42fdc2caa0a4", "logs": [], - "blockNumber": 6680783, - "cumulativeGasUsed": "1328789", + "blockNumber": 6754215, + "cumulativeGasUsed": "5796759", "status": 1, "byzantium": true }, "args": [ - "0xe352dDE5d101BB422f78C3eD77f2cD8f0b9B0f82", + "0x4600216A9C733658A48Ef83Ad218BA221514894E", "0x4F3F400c20448D33ECc12E7d289F49dA7fC51736", "0x2e552c5e1eaa6bcb8ea89d558309b9a8a26daa8cfe310169433a912499962b95", "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x00000000000000000000000084a374C4082252FCEc215C242513c15551b15976", + "0x000000000000000000000000497cdD0F36b3D3012C1fEa605332E77E942C494a", "0x0000000000000000000000000000000000000000000000000000000000000001", "0x0000000000000000000000004200000000000000000000000000000000000010" ], diff --git a/packages/contracts/deployments/goerli-nightly/L1StandardBridge_for_verification_only.json b/packages/contracts/deployments/goerli-nightly/L1StandardBridge_for_verification_only.json index 782da51eb9b9..9477eb317b60 100644 --- a/packages/contracts/deployments/goerli-nightly/L1StandardBridge_for_verification_only.json +++ b/packages/contracts/deployments/goerli-nightly/L1StandardBridge_for_verification_only.json @@ -1,5 +1,5 @@ { - "address": "0x8f920A82C232585E83f02C7971Cd6C916Bc21f72", + "address": "0xD579E17f207B3056A6212d1ccBA87F50DDE01785", "abi": [ { "inputs": [], @@ -412,24 +412,24 @@ "type": "receive" } ], - "transactionHash": "0xa7caf997aeaebb70efca4c38a29e667f9189cb3325e865334d8cbb59ac8c48f1", + "transactionHash": "0x7e570f4d8d5ed59f5056412cb9c67827cbe50f551ed2a485f6da2ebfc5fc52b2", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x8f920A82C232585E83f02C7971Cd6C916Bc21f72", - "transactionIndex": 4, + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0xD579E17f207B3056A6212d1ccBA87F50DDE01785", + "transactionIndex": 20, "gasUsed": "1467241", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2be2a75d537b7ffeccdecb4b05adc5beb71d5fc9fc0f79c208f5d697ad533971", - "transactionHash": "0xa7caf997aeaebb70efca4c38a29e667f9189cb3325e865334d8cbb59ac8c48f1", + "blockHash": "0x481df291685019ed366df2cd146d1c62683bd08d1906a309a4e7f3a5b1a60d62", + "transactionHash": "0x7e570f4d8d5ed59f5056412cb9c67827cbe50f551ed2a485f6da2ebfc5fc52b2", "logs": [], - "blockNumber": 6680819, - "cumulativeGasUsed": "1704475", + "blockNumber": 6754229, + "cumulativeGasUsed": "10300004", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "1bd14ab7f178fa738825499e24d5538d", + "solcInputHash": "71eef09945fcfbedc76225dfa2da1007", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_l2Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"ERC20DepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_l1Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_l2Token\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"ERC20WithdrawalFinalized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"ETHDepositInitiated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"ETHWithdrawalFinalized\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_l2Token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_l2Gas\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"depositERC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_l2Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_l2Gas\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"depositERC20To\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_l2Gas\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"depositETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_l2Gas\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"depositETHTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"donateETH\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l1Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_l2Token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"finalizeERC20Withdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"finalizeETHWithdrawal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l1messenger\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_l2TokenBridge\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2TokenBridge\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard tokens that are in use on L2. It synchronizes a corresponding L2 Bridge, informing it of deposits and listening to it for newly finalized withdrawals.\",\"kind\":\"dev\",\"methods\":{\"depositERC20(address,address,uint256,uint32,bytes)\":{\"details\":\"deposit an amount of the ERC20 to the caller's balance on L2.\",\"params\":{\"_amount\":\"Amount of the ERC20 to deposit\",\"_data\":\"Optional data to forward to L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum length, these contracts provide no guarantees about its content.\",\"_l1Token\":\"Address of the L1 ERC20 we are depositing\",\"_l2Gas\":\"Gas limit required to complete the deposit on L2.\",\"_l2Token\":\"Address of the L1 respective L2 ERC20\"}},\"depositERC20To(address,address,address,uint256,uint32,bytes)\":{\"details\":\"deposit an amount of ERC20 to a recipient's balance on L2.\",\"params\":{\"_amount\":\"Amount of the ERC20 to deposit.\",\"_data\":\"Optional data to forward to L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum length, these contracts provide no guarantees about its content.\",\"_l1Token\":\"Address of the L1 ERC20 we are depositing\",\"_l2Gas\":\"Gas limit required to complete the deposit on L2.\",\"_l2Token\":\"Address of the L1 respective L2 ERC20\",\"_to\":\"L2 address to credit the withdrawal to.\"}},\"depositETH(uint32,bytes)\":{\"details\":\"Deposit an amount of the ETH to the caller's balance on L2.\",\"params\":{\"_data\":\"Optional data to forward to L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum length, these contracts provide no guarantees about its content.\",\"_l2Gas\":\"Gas limit required to complete the deposit on L2.\"}},\"depositETHTo(address,uint32,bytes)\":{\"details\":\"Deposit an amount of ETH to a recipient's balance on L2.\",\"params\":{\"_data\":\"Optional data to forward to L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum length, these contracts provide no guarantees about its content.\",\"_l2Gas\":\"Gas limit required to complete the deposit on L2.\",\"_to\":\"L2 address to credit the withdrawal to.\"}},\"donateETH()\":{\"details\":\"Adds ETH balance to the account. This is meant to allow for ETH to be migrated from an old gateway to a new gateway. NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the old contract\"},\"finalizeERC20Withdrawal(address,address,address,address,uint256,bytes)\":{\"details\":\"Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the L1 ERC20 token. This call will fail if the initialized withdrawal from L2 has not been finalized.\",\"params\":{\"_amount\":\"Amount of the ERC20 to deposit.\",\"_data\":\"Data provided by the sender on L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum length, these contracts provide no guarantees about its content.\",\"_from\":\"L2 address initiating the transfer.\",\"_l1Token\":\"Address of L1 token to finalizeWithdrawal for.\",\"_l2Token\":\"Address of L2 token where withdrawal was initiated.\",\"_to\":\"L1 address to credit the withdrawal to.\"}},\"finalizeETHWithdrawal(address,address,uint256,bytes)\":{\"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 ERC20 to deposit.\",\"_data\":\"Optional data to forward to L2. This data is provided solely as a convenience for external contracts. Aside from enforcing a maximum length, these contracts provide no guarantees about its content.\",\"_from\":\"L2 address initiating the transfer.\",\"_to\":\"L1 address to credit the withdrawal to.\"}},\"initialize(address,address)\":{\"params\":{\"_l1messenger\":\"L1 Messenger address being used for cross-chain communications.\",\"_l2TokenBridge\":\"L2 standard bridge address.\"}}},\"stateVariables\":{\"l2TokenBridge\":{\"details\":\"get the address of the corresponding L2 bridge contract.\",\"return\":\"Address of the corresponding L2 bridge contract.\",\"returns\":{\"_0\":\"Address of the corresponding L2 bridge contract.\"}}},\"title\":\"L1StandardBridge\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/L1/messaging/L1StandardBridge.sol\":\"L1StandardBridge\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x027b891937d20ccf213fdb9c31531574256de774bda99d3a70ecef6e1913ed2a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n // safeApprove should only be called when setting an initial allowance,\\n // or when resetting it to zero. To increase and decrease it, use\\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n /**\\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n * on the return value: the return value is optional (but if data is returned, it must not be false).\\n * @param token The token targeted by the call.\\n * @param data The call data (encoded using abi.encode or one of its variants).\\n */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x02348b2e4b9f3200c7e3907c5c2661643a6d8520e9f79939fbb9b4005a54894d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n assembly {\\n size := extcodesize(account)\\n }\\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 (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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) 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 (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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal 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 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\":\"0x3336baae5cf23e94274d75336e2d412193be508504aee185e61dc7d58cd05c8a\",\"license\":\"MIT\"},\"contracts/L1/messaging/IL1ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IL1ERC20Bridge\\n */\\ninterface IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event ERC20DepositInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ERC20WithdrawalFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L2 bridge contract.\\n * @return Address of the corresponding L2 bridge contract.\\n */\\n function l2TokenBridge() external returns (address);\\n\\n /**\\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _amount Amount of the ERC20 to deposit\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20(\\n address _l1Token,\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositERC20To(\\n address _l1Token,\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ERC20 token.\\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\\n *\\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Data provided by the sender on L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeERC20Withdrawal(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x69f831896dcbb6bef4f2d6c8be6cd1bf352f5910074d3ce973b9f8e0a4f4c1dd\",\"license\":\"MIT\"},\"contracts/L1/messaging/IL1StandardBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\nimport \\\"./IL1ERC20Bridge.sol\\\";\\n\\n/**\\n * @title IL1StandardBridge\\n */\\ninterface IL1StandardBridge is IL1ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n event ETHDepositInitiated(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event ETHWithdrawalFinalized(\\n address indexed _from,\\n address indexed _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\\n\\n /**\\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\\n * @param _to L2 address to credit the withdrawal to.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function depositETHTo(\\n address _to,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external payable;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\\n * before the withdrawal is finalized.\\n * @param _from L2 address initiating the transfer.\\n * @param _to L1 address to credit the withdrawal to.\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeETHWithdrawal(\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x3d511f1bcea86aa88a9c41798926ea75b5b3f455c0377e63223a123a9e714ddc\",\"license\":\"MIT\"},\"contracts/L1/messaging/L1StandardBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Interface Imports */\\nimport { IL1StandardBridge } from \\\"./IL1StandardBridge.sol\\\";\\nimport { IL1ERC20Bridge } from \\\"./IL1ERC20Bridge.sol\\\";\\nimport { IL2ERC20Bridge } from \\\"../../L2/messaging/IL2ERC20Bridge.sol\\\";\\nimport { IERC20 } from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/* Library Imports */\\nimport { CrossDomainEnabled } from \\\"../../libraries/bridge/CrossDomainEnabled.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport { Address } from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\nimport { SafeERC20 } from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\n\\n/**\\n * @title L1StandardBridge\\n * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard\\n * tokens that are in use on L2. It synchronizes a corresponding L2 Bridge, informing it of deposits\\n * and listening to it for newly finalized withdrawals.\\n *\\n */\\ncontract L1StandardBridge is IL1StandardBridge, CrossDomainEnabled {\\n using SafeERC20 for IERC20;\\n\\n /********************************\\n * External Contract References *\\n ********************************/\\n\\n address public l2TokenBridge;\\n\\n // Maps L1 token to L2 token to balance of the L1 token deposited\\n mapping(address => mapping(address => uint256)) public deposits;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n // This contract lives behind a proxy, so the constructor parameters will go unused.\\n constructor() CrossDomainEnabled(address(0)) {}\\n\\n /******************\\n * Initialization *\\n ******************/\\n\\n /**\\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\\n * @param _l2TokenBridge L2 standard bridge address.\\n */\\n // slither-disable-next-line external-function\\n function initialize(address _l1messenger, address _l2TokenBridge) public {\\n require(messenger == address(0), \\\"Contract has already been initialized.\\\");\\n messenger = _l1messenger;\\n l2TokenBridge = _l2TokenBridge;\\n }\\n\\n /**************\\n * Depositing *\\n **************/\\n\\n /** @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious\\n * contract via initcode, but it takes care of the user error we want to avoid.\\n */\\n modifier onlyEOA() {\\n // Used to stop deposits from contracts (avoid accidentally lost tokens)\\n require(!Address.isContract(msg.sender), \\\"Account not EOA\\\");\\n _;\\n }\\n\\n /**\\n * @dev This function can be called with no data\\n * to deposit an amount of ETH to the caller's balance on L2.\\n * Since the receive function doesn't take data, a conservative\\n * default amount is forwarded to L2.\\n */\\n receive() external payable onlyEOA {\\n _initiateETHDeposit(msg.sender, msg.sender, 200_000, bytes(\\\"\\\"));\\n }\\n\\n /**\\n * @inheritdoc IL1StandardBridge\\n */\\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable onlyEOA {\\n _initiateETHDeposit(msg.sender, msg.sender, _l2Gas, _data);\\n }\\n\\n /**\\n * @inheritdoc IL1StandardBridge\\n */\\n function depositETHTo(\\n address _to,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external payable {\\n _initiateETHDeposit(msg.sender, _to, _l2Gas, _data);\\n }\\n\\n /**\\n * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of\\n * the deposit.\\n * @param _from Account to pull the deposit from on L1.\\n * @param _to Account to give the deposit to on L2.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function _initiateETHDeposit(\\n address _from,\\n address _to,\\n uint32 _l2Gas,\\n bytes memory _data\\n ) internal {\\n // Construct calldata for finalizeDeposit call\\n bytes memory message = abi.encodeWithSelector(\\n IL2ERC20Bridge.finalizeDeposit.selector,\\n address(0),\\n Lib_PredeployAddresses.OVM_ETH,\\n _from,\\n _to,\\n msg.value,\\n _data\\n );\\n\\n // Send calldata into L2\\n // slither-disable-next-line reentrancy-events\\n sendCrossDomainMessage(l2TokenBridge, _l2Gas, message);\\n\\n // slither-disable-next-line reentrancy-events\\n emit ETHDepositInitiated(_from, _to, msg.value, _data);\\n }\\n\\n /**\\n * @inheritdoc IL1ERC20Bridge\\n */\\n function depositERC20(\\n address _l1Token,\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external virtual onlyEOA {\\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data);\\n }\\n\\n /**\\n * @inheritdoc IL1ERC20Bridge\\n */\\n function depositERC20To(\\n address _l1Token,\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) external virtual {\\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data);\\n }\\n\\n /**\\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\\n *\\n * @param _l1Token Address of the L1 ERC20 we are depositing\\n * @param _l2Token Address of the L1 respective L2 ERC20\\n * @param _from Account to pull the deposit from on L1\\n * @param _to Account to give the deposit to on L2\\n * @param _amount Amount of the ERC20 to deposit.\\n * @param _l2Gas Gas limit required to complete the deposit on L2.\\n * @param _data Optional data to forward to L2. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function _initiateERC20Deposit(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n uint32 _l2Gas,\\n bytes calldata _data\\n ) internal {\\n // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future\\n // withdrawals. safeTransferFrom also checks if the contract has code, so this will fail if\\n // _from is an EOA or address(0).\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);\\n\\n // Construct calldata for _l2Token.finalizeDeposit(_to, _amount)\\n bytes memory message = abi.encodeWithSelector(\\n IL2ERC20Bridge.finalizeDeposit.selector,\\n _l1Token,\\n _l2Token,\\n _from,\\n _to,\\n _amount,\\n _data\\n );\\n\\n // Send calldata into L2\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n sendCrossDomainMessage(l2TokenBridge, _l2Gas, message);\\n\\n // slither-disable-next-line reentrancy-benign\\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token] + _amount;\\n\\n // slither-disable-next-line reentrancy-events\\n emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data);\\n }\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @inheritdoc IL1StandardBridge\\n */\\n function finalizeETHWithdrawal(\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external onlyFromCrossDomainAccount(l2TokenBridge) {\\n // slither-disable-next-line reentrancy-events\\n (bool success, ) = _to.call{ value: _amount }(new bytes(0));\\n require(success, \\\"TransferHelper::safeTransferETH: ETH transfer failed\\\");\\n\\n // slither-disable-next-line reentrancy-events\\n emit ETHWithdrawalFinalized(_from, _to, _amount, _data);\\n }\\n\\n /**\\n * @inheritdoc IL1ERC20Bridge\\n */\\n function finalizeERC20Withdrawal(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external onlyFromCrossDomainAccount(l2TokenBridge) {\\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token] - _amount;\\n\\n // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer\\n // slither-disable-next-line reentrancy-events\\n IERC20(_l1Token).safeTransfer(_to, _amount);\\n\\n // slither-disable-next-line reentrancy-events\\n emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\\n }\\n\\n /*****************************\\n * Temporary - Migrating ETH *\\n *****************************/\\n\\n /**\\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\\n * to be migrated from an old gateway to a new gateway.\\n * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the\\n * old contract\\n */\\n function donateETH() external payable {}\\n}\\n\",\"keccak256\":\"0x9b87d80b31401c4907c73ea1b73365a618d3c3d9e67e36fb74d25c0880e1b2bc\",\"license\":\"MIT\"},\"contracts/L2/messaging/IL2ERC20Bridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title IL2ERC20Bridge\\n */\\ninterface IL2ERC20Bridge {\\n /**********\\n * Events *\\n **********/\\n\\n event WithdrawalInitiated(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event DepositFinalized(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n event DepositFailed(\\n address indexed _l1Token,\\n address indexed _l2Token,\\n address indexed _from,\\n address _to,\\n uint256 _amount,\\n bytes _data\\n );\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @dev get the address of the corresponding L1 bridge contract.\\n * @return Address of the corresponding L1 bridge contract.\\n */\\n function l1TokenBridge() external returns (address);\\n\\n /**\\n * @dev initiate a withdraw of some tokens to the caller's account on L1\\n * @param _l2Token Address of L2 token where withdrawal was initiated.\\n * @param _amount Amount of the token to withdraw.\\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\\n * @param _data Optional data to forward to L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function withdraw(\\n address _l2Token,\\n uint256 _amount,\\n uint32 _l1Gas,\\n bytes calldata _data\\n ) external;\\n\\n /**\\n * @dev initiate a withdraw of some token to a recipient's account on L1.\\n * @param _l2Token Address of L2 token where withdrawal is initiated.\\n * @param _to L1 adress to credit the withdrawal to.\\n * @param _amount Amount of the token to withdraw.\\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\\n * @param _data Optional data to forward to L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function withdrawTo(\\n address _l2Token,\\n address _to,\\n uint256 _amount,\\n uint32 _l1Gas,\\n bytes calldata _data\\n ) external;\\n\\n /*************************\\n * Cross-chain Functions *\\n *************************/\\n\\n /**\\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\\n * L1StandardTokenBridge.\\n * @param _l1Token Address for the l1 token this is called with\\n * @param _l2Token Address for the l2 token this is called with\\n * @param _from Account to pull the deposit from on L2.\\n * @param _to Address to receive the withdrawal at\\n * @param _amount Amount of the token to withdraw\\n * @param _data Data provider by the sender on L1. This data is provided\\n * solely as a convenience for external contracts. Aside from enforcing a maximum\\n * length, these contracts provide no guarantees about its content.\\n */\\n function finalizeDeposit(\\n address _l1Token,\\n address _l2Token,\\n address _from,\\n address _to,\\n uint256 _amount,\\n bytes calldata _data\\n ) external;\\n}\\n\",\"keccak256\":\"0x4674c3c8733ca0db16c2b81d58227560df36a07ded3b637a0793564d90ac0475\",\"license\":\"MIT\"},\"contracts/libraries/bridge/CrossDomainEnabled.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"./ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title CrossDomainEnabled\\n * @dev Helper contract for contracts performing cross-domain communications\\n *\\n * Compiler used: defined by inheriting contract\\n */\\ncontract CrossDomainEnabled {\\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 * Constructor *\\n ***************/\\n\\n /**\\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\\n */\\n constructor(address _messenger) {\\n messenger = _messenger;\\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(address _sourceDomainAccount) {\\n require(\\n msg.sender == address(getCrossDomainMessenger()),\\n \\\"OVM_XCHAIN: messenger contract unauthenticated\\\"\\n );\\n\\n require(\\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\\n \\\"OVM_XCHAIN: wrong sender of cross-domain message\\\"\\n );\\n\\n _;\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * 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() internal virtual returns (ICrossDomainMessenger) {\\n return ICrossDomainMessenger(messenger);\\n }\\n\\n /**q\\n * Sends a message to an account on another domain\\n * @param _crossDomainTarget The intended recipient on the destination domain\\n * @param _message The data to send to the target (usually calldata to a function with\\n * `onlyFromCrossDomainAccount()`)\\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\\n */\\n function sendCrossDomainMessage(\\n address _crossDomainTarget,\\n uint32 _gasLimit,\\n bytes memory _message\\n ) internal {\\n // slither-disable-next-line reentrancy-events, reentrancy-benign\\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\\n }\\n}\\n\",\"keccak256\":\"0x9c3cc8b7047c68a403529b15769a21c2e2668ea71db7bef51f123288009811ea\",\"license\":\"MIT\"},\"contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"contracts/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\\n 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant L2_STANDARD_TOKEN_FACTORY =\\n 0x4200000000000000000000000000000000000012;\\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\\n}\\n\",\"keccak256\":\"0x2bc28307af93e9716151a41a81694b56cbe513ef5eb335fb1d81f35e5db8edfa\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b50600080546001600160a01b031916905561199e806100306000396000f3fe6080604052600436106100c05760003560e01c80638b4c40b0116100745780639a2ac6d51161004e5780639a2ac6d514610288578063a9f9e6751461029b578063b1a1a882146102bb57600080fd5b80638b4c40b0146101375780638f601f661461021557806391c49bf81461025b57600080fd5b8063485cc955116100a5578063485cc955146101b557806358a997f6146101d5578063838b2520146101f557600080fd5b80631532ec341461013e5780633cb747bf1461015e57600080fd5b3661013957333b156101195760405162461bcd60e51b815260206004820152600f60248201527f4163636f756e74206e6f7420454f41000000000000000000000000000000000060448201526064015b60405180910390fd5b610137333362030d40604051806020016040528060008152506102ce565b005b600080fd5b34801561014a57600080fd5b50610137610159366004611357565b61041a565b34801561016a57600080fd5b5060005461018b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156101c157600080fd5b506101376101d03660046113ca565b610790565b3480156101e157600080fd5b506101376101f036600461141c565b61086f565b34801561020157600080fd5b5061013761021036600461149f565b6108d6565b34801561022157600080fd5b5061024d6102303660046113ca565b600260209081526000928352604080842090915290825290205481565b6040519081526020016101ac565b34801561026757600080fd5b5060015461018b9073ffffffffffffffffffffffffffffffffffffffff1681565b610137610296366004611535565b6108ef565b3480156102a757600080fd5b506101376102b6366004611598565b610937565b6101376102c9366004611611565b610c59565b600063662a633a60e01b600073deaddeaddeaddeaddeaddeaddeaddeaddead000087873487604051602401610308969594939291906116da565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001549091506103ac9073ffffffffffffffffffffffffffffffffffffffff168483610cef565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f35d79ab81f2b2017e19afb5c5571778877782d7a8786f5907f93b0f4702f4f23348560405161040b929190611735565b60405180910390a35050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1661045260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104f25760405162461bcd60e51b815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610110565b8073ffffffffffffffffffffffffffffffffffffffff1661052860005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561056d57600080fd5b505afa158015610581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a5919061174e565b73ffffffffffffffffffffffffffffffffffffffff161461062e5760405162461bcd60e51b815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610110565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8716908690604051610665919061176b565b60006040518083038185875af1925050503d80600081146106a2576040519150601f19603f3d011682016040523d82523d6000602084013e6106a7565b606091505b505090508061071e5760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610110565b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f2ac69ee804d9a7a0984249f508dfab7cb2534b465b6ce1580f99a38ba9c5e63187878760405161077f939291906117d0565b60405180910390a350505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff161561081c5760405162461bcd60e51b815260206004820152602660248201527f436f6e74726163742068617320616c7265616479206265656e20696e6974696160448201527f6c697a65642e00000000000000000000000000000000000000000000000000006064820152608401610110565b6000805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560018054929093169116179055565b333b156108be5760405162461bcd60e51b815260206004820152600f60248201527f4163636f756e74206e6f7420454f4100000000000000000000000000000000006044820152606401610110565b6108ce8686333388888888610d77565b505050505050565b6108e68787338888888888610d77565b50505050505050565b61093133858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506102ce92505050565b50505050565b60015473ffffffffffffffffffffffffffffffffffffffff1661096f60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a0f5760405162461bcd60e51b815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610110565b8073ffffffffffffffffffffffffffffffffffffffff16610a4560005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac2919061174e565b73ffffffffffffffffffffffffffffffffffffffff1614610b4b5760405162461bcd60e51b815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610110565b73ffffffffffffffffffffffffffffffffffffffff8089166000908152600260209081526040808320938b1683529290522054610b89908590611822565b73ffffffffffffffffffffffffffffffffffffffff808a166000818152600260209081526040808320948d1683529390529190912091909155610bcd908686610f27565b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f3ceee06c1e37648fcbb6ed52e17b3e1f275a1f8c7b22a84b2b84732431e046b388888888604051610c479493929190611839565b60405180910390a45050505050505050565b333b15610ca85760405162461bcd60e51b815260206004820152600f60248201527f4163636f756e74206e6f7420454f4100000000000000000000000000000000006044820152606401610110565b610cea33338585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506102ce92505050565b505050565b6000546040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633dbb202b90610d4990869085908790600401611879565b600060405180830381600087803b158015610d6357600080fd5b505af11580156108e6573d6000803e3d6000fd5b610d9973ffffffffffffffffffffffffffffffffffffffff8916873087610ffb565b600063662a633a60e01b89898989898888604051602401610dc097969594939291906118be565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152600154909150610e649073ffffffffffffffffffffffffffffffffffffffff168583610cef565b73ffffffffffffffffffffffffffffffffffffffff808a166000908152600260209081526040808320938c1683529290522054610ea290869061191b565b73ffffffffffffffffffffffffffffffffffffffff808b1660008181526002602090815260408083208e86168085529252918290209490945551918a1692917f718594027abd4eaed59f95162563e0cc6d0e8d5b86b1c7be8b1b0ac3343d039690610f14908b908b908a908a90611839565b60405180910390a4505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610cea9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611059565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526109319085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610f79565b60006110bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661114b9092919063ffffffff16565b805190915015610cea57808060200190518101906110d99190611933565b610cea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610110565b606061115a8484600085611164565b90505b9392505050565b6060824710156111dc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610110565b843b61122a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610110565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611253919061176b565b60006040518083038185875af1925050503d8060008114611290576040519150601f19603f3d011682016040523d82523d6000602084013e611295565b606091505b50915091506112a58282866112b0565b979650505050505050565b606083156112bf57508161115d565b8251156112cf5782518084602001fd5b8160405162461bcd60e51b81526004016101109190611955565b73ffffffffffffffffffffffffffffffffffffffff8116811461130b57600080fd5b50565b60008083601f84011261132057600080fd5b50813567ffffffffffffffff81111561133857600080fd5b60208301915083602082850101111561135057600080fd5b9250929050565b60008060008060006080868803121561136f57600080fd5b853561137a816112e9565b9450602086013561138a816112e9565b935060408601359250606086013567ffffffffffffffff8111156113ad57600080fd5b6113b98882890161130e565b969995985093965092949392505050565b600080604083850312156113dd57600080fd5b82356113e8816112e9565b915060208301356113f8816112e9565b809150509250929050565b803563ffffffff8116811461141757600080fd5b919050565b60008060008060008060a0878903121561143557600080fd5b8635611440816112e9565b95506020870135611450816112e9565b94506040870135935061146560608801611403565b9250608087013567ffffffffffffffff81111561148157600080fd5b61148d89828a0161130e565b979a9699509497509295939492505050565b600080600080600080600060c0888a0312156114ba57600080fd5b87356114c5816112e9565b965060208801356114d5816112e9565b955060408801356114e5816112e9565b9450606088013593506114fa60808901611403565b925060a088013567ffffffffffffffff81111561151657600080fd5b6115228a828b0161130e565b989b979a50959850939692959293505050565b6000806000806060858703121561154b57600080fd5b8435611556816112e9565b935061156460208601611403565b9250604085013567ffffffffffffffff81111561158057600080fd5b61158c8782880161130e565b95989497509550505050565b600080600080600080600060c0888a0312156115b357600080fd5b87356115be816112e9565b965060208801356115ce816112e9565b955060408801356115de816112e9565b945060608801356115ee816112e9565b93506080880135925060a088013567ffffffffffffffff81111561151657600080fd5b60008060006040848603121561162657600080fd5b61162f84611403565b9250602084013567ffffffffffffffff81111561164b57600080fd5b6116578682870161130e565b9497909650939450505050565b60005b8381101561167f578181015183820152602001611667565b838111156109315750506000910152565b600081518084526116a8816020860160208601611664565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff80891683528088166020840152808716604084015280861660608401525083608083015260c060a083015261172960c0830184611690565b98975050505050505050565b82815260406020820152600061115a6040830184611690565b60006020828403121561176057600080fd5b815161115d816112e9565b6000825161177d818460208701611664565b9190910192915050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b8381526040602082015260006117ea604083018486611787565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015611834576118346117f3565b500390565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061186f606083018486611787565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff841681526060602082015260006118a86060830185611690565b905063ffffffff83166040830152949350505050565b600073ffffffffffffffffffffffffffffffffffffffff808a1683528089166020840152808816604084015280871660608401525084608083015260c060a083015261190e60c083018486611787565b9998505050505050505050565b6000821982111561192e5761192e6117f3565b500190565b60006020828403121561194557600080fd5b8151801515811461115d57600080fd5b60208152600061115d602083018461169056fea2646970667358221220ab0015e7cee64db6dc95e6eb0899ae4017c78ab54ebce874e3b018a7bc88850364736f6c63430008090033", "deployedBytecode": "0x6080604052600436106100c05760003560e01c80638b4c40b0116100745780639a2ac6d51161004e5780639a2ac6d514610288578063a9f9e6751461029b578063b1a1a882146102bb57600080fd5b80638b4c40b0146101375780638f601f661461021557806391c49bf81461025b57600080fd5b8063485cc955116100a5578063485cc955146101b557806358a997f6146101d5578063838b2520146101f557600080fd5b80631532ec341461013e5780633cb747bf1461015e57600080fd5b3661013957333b156101195760405162461bcd60e51b815260206004820152600f60248201527f4163636f756e74206e6f7420454f41000000000000000000000000000000000060448201526064015b60405180910390fd5b610137333362030d40604051806020016040528060008152506102ce565b005b600080fd5b34801561014a57600080fd5b50610137610159366004611357565b61041a565b34801561016a57600080fd5b5060005461018b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156101c157600080fd5b506101376101d03660046113ca565b610790565b3480156101e157600080fd5b506101376101f036600461141c565b61086f565b34801561020157600080fd5b5061013761021036600461149f565b6108d6565b34801561022157600080fd5b5061024d6102303660046113ca565b600260209081526000928352604080842090915290825290205481565b6040519081526020016101ac565b34801561026757600080fd5b5060015461018b9073ffffffffffffffffffffffffffffffffffffffff1681565b610137610296366004611535565b6108ef565b3480156102a757600080fd5b506101376102b6366004611598565b610937565b6101376102c9366004611611565b610c59565b600063662a633a60e01b600073deaddeaddeaddeaddeaddeaddeaddeaddead000087873487604051602401610308969594939291906116da565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001549091506103ac9073ffffffffffffffffffffffffffffffffffffffff168483610cef565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f35d79ab81f2b2017e19afb5c5571778877782d7a8786f5907f93b0f4702f4f23348560405161040b929190611735565b60405180910390a35050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1661045260005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104f25760405162461bcd60e51b815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610110565b8073ffffffffffffffffffffffffffffffffffffffff1661052860005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561056d57600080fd5b505afa158015610581573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105a5919061174e565b73ffffffffffffffffffffffffffffffffffffffff161461062e5760405162461bcd60e51b815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610110565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8716908690604051610665919061176b565b60006040518083038185875af1925050503d80600081146106a2576040519150601f19603f3d011682016040523d82523d6000602084013e6106a7565b606091505b505090508061071e5760405162461bcd60e51b815260206004820152603460248201527f5472616e7366657248656c7065723a3a736166655472616e736665724554483a60448201527f20455448207472616e73666572206661696c65640000000000000000000000006064820152608401610110565b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f2ac69ee804d9a7a0984249f508dfab7cb2534b465b6ce1580f99a38ba9c5e63187878760405161077f939291906117d0565b60405180910390a350505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff161561081c5760405162461bcd60e51b815260206004820152602660248201527f436f6e74726163742068617320616c7265616479206265656e20696e6974696160448201527f6c697a65642e00000000000000000000000000000000000000000000000000006064820152608401610110565b6000805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560018054929093169116179055565b333b156108be5760405162461bcd60e51b815260206004820152600f60248201527f4163636f756e74206e6f7420454f4100000000000000000000000000000000006044820152606401610110565b6108ce8686333388888888610d77565b505050505050565b6108e68787338888888888610d77565b50505050505050565b61093133858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506102ce92505050565b50505050565b60015473ffffffffffffffffffffffffffffffffffffffff1661096f60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a0f5760405162461bcd60e51b815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e746963617465640000000000000000000000000000000000006064820152608401610110565b8073ffffffffffffffffffffffffffffffffffffffff16610a4560005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac2919061174e565b73ffffffffffffffffffffffffffffffffffffffff1614610b4b5760405162461bcd60e51b815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610110565b73ffffffffffffffffffffffffffffffffffffffff8089166000908152600260209081526040808320938b1683529290522054610b89908590611822565b73ffffffffffffffffffffffffffffffffffffffff808a166000818152600260209081526040808320948d1683529390529190912091909155610bcd908686610f27565b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f3ceee06c1e37648fcbb6ed52e17b3e1f275a1f8c7b22a84b2b84732431e046b388888888604051610c479493929190611839565b60405180910390a45050505050505050565b333b15610ca85760405162461bcd60e51b815260206004820152600f60248201527f4163636f756e74206e6f7420454f4100000000000000000000000000000000006044820152606401610110565b610cea33338585858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506102ce92505050565b505050565b6000546040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633dbb202b90610d4990869085908790600401611879565b600060405180830381600087803b158015610d6357600080fd5b505af11580156108e6573d6000803e3d6000fd5b610d9973ffffffffffffffffffffffffffffffffffffffff8916873087610ffb565b600063662a633a60e01b89898989898888604051602401610dc097969594939291906118be565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152600154909150610e649073ffffffffffffffffffffffffffffffffffffffff168583610cef565b73ffffffffffffffffffffffffffffffffffffffff808a166000908152600260209081526040808320938c1683529290522054610ea290869061191b565b73ffffffffffffffffffffffffffffffffffffffff808b1660008181526002602090815260408083208e86168085529252918290209490945551918a1692917f718594027abd4eaed59f95162563e0cc6d0e8d5b86b1c7be8b1b0ac3343d039690610f14908b908b908a908a90611839565b60405180910390a4505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052610cea9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611059565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526109319085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610f79565b60006110bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661114b9092919063ffffffff16565b805190915015610cea57808060200190518101906110d99190611933565b610cea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610110565b606061115a8484600085611164565b90505b9392505050565b6060824710156111dc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610110565b843b61122a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610110565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611253919061176b565b60006040518083038185875af1925050503d8060008114611290576040519150601f19603f3d011682016040523d82523d6000602084013e611295565b606091505b50915091506112a58282866112b0565b979650505050505050565b606083156112bf57508161115d565b8251156112cf5782518084602001fd5b8160405162461bcd60e51b81526004016101109190611955565b73ffffffffffffffffffffffffffffffffffffffff8116811461130b57600080fd5b50565b60008083601f84011261132057600080fd5b50813567ffffffffffffffff81111561133857600080fd5b60208301915083602082850101111561135057600080fd5b9250929050565b60008060008060006080868803121561136f57600080fd5b853561137a816112e9565b9450602086013561138a816112e9565b935060408601359250606086013567ffffffffffffffff8111156113ad57600080fd5b6113b98882890161130e565b969995985093965092949392505050565b600080604083850312156113dd57600080fd5b82356113e8816112e9565b915060208301356113f8816112e9565b809150509250929050565b803563ffffffff8116811461141757600080fd5b919050565b60008060008060008060a0878903121561143557600080fd5b8635611440816112e9565b95506020870135611450816112e9565b94506040870135935061146560608801611403565b9250608087013567ffffffffffffffff81111561148157600080fd5b61148d89828a0161130e565b979a9699509497509295939492505050565b600080600080600080600060c0888a0312156114ba57600080fd5b87356114c5816112e9565b965060208801356114d5816112e9565b955060408801356114e5816112e9565b9450606088013593506114fa60808901611403565b925060a088013567ffffffffffffffff81111561151657600080fd5b6115228a828b0161130e565b989b979a50959850939692959293505050565b6000806000806060858703121561154b57600080fd5b8435611556816112e9565b935061156460208601611403565b9250604085013567ffffffffffffffff81111561158057600080fd5b61158c8782880161130e565b95989497509550505050565b600080600080600080600060c0888a0312156115b357600080fd5b87356115be816112e9565b965060208801356115ce816112e9565b955060408801356115de816112e9565b945060608801356115ee816112e9565b93506080880135925060a088013567ffffffffffffffff81111561151657600080fd5b60008060006040848603121561162657600080fd5b61162f84611403565b9250602084013567ffffffffffffffff81111561164b57600080fd5b6116578682870161130e565b9497909650939450505050565b60005b8381101561167f578181015183820152602001611667565b838111156109315750506000910152565b600081518084526116a8816020860160208601611664565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600073ffffffffffffffffffffffffffffffffffffffff80891683528088166020840152808716604084015280861660608401525083608083015260c060a083015261172960c0830184611690565b98975050505050505050565b82815260406020820152600061115a6040830184611690565b60006020828403121561176057600080fd5b815161115d816112e9565b6000825161177d818460208701611664565b9190910192915050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b8381526040602082015260006117ea604083018486611787565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015611834576118346117f3565b500390565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061186f606083018486611787565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff841681526060602082015260006118a86060830185611690565b905063ffffffff83166040830152949350505050565b600073ffffffffffffffffffffffffffffffffffffffff808a1683528089166020840152808816604084015280871660608401525084608083015260c060a083015261190e60c083018486611787565b9998505050505050505050565b6000821982111561192e5761192e6117f3565b500190565b60006020828403121561194557600080fd5b8151801515811461115d57600080fd5b60208152600061115d602083018461169056fea2646970667358221220ab0015e7cee64db6dc95e6eb0899ae4017c78ab54ebce874e3b018a7bc88850364736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/Lib_AddressManager.json b/packages/contracts/deployments/goerli-nightly/Lib_AddressManager.json index cf72abe788f4..ab187b7ec946 100644 --- a/packages/contracts/deployments/goerli-nightly/Lib_AddressManager.json +++ b/packages/contracts/deployments/goerli-nightly/Lib_AddressManager.json @@ -1,5 +1,5 @@ { - "address": "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "address": "0x2E8234de112b3d020D4310820B8e253056A90D9F", "abi": [ { "anonymous": false, @@ -116,39 +116,39 @@ "type": "function" } ], - "transactionHash": "0xeacbc4399d1883ba0c624aefbe8bf372a1b26da99a08f43955dc111dd20b3214", + "transactionHash": "0x99758e30bc773cbd8de082c6e7822aed5cf95f6d2b04f226390bf5bac8be76a6", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", - "transactionIndex": 59, + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x2E8234de112b3d020D4310820B8e253056A90D9F", + "transactionIndex": 34, "gasUsed": "463444", - "logsBloom": "0x00000080000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000100000000000000000001000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000200000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6eece1a58ca9a6708d7af4d6f644194f8d1b5d91370f4667953193b5e0b9c2f9", - "transactionHash": "0xeacbc4399d1883ba0c624aefbe8bf372a1b26da99a08f43955dc111dd20b3214", + "logsBloom": "0x000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000002000000000000000010000000000000000000000000000000000000a0000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x6c4266e2c1cc3cbf3babe2697aab9c08e6a887cd598b9ef9f773e2c73997e137", + "transactionHash": "0x99758e30bc773cbd8de082c6e7822aed5cf95f6d2b04f226390bf5bac8be76a6", "logs": [ { - "transactionIndex": 59, - "blockNumber": 6680713, - "transactionHash": "0xeacbc4399d1883ba0c624aefbe8bf372a1b26da99a08f43955dc111dd20b3214", - "address": "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "transactionIndex": 34, + "blockNumber": 6754101, + "transactionHash": "0x99758e30bc773cbd8de082c6e7822aed5cf95f6d2b04f226390bf5bac8be76a6", + "address": "0x2E8234de112b3d020D4310820B8e253056A90D9F", "topics": [ "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0", "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000003a605b442055df2898e18cf518feb2e2a6bd0d31" + "0x00000000000000000000000026d58ad41d2be997c02802468b92f1eab4f8b95c" ], "data": "0x", - "logIndex": 52, - "blockHash": "0x6eece1a58ca9a6708d7af4d6f644194f8d1b5d91370f4667953193b5e0b9c2f9" + "logIndex": 377, + "blockHash": "0x6c4266e2c1cc3cbf3babe2697aab9c08e6a887cd598b9ef9f773e2c73997e137" } ], - "blockNumber": 6680713, - "cumulativeGasUsed": "14560124", + "blockNumber": 6754101, + "cumulativeGasUsed": "15298044", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "ad04ab9565e42a9370aa7f055041028d", + "solcInputHash": "9b223da611bcb371fb03d40e6b1620c7", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldAddress\",\"type\":\"address\"}],\"name\":\"AddressSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"getAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"setAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getAddress(string)\":{\"params\":{\"_name\":\"Name to retrieve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setAddress(string,address)\":{\"params\":{\"_address\":\"Address to associate with the name.\",\"_name\":\"String name to associate an address with.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"Lib_AddressManager\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getAddress(string)\":{\"notice\":\"Retrieves the address associated with a given name.\"},\"setAddress(string,address)\":{\"notice\":\"Changes the address associated with a particular name.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/libraries/resolver/Lib_AddressManager.sol\":\"Lib_AddressManager\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6107028061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80639b2ea4bd116100505780639b2ea4bd146100b9578063bf40fac1146100cc578063f2fde38b146100df57600080fd5b8063715018a61461006c5780638da5cb5b14610076575b600080fd5b6100746100f2565b005b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100746100c73660046105e4565b610184565b6100906100da366004610632565b6102d0565b6100746100ed36600461066f565b61030c565b60005473ffffffffffffffffffffffffffffffffffffffff163314610178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610182600061043c565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610205576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161016f565b6000610210836104b1565b60008181526001602052604090819020805473ffffffffffffffffffffffffffffffffffffffff8681167fffffffffffffffffffffffff000000000000000000000000000000000000000083161790925591519293501690610273908590610691565b6040805191829003822073ffffffffffffffffffffffffffffffffffffffff808716845284166020840152917f9416a153a346f93d95f94b064ae3f148b6460473c6e82b3f9fc2521b873fcd6c910160405180910390a250505050565b6000600160006102df846104b1565b815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff1692915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461038d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161016f565b73ffffffffffffffffffffffffffffffffffffffff8116610430576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161016f565b6104398161043c565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000816040516020016104c49190610691565b604051602081830303815290604052805190602001209050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261052157600080fd5b813567ffffffffffffffff8082111561053c5761053c6104e1565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610582576105826104e1565b8160405283815286602085880101111561059b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146105df57600080fd5b919050565b600080604083850312156105f757600080fd5b823567ffffffffffffffff81111561060e57600080fd5b61061a85828601610510565b925050610629602084016105bb565b90509250929050565b60006020828403121561064457600080fd5b813567ffffffffffffffff81111561065b57600080fd5b61066784828501610510565b949350505050565b60006020828403121561068157600080fd5b61068a826105bb565b9392505050565b6000825160005b818110156106b25760208186018101518583015201610698565b818111156106c1576000828501525b50919091019291505056fea2646970667358221220882d6a267e1fbcc015c1726b422a6847e08c6be7e987e8b5ec1f7e85aa5095bb64736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80639b2ea4bd116100505780639b2ea4bd146100b9578063bf40fac1146100cc578063f2fde38b146100df57600080fd5b8063715018a61461006c5780638da5cb5b14610076575b600080fd5b6100746100f2565b005b60005473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100746100c73660046105e4565b610184565b6100906100da366004610632565b6102d0565b6100746100ed36600461066f565b61030c565b60005473ffffffffffffffffffffffffffffffffffffffff163314610178576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b610182600061043c565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610205576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161016f565b6000610210836104b1565b60008181526001602052604090819020805473ffffffffffffffffffffffffffffffffffffffff8681167fffffffffffffffffffffffff000000000000000000000000000000000000000083161790925591519293501690610273908590610691565b6040805191829003822073ffffffffffffffffffffffffffffffffffffffff808716845284166020840152917f9416a153a346f93d95f94b064ae3f148b6460473c6e82b3f9fc2521b873fcd6c910160405180910390a250505050565b6000600160006102df846104b1565b815260208101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff1692915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461038d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161016f565b73ffffffffffffffffffffffffffffffffffffffff8116610430576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161016f565b6104398161043c565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000816040516020016104c49190610691565b604051602081830303815290604052805190602001209050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261052157600080fd5b813567ffffffffffffffff8082111561053c5761053c6104e1565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610582576105826104e1565b8160405283815286602085880101111561059b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146105df57600080fd5b919050565b600080604083850312156105f757600080fd5b823567ffffffffffffffff81111561060e57600080fd5b61061a85828601610510565b925050610629602084016105bb565b90509250929050565b60006020828403121561064457600080fd5b813567ffffffffffffffff81111561065b57600080fd5b61066784828501610510565b949350505050565b60006020828403121561068157600080fd5b61068a826105bb565b9392505050565b6000825160005b818110156106b25760208186018101518583015201610698565b818111156106c1576000828501525b50919091019291505056fea2646970667358221220882d6a267e1fbcc015c1726b422a6847e08c6be7e987e8b5ec1f7e85aa5095bb64736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/goerli-nightly/OVM_L1CrossDomainMessenger.json index ada7f2a24c5d..35f68695e43c 100644 --- a/packages/contracts/deployments/goerli-nightly/OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/goerli-nightly/OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0x74CF0044A6A384fafEf9Ab3474D578345Aba9a32", + "address": "0x7E7F3df6aCc8f1f97047116b1c468BCBE7a0A794", "abi": [ { "inputs": [], @@ -495,24 +495,24 @@ "type": "function" } ], - "transactionHash": "0x7320a91304161f1d2fab5beaecc076401344866dfbdc6afbf938cd1da13c0e02", + "transactionHash": "0xd9f10507bf358ca97262e1f9f0da4738aa81db19887183d4c8ffcb491d6348fa", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x74CF0044A6A384fafEf9Ab3474D578345Aba9a32", - "transactionIndex": 16, + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x7E7F3df6aCc8f1f97047116b1c468BCBE7a0A794", + "transactionIndex": 5, "gasUsed": "3394374", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb3cd9801a69984cddd0d58faaa955725eb480719e1b4f237f99d4fad770f6dbc", - "transactionHash": "0x7320a91304161f1d2fab5beaecc076401344866dfbdc6afbf938cd1da13c0e02", + "blockHash": "0x6c3d6b541aec31b0ea5547ea587b66a69bc91b110e8f0a0cfc0fd5d579caa236", + "transactionHash": "0xd9f10507bf358ca97262e1f9f0da4738aa81db19887183d4c8ffcb491d6348fa", "logs": [], - "blockNumber": 6680735, - "cumulativeGasUsed": "8202967", + "blockNumber": 6754185, + "cumulativeGasUsed": "6399477", "status": 1, "byzantium": true }, "args": [], - "solcInputHash": "453cf665b5e2b83b8253dcbd4b55e968", + "solcInputHash": "8e1d6ed52c0bdd4990c7a20b88a38f67", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"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\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"RelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"messageNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"}],\"name\":\"SentMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"allowMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_xDomainCalldataHash\",\"type\":\"bytes32\"}],\"name\":\"blockMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"blockedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_libAddressManager\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"libAddressManager\",\"outputs\":[{\"internalType\":\"contract Lib_AddressManager\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_messageNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"batchRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prevTotalElements\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"extraData\",\"type\":\"bytes\"}],\"internalType\":\"struct Lib_OVMCodec.ChainBatchHeader\",\"name\":\"stateRootBatchHeader\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"siblings\",\"type\":\"bytes32[]\"}],\"internalType\":\"struct Lib_OVMCodec.ChainInclusionProof\",\"name\":\"stateRootProof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"stateTrieWitness\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"storageTrieWitness\",\"type\":\"bytes\"}],\"internalType\":\"struct IL1CrossDomainMessenger.L2MessageInclusionProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"relayedMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"_oldGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"_newGasLimit\",\"type\":\"uint32\"}],\"name\":\"replayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"_gasLimit\",\"type\":\"uint32\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"successfulMessages\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"xDomainMessageSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted via this contract's replay function.\",\"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,uint32)\":{\"params\":{\"_message\":\"Message to send to the target.\",\"_newGasLimit\":\"New gas limit to be used for this message.\",\"_oldGasLimit\":\"Original gas limit used to send the message.\",\"_queueIndex\":\"CTC Queue index for the message to replay.\",\"_sender\":\"Original sender address.\",\"_target\":\"Target contract address.\"}},\"resolve(string)\":{\"params\":{\"_name\":\"Name to resolve an address for.\"},\"returns\":{\"_0\":\"Address associated with the given name.\"}},\"sendMessage(address,bytes,uint32)\":{\"params\":{\"_gasLimit\":\"Gas limit for the provided message.\",\"_message\":\"Message to send to the target.\",\"_target\":\"Target contract address.\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"title\":\"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,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/L1/messaging/L1CrossDomainMessenger.sol\":\"L1CrossDomainMessenger\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\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 _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x35b09b69aca3bc2633da8f47382a81ecf367efe57167a2114f60f9ec81988afa\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\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 {ERC1967Proxy-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 * @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 || !_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\",\"keccak256\":\"0x8b2abd85d0ece7e866e100e9d47ca9cbec93c87cf71a8d267b2b93eb81f7d5e9\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/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\":\"0x742c0fbab73bf595ca40025f6e81cb48dbd5e133950717f7befd062a925c0148\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/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\":\"0x89fa60d14355f7ae06af11e28fce2bb90c5c6186645d681a30e1b36234a4c210\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x062b5a0f7cc6b0528fa350033759f3a15ba42afb57423d7c593753860f2c82e0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/messaging/IL1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { ICrossDomainMessenger } from \\\"../../libraries/bridge/ICrossDomainMessenger.sol\\\";\\n\\n/**\\n * @title IL1CrossDomainMessenger\\n */\\ninterface IL1CrossDomainMessenger is ICrossDomainMessenger {\\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 * Public Functions *\\n ********************/\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @param _proof Inclusion proof for the given message.\\n */\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n ) external;\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _sender Original sender address.\\n * @param _message Message to send to the target.\\n * @param _queueIndex CTC Queue index for the message to replay.\\n * @param _oldGasLimit Original gas limit used to send the message.\\n * @param _newGasLimit New gas limit to be used for this message.\\n */\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _queueIndex,\\n uint32 _oldGasLimit,\\n uint32 _newGasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0xb0058ed29f6b510f09ffb52dd09812883adccb433cb2da1c8d5dd7de6d6c93ed\",\"license\":\"MIT\"},\"contracts/L1/messaging/L1CrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { AddressAliasHelper } from \\\"../../standards/AddressAliasHelper.sol\\\";\\nimport { Lib_AddressResolver } from \\\"../../libraries/resolver/Lib_AddressResolver.sol\\\";\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\nimport { Lib_AddressManager } from \\\"../../libraries/resolver/Lib_AddressManager.sol\\\";\\nimport { Lib_SecureMerkleTrie } from \\\"../../libraries/trie/Lib_SecureMerkleTrie.sol\\\";\\nimport { Lib_DefaultValues } from \\\"../../libraries/constants/Lib_DefaultValues.sol\\\";\\nimport { Lib_PredeployAddresses } from \\\"../../libraries/constants/Lib_PredeployAddresses.sol\\\";\\nimport { Lib_CrossDomainUtils } from \\\"../../libraries/bridge/Lib_CrossDomainUtils.sol\\\";\\n\\n/* Interface Imports */\\nimport { IL1CrossDomainMessenger } from \\\"./IL1CrossDomainMessenger.sol\\\";\\nimport { ICanonicalTransactionChain } from \\\"../rollup/ICanonicalTransactionChain.sol\\\";\\nimport { IStateCommitmentChain } from \\\"../rollup/IStateCommitmentChain.sol\\\";\\n\\n/* External Imports */\\nimport {\\n OwnableUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {\\n PausableUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport {\\n ReentrancyGuardUpgradeable\\n} from \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\n\\n/**\\n * @title 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 */\\ncontract L1CrossDomainMessenger is\\n IL1CrossDomainMessenger,\\n Lib_AddressResolver,\\n OwnableUpgradeable,\\n PausableUpgradeable,\\n ReentrancyGuardUpgradeable\\n{\\n /**********\\n * Events *\\n **********/\\n\\n event MessageBlocked(bytes32 indexed _xDomainCalldataHash);\\n\\n event MessageAllowed(bytes32 indexed _xDomainCalldataHash);\\n\\n /**********************\\n * Contract Variables *\\n **********************/\\n\\n mapping(bytes32 => bool) public blockedMessages;\\n mapping(bytes32 => bool) public relayedMessages;\\n mapping(bytes32 => bool) public successfulMessages;\\n\\n address internal xDomainMsgSender = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * This contract is intended to be behind a delegate proxy.\\n * We pass the zero address to the address resolver just to satisfy the constructor.\\n * We still need to set this value in initialize().\\n */\\n constructor() Lib_AddressResolver(address(0)) {}\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * @param _libAddressManager Address of the Address Manager.\\n */\\n // slither-disable-next-line external-function\\n function initialize(address _libAddressManager) public initializer {\\n require(\\n address(libAddressManager) == address(0),\\n \\\"L1CrossDomainMessenger already intialized.\\\"\\n );\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\n xDomainMsgSender = Lib_DefaultValues.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() external onlyOwner {\\n _pause();\\n }\\n\\n /**\\n * Block a message.\\n * @param _xDomainCalldataHash Hash of the message to block.\\n */\\n function blockMessage(bytes32 _xDomainCalldataHash) external onlyOwner {\\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(bytes32 _xDomainCalldataHash) external onlyOwner {\\n blockedMessages[_xDomainCalldataHash] = false;\\n emit MessageAllowed(_xDomainCalldataHash);\\n }\\n\\n // slither-disable-next-line external-function\\n function xDomainMessageSender() public view returns (address) {\\n require(\\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\\n \\\"xDomainMessageSender is not set\\\"\\n );\\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 // slither-disable-next-line external-function\\n function sendMessage(\\n address _target,\\n bytes memory _message,\\n uint32 _gasLimit\\n ) public {\\n address ovmCanonicalTransactionChain = resolve(\\\"CanonicalTransactionChain\\\");\\n // Use the CTC queue length as nonce\\n uint40 nonce = ICanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\\n\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n msg.sender,\\n _message,\\n nonce\\n );\\n\\n // slither-disable-next-line reentrancy-events\\n _sendXDomainMessage(ovmCanonicalTransactionChain, xDomainCalldata, _gasLimit);\\n\\n // slither-disable-next-line reentrancy-events\\n emit SentMessage(_target, msg.sender, _message, nonce, _gasLimit);\\n }\\n\\n /**\\n * Relays a cross domain message to a contract.\\n * @inheritdoc IL1CrossDomainMessenger\\n */\\n // slither-disable-next-line external-function\\n function relayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce,\\n L2MessageInclusionProof memory _proof\\n ) public nonReentrant whenNotPaused {\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n\\n require(\\n _verifyXDomainMessage(xDomainCalldata, _proof) == 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 require(\\n _target != resolve(\\\"CanonicalTransactionChain\\\"),\\n \\\"Cannot send L2->L1 messages to L1 system contracts.\\\"\\n );\\n\\n xDomainMsgSender = _sender;\\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\\n (bool success, ) = _target.call(_message);\\n // slither-disable-next-line reentrancy-benign\\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\\n successfulMessages[xDomainCalldataHash] = true;\\n // slither-disable-next-line reentrancy-events\\n emit RelayedMessage(xDomainCalldataHash);\\n } else {\\n // slither-disable-next-line reentrancy-events\\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\\n // slither-disable-next-line reentrancy-benign\\n relayedMessages[relayId] = true;\\n }\\n\\n /**\\n * Replays a cross domain message to the target messenger.\\n * @inheritdoc IL1CrossDomainMessenger\\n */\\n // slither-disable-next-line external-function\\n function replayMessage(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _queueIndex,\\n uint32 _oldGasLimit,\\n uint32 _newGasLimit\\n ) public {\\n // Verify that the message is in the queue:\\n address canonicalTransactionChain = resolve(\\\"CanonicalTransactionChain\\\");\\n Lib_OVMCodec.QueueElement memory element = ICanonicalTransactionChain(\\n canonicalTransactionChain\\n ).getQueueElement(_queueIndex);\\n\\n // Compute the calldata that was originally used to send the message.\\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\\n _target,\\n _sender,\\n _message,\\n _queueIndex\\n );\\n\\n // Compute the transactionHash\\n bytes32 transactionHash = keccak256(\\n abi.encode(\\n AddressAliasHelper.applyL1ToL2Alias(address(this)),\\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,\\n _oldGasLimit,\\n xDomainCalldata\\n )\\n );\\n\\n // Now check that the provided message data matches the one in the queue element.\\n require(\\n transactionHash == element.transactionHash,\\n \\\"Provided message has not been enqueued.\\\"\\n );\\n\\n // Send the same message but with the new gas limit.\\n _sendXDomainMessage(canonicalTransactionChain, xDomainCalldata, _newGasLimit);\\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 ) internal view returns (bool) {\\n return (_verifyStateRootProof(_proof) && _verifyStorageProof(_xDomainCalldata, _proof));\\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(L2MessageInclusionProof memory _proof)\\n internal\\n view\\n returns (bool)\\n {\\n IStateCommitmentChain ovmStateCommitmentChain = IStateCommitmentChain(\\n resolve(\\\"StateCommitmentChain\\\")\\n );\\n\\n return (ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) ==\\n false &&\\n ovmStateCommitmentChain.verifyStateCommitment(\\n _proof.stateRoot,\\n _proof.stateRootBatchHeader,\\n _proof.stateRootProof\\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 ) internal view returns (bool) {\\n bytes32 storageKey = keccak256(\\n abi.encodePacked(\\n keccak256(\\n abi.encodePacked(\\n _xDomainCalldata,\\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER\\n )\\n ),\\n uint256(0)\\n )\\n );\\n\\n (bool exists, bytes memory encodedMessagePassingAccount) = Lib_SecureMerkleTrie.get(\\n abi.encodePacked(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\\n _proof.stateTrieWitness,\\n _proof.stateRoot\\n );\\n\\n require(\\n exists == true,\\n \\\"Message passing predeploy has not been initialized or invalid proof provided.\\\"\\n );\\n\\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\\n encodedMessagePassingAccount\\n );\\n\\n return\\n Lib_SecureMerkleTrie.verifyInclusionProof(\\n abi.encodePacked(storageKey),\\n abi.encodePacked(uint8(1)),\\n _proof.storageTrieWitness,\\n account.storageRoot\\n );\\n }\\n\\n /**\\n * Sends a cross domain message.\\n * @param _canonicalTransactionChain Address of the CanonicalTransactionChain instance.\\n * @param _message Message to send.\\n * @param _gasLimit OVM gas limit for the message.\\n */\\n function _sendXDomainMessage(\\n address _canonicalTransactionChain,\\n bytes memory _message,\\n uint256 _gasLimit\\n ) internal {\\n // slither-disable-next-line reentrancy-events\\n ICanonicalTransactionChain(_canonicalTransactionChain).enqueue(\\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,\\n _gasLimit,\\n _message\\n );\\n }\\n}\\n\",\"keccak256\":\"0x046d26c447ba756418fbab905663e6d1ed40553a185876c6d7aa14f5ae41a15f\",\"license\":\"MIT\"},\"contracts/L1/rollup/ICanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title ICanonicalTransactionChain\\n */\\ninterface ICanonicalTransactionChain {\\n /**********\\n * Events *\\n **********/\\n\\n event L2GasParamsUpdated(\\n uint256 l2GasDiscountDivisor,\\n uint256 enqueueGasCost,\\n uint256 enqueueL2GasPrepaid\\n );\\n\\n event TransactionEnqueued(\\n address indexed _l1TxOrigin,\\n address indexed _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 indexed _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 * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n /*******************************\\n * Authorized Setter Functions *\\n *******************************/\\n\\n /**\\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\\n * The value of enqueueL2GasPrepaid is immediately updated as well.\\n */\\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost) external;\\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() external view returns (IChainStorageContainer);\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements() external view returns (uint256 _totalElements);\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches() external view returns (uint256 _totalBatches);\\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() external view returns (uint40);\\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(uint256 _index)\\n external\\n view\\n returns (Lib_OVMCodec.QueueElement memory _element);\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp() external view returns (uint40);\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber() external view returns (uint40);\\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() external view returns (uint40);\\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() external view returns (uint40);\\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 ) 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 ) external;\\n}\\n\",\"keccak256\":\"0xa534e90efd57e3c36053cb4aabba63ef8f53e35e3a4ce3d0f127ec2d0af1f618\",\"license\":\"MIT\"},\"contracts/L1/rollup/IChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IChainStorageContainer\\n */\\ninterface IChainStorageContainer {\\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(bytes27 _globalMetadata) external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata() external view returns (bytes27);\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length() external view returns (uint256);\\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\\n}\\n\",\"keccak256\":\"0xe55ad72572ec47dc09a02228d0c5a438571c76a41d16d92b35add057811977ce\",\"license\":\"MIT\"},\"contracts/L1/rollup/IStateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title IStateCommitmentChain\\n */\\ninterface IStateCommitmentChain {\\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(uint256 indexed _batchIndex, bytes32 _batchRoot);\\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() external view returns (uint256 _totalElements);\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches() external view returns (uint256 _totalBatches);\\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() external view returns (uint256 _lastSequencerTimestamp);\\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(bytes32[] calldata _batch, uint256 _shouldStartAtElement) 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) 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 ) external view returns (bool _verified);\\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n external\\n view\\n returns (bool _inside);\\n}\\n\",\"keccak256\":\"0x47253e63bc34a006102374c39c052470b977e1eb63dacc953e2cbff19940de69\",\"license\":\"MIT\"},\"contracts/libraries/bridge/ICrossDomainMessenger.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title ICrossDomainMessenger\\n */\\ninterface ICrossDomainMessenger {\\n /**********\\n * Events *\\n **********/\\n\\n event SentMessage(\\n address indexed target,\\n address sender,\\n bytes message,\\n uint256 messageNonce,\\n uint256 gasLimit\\n );\\n event RelayedMessage(bytes32 indexed msgHash);\\n event FailedRelayedMessage(bytes32 indexed msgHash);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n function xDomainMessageSender() external view returns (address);\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sends a cross domain message to the target messenger.\\n * @param _target Target contract address.\\n * @param _message Message to send to the target.\\n * @param _gasLimit Gas limit for the provided message.\\n */\\n function sendMessage(\\n address _target,\\n bytes calldata _message,\\n uint32 _gasLimit\\n ) external;\\n}\\n\",\"keccak256\":\"0x8f29ae23021345a20ccac7b5edb3fc38268aef943b65adc8a32e74b80bf1833a\",\"license\":\"MIT\"},\"contracts/libraries/bridge/Lib_CrossDomainUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_CrossDomainUtils\\n */\\nlibrary Lib_CrossDomainUtils {\\n /**\\n * Generates the correct cross domain calldata for a message.\\n * @param _target Target contract address.\\n * @param _sender Message sender address.\\n * @param _message Message to send to the target.\\n * @param _messageNonce Nonce for the provided message.\\n * @return ABI encoded cross domain calldata.\\n */\\n function encodeXDomainCalldata(\\n address _target,\\n address _sender,\\n bytes memory _message,\\n uint256 _messageNonce\\n ) internal pure returns (bytes memory) {\\n return\\n abi.encodeWithSignature(\\n \\\"relayMessage(address,address,bytes,uint256)\\\",\\n _target,\\n _sender,\\n _message,\\n _messageNonce\\n );\\n }\\n}\\n\",\"keccak256\":\"0xbb7fc8ab995ec8f1abb7a8be6a6d26d765cf9bf2c2c895f65d0c482011f8f200\",\"license\":\"MIT\"},\"contracts/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Enums *\\n *********/\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n /***********\\n * Structs *\\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 * 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(Transaction memory _transaction)\\n internal\\n pure\\n returns (bytes memory)\\n {\\n return\\n 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(Transaction memory _transaction) internal pure returns (bytes32) {\\n return keccak256(encodeTransaction(_transaction));\\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(bytes memory _encoded) internal pure returns (EVMAccount memory) {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return\\n 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n internal\\n pure\\n returns (bytes32)\\n {\\n return\\n keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb5009ac1e0617e0b3b2fb917f08f8e8a7ae706034cc3a675258bc3d91978525e\",\"license\":\"MIT\"},\"contracts/libraries/constants/Lib_DefaultValues.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_DefaultValues\\n */\\nlibrary Lib_DefaultValues {\\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\",\"keccak256\":\"0xa4c6003e04da72f20adb9caed0f8fd3faf5402ad8aa6034e8d9b440e7c0dd227\",\"license\":\"MIT\"},\"contracts/libraries/constants/Lib_PredeployAddresses.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_PredeployAddresses\\n */\\nlibrary Lib_PredeployAddresses {\\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\\n 0x4200000000000000000000000000000000000007;\\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\\n address internal constant L2_STANDARD_TOKEN_FACTORY =\\n 0x4200000000000000000000000000000000000012;\\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\\n}\\n\",\"keccak256\":\"0x2bc28307af93e9716151a41a81694b56cbe513ef5eb335fb1d81f35e5db8edfa\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\nabstract contract Lib_AddressResolver {\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(address _libAddressManager) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\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(string memory _name) public view returns (address) {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x515c4db671a28e2fe180201f6d11c0208c05f582ca3489fb6b8e81c27659bc62\",\"license\":\"MIT\"},\"contracts/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 internal constant MAX_LIST_LENGTH = 32;\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\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(bytes memory _in) internal pure returns (RLPItem memory) {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({ length: _in.length, ptr: ptr });\\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(RLPItem memory _in) internal pure returns (RLPItem[] memory) {\\n (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.LIST_ITEM, \\\"Invalid RLP list value.\\\");\\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(itemCount < MAX_LIST_LENGTH, \\\"Provided RLP list exceeds max list length.\\\");\\n\\n (uint256 itemOffset, uint256 itemLength, ) = _decodeLength(\\n RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })\\n );\\n\\n out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset });\\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(bytes memory _in) internal pure returns (RLPItem[] memory) {\\n return readList(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes memory) {\\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.DATA_ITEM, \\\"Invalid RLP bytes value.\\\");\\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(bytes memory _in) internal pure returns (bytes memory) {\\n return readBytes(toRLPItem(_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(RLPItem memory _in) internal pure returns (string memory) {\\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(bytes memory _in) internal pure returns (string memory) {\\n return readString(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes32) {\\n require(_in.length <= 33, \\\"Invalid RLP bytes32 value.\\\");\\n\\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.DATA_ITEM, \\\"Invalid RLP bytes32 value.\\\");\\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(bytes memory _in) internal pure returns (bytes32) {\\n return readBytes32(toRLPItem(_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(RLPItem memory _in) internal pure returns (uint256) {\\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(bytes memory _in) internal pure returns (uint256) {\\n return readUint256(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bool) {\\n require(_in.length == 1, \\\"Invalid RLP boolean value.\\\");\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n require(out == 0 || out == 1, \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\");\\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(bytes memory _in) internal pure returns (bool) {\\n return readBool(toRLPItem(_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(RLPItem memory _in) internal pure returns (address) {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(_in.length == 21, \\\"Invalid RLP address value.\\\");\\n\\n return address(uint160(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(bytes memory _in) internal pure returns (address) {\\n return readAddress(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes memory) {\\n return _copy(_in);\\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(RLPItem memory _in)\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(_in.length > 0, \\\"RLP item cannot be null.\\\");\\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 // slither-disable-next-line variable-scope\\n uint256 strLen = prefix - 0x80;\\n\\n require(_in.length > strLen, \\\"Invalid RLP short string.\\\");\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(_in.length > lenOfStrLen, \\\"Invalid RLP long string length.\\\");\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))\\n }\\n\\n require(_in.length > lenOfStrLen + strLen, \\\"Invalid RLP long string.\\\");\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n // slither-disable-next-line variable-scope\\n uint256 listLen = prefix - 0xc0;\\n\\n require(_in.length > listLen, \\\"Invalid RLP short list.\\\");\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(_in.length > lenOfListLen, \\\"Invalid RLP long list length.\\\");\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))\\n }\\n\\n require(_in.length > lenOfListLen + listLen, \\\"Invalid RLP long list.\\\");\\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 ) private pure returns (bytes memory) {\\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;\\n unchecked {\\n mask = 256**(32 - (_length % 32)) - 1;\\n }\\n\\n assembly {\\n mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))\\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(RLPItem memory _in) private pure returns (bytes memory) {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xd794d1b32c6e31d40e2526b5e519de1b4e8d14d6933889f9b916e69c5d1848c6\",\"license\":\"MIT\"},\"contracts/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\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(bytes memory _in) internal pure returns (bytes memory) {\\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(bytes[] memory _in) internal pure returns (bytes memory) {\\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(string memory _in) internal pure returns (bytes memory) {\\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(address _in) internal pure returns (bytes memory) {\\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(uint256 _in) internal pure returns (bytes memory) {\\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(bool _in) internal pure returns (bytes memory) {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\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(uint256 _len, uint256 _offset) private pure returns (bytes memory) {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = bytes1(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] = bytes1(uint8(lenLen) + uint8(_offset) + 55);\\n for (i = 1; i <= lenLen; i++) {\\n encoded[i] = bytes1(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(uint256 _x) private pure returns (bytes memory) {\\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 ) private pure {\\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;\\n unchecked {\\n mask = 256**(32 - len) - 1;\\n }\\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(bytes[] memory _list) private pure returns (bytes memory) {\\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 {\\n flattenedPtr := add(flattened, 0x20)\\n }\\n\\n for (i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly {\\n listPtr := add(item, 0x20)\\n }\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\\n\",\"keccak256\":\"0x215b90672ce126effc3f2df61ca0cdf52d2b1cc9be602877e637829b0bf229fd\",\"license\":\"MIT\"},\"contracts/libraries/trie/Lib_MerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * 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 * 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\\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 ) internal pure returns (bool _verified) {\\n (bool exists, bytes memory value) = get(_key, _proof, _root);\\n\\n return (exists && Lib_BytesUtils.equal(_value, value));\\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 ) internal pure returns (bool _exists, bytes memory _value) {\\n TrieNode[] memory proof = _parseProof(_proof);\\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(\\n proof,\\n _key,\\n _root\\n );\\n\\n bool exists = keyRemainder.length == 0;\\n\\n require(exists || isFinalNode, \\\"Provided proof is invalid.\\\");\\n\\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes(\\\"\\\");\\n\\n return (exists, value);\\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(keccak256(currentNode.encoded) == currentNodeID, \\\"Invalid root hash\\\");\\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\\n // meaning the value should be within this branch node.\\n break;\\n } else {\\n // We're not at the end of the key yet.\\n // Figure out what the next node ID should be and continue.\\n uint8 branchKey = uint8(key[currentKeyIndex]);\\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\\n currentNodeID = _getNodeID(nextNode);\\n currentKeyIncrement = 1;\\n continue;\\n }\\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\\n bytes memory path = _getNodePath(currentNode);\\n uint8 prefix = uint8(path[0]);\\n uint8 offset = 2 - (prefix % 2);\\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\\n\\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\\n if (\\n pathRemainder.length == sharedNibbleLength &&\\n keyRemainder.length == sharedNibbleLength\\n ) {\\n // The key within this leaf matches our key exactly.\\n // Increment the key index to reflect that we have no remainder.\\n currentKeyIndex += sharedNibbleLength;\\n }\\n\\n // We've hit a leaf node, so our next node should be NULL.\\n currentNodeID = bytes32(RLP_NULL);\\n break;\\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\\n if (sharedNibbleLength != pathRemainder.length) {\\n // Our extension node is not identical to the remainder.\\n // We've hit the end of this path\\n // 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 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(bytes memory _proof) private pure returns (TrieNode[] memory _parsed) {\\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({ encoded: encoded, decoded: Lib_RLPReader.readList(encoded) });\\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(Lib_RLPReader.RLPItem memory _node) private pure returns (bytes32 _nodeID) {\\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(TrieNode memory _node) private pure returns (bytes memory _path) {\\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\\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(TrieNode memory _node) private pure returns (bytes memory _value) {\\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\\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(bytes memory _a, bytes memory _b)\\n private\\n pure\\n returns (uint256 _shared)\\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\",\"keccak256\":\"0x081304d7627b242e0a5724785a9cc4128b3104460f234ffe404d7bc87c1ad162\",\"license\":\"MIT\"},\"contracts/libraries/trie/Lib_SecureMerkleTrie.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_MerkleTrie } from \\\"./Lib_MerkleTrie.sol\\\";\\n\\n/**\\n * @title Lib_SecureMerkleTrie\\n */\\nlibrary Lib_SecureMerkleTrie {\\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 ) internal pure returns (bool _verified) {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.verifyInclusionProof(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 ) internal pure returns (bool _exists, bytes memory _value) {\\n bytes memory key = _getSecureKey(_key);\\n return Lib_MerkleTrie.get(key, _proof, _root);\\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(bytes memory _key) private pure returns (bytes memory _secureKey) {\\n return abi.encodePacked(keccak256(_key));\\n }\\n}\\n\",\"keccak256\":\"0x38e47070ba79b1049b6d623db3377322d98c2217e8fa786bd48116fc7e3bfd9e\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\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(bytes32 _in) internal pure returns (bool) {\\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(bool _in) internal pure returns (bytes32) {\\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(bytes32 _in) internal pure returns (address) {\\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(address _in) internal pure returns (bytes32) {\\n return bytes32(uint256(uint160(_in)));\\n }\\n}\\n\",\"keccak256\":\"0xf2d1a526f2529e51fc2fffccf093c1691e291cbbb6de8a3da7d7f80024a9a234\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n ) internal pure returns (bytes memory) {\\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(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) {\\n if (_start >= _bytes.length) {\\n return bytes(\\\"\\\");\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {\\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(bytes memory _bytes) internal pure returns (uint256) {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) {\\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(bytes memory _bytes) internal pure returns (bytes memory) {\\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(bytes memory _bytes, bytes memory _other) internal pure returns (bool) {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xc39ee13f97e4ccfbc72a5aac571deb3c1aff882fca2dd18be794d43ac5de0a30\",\"license\":\"MIT\"},\"contracts/standards/AddressAliasHelper.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2019-2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity ^0.8.7;\\n\\nlibrary AddressAliasHelper {\\n uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);\\n\\n /// @notice Utility function that converts the address in the L1 that submitted a tx to\\n /// the inbox to the msg.sender viewed in the L2\\n /// @param l1Address the address in the L1 that triggered the tx to L2\\n /// @return l2Address L2 address as viewed in msg.sender\\n function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\\n unchecked {\\n l2Address = address(uint160(l1Address) + offset);\\n }\\n }\\n\\n /// @notice Utility function that converts the msg.sender viewed in the L2 to the\\n /// address in the L1 that submitted a tx to the inbox\\n /// @param l2Address L2 address as viewed in msg.sender\\n /// @return l1Address the address in the L1 that triggered the tx to L2\\n function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\\n unchecked {\\n l1Address = address(uint160(l2Address) - offset);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf330061b0ad081dd4d35a3efaeb3acd0a926c23ebb1ce7115007dac406d61b3f\",\"license\":\"Apache-2.0\"}},\"version\":1}", "bytecode": "0x608060405260cc80546001600160a01b03191661dead17905534801561002457600080fd5b50600080546001600160a01b0319169055613c54806100446000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c8063715018a6116100b2578063b1b1b20911610081578063c6b94ab011610066578063c6b94ab014610275578063d7fd19dd14610298578063f2fde38b146102ab57600080fd5b8063b1b1b2091461023f578063c4d66de81461026257600080fd5b8063715018a6146101fe57806381ada46c146102065780638456cb59146102195780638da5cb5b1461022157600080fd5b8063461a4478116100ee578063461a4478146101c55780635c975abb146101d85780636e296e45146101e35780636f1c8d47146101eb57600080fd5b80630ecf2eea1461012057806321d800ec14610135578063299ca4781461016d5780633dbb202b146101b2575b600080fd5b61013361012e36600461311d565b6102be565b005b61015861014336600461311d565b60ca6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b60005461018d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610164565b6101336101c0366004613295565b61036d565b61018d6101d33660046132f5565b6104b5565b60655460ff16610158565b61018d610562565b6101336101f9366004613346565b6105ec565b6101336107d3565b61013361021436600461311d565b610846565b6101336108ed565b60335473ffffffffffffffffffffffffffffffffffffffff1661018d565b61015861024d36600461311d565b60cb6020526000908152604090205460ff1681565b6101336102703660046133d2565b61095c565b61015861028336600461311d565b60c96020526000908152604090205460ff1681565b6101336102a6366004613538565b610ba9565b6101336102b93660046133d2565b611078565b60335473ffffffffffffffffffffffffffffffffffffffff16331461032a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60006103ad6040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506104b5565b905060008173ffffffffffffffffffffffffffffffffffffffff1663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b1580156103f757600080fd5b505afa15801561040b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042f9190613686565b905060006104468633878564ffffffffff16611174565b905061045983828663ffffffff166111ef565b8573ffffffffffffffffffffffffffffffffffffffff167fcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a338785886040516104a594939291906136fd565b60405180910390a2505050505050565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061050c908590600401613750565b60206040518083038186803b15801561052457600080fd5b505afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c9190613763565b92915050565b60cc5460009073ffffffffffffffffffffffffffffffffffffffff1661dead14156105cf5760405162461bcd60e51b815260206004820152601f60248201527f78446f6d61696e4d65737361676553656e646572206973206e6f7420736574006044820152606401610321565b5060cc5473ffffffffffffffffffffffffffffffffffffffff1690565b600061062c6040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506104b5565b6040517f2a7f18be0000000000000000000000000000000000000000000000000000000081526004810186905290915060009073ffffffffffffffffffffffffffffffffffffffff831690632a7f18be9060240160606040518083038186803b15801561069857600080fd5b505afa1580156106ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d09190613780565b905060006106e089898989611174565b905060007311110000000000000000000000000000000011113001734200000000000000000000000000000000000007878460405160200161072594939291906137e5565b604051602081830303815290604052805190602001209050826000015181146107b65760405162461bcd60e51b815260206004820152602760248201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60448201527f7175657565642e000000000000000000000000000000000000000000000000006064820152608401610321565b6107c784838763ffffffff166111ef565b50505050505050505050565b60335473ffffffffffffffffffffffffffffffffffffffff16331461083a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b6108446000611290565b565b60335473ffffffffffffffffffffffffffffffffffffffff1633146108ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b60335473ffffffffffffffffffffffffffffffffffffffff1633146109545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b610844611307565b6000547501000000000000000000000000000000000000000000900460ff16806109a1575060005474010000000000000000000000000000000000000000900460ff16155b610a135760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff16158015610a7a57600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b60005473ffffffffffffffffffffffffffffffffffffffff1615610b065760405162461bcd60e51b815260206004820152602a60248201527f4c3143726f7373446f6d61696e4d657373656e67657220616c7265616479206960448201527f6e7469616c697a65642e000000000000000000000000000000000000000000006064820152608401610321565b6000805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560cc805490911661dead179055610b5e6113b9565b610b66611508565b610b6e61162f565b610b76611788565b8015610ba557600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b5050565b60026097541415610bfc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610321565b600260975560655460ff1615610c545760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610321565b6000610c6286868686611174565b9050610c6e81836118dc565b1515600114610ce55760405162461bcd60e51b815260206004820152602760248201527f50726f7669646564206d65737361676520636f756c64206e6f7420626520766560448201527f7269666965642e000000000000000000000000000000000000000000000000006064820152608401610321565b8051602080830191909120600081815260cb90925260409091205460ff1615610d765760405162461bcd60e51b815260206004820152602b60248201527f50726f7669646564206d6573736167652068617320616c72656164792062656560448201527f6e2072656365697665642e0000000000000000000000000000000000000000006064820152608401610321565b600081815260c9602052604090205460ff1615610dfb5760405162461bcd60e51b815260206004820152602260248201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b6560448201527f642e0000000000000000000000000000000000000000000000000000000000006064820152608401610321565b610e396040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506104b5565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610eda5760405162461bcd60e51b815260206004820152603360248201527f43616e6e6f742073656e64204c322d3e4c31206d6573736167657320746f204c60448201527f312073797374656d20636f6e7472616374732e000000000000000000000000006064820152608401610321565b60cc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691909117909155604051600091891690610f3390889061382a565b6000604051808303816000865af19150503d8060008114610f70576040519150601f19603f3d011682016040523d82523d6000602084013e610f75565b606091505b505060cc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead179055905080151560011415610ff557600082815260cb6020526040808220805460ff191660011790555183917f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c91a2611021565b60405182907f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f90600090a25b600083334360405160200161103893929190613846565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff19166001908117909155609755505050505050505050565b60335473ffffffffffffffffffffffffffffffffffffffff1633146110df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b73ffffffffffffffffffffffffffffffffffffffff81166111685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610321565b61117181611290565b50565b60608484848460405160240161118d9493929190613898565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fcbd4ece9000000000000000000000000000000000000000000000000000000001790529050949350505050565b6040517f6fee07e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690636fee07e0906112599073420000000000000000000000000000000000000790859087906004016138e2565b600060405180830381600087803b15801561127357600080fd5b505af1158015611287573d6000803e3d6000fd5b50505050505050565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60655460ff161561135a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610321565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861138f3390565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6000547501000000000000000000000000000000000000000000900460ff16806113fe575060005474010000000000000000000000000000000000000000900460ff16155b6114705760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff161580156114d757600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b801561117157600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b6000547501000000000000000000000000000000000000000000900460ff168061154d575060005474010000000000000000000000000000000000000000900460ff16155b6115bf5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff1615801561162657600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b6114d733611290565b6000547501000000000000000000000000000000000000000000900460ff1680611674575060005474010000000000000000000000000000000000000000900460ff16155b6116e65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff1615801561174d57600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b6065805460ff19169055801561117157600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b6000547501000000000000000000000000000000000000000000900460ff16806117cd575060005474010000000000000000000000000000000000000000900460ff16155b61183f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff161580156118a657600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b6001609755801561117157600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b60006118e7826118ff565b80156118f857506118f88383611aa1565b9392505050565b6000806119406040518060400160405280601481526020017f5374617465436f6d6d69746d656e74436861696e0000000000000000000000008152506104b5565b60208401516040517f9418bddd00000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff831691639418bddd9161199891600401613954565b60206040518083038186803b1580156119b057600080fd5b505afa1580156119c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e89190613967565b1580156118f857508251602084015160408086015190517f4d69ee5700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851693634d69ee5793611a51939192909190600401613989565b60206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f89190613967565b60008083734200000000000000000000000000000000000007604051602001611acb929190613a01565b60408051601f1981840301815282825280516020918201209083015260009082015260600160408051601f198184030181529082905280516020918201207f42000000000000000000000000000000000000000000000000000000000000009183019190915291506000908190611b5b9060340160408051601f1981840301815291905260608701518751611c85565b9092509050600182151514611bfe5760405162461bcd60e51b815260206004820152604d60248201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60448201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260648201527f6f6f662070726f76696465642e00000000000000000000000000000000000000608482015260a401610321565b6000611c0982611cae565b9050611c7a84604051602001611c2191815260200190565b60408051601f19818403018152908290527f010000000000000000000000000000000000000000000000000000000000000060208301529060210160405160208183030381529060405288608001518460400151611d72565b979650505050505050565b600060606000611c9486611d96565b9050611ca1818686611dc8565b9250925050935093915050565b604080516080810182526000808252602082018190529181018290526060810182905290611cdb83611ea3565b90506040518060800160405280611d0b83600081518110611cfe57611cfe613a4b565b6020026020010151611ed6565b8152602001611d2683600181518110611cfe57611cfe613a4b565b8152602001611d4e83600281518110611d4157611d41613a4b565b6020026020010151611edd565b8152602001611d6983600381518110611d4157611d41613a4b565b90529392505050565b600080611d7e86611d96565b9050611d8c81868686611fdf565b9695505050505050565b60608180519060200120604051602001611db291815260200190565b6040516020818303038152906040529050919050565b600060606000611dd785612015565b90506000806000611de9848a89612110565b81519295509093509150158080611dfd5750815b611e495760405162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e0000000000006044820152606401610321565b600081611e655760405180602001604052806000815250611e91565b611e9186611e74600188613aa9565b81518110611e8457611e84613a4b565b60200260200101516125ab565b919b919a509098505050505050505050565b60408051808201825260008082526020918201528151808301909252825182528083019082015260609061055c906125d5565b600061055c825b6000602182600001511115611f345760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e0000000000006044820152606401610321565b6000806000611f42856127d4565b919450925090506000816001811115611f5d57611f5d613ac0565b14611faa5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e0000000000006044820152606401610321565b6000838660200151611fbc9190613aef565b80519091506020841015611d8c5760208490036101000a90049695505050505050565b6000806000611fef878686611dc8565b91509150818015611c7a5750805160208083019190912087519188019190912014611c7a565b6060600061202283611ea3565b90506000815167ffffffffffffffff81111561204057612040613158565b60405190808252806020026020018201604052801561208557816020015b604080518082019091526060808252602082015281526020019060019003908161205e5790505b50905060005b82518110156121085760006120b88483815181106120ab576120ab613a4b565b6020026020010151612b25565b905060405180604001604052808281526020016120d483611ea3565b8152508383815181106120e9576120e9613a4b565b602002602001018190525050808061210090613b07565b91505061208b565b509392505050565b6000606081808061212087612bb5565b90506000869050600080612147604051806040016040528060608152602001606081525090565b60005b8c51811015612567578c818151811061216557612165613a4b565b60200260200101519150828461217b9190613aef565b9350612188600188613aef565b9650836121ec578151805160209091012085146121e75760405162461bcd60e51b815260206004820152601160248201527f496e76616c696420726f6f7420686173680000000000000000000000000000006044820152606401610321565b6122a9565b81515160201161224e578151805160209091012085146121e75760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c206861736800000000006044820152606401610321565b8461225c8360000151612d38565b146122a95760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f646520686173680000000000006044820152606401610321565b6122b560106001613aef565b826020015151141561232e5785518414156122cf57612567565b60008685815181106122e3576122e3613a4b565b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061230e5761230e613a4b565b6020026020010151905061232181612d60565b9650600194505050612555565b6002826020015151141561250d57600061234783612d96565b905060008160008151811061235e5761235e613a4b565b016020015160f81c90506000612375600283613b6f565b612380906002613b91565b90506000612391848360ff16612dba565b9050600061239f8b8a612dba565b905060006123ad8383612df0565b905060ff8516600214806123c4575060ff85166003145b1561241a578083511480156123d95750808251145b156123eb576123e8818b613aef565b99505b507f80000000000000000000000000000000000000000000000000000000000000009950612567945050505050565b60ff8516158061242d575060ff85166001145b1561249f578251811461246957507f80000000000000000000000000000000000000000000000000000000000000009950612567945050505050565b612490886020015160018151811061248357612483613a4b565b6020026020010151612d60565b9a509750612555945050505050565b60405162461bcd60e51b815260206004820152602660248201527f52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e2060448201527f70726566697800000000000000000000000000000000000000000000000000006064820152608401610321565b60405162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e0000006044820152606401610321565b8061255f81613b07565b91505061214a565b507f80000000000000000000000000000000000000000000000000000000000000008414866125968786612dba565b909e909d50909b509950505050505050505050565b6020810151805160609161055c916125c590600190613aa9565b815181106120ab576120ab613a4b565b60606000806125e3846127d4565b919350909150600190508160018111156125ff576125ff613ac0565b1461264c5760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e0000000000000000006044820152606401610321565b6040805160208082526104208201909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816126655790505090506000835b86518110156127c957602082106127115760405162461bcd60e51b815260206004820152602a60248201527f50726f766964656420524c50206c6973742065786365656473206d6178206c6960448201527f7374206c656e6774682e000000000000000000000000000000000000000000006064820152608401610321565b60008061274e6040518060400160405280858c600001516127329190613aa9565b8152602001858c602001516127479190613aef565b90526127d4565b50915091506040518060400160405280838361276a9190613aef565b8152602001848b6020015161277f9190613aef565b81525085858151811061279457612794613a4b565b60209081029190910101526127aa600185613aef565b93506127b68183613aef565b6127c09084613aef565b92505050612692565b508152949350505050565b60008060008084600001511161282c5760405162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e00000000000000006044820152606401610321565b6020840151805160001a607f8111612851576000600160009450945094505050612b1e565b60b781116128cd576000612866608083613aa9565b9050808760000151116128bb5760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e000000000000006044820152606401610321565b60019550935060009250612b1e915050565b60bf81116129bc5760006128e260b783613aa9565b9050808760000151116129375760405162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e006044820152606401610321565b600183015160208290036101000a90046129518183613aef565b8851116129a05760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e00000000000000006044820152606401610321565b6129ab826001613aef565b9650945060009350612b1e92505050565b60f78111612a375760006129d160c083613aa9565b905080876000015111612a265760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e0000000000000000006044820152606401610321565b600195509350849250612b1e915050565b6000612a4460f783613aa9565b905080876000015111612a995760405162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e0000006044820152606401610321565b600183015160208290036101000a9004612ab38183613aef565b885111612b025760405162461bcd60e51b815260206004820152601660248201527f496e76616c696420524c50206c6f6e67206c6973742e000000000000000000006044820152606401610321565b612b0d826001613aef565b9650945060019350612b1e92505050565b9193909250565b60606000806000612b35856127d4565b919450925090506000816001811115612b5057612b50613ac0565b14612b9d5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e00000000000000006044820152606401610321565b612bac85602001518484612e9c565b95945050505050565b6060600082516002612bc79190613bb4565b67ffffffffffffffff811115612bdf57612bdf613158565b6040519080825280601f01601f191660200182016040528015612c09576020820181803683370190505b50905060005b8351811015612d31576004848281518110612c2c57612c2c613a4b565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016901c82612c61836002613bb4565b81518110612c7157612c71613a4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506010848281518110612cb457612cb4613a4b565b0160200151612cc6919060f81c613b6f565b60f81b82612cd5836002613bb4565b612ce0906001613aef565b81518110612cf057612cf0613a4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080612d2981613b07565b915050612c0f565b5092915050565b6000602082511015612d4c57506020015190565b8180602001905181019061055c9190613bf1565b60006060602083600001511015612d8157612d7a83612f7b565b9050612d8d565b612d8a83612b25565b90505b6118f881612d38565b606061055c612db583602001516000815181106120ab576120ab613a4b565b612bb5565b606082518210612dd9575060408051602081019091526000815261055c565b6118f88383848651612deb9190613aa9565b612f86565b6000805b808451118015612e045750808351115b8015612e855750828181518110612e1d57612e1d613a4b565b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916848281518110612e5c57612e5c613a4b565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016145b156118f85780612e9481613b07565b915050612df4565b606060008267ffffffffffffffff811115612eb957612eb9613158565b6040519080825280601f01601f191660200182016040528015612ee3576020820181803683370190505b509050805160001415612ef75790506118f8565b6000612f038587613aef565b90506020820160005b612f17602087613c0a565b811015612f4e5782518252612f2d602084613aef565b9250612f3a602083613aef565b915080612f4681613b07565b915050612f0c565b5060006001602087066020036101000a039050808251168119845116178252839450505050509392505050565b606061055c82613107565b606081612f9481601f613aef565b1015612fe25760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401610321565b82612fed8382613aef565b101561303b5760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401610321565b6130458284613aef565b845110156130955760405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606401610321565b6060821580156130b457604051915060008252602082016040526130fe565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156130ed5780518352602092830192016130d5565b5050858452601f01601f1916604052505b50949350505050565b606061055c826020015160008460000151612e9c565b60006020828403121561312f57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461117157600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156131aa576131aa613158565b60405290565b60405160a0810167ffffffffffffffff811182821017156131aa576131aa613158565b604051601f8201601f1916810167ffffffffffffffff811182821017156131fc576131fc613158565b604052919050565b600067ffffffffffffffff83111561321e5761321e613158565b6132316020601f19601f860116016131d3565b905082815283838301111561324557600080fd5b828260208301376000602084830101529392505050565b600082601f83011261326d57600080fd5b6118f883833560208501613204565b803563ffffffff8116811461329057600080fd5b919050565b6000806000606084860312156132aa57600080fd5b83356132b581613136565b9250602084013567ffffffffffffffff8111156132d157600080fd5b6132dd8682870161325c565b9250506132ec6040850161327c565b90509250925092565b60006020828403121561330757600080fd5b813567ffffffffffffffff81111561331e57600080fd5b8201601f8101841361332f57600080fd5b61333e84823560208401613204565b949350505050565b60008060008060008060c0878903121561335f57600080fd5b863561336a81613136565b9550602087013561337a81613136565b9450604087013567ffffffffffffffff81111561339657600080fd5b6133a289828a0161325c565b945050606087013592506133b86080880161327c565b91506133c660a0880161327c565b90509295509295509295565b6000602082840312156133e457600080fd5b81356118f881613136565b600060a0828403121561340157600080fd5b60405160a0810167ffffffffffffffff828210818311171561342557613425613158565b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561346257600080fd5b5061346f8582860161325c565b6080830152505092915050565b60006040828403121561348e57600080fd5b613496613187565b90508135815260208083013567ffffffffffffffff808211156134b857600080fd5b818501915085601f8301126134cc57600080fd5b8135818111156134de576134de613158565b8060051b91506134ef8483016131d3565b818152918301840191848101908884111561350957600080fd5b938501935b838510156135275784358252938501939085019061350e565b808688015250505050505092915050565b600080600080600060a0868803121561355057600080fd5b853561355b81613136565b9450602086013561356b81613136565b9350604086013567ffffffffffffffff8082111561358857600080fd5b61359489838a0161325c565b94506060880135935060808801359150808211156135b157600080fd5b9087019060a0828a0312156135c557600080fd5b6135cd6131b0565b823581526020830135828111156135e357600080fd5b6135ef8b8286016133ef565b60208301525060408301358281111561360757600080fd5b6136138b82860161347c565b60408301525060608301358281111561362b57600080fd5b6136378b82860161325c565b60608301525060808301358281111561364f57600080fd5b61365b8b82860161325c565b6080830152508093505050509295509295909350565b805164ffffffffff8116811461329057600080fd5b60006020828403121561369857600080fd5b6118f882613671565b60005b838110156136bc5781810151838201526020016136a4565b838111156136cb576000848401525b50505050565b600081518084526136e98160208601602086016136a1565b601f01601f19169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8516815260806020820152600061372c60808301866136d1565b905064ffffffffff8416604083015263ffffffff8316606083015295945050505050565b6020815260006118f860208301846136d1565b60006020828403121561377557600080fd5b81516118f881613136565b60006060828403121561379257600080fd5b6040516060810181811067ffffffffffffffff821117156137b5576137b5613158565b604052825181526137c860208401613671565b60208201526137d960408401613671565b60408201529392505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525063ffffffff8416604083015260806060830152611d8c60808301846136d1565b6000825161383c8184602087016136a1565b9190910192915050565b600084516138588184602089016136a1565b60609490941b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001691909301908152601481019190915260340192915050565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250608060408301526138d160808301856136d1565b905082606083015295945050505050565b73ffffffffffffffffffffffffffffffffffffffff84168152826020820152606060408201526000612bac60608301846136d1565b805182526020810151602083015260408101516040830152606081015160608301526000608082015160a0608085015261333e60a08501826136d1565b6020815260006118f86020830184613917565b60006020828403121561397957600080fd5b815180151581146118f857600080fd5b838152600060206060818401526139a36060840186613917565b83810360408501526040810185518252828601516040848401528181518084526060850191508583019450600093505b808410156139f357845182529385019360019390930192908501906139d3565b509998505050505050505050565b60008351613a138184602088016136a1565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015613abb57613abb613a7a565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60008219821115613b0257613b02613a7a565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b3957613b39613a7a565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600060ff831680613b8257613b82613b40565b8060ff84160691505092915050565b600060ff821660ff841680821015613bab57613bab613a7a565b90039392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bec57613bec613a7a565b500290565b600060208284031215613c0357600080fd5b5051919050565b600082613c1957613c19613b40565b50049056fea2646970667358221220519d4dd06fdca55c7846233d66cce54c28d04b6fad7bf6aa770977b4e1ba665664736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061011b5760003560e01c8063715018a6116100b2578063b1b1b20911610081578063c6b94ab011610066578063c6b94ab014610275578063d7fd19dd14610298578063f2fde38b146102ab57600080fd5b8063b1b1b2091461023f578063c4d66de81461026257600080fd5b8063715018a6146101fe57806381ada46c146102065780638456cb59146102195780638da5cb5b1461022157600080fd5b8063461a4478116100ee578063461a4478146101c55780635c975abb146101d85780636e296e45146101e35780636f1c8d47146101eb57600080fd5b80630ecf2eea1461012057806321d800ec14610135578063299ca4781461016d5780633dbb202b146101b2575b600080fd5b61013361012e36600461311d565b6102be565b005b61015861014336600461311d565b60ca6020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b60005461018d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610164565b6101336101c0366004613295565b61036d565b61018d6101d33660046132f5565b6104b5565b60655460ff16610158565b61018d610562565b6101336101f9366004613346565b6105ec565b6101336107d3565b61013361021436600461311d565b610846565b6101336108ed565b60335473ffffffffffffffffffffffffffffffffffffffff1661018d565b61015861024d36600461311d565b60cb6020526000908152604090205460ff1681565b6101336102703660046133d2565b61095c565b61015861028336600461311d565b60c96020526000908152604090205460ff1681565b6101336102a6366004613538565b610ba9565b6101336102b93660046133d2565b611078565b60335473ffffffffffffffffffffffffffffffffffffffff16331461032a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600081815260c96020526040808220805460ff191660011790555182917ff52508d5339edf0d7e5060a416df98db067af561bdc60872d29c0439eaa13a0291a250565b60006103ad6040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506104b5565b905060008173ffffffffffffffffffffffffffffffffffffffff1663b8f770056040518163ffffffff1660e01b815260040160206040518083038186803b1580156103f757600080fd5b505afa15801561040b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042f9190613686565b905060006104468633878564ffffffffff16611174565b905061045983828663ffffffff166111ef565b8573ffffffffffffffffffffffffffffffffffffffff167fcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a338785886040516104a594939291906136fd565b60405180910390a2505050505050565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061050c908590600401613750565b60206040518083038186803b15801561052457600080fd5b505afa158015610538573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055c9190613763565b92915050565b60cc5460009073ffffffffffffffffffffffffffffffffffffffff1661dead14156105cf5760405162461bcd60e51b815260206004820152601f60248201527f78446f6d61696e4d65737361676553656e646572206973206e6f7420736574006044820152606401610321565b5060cc5473ffffffffffffffffffffffffffffffffffffffff1690565b600061062c6040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506104b5565b6040517f2a7f18be0000000000000000000000000000000000000000000000000000000081526004810186905290915060009073ffffffffffffffffffffffffffffffffffffffff831690632a7f18be9060240160606040518083038186803b15801561069857600080fd5b505afa1580156106ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d09190613780565b905060006106e089898989611174565b905060007311110000000000000000000000000000000011113001734200000000000000000000000000000000000007878460405160200161072594939291906137e5565b604051602081830303815290604052805190602001209050826000015181146107b65760405162461bcd60e51b815260206004820152602760248201527f50726f7669646564206d65737361676520686173206e6f74206265656e20656e60448201527f7175657565642e000000000000000000000000000000000000000000000000006064820152608401610321565b6107c784838763ffffffff166111ef565b50505050505050505050565b60335473ffffffffffffffffffffffffffffffffffffffff16331461083a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b6108446000611290565b565b60335473ffffffffffffffffffffffffffffffffffffffff1633146108ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b600081815260c96020526040808220805460ff191690555182917f52c8a2680a9f4cc0ad0bf88f32096eadbebf0646ea611d93a0ce6a29a024040591a250565b60335473ffffffffffffffffffffffffffffffffffffffff1633146109545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b610844611307565b6000547501000000000000000000000000000000000000000000900460ff16806109a1575060005474010000000000000000000000000000000000000000900460ff16155b610a135760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff16158015610a7a57600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b60005473ffffffffffffffffffffffffffffffffffffffff1615610b065760405162461bcd60e51b815260206004820152602a60248201527f4c3143726f7373446f6d61696e4d657373656e67657220616c7265616479206960448201527f6e7469616c697a65642e000000000000000000000000000000000000000000006064820152608401610321565b6000805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560cc805490911661dead179055610b5e6113b9565b610b66611508565b610b6e61162f565b610b76611788565b8015610ba557600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff1690555b5050565b60026097541415610bfc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610321565b600260975560655460ff1615610c545760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610321565b6000610c6286868686611174565b9050610c6e81836118dc565b1515600114610ce55760405162461bcd60e51b815260206004820152602760248201527f50726f7669646564206d65737361676520636f756c64206e6f7420626520766560448201527f7269666965642e000000000000000000000000000000000000000000000000006064820152608401610321565b8051602080830191909120600081815260cb90925260409091205460ff1615610d765760405162461bcd60e51b815260206004820152602b60248201527f50726f7669646564206d6573736167652068617320616c72656164792062656560448201527f6e2072656365697665642e0000000000000000000000000000000000000000006064820152608401610321565b600081815260c9602052604090205460ff1615610dfb5760405162461bcd60e51b815260206004820152602260248201527f50726f7669646564206d65737361676520686173206265656e20626c6f636b6560448201527f642e0000000000000000000000000000000000000000000000000000000000006064820152608401610321565b610e396040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506104b5565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415610eda5760405162461bcd60e51b815260206004820152603360248201527f43616e6e6f742073656e64204c322d3e4c31206d6573736167657320746f204c60448201527f312073797374656d20636f6e7472616374732e000000000000000000000000006064820152608401610321565b60cc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691909117909155604051600091891690610f3390889061382a565b6000604051808303816000865af19150503d8060008114610f70576040519150601f19603f3d011682016040523d82523d6000602084013e610f75565b606091505b505060cc80547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead179055905080151560011415610ff557600082815260cb6020526040808220805460ff191660011790555183917f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c91a2611021565b60405182907f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f90600090a25b600083334360405160200161103893929190613846565b60408051601f198184030181529181528151602092830120600090815260ca9092529020805460ff19166001908117909155609755505050505050505050565b60335473ffffffffffffffffffffffffffffffffffffffff1633146110df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610321565b73ffffffffffffffffffffffffffffffffffffffff81166111685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610321565b61117181611290565b50565b60608484848460405160240161118d9493929190613898565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fcbd4ece9000000000000000000000000000000000000000000000000000000001790529050949350505050565b6040517f6fee07e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690636fee07e0906112599073420000000000000000000000000000000000000790859087906004016138e2565b600060405180830381600087803b15801561127357600080fd5b505af1158015611287573d6000803e3d6000fd5b50505050505050565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60655460ff161561135a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610321565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861138f3390565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b6000547501000000000000000000000000000000000000000000900460ff16806113fe575060005474010000000000000000000000000000000000000000900460ff16155b6114705760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff161580156114d757600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b801561117157600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b6000547501000000000000000000000000000000000000000000900460ff168061154d575060005474010000000000000000000000000000000000000000900460ff16155b6115bf5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff1615801561162657600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b6114d733611290565b6000547501000000000000000000000000000000000000000000900460ff1680611674575060005474010000000000000000000000000000000000000000900460ff16155b6116e65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff1615801561174d57600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b6065805460ff19169055801561117157600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b6000547501000000000000000000000000000000000000000000900460ff16806117cd575060005474010000000000000000000000000000000000000000900460ff16155b61183f5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610321565b6000547501000000000000000000000000000000000000000000900460ff161580156118a657600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff1675010100000000000000000000000000000000000000001790555b6001609755801561117157600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550565b60006118e7826118ff565b80156118f857506118f88383611aa1565b9392505050565b6000806119406040518060400160405280601481526020017f5374617465436f6d6d69746d656e74436861696e0000000000000000000000008152506104b5565b60208401516040517f9418bddd00000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff831691639418bddd9161199891600401613954565b60206040518083038186803b1580156119b057600080fd5b505afa1580156119c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e89190613967565b1580156118f857508251602084015160408086015190517f4d69ee5700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851693634d69ee5793611a51939192909190600401613989565b60206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f89190613967565b60008083734200000000000000000000000000000000000007604051602001611acb929190613a01565b60408051601f1981840301815282825280516020918201209083015260009082015260600160408051601f198184030181529082905280516020918201207f42000000000000000000000000000000000000000000000000000000000000009183019190915291506000908190611b5b9060340160408051601f1981840301815291905260608701518751611c85565b9092509050600182151514611bfe5760405162461bcd60e51b815260206004820152604d60248201527f4d6573736167652070617373696e67207072656465706c6f7920686173206e6f60448201527f74206265656e20696e697469616c697a6564206f7220696e76616c696420707260648201527f6f6f662070726f76696465642e00000000000000000000000000000000000000608482015260a401610321565b6000611c0982611cae565b9050611c7a84604051602001611c2191815260200190565b60408051601f19818403018152908290527f010000000000000000000000000000000000000000000000000000000000000060208301529060210160405160208183030381529060405288608001518460400151611d72565b979650505050505050565b600060606000611c9486611d96565b9050611ca1818686611dc8565b9250925050935093915050565b604080516080810182526000808252602082018190529181018290526060810182905290611cdb83611ea3565b90506040518060800160405280611d0b83600081518110611cfe57611cfe613a4b565b6020026020010151611ed6565b8152602001611d2683600181518110611cfe57611cfe613a4b565b8152602001611d4e83600281518110611d4157611d41613a4b565b6020026020010151611edd565b8152602001611d6983600381518110611d4157611d41613a4b565b90529392505050565b600080611d7e86611d96565b9050611d8c81868686611fdf565b9695505050505050565b60608180519060200120604051602001611db291815260200190565b6040516020818303038152906040529050919050565b600060606000611dd785612015565b90506000806000611de9848a89612110565b81519295509093509150158080611dfd5750815b611e495760405162461bcd60e51b815260206004820152601a60248201527f50726f76696465642070726f6f6620697320696e76616c69642e0000000000006044820152606401610321565b600081611e655760405180602001604052806000815250611e91565b611e9186611e74600188613aa9565b81518110611e8457611e84613a4b565b60200260200101516125ab565b919b919a509098505050505050505050565b60408051808201825260008082526020918201528151808301909252825182528083019082015260609061055c906125d5565b600061055c825b6000602182600001511115611f345760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e0000000000006044820152606401610321565b6000806000611f42856127d4565b919450925090506000816001811115611f5d57611f5d613ac0565b14611faa5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420524c5020627974657333322076616c75652e0000000000006044820152606401610321565b6000838660200151611fbc9190613aef565b80519091506020841015611d8c5760208490036101000a90049695505050505050565b6000806000611fef878686611dc8565b91509150818015611c7a5750805160208083019190912087519188019190912014611c7a565b6060600061202283611ea3565b90506000815167ffffffffffffffff81111561204057612040613158565b60405190808252806020026020018201604052801561208557816020015b604080518082019091526060808252602082015281526020019060019003908161205e5790505b50905060005b82518110156121085760006120b88483815181106120ab576120ab613a4b565b6020026020010151612b25565b905060405180604001604052808281526020016120d483611ea3565b8152508383815181106120e9576120e9613a4b565b602002602001018190525050808061210090613b07565b91505061208b565b509392505050565b6000606081808061212087612bb5565b90506000869050600080612147604051806040016040528060608152602001606081525090565b60005b8c51811015612567578c818151811061216557612165613a4b565b60200260200101519150828461217b9190613aef565b9350612188600188613aef565b9650836121ec578151805160209091012085146121e75760405162461bcd60e51b815260206004820152601160248201527f496e76616c696420726f6f7420686173680000000000000000000000000000006044820152606401610321565b6122a9565b81515160201161224e578151805160209091012085146121e75760405162461bcd60e51b815260206004820152601b60248201527f496e76616c6964206c6172676520696e7465726e616c206861736800000000006044820152606401610321565b8461225c8360000151612d38565b146122a95760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420696e7465726e616c206e6f646520686173680000000000006044820152606401610321565b6122b560106001613aef565b826020015151141561232e5785518414156122cf57612567565b60008685815181106122e3576122e3613a4b565b602001015160f81c60f81b60f81c9050600083602001518260ff168151811061230e5761230e613a4b565b6020026020010151905061232181612d60565b9650600194505050612555565b6002826020015151141561250d57600061234783612d96565b905060008160008151811061235e5761235e613a4b565b016020015160f81c90506000612375600283613b6f565b612380906002613b91565b90506000612391848360ff16612dba565b9050600061239f8b8a612dba565b905060006123ad8383612df0565b905060ff8516600214806123c4575060ff85166003145b1561241a578083511480156123d95750808251145b156123eb576123e8818b613aef565b99505b507f80000000000000000000000000000000000000000000000000000000000000009950612567945050505050565b60ff8516158061242d575060ff85166001145b1561249f578251811461246957507f80000000000000000000000000000000000000000000000000000000000000009950612567945050505050565b612490886020015160018151811061248357612483613a4b565b6020026020010151612d60565b9a509750612555945050505050565b60405162461bcd60e51b815260206004820152602660248201527f52656365697665642061206e6f6465207769746820616e20756e6b6e6f776e2060448201527f70726566697800000000000000000000000000000000000000000000000000006064820152608401610321565b60405162461bcd60e51b815260206004820152601d60248201527f526563656976656420616e20756e706172736561626c65206e6f64652e0000006044820152606401610321565b8061255f81613b07565b91505061214a565b507f80000000000000000000000000000000000000000000000000000000000000008414866125968786612dba565b909e909d50909b509950505050505050505050565b6020810151805160609161055c916125c590600190613aa9565b815181106120ab576120ab613a4b565b60606000806125e3846127d4565b919350909150600190508160018111156125ff576125ff613ac0565b1461264c5760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c50206c6973742076616c75652e0000000000000000006044820152606401610321565b6040805160208082526104208201909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816126655790505090506000835b86518110156127c957602082106127115760405162461bcd60e51b815260206004820152602a60248201527f50726f766964656420524c50206c6973742065786365656473206d6178206c6960448201527f7374206c656e6774682e000000000000000000000000000000000000000000006064820152608401610321565b60008061274e6040518060400160405280858c600001516127329190613aa9565b8152602001858c602001516127479190613aef565b90526127d4565b50915091506040518060400160405280838361276a9190613aef565b8152602001848b6020015161277f9190613aef565b81525085858151811061279457612794613a4b565b60209081029190910101526127aa600185613aef565b93506127b68183613aef565b6127c09084613aef565b92505050612692565b508152949350505050565b60008060008084600001511161282c5760405162461bcd60e51b815260206004820152601860248201527f524c50206974656d2063616e6e6f74206265206e756c6c2e00000000000000006044820152606401610321565b6020840151805160001a607f8111612851576000600160009450945094505050612b1e565b60b781116128cd576000612866608083613aa9565b9050808760000151116128bb5760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420524c502073686f727420737472696e672e000000000000006044820152606401610321565b60019550935060009250612b1e915050565b60bf81116129bc5760006128e260b783613aa9565b9050808760000151116129375760405162461bcd60e51b815260206004820152601f60248201527f496e76616c696420524c50206c6f6e6720737472696e67206c656e6774682e006044820152606401610321565b600183015160208290036101000a90046129518183613aef565b8851116129a05760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c50206c6f6e6720737472696e672e00000000000000006044820152606401610321565b6129ab826001613aef565b9650945060009350612b1e92505050565b60f78111612a375760006129d160c083613aa9565b905080876000015111612a265760405162461bcd60e51b815260206004820152601760248201527f496e76616c696420524c502073686f7274206c6973742e0000000000000000006044820152606401610321565b600195509350849250612b1e915050565b6000612a4460f783613aa9565b905080876000015111612a995760405162461bcd60e51b815260206004820152601d60248201527f496e76616c696420524c50206c6f6e67206c697374206c656e6774682e0000006044820152606401610321565b600183015160208290036101000a9004612ab38183613aef565b885111612b025760405162461bcd60e51b815260206004820152601660248201527f496e76616c696420524c50206c6f6e67206c6973742e000000000000000000006044820152606401610321565b612b0d826001613aef565b9650945060019350612b1e92505050565b9193909250565b60606000806000612b35856127d4565b919450925090506000816001811115612b5057612b50613ac0565b14612b9d5760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420524c502062797465732076616c75652e00000000000000006044820152606401610321565b612bac85602001518484612e9c565b95945050505050565b6060600082516002612bc79190613bb4565b67ffffffffffffffff811115612bdf57612bdf613158565b6040519080825280601f01601f191660200182016040528015612c09576020820181803683370190505b50905060005b8351811015612d31576004848281518110612c2c57612c2c613a4b565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016901c82612c61836002613bb4565b81518110612c7157612c71613a4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506010848281518110612cb457612cb4613a4b565b0160200151612cc6919060f81c613b6f565b60f81b82612cd5836002613bb4565b612ce0906001613aef565b81518110612cf057612cf0613a4b565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080612d2981613b07565b915050612c0f565b5092915050565b6000602082511015612d4c57506020015190565b8180602001905181019061055c9190613bf1565b60006060602083600001511015612d8157612d7a83612f7b565b9050612d8d565b612d8a83612b25565b90505b6118f881612d38565b606061055c612db583602001516000815181106120ab576120ab613a4b565b612bb5565b606082518210612dd9575060408051602081019091526000815261055c565b6118f88383848651612deb9190613aa9565b612f86565b6000805b808451118015612e045750808351115b8015612e855750828181518110612e1d57612e1d613a4b565b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916848281518110612e5c57612e5c613a4b565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016145b156118f85780612e9481613b07565b915050612df4565b606060008267ffffffffffffffff811115612eb957612eb9613158565b6040519080825280601f01601f191660200182016040528015612ee3576020820181803683370190505b509050805160001415612ef75790506118f8565b6000612f038587613aef565b90506020820160005b612f17602087613c0a565b811015612f4e5782518252612f2d602084613aef565b9250612f3a602083613aef565b915080612f4681613b07565b915050612f0c565b5060006001602087066020036101000a039050808251168119845116178252839450505050509392505050565b606061055c82613107565b606081612f9481601f613aef565b1015612fe25760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401610321565b82612fed8382613aef565b101561303b5760405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401610321565b6130458284613aef565b845110156130955760405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606401610321565b6060821580156130b457604051915060008252602082016040526130fe565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156130ed5780518352602092830192016130d5565b5050858452601f01601f1916604052505b50949350505050565b606061055c826020015160008460000151612e9c565b60006020828403121561312f57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461117157600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156131aa576131aa613158565b60405290565b60405160a0810167ffffffffffffffff811182821017156131aa576131aa613158565b604051601f8201601f1916810167ffffffffffffffff811182821017156131fc576131fc613158565b604052919050565b600067ffffffffffffffff83111561321e5761321e613158565b6132316020601f19601f860116016131d3565b905082815283838301111561324557600080fd5b828260208301376000602084830101529392505050565b600082601f83011261326d57600080fd5b6118f883833560208501613204565b803563ffffffff8116811461329057600080fd5b919050565b6000806000606084860312156132aa57600080fd5b83356132b581613136565b9250602084013567ffffffffffffffff8111156132d157600080fd5b6132dd8682870161325c565b9250506132ec6040850161327c565b90509250925092565b60006020828403121561330757600080fd5b813567ffffffffffffffff81111561331e57600080fd5b8201601f8101841361332f57600080fd5b61333e84823560208401613204565b949350505050565b60008060008060008060c0878903121561335f57600080fd5b863561336a81613136565b9550602087013561337a81613136565b9450604087013567ffffffffffffffff81111561339657600080fd5b6133a289828a0161325c565b945050606087013592506133b86080880161327c565b91506133c660a0880161327c565b90509295509295509295565b6000602082840312156133e457600080fd5b81356118f881613136565b600060a0828403121561340157600080fd5b60405160a0810167ffffffffffffffff828210818311171561342557613425613158565b8160405282935084358352602085013560208401526040850135604084015260608501356060840152608085013591508082111561346257600080fd5b5061346f8582860161325c565b6080830152505092915050565b60006040828403121561348e57600080fd5b613496613187565b90508135815260208083013567ffffffffffffffff808211156134b857600080fd5b818501915085601f8301126134cc57600080fd5b8135818111156134de576134de613158565b8060051b91506134ef8483016131d3565b818152918301840191848101908884111561350957600080fd5b938501935b838510156135275784358252938501939085019061350e565b808688015250505050505092915050565b600080600080600060a0868803121561355057600080fd5b853561355b81613136565b9450602086013561356b81613136565b9350604086013567ffffffffffffffff8082111561358857600080fd5b61359489838a0161325c565b94506060880135935060808801359150808211156135b157600080fd5b9087019060a0828a0312156135c557600080fd5b6135cd6131b0565b823581526020830135828111156135e357600080fd5b6135ef8b8286016133ef565b60208301525060408301358281111561360757600080fd5b6136138b82860161347c565b60408301525060608301358281111561362b57600080fd5b6136378b82860161325c565b60608301525060808301358281111561364f57600080fd5b61365b8b82860161325c565b6080830152508093505050509295509295909350565b805164ffffffffff8116811461329057600080fd5b60006020828403121561369857600080fd5b6118f882613671565b60005b838110156136bc5781810151838201526020016136a4565b838111156136cb576000848401525b50505050565b600081518084526136e98160208601602086016136a1565b601f01601f19169290920160200192915050565b73ffffffffffffffffffffffffffffffffffffffff8516815260806020820152600061372c60808301866136d1565b905064ffffffffff8416604083015263ffffffff8316606083015295945050505050565b6020815260006118f860208301846136d1565b60006020828403121561377557600080fd5b81516118f881613136565b60006060828403121561379257600080fd5b6040516060810181811067ffffffffffffffff821117156137b5576137b5613158565b604052825181526137c860208401613671565b60208201526137d960408401613671565b60408201529392505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525063ffffffff8416604083015260806060830152611d8c60808301846136d1565b6000825161383c8184602087016136a1565b9190910192915050565b600084516138588184602089016136a1565b60609490941b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001691909301908152601481019190915260340192915050565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015250608060408301526138d160808301856136d1565b905082606083015295945050505050565b73ffffffffffffffffffffffffffffffffffffffff84168152826020820152606060408201526000612bac60608301846136d1565b805182526020810151602083015260408101516040830152606081015160608301526000608082015160a0608085015261333e60a08501826136d1565b6020815260006118f86020830184613917565b60006020828403121561397957600080fd5b815180151581146118f857600080fd5b838152600060206060818401526139a36060840186613917565b83810360408501526040810185518252828601516040848401528181518084526060850191508583019450600093505b808410156139f357845182529385019360019390930192908501906139d3565b509998505050505050505050565b60008351613a138184602088016136a1565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015613abb57613abb613a7a565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60008219821115613b0257613b02613a7a565b500190565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b3957613b39613a7a565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600060ff831680613b8257613b82613b40565b8060ff84160691505092915050565b600060ff821660ff841680821015613bab57613bab613a7a565b90039392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bec57613bec613a7a565b500290565b600060208284031215613c0357600080fd5b5051919050565b600082613c1957613c19613b40565b50049056fea2646970667358221220519d4dd06fdca55c7846233d66cce54c28d04b6fad7bf6aa770977b4e1ba665664736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1CrossDomainMessenger.json b/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1CrossDomainMessenger.json index 0dc837628a0b..72e076f19984 100644 --- a/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1CrossDomainMessenger.json +++ b/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1CrossDomainMessenger.json @@ -1,5 +1,5 @@ { - "address": "0x84a374C4082252FCEc215C242513c15551b15976", + "address": "0x497cdD0F36b3D3012C1fEa605332E77E942C494a", "abi": [ { "inputs": [ @@ -22,27 +22,27 @@ "type": "fallback" } ], - "transactionHash": "0xb4325e1537759b032b15c333184a14be073e373e885799a54d999629babb30bd", + "transactionHash": "0xe846b94f28451de43af5b26036699d5fe5574d9d3e714939669f1bf39272fc3f", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0x84a374C4082252FCEc215C242513c15551b15976", - "transactionIndex": 6, - "gasUsed": "291449", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x497cdD0F36b3D3012C1fEa605332E77E942C494a", + "transactionIndex": 71, + "gasUsed": "291461", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9d11a7f0357c59d7e420e8a5ad335a30430638b3180860f75cb0760c5cf56bfa", - "transactionHash": "0xb4325e1537759b032b15c333184a14be073e373e885799a54d999629babb30bd", + "blockHash": "0x7ec7f0fcaa1ea4aa07fe0a87640cf68d528a4cc048c8f7e46889756c16fae810", + "transactionHash": "0xe846b94f28451de43af5b26036699d5fe5574d9d3e714939669f1bf39272fc3f", "logs": [], - "blockNumber": 6680741, - "cumulativeGasUsed": "684227", + "blockNumber": 6754193, + "cumulativeGasUsed": "27427837", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "0x2E8234de112b3d020D4310820B8e253056A90D9F", "OVM_L1CrossDomainMessenger" ], - "solcInputHash": "135031d3a6e239ee886cdb6d92ff3eb4", + "solcInputHash": "0f61c2f477ce8ca23a2a78795b625932", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"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/libraries/resolver/Lib_ResolvedDelegateProxy.sol\":\"Lib_ResolvedDelegateProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_ResolvedDelegateProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_ResolvedDelegateProxy\\n */\\ncontract Lib_ResolvedDelegateProxy {\\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 * 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(address _libAddressManager, string memory _implementationName) {\\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\\n implementationName[address(this)] = _implementationName;\\n }\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n fallback() external payable {\\n address target = addressManager[address(this)].getAddress(\\n (implementationName[address(this)])\\n );\\n\\n require(target != address(0), \\\"Target address must be initialized.\\\");\\n\\n // slither-disable-next-line controlled-delegatecall\\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\":\"0x987774d18365ed25f5be61198e8b241728db6f97c6f2496f4a35bf9dbe0bda2b\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506040516105b53803806105b583398101604081905261002f91610125565b30600090815260016020908152604080832080546001600160a01b0319166001600160a01b038716179055828252909120825161006e92840190610076565b505050610252565b82805461008290610217565b90600052602060002090601f0160209004810192826100a457600085556100ea565b82601f106100bd57805160ff19168380011785556100ea565b828001600101855582156100ea579182015b828111156100ea5782518255916020019190600101906100cf565b506100f69291506100fa565b5090565b5b808211156100f657600081556001016100fb565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561013857600080fd5b82516001600160a01b038116811461014f57600080fd5b602084810151919350906001600160401b038082111561016e57600080fd5b818601915086601f83011261018257600080fd5b8151818111156101945761019461010f565b604051601f8201601f19908116603f011681019083821181831017156101bc576101bc61010f565b8160405282815289868487010111156101d457600080fd5b600093505b828410156101f657848401860151818501870152928501926101d9565b828411156102075760008684830101525b8096505050505050509250929050565b600181811c9082168061022b57607f821691505b6020821081141561024c57634e487b7160e01b600052602260045260246000fd5b50919050565b610354806102616000396000f3fe608060408181523060009081526001602090815282822054908290529181207fbf40fac1000000000000000000000000000000000000000000000000000000009093529173ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061006d9060846101f2565b60206040518083038186803b15801561008557600080fd5b505afa158015610099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bd91906102d1565b905073ffffffffffffffffffffffffffffffffffffffff8116610166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f5461726765742061646472657373206d75737420626520696e697469616c697a60448201527f65642e0000000000000000000000000000000000000000000000000000000000606482015260840160405180910390fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1660003660405161019192919061030e565b600060405180830381855af49150503d80600081146101cc576040519150601f19603f3d011682016040523d82523d6000602084013e6101d1565b606091505b509092509050600182151514156101ea57805160208201f35b805160208201fd5b600060208083526000845481600182811c91508083168061021457607f831692505b85831081141561024b577f4e487b710000000000000000000000000000000000000000000000000000000085526022600452602485fd5b8786018381526020018180156102685760018114610297576102c2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008616825287820196506102c2565b60008b81526020902060005b868110156102bc578154848201529085019089016102a3565b83019750505b50949998505050505050505050565b6000602082840312156102e357600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461030757600080fd5b9392505050565b818382376000910190815291905056fea2646970667358221220d66a7dad92a7f7528f41181719174e1d244423b8bb730d2884645c76cfa0944064736f6c63430008090033", "deployedBytecode": "0x608060408181523060009081526001602090815282822054908290529181207fbf40fac1000000000000000000000000000000000000000000000000000000009093529173ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061006d9060846101f2565b60206040518083038186803b15801561008557600080fd5b505afa158015610099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100bd91906102d1565b905073ffffffffffffffffffffffffffffffffffffffff8116610166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f5461726765742061646472657373206d75737420626520696e697469616c697a60448201527f65642e0000000000000000000000000000000000000000000000000000000000606482015260840160405180910390fd5b6000808273ffffffffffffffffffffffffffffffffffffffff1660003660405161019192919061030e565b600060405180830381855af49150503d80600081146101cc576040519150601f19603f3d011682016040523d82523d6000602084013e6101d1565b606091505b509092509050600182151514156101ea57805160208201f35b805160208201fd5b600060208083526000845481600182811c91508083168061021457607f831692505b85831081141561024b577f4e487b710000000000000000000000000000000000000000000000000000000085526022600452602485fd5b8786018381526020018180156102685760018114610297576102c2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008616825287820196506102c2565b60008b81526020902060005b868110156102bc578154848201529085019089016102a3565b83019750505b50949998505050505050505050565b6000602082840312156102e357600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461030757600080fd5b9392505050565b818382376000910190815291905056fea2646970667358221220d66a7dad92a7f7528f41181719174e1d244423b8bb730d2884645c76cfa0944064736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1StandardBridge.json b/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1StandardBridge.json index 6bc5b2094cc0..502353b45d29 100644 --- a/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1StandardBridge.json +++ b/packages/contracts/deployments/goerli-nightly/Proxy__OVM_L1StandardBridge.json @@ -1,5 +1,5 @@ { - "address": "0xe352dDE5d101BB422f78C3eD77f2cD8f0b9B0f82", + "address": "0x4600216A9C733658A48Ef83Ad218BA221514894E", "abi": [ { "inputs": [ @@ -87,24 +87,24 @@ "type": "function" } ], - "transactionHash": "0xec6aaf35b871bf15217836befb5a667c735143f57ff11e0e24d4e3f2e81a1bd2", + "transactionHash": "0xbeec597592cd5394ffd4f1dec67372bdb930a971de5bed3c6d956519e76626b5", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0xe352dDE5d101BB422f78C3eD77f2cD8f0b9B0f82", - "transactionIndex": 9, + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x4600216A9C733658A48Ef83Ad218BA221514894E", + "transactionIndex": 105, "gasUsed": "614417", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa0f1096e0cb67f9390640b6af43c9ae5f86e79993479b923bce55e0b6e0df7fc", - "transactionHash": "0xec6aaf35b871bf15217836befb5a667c735143f57ff11e0e24d4e3f2e81a1bd2", + "blockHash": "0x051349fd01f42710bda0e39de1fd404f8aa8b5da8f0c8e1915ad26ba5c05179e", + "transactionHash": "0xbeec597592cd5394ffd4f1dec67372bdb930a971de5bed3c6d956519e76626b5", "logs": [], - "blockNumber": 6680746, - "cumulativeGasUsed": "5047749", + "blockNumber": 6754199, + "cumulativeGasUsed": "22818745", "status": 1, "byzantium": true }, "args": [ - "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31" + "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C" ], "solcInputHash": "1922d6575f24d34049f0f77444309807", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"getImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_code\",\"type\":\"bytes\"}],\"name\":\"setCode\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_value\",\"type\":\"bytes32\"}],\"name\":\"setStorage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty! Note for future developers: do NOT make anything in this contract 'public' unless you know what you're doing. Anything public can potentially have a function signature that conflicts with a signature attached to the implementation contract. Public functions SHOULD always have the 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\",\"kind\":\"dev\",\"methods\":{\"constructor\":{\"params\":{\"_owner\":\"Address of the initial contract owner.\"}},\"getImplementation()\":{\"returns\":{\"_0\":\"Implementation address.\"}},\"getOwner()\":{\"returns\":{\"_0\":\"Owner address.\"}},\"setCode(bytes)\":{\"params\":{\"_code\":\"New contract code to run inside this contract.\"}},\"setOwner(address)\":{\"params\":{\"_owner\":\"New owner of the proxy contract.\"}},\"setStorage(bytes32,bytes32)\":{\"params\":{\"_key\":\"Storage key to modify.\",\"_value\":\"New value for the storage key.\"}}},\"title\":\"L1ChugSplashProxy\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getImplementation()\":{\"notice\":\"Queries the implementation address. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"getOwner()\":{\"notice\":\"Queries the owner of the proxy contract. Can only be called by the owner OR by making an eth_call and setting the \\\"from\\\" address to address(0).\"},\"setCode(bytes)\":{\"notice\":\"Sets the code that should be running behind this proxy. Note that this scheme is a bit different from the standard proxy scheme where one would typically deploy the code separately and then set the implementation address. We're doing it this way because it gives us a lot more freedom on the client side. Can only be triggered by the contract owner.\"},\"setOwner(address)\":{\"notice\":\"Changes the owner of the proxy contract. Only callable by the owner.\"},\"setStorage(bytes32,bytes32)\":{\"notice\":\"Modifies some storage slot within the proxy contract. Gives us a lot of power to perform upgrades in a more transparent way. Only callable by the owner.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":\"L1ChugSplashProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"contracts/chugsplash/L1ChugSplashProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\nimport { iL1ChugSplashDeployer } from \\\"./interfaces/iL1ChugSplashDeployer.sol\\\";\\n\\n/**\\n * @title L1ChugSplashProxy\\n * @dev Basic ChugSplash proxy contract for L1. Very close to being a normal proxy but has added\\n * functions `setCode` and `setStorage` for changing the code or storage of the contract. Nifty!\\n *\\n * Note for future developers: do NOT make anything in this contract 'public' unless you know what\\n * you're doing. Anything public can potentially have a function signature that conflicts with a\\n * signature attached to the implementation contract. Public functions SHOULD always have the\\n * 'proxyCallIfNotOwner' modifier unless there's some *really* good reason not to have that\\n * modifier. And there almost certainly is not a good reason to not have that modifier. Beware!\\n */\\ncontract L1ChugSplashProxy {\\n /*************\\n * Constants *\\n *************/\\n\\n // \\\"Magic\\\" prefix. When prepended to some arbitrary bytecode and used to create a contract, the\\n // appended bytecode will be deployed as given.\\n bytes13 internal constant DEPLOY_CODE_PREFIX = 0x600D380380600D6000396000f3;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)\\n bytes32 internal constant IMPLEMENTATION_KEY =\\n 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)\\n bytes32 internal constant OWNER_KEY =\\n 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _owner Address of the initial contract owner.\\n */\\n constructor(address _owner) {\\n _setOwner(_owner);\\n }\\n\\n /**********************\\n * Function Modifiers *\\n **********************/\\n\\n /**\\n * Blocks a function from being called when the parent signals that the system should be paused\\n * via an isUpgrading function.\\n */\\n modifier onlyWhenNotPaused() {\\n address owner = _getOwner();\\n\\n // We do a low-level call because there's no guarantee that the owner actually *is* an\\n // L1ChugSplashDeployer contract and Solidity will throw errors if we do a normal call and\\n // it turns out that it isn't the right type of contract.\\n (bool success, bytes memory returndata) = owner.staticcall(\\n abi.encodeWithSelector(iL1ChugSplashDeployer.isUpgrading.selector)\\n );\\n\\n // If the call was unsuccessful then we assume that there's no \\\"isUpgrading\\\" method and we\\n // can just continue as normal. We also expect that the return value is exactly 32 bytes\\n // long. If this isn't the case then we can safely ignore the result.\\n if (success && returndata.length == 32) {\\n // Although the expected value is a *boolean*, it's safer to decode as a uint256 in the\\n // case that the isUpgrading function returned something other than 0 or 1. But we only\\n // really care about the case where this value is 0 (= false).\\n uint256 ret = abi.decode(returndata, (uint256));\\n require(ret == 0, \\\"L1ChugSplashProxy: system is currently being upgraded\\\");\\n }\\n\\n _;\\n }\\n\\n /**\\n * Makes a proxy call instead of triggering the given function when the caller is either the\\n * owner or the zero address. Caller can only ever be the zero address if this function is\\n * being called off-chain via eth_call, which is totally fine and can be convenient for\\n * client-side tooling. Avoids situations where the proxy and implementation share a sighash\\n * and the proxy function ends up being called instead of the implementation one.\\n *\\n * Note: msg.sender == address(0) can ONLY be triggered off-chain via eth_call. If there's a\\n * way for someone to send a transaction with msg.sender == address(0) in any real context then\\n * we have much bigger problems. Primary reason to include this additional allowed sender is\\n * because the owner address can be changed dynamically and we do not want clients to have to\\n * keep track of the current owner in order to make an eth_call that doesn't trigger the\\n * proxied contract.\\n */\\n // slither-disable-next-line incorrect-modifier\\n modifier proxyCallIfNotOwner() {\\n if (msg.sender == _getOwner() || msg.sender == address(0)) {\\n _;\\n } else {\\n // This WILL halt the call frame on completion.\\n _doProxyCall();\\n }\\n }\\n\\n /*********************\\n * Fallback Function *\\n *********************/\\n\\n // slither-disable-next-line locked-ether\\n fallback() external payable {\\n // Proxy call by default.\\n _doProxyCall();\\n }\\n\\n /********************\\n * Public Functions *\\n ********************/\\n\\n /**\\n * Sets the code that should be running behind this proxy. Note that this scheme is a bit\\n * different from the standard proxy scheme where one would typically deploy the code\\n * separately and then set the implementation address. We're doing it this way because it gives\\n * us a lot more freedom on the client side. Can only be triggered by the contract owner.\\n * @param _code New contract code to run inside this contract.\\n */\\n // slither-disable-next-line external-function\\n function setCode(bytes memory _code) public proxyCallIfNotOwner {\\n // Get the code hash of the current implementation.\\n address implementation = _getImplementation();\\n\\n // If the code hash matches the new implementation then we return early.\\n if (keccak256(_code) == _getAccountCodeHash(implementation)) {\\n return;\\n }\\n\\n // Create the deploycode by appending the magic prefix.\\n bytes memory deploycode = abi.encodePacked(DEPLOY_CODE_PREFIX, _code);\\n\\n // Deploy the code and set the new implementation address.\\n address newImplementation;\\n assembly {\\n newImplementation := create(0x0, add(deploycode, 0x20), mload(deploycode))\\n }\\n\\n // Check that the code was actually deployed correctly. I'm not sure if you can ever\\n // actually fail this check. Should only happen if the contract creation from above runs\\n // out of gas but this parent execution thread does NOT run out of gas. Seems like we\\n // should be doing this check anyway though.\\n require(\\n _getAccountCodeHash(newImplementation) == keccak256(_code),\\n \\\"L1ChugSplashProxy: code was not correctly deployed.\\\"\\n );\\n\\n _setImplementation(newImplementation);\\n }\\n\\n /**\\n * Modifies some storage slot within the proxy contract. Gives us a lot of power to perform\\n * upgrades in a more transparent way. Only callable by the owner.\\n * @param _key Storage key to modify.\\n * @param _value New value for the storage key.\\n */\\n // slither-disable-next-line external-function\\n function setStorage(bytes32 _key, bytes32 _value) public proxyCallIfNotOwner {\\n assembly {\\n sstore(_key, _value)\\n }\\n }\\n\\n /**\\n * Changes the owner of the proxy contract. Only callable by the owner.\\n * @param _owner New owner of the proxy contract.\\n */\\n // slither-disable-next-line external-function\\n function setOwner(address _owner) public proxyCallIfNotOwner {\\n _setOwner(_owner);\\n }\\n\\n /**\\n * Queries the owner of the proxy contract. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Owner address.\\n */\\n // slither-disable-next-line external-function\\n function getOwner() public proxyCallIfNotOwner returns (address) {\\n return _getOwner();\\n }\\n\\n /**\\n * Queries the implementation address. Can only be called by the owner OR by making an\\n * eth_call and setting the \\\"from\\\" address to address(0).\\n * @return Implementation address.\\n */\\n // slither-disable-next-line external-function\\n function getImplementation() public proxyCallIfNotOwner returns (address) {\\n return _getImplementation();\\n }\\n\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n /**\\n * Sets the implementation address.\\n * @param _implementation New implementation address.\\n */\\n function _setImplementation(address _implementation) internal {\\n assembly {\\n sstore(IMPLEMENTATION_KEY, _implementation)\\n }\\n }\\n\\n /**\\n * Queries the implementation address.\\n * @return Implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n address implementation;\\n assembly {\\n implementation := sload(IMPLEMENTATION_KEY)\\n }\\n return implementation;\\n }\\n\\n /**\\n * Changes the owner of the proxy contract.\\n * @param _owner New owner of the proxy contract.\\n */\\n function _setOwner(address _owner) internal {\\n assembly {\\n sstore(OWNER_KEY, _owner)\\n }\\n }\\n\\n /**\\n * Queries the owner of the proxy contract.\\n * @return Owner address.\\n */\\n function _getOwner() internal view returns (address) {\\n address owner;\\n assembly {\\n owner := sload(OWNER_KEY)\\n }\\n return owner;\\n }\\n\\n /**\\n * Gets the code hash for a given account.\\n * @param _account Address of the account to get a code hash for.\\n * @return Code hash for the account.\\n */\\n function _getAccountCodeHash(address _account) internal view returns (bytes32) {\\n bytes32 codeHash;\\n assembly {\\n codeHash := extcodehash(_account)\\n }\\n return codeHash;\\n }\\n\\n /**\\n * Performs the proxy call via a delegatecall.\\n */\\n function _doProxyCall() internal onlyWhenNotPaused {\\n address implementation = _getImplementation();\\n\\n require(implementation != address(0), \\\"L1ChugSplashProxy: implementation is not set yet\\\");\\n\\n assembly {\\n // Copy calldata into memory at 0x0....calldatasize.\\n calldatacopy(0x0, 0x0, calldatasize())\\n\\n // Perform the delegatecall, make sure to pass all available gas.\\n let success := delegatecall(gas(), implementation, 0x0, calldatasize(), 0x0, 0x0)\\n\\n // Copy returndata into memory at 0x0....returndatasize. Note that this *will*\\n // overwrite the calldata that we just copied into memory but that doesn't really\\n // matter because we'll be returning in a second anyway.\\n returndatacopy(0x0, 0x0, returndatasize())\\n\\n // Success == 0 means a revert. We'll revert too and pass the data up.\\n if iszero(success) {\\n revert(0x0, returndatasize())\\n }\\n\\n // Otherwise we'll just return and pass the data up.\\n return(0x0, returndatasize())\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc3cb52dfdc2706992572dd5621ae89ba919fd20539b73488a455d564f16f1b8d\",\"license\":\"MIT\"},\"contracts/chugsplash/interfaces/iL1ChugSplashDeployer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title iL1ChugSplashDeployer\\n */\\ninterface iL1ChugSplashDeployer {\\n function isUpgrading() external view returns (bool);\\n}\\n\",\"keccak256\":\"0x9a496d99f111c1091f0c33d6bfc7802a522baa7235614b0014f35e4bbe280e57\",\"license\":\"MIT\"}},\"version\":1}", diff --git a/packages/contracts/deployments/goerli-nightly/StateCommitmentChain.json b/packages/contracts/deployments/goerli-nightly/StateCommitmentChain.json index adf6ce2efc23..22af44d3db91 100644 --- a/packages/contracts/deployments/goerli-nightly/StateCommitmentChain.json +++ b/packages/contracts/deployments/goerli-nightly/StateCommitmentChain.json @@ -1,5 +1,5 @@ { - "address": "0xd1a3a355Cd384106883823E667fbb1f30AB843A3", + "address": "0x0F4d7B946A53D0Ebc8a427Bde033C8BF3FF02Baa", "abi": [ { "inputs": [ @@ -361,28 +361,28 @@ "type": "function" } ], - "transactionHash": "0xbfba9191d2bb8076e98ad41b5517a54203c1ae5d8491f2534a1ada8dd9560b69", + "transactionHash": "0xfdb3d68417edcb0167d1d448c054378c529d64b6a90ec6f5647b955894c6dd9a", "receipt": { "to": null, - "from": "0x3a605B442055DF2898E18cF518feb2e2A6BD0D31", - "contractAddress": "0xd1a3a355Cd384106883823E667fbb1f30AB843A3", - "transactionIndex": 1, - "gasUsed": "1888185", + "from": "0x26D58aD41d2BE997C02802468B92F1eaB4f8b95C", + "contractAddress": "0x0F4d7B946A53D0Ebc8a427Bde033C8BF3FF02Baa", + "transactionIndex": 13, + "gasUsed": "1888197", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5af645564542db7f63d56634a2996541c19772d6e901e596afcfbffbafc1aaab", - "transactionHash": "0xbfba9191d2bb8076e98ad41b5517a54203c1ae5d8491f2534a1ada8dd9560b69", + "blockHash": "0xb34e0541a0d3989b1ee2f30c4e58703abd6508473e11b63d9100fa43d69ca4a7", + "transactionHash": "0xfdb3d68417edcb0167d1d448c054378c529d64b6a90ec6f5647b955894c6dd9a", "logs": [], - "blockNumber": 6680724, - "cumulativeGasUsed": "1939675", + "blockNumber": 6754175, + "cumulativeGasUsed": "4858934", "status": 1, "byzantium": true }, "args": [ - "0x07917E3D28aa7C61baAAcf8e486a77007E1Daa89", + "0x2E8234de112b3d020D4310820B8e253056A90D9F", 604800, 12592000 ], - "solcInputHash": "b4ecc4d6ec9067f0dc398c96f1aabdaf", + "solcInputHash": "d6c87ae3c9bb8c703d33a5e718b3cc75", "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"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 IChainStorageContainer\",\"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.\",\"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\":\"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/L1/rollup/StateCommitmentChain.sol\":\"StateCommitmentChain\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\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() {\\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\\n }\\n\\n function _setOwner(address newOwner) private {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n}\\n\",\"keccak256\":\"0x6bb804a310218875e89d12c053e94a13a4607cdf7cc2052f3e52bd32a0dc50a1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^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 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) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0x90565a39ae45c80f0468dc96c7b20d0afc3055f344c8203a0c9258239f350b9f\",\"license\":\"MIT\"},\"contracts/L1/rollup/ICanonicalTransactionChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/* Interface Imports */\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title ICanonicalTransactionChain\\n */\\ninterface ICanonicalTransactionChain {\\n /**********\\n * Events *\\n **********/\\n\\n event L2GasParamsUpdated(\\n uint256 l2GasDiscountDivisor,\\n uint256 enqueueGasCost,\\n uint256 enqueueL2GasPrepaid\\n );\\n\\n event TransactionEnqueued(\\n address indexed _l1TxOrigin,\\n address indexed _target,\\n uint256 _gasLimit,\\n bytes _data,\\n uint256 indexed _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 * Structs *\\n ***********/\\n\\n struct BatchContext {\\n uint256 numSequencedTransactions;\\n uint256 numSubsequentQueueTransactions;\\n uint256 timestamp;\\n uint256 blockNumber;\\n }\\n\\n /*******************************\\n * Authorized Setter Functions *\\n *******************************/\\n\\n /**\\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\\n * The value of enqueueL2GasPrepaid is immediately updated as well.\\n */\\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost) external;\\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() external view returns (IChainStorageContainer);\\n\\n /**\\n * Retrieves the total number of elements submitted.\\n * @return _totalElements Total submitted elements.\\n */\\n function getTotalElements() external view returns (uint256 _totalElements);\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches() external view returns (uint256 _totalBatches);\\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() external view returns (uint40);\\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(uint256 _index)\\n external\\n view\\n returns (Lib_OVMCodec.QueueElement memory _element);\\n\\n /**\\n * Returns the timestamp of the last transaction.\\n * @return Timestamp for the last transaction.\\n */\\n function getLastTimestamp() external view returns (uint40);\\n\\n /**\\n * Returns the blocknumber of the last transaction.\\n * @return Blocknumber for the last transaction.\\n */\\n function getLastBlockNumber() external view returns (uint40);\\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() external view returns (uint40);\\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() external view returns (uint40);\\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 ) 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 ) external;\\n}\\n\",\"keccak256\":\"0xa534e90efd57e3c36053cb4aabba63ef8f53e35e3a4ce3d0f127ec2d0af1f618\",\"license\":\"MIT\"},\"contracts/L1/rollup/IChainStorageContainer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/**\\n * @title IChainStorageContainer\\n */\\ninterface IChainStorageContainer {\\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(bytes27 _globalMetadata) external;\\n\\n /**\\n * Retrieves the container's global metadata field.\\n * @return Container global metadata field.\\n */\\n function getGlobalMetadata() external view returns (bytes27);\\n\\n /**\\n * Retrieves the number of objects stored in the container.\\n * @return Number of objects in the container.\\n */\\n function length() external view returns (uint256);\\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\\n\\n /**\\n * Removes all objects after and including a given index.\\n * @param _index Object index to delete from.\\n */\\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\\n}\\n\",\"keccak256\":\"0xe55ad72572ec47dc09a02228d0c5a438571c76a41d16d92b35add057811977ce\",\"license\":\"MIT\"},\"contracts/L1/rollup/IStateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >0.5.0 <0.9.0;\\n\\n/* Library Imports */\\nimport { Lib_OVMCodec } from \\\"../../libraries/codec/Lib_OVMCodec.sol\\\";\\n\\n/**\\n * @title IStateCommitmentChain\\n */\\ninterface IStateCommitmentChain {\\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(uint256 indexed _batchIndex, bytes32 _batchRoot);\\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() external view returns (uint256 _totalElements);\\n\\n /**\\n * Retrieves the total number of batches submitted.\\n * @return _totalBatches Total submitted batches.\\n */\\n function getTotalBatches() external view returns (uint256 _totalBatches);\\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() external view returns (uint256 _lastSequencerTimestamp);\\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(bytes32[] calldata _batch, uint256 _shouldStartAtElement) 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) 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 ) external view returns (bool _verified);\\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n external\\n view\\n returns (bool _inside);\\n}\\n\",\"keccak256\":\"0x47253e63bc34a006102374c39c052470b977e1eb63dacc953e2cbff19940de69\",\"license\":\"MIT\"},\"contracts/L1/rollup/StateCommitmentChain.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 { IStateCommitmentChain } from \\\"./IStateCommitmentChain.sol\\\";\\nimport { ICanonicalTransactionChain } from \\\"./ICanonicalTransactionChain.sol\\\";\\nimport { IBondManager } from \\\"../verification/IBondManager.sol\\\";\\nimport { IChainStorageContainer } from \\\"./IChainStorageContainer.sol\\\";\\n\\n/**\\n * @title 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 */\\ncontract StateCommitmentChain is IStateCommitmentChain, Lib_AddressResolver {\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 public FRAUD_PROOF_WINDOW;\\n uint256 public SEQUENCER_PUBLISH_WINDOW;\\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 ) Lib_AddressResolver(_libAddressManager) {\\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\\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() public view returns (IChainStorageContainer) {\\n return IChainStorageContainer(resolve(\\\"ChainStorageContainer-SCC-batches\\\"));\\n }\\n\\n /**\\n * @inheritdoc IStateCommitmentChain\\n */\\n function getTotalElements() public view returns (uint256 _totalElements) {\\n (uint40 totalElements, ) = _getBatchExtraData();\\n return uint256(totalElements);\\n }\\n\\n /**\\n * @inheritdoc IStateCommitmentChain\\n */\\n function getTotalBatches() public view returns (uint256 _totalBatches) {\\n return batches().length();\\n }\\n\\n /**\\n * @inheritdoc IStateCommitmentChain\\n */\\n // slither-disable-next-line external-function\\n function getLastSequencerTimestamp() public view returns (uint256 _lastSequencerTimestamp) {\\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\\n return uint256(lastSequencerTimestamp);\\n }\\n\\n /**\\n * @inheritdoc IStateCommitmentChain\\n */\\n // slither-disable-next-line external-function\\n function appendStateBatch(bytes32[] memory _batch, uint256 _shouldStartAtElement) public {\\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 IBondManager(resolve(\\\"BondManager\\\")).isCollateralized(msg.sender),\\n \\\"Proposer does not have enough collateral posted\\\"\\n );\\n\\n require(_batch.length > 0, \\\"Cannot submit an empty state batch.\\\");\\n\\n require(\\n getTotalElements() + _batch.length <=\\n ICanonicalTransactionChain(resolve(\\\"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(_batch, abi.encode(block.timestamp, msg.sender));\\n }\\n\\n /**\\n * @inheritdoc IStateCommitmentChain\\n */\\n // slither-disable-next-line external-function\\n function deleteStateBatch(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) public {\\n require(\\n msg.sender == resolve(\\\"OVM_FraudVerifier\\\"),\\n \\\"State batches can only be deleted by the OVM_FraudVerifier.\\\"\\n );\\n\\n require(_isValidBatchHeader(_batchHeader), \\\"Invalid batch header.\\\");\\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 IStateCommitmentChain\\n */\\n // slither-disable-next-line external-function\\n function verifyStateCommitment(\\n bytes32 _element,\\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\\n Lib_OVMCodec.ChainInclusionProof memory _proof\\n ) public view returns (bool) {\\n require(_isValidBatchHeader(_batchHeader), \\\"Invalid batch header.\\\");\\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 IStateCommitmentChain\\n */\\n function insideFraudProofWindow(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n public\\n view\\n returns (bool _inside)\\n {\\n (uint256 timestamp, ) = abi.decode(_batchHeader.extraData, (uint256, address));\\n\\n require(timestamp != 0, \\\"Batch header timestamp cannot be zero\\\");\\n return (timestamp + FRAUD_PROOF_WINDOW) > block.timestamp;\\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() internal view returns (uint40, uint40) {\\n bytes27 extraData = batches().getGlobalMetadata();\\n\\n // solhint-disable max-line-length\\n uint40 totalElements;\\n uint40 lastSequencerTimestamp;\\n assembly {\\n extraData := shr(40, extraData)\\n totalElements := and(\\n extraData,\\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\\n )\\n lastSequencerTimestamp := shr(\\n 40,\\n and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\\n )\\n }\\n // solhint-enable max-line-length\\n\\n return (totalElements, lastSequencerTimestamp);\\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(uint40 _totalElements, uint40 _lastSequencerTimestamp)\\n internal\\n pure\\n returns (bytes27)\\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(bytes32[] memory _batch, bytes memory _extraData) internal {\\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) internal {\\n require(_batchHeader.batchIndex < batches().length(), \\\"Invalid batch index.\\\");\\n\\n require(_isValidBatchHeader(_batchHeader), \\\"Invalid batch header.\\\");\\n\\n // slither-disable-next-line reentrancy-events\\n batches().deleteElementsAfterInclusive(\\n _batchHeader.batchIndex,\\n _makeBatchExtraData(uint40(_batchHeader.prevTotalElements), 0)\\n );\\n\\n // slither-disable-next-line reentrancy-events\\n emit StateBatchDeleted(_batchHeader.batchIndex, _batchHeader.batchRoot);\\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n internal\\n view\\n returns (bool)\\n {\\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\\n }\\n}\\n\",\"keccak256\":\"0x1d0a0880402b860af05ee5cbdafc8e2ea1e5cc260cf74ea4aa3376b92391e435\",\"license\":\"MIT\"},\"contracts/L1/verification/IBondManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title IBondManager\\n */\\ninterface IBondManager {\\n /********************\\n * Public Functions *\\n ********************/\\n\\n function isCollateralized(address _who) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x4ae2dc7bf175626d2930299e73d50a7ba936171d07810497ef71fa38a4e246a7\",\"license\":\"MIT\"},\"contracts/libraries/codec/Lib_OVMCodec.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Enums *\\n *********/\\n\\n enum QueueOrigin {\\n SEQUENCER_QUEUE,\\n L1TOL2_QUEUE\\n }\\n\\n /***********\\n * Structs *\\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 * 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(Transaction memory _transaction)\\n internal\\n pure\\n returns (bytes memory)\\n {\\n return\\n 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(Transaction memory _transaction) internal pure returns (bytes32) {\\n return keccak256(encodeTransaction(_transaction));\\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(bytes memory _encoded) internal pure returns (EVMAccount memory) {\\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\\n\\n return\\n 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\\n internal\\n pure\\n returns (bytes32)\\n {\\n return\\n keccak256(\\n abi.encode(\\n _batchHeader.batchRoot,\\n _batchHeader.batchSize,\\n _batchHeader.prevTotalElements,\\n _batchHeader.extraData\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xb5009ac1e0617e0b3b2fb917f08f8e8a7ae706034cc3a675258bc3d91978525e\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\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 * Events *\\n **********/\\n\\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\\n\\n /*************\\n * Variables *\\n *************/\\n\\n mapping(bytes32 => address) private addresses;\\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(string memory _name, address _address) external onlyOwner {\\n bytes32 nameHash = _getNameHash(_name);\\n address oldAddress = addresses[nameHash];\\n addresses[nameHash] = _address;\\n\\n emit AddressSet(_name, _address, oldAddress);\\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(string memory _name) external view returns (address) {\\n return addresses[_getNameHash(_name)];\\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(string memory _name) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_name));\\n }\\n}\\n\",\"keccak256\":\"0xcde9b29429d512c549f7c1b8a033f161fa71c18cda08b241748663854196ae14\",\"license\":\"MIT\"},\"contracts/libraries/resolver/Lib_AddressResolver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/* Library Imports */\\nimport { Lib_AddressManager } from \\\"./Lib_AddressManager.sol\\\";\\n\\n/**\\n * @title Lib_AddressResolver\\n */\\nabstract contract Lib_AddressResolver {\\n /*************\\n * Variables *\\n *************/\\n\\n Lib_AddressManager public libAddressManager;\\n\\n /***************\\n * Constructor *\\n ***************/\\n\\n /**\\n * @param _libAddressManager Address of the Lib_AddressManager.\\n */\\n constructor(address _libAddressManager) {\\n libAddressManager = Lib_AddressManager(_libAddressManager);\\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(string memory _name) public view returns (address) {\\n return libAddressManager.getAddress(_name);\\n }\\n}\\n\",\"keccak256\":\"0x515c4db671a28e2fe180201f6d11c0208c05f582ca3489fb6b8e81c27659bc62\",\"license\":\"MIT\"},\"contracts/libraries/rlp/Lib_RLPReader.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_RLPReader\\n * @dev Adapted from \\\"RLPReader\\\" by Hamdi Allam (hamdi.allam97@gmail.com).\\n */\\nlibrary Lib_RLPReader {\\n /*************\\n * Constants *\\n *************/\\n\\n uint256 internal constant MAX_LIST_LENGTH = 32;\\n\\n /*********\\n * Enums *\\n *********/\\n\\n enum RLPItemType {\\n DATA_ITEM,\\n LIST_ITEM\\n }\\n\\n /***********\\n * Structs *\\n ***********/\\n\\n struct RLPItem {\\n uint256 length;\\n uint256 ptr;\\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(bytes memory _in) internal pure returns (RLPItem memory) {\\n uint256 ptr;\\n assembly {\\n ptr := add(_in, 32)\\n }\\n\\n return RLPItem({ length: _in.length, ptr: ptr });\\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(RLPItem memory _in) internal pure returns (RLPItem[] memory) {\\n (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.LIST_ITEM, \\\"Invalid RLP list value.\\\");\\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(itemCount < MAX_LIST_LENGTH, \\\"Provided RLP list exceeds max list length.\\\");\\n\\n (uint256 itemOffset, uint256 itemLength, ) = _decodeLength(\\n RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })\\n );\\n\\n out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset });\\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(bytes memory _in) internal pure returns (RLPItem[] memory) {\\n return readList(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes memory) {\\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.DATA_ITEM, \\\"Invalid RLP bytes value.\\\");\\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(bytes memory _in) internal pure returns (bytes memory) {\\n return readBytes(toRLPItem(_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(RLPItem memory _in) internal pure returns (string memory) {\\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(bytes memory _in) internal pure returns (string memory) {\\n return readString(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes32) {\\n require(_in.length <= 33, \\\"Invalid RLP bytes32 value.\\\");\\n\\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\\n\\n require(itemType == RLPItemType.DATA_ITEM, \\\"Invalid RLP bytes32 value.\\\");\\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(bytes memory _in) internal pure returns (bytes32) {\\n return readBytes32(toRLPItem(_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(RLPItem memory _in) internal pure returns (uint256) {\\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(bytes memory _in) internal pure returns (uint256) {\\n return readUint256(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bool) {\\n require(_in.length == 1, \\\"Invalid RLP boolean value.\\\");\\n\\n uint256 ptr = _in.ptr;\\n uint256 out;\\n assembly {\\n out := byte(0, mload(ptr))\\n }\\n\\n require(out == 0 || out == 1, \\\"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\\\");\\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(bytes memory _in) internal pure returns (bool) {\\n return readBool(toRLPItem(_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(RLPItem memory _in) internal pure returns (address) {\\n if (_in.length == 1) {\\n return address(0);\\n }\\n\\n require(_in.length == 21, \\\"Invalid RLP address value.\\\");\\n\\n return address(uint160(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(bytes memory _in) internal pure returns (address) {\\n return readAddress(toRLPItem(_in));\\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(RLPItem memory _in) internal pure returns (bytes memory) {\\n return _copy(_in);\\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(RLPItem memory _in)\\n private\\n pure\\n returns (\\n uint256,\\n uint256,\\n RLPItemType\\n )\\n {\\n require(_in.length > 0, \\\"RLP item cannot be null.\\\");\\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 // slither-disable-next-line variable-scope\\n uint256 strLen = prefix - 0x80;\\n\\n require(_in.length > strLen, \\\"Invalid RLP short string.\\\");\\n\\n return (1, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xbf) {\\n // Long string.\\n uint256 lenOfStrLen = prefix - 0xb7;\\n\\n require(_in.length > lenOfStrLen, \\\"Invalid RLP long string length.\\\");\\n\\n uint256 strLen;\\n assembly {\\n // Pick out the string length.\\n strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))\\n }\\n\\n require(_in.length > lenOfStrLen + strLen, \\\"Invalid RLP long string.\\\");\\n\\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\\n } else if (prefix <= 0xf7) {\\n // Short list.\\n // slither-disable-next-line variable-scope\\n uint256 listLen = prefix - 0xc0;\\n\\n require(_in.length > listLen, \\\"Invalid RLP short list.\\\");\\n\\n return (1, listLen, RLPItemType.LIST_ITEM);\\n } else {\\n // Long list.\\n uint256 lenOfListLen = prefix - 0xf7;\\n\\n require(_in.length > lenOfListLen, \\\"Invalid RLP long list length.\\\");\\n\\n uint256 listLen;\\n assembly {\\n // Pick out the list length.\\n listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))\\n }\\n\\n require(_in.length > lenOfListLen + listLen, \\\"Invalid RLP long list.\\\");\\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 ) private pure returns (bytes memory) {\\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;\\n unchecked {\\n mask = 256**(32 - (_length % 32)) - 1;\\n }\\n\\n assembly {\\n mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))\\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(RLPItem memory _in) private pure returns (bytes memory) {\\n return _copy(_in.ptr, 0, _in.length);\\n }\\n}\\n\",\"keccak256\":\"0xd794d1b32c6e31d40e2526b5e519de1b4e8d14d6933889f9b916e69c5d1848c6\",\"license\":\"MIT\"},\"contracts/libraries/rlp/Lib_RLPWriter.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_RLPWriter\\n * @author Bakaoh (with modifications)\\n */\\nlibrary Lib_RLPWriter {\\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(bytes memory _in) internal pure returns (bytes memory) {\\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(bytes[] memory _in) internal pure returns (bytes memory) {\\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(string memory _in) internal pure returns (bytes memory) {\\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(address _in) internal pure returns (bytes memory) {\\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(uint256 _in) internal pure returns (bytes memory) {\\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(bool _in) internal pure returns (bytes memory) {\\n bytes memory encoded = new bytes(1);\\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\\n return encoded;\\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(uint256 _len, uint256 _offset) private pure returns (bytes memory) {\\n bytes memory encoded;\\n\\n if (_len < 56) {\\n encoded = new bytes(1);\\n encoded[0] = bytes1(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] = bytes1(uint8(lenLen) + uint8(_offset) + 55);\\n for (i = 1; i <= lenLen; i++) {\\n encoded[i] = bytes1(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(uint256 _x) private pure returns (bytes memory) {\\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 ) private pure {\\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;\\n unchecked {\\n mask = 256**(32 - len) - 1;\\n }\\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(bytes[] memory _list) private pure returns (bytes memory) {\\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 {\\n flattenedPtr := add(flattened, 0x20)\\n }\\n\\n for (i = 0; i < _list.length; i++) {\\n bytes memory item = _list[i];\\n\\n uint256 listPtr;\\n assembly {\\n listPtr := add(item, 0x20)\\n }\\n\\n _memcpy(flattenedPtr, listPtr, item.length);\\n flattenedPtr += _list[i].length;\\n }\\n\\n return flattened;\\n }\\n}\\n\",\"keccak256\":\"0x215b90672ce126effc3f2df61ca0cdf52d2b1cc9be602877e637829b0bf229fd\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_Bytes32Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_Byte32Utils\\n */\\nlibrary Lib_Bytes32Utils {\\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(bytes32 _in) internal pure returns (bool) {\\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(bool _in) internal pure returns (bytes32) {\\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(bytes32 _in) internal pure returns (address) {\\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(address _in) internal pure returns (bytes32) {\\n return bytes32(uint256(uint160(_in)));\\n }\\n}\\n\",\"keccak256\":\"0xf2d1a526f2529e51fc2fffccf093c1691e291cbbb6de8a3da7d7f80024a9a234\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_BytesUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_BytesUtils\\n */\\nlibrary Lib_BytesUtils {\\n /**********************\\n * Internal Functions *\\n **********************/\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n ) internal pure returns (bytes memory) {\\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(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) {\\n if (_start >= _bytes.length) {\\n return bytes(\\\"\\\");\\n }\\n\\n return slice(_bytes, _start, _bytes.length - _start);\\n }\\n\\n function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {\\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(bytes memory _bytes) internal pure returns (uint256) {\\n return uint256(toBytes32(_bytes));\\n }\\n\\n function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) {\\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(bytes memory _bytes) internal pure returns (bytes memory) {\\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(bytes memory _bytes, bytes memory _other) internal pure returns (bool) {\\n return keccak256(_bytes) == keccak256(_other);\\n }\\n}\\n\",\"keccak256\":\"0xc39ee13f97e4ccfbc72a5aac571deb3c1aff882fca2dd18be794d43ac5de0a30\",\"license\":\"MIT\"},\"contracts/libraries/utils/Lib_MerkleTree.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.9;\\n\\n/**\\n * @title Lib_MerkleTree\\n * @author River Keefer\\n */\\nlibrary Lib_MerkleTree {\\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, then\\n * 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(bytes32[] memory _elements) internal pure returns (bytes32) {\\n require(_elements.length > 0, \\\"Lib_MerkleTree: Must provide at least one leaf hash.\\\");\\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\\n * (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 ) internal pure returns (bool) {\\n require(_totalLeaves > 0, \\\"Lib_MerkleTree: Total leaves must be greater than zero.\\\");\\n\\n require(_index < _totalLeaves, \\\"Lib_MerkleTree: Index out of bounds.\\\");\\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(abi.encodePacked(_siblings[i], computedRoot));\\n } else {\\n computedRoot = keccak256(abi.encodePacked(computedRoot, _siblings[i]));\\n }\\n\\n _index >>= 1;\\n }\\n\\n return _root == computedRoot;\\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(uint256 _in) private pure returns (uint256) {\\n require(_in > 0, \\\"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\\\");\\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 & (((uint256(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 ((uint256(1) << highest) != _in) {\\n highest += 1;\\n }\\n\\n return highest;\\n }\\n}\\n\",\"keccak256\":\"0x84351e7b8be5007b77a67c1e3f34f46ed0c1ddc67e4e76797fd06f01ca9325aa\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506040516120bb3803806120bb83398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009e565b60008060006060848603121561007057600080fd5b83516001600160a01b038116811461008757600080fd5b602085015160409095015190969495509392505050565b61200e806100ad6000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80638ca5cbb911610081578063c17b291b1161005b578063c17b291b146101bb578063cfdf677e146101c4578063e561dddc146101cc57600080fd5b80638ca5cbb9146101805780639418bddd14610195578063b8e189ac146101a857600080fd5b80637aa63a86116100b25780637aa63a86146101595780637ad168a01461016f57806381eb62ef1461017757600080fd5b8063299ca478146100d9578063461a4478146101235780634d69ee5714610136575b600080fd5b6000546100f99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100f9610131366004611a1b565b6101d4565b610149610144366004611b8d565b610281565b604051901515815260200161011a565b610161610350565b60405190815260200161011a565b610161610369565b61016160025481565b61019361018e366004611c4a565b610382565b005b6101496101a3366004611c8f565b61075c565b6101936101b6366004611c8f565b610804565b61016160015481565b6100f96109c0565b6101616109e8565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061022b908590600401611d2f565b60206040518083038186803b15801561024357600080fd5b505afa158015610257573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027b9190611d64565b92915050565b600061028c83610a6f565b6102dd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206261746368206865616465722e000000000000000000000060448201526064015b60405180910390fd5b6102fa836020015185846000015185602001518760400151610b31565b6103465760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420696e636c7573696f6e2070726f6f662e000000000000000060448201526064016102d4565b5060019392505050565b60008061035b610d9f565b5064ffffffffff1692915050565b600080610374610d9f565b64ffffffffff169392505050565b61038a610350565b81146103fe5760405162461bcd60e51b815260206004820152603d60248201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60448201527f74206d6174636820657870656374656420737461727420696e6465782e00000060648201526084016102d4565b61043c6040518060400160405280600b81526020017f426f6e644d616e616765720000000000000000000000000000000000000000008152506101d4565b6040517f02ad4d2a00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff91909116906302ad4d2a9060240160206040518083038186803b1580156104a357600080fd5b505afa1580156104b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104db9190611d81565b61054d5760405162461bcd60e51b815260206004820152602f60248201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60448201527f6c6c61746572616c20706f73746564000000000000000000000000000000000060648201526084016102d4565b60008251116105c45760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460448201527f63682e000000000000000000000000000000000000000000000000000000000060648201526084016102d4565b6106026040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506101d4565b73ffffffffffffffffffffffffffffffffffffffff16637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561064757600080fd5b505afa15801561065b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067f9190611da3565b8251610689610350565b6106939190611deb565b111561072d5760405162461bcd60e51b815260206004820152604960248201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360448201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60648201527f73616374696f6e732e0000000000000000000000000000000000000000000000608482015260a4016102d4565b6040805142602082015233818301528151808203830181526060909101909152610758908390610e43565b5050565b60008082608001518060200190518101906107779190611e03565b509050806107ed5760405162461bcd60e51b815260206004820152602560248201527f4261746368206865616465722074696d657374616d702063616e6e6f7420626560448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016102d4565b42600154826107fc9190611deb565b119392505050565b6108426040518060400160405280601181526020017f4f564d5f467261756456657269666965720000000000000000000000000000008152506101d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e25760405162461bcd60e51b815260206004820152603b60248201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f6420627920746865204f564d5f467261756456657269666965722e000000000060648201526084016102d4565b6108eb81610a6f565b6109375760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206261746368206865616465722e000000000000000000000060448201526064016102d4565b6109408161075c565b6109b4576040805162461bcd60e51b81526020600482015260248101919091527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f642077697468696e207468652066726175642070726f6f662077696e646f772e60648201526084016102d4565b6109bd816110e6565b50565b60006109e3604051806060016040528060218152602001611fb8602191396101d4565b905090565b60006109f26109c0565b73ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3757600080fd5b505afa158015610a4b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e39190611da3565b6000610a796109c0565b82516040517f9507d39a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9290921691639507d39a91610ad19160040190815260200190565b60206040518083038186803b158015610ae957600080fd5b505afa158015610afd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b219190611da3565b610b2a83611317565b1492915050565b6000808211610ba85760405162461bcd60e51b815260206004820152603760248201527f4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d757360448201527f742062652067726561746572207468616e207a65726f2e00000000000000000060648201526084016102d4565b818410610c1c5760405162461bcd60e51b8152602060048201526024808201527f4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f7560448201527f6e64732e0000000000000000000000000000000000000000000000000000000060648201526084016102d4565b610c258261135d565b835114610cc05760405162461bcd60e51b815260206004820152604d60248201527f4c69625f4d65726b6c65547265653a20546f74616c207369626c696e6773206460448201527f6f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f2060648201527f746f74616c206c65617665732e00000000000000000000000000000000000000608482015260a4016102d4565b8460005b8451811015610d92578560011660011415610d2b57848181518110610ceb57610ceb611e33565b602002602001015182604051602001610d0e929190918252602082015260400190565b604051602081830303815290604052805190602001209150610d79565b81858281518110610d3e57610d3e611e33565b6020026020010151604051602001610d60929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b60019590951c9480610d8a81611e62565b915050610cc4565b5090951495945050505050565b6000806000610dac6109c0565b73ffffffffffffffffffffffffffffffffffffffff1663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610df157600080fd5b505afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e299190611e9b565b64ffffffffff602882901c169460509190911c9350915050565b6000610e836040518060400160405280600c81526020017f4f564d5f50726f706f73657200000000000000000000000000000000000000008152506101d4565b9050600080610e90610d9f565b90925090503373ffffffffffffffffffffffffffffffffffffffff84161415610eba575042610f69565b426002548264ffffffffff16610ed09190611deb565b10610f695760405162461bcd60e51b815260206004820152604360248201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960448201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460648201527f6f772e0000000000000000000000000000000000000000000000000000000000608482015260a4016102d4565b60006040518060a00160405280610f7e6109e8565b8152602001610f8c88611443565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610ff59493929190611edd565b60405180910390a26110056109c0565b73ffffffffffffffffffffffffffffffffffffffff16632015276c61102983611317565b61104e846040015185606001516110409190611deb565b602887811b91909117901b90565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000166024820152604401600060405180830381600087803b1580156110c657600080fd5b505af11580156110da573d6000803e3d6000fd5b50505050505050505050565b6110ee6109c0565b73ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561113357600080fd5b505afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190611da3565b8151106111ba5760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420626174636820696e6465782e00000000000000000000000060448201526064016102d4565b6111c381610a6f565b61120f5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206261746368206865616465722e000000000000000000000060448201526064016102d4565b6112176109c0565b8151606083015173ffffffffffffffffffffffffffffffffffffffff929092169163167fd681919060281b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000166024820152604401600060405180830381600087803b1580156112ba57600080fd5b505af11580156112ce573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd64826020015160405161130c91815260200190565b60405180910390a250565b600081602001518260400151836060015184608001516040516020016113409493929190611edd565b604051602081830303815290604052805190602001209050919050565b60008082116113d45760405162461bcd60e51b815260206004820152603060248201527f4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206360448201527f65696c286c6f675f3229206f6620302e0000000000000000000000000000000060648201526084016102d4565b81600114156113e557506000919050565b81600060805b600181106114235780611401600180831b611f0c565b901b83161561141b576114148183611deb565b92811c9291505b60011c6113eb565b506001811b841461143c57611439600182611deb565b90505b9392505050565b6000808251116114bb5760405162461bcd60e51b815260206004820152603460248201527f4c69625f4d65726b6c65547265653a204d7573742070726f766964652061742060448201527f6c65617374206f6e65206c65616620686173682e00000000000000000000000060648201526084016102d4565b8151600114156114e757816000815181106114d8576114d8611e33565b60200260200101519050919050565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156118fd57611798600285611f52565b91506117a5600285611f66565b600114905060005b82811015611851578a6117c1826002611f7a565b815181106117d1576117d1611e33565b602002602001015196508a8160026117e99190611f7a565b6117f4906001611deb565b8151811061180457611804611e33565b6020026020010151955086602089015285604089015287805190602001208b828151811061183457611834611e33565b60209081029190910101528061184981611e62565b9150506117ad565b5080156118cd5789611864600186611f0c565b8151811061187457611874611e33565b6020026020010151955087836010811061189057611890611e33565b602002015160001b945085602088015284604088015286805190602001208a83815181106118c0576118c0611e33565b6020026020010181815250505b806118d95760006118dc565b60015b6118e99060ff1683611deb565b9350826118f581611e62565b935050611784565b8960008151811061191057611910611e33565b602002602001015198505050505050505050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561199d5761199d611927565b604052919050565b600067ffffffffffffffff8311156119bf576119bf611927565b6119f060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011601611956565b9050828152838383011115611a0457600080fd5b828260208301376000602084830101529392505050565b600060208284031215611a2d57600080fd5b813567ffffffffffffffff811115611a4457600080fd5b8201601f81018413611a5557600080fd5b611a64848235602084016119a5565b949350505050565b600060a08284031215611a7e57600080fd5b60405160a0810167ffffffffffffffff8282108183111715611aa257611aa2611927565b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611adf57600080fd5b508301601f81018513611af157600080fd5b611b00858235602084016119a5565b6080830152505092915050565b600082601f830112611b1e57600080fd5b8135602067ffffffffffffffff821115611b3a57611b3a611927565b8160051b611b49828201611956565b9283528481018201928281019087851115611b6357600080fd5b83870192505b84831015611b8257823582529183019190830190611b69565b979650505050505050565b600080600060608486031215611ba257600080fd5b83359250602084013567ffffffffffffffff80821115611bc157600080fd5b611bcd87838801611a6c565b93506040860135915080821115611be357600080fd5b9085019060408288031215611bf757600080fd5b604051604081018181108382111715611c1257611c12611927565b60405282358152602083013582811115611c2b57600080fd5b611c3789828601611b0d565b6020830152508093505050509250925092565b60008060408385031215611c5d57600080fd5b823567ffffffffffffffff811115611c7457600080fd5b611c8085828601611b0d565b95602094909401359450505050565b600060208284031215611ca157600080fd5b813567ffffffffffffffff811115611cb857600080fd5b611a6484828501611a6c565b6000815180845260005b81811015611cea57602081850181015186830182015201611cce565b81811115611cfc576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061143c6020830184611cc4565b73ffffffffffffffffffffffffffffffffffffffff811681146109bd57600080fd5b600060208284031215611d7657600080fd5b815161143c81611d42565b600060208284031215611d9357600080fd5b8151801515811461143c57600080fd5b600060208284031215611db557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611dfe57611dfe611dbc565b500190565b60008060408385031215611e1657600080fd5b825191506020830151611e2881611d42565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e9457611e94611dbc565b5060010190565b600060208284031215611ead57600080fd5b81517fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008116811461143c57600080fd5b848152836020820152826040820152608060608201526000611f026080830184611cc4565b9695505050505050565b600082821015611f1e57611f1e611dbc565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611f6157611f61611f23565b500490565b600082611f7557611f75611f23565b500690565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611fb257611fb2611dbc565b50029056fe436861696e53746f72616765436f6e7461696e65722d5343432d62617463686573a2646970667358221220f97433bcdfea89f96da4dd35233c6b44aadecb94f82aab10226e964aff14127064736f6c63430008090033", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80638ca5cbb911610081578063c17b291b1161005b578063c17b291b146101bb578063cfdf677e146101c4578063e561dddc146101cc57600080fd5b80638ca5cbb9146101805780639418bddd14610195578063b8e189ac146101a857600080fd5b80637aa63a86116100b25780637aa63a86146101595780637ad168a01461016f57806381eb62ef1461017757600080fd5b8063299ca478146100d9578063461a4478146101235780634d69ee5714610136575b600080fd5b6000546100f99073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100f9610131366004611a1b565b6101d4565b610149610144366004611b8d565b610281565b604051901515815260200161011a565b610161610350565b60405190815260200161011a565b610161610369565b61016160025481565b61019361018e366004611c4a565b610382565b005b6101496101a3366004611c8f565b61075c565b6101936101b6366004611c8f565b610804565b61016160015481565b6100f96109c0565b6101616109e8565b600080546040517fbf40fac100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bf40fac19061022b908590600401611d2f565b60206040518083038186803b15801561024357600080fd5b505afa158015610257573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027b9190611d64565b92915050565b600061028c83610a6f565b6102dd5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206261746368206865616465722e000000000000000000000060448201526064015b60405180910390fd5b6102fa836020015185846000015185602001518760400151610b31565b6103465760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420696e636c7573696f6e2070726f6f662e000000000000000060448201526064016102d4565b5060019392505050565b60008061035b610d9f565b5064ffffffffff1692915050565b600080610374610d9f565b64ffffffffff169392505050565b61038a610350565b81146103fe5760405162461bcd60e51b815260206004820152603d60248201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60448201527f74206d6174636820657870656374656420737461727420696e6465782e00000060648201526084016102d4565b61043c6040518060400160405280600b81526020017f426f6e644d616e616765720000000000000000000000000000000000000000008152506101d4565b6040517f02ad4d2a00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff91909116906302ad4d2a9060240160206040518083038186803b1580156104a357600080fd5b505afa1580156104b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104db9190611d81565b61054d5760405162461bcd60e51b815260206004820152602f60248201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60448201527f6c6c61746572616c20706f73746564000000000000000000000000000000000060648201526084016102d4565b60008251116105c45760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460448201527f63682e000000000000000000000000000000000000000000000000000000000060648201526084016102d4565b6106026040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e000000000000008152506101d4565b73ffffffffffffffffffffffffffffffffffffffff16637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b15801561064757600080fd5b505afa15801561065b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067f9190611da3565b8251610689610350565b6106939190611deb565b111561072d5760405162461bcd60e51b815260206004820152604960248201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360448201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60648201527f73616374696f6e732e0000000000000000000000000000000000000000000000608482015260a4016102d4565b6040805142602082015233818301528151808203830181526060909101909152610758908390610e43565b5050565b60008082608001518060200190518101906107779190611e03565b509050806107ed5760405162461bcd60e51b815260206004820152602560248201527f4261746368206865616465722074696d657374616d702063616e6e6f7420626560448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016102d4565b42600154826107fc9190611deb565b119392505050565b6108426040518060400160405280601181526020017f4f564d5f467261756456657269666965720000000000000000000000000000008152506101d4565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e25760405162461bcd60e51b815260206004820152603b60248201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f6420627920746865204f564d5f467261756456657269666965722e000000000060648201526084016102d4565b6108eb81610a6f565b6109375760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206261746368206865616465722e000000000000000000000060448201526064016102d4565b6109408161075c565b6109b4576040805162461bcd60e51b81526020600482015260248101919091527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f642077697468696e207468652066726175642070726f6f662077696e646f772e60648201526084016102d4565b6109bd816110e6565b50565b60006109e3604051806060016040528060218152602001611fb8602191396101d4565b905090565b60006109f26109c0565b73ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3757600080fd5b505afa158015610a4b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e39190611da3565b6000610a796109c0565b82516040517f9507d39a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9290921691639507d39a91610ad19160040190815260200190565b60206040518083038186803b158015610ae957600080fd5b505afa158015610afd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b219190611da3565b610b2a83611317565b1492915050565b6000808211610ba85760405162461bcd60e51b815260206004820152603760248201527f4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d757360448201527f742062652067726561746572207468616e207a65726f2e00000000000000000060648201526084016102d4565b818410610c1c5760405162461bcd60e51b8152602060048201526024808201527f4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f7560448201527f6e64732e0000000000000000000000000000000000000000000000000000000060648201526084016102d4565b610c258261135d565b835114610cc05760405162461bcd60e51b815260206004820152604d60248201527f4c69625f4d65726b6c65547265653a20546f74616c207369626c696e6773206460448201527f6f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f2060648201527f746f74616c206c65617665732e00000000000000000000000000000000000000608482015260a4016102d4565b8460005b8451811015610d92578560011660011415610d2b57848181518110610ceb57610ceb611e33565b602002602001015182604051602001610d0e929190918252602082015260400190565b604051602081830303815290604052805190602001209150610d79565b81858281518110610d3e57610d3e611e33565b6020026020010151604051602001610d60929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b60019590951c9480610d8a81611e62565b915050610cc4565b5090951495945050505050565b6000806000610dac6109c0565b73ffffffffffffffffffffffffffffffffffffffff1663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b158015610df157600080fd5b505afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e299190611e9b565b64ffffffffff602882901c169460509190911c9350915050565b6000610e836040518060400160405280600c81526020017f4f564d5f50726f706f73657200000000000000000000000000000000000000008152506101d4565b9050600080610e90610d9f565b90925090503373ffffffffffffffffffffffffffffffffffffffff84161415610eba575042610f69565b426002548264ffffffffff16610ed09190611deb565b10610f695760405162461bcd60e51b815260206004820152604360248201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960448201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460648201527f6f772e0000000000000000000000000000000000000000000000000000000000608482015260a4016102d4565b60006040518060a00160405280610f7e6109e8565b8152602001610f8c88611443565b8152602001875181526020018464ffffffffff16815260200186815250905080600001517f16be4c5129a4e03cf3350262e181dc02ddfb4a6008d925368c0899fcd97ca9c58260200151836040015184606001518560800151604051610ff59493929190611edd565b60405180910390a26110056109c0565b73ffffffffffffffffffffffffffffffffffffffff16632015276c61102983611317565b61104e846040015185606001516110409190611deb565b602887811b91909117901b90565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000166024820152604401600060405180830381600087803b1580156110c657600080fd5b505af11580156110da573d6000803e3d6000fd5b50505050505050505050565b6110ee6109c0565b73ffffffffffffffffffffffffffffffffffffffff16631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561113357600080fd5b505afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190611da3565b8151106111ba5760405162461bcd60e51b815260206004820152601460248201527f496e76616c696420626174636820696e6465782e00000000000000000000000060448201526064016102d4565b6111c381610a6f565b61120f5760405162461bcd60e51b815260206004820152601560248201527f496e76616c6964206261746368206865616465722e000000000000000000000060448201526064016102d4565b6112176109c0565b8151606083015173ffffffffffffffffffffffffffffffffffffffff929092169163167fd681919060281b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815260048101929092527fffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000166024820152604401600060405180830381600087803b1580156112ba57600080fd5b505af11580156112ce573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd64826020015160405161130c91815260200190565b60405180910390a250565b600081602001518260400151836060015184608001516040516020016113409493929190611edd565b604051602081830303815290604052805190602001209050919050565b60008082116113d45760405162461bcd60e51b815260206004820152603060248201527f4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206360448201527f65696c286c6f675f3229206f6620302e0000000000000000000000000000000060648201526084016102d4565b81600114156113e557506000919050565b81600060805b600181106114235780611401600180831b611f0c565b901b83161561141b576114148183611deb565b92811c9291505b60011c6113eb565b506001811b841461143c57611439600182611deb565b90505b9392505050565b6000808251116114bb5760405162461bcd60e51b815260206004820152603460248201527f4c69625f4d65726b6c65547265653a204d7573742070726f766964652061742060448201527f6c65617374206f6e65206c65616620686173682e00000000000000000000000060648201526084016102d4565b8151600114156114e757816000815181106114d8576114d8611e33565b60200260200101519050919050565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b60018411156118fd57611798600285611f52565b91506117a5600285611f66565b600114905060005b82811015611851578a6117c1826002611f7a565b815181106117d1576117d1611e33565b602002602001015196508a8160026117e99190611f7a565b6117f4906001611deb565b8151811061180457611804611e33565b6020026020010151955086602089015285604089015287805190602001208b828151811061183457611834611e33565b60209081029190910101528061184981611e62565b9150506117ad565b5080156118cd5789611864600186611f0c565b8151811061187457611874611e33565b6020026020010151955087836010811061189057611890611e33565b602002015160001b945085602088015284604088015286805190602001208a83815181106118c0576118c0611e33565b6020026020010181815250505b806118d95760006118dc565b60015b6118e99060ff1683611deb565b9350826118f581611e62565b935050611784565b8960008151811061191057611910611e33565b602002602001015198505050505050505050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561199d5761199d611927565b604052919050565b600067ffffffffffffffff8311156119bf576119bf611927565b6119f060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f86011601611956565b9050828152838383011115611a0457600080fd5b828260208301376000602084830101529392505050565b600060208284031215611a2d57600080fd5b813567ffffffffffffffff811115611a4457600080fd5b8201601f81018413611a5557600080fd5b611a64848235602084016119a5565b949350505050565b600060a08284031215611a7e57600080fd5b60405160a0810167ffffffffffffffff8282108183111715611aa257611aa2611927565b81604052829350843583526020850135602084015260408501356040840152606085013560608401526080850135915080821115611adf57600080fd5b508301601f81018513611af157600080fd5b611b00858235602084016119a5565b6080830152505092915050565b600082601f830112611b1e57600080fd5b8135602067ffffffffffffffff821115611b3a57611b3a611927565b8160051b611b49828201611956565b9283528481018201928281019087851115611b6357600080fd5b83870192505b84831015611b8257823582529183019190830190611b69565b979650505050505050565b600080600060608486031215611ba257600080fd5b83359250602084013567ffffffffffffffff80821115611bc157600080fd5b611bcd87838801611a6c565b93506040860135915080821115611be357600080fd5b9085019060408288031215611bf757600080fd5b604051604081018181108382111715611c1257611c12611927565b60405282358152602083013582811115611c2b57600080fd5b611c3789828601611b0d565b6020830152508093505050509250925092565b60008060408385031215611c5d57600080fd5b823567ffffffffffffffff811115611c7457600080fd5b611c8085828601611b0d565b95602094909401359450505050565b600060208284031215611ca157600080fd5b813567ffffffffffffffff811115611cb857600080fd5b611a6484828501611a6c565b6000815180845260005b81811015611cea57602081850181015186830182015201611cce565b81811115611cfc576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061143c6020830184611cc4565b73ffffffffffffffffffffffffffffffffffffffff811681146109bd57600080fd5b600060208284031215611d7657600080fd5b815161143c81611d42565b600060208284031215611d9357600080fd5b8151801515811461143c57600080fd5b600060208284031215611db557600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115611dfe57611dfe611dbc565b500190565b60008060408385031215611e1657600080fd5b825191506020830151611e2881611d42565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611e9457611e94611dbc565b5060010190565b600060208284031215611ead57600080fd5b81517fffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000008116811461143c57600080fd5b848152836020820152826040820152608060608201526000611f026080830184611cc4565b9695505050505050565b600082821015611f1e57611f1e611dbc565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600082611f6157611f61611f23565b500490565b600082611f7557611f75611f23565b500690565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611fb257611fb2611dbc565b50029056fe436861696e53746f72616765436f6e7461696e65722d5343432d62617463686573a2646970667358221220f97433bcdfea89f96da4dd35233c6b44aadecb94f82aab10226e964aff14127064736f6c63430008090033", diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/fe8f11a27fedbac07dcc3c9879e50c98.json b/packages/contracts/deployments/goerli-nightly/solcInputs/0f61c2f477ce8ca23a2a78795b625932.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/fe8f11a27fedbac07dcc3c9879e50c98.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/0f61c2f477ce8ca23a2a78795b625932.json index bf0c6af44eaa..d85ab992cc0b 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/fe8f11a27fedbac07dcc3c9879e50c98.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/0f61c2f477ce8ca23a2a78795b625932.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" @@ -262,14 +262,6 @@ "devdoc", "userdoc", "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", "userdoc" ], "": [ diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/135031d3a6e239ee886cdb6d92ff3eb4.json b/packages/contracts/deployments/goerli-nightly/solcInputs/2453276f0fd3d335163681e9ac1b451f.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/135031d3a6e239ee886cdb6d92ff3eb4.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/2453276f0fd3d335163681e9ac1b451f.json index 7fbefd22fb4c..d3692e22b5df 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/135031d3a6e239ee886cdb6d92ff3eb4.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/2453276f0fd3d335163681e9ac1b451f.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" @@ -254,14 +254,6 @@ "devdoc", "userdoc", "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", "userdoc" ], "": [ diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/0be4bc8d116b632300d43e314f15da0c.json b/packages/contracts/deployments/goerli-nightly/solcInputs/44cb02469758083657d0b22a42632103.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/0be4bc8d116b632300d43e314f15da0c.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/44cb02469758083657d0b22a42632103.json index 028470798eeb..e8b9c13b1deb 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/0be4bc8d116b632300d43e314f15da0c.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/44cb02469758083657d0b22a42632103.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/4a53c0dd06fca16c6fdd29a0c129b9a0.json b/packages/contracts/deployments/goerli-nightly/solcInputs/4a53c0dd06fca16c6fdd29a0c129b9a0.json deleted file mode 100644 index 38a95547a8bd..000000000000 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/4a53c0dd06fca16c6fdd29a0c129b9a0.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "language": "Solidity", - "sources": { - "contracts/L1/deployment/AddressDictator.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { Lib_AddressManager } from \"../../libraries/resolver/Lib_AddressManager.sol\";\n\n/**\n * @title AddressDictator\n * @dev The AddressDictator (glory to Arstotzka) is a contract that allows us to safely manipulate\n * many different addresses in the AddressManager without transferring ownership of the\n * AddressManager to a hot wallet or hardware wallet.\n */\ncontract AddressDictator {\n /*********\n * Types *\n *********/\n\n struct NamedAddress {\n string name;\n address addr;\n }\n\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public manager;\n address public finalOwner;\n NamedAddress[] namedAddresses;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _manager Address of the AddressManager contract.\n * @param _finalOwner Address to transfer AddressManager ownership to afterwards.\n * @param _names Array of names to associate an address with.\n * @param _addresses Array of addresses to associate with the name.\n */\n constructor(\n Lib_AddressManager _manager,\n address _finalOwner,\n string[] memory _names,\n address[] memory _addresses\n ) {\n manager = _manager;\n finalOwner = _finalOwner;\n require(\n _names.length == _addresses.length,\n \"AddressDictator: Must provide an equal number of names and addresses.\"\n );\n for (uint256 i = 0; i < _names.length; i++) {\n namedAddresses.push(NamedAddress({ name: _names[i], addr: _addresses[i] }));\n }\n }\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Called to finalize the transfer, this function is callable by anyone, but will only result in\n * an upgrade if this contract is the owner Address Manager.\n */\n // slither-disable-next-line calls-loop\n function setAddresses() external {\n for (uint256 i = 0; i < namedAddresses.length; i++) {\n manager.setAddress(namedAddresses[i].name, namedAddresses[i].addr);\n }\n // note that this will revert if _finalOwner == currentOwner\n manager.transferOwnership(finalOwner);\n }\n\n /**\n * Transfers ownership of this contract to the finalOwner.\n * Only callable by the Final Owner, which is intended to be our multisig.\n * This function shouldn't be necessary, but it gives a sense of reassurance that we can recover\n * if something really surprising goes wrong.\n */\n function returnOwnership() external {\n require(msg.sender == finalOwner, \"AddressDictator: only callable by finalOwner\");\n manager.transferOwnership(finalOwner);\n }\n\n /******************\n * View Functions *\n ******************/\n\n /**\n * Returns the full namedAddresses array.\n */\n function getNamedAddresses() external view returns (NamedAddress[] memory) {\n return namedAddresses;\n }\n}\n" - }, - "contracts/libraries/resolver/Lib_AddressManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 * Events *\n **********/\n\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\n\n /*************\n * Variables *\n *************/\n\n mapping(bytes32 => address) private addresses;\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(string memory _name, address _address) external onlyOwner {\n bytes32 nameHash = _getNameHash(_name);\n address oldAddress = addresses[nameHash];\n addresses[nameHash] = _address;\n\n emit AddressSet(_name, _address, oldAddress);\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(string memory _name) external view returns (address) {\n return addresses[_getNameHash(_name)];\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(string memory _name) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" - }, - "@openzeppelin/contracts/access/Ownable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\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() {\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Context.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^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 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) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" - }, - "contracts/libraries/resolver/Lib_ResolvedDelegateProxy.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_ResolvedDelegateProxy\n */\ncontract Lib_ResolvedDelegateProxy {\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 * 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(address _libAddressManager, string memory _implementationName) {\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\n implementationName[address(this)] = _implementationName;\n }\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback() external payable {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\n require(target != address(0), \"Target address must be initialized.\");\n\n // slither-disable-next-line controlled-delegatecall\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/libraries/resolver/Lib_AddressResolver.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_AddressResolver\n */\nabstract contract Lib_AddressResolver {\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public libAddressManager;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(address _libAddressManager) {\n libAddressManager = Lib_AddressManager(_libAddressManager);\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(string memory _name) public view returns (address) {\n return libAddressManager.getAddress(_name);\n }\n}\n" - }, - "contracts/L1/verification/BondManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IBondManager } from \"./IBondManager.sol\";\n\n/* Contract Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/**\n * @title BondManager\n * @dev This contract is, for now, a stub of the \"real\" BondManager that does nothing but\n * allow the \"OVM_Proposer\" to submit state root batches.\n *\n */\ncontract BondManager is IBondManager, Lib_AddressResolver {\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) {}\n\n /**\n * Checks whether a given address is properly collateralized and can perform actions within\n * the system.\n * @param _who Address to check.\n * @return true if the address is properly collateralized, false otherwise.\n */\n // slither-disable-next-line external-function\n function isCollateralized(address _who) public view returns (bool) {\n // Only authenticate sequencer to submit state root batches.\n return _who == resolve(\"OVM_Proposer\");\n }\n}\n" - }, - "contracts/L1/verification/IBondManager.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IBondManager\n */\ninterface IBondManager {\n /********************\n * Public Functions *\n ********************/\n\n function isCollateralized(address _who) external view returns (bool);\n}\n" - }, - "contracts/L1/rollup/StateCommitmentChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 { IStateCommitmentChain } from \"./IStateCommitmentChain.sol\";\nimport { ICanonicalTransactionChain } from \"./ICanonicalTransactionChain.sol\";\nimport { IBondManager } from \"../verification/IBondManager.sol\";\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title 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 */\ncontract StateCommitmentChain is IStateCommitmentChain, Lib_AddressResolver {\n /*************\n * Constants *\n *************/\n\n uint256 public FRAUD_PROOF_WINDOW;\n uint256 public SEQUENCER_PUBLISH_WINDOW;\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 ) Lib_AddressResolver(_libAddressManager) {\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\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() public view returns (IChainStorageContainer) {\n return IChainStorageContainer(resolve(\"ChainStorageContainer-SCC-batches\"));\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n function getTotalElements() public view returns (uint256 _totalElements) {\n (uint40 totalElements, ) = _getBatchExtraData();\n return uint256(totalElements);\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n function getTotalBatches() public view returns (uint256 _totalBatches) {\n return batches().length();\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function getLastSequencerTimestamp() public view returns (uint256 _lastSequencerTimestamp) {\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\n return uint256(lastSequencerTimestamp);\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function appendStateBatch(bytes32[] memory _batch, uint256 _shouldStartAtElement) public {\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 IBondManager(resolve(\"BondManager\")).isCollateralized(msg.sender),\n \"Proposer does not have enough collateral posted\"\n );\n\n require(_batch.length > 0, \"Cannot submit an empty state batch.\");\n\n require(\n getTotalElements() + _batch.length <=\n ICanonicalTransactionChain(resolve(\"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(_batch, abi.encode(block.timestamp, msg.sender));\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function deleteStateBatch(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) public {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"State batches can only be deleted by the OVM_FraudVerifier.\"\n );\n\n require(_isValidBatchHeader(_batchHeader), \"Invalid batch header.\");\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 IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function verifyStateCommitment(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n ) public view returns (bool) {\n require(_isValidBatchHeader(_batchHeader), \"Invalid batch header.\");\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 IStateCommitmentChain\n */\n function insideFraudProofWindow(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n public\n view\n returns (bool _inside)\n {\n (uint256 timestamp, ) = abi.decode(_batchHeader.extraData, (uint256, address));\n\n require(timestamp != 0, \"Batch header timestamp cannot be zero\");\n return (timestamp + FRAUD_PROOF_WINDOW) > block.timestamp;\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() internal view returns (uint40, uint40) {\n bytes27 extraData = batches().getGlobalMetadata();\n\n // solhint-disable max-line-length\n uint40 totalElements;\n uint40 lastSequencerTimestamp;\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(\n extraData,\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\n )\n lastSequencerTimestamp := shr(\n 40,\n and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n )\n }\n // solhint-enable max-line-length\n\n return (totalElements, lastSequencerTimestamp);\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(uint40 _totalElements, uint40 _lastSequencerTimestamp)\n internal\n pure\n returns (bytes27)\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(bytes32[] memory _batch, bytes memory _extraData) internal {\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) internal {\n require(_batchHeader.batchIndex < batches().length(), \"Invalid batch index.\");\n\n require(_isValidBatchHeader(_batchHeader), \"Invalid batch header.\");\n\n // slither-disable-next-line reentrancy-events\n batches().deleteElementsAfterInclusive(\n _batchHeader.batchIndex,\n _makeBatchExtraData(uint40(_batchHeader.prevTotalElements), 0)\n );\n\n // slither-disable-next-line reentrancy-events\n emit StateBatchDeleted(_batchHeader.batchIndex, _batchHeader.batchRoot);\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n internal\n view\n returns (bool)\n {\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\n }\n}\n" - }, - "contracts/libraries/codec/Lib_OVMCodec.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 * Enums *\n *********/\n\n enum QueueOrigin {\n SEQUENCER_QUEUE,\n L1TOL2_QUEUE\n }\n\n /***********\n * Structs *\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 * 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(Transaction memory _transaction)\n internal\n pure\n returns (bytes memory)\n {\n return\n 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(Transaction memory _transaction) internal pure returns (bytes32) {\n return keccak256(encodeTransaction(_transaction));\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(bytes memory _encoded) internal pure returns (EVMAccount memory) {\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\n\n return\n 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n internal\n pure\n returns (bytes32)\n {\n return\n keccak256(\n abi.encode(\n _batchHeader.batchRoot,\n _batchHeader.batchSize,\n _batchHeader.prevTotalElements,\n _batchHeader.extraData\n )\n );\n }\n}\n" - }, - "contracts/libraries/utils/Lib_MerkleTree.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_MerkleTree\n * @author River Keefer\n */\nlibrary Lib_MerkleTree {\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, then\n * 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(bytes32[] memory _elements) internal pure returns (bytes32) {\n require(_elements.length > 0, \"Lib_MerkleTree: Must provide at least one leaf hash.\");\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\n * (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 ) internal pure returns (bool) {\n require(_totalLeaves > 0, \"Lib_MerkleTree: Total leaves must be greater than zero.\");\n\n require(_index < _totalLeaves, \"Lib_MerkleTree: Index out of bounds.\");\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(abi.encodePacked(_siblings[i], computedRoot));\n } else {\n computedRoot = keccak256(abi.encodePacked(computedRoot, _siblings[i]));\n }\n\n _index >>= 1;\n }\n\n return _root == computedRoot;\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(uint256 _in) private pure returns (uint256) {\n require(_in > 0, \"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\");\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 & (((uint256(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 ((uint256(1) << highest) != _in) {\n highest += 1;\n }\n\n return highest;\n }\n}\n" - }, - "contracts/L1/rollup/IStateCommitmentChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title IStateCommitmentChain\n */\ninterface IStateCommitmentChain {\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(uint256 indexed _batchIndex, bytes32 _batchRoot);\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() external view returns (uint256 _totalElements);\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches() external view returns (uint256 _totalBatches);\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() external view returns (uint256 _lastSequencerTimestamp);\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(bytes32[] calldata _batch, uint256 _shouldStartAtElement) 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) 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 ) external view returns (bool _verified);\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n external\n view\n returns (bool _inside);\n}\n" - }, - "contracts/L1/rollup/ICanonicalTransactionChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title ICanonicalTransactionChain\n */\ninterface ICanonicalTransactionChain {\n /**********\n * Events *\n **********/\n\n event L2GasParamsUpdated(\n uint256 l2GasDiscountDivisor,\n uint256 enqueueGasCost,\n uint256 enqueueL2GasPrepaid\n );\n\n event TransactionEnqueued(\n address indexed _l1TxOrigin,\n address indexed _target,\n uint256 _gasLimit,\n bytes _data,\n uint256 indexed _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 * Structs *\n ***********/\n\n struct BatchContext {\n uint256 numSequencedTransactions;\n uint256 numSubsequentQueueTransactions;\n uint256 timestamp;\n uint256 blockNumber;\n }\n\n /*******************************\n * Authorized Setter Functions *\n *******************************/\n\n /**\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\n * The value of enqueueL2GasPrepaid is immediately updated as well.\n */\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost) external;\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() external view returns (IChainStorageContainer);\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements() external view returns (uint256 _totalElements);\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches() external view returns (uint256 _totalBatches);\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() external view returns (uint40);\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(uint256 _index)\n external\n view\n returns (Lib_OVMCodec.QueueElement memory _element);\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n function getLastTimestamp() external view returns (uint40);\n\n /**\n * Returns the blocknumber of the last transaction.\n * @return Blocknumber for the last transaction.\n */\n function getLastBlockNumber() external view returns (uint40);\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() external view returns (uint40);\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() external view returns (uint40);\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 ) 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 ) external;\n}\n" - }, - "contracts/L1/rollup/IChainStorageContainer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IChainStorageContainer\n */\ninterface IChainStorageContainer {\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(bytes27 _globalMetadata) external;\n\n /**\n * Retrieves the container's global metadata field.\n * @return Container global metadata field.\n */\n function getGlobalMetadata() external view returns (bytes27);\n\n /**\n * Retrieves the number of objects stored in the container.\n * @return Number of objects in the container.\n */\n function length() external view returns (uint256);\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\n\n /**\n * Removes all objects after and including a given index.\n * @param _index Object index to delete from.\n */\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\n}\n" - }, - "contracts/libraries/rlp/Lib_RLPReader.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_RLPReader\n * @dev Adapted from \"RLPReader\" by Hamdi Allam (hamdi.allam97@gmail.com).\n */\nlibrary Lib_RLPReader {\n /*************\n * Constants *\n *************/\n\n uint256 internal constant MAX_LIST_LENGTH = 32;\n\n /*********\n * Enums *\n *********/\n\n enum RLPItemType {\n DATA_ITEM,\n LIST_ITEM\n }\n\n /***********\n * Structs *\n ***********/\n\n struct RLPItem {\n uint256 length;\n uint256 ptr;\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(bytes memory _in) internal pure returns (RLPItem memory) {\n uint256 ptr;\n assembly {\n ptr := add(_in, 32)\n }\n\n return RLPItem({ length: _in.length, ptr: ptr });\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(RLPItem memory _in) internal pure returns (RLPItem[] memory) {\n (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in);\n\n require(itemType == RLPItemType.LIST_ITEM, \"Invalid RLP list value.\");\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(itemCount < MAX_LIST_LENGTH, \"Provided RLP list exceeds max list length.\");\n\n (uint256 itemOffset, uint256 itemLength, ) = _decodeLength(\n RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })\n );\n\n out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset });\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(bytes memory _in) internal pure returns (RLPItem[] memory) {\n return readList(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bytes memory) {\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\n\n require(itemType == RLPItemType.DATA_ITEM, \"Invalid RLP bytes value.\");\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(bytes memory _in) internal pure returns (bytes memory) {\n return readBytes(toRLPItem(_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(RLPItem memory _in) internal pure returns (string memory) {\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(bytes memory _in) internal pure returns (string memory) {\n return readString(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bytes32) {\n require(_in.length <= 33, \"Invalid RLP bytes32 value.\");\n\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\n\n require(itemType == RLPItemType.DATA_ITEM, \"Invalid RLP bytes32 value.\");\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(bytes memory _in) internal pure returns (bytes32) {\n return readBytes32(toRLPItem(_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(RLPItem memory _in) internal pure returns (uint256) {\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(bytes memory _in) internal pure returns (uint256) {\n return readUint256(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bool) {\n require(_in.length == 1, \"Invalid RLP boolean value.\");\n\n uint256 ptr = _in.ptr;\n uint256 out;\n assembly {\n out := byte(0, mload(ptr))\n }\n\n require(out == 0 || out == 1, \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\");\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(bytes memory _in) internal pure returns (bool) {\n return readBool(toRLPItem(_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(RLPItem memory _in) internal pure returns (address) {\n if (_in.length == 1) {\n return address(0);\n }\n\n require(_in.length == 21, \"Invalid RLP address value.\");\n\n return address(uint160(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(bytes memory _in) internal pure returns (address) {\n return readAddress(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bytes memory) {\n return _copy(_in);\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(RLPItem memory _in)\n private\n pure\n returns (\n uint256,\n uint256,\n RLPItemType\n )\n {\n require(_in.length > 0, \"RLP item cannot be null.\");\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 // slither-disable-next-line variable-scope\n uint256 strLen = prefix - 0x80;\n\n require(_in.length > strLen, \"Invalid RLP short string.\");\n\n return (1, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xbf) {\n // Long string.\n uint256 lenOfStrLen = prefix - 0xb7;\n\n require(_in.length > lenOfStrLen, \"Invalid RLP long string length.\");\n\n uint256 strLen;\n assembly {\n // Pick out the string length.\n strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))\n }\n\n require(_in.length > lenOfStrLen + strLen, \"Invalid RLP long string.\");\n\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xf7) {\n // Short list.\n // slither-disable-next-line variable-scope\n uint256 listLen = prefix - 0xc0;\n\n require(_in.length > listLen, \"Invalid RLP short list.\");\n\n return (1, listLen, RLPItemType.LIST_ITEM);\n } else {\n // Long list.\n uint256 lenOfListLen = prefix - 0xf7;\n\n require(_in.length > lenOfListLen, \"Invalid RLP long list length.\");\n\n uint256 listLen;\n assembly {\n // Pick out the list length.\n listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))\n }\n\n require(_in.length > lenOfListLen + listLen, \"Invalid RLP long list.\");\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 ) private pure returns (bytes memory) {\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;\n unchecked {\n mask = 256**(32 - (_length % 32)) - 1;\n }\n\n assembly {\n mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))\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(RLPItem memory _in) private pure returns (bytes memory) {\n return _copy(_in.ptr, 0, _in.length);\n }\n}\n" - }, - "contracts/libraries/rlp/Lib_RLPWriter.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_RLPWriter\n * @author Bakaoh (with modifications)\n */\nlibrary Lib_RLPWriter {\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(bytes memory _in) internal pure returns (bytes memory) {\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(bytes[] memory _in) internal pure returns (bytes memory) {\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(string memory _in) internal pure returns (bytes memory) {\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(address _in) internal pure returns (bytes memory) {\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(uint256 _in) internal pure returns (bytes memory) {\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(bool _in) internal pure returns (bytes memory) {\n bytes memory encoded = new bytes(1);\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\n return encoded;\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(uint256 _len, uint256 _offset) private pure returns (bytes memory) {\n bytes memory encoded;\n\n if (_len < 56) {\n encoded = new bytes(1);\n encoded[0] = bytes1(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] = bytes1(uint8(lenLen) + uint8(_offset) + 55);\n for (i = 1; i <= lenLen; i++) {\n encoded[i] = bytes1(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(uint256 _x) private pure returns (bytes memory) {\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 ) private pure {\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;\n unchecked {\n mask = 256**(32 - len) - 1;\n }\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(bytes[] memory _list) private pure returns (bytes memory) {\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 {\n flattenedPtr := add(flattened, 0x20)\n }\n\n for (i = 0; i < _list.length; i++) {\n bytes memory item = _list[i];\n\n uint256 listPtr;\n assembly {\n listPtr := add(item, 0x20)\n }\n\n _memcpy(flattenedPtr, listPtr, item.length);\n flattenedPtr += _list[i].length;\n }\n\n return flattened;\n }\n}\n" - }, - "contracts/libraries/utils/Lib_BytesUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_BytesUtils\n */\nlibrary Lib_BytesUtils {\n /**********************\n * Internal Functions *\n **********************/\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) internal pure returns (bytes memory) {\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(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) {\n if (_start >= _bytes.length) {\n return bytes(\"\");\n }\n\n return slice(_bytes, _start, _bytes.length - _start);\n }\n\n function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {\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(bytes memory _bytes) internal pure returns (uint256) {\n return uint256(toBytes32(_bytes));\n }\n\n function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) {\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(bytes memory _bytes) internal pure returns (bytes memory) {\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(bytes memory _bytes, bytes memory _other) internal pure returns (bool) {\n return keccak256(_bytes) == keccak256(_other);\n }\n}\n" - }, - "contracts/libraries/utils/Lib_Bytes32Utils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_Byte32Utils\n */\nlibrary Lib_Bytes32Utils {\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(bytes32 _in) internal pure returns (bool) {\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(bool _in) internal pure returns (bytes32) {\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(bytes32 _in) internal pure returns (address) {\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(address _in) internal pure returns (bytes32) {\n return bytes32(uint256(uint160(_in)));\n }\n}\n" - }, - "contracts/L1/rollup/ChainStorageContainer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../libraries/utils/Lib_Buffer.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title ChainStorageContainer\n * @dev The Chain Storage Container provides its owner contract with read, write and delete\n * functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which\n * can no longer be used in a fraud proof due to the fraud window having passed, and the associated\n * chain state or 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 */\ncontract ChainStorageContainer is IChainStorageContainer, Lib_AddressResolver {\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Lib_Buffer.Buffer;\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_Buffer.Buffer internal buffer;\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(address _libAddressManager, string memory _owner)\n Lib_AddressResolver(_libAddressManager)\n {\n owner = _owner;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyOwner() {\n require(\n msg.sender == resolve(owner),\n \"ChainStorageContainer: Function can only be called by the owner.\"\n );\n _;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function setGlobalMetadata(bytes27 _globalMetadata) public onlyOwner {\n return buffer.setExtraData(_globalMetadata);\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function getGlobalMetadata() public view returns (bytes27) {\n return buffer.getExtraData();\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function length() public view returns (uint256) {\n return uint256(buffer.getLength());\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function push(bytes32 _object) public onlyOwner {\n buffer.push(_object);\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function push(bytes32 _object, bytes27 _globalMetadata) public onlyOwner {\n buffer.push(_object, _globalMetadata);\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function get(uint256 _index) public view returns (bytes32) {\n return buffer.get(uint40(_index));\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function deleteElementsAfterInclusive(uint256 _index) public onlyOwner {\n buffer.deleteElementsAfterInclusive(uint40(_index));\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function deleteElementsAfterInclusive(uint256 _index, bytes27 _globalMetadata)\n public\n onlyOwner\n {\n buffer.deleteElementsAfterInclusive(uint40(_index), _globalMetadata);\n }\n}\n" - }, - "contracts/libraries/utils/Lib_Buffer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_Buffer\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\n * overwritable \"extra data\" field so we can store more information with a single SSTORE.\n */\nlibrary Lib_Buffer {\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Buffer;\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n bytes32 context;\n mapping(uint256 => bytes32) buf;\n }\n\n struct BufferContext {\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\n // need in an array and we get an extra 27 bytes of extra data to play with.\n uint40 length;\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\n // squeezing out some gas optimizations.\n bytes27 extraData;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n * @param _extraData Global extra data.\n */\n function push(\n Buffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n ) internal {\n BufferContext memory ctx = _self.getContext();\n\n _self.buf[ctx.length] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.length++;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n */\n function push(Buffer storage _self, bytes32 _value) internal {\n BufferContext memory ctx = _self.getContext();\n\n _self.push(_value, ctx.extraData);\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(Buffer storage _self, uint256 _index) internal view returns (bytes32) {\n BufferContext memory ctx = _self.getContext();\n\n require(_index < ctx.length, \"Index out of bounds.\");\n\n return _self.buf[_index];\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n * @param _extraData Optional global extra data.\n */\n function deleteElementsAfterInclusive(\n Buffer storage _self,\n uint40 _index,\n bytes27 _extraData\n ) internal {\n BufferContext memory ctx = _self.getContext();\n\n require(_index < ctx.length, \"Index out of bounds.\");\n\n // Set our length and extra data, save the context.\n ctx.length = _index;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n */\n function deleteElementsAfterInclusive(Buffer storage _self, uint40 _index) internal {\n BufferContext memory ctx = _self.getContext();\n _self.deleteElementsAfterInclusive(_index, ctx.extraData);\n }\n\n /**\n * Retrieves the current global index.\n * @param _self Buffer to access.\n * @return Current global index.\n */\n function getLength(Buffer storage _self) internal view returns (uint40) {\n BufferContext memory ctx = _self.getContext();\n return ctx.length;\n }\n\n /**\n * Changes current global extra data.\n * @param _self Buffer to access.\n * @param _extraData New global extra data.\n */\n function setExtraData(Buffer storage _self, bytes27 _extraData) internal {\n BufferContext memory ctx = _self.getContext();\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Retrieves the current global extra data.\n * @param _self Buffer to access.\n * @return Current global extra data.\n */\n function getExtraData(Buffer storage _self) internal view returns (bytes27) {\n BufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current buffer context.\n */\n function setContext(Buffer storage _self, BufferContext memory _ctx) internal {\n bytes32 context;\n uint40 length = _ctx.length;\n bytes27 extraData = _ctx.extraData;\n assembly {\n context := length\n context := or(context, extraData)\n }\n\n if (_self.context != context) {\n _self.context = context;\n }\n }\n\n /**\n * Retrieves the current buffer context.\n * @param _self Buffer to access.\n * @return Current buffer context.\n */\n function getContext(Buffer storage _self) internal view returns (BufferContext memory) {\n bytes32 context = _self.context;\n uint40 length;\n bytes27 extraData;\n assembly {\n length := and(\n context,\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\n )\n extraData := and(\n context,\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000\n )\n }\n\n return BufferContext({ length: length, extraData: extraData });\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_Buffer.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../libraries/utils/Lib_Buffer.sol\";\n\n/**\n * @title TestLib_Buffer\n */\ncontract TestLib_Buffer {\n using Lib_Buffer for Lib_Buffer.Buffer;\n using Lib_Buffer for Lib_Buffer.BufferContext;\n\n Lib_Buffer.Buffer internal buf;\n\n function push(bytes32 _value, bytes27 _extraData) public {\n buf.push(_value, _extraData);\n }\n\n function push(bytes32 _value) public {\n buf.push(_value);\n }\n\n function get(uint256 _index) public view returns (bytes32) {\n return buf.get(_index);\n }\n\n function deleteElementsAfterInclusive(uint40 _index) public {\n return buf.deleteElementsAfterInclusive(_index);\n }\n\n function deleteElementsAfterInclusive(uint40 _index, bytes27 _extraData) public {\n return buf.deleteElementsAfterInclusive(_index, _extraData);\n }\n\n function getLength() public view returns (uint40) {\n return buf.getLength();\n }\n\n function setExtraData(bytes27 _extraData) public {\n return buf.setExtraData(_extraData);\n }\n\n function getExtraData() public view returns (bytes27) {\n return buf.getExtraData();\n }\n\n function getContext() public view returns (Lib_Buffer.BufferContext memory) {\n return buf.getContext();\n }\n\n function setContext(uint40 _index, bytes27 _extraData) public {\n Lib_Buffer.BufferContext memory _ctx = Lib_Buffer.BufferContext({\n length: _index,\n extraData: _extraData\n });\n return buf.setContext(_ctx);\n }\n}\n" - }, - "contracts/L1/rollup/CanonicalTransactionChain.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { ICanonicalTransactionChain } from \"./ICanonicalTransactionChain.sol\";\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title 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\n * Sequencer will eventually append it to the rollup state.\n *\n */\ncontract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressResolver {\n /*************\n * Constants *\n *************/\n\n // L2 tx gas-related\n uint256 public constant MIN_ROLLUP_TX_GAS = 100000;\n uint256 public constant MAX_ROLLUP_TX_SIZE = 50000;\n\n // The approximate cost of calling the enqueue function\n uint256 public enqueueGasCost;\n // The ratio of the cost of L1 gas to the cost of L2 gas\n uint256 public l2GasDiscountDivisor;\n // The amount of L2 gas which can be forwarded to L2 without spam prevention via 'gas burn'.\n // Calculated as the product of l2GasDiscountDivisor * enqueueGasCost.\n // See comments in enqueue() for further detail.\n uint256 public enqueueL2GasPrepaid;\n\n // Encoding-related (all in bytes)\n uint256 internal constant BATCH_CONTEXT_SIZE = 16;\n // slither-disable-next-line unused-state\n uint256 internal constant BATCH_CONTEXT_LENGTH_POS = 12;\n uint256 internal constant BATCH_CONTEXT_START_POS = 15;\n // slither-disable-next-line unused-state\n uint256 internal constant TX_DATA_HEADER_SIZE = 3;\n // slither-disable-next-line unused-state\n uint256 internal constant BYTES_TILL_TX_DATA = 65;\n\n /*************\n * Variables *\n *************/\n\n uint256 public maxTransactionGasLimit;\n\n /***************\n * Queue State *\n ***************/\n\n uint40 private _nextQueueIndex; // index of the first queue element not yet included\n Lib_OVMCodec.QueueElement[] queueElements;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager,\n uint256 _maxTransactionGasLimit,\n uint256 _l2GasDiscountDivisor,\n uint256 _enqueueGasCost\n ) Lib_AddressResolver(_libAddressManager) {\n maxTransactionGasLimit = _maxTransactionGasLimit;\n l2GasDiscountDivisor = _l2GasDiscountDivisor;\n enqueueGasCost = _enqueueGasCost;\n enqueueL2GasPrepaid = _l2GasDiscountDivisor * _enqueueGasCost;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the Burn Admin may\n * successfully call a method.\n */\n modifier onlyBurnAdmin() {\n require(msg.sender == libAddressManager.owner(), \"Only callable by the Burn Admin.\");\n _;\n }\n\n /*******************************\n * Authorized Setter Functions *\n *******************************/\n\n /**\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\n * The value of enqueueL2GasPrepaid is immediately updated as well.\n */\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost)\n external\n onlyBurnAdmin\n {\n enqueueGasCost = _enqueueGasCost;\n l2GasDiscountDivisor = _l2GasDiscountDivisor;\n // See the comment in enqueue() for the rationale behind this formula.\n enqueueL2GasPrepaid = _l2GasDiscountDivisor * _enqueueGasCost;\n\n emit L2GasParamsUpdated(l2GasDiscountDivisor, enqueueGasCost, enqueueL2GasPrepaid);\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() public view returns (IChainStorageContainer) {\n return IChainStorageContainer(resolve(\"ChainStorageContainer-CTC-batches\"));\n }\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements() public view returns (uint256 _totalElements) {\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 // slither-disable-next-line external-function\n function getTotalBatches() public view returns (uint256 _totalBatches) {\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 // slither-disable-next-line external-function\n function getNextQueueIndex() public view returns (uint40) {\n return _nextQueueIndex;\n }\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n // slither-disable-next-line external-function\n function getLastTimestamp() public view returns (uint40) {\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 // slither-disable-next-line external-function\n function getLastBlockNumber() public view returns (uint40) {\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 // slither-disable-next-line external-function\n function getQueueElement(uint256 _index)\n public\n view\n returns (Lib_OVMCodec.QueueElement memory _element)\n {\n return queueElements[_index];\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 // slither-disable-next-line external-function\n function getNumPendingQueueElements() public view returns (uint40) {\n return uint40(queueElements.length) - _nextQueueIndex;\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 // slither-disable-next-line external-function\n function getQueueLength() public view returns (uint40) {\n return uint40(queueElements.length);\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 ) external {\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(_gasLimit >= MIN_ROLLUP_TX_GAS, \"Transaction gas limit too low to enqueue.\");\n\n // Transactions submitted to the queue lack a method for paying gas fees to the Sequencer.\n // So we need to prevent spam attacks by ensuring that the cost of enqueueing a transaction\n // from L1 to L2 is not underpriced. For transaction with a high L2 gas limit, we do this by\n // burning some extra gas on L1. Of course there is also some intrinsic cost to enqueueing a\n // transaction, so we want to make sure not to over-charge (by burning too much L1 gas).\n // Therefore, we define 'enqueueL2GasPrepaid' as the L2 gas limit above which we must burn\n // additional gas on L1. This threshold is the product of two inputs:\n // 1. enqueueGasCost: the base cost of calling this function.\n // 2. l2GasDiscountDivisor: the ratio between the cost of gas on L1 and L2. This is a\n // positive integer, meaning we assume L2 gas is always less costly.\n // The calculation below for gasToConsume can be seen as converting the difference (between\n // the specified L2 gas limit and the prepaid L2 gas limit) to an L1 gas amount.\n if (_gasLimit > enqueueL2GasPrepaid) {\n uint256 gasToConsume = (_gasLimit - enqueueL2GasPrepaid) / l2GasDiscountDivisor;\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(startingGas > gasToConsume, \"Insufficient gas for L2 rate limiting burn.\");\n\n uint256 i;\n while (startingGas - gasleft() < gasToConsume) {\n i++;\n }\n }\n\n // Apply an aliasing unless msg.sender == tx.origin. This prevents an attack in which a\n // contract on L1 has the same address as a contract on L2 but doesn't have the same code.\n // We can safely ignore this for EOAs because they're guaranteed to have the same \"code\"\n // (i.e. no code at all). This also makes it possible for users to interact with contracts\n // on L2 even when the Sequencer is down.\n address sender;\n if (msg.sender == tx.origin) {\n sender = msg.sender;\n } else {\n sender = AddressAliasHelper.applyL1ToL2Alias(msg.sender);\n }\n\n bytes32 transactionHash = keccak256(abi.encode(sender, _target, _gasLimit, _data));\n\n queueElements.push(\n Lib_OVMCodec.QueueElement({\n transactionHash: transactionHash,\n timestamp: uint40(block.timestamp),\n blockNumber: uint40(block.number)\n })\n );\n uint256 queueIndex = queueElements.length - 1;\n emit TransactionEnqueued(sender, _target, _gasLimit, _data, queueIndex, block.timestamp);\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() external {\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 uint40 nextTransactionPtr = uint40(\n BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts\n );\n\n require(msg.data.length >= nextTransactionPtr, \"Not enough BatchContexts provided.\");\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\n // Cache the _nextQueueIndex storage variable to a temporary stack variable.\n // This is safe as long as nothing reads or writes to the storage variable\n // until it is updated by the temp variable.\n uint40 nextQueueIndex = _nextQueueIndex;\n\n BatchContext memory curContext;\n for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n numSequencerTransactions += uint32(curContext.numSequencedTransactions);\n\n // Now process any subsequent queue transactions.\n nextQueueIndex += uint40(curContext.numSubsequentQueueTransactions);\n }\n\n require(\n nextQueueIndex <= queueElements.length,\n \"Attempted to append more elements than are available in the queue.\"\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\n // 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\n // queue element.\n // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at\n // least one queue element. We increment nextQueueIndex after processing each queue\n // element, so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = queueElements[nextQueueIndex - 1];\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // Cache the previous blockhash to ensure all transaction data can be retrieved efficiently.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n _appendBatch(\n blockhash(block.number - 1),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\n blockNumber\n );\n\n // slither-disable-next-line reentrancy-events\n emit SequencerBatchAppended(\n nextQueueIndex - numQueuedTransactions,\n numQueuedTransactions,\n getTotalElements()\n );\n\n // Update the _nextQueueIndex storage variable.\n // slither-disable-next-line reentrancy-no-eth\n _nextQueueIndex = nextQueueIndex;\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(uint256 _index) internal pure returns (BatchContext memory) {\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\n // slither-disable-next-line similar-names\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\n 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\n // solhint-disable max-line-length\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(\n extraData,\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\n )\n nextQueueIndex := shr(\n 40,\n and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000)\n )\n lastTimestamp := shr(\n 80,\n and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000)\n )\n lastBlockNumber := shr(\n 120,\n and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000)\n )\n }\n // solhint-enable max-line-length\n\n return (totalElements, nextQueueIndex, lastTimestamp, lastBlockNumber);\n }\n\n /**\n * Encodes the batch context for the extra data.\n * @param _totalElements Total number of elements submitted.\n * @param _nextQueueIdx 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 _nextQueueIdx,\n uint40 _timestamp,\n uint40 _blockNumber\n ) internal pure returns (bytes27) {\n bytes27 extraData;\n assembly {\n extraData := _totalElements\n extraData := or(extraData, shl(40, _nextQueueIdx))\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 * 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 ) internal {\n IChainStorageContainer 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 // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n batchesRef.push(batchHeaderHash, latestBatchContext);\n }\n}\n" - }, - "contracts/standards/AddressAliasHelper.sol": { - "content": "// SPDX-License-Identifier: Apache-2.0\n\n/*\n * Copyright 2019-2021, Offchain Labs, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npragma solidity ^0.8.7;\n\nlibrary AddressAliasHelper {\n uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);\n\n /// @notice Utility function that converts the address in the L1 that submitted a tx to\n /// the inbox to the msg.sender viewed in the L2\n /// @param l1Address the address in the L1 that triggered the tx to L2\n /// @return l2Address L2 address as viewed in msg.sender\n function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n unchecked {\n l2Address = address(uint160(l1Address) + offset);\n }\n }\n\n /// @notice Utility function that converts the msg.sender viewed in the L2 to the\n /// address in the L1 that submitted a tx to the inbox\n /// @param l2Address L2 address as viewed in msg.sender\n /// @return l1Address the address in the L1 that triggered the tx to L2\n function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\n unchecked {\n l1Address = address(uint160(l2Address) - offset);\n }\n }\n}\n" - }, - "contracts/test-libraries/codec/TestLib_OVMCodec.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title TestLib_OVMCodec\n */\ncontract TestLib_OVMCodec {\n function encodeTransaction(Lib_OVMCodec.Transaction memory _transaction)\n public\n pure\n returns (bytes memory _encoded)\n {\n return Lib_OVMCodec.encodeTransaction(_transaction);\n }\n\n function hashTransaction(Lib_OVMCodec.Transaction memory _transaction)\n public\n pure\n returns (bytes32 _hash)\n {\n return Lib_OVMCodec.hashTransaction(_transaction);\n }\n}\n" - }, - "contracts/L1/messaging/L1CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressManager } from \"../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { IL1CrossDomainMessenger } from \"./IL1CrossDomainMessenger.sol\";\nimport { ICanonicalTransactionChain } from \"../rollup/ICanonicalTransactionChain.sol\";\nimport { IStateCommitmentChain } from \"../rollup/IStateCommitmentChain.sol\";\n\n/* External Imports */\nimport {\n OwnableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {\n PausableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {\n ReentrancyGuardUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title 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 */\ncontract L1CrossDomainMessenger is\n IL1CrossDomainMessenger,\n Lib_AddressResolver,\n OwnableUpgradeable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n /**********\n * Events *\n **********/\n\n event MessageBlocked(bytes32 indexed _xDomainCalldataHash);\n\n event MessageAllowed(bytes32 indexed _xDomainCalldataHash);\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping(bytes32 => bool) public blockedMessages;\n mapping(bytes32 => bool) public relayedMessages;\n mapping(bytes32 => bool) public successfulMessages;\n\n address internal xDomainMsgSender = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * This contract is intended to be behind a delegate proxy.\n * We pass the zero address to the address resolver just to satisfy the constructor.\n * We still need to set this value in initialize().\n */\n constructor() Lib_AddressResolver(address(0)) {}\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n // slither-disable-next-line external-function\n function initialize(address _libAddressManager) public initializer {\n require(\n address(libAddressManager) == address(0),\n \"L1CrossDomainMessenger already intialized.\"\n );\n libAddressManager = Lib_AddressManager(_libAddressManager);\n xDomainMsgSender = Lib_DefaultValues.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() external onlyOwner {\n _pause();\n }\n\n /**\n * Block a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function blockMessage(bytes32 _xDomainCalldataHash) external onlyOwner {\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(bytes32 _xDomainCalldataHash) external onlyOwner {\n blockedMessages[_xDomainCalldataHash] = false;\n emit MessageAllowed(_xDomainCalldataHash);\n }\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n address ovmCanonicalTransactionChain = resolve(\"CanonicalTransactionChain\");\n // Use the CTC queue length as nonce\n uint40 nonce = ICanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n nonce\n );\n\n // slither-disable-next-line reentrancy-events\n _sendXDomainMessage(ovmCanonicalTransactionChain, xDomainCalldata, _gasLimit);\n\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, nonce, _gasLimit);\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL1CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n ) public nonReentrant whenNotPaused {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n require(\n _verifyXDomainMessage(xDomainCalldata, _proof) == 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 require(\n _target != resolve(\"CanonicalTransactionChain\"),\n \"Cannot send L2->L1 messages to L1 system contracts.\"\n );\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n\n /**\n * Replays a cross domain message to the target messenger.\n * @inheritdoc IL1CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _queueIndex,\n uint32 _oldGasLimit,\n uint32 _newGasLimit\n ) public {\n // Verify that the message is in the queue:\n address canonicalTransactionChain = resolve(\"CanonicalTransactionChain\");\n Lib_OVMCodec.QueueElement memory element = ICanonicalTransactionChain(\n canonicalTransactionChain\n ).getQueueElement(_queueIndex);\n\n // Compute the calldata that was originally used to send the message.\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _queueIndex\n );\n\n // Compute the transactionHash\n bytes32 transactionHash = keccak256(\n abi.encode(\n AddressAliasHelper.applyL1ToL2Alias(address(this)),\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,\n _oldGasLimit,\n xDomainCalldata\n )\n );\n\n // Now check that the provided message data matches the one in the queue element.\n require(\n transactionHash == element.transactionHash,\n \"Provided message has not been enqueued.\"\n );\n\n // Send the same message but with the new gas limit.\n _sendXDomainMessage(canonicalTransactionChain, xDomainCalldata, _newGasLimit);\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 ) internal view returns (bool) {\n return (_verifyStateRootProof(_proof) && _verifyStorageProof(_xDomainCalldata, _proof));\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(L2MessageInclusionProof memory _proof)\n internal\n view\n returns (bool)\n {\n IStateCommitmentChain ovmStateCommitmentChain = IStateCommitmentChain(\n resolve(\"StateCommitmentChain\")\n );\n\n return (ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) ==\n false &&\n ovmStateCommitmentChain.verifyStateCommitment(\n _proof.stateRoot,\n _proof.stateRootBatchHeader,\n _proof.stateRootProof\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 ) internal view returns (bool) {\n bytes32 storageKey = keccak256(\n abi.encodePacked(\n keccak256(\n abi.encodePacked(\n _xDomainCalldata,\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER\n )\n ),\n uint256(0)\n )\n );\n\n (bool exists, bytes memory encodedMessagePassingAccount) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing predeploy has not been initialized or invalid proof provided.\"\n );\n\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\n encodedMessagePassingAccount\n );\n\n return\n Lib_SecureMerkleTrie.verifyInclusionProof(\n abi.encodePacked(storageKey),\n abi.encodePacked(uint8(1)),\n _proof.storageTrieWitness,\n account.storageRoot\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _canonicalTransactionChain Address of the CanonicalTransactionChain instance.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n address _canonicalTransactionChain,\n bytes memory _message,\n uint256 _gasLimit\n ) internal {\n // slither-disable-next-line reentrancy-events\n ICanonicalTransactionChain(_canonicalTransactionChain).enqueue(\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,\n _gasLimit,\n _message\n );\n }\n}\n" - }, - "contracts/libraries/trie/Lib_SecureMerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"./Lib_MerkleTrie.sol\";\n\n/**\n * @title Lib_SecureMerkleTrie\n */\nlibrary Lib_SecureMerkleTrie {\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 ) internal pure returns (bool _verified) {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.verifyInclusionProof(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 ) internal pure returns (bool _exists, bytes memory _value) {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.get(key, _proof, _root);\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(bytes memory _key) private pure returns (bytes memory _secureKey) {\n return abi.encodePacked(keccak256(_key));\n }\n}\n" - }, - "contracts/libraries/constants/Lib_DefaultValues.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_DefaultValues\n */\nlibrary Lib_DefaultValues {\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" - }, - "contracts/libraries/constants/Lib_PredeployAddresses.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" - }, - "contracts/libraries/bridge/Lib_CrossDomainUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_CrossDomainUtils\n */\nlibrary Lib_CrossDomainUtils {\n /**\n * Generates the correct cross domain calldata for a message.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @return ABI encoded cross domain calldata.\n */\n function encodeXDomainCalldata(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) internal pure returns (bytes memory) {\n return\n abi.encodeWithSignature(\n \"relayMessage(address,address,bytes,uint256)\",\n _target,\n _sender,\n _message,\n _messageNonce\n );\n }\n}\n" - }, - "contracts/L1/messaging/IL1CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL1CrossDomainMessenger\n */\ninterface IL1CrossDomainMessenger is ICrossDomainMessenger {\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 * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @param _proof Inclusion proof for the given message.\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n ) external;\n\n /**\n * Replays a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _sender Original sender address.\n * @param _message Message to send to the target.\n * @param _queueIndex CTC Queue index for the message to replay.\n * @param _oldGasLimit Original gas limit used to send the message.\n * @param _newGasLimit New gas limit to be used for this message.\n */\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _queueIndex,\n uint32 _oldGasLimit,\n uint32 _newGasLimit\n ) external;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\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 _setOwner(_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 _setOwner(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 _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n uint256[49] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/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/security/ReentrancyGuardUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/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" - }, - "contracts/libraries/trie/Lib_MerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 * 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 * 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\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 ) internal pure returns (bool _verified) {\n (bool exists, bytes memory value) = get(_key, _proof, _root);\n\n return (exists && Lib_BytesUtils.equal(_value, value));\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 ) internal pure returns (bool _exists, bytes memory _value) {\n TrieNode[] memory proof = _parseProof(_proof);\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(\n proof,\n _key,\n _root\n );\n\n bool exists = keyRemainder.length == 0;\n\n require(exists || isFinalNode, \"Provided proof is invalid.\");\n\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes(\"\");\n\n return (exists, value);\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(keccak256(currentNode.encoded) == currentNodeID, \"Invalid root hash\");\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\n // meaning the value should be within this branch node.\n break;\n } else {\n // We're not at the end of the key yet.\n // Figure out what the next node ID should be and continue.\n uint8 branchKey = uint8(key[currentKeyIndex]);\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\n currentNodeID = _getNodeID(nextNode);\n currentKeyIncrement = 1;\n continue;\n }\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\n bytes memory path = _getNodePath(currentNode);\n uint8 prefix = uint8(path[0]);\n uint8 offset = 2 - (prefix % 2);\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\n\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\n if (\n pathRemainder.length == sharedNibbleLength &&\n keyRemainder.length == sharedNibbleLength\n ) {\n // The key within this leaf matches our key exactly.\n // Increment the key index to reflect that we have no remainder.\n currentKeyIndex += sharedNibbleLength;\n }\n\n // We've hit a leaf node, so our next node should be NULL.\n currentNodeID = bytes32(RLP_NULL);\n break;\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\n if (sharedNibbleLength != pathRemainder.length) {\n // Our extension node is not identical to the remainder.\n // We've hit the end of this path\n // 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 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(bytes memory _proof) private pure returns (TrieNode[] memory _parsed) {\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({ encoded: encoded, decoded: Lib_RLPReader.readList(encoded) });\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(Lib_RLPReader.RLPItem memory _node) private pure returns (bytes32 _nodeID) {\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(TrieNode memory _node) private pure returns (bytes memory _path) {\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\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(TrieNode memory _node) private pure returns (bytes memory _value) {\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\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(bytes memory _a, bytes memory _b)\n private\n pure\n returns (uint256 _shared)\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" - }, - "contracts/libraries/bridge/ICrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/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 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) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" - }, - "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\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 {ERC1967Proxy-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 * @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 || !_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" - }, - "contracts/L2/messaging/IL2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" - }, - "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" - }, - "contracts/L2/predeploys/OVM_L2ToL1MessagePasser.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { iOVM_L2ToL1MessagePasser } from \"./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 */\ncontract OVM_L2ToL1MessagePasser is iOVM_L2ToL1MessagePasser {\n /**********************\n * Contract Variables *\n **********************/\n\n mapping(bytes32 => bool) public sentMessages;\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Passes a message to L1.\n * @param _message Message to pass to L1.\n */\n // slither-disable-next-line external-function\n function passMessageToL1(bytes memory _message) public {\n // Note: although this function is public, only messages sent from the\n // L2CrossDomainMessenger will be relayed by the L1CrossDomainMessenger.\n // This is enforced by a check in L1CrossDomainMessenger._verifyStorageProof().\n sentMessages[keccak256(abi.encodePacked(_message, msg.sender))] = true;\n }\n}\n" - }, - "contracts/L2/predeploys/OVM_SequencerFeeVault.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardBridge } from \"../messaging/L2StandardBridge.sol\";\n\n/**\n * @title OVM_SequencerFeeVault\n * @dev Simple holding contract for fees paid to the Sequencer. Likely to be replaced in the future\n * but \"good enough for now\".\n */\ncontract OVM_SequencerFeeVault {\n /*************\n * Constants *\n *************/\n\n // Minimum ETH balance that can be withdrawn in a single withdrawal.\n uint256 public constant MIN_WITHDRAWAL_AMOUNT = 15 ether;\n\n /*************\n * Variables *\n *************/\n\n // Address on L1 that will hold the fees once withdrawn. Dynamically initialized within l2geth.\n address public l1FeeWallet;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn.\n * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during\n * the genesis block. This is ONLY for testing purposes.\n */\n constructor(address _l1FeeWallet) {\n l1FeeWallet = _l1FeeWallet;\n }\n\n /************\n * Fallback *\n ************/\n\n // slither-disable-next-line locked-ether\n receive() external payable {}\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function withdraw() public {\n require(\n address(this).balance >= MIN_WITHDRAWAL_AMOUNT,\n // solhint-disable-next-line max-line-length\n \"OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount\"\n );\n\n L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\n Lib_PredeployAddresses.OVM_ETH,\n l1FeeWallet,\n address(this).balance,\n 0,\n bytes(\"\")\n );\n }\n}\n" - }, - "contracts/L2/messaging/L2StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IL1StandardBridge } from \"../../L1/messaging/IL1StandardBridge.sol\";\nimport { IL1ERC20Bridge } from \"../../L1/messaging/IL1ERC20Bridge.sol\";\nimport { IL2ERC20Bridge } from \"./IL2ERC20Bridge.sol\";\n\n/* Library Imports */\nimport { ERC165Checker } from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport { CrossDomainEnabled } from \"../../libraries/bridge/CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { IL2StandardERC20 } from \"../../standards/IL2StandardERC20.sol\";\n\n/**\n * @title L2StandardBridge\n * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to\n * enable ETH and ERC20 transitions between L1 and L2.\n * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard\n * bridge.\n * This contract also acts as a burner of the tokens intended for withdrawal, informing the L1\n * bridge to release L1 funds.\n */\ncontract L2StandardBridge is IL2ERC20Bridge, CrossDomainEnabled {\n /********************************\n * External Contract References *\n ********************************/\n\n address public l1TokenBridge;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _l1TokenBridge Address of the L1 bridge deployed to the main chain.\n */\n constructor(address _l2CrossDomainMessenger, address _l1TokenBridge)\n CrossDomainEnabled(_l2CrossDomainMessenger)\n {\n l1TokenBridge = _l1TokenBridge;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @inheritdoc IL2ERC20Bridge\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external virtual {\n _initiateWithdrawal(_l2Token, msg.sender, msg.sender, _amount, _l1Gas, _data);\n }\n\n /**\n * @inheritdoc IL2ERC20Bridge\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external virtual {\n _initiateWithdrawal(_l2Token, msg.sender, _to, _amount, _l1Gas, _data);\n }\n\n /**\n * @dev Performs the logic for withdrawals by burning the token and informing\n * the L1 token Gateway of the withdrawal.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _from Account to pull the withdrawal from on L2.\n * @param _to Account to give the withdrawal to on L1.\n * @param _amount Amount of the token to withdraw.\n * @param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateWithdrawal(\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) internal {\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2\n // usage\n // slither-disable-next-line reentrancy-events\n IL2StandardERC20(_l2Token).burn(msg.sender, _amount);\n\n // Construct calldata for l1TokenBridge.finalizeERC20Withdrawal(_to, _amount)\n // slither-disable-next-line reentrancy-events\n address l1Token = IL2StandardERC20(_l2Token).l1Token();\n bytes memory message;\n\n if (_l2Token == Lib_PredeployAddresses.OVM_ETH) {\n message = abi.encodeWithSelector(\n IL1StandardBridge.finalizeETHWithdrawal.selector,\n _from,\n _to,\n _amount,\n _data\n );\n } else {\n message = abi.encodeWithSelector(\n IL1ERC20Bridge.finalizeERC20Withdrawal.selector,\n l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n }\n\n // Send message up to L1 bridge\n // slither-disable-next-line reentrancy-events\n sendCrossDomainMessage(l1TokenBridge, _l1Gas, message);\n\n // slither-disable-next-line reentrancy-events\n emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @inheritdoc IL2ERC20Bridge\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external virtual onlyFromCrossDomainAccount(l1TokenBridge) {\n // Check the target token is compliant and\n // verify the deposited token on L1 matches the L2 deposited token representation here\n if (\n // slither-disable-next-line reentrancy-events\n ERC165Checker.supportsInterface(_l2Token, 0x1d1d8b63) &&\n _l1Token == IL2StandardERC20(_l2Token).l1Token()\n ) {\n // When a deposit is finalized, we credit the account on L2 with the same amount of\n // tokens.\n // slither-disable-next-line reentrancy-events\n IL2StandardERC20(_l2Token).mint(_to, _amount);\n // slither-disable-next-line reentrancy-events\n emit DepositFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n } else {\n // Either the L2 token which is being deposited-into disagrees about the correct address\n // of its L1 token, or does not support the correct interface.\n // This should only happen if there is a malicious L2 token, or if a user somehow\n // specified the wrong L2 token address to deposit into.\n // In either case, we stop the process here and construct a withdrawal\n // message so that users can get their funds out in some cases.\n // There is no way to prevent malicious token contracts altogether, but this does limit\n // user error and mitigate some forms of malicious contract behavior.\n bytes memory message = abi.encodeWithSelector(\n IL1ERC20Bridge.finalizeERC20Withdrawal.selector,\n _l1Token,\n _l2Token,\n _to, // switched the _to and _from here to bounce back the deposit to the sender\n _from,\n _amount,\n _data\n );\n\n // Send message up to L1 bridge\n // slither-disable-next-line reentrancy-events\n sendCrossDomainMessage(l1TokenBridge, 0, message);\n // slither-disable-next-line reentrancy-events\n emit DepositFailed(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n }\n}\n" - }, - "contracts/L1/messaging/IL1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "contracts/L1/messaging/IL1ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "contracts/L2/messaging/IL2ERC20Bridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" - }, - "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface,\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n _supportsERC165Interface(account, type(IERC165).interfaceId) &&\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)\n internal\n view\n returns (bool[] memory)\n {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in _interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n * Interface identification is specified in ERC-165.\n */\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);\n if (result.length < 32) return false;\n return success && abi.decode(result, (bool));\n }\n}\n" - }, - "contracts/libraries/bridge/CrossDomainEnabled.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\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 * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\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(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * 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() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" - }, - "contracts/standards/IL2StandardERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface IL2StandardERC20 is IERC20, IERC165 {\n function l1Token() external returns (address);\n\n function mint(address _to, uint256 _amount) external;\n\n function burn(address _from, uint256 _amount) external;\n\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" - }, - "@openzeppelin/contracts/utils/introspection/IERC165.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" - }, - "contracts/standards/L2StandardERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./IL2StandardERC20.sol\";\n\ncontract L2StandardERC20 is IL2StandardERC20, ERC20 {\n address public l1Token;\n address public l2Bridge;\n\n /**\n * @param _l2Bridge Address of the L2 standard bridge.\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n constructor(\n address _l2Bridge,\n address _l1Token,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol) {\n l1Token = _l1Token;\n l2Bridge = _l2Bridge;\n }\n\n modifier onlyL2Bridge() {\n require(msg.sender == l2Bridge, \"Only L2 Bridge can mint and burn\");\n _;\n }\n\n // slither-disable-next-line external-function\n function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {\n bytes4 firstSupportedInterface = bytes4(keccak256(\"supportsInterface(bytes4)\")); // ERC165\n bytes4 secondSupportedInterface = IL2StandardERC20.l1Token.selector ^\n IL2StandardERC20.mint.selector ^\n IL2StandardERC20.burn.selector;\n return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;\n }\n\n // slither-disable-next-line external-function\n function mint(address _to, uint256 _amount) public virtual onlyL2Bridge {\n _mint(_to, _amount);\n\n emit Mint(_to, _amount);\n }\n\n // slither-disable-next-line external-function\n function burn(address _from, uint256 _amount) public virtual onlyL2Bridge {\n _burn(_from, _amount);\n\n emit Burn(_from, _amount);\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" - }, - "contracts/L2/predeploys/OVM_ETH.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../standards/L2StandardERC20.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 */\ncontract OVM_ETH is L2StandardERC20 {\n /***************\n * Constructor *\n ***************/\n\n constructor()\n L2StandardERC20(Lib_PredeployAddresses.L2_STANDARD_BRIDGE, address(0), \"Ether\", \"ETH\")\n {}\n\n // ETH ERC20 features are disabled until further notice.\n // Discussion here: https://github.com/ethereum-optimism/optimism/discussions/1444\n\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n revert(\"OVM_ETH: transfer is disabled pending further community discussion.\");\n }\n\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n revert(\"OVM_ETH: approve is disabled pending further community discussion.\");\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n revert(\"OVM_ETH: transferFrom is disabled pending further community discussion.\");\n }\n\n function increaseAllowance(address spender, uint256 addedValue)\n public\n virtual\n override\n returns (bool)\n {\n revert(\"OVM_ETH: increaseAllowance is disabled pending further community discussion.\");\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n virtual\n override\n returns (bool)\n {\n revert(\"OVM_ETH: decreaseAllowance is disabled pending further community discussion.\");\n }\n}\n" - }, - "contracts/L2/teleportr/TeleportrDisburser.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.9;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title TeleportrDisburser\n */\ncontract TeleportrDisburser is Ownable {\n /**\n * @notice A struct holding the address and amount to disbursement.\n */\n struct Disbursement {\n uint256 amount;\n address addr;\n }\n\n /// The total number of disbursements processed.\n uint256 public totalDisbursements;\n\n /**\n * @notice Emitted any time the balance is withdrawn by the owner.\n * @param owner The current owner and recipient of the funds.\n * @param balance The current contract balance paid to the owner.\n */\n event BalanceWithdrawn(address indexed owner, uint256 balance);\n\n /**\n * @notice Emitted any time a disbursement is successfuly sent.\n * @param depositId The unique sequence number identifying the deposit.\n * @param to The recipient of the disbursement.\n * @param amount The amount sent to the recipient.\n */\n event DisbursementSuccess(uint256 indexed depositId, address indexed to, uint256 amount);\n\n /**\n * @notice Emitted any time a disbursement fails to send.\n * @param depositId The unique sequence number identifying the deposit.\n * @param to The intended recipient of the disbursement.\n * @param amount The amount intended to be sent to the recipient.\n */\n event DisbursementFailed(uint256 indexed depositId, address indexed to, uint256 amount);\n\n /**\n * @notice Initializes a new TeleportrDisburser contract.\n */\n constructor() {\n totalDisbursements = 0;\n }\n\n /**\n * @notice Accepts a list of Disbursements and forwards the amount paid to\n * the contract to each recipient. The method reverts if there are zero\n * disbursements, the total amount to forward differs from the amount sent\n * in the transaction, or the _nextDepositId is unexpected. Failed\n * disbursements will not cause the method to revert, but will instead be\n * held by the contract and availabe for the owner to withdraw.\n * @param _nextDepositId The depositId of the first Dispursement.\n * @param _disbursements A list of Disbursements to process.\n */\n function disburse(uint256 _nextDepositId, Disbursement[] calldata _disbursements)\n external\n payable\n onlyOwner\n {\n // Ensure there are disbursements to process.\n uint256 _numDisbursements = _disbursements.length;\n require(_numDisbursements > 0, \"No disbursements\");\n\n // Ensure the _nextDepositId matches our expected value.\n uint256 _depositId = totalDisbursements;\n require(_depositId == _nextDepositId, \"Unexpected next deposit id\");\n unchecked {\n totalDisbursements += _numDisbursements;\n }\n\n // Ensure the amount sent in the transaction is equal to the sum of the\n // disbursements.\n uint256 _totalDisbursed = 0;\n for (uint256 i = 0; i < _numDisbursements; i++) {\n _totalDisbursed += _disbursements[i].amount;\n }\n require(_totalDisbursed == msg.value, \"Disbursement total != amount sent\");\n\n // Process disbursements.\n for (uint256 i = 0; i < _numDisbursements; i++) {\n uint256 _amount = _disbursements[i].amount;\n address _addr = _disbursements[i].addr;\n\n // Deliver the dispursement amount to the receiver. If the\n // disbursement fails, the amount will be kept by the contract\n // rather than reverting to prevent blocking progress on other\n // disbursements.\n\n // slither-disable-next-line calls-loop,reentrancy-events\n (bool success, ) = _addr.call{ value: _amount, gas: 2300 }(\"\");\n if (success) emit DisbursementSuccess(_depositId, _addr, _amount);\n else emit DisbursementFailed(_depositId, _addr, _amount);\n\n unchecked {\n _depositId += 1;\n }\n }\n }\n\n /**\n * @notice Sends the contract's current balance to the owner.\n */\n function withdrawBalance() external onlyOwner {\n address _owner = owner();\n uint256 balance = address(this).balance;\n emit BalanceWithdrawn(_owner, balance);\n payable(_owner).transfer(balance);\n }\n}\n" - }, - "contracts/L2/predeploys/OVM_GasPriceOracle.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title OVM_GasPriceOracle\n * @dev This contract exposes the current l2 gas price, a measure of how congested the network\n * currently is. This measure is used by the Sequencer to determine what fee to charge for\n * transactions. When the system is more congested, the l2 gas price will increase and fees\n * will also increase as a result.\n *\n * All public variables are set while generating the initial L2 state. The\n * constructor doesn't run in practice as the L2 state generation script uses\n * the deployed bytecode instead of running the initcode.\n */\ncontract OVM_GasPriceOracle is Ownable {\n /*************\n * Variables *\n *************/\n\n // Current L2 gas price\n uint256 public gasPrice;\n // Current L1 base fee\n uint256 public l1BaseFee;\n // Amortized cost of batch submission per transaction\n uint256 public overhead;\n // Value to scale the fee up by\n uint256 public scalar;\n // Number of decimals of the scalar\n uint256 public decimals;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address that will initially own this contract.\n */\n constructor(address _owner) Ownable() {\n transferOwnership(_owner);\n }\n\n /**********\n * Events *\n **********/\n\n event GasPriceUpdated(uint256);\n event L1BaseFeeUpdated(uint256);\n event OverheadUpdated(uint256);\n event ScalarUpdated(uint256);\n event DecimalsUpdated(uint256);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Allows the owner to modify the l2 gas price.\n * @param _gasPrice New l2 gas price.\n */\n // slither-disable-next-line external-function\n function setGasPrice(uint256 _gasPrice) public onlyOwner {\n gasPrice = _gasPrice;\n emit GasPriceUpdated(_gasPrice);\n }\n\n /**\n * Allows the owner to modify the l1 base fee.\n * @param _baseFee New l1 base fee\n */\n // slither-disable-next-line external-function\n function setL1BaseFee(uint256 _baseFee) public onlyOwner {\n l1BaseFee = _baseFee;\n emit L1BaseFeeUpdated(_baseFee);\n }\n\n /**\n * Allows the owner to modify the overhead.\n * @param _overhead New overhead\n */\n // slither-disable-next-line external-function\n function setOverhead(uint256 _overhead) public onlyOwner {\n overhead = _overhead;\n emit OverheadUpdated(_overhead);\n }\n\n /**\n * Allows the owner to modify the scalar.\n * @param _scalar New scalar\n */\n // slither-disable-next-line external-function\n function setScalar(uint256 _scalar) public onlyOwner {\n scalar = _scalar;\n emit ScalarUpdated(_scalar);\n }\n\n /**\n * Allows the owner to modify the decimals.\n * @param _decimals New decimals\n */\n // slither-disable-next-line external-function\n function setDecimals(uint256 _decimals) public onlyOwner {\n decimals = _decimals;\n emit DecimalsUpdated(_decimals);\n }\n\n /**\n * Computes the L1 portion of the fee\n * based on the size of the RLP encoded tx\n * and the current l1BaseFee\n * @param _data Unsigned RLP encoded tx, 6 elements\n * @return L1 fee that should be paid for the tx\n */\n // slither-disable-next-line external-function\n function getL1Fee(bytes memory _data) public view returns (uint256) {\n uint256 l1GasUsed = getL1GasUsed(_data);\n uint256 l1Fee = l1GasUsed * l1BaseFee;\n uint256 divisor = 10**decimals;\n uint256 unscaled = l1Fee * scalar;\n uint256 scaled = unscaled / divisor;\n return scaled;\n }\n\n // solhint-disable max-line-length\n /**\n * Computes the amount of L1 gas used for a transaction\n * The overhead represents the per batch gas overhead of\n * posting both transaction and state roots to L1 given larger\n * batch sizes.\n * 4 gas for 0 byte\n * https://github.com/ethereum/go-ethereum/blob/9ada4a2e2c415e6b0b51c50e901336872e028872/params/protocol_params.go#L33\n * 16 gas for non zero byte\n * https://github.com/ethereum/go-ethereum/blob/9ada4a2e2c415e6b0b51c50e901336872e028872/params/protocol_params.go#L87\n * This will need to be updated if calldata gas prices change\n * Account for the transaction being unsigned\n * Padding is added to account for lack of signature on transaction\n * 1 byte for RLP V prefix\n * 1 byte for V\n * 1 byte for RLP R prefix\n * 32 bytes for R\n * 1 byte for RLP S prefix\n * 32 bytes for S\n * Total: 68 bytes of padding\n * @param _data Unsigned RLP encoded tx, 6 elements\n * @return Amount of L1 gas used for a transaction\n */\n // solhint-enable max-line-length\n function getL1GasUsed(bytes memory _data) public view returns (uint256) {\n uint256 total = 0;\n for (uint256 i = 0; i < _data.length; i++) {\n if (_data[i] == 0) {\n total += 4;\n } else {\n total += 16;\n }\n }\n uint256 unsigned = total + overhead;\n return unsigned + (68 * 16);\n }\n}\n" - }, - "contracts/L1/teleportr/TeleportrDeposit.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.9;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title TeleportrDeposit\n *\n * Shout out to 0xclem for providing the inspiration for this contract:\n * https://github.com/0xclem/teleportr/blob/main/contracts/BridgeDeposit.sol\n */\ncontract TeleportrDeposit is Ownable {\n /// The minimum amount that be deposited in a receive.\n uint256 public minDepositAmount;\n /// The maximum amount that be deposited in a receive.\n uint256 public maxDepositAmount;\n /// The maximum balance the contract can hold after a receive.\n uint256 public maxBalance;\n /// The total number of successful deposits received.\n uint256 public totalDeposits;\n\n /**\n * @notice Emitted any time the minimum deposit amount is set.\n * @param previousAmount The previous minimum deposit amount.\n * @param newAmount The new minimum deposit amount.\n */\n event MinDepositAmountSet(uint256 previousAmount, uint256 newAmount);\n\n /**\n * @notice Emitted any time the maximum deposit amount is set.\n * @param previousAmount The previous maximum deposit amount.\n * @param newAmount The new maximum deposit amount.\n */\n event MaxDepositAmountSet(uint256 previousAmount, uint256 newAmount);\n\n /**\n * @notice Emitted any time the contract maximum balance is set.\n * @param previousBalance The previous maximum contract balance.\n * @param newBalance The new maximum contract balance.\n */\n event MaxBalanceSet(uint256 previousBalance, uint256 newBalance);\n\n /**\n * @notice Emitted any time the balance is withdrawn by the owner.\n * @param owner The current owner and recipient of the funds.\n * @param balance The current contract balance paid to the owner.\n */\n event BalanceWithdrawn(address indexed owner, uint256 balance);\n\n /**\n * @notice Emitted any time a successful deposit is received.\n * @param depositId A unique sequencer number identifying the deposit.\n * @param emitter The sending address of the payer.\n * @param amount The amount deposited by the payer.\n */\n event EtherReceived(uint256 indexed depositId, address indexed emitter, uint256 indexed amount);\n\n /**\n * @notice Initializes a new TeleportrDeposit contract.\n * @param _minDepositAmount The initial minimum deposit amount.\n * @param _maxDepositAmount The initial maximum deposit amount.\n * @param _maxBalance The initial maximum contract balance.\n */\n constructor(\n uint256 _minDepositAmount,\n uint256 _maxDepositAmount,\n uint256 _maxBalance\n ) {\n minDepositAmount = _minDepositAmount;\n maxDepositAmount = _maxDepositAmount;\n maxBalance = _maxBalance;\n totalDeposits = 0;\n emit MinDepositAmountSet(0, _minDepositAmount);\n emit MaxDepositAmountSet(0, _maxDepositAmount);\n emit MaxBalanceSet(0, _maxBalance);\n }\n\n /**\n * @notice Accepts deposits that will be disbursed to the sender's address on L2.\n * The method reverts if the amount is less than the current\n * minDepositAmount, the amount is greater than the current\n * maxDepositAmount, or the amount causes the contract to exceed its maximum\n * allowed balance.\n */\n receive() external payable {\n require(msg.value >= minDepositAmount, \"Deposit amount is too small\");\n require(msg.value <= maxDepositAmount, \"Deposit amount is too big\");\n require(address(this).balance <= maxBalance, \"Contract max balance exceeded\");\n\n emit EtherReceived(totalDeposits, msg.sender, msg.value);\n unchecked {\n totalDeposits += 1;\n }\n }\n\n /**\n * @notice Sends the contract's current balance to the owner.\n */\n function withdrawBalance() external onlyOwner {\n address _owner = owner();\n uint256 _balance = address(this).balance;\n emit BalanceWithdrawn(_owner, _balance);\n payable(_owner).transfer(_balance);\n }\n\n /**\n * @notice Sets the minimum amount that can be deposited in a receive.\n * @param _minDepositAmount The new minimum deposit amount.\n */\n function setMinAmount(uint256 _minDepositAmount) external onlyOwner {\n emit MinDepositAmountSet(minDepositAmount, _minDepositAmount);\n minDepositAmount = _minDepositAmount;\n }\n\n /**\n * @notice Sets the maximum amount that can be deposited in a receive.\n * @param _maxDepositAmount The new maximum deposit amount.\n */\n function setMaxAmount(uint256 _maxDepositAmount) external onlyOwner {\n emit MaxDepositAmountSet(maxDepositAmount, _maxDepositAmount);\n maxDepositAmount = _maxDepositAmount;\n }\n\n /**\n * @notice Sets the maximum balance the contract can hold after a receive.\n * @param _maxBalance The new maximum contract balance.\n */\n function setMaxBalance(uint256 _maxBalance) external onlyOwner {\n emit MaxBalanceSet(maxBalance, _maxBalance);\n maxBalance = _maxBalance;\n }\n}\n" - }, - "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" - }, - "@openzeppelin/contracts/utils/Address.sol": { - "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\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 (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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) 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(\n address target,\n bytes memory data,\n uint256 value\n ) 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(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) 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 (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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal 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 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/L1/messaging/L1StandardBridge.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IL1StandardBridge } from \"./IL1StandardBridge.sol\";\nimport { IL1ERC20Bridge } from \"./IL1ERC20Bridge.sol\";\nimport { IL2ERC20Bridge } from \"../../L2/messaging/IL2ERC20Bridge.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/* Library Imports */\nimport { CrossDomainEnabled } from \"../../libraries/bridge/CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @title L1StandardBridge\n * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard\n * tokens that are in use on L2. It synchronizes a corresponding L2 Bridge, informing it of deposits\n * and listening to it for newly finalized withdrawals.\n *\n */\ncontract L1StandardBridge is IL1StandardBridge, CrossDomainEnabled {\n using SafeERC20 for IERC20;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2TokenBridge;\n\n // Maps L1 token to L2 token to balance of the L1 token deposited\n mapping(address => mapping(address => uint256)) public deposits;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor() CrossDomainEnabled(address(0)) {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n * @param _l2TokenBridge L2 standard bridge address.\n */\n // slither-disable-next-line external-function\n function initialize(address _l1messenger, address _l2TokenBridge) public {\n require(messenger == address(0), \"Contract has already been initialized.\");\n messenger = _l1messenger;\n l2TokenBridge = _l2TokenBridge;\n }\n\n /**************\n * Depositing *\n **************/\n\n /** @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious\n * contract via initcode, but it takes care of the user error we want to avoid.\n */\n modifier onlyEOA() {\n // Used to stop deposits from contracts (avoid accidentally lost tokens)\n require(!Address.isContract(msg.sender), \"Account not EOA\");\n _;\n }\n\n /**\n * @dev This function can be called with no data\n * to deposit an amount of ETH to the caller's balance on L2.\n * Since the receive function doesn't take data, a conservative\n * default amount is forwarded to L2.\n */\n receive() external payable onlyEOA {\n _initiateETHDeposit(msg.sender, msg.sender, 200_000, bytes(\"\"));\n }\n\n /**\n * @inheritdoc IL1StandardBridge\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable onlyEOA {\n _initiateETHDeposit(msg.sender, msg.sender, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc IL1StandardBridge\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable {\n _initiateETHDeposit(msg.sender, _to, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of\n * the deposit.\n * @param _from Account to pull the deposit from on L1.\n * @param _to Account to give the deposit to on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateETHDeposit(\n address _from,\n address _to,\n uint32 _l2Gas,\n bytes memory _data\n ) internal {\n // Construct calldata for finalizeDeposit call\n bytes memory message = abi.encodeWithSelector(\n IL2ERC20Bridge.finalizeDeposit.selector,\n address(0),\n Lib_PredeployAddresses.OVM_ETH,\n _from,\n _to,\n msg.value,\n _data\n );\n\n // Send calldata into L2\n // slither-disable-next-line reentrancy-events\n sendCrossDomainMessage(l2TokenBridge, _l2Gas, message);\n\n // slither-disable-next-line reentrancy-events\n emit ETHDepositInitiated(_from, _to, msg.value, _data);\n }\n\n /**\n * @inheritdoc IL1ERC20Bridge\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external virtual onlyEOA {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc IL1ERC20Bridge\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external virtual {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\n *\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _from Account to pull the deposit from on L1\n * @param _to Account to give the deposit to on L2\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateERC20Deposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) internal {\n // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future\n // withdrawals. safeTransferFrom also checks if the contract has code, so this will fail if\n // _from is an EOA or address(0).\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);\n\n // Construct calldata for _l2Token.finalizeDeposit(_to, _amount)\n bytes memory message = abi.encodeWithSelector(\n IL2ERC20Bridge.finalizeDeposit.selector,\n _l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n\n // Send calldata into L2\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n sendCrossDomainMessage(l2TokenBridge, _l2Gas, message);\n\n // slither-disable-next-line reentrancy-benign\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token] + _amount;\n\n // slither-disable-next-line reentrancy-events\n emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @inheritdoc IL1StandardBridge\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external onlyFromCrossDomainAccount(l2TokenBridge) {\n // slither-disable-next-line reentrancy-events\n (bool success, ) = _to.call{ value: _amount }(new bytes(0));\n require(success, \"TransferHelper::safeTransferETH: ETH transfer failed\");\n\n // slither-disable-next-line reentrancy-events\n emit ETHWithdrawalFinalized(_from, _to, _amount, _data);\n }\n\n /**\n * @inheritdoc IL1ERC20Bridge\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external onlyFromCrossDomainAccount(l2TokenBridge) {\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token] - _amount;\n\n // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer\n // slither-disable-next-line reentrancy-events\n IERC20(_l1Token).safeTransfer(_to, _amount);\n\n // slither-disable-next-line reentrancy-events\n emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*****************************\n * Temporary - Migrating ETH *\n *****************************/\n\n /**\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\n * to be migrated from an old gateway to a new gateway.\n * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the\n * old contract\n */\n function donateETH() external payable {}\n}\n" - }, - "contracts/L2/messaging/L2StandardTokenFactory.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../standards/L2StandardERC20.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/**\n * @title L2StandardTokenFactory\n * @dev Factory contract for creating standard L2 token representations of L1 ERC20s\n * compatible with and working on the standard bridge.\n */\ncontract L2StandardTokenFactory {\n event StandardL2TokenCreated(address indexed _l1Token, address indexed _l2Token);\n\n /**\n * @dev Creates an instance of the standard ERC20 token on L2.\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n function createStandardL2Token(\n address _l1Token,\n string memory _name,\n string memory _symbol\n ) external {\n require(_l1Token != address(0), \"Must provide L1 token address\");\n\n L2StandardERC20 l2Token = new L2StandardERC20(\n Lib_PredeployAddresses.L2_STANDARD_BRIDGE,\n _l1Token,\n _name,\n _symbol\n );\n\n emit StandardL2TokenCreated(_l1Token, address(l2Token));\n }\n}\n" - }, - "contracts/test-libraries/bridge/TestLib_CrossDomainUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/**\n * @title TestLib_CrossDomainUtils\n */\nlibrary TestLib_CrossDomainUtils {\n function encodeXDomainCalldata(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public pure returns (bytes memory) {\n return\n Lib_CrossDomainUtils.encodeXDomainCalldata(_target, _sender, _message, _messageNonce);\n }\n}\n" - }, - "contracts/test-libraries/standards/TestLib_AddressAliasHelper.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\n\n/**\n * @title TestLib_AddressAliasHelper\n */\ncontract TestLib_AddressAliasHelper {\n function applyL1ToL2Alias(address _address) public pure returns (address) {\n return AddressAliasHelper.applyL1ToL2Alias(_address);\n }\n\n function undoL1ToL2Alias(address _address) public pure returns (address) {\n return AddressAliasHelper.undoL1ToL2Alias(_address);\n }\n}\n" - }, - "contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_SecureMerkleTrie } from \"../../libraries/trie/Lib_SecureMerkleTrie.sol\";\n\n/**\n * @title TestLib_SecureMerkleTrie\n */\ncontract TestLib_SecureMerkleTrie {\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool) {\n return Lib_SecureMerkleTrie.verifyInclusionProof(_key, _value, _proof, _root);\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool, bytes memory) {\n return Lib_SecureMerkleTrie.get(_key, _proof, _root);\n }\n}\n" - }, - "contracts/test-libraries/trie/TestLib_MerkleTrie.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"../../libraries/trie/Lib_MerkleTrie.sol\";\n\n/**\n * @title TestLib_MerkleTrie\n */\ncontract TestLib_MerkleTrie {\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool) {\n return Lib_MerkleTrie.verifyInclusionProof(_key, _value, _proof, _root);\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool, bytes memory) {\n return Lib_MerkleTrie.get(_key, _proof, _root);\n }\n}\n" - }, - "contracts/test-libraries/rlp/TestLib_RLPWriter.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_RLPWriter } from \"../../libraries/rlp/Lib_RLPWriter.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_RLPWriter\n */\ncontract TestLib_RLPWriter {\n function writeBytes(bytes memory _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeBytes(_in);\n }\n\n function writeList(bytes[] memory _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeList(_in);\n }\n\n function writeString(string memory _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeString(_in);\n }\n\n function writeAddress(address _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeAddress(_in);\n }\n\n function writeUint(uint256 _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeUint(_in);\n }\n\n function writeBool(bool _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeBool(_in);\n }\n\n function writeAddressWithTaintedMemory(address _in) public returns (bytes memory _out) {\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.8.9;\n\n// a test ERC20 token with an open mint function\ncontract TestERC20 {\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 => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) 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 + value;\n balanceOf[to] = balanceOf[to] + value;\n emit Transfer(address(0), to, value);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value\n ) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 value\n ) private {\n balanceOf[from] = balanceOf[from] - value;\n balanceOf[to] = balanceOf[to] + 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(\n address from,\n address to,\n uint256 value\n ) external returns (bool) {\n if (allowance[from][msg.sender] != type(uint256).max) {\n allowance[from][msg.sender] = allowance[from][msg.sender] - value;\n }\n _transfer(from, to, value);\n return true;\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_BytesUtils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_BytesUtils\n */\ncontract TestLib_BytesUtils {\n function concat(bytes memory _preBytes, bytes memory _postBytes)\n public\n pure\n returns (bytes memory)\n {\n return abi.encodePacked(_preBytes, _postBytes);\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) public pure returns (bytes memory) {\n return Lib_BytesUtils.slice(_bytes, _start, _length);\n }\n\n function toBytes32(bytes memory _bytes) public pure returns (bytes32) {\n return Lib_BytesUtils.toBytes32(_bytes);\n }\n\n function toUint256(bytes memory _bytes) public pure returns (uint256) {\n return Lib_BytesUtils.toUint256(_bytes);\n }\n\n function toNibbles(bytes memory _bytes) public pure returns (bytes memory) {\n return Lib_BytesUtils.toNibbles(_bytes);\n }\n\n function fromNibbles(bytes memory _bytes) public pure returns (bytes memory) {\n return Lib_BytesUtils.fromNibbles(_bytes);\n }\n\n function equal(bytes memory _bytes, bytes memory _other) public pure returns (bool) {\n return Lib_BytesUtils.equal(_bytes, _other);\n }\n\n function sliceWithTaintedMemory(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) public returns (bytes memory) {\n new TestERC20();\n return Lib_BytesUtils.slice(_bytes, _start, _length);\n }\n}\n" - }, - "contracts/test-libraries/rlp/TestLib_RLPReader.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_RLPReader } from \"../../libraries/rlp/Lib_RLPReader.sol\";\n\n/**\n * @title TestLib_RLPReader\n */\ncontract TestLib_RLPReader {\n function readList(bytes memory _in) public pure returns (bytes[] memory) {\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(bytes memory _in) public pure returns (string memory) {\n return Lib_RLPReader.readString(_in);\n }\n\n function readBytes(bytes memory _in) public pure returns (bytes memory) {\n return Lib_RLPReader.readBytes(_in);\n }\n\n function readBytes32(bytes memory _in) public pure returns (bytes32) {\n return Lib_RLPReader.readBytes32(_in);\n }\n\n function readUint256(bytes memory _in) public pure returns (uint256) {\n return Lib_RLPReader.readUint256(_in);\n }\n\n function readBool(bytes memory _in) public pure returns (bool) {\n return Lib_RLPReader.readBool(_in);\n }\n\n function readAddress(bytes memory _in) public pure returns (address) {\n return Lib_RLPReader.readAddress(_in);\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_Bytes32Utils.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\n\n/**\n * @title TestLib_Byte32Utils\n */\ncontract TestLib_Bytes32Utils {\n function toBool(bytes32 _in) public pure returns (bool _out) {\n return Lib_Bytes32Utils.toBool(_in);\n }\n\n function fromBool(bool _in) public pure returns (bytes32 _out) {\n return Lib_Bytes32Utils.fromBool(_in);\n }\n\n function toAddress(bytes32 _in) public pure returns (address _out) {\n return Lib_Bytes32Utils.toAddress(_in);\n }\n\n function fromAddress(address _in) public pure returns (bytes32 _out) {\n return Lib_Bytes32Utils.fromAddress(_in);\n }\n}\n" - }, - "contracts/test-libraries/utils/TestLib_MerkleTree.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_MerkleTree } from \"../../libraries/utils/Lib_MerkleTree.sol\";\n\n/**\n * @title TestLib_MerkleTree\n */\ncontract TestLib_MerkleTree {\n function getMerkleRoot(bytes32[] memory _elements) public pure returns (bytes32) {\n return Lib_MerkleTree.getMerkleRoot(_elements);\n }\n\n function verify(\n bytes32 _root,\n bytes32 _leaf,\n uint256 _index,\n bytes32[] memory _siblings,\n uint256 _totalLeaves\n ) public pure returns (bool) {\n return Lib_MerkleTree.verify(_root, _leaf, _index, _siblings, _totalLeaves);\n }\n}\n" - } - }, - "settings": { - "optimizer": { - "enabled": true, - "runs": 10000 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers", - "metadata", - "devdoc", - "userdoc", - "storageLayout", - "evm.gasEstimates", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc" - ], - "": [ - "ast" - ] - } - }, - "metadata": { - "useLiteralContent": true - }, - "libraries": {} - } -} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/1bd14ab7f178fa738825499e24d5538d.json b/packages/contracts/deployments/goerli-nightly/solcInputs/71eef09945fcfbedc76225dfa2da1007.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/1bd14ab7f178fa738825499e24d5538d.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/71eef09945fcfbedc76225dfa2da1007.json index 5282401bbaa2..e9d3c2f9b7ee 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/1bd14ab7f178fa738825499e24d5538d.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/71eef09945fcfbedc76225dfa2da1007.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/85ebee1fe613cdbb58dec7dd9504e627.json b/packages/contracts/deployments/goerli-nightly/solcInputs/85ebee1fe613cdbb58dec7dd9504e627.json new file mode 100644 index 000000000000..1d8a872676a6 --- /dev/null +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/85ebee1fe613cdbb58dec7dd9504e627.json @@ -0,0 +1,285 @@ +{ + "language": "Solidity", + "sources": { + "contracts/L1/deployment/AddressDictator.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { Lib_AddressManager } from \"../../libraries/resolver/Lib_AddressManager.sol\";\n\n/**\n * @title AddressDictator\n * @dev The AddressDictator (glory to Arstotzka) is a contract that allows us to safely manipulate\n * many different addresses in the AddressManager without transferring ownership of the\n * AddressManager to a hot wallet or hardware wallet.\n */\ncontract AddressDictator {\n /*********\n * Types *\n *********/\n\n struct NamedAddress {\n string name;\n address addr;\n }\n\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public manager;\n address public finalOwner;\n NamedAddress[] namedAddresses;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _manager Address of the AddressManager contract.\n * @param _finalOwner Address to transfer AddressManager ownership to afterwards.\n * @param _names Array of names to associate an address with.\n * @param _addresses Array of addresses to associate with the name.\n */\n constructor(\n Lib_AddressManager _manager,\n address _finalOwner,\n string[] memory _names,\n address[] memory _addresses\n ) {\n manager = _manager;\n finalOwner = _finalOwner;\n require(\n _names.length == _addresses.length,\n \"AddressDictator: Must provide an equal number of names and addresses.\"\n );\n for (uint256 i = 0; i < _names.length; i++) {\n namedAddresses.push(NamedAddress({ name: _names[i], addr: _addresses[i] }));\n }\n }\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Called to finalize the transfer, this function is callable by anyone, but will only result in\n * an upgrade if this contract is the owner Address Manager.\n */\n // slither-disable-next-line calls-loop\n function setAddresses() external {\n for (uint256 i = 0; i < namedAddresses.length; i++) {\n manager.setAddress(namedAddresses[i].name, namedAddresses[i].addr);\n }\n // note that this will revert if _finalOwner == currentOwner\n manager.transferOwnership(finalOwner);\n }\n\n /**\n * Transfers ownership of this contract to the finalOwner.\n * Only callable by the Final Owner, which is intended to be our multisig.\n * This function shouldn't be necessary, but it gives a sense of reassurance that we can recover\n * if something really surprising goes wrong.\n */\n function returnOwnership() external {\n require(msg.sender == finalOwner, \"AddressDictator: only callable by finalOwner\");\n manager.transferOwnership(finalOwner);\n }\n\n /******************\n * View Functions *\n ******************/\n\n /**\n * Returns the full namedAddresses array.\n */\n function getNamedAddresses() external view returns (NamedAddress[] memory) {\n return namedAddresses;\n }\n}\n" + }, + "contracts/libraries/resolver/Lib_AddressManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 * Events *\n **********/\n\n event AddressSet(string indexed _name, address _newAddress, address _oldAddress);\n\n /*************\n * Variables *\n *************/\n\n mapping(bytes32 => address) private addresses;\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(string memory _name, address _address) external onlyOwner {\n bytes32 nameHash = _getNameHash(_name);\n address oldAddress = addresses[nameHash];\n addresses[nameHash] = _address;\n\n emit AddressSet(_name, _address, oldAddress);\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(string memory _name) external view returns (address) {\n return addresses[_getNameHash(_name)];\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(string memory _name) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(_name));\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\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() {\n _setOwner(_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 _setOwner(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 _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^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 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) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "contracts/libraries/resolver/Lib_ResolvedDelegateProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_ResolvedDelegateProxy\n */\ncontract Lib_ResolvedDelegateProxy {\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 * 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(address _libAddressManager, string memory _implementationName) {\n addressManager[address(this)] = Lib_AddressManager(_libAddressManager);\n implementationName[address(this)] = _implementationName;\n }\n\n /*********************\n * Fallback Function *\n *********************/\n\n fallback() external payable {\n address target = addressManager[address(this)].getAddress(\n (implementationName[address(this)])\n );\n\n require(target != address(0), \"Target address must be initialized.\");\n\n // slither-disable-next-line controlled-delegatecall\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/libraries/resolver/Lib_AddressResolver.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_AddressManager } from \"./Lib_AddressManager.sol\";\n\n/**\n * @title Lib_AddressResolver\n */\nabstract contract Lib_AddressResolver {\n /*************\n * Variables *\n *************/\n\n Lib_AddressManager public libAddressManager;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _libAddressManager Address of the Lib_AddressManager.\n */\n constructor(address _libAddressManager) {\n libAddressManager = Lib_AddressManager(_libAddressManager);\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(string memory _name) public view returns (address) {\n return libAddressManager.getAddress(_name);\n }\n}\n" + }, + "contracts/L1/verification/BondManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IBondManager } from \"./IBondManager.sol\";\n\n/* Contract Imports */\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/**\n * @title BondManager\n * @dev This contract is, for now, a stub of the \"real\" BondManager that does nothing but\n * allow the \"OVM_Proposer\" to submit state root batches.\n *\n */\ncontract BondManager is IBondManager, Lib_AddressResolver {\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n constructor(address _libAddressManager) Lib_AddressResolver(_libAddressManager) {}\n\n /**\n * Checks whether a given address is properly collateralized and can perform actions within\n * the system.\n * @param _who Address to check.\n * @return true if the address is properly collateralized, false otherwise.\n */\n // slither-disable-next-line external-function\n function isCollateralized(address _who) public view returns (bool) {\n // Only authenticate sequencer to submit state root batches.\n return _who == resolve(\"OVM_Proposer\");\n }\n}\n" + }, + "contracts/L1/verification/IBondManager.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IBondManager\n */\ninterface IBondManager {\n /********************\n * Public Functions *\n ********************/\n\n function isCollateralized(address _who) external view returns (bool);\n}\n" + }, + "contracts/L1/rollup/StateCommitmentChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 { IStateCommitmentChain } from \"./IStateCommitmentChain.sol\";\nimport { ICanonicalTransactionChain } from \"./ICanonicalTransactionChain.sol\";\nimport { IBondManager } from \"../verification/IBondManager.sol\";\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title 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 */\ncontract StateCommitmentChain is IStateCommitmentChain, Lib_AddressResolver {\n /*************\n * Constants *\n *************/\n\n uint256 public FRAUD_PROOF_WINDOW;\n uint256 public SEQUENCER_PUBLISH_WINDOW;\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 ) Lib_AddressResolver(_libAddressManager) {\n FRAUD_PROOF_WINDOW = _fraudProofWindow;\n SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow;\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() public view returns (IChainStorageContainer) {\n return IChainStorageContainer(resolve(\"ChainStorageContainer-SCC-batches\"));\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n function getTotalElements() public view returns (uint256 _totalElements) {\n (uint40 totalElements, ) = _getBatchExtraData();\n return uint256(totalElements);\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n function getTotalBatches() public view returns (uint256 _totalBatches) {\n return batches().length();\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function getLastSequencerTimestamp() public view returns (uint256 _lastSequencerTimestamp) {\n (, uint40 lastSequencerTimestamp) = _getBatchExtraData();\n return uint256(lastSequencerTimestamp);\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function appendStateBatch(bytes32[] memory _batch, uint256 _shouldStartAtElement) public {\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 IBondManager(resolve(\"BondManager\")).isCollateralized(msg.sender),\n \"Proposer does not have enough collateral posted\"\n );\n\n require(_batch.length > 0, \"Cannot submit an empty state batch.\");\n\n require(\n getTotalElements() + _batch.length <=\n ICanonicalTransactionChain(resolve(\"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(_batch, abi.encode(block.timestamp, msg.sender));\n }\n\n /**\n * @inheritdoc IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function deleteStateBatch(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) public {\n require(\n msg.sender == resolve(\"OVM_FraudVerifier\"),\n \"State batches can only be deleted by the OVM_FraudVerifier.\"\n );\n\n require(_isValidBatchHeader(_batchHeader), \"Invalid batch header.\");\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 IStateCommitmentChain\n */\n // slither-disable-next-line external-function\n function verifyStateCommitment(\n bytes32 _element,\n Lib_OVMCodec.ChainBatchHeader memory _batchHeader,\n Lib_OVMCodec.ChainInclusionProof memory _proof\n ) public view returns (bool) {\n require(_isValidBatchHeader(_batchHeader), \"Invalid batch header.\");\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 IStateCommitmentChain\n */\n function insideFraudProofWindow(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n public\n view\n returns (bool _inside)\n {\n (uint256 timestamp, ) = abi.decode(_batchHeader.extraData, (uint256, address));\n\n require(timestamp != 0, \"Batch header timestamp cannot be zero\");\n return (timestamp + FRAUD_PROOF_WINDOW) > block.timestamp;\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() internal view returns (uint40, uint40) {\n bytes27 extraData = batches().getGlobalMetadata();\n\n // solhint-disable max-line-length\n uint40 totalElements;\n uint40 lastSequencerTimestamp;\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(\n extraData,\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\n )\n lastSequencerTimestamp := shr(\n 40,\n and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000)\n )\n }\n // solhint-enable max-line-length\n\n return (totalElements, lastSequencerTimestamp);\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(uint40 _totalElements, uint40 _lastSequencerTimestamp)\n internal\n pure\n returns (bytes27)\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(bytes32[] memory _batch, bytes memory _extraData) internal {\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) internal {\n require(_batchHeader.batchIndex < batches().length(), \"Invalid batch index.\");\n\n require(_isValidBatchHeader(_batchHeader), \"Invalid batch header.\");\n\n // slither-disable-next-line reentrancy-events\n batches().deleteElementsAfterInclusive(\n _batchHeader.batchIndex,\n _makeBatchExtraData(uint40(_batchHeader.prevTotalElements), 0)\n );\n\n // slither-disable-next-line reentrancy-events\n emit StateBatchDeleted(_batchHeader.batchIndex, _batchHeader.batchRoot);\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n internal\n view\n returns (bool)\n {\n return Lib_OVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex);\n }\n}\n" + }, + "contracts/libraries/codec/Lib_OVMCodec.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 * Enums *\n *********/\n\n enum QueueOrigin {\n SEQUENCER_QUEUE,\n L1TOL2_QUEUE\n }\n\n /***********\n * Structs *\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 * 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(Transaction memory _transaction)\n internal\n pure\n returns (bytes memory)\n {\n return\n 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(Transaction memory _transaction) internal pure returns (bytes32) {\n return keccak256(encodeTransaction(_transaction));\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(bytes memory _encoded) internal pure returns (EVMAccount memory) {\n Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded);\n\n return\n 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n internal\n pure\n returns (bytes32)\n {\n return\n keccak256(\n abi.encode(\n _batchHeader.batchRoot,\n _batchHeader.batchSize,\n _batchHeader.prevTotalElements,\n _batchHeader.extraData\n )\n );\n }\n}\n" + }, + "contracts/libraries/utils/Lib_MerkleTree.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_MerkleTree\n * @author River Keefer\n */\nlibrary Lib_MerkleTree {\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, then\n * 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(bytes32[] memory _elements) internal pure returns (bytes32) {\n require(_elements.length > 0, \"Lib_MerkleTree: Must provide at least one leaf hash.\");\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\n * (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 ) internal pure returns (bool) {\n require(_totalLeaves > 0, \"Lib_MerkleTree: Total leaves must be greater than zero.\");\n\n require(_index < _totalLeaves, \"Lib_MerkleTree: Index out of bounds.\");\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(abi.encodePacked(_siblings[i], computedRoot));\n } else {\n computedRoot = keccak256(abi.encodePacked(computedRoot, _siblings[i]));\n }\n\n _index >>= 1;\n }\n\n return _root == computedRoot;\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(uint256 _in) private pure returns (uint256) {\n require(_in > 0, \"Lib_MerkleTree: Cannot compute ceil(log_2) of 0.\");\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 & (((uint256(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 ((uint256(1) << highest) != _in) {\n highest += 1;\n }\n\n return highest;\n }\n}\n" + }, + "contracts/L1/rollup/IStateCommitmentChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title IStateCommitmentChain\n */\ninterface IStateCommitmentChain {\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(uint256 indexed _batchIndex, bytes32 _batchRoot);\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() external view returns (uint256 _totalElements);\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches() external view returns (uint256 _totalBatches);\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() external view returns (uint256 _lastSequencerTimestamp);\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(bytes32[] calldata _batch, uint256 _shouldStartAtElement) 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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader) 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 ) external view returns (bool _verified);\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(Lib_OVMCodec.ChainBatchHeader memory _batchHeader)\n external\n view\n returns (bool _inside);\n}\n" + }, + "contracts/L1/rollup/ICanonicalTransactionChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title ICanonicalTransactionChain\n */\ninterface ICanonicalTransactionChain {\n /**********\n * Events *\n **********/\n\n event L2GasParamsUpdated(\n uint256 l2GasDiscountDivisor,\n uint256 enqueueGasCost,\n uint256 enqueueL2GasPrepaid\n );\n\n event TransactionEnqueued(\n address indexed _l1TxOrigin,\n address indexed _target,\n uint256 _gasLimit,\n bytes _data,\n uint256 indexed _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 * Structs *\n ***********/\n\n struct BatchContext {\n uint256 numSequencedTransactions;\n uint256 numSubsequentQueueTransactions;\n uint256 timestamp;\n uint256 blockNumber;\n }\n\n /*******************************\n * Authorized Setter Functions *\n *******************************/\n\n /**\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\n * The value of enqueueL2GasPrepaid is immediately updated as well.\n */\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost) external;\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() external view returns (IChainStorageContainer);\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements() external view returns (uint256 _totalElements);\n\n /**\n * Retrieves the total number of batches submitted.\n * @return _totalBatches Total submitted batches.\n */\n function getTotalBatches() external view returns (uint256 _totalBatches);\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() external view returns (uint40);\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(uint256 _index)\n external\n view\n returns (Lib_OVMCodec.QueueElement memory _element);\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n function getLastTimestamp() external view returns (uint40);\n\n /**\n * Returns the blocknumber of the last transaction.\n * @return Blocknumber for the last transaction.\n */\n function getLastBlockNumber() external view returns (uint40);\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() external view returns (uint40);\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() external view returns (uint40);\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 ) 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 ) external;\n}\n" + }, + "contracts/L1/rollup/IChainStorageContainer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IChainStorageContainer\n */\ninterface IChainStorageContainer {\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(bytes27 _globalMetadata) external;\n\n /**\n * Retrieves the container's global metadata field.\n * @return Container global metadata field.\n */\n function getGlobalMetadata() external view returns (bytes27);\n\n /**\n * Retrieves the number of objects stored in the container.\n * @return Number of objects in the container.\n */\n function length() external view returns (uint256);\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(bytes32 _object) 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(bytes32 _object, bytes27 _globalMetadata) 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(uint256 _index) external view returns (bytes32);\n\n /**\n * Removes all objects after and including a given index.\n * @param _index Object index to delete from.\n */\n function deleteElementsAfterInclusive(uint256 _index) 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(uint256 _index, bytes27 _globalMetadata) external;\n}\n" + }, + "contracts/libraries/rlp/Lib_RLPReader.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_RLPReader\n * @dev Adapted from \"RLPReader\" by Hamdi Allam (hamdi.allam97@gmail.com).\n */\nlibrary Lib_RLPReader {\n /*************\n * Constants *\n *************/\n\n uint256 internal constant MAX_LIST_LENGTH = 32;\n\n /*********\n * Enums *\n *********/\n\n enum RLPItemType {\n DATA_ITEM,\n LIST_ITEM\n }\n\n /***********\n * Structs *\n ***********/\n\n struct RLPItem {\n uint256 length;\n uint256 ptr;\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(bytes memory _in) internal pure returns (RLPItem memory) {\n uint256 ptr;\n assembly {\n ptr := add(_in, 32)\n }\n\n return RLPItem({ length: _in.length, ptr: ptr });\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(RLPItem memory _in) internal pure returns (RLPItem[] memory) {\n (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in);\n\n require(itemType == RLPItemType.LIST_ITEM, \"Invalid RLP list value.\");\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(itemCount < MAX_LIST_LENGTH, \"Provided RLP list exceeds max list length.\");\n\n (uint256 itemOffset, uint256 itemLength, ) = _decodeLength(\n RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset })\n );\n\n out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset });\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(bytes memory _in) internal pure returns (RLPItem[] memory) {\n return readList(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bytes memory) {\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\n\n require(itemType == RLPItemType.DATA_ITEM, \"Invalid RLP bytes value.\");\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(bytes memory _in) internal pure returns (bytes memory) {\n return readBytes(toRLPItem(_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(RLPItem memory _in) internal pure returns (string memory) {\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(bytes memory _in) internal pure returns (string memory) {\n return readString(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bytes32) {\n require(_in.length <= 33, \"Invalid RLP bytes32 value.\");\n\n (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in);\n\n require(itemType == RLPItemType.DATA_ITEM, \"Invalid RLP bytes32 value.\");\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(bytes memory _in) internal pure returns (bytes32) {\n return readBytes32(toRLPItem(_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(RLPItem memory _in) internal pure returns (uint256) {\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(bytes memory _in) internal pure returns (uint256) {\n return readUint256(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bool) {\n require(_in.length == 1, \"Invalid RLP boolean value.\");\n\n uint256 ptr = _in.ptr;\n uint256 out;\n assembly {\n out := byte(0, mload(ptr))\n }\n\n require(out == 0 || out == 1, \"Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1\");\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(bytes memory _in) internal pure returns (bool) {\n return readBool(toRLPItem(_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(RLPItem memory _in) internal pure returns (address) {\n if (_in.length == 1) {\n return address(0);\n }\n\n require(_in.length == 21, \"Invalid RLP address value.\");\n\n return address(uint160(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(bytes memory _in) internal pure returns (address) {\n return readAddress(toRLPItem(_in));\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(RLPItem memory _in) internal pure returns (bytes memory) {\n return _copy(_in);\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(RLPItem memory _in)\n private\n pure\n returns (\n uint256,\n uint256,\n RLPItemType\n )\n {\n require(_in.length > 0, \"RLP item cannot be null.\");\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 // slither-disable-next-line variable-scope\n uint256 strLen = prefix - 0x80;\n\n require(_in.length > strLen, \"Invalid RLP short string.\");\n\n return (1, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xbf) {\n // Long string.\n uint256 lenOfStrLen = prefix - 0xb7;\n\n require(_in.length > lenOfStrLen, \"Invalid RLP long string length.\");\n\n uint256 strLen;\n assembly {\n // Pick out the string length.\n strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen)))\n }\n\n require(_in.length > lenOfStrLen + strLen, \"Invalid RLP long string.\");\n\n return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM);\n } else if (prefix <= 0xf7) {\n // Short list.\n // slither-disable-next-line variable-scope\n uint256 listLen = prefix - 0xc0;\n\n require(_in.length > listLen, \"Invalid RLP short list.\");\n\n return (1, listLen, RLPItemType.LIST_ITEM);\n } else {\n // Long list.\n uint256 lenOfListLen = prefix - 0xf7;\n\n require(_in.length > lenOfListLen, \"Invalid RLP long list length.\");\n\n uint256 listLen;\n assembly {\n // Pick out the list length.\n listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen)))\n }\n\n require(_in.length > lenOfListLen + listLen, \"Invalid RLP long list.\");\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 ) private pure returns (bytes memory) {\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;\n unchecked {\n mask = 256**(32 - (_length % 32)) - 1;\n }\n\n assembly {\n mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask)))\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(RLPItem memory _in) private pure returns (bytes memory) {\n return _copy(_in.ptr, 0, _in.length);\n }\n}\n" + }, + "contracts/libraries/rlp/Lib_RLPWriter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_RLPWriter\n * @author Bakaoh (with modifications)\n */\nlibrary Lib_RLPWriter {\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(bytes memory _in) internal pure returns (bytes memory) {\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(bytes[] memory _in) internal pure returns (bytes memory) {\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(string memory _in) internal pure returns (bytes memory) {\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(address _in) internal pure returns (bytes memory) {\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(uint256 _in) internal pure returns (bytes memory) {\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(bool _in) internal pure returns (bytes memory) {\n bytes memory encoded = new bytes(1);\n encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80));\n return encoded;\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(uint256 _len, uint256 _offset) private pure returns (bytes memory) {\n bytes memory encoded;\n\n if (_len < 56) {\n encoded = new bytes(1);\n encoded[0] = bytes1(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] = bytes1(uint8(lenLen) + uint8(_offset) + 55);\n for (i = 1; i <= lenLen; i++) {\n encoded[i] = bytes1(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(uint256 _x) private pure returns (bytes memory) {\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 ) private pure {\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;\n unchecked {\n mask = 256**(32 - len) - 1;\n }\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(bytes[] memory _list) private pure returns (bytes memory) {\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 {\n flattenedPtr := add(flattened, 0x20)\n }\n\n for (i = 0; i < _list.length; i++) {\n bytes memory item = _list[i];\n\n uint256 listPtr;\n assembly {\n listPtr := add(item, 0x20)\n }\n\n _memcpy(flattenedPtr, listPtr, item.length);\n flattenedPtr += _list[i].length;\n }\n\n return flattened;\n }\n}\n" + }, + "contracts/libraries/utils/Lib_BytesUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_BytesUtils\n */\nlibrary Lib_BytesUtils {\n /**********************\n * Internal Functions *\n **********************/\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) internal pure returns (bytes memory) {\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(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) {\n if (_start >= _bytes.length) {\n return bytes(\"\");\n }\n\n return slice(_bytes, _start, _bytes.length - _start);\n }\n\n function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {\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(bytes memory _bytes) internal pure returns (uint256) {\n return uint256(toBytes32(_bytes));\n }\n\n function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) {\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(bytes memory _bytes) internal pure returns (bytes memory) {\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(bytes memory _bytes, bytes memory _other) internal pure returns (bool) {\n return keccak256(_bytes) == keccak256(_other);\n }\n}\n" + }, + "contracts/libraries/utils/Lib_Bytes32Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_Byte32Utils\n */\nlibrary Lib_Bytes32Utils {\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(bytes32 _in) internal pure returns (bool) {\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(bool _in) internal pure returns (bytes32) {\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(bytes32 _in) internal pure returns (address) {\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(address _in) internal pure returns (bytes32) {\n return bytes32(uint256(uint160(_in)));\n }\n}\n" + }, + "contracts/L1/rollup/ChainStorageContainer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../libraries/utils/Lib_Buffer.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title ChainStorageContainer\n * @dev The Chain Storage Container provides its owner contract with read, write and delete\n * functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which\n * can no longer be used in a fraud proof due to the fraud window having passed, and the associated\n * chain state or 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 */\ncontract ChainStorageContainer is IChainStorageContainer, Lib_AddressResolver {\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Lib_Buffer.Buffer;\n\n /*************\n * Variables *\n *************/\n\n string public owner;\n Lib_Buffer.Buffer internal buffer;\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(address _libAddressManager, string memory _owner)\n Lib_AddressResolver(_libAddressManager)\n {\n owner = _owner;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n modifier onlyOwner() {\n require(\n msg.sender == resolve(owner),\n \"ChainStorageContainer: Function can only be called by the owner.\"\n );\n _;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function setGlobalMetadata(bytes27 _globalMetadata) public onlyOwner {\n return buffer.setExtraData(_globalMetadata);\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function getGlobalMetadata() public view returns (bytes27) {\n return buffer.getExtraData();\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function length() public view returns (uint256) {\n return uint256(buffer.getLength());\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function push(bytes32 _object) public onlyOwner {\n buffer.push(_object);\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function push(bytes32 _object, bytes27 _globalMetadata) public onlyOwner {\n buffer.push(_object, _globalMetadata);\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function get(uint256 _index) public view returns (bytes32) {\n return buffer.get(uint40(_index));\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function deleteElementsAfterInclusive(uint256 _index) public onlyOwner {\n buffer.deleteElementsAfterInclusive(uint40(_index));\n }\n\n /**\n * @inheritdoc IChainStorageContainer\n */\n // slither-disable-next-line external-function\n function deleteElementsAfterInclusive(uint256 _index, bytes27 _globalMetadata)\n public\n onlyOwner\n {\n buffer.deleteElementsAfterInclusive(uint40(_index), _globalMetadata);\n }\n}\n" + }, + "contracts/libraries/utils/Lib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_Buffer\n * @dev This library implements a bytes32 storage array with some additional gas-optimized\n * functionality. In particular, it encodes its length as a uint40, and tightly packs this with an\n * overwritable \"extra data\" field so we can store more information with a single SSTORE.\n */\nlibrary Lib_Buffer {\n /*************\n * Libraries *\n *************/\n\n using Lib_Buffer for Buffer;\n\n /***********\n * Structs *\n ***********/\n\n struct Buffer {\n bytes32 context;\n mapping(uint256 => bytes32) buf;\n }\n\n struct BufferContext {\n // Stores the length of the array. Uint40 is way more elements than we'll ever reasonably\n // need in an array and we get an extra 27 bytes of extra data to play with.\n uint40 length;\n // Arbitrary extra data that can be modified whenever the length is updated. Useful for\n // squeezing out some gas optimizations.\n bytes27 extraData;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n * @param _extraData Global extra data.\n */\n function push(\n Buffer storage _self,\n bytes32 _value,\n bytes27 _extraData\n ) internal {\n BufferContext memory ctx = _self.getContext();\n\n _self.buf[ctx.length] = _value;\n\n // Bump the global index and insert our extra data, then save the context.\n ctx.length++;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Pushes a single element to the buffer.\n * @param _self Buffer to access.\n * @param _value Value to push to the buffer.\n */\n function push(Buffer storage _self, bytes32 _value) internal {\n BufferContext memory ctx = _self.getContext();\n\n _self.push(_value, ctx.extraData);\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(Buffer storage _self, uint256 _index) internal view returns (bytes32) {\n BufferContext memory ctx = _self.getContext();\n\n require(_index < ctx.length, \"Index out of bounds.\");\n\n return _self.buf[_index];\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n * @param _extraData Optional global extra data.\n */\n function deleteElementsAfterInclusive(\n Buffer storage _self,\n uint40 _index,\n bytes27 _extraData\n ) internal {\n BufferContext memory ctx = _self.getContext();\n\n require(_index < ctx.length, \"Index out of bounds.\");\n\n // Set our length and extra data, save the context.\n ctx.length = _index;\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Deletes all elements after (and including) a given index.\n * @param _self Buffer to access.\n * @param _index Index of the element to delete from (inclusive).\n */\n function deleteElementsAfterInclusive(Buffer storage _self, uint40 _index) internal {\n BufferContext memory ctx = _self.getContext();\n _self.deleteElementsAfterInclusive(_index, ctx.extraData);\n }\n\n /**\n * Retrieves the current global index.\n * @param _self Buffer to access.\n * @return Current global index.\n */\n function getLength(Buffer storage _self) internal view returns (uint40) {\n BufferContext memory ctx = _self.getContext();\n return ctx.length;\n }\n\n /**\n * Changes current global extra data.\n * @param _self Buffer to access.\n * @param _extraData New global extra data.\n */\n function setExtraData(Buffer storage _self, bytes27 _extraData) internal {\n BufferContext memory ctx = _self.getContext();\n ctx.extraData = _extraData;\n _self.setContext(ctx);\n }\n\n /**\n * Retrieves the current global extra data.\n * @param _self Buffer to access.\n * @return Current global extra data.\n */\n function getExtraData(Buffer storage _self) internal view returns (bytes27) {\n BufferContext memory ctx = _self.getContext();\n return ctx.extraData;\n }\n\n /**\n * Sets the current buffer context.\n * @param _self Buffer to access.\n * @param _ctx Current buffer context.\n */\n function setContext(Buffer storage _self, BufferContext memory _ctx) internal {\n bytes32 context;\n uint40 length = _ctx.length;\n bytes27 extraData = _ctx.extraData;\n assembly {\n context := length\n context := or(context, extraData)\n }\n\n if (_self.context != context) {\n _self.context = context;\n }\n }\n\n /**\n * Retrieves the current buffer context.\n * @param _self Buffer to access.\n * @return Current buffer context.\n */\n function getContext(Buffer storage _self) internal view returns (BufferContext memory) {\n bytes32 context = _self.context;\n uint40 length;\n bytes27 extraData;\n assembly {\n length := and(\n context,\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\n )\n extraData := and(\n context,\n 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000\n )\n }\n\n return BufferContext({ length: length, extraData: extraData });\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_Buffer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_Buffer } from \"../../libraries/utils/Lib_Buffer.sol\";\n\n/**\n * @title TestLib_Buffer\n */\ncontract TestLib_Buffer {\n using Lib_Buffer for Lib_Buffer.Buffer;\n using Lib_Buffer for Lib_Buffer.BufferContext;\n\n Lib_Buffer.Buffer internal buf;\n\n function push(bytes32 _value, bytes27 _extraData) public {\n buf.push(_value, _extraData);\n }\n\n function push(bytes32 _value) public {\n buf.push(_value);\n }\n\n function get(uint256 _index) public view returns (bytes32) {\n return buf.get(_index);\n }\n\n function deleteElementsAfterInclusive(uint40 _index) public {\n return buf.deleteElementsAfterInclusive(_index);\n }\n\n function deleteElementsAfterInclusive(uint40 _index, bytes27 _extraData) public {\n return buf.deleteElementsAfterInclusive(_index, _extraData);\n }\n\n function getLength() public view returns (uint40) {\n return buf.getLength();\n }\n\n function setExtraData(bytes27 _extraData) public {\n return buf.setExtraData(_extraData);\n }\n\n function getExtraData() public view returns (bytes27) {\n return buf.getExtraData();\n }\n\n function getContext() public view returns (Lib_Buffer.BufferContext memory) {\n return buf.getContext();\n }\n\n function setContext(uint40 _index, bytes27 _extraData) public {\n Lib_Buffer.BufferContext memory _ctx = Lib_Buffer.BufferContext({\n length: _index,\n extraData: _extraData\n });\n return buf.setContext(_ctx);\n }\n}\n" + }, + "contracts/L1/rollup/CanonicalTransactionChain.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\n\n/* Interface Imports */\nimport { ICanonicalTransactionChain } from \"./ICanonicalTransactionChain.sol\";\nimport { IChainStorageContainer } from \"./IChainStorageContainer.sol\";\n\n/**\n * @title 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\n * Sequencer will eventually append it to the rollup state.\n *\n */\ncontract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressResolver {\n /*************\n * Constants *\n *************/\n\n // L2 tx gas-related\n uint256 public constant MIN_ROLLUP_TX_GAS = 100000;\n uint256 public constant MAX_ROLLUP_TX_SIZE = 50000;\n\n // The approximate cost of calling the enqueue function\n uint256 public enqueueGasCost;\n // The ratio of the cost of L1 gas to the cost of L2 gas\n uint256 public l2GasDiscountDivisor;\n // The amount of L2 gas which can be forwarded to L2 without spam prevention via 'gas burn'.\n // Calculated as the product of l2GasDiscountDivisor * enqueueGasCost.\n // See comments in enqueue() for further detail.\n uint256 public enqueueL2GasPrepaid;\n\n // Encoding-related (all in bytes)\n uint256 internal constant BATCH_CONTEXT_SIZE = 16;\n // slither-disable-next-line unused-state\n uint256 internal constant BATCH_CONTEXT_LENGTH_POS = 12;\n uint256 internal constant BATCH_CONTEXT_START_POS = 15;\n // slither-disable-next-line unused-state\n uint256 internal constant TX_DATA_HEADER_SIZE = 3;\n // slither-disable-next-line unused-state\n uint256 internal constant BYTES_TILL_TX_DATA = 65;\n\n /*************\n * Variables *\n *************/\n\n uint256 public maxTransactionGasLimit;\n\n /***************\n * Queue State *\n ***************/\n\n uint40 private _nextQueueIndex; // index of the first queue element not yet included\n Lib_OVMCodec.QueueElement[] queueElements;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(\n address _libAddressManager,\n uint256 _maxTransactionGasLimit,\n uint256 _l2GasDiscountDivisor,\n uint256 _enqueueGasCost\n ) Lib_AddressResolver(_libAddressManager) {\n maxTransactionGasLimit = _maxTransactionGasLimit;\n l2GasDiscountDivisor = _l2GasDiscountDivisor;\n enqueueGasCost = _enqueueGasCost;\n enqueueL2GasPrepaid = _l2GasDiscountDivisor * _enqueueGasCost;\n }\n\n /**********************\n * Function Modifiers *\n **********************/\n\n /**\n * Modifier to enforce that, if configured, only the Burn Admin may\n * successfully call a method.\n */\n modifier onlyBurnAdmin() {\n require(msg.sender == libAddressManager.owner(), \"Only callable by the Burn Admin.\");\n _;\n }\n\n /*******************************\n * Authorized Setter Functions *\n *******************************/\n\n /**\n * Allows the Burn Admin to update the parameters which determine the amount of gas to burn.\n * The value of enqueueL2GasPrepaid is immediately updated as well.\n */\n function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost)\n external\n onlyBurnAdmin\n {\n enqueueGasCost = _enqueueGasCost;\n l2GasDiscountDivisor = _l2GasDiscountDivisor;\n // See the comment in enqueue() for the rationale behind this formula.\n enqueueL2GasPrepaid = _l2GasDiscountDivisor * _enqueueGasCost;\n\n emit L2GasParamsUpdated(l2GasDiscountDivisor, enqueueGasCost, enqueueL2GasPrepaid);\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() public view returns (IChainStorageContainer) {\n return IChainStorageContainer(resolve(\"ChainStorageContainer-CTC-batches\"));\n }\n\n /**\n * Retrieves the total number of elements submitted.\n * @return _totalElements Total submitted elements.\n */\n function getTotalElements() public view returns (uint256 _totalElements) {\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 // slither-disable-next-line external-function\n function getTotalBatches() public view returns (uint256 _totalBatches) {\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 // slither-disable-next-line external-function\n function getNextQueueIndex() public view returns (uint40) {\n return _nextQueueIndex;\n }\n\n /**\n * Returns the timestamp of the last transaction.\n * @return Timestamp for the last transaction.\n */\n // slither-disable-next-line external-function\n function getLastTimestamp() public view returns (uint40) {\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 // slither-disable-next-line external-function\n function getLastBlockNumber() public view returns (uint40) {\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 // slither-disable-next-line external-function\n function getQueueElement(uint256 _index)\n public\n view\n returns (Lib_OVMCodec.QueueElement memory _element)\n {\n return queueElements[_index];\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 // slither-disable-next-line external-function\n function getNumPendingQueueElements() public view returns (uint40) {\n return uint40(queueElements.length) - _nextQueueIndex;\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 // slither-disable-next-line external-function\n function getQueueLength() public view returns (uint40) {\n return uint40(queueElements.length);\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 ) external {\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(_gasLimit >= MIN_ROLLUP_TX_GAS, \"Transaction gas limit too low to enqueue.\");\n\n // Transactions submitted to the queue lack a method for paying gas fees to the Sequencer.\n // So we need to prevent spam attacks by ensuring that the cost of enqueueing a transaction\n // from L1 to L2 is not underpriced. For transaction with a high L2 gas limit, we do this by\n // burning some extra gas on L1. Of course there is also some intrinsic cost to enqueueing a\n // transaction, so we want to make sure not to over-charge (by burning too much L1 gas).\n // Therefore, we define 'enqueueL2GasPrepaid' as the L2 gas limit above which we must burn\n // additional gas on L1. This threshold is the product of two inputs:\n // 1. enqueueGasCost: the base cost of calling this function.\n // 2. l2GasDiscountDivisor: the ratio between the cost of gas on L1 and L2. This is a\n // positive integer, meaning we assume L2 gas is always less costly.\n // The calculation below for gasToConsume can be seen as converting the difference (between\n // the specified L2 gas limit and the prepaid L2 gas limit) to an L1 gas amount.\n if (_gasLimit > enqueueL2GasPrepaid) {\n uint256 gasToConsume = (_gasLimit - enqueueL2GasPrepaid) / l2GasDiscountDivisor;\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(startingGas > gasToConsume, \"Insufficient gas for L2 rate limiting burn.\");\n\n uint256 i;\n while (startingGas - gasleft() < gasToConsume) {\n i++;\n }\n }\n\n // Apply an aliasing unless msg.sender == tx.origin. This prevents an attack in which a\n // contract on L1 has the same address as a contract on L2 but doesn't have the same code.\n // We can safely ignore this for EOAs because they're guaranteed to have the same \"code\"\n // (i.e. no code at all). This also makes it possible for users to interact with contracts\n // on L2 even when the Sequencer is down.\n address sender;\n if (msg.sender == tx.origin) {\n sender = msg.sender;\n } else {\n sender = AddressAliasHelper.applyL1ToL2Alias(msg.sender);\n }\n\n bytes32 transactionHash = keccak256(abi.encode(sender, _target, _gasLimit, _data));\n\n queueElements.push(\n Lib_OVMCodec.QueueElement({\n transactionHash: transactionHash,\n timestamp: uint40(block.timestamp),\n blockNumber: uint40(block.number)\n })\n );\n uint256 queueIndex = queueElements.length - 1;\n emit TransactionEnqueued(sender, _target, _gasLimit, _data, queueIndex, block.timestamp);\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() external {\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 uint40 nextTransactionPtr = uint40(\n BATCH_CONTEXT_START_POS + BATCH_CONTEXT_SIZE * numContexts\n );\n\n require(msg.data.length >= nextTransactionPtr, \"Not enough BatchContexts provided.\");\n\n // Counter for number of sequencer transactions appended so far.\n uint32 numSequencerTransactions = 0;\n\n // Cache the _nextQueueIndex storage variable to a temporary stack variable.\n // This is safe as long as nothing reads or writes to the storage variable\n // until it is updated by the temp variable.\n uint40 nextQueueIndex = _nextQueueIndex;\n\n BatchContext memory curContext;\n for (uint32 i = 0; i < numContexts; i++) {\n BatchContext memory nextContext = _getBatchContext(i);\n\n // Now we can update our current context.\n curContext = nextContext;\n\n // Process sequencer transactions first.\n numSequencerTransactions += uint32(curContext.numSequencedTransactions);\n\n // Now process any subsequent queue transactions.\n nextQueueIndex += uint40(curContext.numSubsequentQueueTransactions);\n }\n\n require(\n nextQueueIndex <= queueElements.length,\n \"Attempted to append more elements than are available in the queue.\"\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\n // 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\n // queue element.\n // curContext.numSubsequentQueueTransactions > 0 which means that we've processed at\n // least one queue element. We increment nextQueueIndex after processing each queue\n // element, so the index of the last element we processed is nextQueueIndex - 1.\n Lib_OVMCodec.QueueElement memory lastElement = queueElements[nextQueueIndex - 1];\n\n blockTimestamp = lastElement.timestamp;\n blockNumber = lastElement.blockNumber;\n }\n\n // Cache the previous blockhash to ensure all transaction data can be retrieved efficiently.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n _appendBatch(\n blockhash(block.number - 1),\n totalElementsToAppend,\n numQueuedTransactions,\n blockTimestamp,\n blockNumber\n );\n\n // slither-disable-next-line reentrancy-events\n emit SequencerBatchAppended(\n nextQueueIndex - numQueuedTransactions,\n numQueuedTransactions,\n getTotalElements()\n );\n\n // Update the _nextQueueIndex storage variable.\n // slither-disable-next-line reentrancy-no-eth\n _nextQueueIndex = nextQueueIndex;\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(uint256 _index) internal pure returns (BatchContext memory) {\n uint256 contextPtr = 15 + _index * BATCH_CONTEXT_SIZE;\n // slither-disable-next-line similar-names\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\n 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\n // solhint-disable max-line-length\n assembly {\n extraData := shr(40, extraData)\n totalElements := and(\n extraData,\n 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF\n )\n nextQueueIndex := shr(\n 40,\n and(extraData, 0x00000000000000000000000000000000000000000000FFFFFFFFFF0000000000)\n )\n lastTimestamp := shr(\n 80,\n and(extraData, 0x0000000000000000000000000000000000FFFFFFFFFF00000000000000000000)\n )\n lastBlockNumber := shr(\n 120,\n and(extraData, 0x000000000000000000000000FFFFFFFFFF000000000000000000000000000000)\n )\n }\n // solhint-enable max-line-length\n\n return (totalElements, nextQueueIndex, lastTimestamp, lastBlockNumber);\n }\n\n /**\n * Encodes the batch context for the extra data.\n * @param _totalElements Total number of elements submitted.\n * @param _nextQueueIdx 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 _nextQueueIdx,\n uint40 _timestamp,\n uint40 _blockNumber\n ) internal pure returns (bytes27) {\n bytes27 extraData;\n assembly {\n extraData := _totalElements\n extraData := or(extraData, shl(40, _nextQueueIdx))\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 * 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 ) internal {\n IChainStorageContainer 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 // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n batchesRef.push(batchHeaderHash, latestBatchContext);\n }\n}\n" + }, + "contracts/standards/AddressAliasHelper.sol": { + "content": "// SPDX-License-Identifier: Apache-2.0\n\n/*\n * Copyright 2019-2021, Offchain Labs, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npragma solidity ^0.8.7;\n\nlibrary AddressAliasHelper {\n uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);\n\n /// @notice Utility function that converts the address in the L1 that submitted a tx to\n /// the inbox to the msg.sender viewed in the L2\n /// @param l1Address the address in the L1 that triggered the tx to L2\n /// @return l2Address L2 address as viewed in msg.sender\n function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n unchecked {\n l2Address = address(uint160(l1Address) + offset);\n }\n }\n\n /// @notice Utility function that converts the msg.sender viewed in the L2 to the\n /// address in the L1 that submitted a tx to the inbox\n /// @param l2Address L2 address as viewed in msg.sender\n /// @return l1Address the address in the L1 that triggered the tx to L2\n function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\n unchecked {\n l1Address = address(uint160(l2Address) - offset);\n }\n }\n}\n" + }, + "contracts/test-libraries/codec/TestLib_OVMCodec.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/**\n * @title TestLib_OVMCodec\n */\ncontract TestLib_OVMCodec {\n function encodeTransaction(Lib_OVMCodec.Transaction memory _transaction)\n public\n pure\n returns (bytes memory _encoded)\n {\n return Lib_OVMCodec.encodeTransaction(_transaction);\n }\n\n function hashTransaction(Lib_OVMCodec.Transaction memory _transaction)\n public\n pure\n returns (bytes32 _hash)\n {\n return Lib_OVMCodec.hashTransaction(_transaction);\n }\n}\n" + }, + "contracts/L1/messaging/L1CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_AddressResolver } from \"../../libraries/resolver/Lib_AddressResolver.sol\";\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\nimport { Lib_AddressManager } from \"../../libraries/resolver/Lib_AddressManager.sol\";\nimport { Lib_SecureMerkleTrie } from \"../../libraries/trie/Lib_SecureMerkleTrie.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/* Interface Imports */\nimport { IL1CrossDomainMessenger } from \"./IL1CrossDomainMessenger.sol\";\nimport { ICanonicalTransactionChain } from \"../rollup/ICanonicalTransactionChain.sol\";\nimport { IStateCommitmentChain } from \"../rollup/IStateCommitmentChain.sol\";\n\n/* External Imports */\nimport {\n OwnableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {\n PausableUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport {\n ReentrancyGuardUpgradeable\n} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\n/**\n * @title 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 */\ncontract L1CrossDomainMessenger is\n IL1CrossDomainMessenger,\n Lib_AddressResolver,\n OwnableUpgradeable,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable\n{\n /**********\n * Events *\n **********/\n\n event MessageBlocked(bytes32 indexed _xDomainCalldataHash);\n\n event MessageAllowed(bytes32 indexed _xDomainCalldataHash);\n\n /**********************\n * Contract Variables *\n **********************/\n\n mapping(bytes32 => bool) public blockedMessages;\n mapping(bytes32 => bool) public relayedMessages;\n mapping(bytes32 => bool) public successfulMessages;\n\n address internal xDomainMsgSender = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * This contract is intended to be behind a delegate proxy.\n * We pass the zero address to the address resolver just to satisfy the constructor.\n * We still need to set this value in initialize().\n */\n constructor() Lib_AddressResolver(address(0)) {}\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @param _libAddressManager Address of the Address Manager.\n */\n // slither-disable-next-line external-function\n function initialize(address _libAddressManager) public initializer {\n require(\n address(libAddressManager) == address(0),\n \"L1CrossDomainMessenger already intialized.\"\n );\n libAddressManager = Lib_AddressManager(_libAddressManager);\n xDomainMsgSender = Lib_DefaultValues.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() external onlyOwner {\n _pause();\n }\n\n /**\n * Block a message.\n * @param _xDomainCalldataHash Hash of the message to block.\n */\n function blockMessage(bytes32 _xDomainCalldataHash) external onlyOwner {\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(bytes32 _xDomainCalldataHash) external onlyOwner {\n blockedMessages[_xDomainCalldataHash] = false;\n emit MessageAllowed(_xDomainCalldataHash);\n }\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n address ovmCanonicalTransactionChain = resolve(\"CanonicalTransactionChain\");\n // Use the CTC queue length as nonce\n uint40 nonce = ICanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n nonce\n );\n\n // slither-disable-next-line reentrancy-events\n _sendXDomainMessage(ovmCanonicalTransactionChain, xDomainCalldata, _gasLimit);\n\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, nonce, _gasLimit);\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL1CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n ) public nonReentrant whenNotPaused {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n require(\n _verifyXDomainMessage(xDomainCalldata, _proof) == 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 require(\n _target != resolve(\"CanonicalTransactionChain\"),\n \"Cannot send L2->L1 messages to L1 system contracts.\"\n );\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n\n /**\n * Replays a cross domain message to the target messenger.\n * @inheritdoc IL1CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _queueIndex,\n uint32 _oldGasLimit,\n uint32 _newGasLimit\n ) public {\n // Verify that the message is in the queue:\n address canonicalTransactionChain = resolve(\"CanonicalTransactionChain\");\n Lib_OVMCodec.QueueElement memory element = ICanonicalTransactionChain(\n canonicalTransactionChain\n ).getQueueElement(_queueIndex);\n\n // Compute the calldata that was originally used to send the message.\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _queueIndex\n );\n\n // Compute the transactionHash\n bytes32 transactionHash = keccak256(\n abi.encode(\n AddressAliasHelper.applyL1ToL2Alias(address(this)),\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,\n _oldGasLimit,\n xDomainCalldata\n )\n );\n\n // Now check that the provided message data matches the one in the queue element.\n require(\n transactionHash == element.transactionHash,\n \"Provided message has not been enqueued.\"\n );\n\n // Send the same message but with the new gas limit.\n _sendXDomainMessage(canonicalTransactionChain, xDomainCalldata, _newGasLimit);\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 ) internal view returns (bool) {\n return (_verifyStateRootProof(_proof) && _verifyStorageProof(_xDomainCalldata, _proof));\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(L2MessageInclusionProof memory _proof)\n internal\n view\n returns (bool)\n {\n IStateCommitmentChain ovmStateCommitmentChain = IStateCommitmentChain(\n resolve(\"StateCommitmentChain\")\n );\n\n return (ovmStateCommitmentChain.insideFraudProofWindow(_proof.stateRootBatchHeader) ==\n false &&\n ovmStateCommitmentChain.verifyStateCommitment(\n _proof.stateRoot,\n _proof.stateRootBatchHeader,\n _proof.stateRootProof\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 ) internal view returns (bool) {\n bytes32 storageKey = keccak256(\n abi.encodePacked(\n keccak256(\n abi.encodePacked(\n _xDomainCalldata,\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER\n )\n ),\n uint256(0)\n )\n );\n\n (bool exists, bytes memory encodedMessagePassingAccount) = Lib_SecureMerkleTrie.get(\n abi.encodePacked(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER),\n _proof.stateTrieWitness,\n _proof.stateRoot\n );\n\n require(\n exists == true,\n \"Message passing predeploy has not been initialized or invalid proof provided.\"\n );\n\n Lib_OVMCodec.EVMAccount memory account = Lib_OVMCodec.decodeEVMAccount(\n encodedMessagePassingAccount\n );\n\n return\n Lib_SecureMerkleTrie.verifyInclusionProof(\n abi.encodePacked(storageKey),\n abi.encodePacked(uint8(1)),\n _proof.storageTrieWitness,\n account.storageRoot\n );\n }\n\n /**\n * Sends a cross domain message.\n * @param _canonicalTransactionChain Address of the CanonicalTransactionChain instance.\n * @param _message Message to send.\n * @param _gasLimit OVM gas limit for the message.\n */\n function _sendXDomainMessage(\n address _canonicalTransactionChain,\n bytes memory _message,\n uint256 _gasLimit\n ) internal {\n // slither-disable-next-line reentrancy-events\n ICanonicalTransactionChain(_canonicalTransactionChain).enqueue(\n Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,\n _gasLimit,\n _message\n );\n }\n}\n" + }, + "contracts/libraries/trie/Lib_SecureMerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"./Lib_MerkleTrie.sol\";\n\n/**\n * @title Lib_SecureMerkleTrie\n */\nlibrary Lib_SecureMerkleTrie {\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 ) internal pure returns (bool _verified) {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.verifyInclusionProof(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 ) internal pure returns (bool _exists, bytes memory _value) {\n bytes memory key = _getSecureKey(_key);\n return Lib_MerkleTrie.get(key, _proof, _root);\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(bytes memory _key) private pure returns (bytes memory _secureKey) {\n return abi.encodePacked(keccak256(_key));\n }\n}\n" + }, + "contracts/libraries/constants/Lib_DefaultValues.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_DefaultValues\n */\nlibrary Lib_DefaultValues {\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" + }, + "contracts/libraries/constants/Lib_PredeployAddresses.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n address internal constant L2_TO_L1_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n address internal constant L1_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n address payable internal constant OVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n address internal constant L2_CROSS_DOMAIN_MESSENGER =\n 0x4200000000000000000000000000000000000007;\n address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n address internal constant L2_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n address internal constant SEQUENCER_FEE_WALLET = 0x4200000000000000000000000000000000000011;\n address internal constant L2_STANDARD_TOKEN_FACTORY =\n 0x4200000000000000000000000000000000000012;\n address internal constant L1_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n" + }, + "contracts/libraries/bridge/Lib_CrossDomainUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_CrossDomainUtils\n */\nlibrary Lib_CrossDomainUtils {\n /**\n * Generates the correct cross domain calldata for a message.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @return ABI encoded cross domain calldata.\n */\n function encodeXDomainCalldata(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) internal pure returns (bytes memory) {\n return\n abi.encodeWithSignature(\n \"relayMessage(address,address,bytes,uint256)\",\n _target,\n _sender,\n _message,\n _messageNonce\n );\n }\n}\n" + }, + "contracts/L1/messaging/IL1CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_OVMCodec } from \"../../libraries/codec/Lib_OVMCodec.sol\";\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL1CrossDomainMessenger\n */\ninterface IL1CrossDomainMessenger is ICrossDomainMessenger {\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 * Public Functions *\n ********************/\n\n /**\n * Relays a cross domain message to a contract.\n * @param _target Target contract address.\n * @param _sender Message sender address.\n * @param _message Message to send to the target.\n * @param _messageNonce Nonce for the provided message.\n * @param _proof Inclusion proof for the given message.\n */\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce,\n L2MessageInclusionProof memory _proof\n ) external;\n\n /**\n * Replays a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _sender Original sender address.\n * @param _message Message to send to the target.\n * @param _queueIndex CTC Queue index for the message to replay.\n * @param _oldGasLimit Original gas limit used to send the message.\n * @param _newGasLimit New gas limit to be used for this message.\n */\n function replayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _queueIndex,\n uint32 _oldGasLimit,\n uint32 _newGasLimit\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\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 _setOwner(_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 _setOwner(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 _setOwner(newOwner);\n }\n\n function _setOwner(address newOwner) private {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/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/security/ReentrancyGuardUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/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" + }, + "contracts/libraries/trie/Lib_MerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\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 * 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 * 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\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 ) internal pure returns (bool _verified) {\n (bool exists, bytes memory value) = get(_key, _proof, _root);\n\n return (exists && Lib_BytesUtils.equal(_value, value));\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 ) internal pure returns (bool _exists, bytes memory _value) {\n TrieNode[] memory proof = _parseProof(_proof);\n (uint256 pathLength, bytes memory keyRemainder, bool isFinalNode) = _walkNodePath(\n proof,\n _key,\n _root\n );\n\n bool exists = keyRemainder.length == 0;\n\n require(exists || isFinalNode, \"Provided proof is invalid.\");\n\n bytes memory value = exists ? _getNodeValue(proof[pathLength - 1]) : bytes(\"\");\n\n return (exists, value);\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(keccak256(currentNode.encoded) == currentNodeID, \"Invalid root hash\");\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\n // meaning the value should be within this branch node.\n break;\n } else {\n // We're not at the end of the key yet.\n // Figure out what the next node ID should be and continue.\n uint8 branchKey = uint8(key[currentKeyIndex]);\n Lib_RLPReader.RLPItem memory nextNode = currentNode.decoded[branchKey];\n currentNodeID = _getNodeID(nextNode);\n currentKeyIncrement = 1;\n continue;\n }\n } else if (currentNode.decoded.length == LEAF_OR_EXTENSION_NODE_LENGTH) {\n bytes memory path = _getNodePath(currentNode);\n uint8 prefix = uint8(path[0]);\n uint8 offset = 2 - (prefix % 2);\n bytes memory pathRemainder = Lib_BytesUtils.slice(path, offset);\n bytes memory keyRemainder = Lib_BytesUtils.slice(key, currentKeyIndex);\n uint256 sharedNibbleLength = _getSharedNibbleLength(pathRemainder, keyRemainder);\n\n if (prefix == PREFIX_LEAF_EVEN || prefix == PREFIX_LEAF_ODD) {\n if (\n pathRemainder.length == sharedNibbleLength &&\n keyRemainder.length == sharedNibbleLength\n ) {\n // The key within this leaf matches our key exactly.\n // Increment the key index to reflect that we have no remainder.\n currentKeyIndex += sharedNibbleLength;\n }\n\n // We've hit a leaf node, so our next node should be NULL.\n currentNodeID = bytes32(RLP_NULL);\n break;\n } else if (prefix == PREFIX_EXTENSION_EVEN || prefix == PREFIX_EXTENSION_ODD) {\n if (sharedNibbleLength != pathRemainder.length) {\n // Our extension node is not identical to the remainder.\n // We've hit the end of this path\n // 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 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(bytes memory _proof) private pure returns (TrieNode[] memory _parsed) {\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({ encoded: encoded, decoded: Lib_RLPReader.readList(encoded) });\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(Lib_RLPReader.RLPItem memory _node) private pure returns (bytes32 _nodeID) {\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(TrieNode memory _node) private pure returns (bytes memory _path) {\n return Lib_BytesUtils.toNibbles(Lib_RLPReader.readBytes(_node.decoded[0]));\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(TrieNode memory _node) private pure returns (bytes memory _value) {\n return Lib_RLPReader.readBytes(_node.decoded[_node.decoded.length - 1]);\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(bytes memory _a, bytes memory _b)\n private\n pure\n returns (uint256 _shared)\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" + }, + "contracts/libraries/bridge/ICrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n /**********\n * Events *\n **********/\n\n event SentMessage(\n address indexed target,\n address sender,\n bytes message,\n uint256 messageNonce,\n uint256 gasLimit\n );\n event RelayedMessage(bytes32 indexed msgHash);\n event FailedRelayedMessage(bytes32 indexed msgHash);\n\n /*************\n * Variables *\n *************/\n\n function xDomainMessageSender() external view returns (address);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Sends a cross domain message to the target messenger.\n * @param _target Target contract address.\n * @param _message Message to send to the target.\n * @param _gasLimit Gas limit for the provided message.\n */\n function sendMessage(\n address _target,\n bytes calldata _message,\n uint32 _gasLimit\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/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 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) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\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 {ERC1967Proxy-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 * @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 || !_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" + }, + "contracts/L2/messaging/IL2CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + }, + "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" + }, + "contracts/L2/predeploys/OVM_L2ToL1MessagePasser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { iOVM_L2ToL1MessagePasser } from \"./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 */\ncontract OVM_L2ToL1MessagePasser is iOVM_L2ToL1MessagePasser {\n /**********************\n * Contract Variables *\n **********************/\n\n mapping(bytes32 => bool) public sentMessages;\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Passes a message to L1.\n * @param _message Message to pass to L1.\n */\n // slither-disable-next-line external-function\n function passMessageToL1(bytes memory _message) public {\n // Note: although this function is public, only messages sent from the\n // L2CrossDomainMessenger will be relayed by the L1CrossDomainMessenger.\n // This is enforced by a check in L1CrossDomainMessenger._verifyStorageProof().\n sentMessages[keccak256(abi.encodePacked(_message, msg.sender))] = true;\n }\n}\n" + }, + "contracts/L2/predeploys/OVM_SequencerFeeVault.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardBridge } from \"../messaging/L2StandardBridge.sol\";\n\n/**\n * @title OVM_SequencerFeeVault\n * @dev Simple holding contract for fees paid to the Sequencer. Likely to be replaced in the future\n * but \"good enough for now\".\n */\ncontract OVM_SequencerFeeVault {\n /*************\n * Constants *\n *************/\n\n // Minimum ETH balance that can be withdrawn in a single withdrawal.\n uint256 public constant MIN_WITHDRAWAL_AMOUNT = 15 ether;\n\n /*************\n * Variables *\n *************/\n\n // Address on L1 that will hold the fees once withdrawn. Dynamically initialized within l2geth.\n address public l1FeeWallet;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l1FeeWallet Initial address for the L1 wallet that will hold fees once withdrawn.\n * Currently HAS NO EFFECT in production because l2geth will mutate this storage slot during\n * the genesis block. This is ONLY for testing purposes.\n */\n constructor(address _l1FeeWallet) {\n l1FeeWallet = _l1FeeWallet;\n }\n\n /************\n * Fallback *\n ************/\n\n // slither-disable-next-line locked-ether\n receive() external payable {}\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function withdraw() public {\n require(\n address(this).balance >= MIN_WITHDRAWAL_AMOUNT,\n // solhint-disable-next-line max-line-length\n \"OVM_SequencerFeeVault: withdrawal amount must be greater than minimum withdrawal amount\"\n );\n\n L2StandardBridge(Lib_PredeployAddresses.L2_STANDARD_BRIDGE).withdrawTo(\n Lib_PredeployAddresses.OVM_ETH,\n l1FeeWallet,\n address(this).balance,\n 0,\n bytes(\"\")\n );\n }\n}\n" + }, + "contracts/L2/messaging/L2StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IL1StandardBridge } from \"../../L1/messaging/IL1StandardBridge.sol\";\nimport { IL1ERC20Bridge } from \"../../L1/messaging/IL1ERC20Bridge.sol\";\nimport { IL2ERC20Bridge } from \"./IL2ERC20Bridge.sol\";\n\n/* Library Imports */\nimport { ERC165Checker } from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\nimport { CrossDomainEnabled } from \"../../libraries/bridge/CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { IL2StandardERC20 } from \"../../standards/IL2StandardERC20.sol\";\n\n/**\n * @title L2StandardBridge\n * @dev The L2 Standard bridge is a contract which works together with the L1 Standard bridge to\n * enable ETH and ERC20 transitions between L1 and L2.\n * This contract acts as a minter for new tokens when it hears about deposits into the L1 Standard\n * bridge.\n * This contract also acts as a burner of the tokens intended for withdrawal, informing the L1\n * bridge to release L1 funds.\n */\ncontract L2StandardBridge is IL2ERC20Bridge, CrossDomainEnabled {\n /********************************\n * External Contract References *\n ********************************/\n\n address public l1TokenBridge;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _l2CrossDomainMessenger Cross-domain messenger used by this contract.\n * @param _l1TokenBridge Address of the L1 bridge deployed to the main chain.\n */\n constructor(address _l2CrossDomainMessenger, address _l1TokenBridge)\n CrossDomainEnabled(_l2CrossDomainMessenger)\n {\n l1TokenBridge = _l1TokenBridge;\n }\n\n /***************\n * Withdrawing *\n ***************/\n\n /**\n * @inheritdoc IL2ERC20Bridge\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external virtual {\n _initiateWithdrawal(_l2Token, msg.sender, msg.sender, _amount, _l1Gas, _data);\n }\n\n /**\n * @inheritdoc IL2ERC20Bridge\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external virtual {\n _initiateWithdrawal(_l2Token, msg.sender, _to, _amount, _l1Gas, _data);\n }\n\n /**\n * @dev Performs the logic for withdrawals by burning the token and informing\n * the L1 token Gateway of the withdrawal.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _from Account to pull the withdrawal from on L2.\n * @param _to Account to give the withdrawal to on L1.\n * @param _amount Amount of the token to withdraw.\n * @param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateWithdrawal(\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) internal {\n // When a withdrawal is initiated, we burn the withdrawer's funds to prevent subsequent L2\n // usage\n // slither-disable-next-line reentrancy-events\n IL2StandardERC20(_l2Token).burn(msg.sender, _amount);\n\n // Construct calldata for l1TokenBridge.finalizeERC20Withdrawal(_to, _amount)\n // slither-disable-next-line reentrancy-events\n address l1Token = IL2StandardERC20(_l2Token).l1Token();\n bytes memory message;\n\n if (_l2Token == Lib_PredeployAddresses.OVM_ETH) {\n message = abi.encodeWithSelector(\n IL1StandardBridge.finalizeETHWithdrawal.selector,\n _from,\n _to,\n _amount,\n _data\n );\n } else {\n message = abi.encodeWithSelector(\n IL1ERC20Bridge.finalizeERC20Withdrawal.selector,\n l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n }\n\n // Send message up to L1 bridge\n // slither-disable-next-line reentrancy-events\n sendCrossDomainMessage(l1TokenBridge, _l1Gas, message);\n\n // slither-disable-next-line reentrancy-events\n emit WithdrawalInitiated(l1Token, _l2Token, msg.sender, _to, _amount, _data);\n }\n\n /************************************\n * Cross-chain Function: Depositing *\n ************************************/\n\n /**\n * @inheritdoc IL2ERC20Bridge\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external virtual onlyFromCrossDomainAccount(l1TokenBridge) {\n // Check the target token is compliant and\n // verify the deposited token on L1 matches the L2 deposited token representation here\n if (\n // slither-disable-next-line reentrancy-events\n ERC165Checker.supportsInterface(_l2Token, 0x1d1d8b63) &&\n _l1Token == IL2StandardERC20(_l2Token).l1Token()\n ) {\n // When a deposit is finalized, we credit the account on L2 with the same amount of\n // tokens.\n // slither-disable-next-line reentrancy-events\n IL2StandardERC20(_l2Token).mint(_to, _amount);\n // slither-disable-next-line reentrancy-events\n emit DepositFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n } else {\n // Either the L2 token which is being deposited-into disagrees about the correct address\n // of its L1 token, or does not support the correct interface.\n // This should only happen if there is a malicious L2 token, or if a user somehow\n // specified the wrong L2 token address to deposit into.\n // In either case, we stop the process here and construct a withdrawal\n // message so that users can get their funds out in some cases.\n // There is no way to prevent malicious token contracts altogether, but this does limit\n // user error and mitigate some forms of malicious contract behavior.\n bytes memory message = abi.encodeWithSelector(\n IL1ERC20Bridge.finalizeERC20Withdrawal.selector,\n _l1Token,\n _l2Token,\n _to, // switched the _to and _from here to bounce back the deposit to the sender\n _from,\n _amount,\n _data\n );\n\n // Send message up to L1 bridge\n // slither-disable-next-line reentrancy-events\n sendCrossDomainMessage(l1TokenBridge, 0, message);\n // slither-disable-next-line reentrancy-events\n emit DepositFailed(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n }\n}\n" + }, + "contracts/L1/messaging/IL1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IL1ERC20Bridge.sol\";\n\n/**\n * @title IL1StandardBridge\n */\ninterface IL1StandardBridge is IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n event ETHDepositInitiated(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n event ETHWithdrawalFinalized(\n address indexed _from,\n address indexed _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev Deposit an amount of the ETH to the caller's balance on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable;\n\n /**\n * @dev Deposit an amount of ETH to a recipient's balance on L2.\n * @param _to L2 address to credit the withdrawal to.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ETH token. Since only the xDomainMessenger can call this function, it will never be called\n * before the withdrawal is finalized.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "contracts/L1/messaging/IL1ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IL1ERC20Bridge\n */\ninterface IL1ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event ERC20DepositInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event ERC20WithdrawalFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L2 bridge contract.\n * @return Address of the corresponding L2 bridge contract.\n */\n function l2TokenBridge() external returns (address);\n\n /**\n * @dev deposit an amount of the ERC20 to the caller's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _amount Amount of the ERC20 to deposit\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev deposit an amount of ERC20 to a recipient's balance on L2.\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _to L2 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a withdrawal from L2 to L1, and credit funds to the recipient's balance of the\n * L1 ERC20 token.\n * This call will fail if the initialized withdrawal from L2 has not been finalized.\n *\n * @param _l1Token Address of L1 token to finalizeWithdrawal for.\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _from L2 address initiating the transfer.\n * @param _to L1 address to credit the withdrawal to.\n * @param _amount Amount of the ERC20 to deposit.\n * @param _data Data provided by the sender on L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "contracts/L2/messaging/IL2ERC20Bridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title IL2ERC20Bridge\n */\ninterface IL2ERC20Bridge {\n /**********\n * Events *\n **********/\n\n event WithdrawalInitiated(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFinalized(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n event DepositFailed(\n address indexed _l1Token,\n address indexed _l2Token,\n address indexed _from,\n address _to,\n uint256 _amount,\n bytes _data\n );\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * @dev get the address of the corresponding L1 bridge contract.\n * @return Address of the corresponding L1 bridge contract.\n */\n function l1TokenBridge() external returns (address);\n\n /**\n * @dev initiate a withdraw of some tokens to the caller's account on L1\n * @param _l2Token Address of L2 token where withdrawal was initiated.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdraw(\n address _l2Token,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /**\n * @dev initiate a withdraw of some token to a recipient's account on L1.\n * @param _l2Token Address of L2 token where withdrawal is initiated.\n * @param _to L1 adress to credit the withdrawal to.\n * @param _amount Amount of the token to withdraw.\n * param _l1Gas Unused, but included for potential forward compatibility considerations.\n * @param _data Optional data to forward to L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function withdrawTo(\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l1Gas,\n bytes calldata _data\n ) external;\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @dev Complete a deposit from L1 to L2, and credits funds to the recipient's balance of this\n * L2 token. This call will fail if it did not originate from a corresponding deposit in\n * L1StandardTokenBridge.\n * @param _l1Token Address for the l1 token this is called with\n * @param _l2Token Address for the l2 token this is called with\n * @param _from Account to pull the deposit from on L2.\n * @param _to Address to receive the withdrawal at\n * @param _amount Amount of the token to withdraw\n * @param _data Data provider by the sender on L1. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function finalizeDeposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external;\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n // As per the EIP-165 spec, no interface should ever match 0xffffffff\n bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n /**\n * @dev Returns true if `account` supports the {IERC165} interface,\n */\n function supportsERC165(address account) internal view returns (bool) {\n // Any contract that implements ERC165 must explicitly indicate support of\n // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n return\n _supportsERC165Interface(account, type(IERC165).interfaceId) &&\n !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);\n }\n\n /**\n * @dev Returns true if `account` supports the interface defined by\n * `interfaceId`. Support for {IERC165} itself is queried automatically.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n // query support of both ERC165 as per the spec and support of _interfaceId\n return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);\n }\n\n /**\n * @dev Returns a boolean array where each value corresponds to the\n * interfaces passed in and whether they're supported or not. This allows\n * you to batch check interfaces for a contract where your expectation\n * is that some interfaces may not be supported.\n *\n * See {IERC165-supportsInterface}.\n *\n * _Available since v3.4._\n */\n function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)\n internal\n view\n returns (bool[] memory)\n {\n // an array of booleans corresponding to interfaceIds and whether they're supported or not\n bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n // query support of ERC165 itself\n if (supportsERC165(account)) {\n // query support of each interface in interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);\n }\n }\n\n return interfaceIdsSupported;\n }\n\n /**\n * @dev Returns true if `account` supports all the interfaces defined in\n * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n *\n * Batch-querying can lead to gas savings by skipping repeated checks for\n * {IERC165} support.\n *\n * See {IERC165-supportsInterface}.\n */\n function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n // query support of ERC165 itself\n if (!supportsERC165(account)) {\n return false;\n }\n\n // query support of each interface in _interfaceIds\n for (uint256 i = 0; i < interfaceIds.length; i++) {\n if (!_supportsERC165Interface(account, interfaceIds[i])) {\n return false;\n }\n }\n\n // all interfaces supported\n return true;\n }\n\n /**\n * @notice Query if a contract implements an interface, does not check ERC165 support\n * @param account The address of the contract to query for support of an interface\n * @param interfaceId The interface identifier, as specified in ERC-165\n * @return true if the contract at account indicates support of the interface with\n * identifier interfaceId, false otherwise\n * @dev Assumes that account contains a contract that supports ERC165, otherwise\n * the behavior of this method is undefined. This precondition can be checked\n * with {supportsERC165}.\n * Interface identification is specified in ERC-165.\n */\n function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {\n bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);\n if (result.length < 32) return false;\n return success && abi.decode(result, (bool));\n }\n}\n" + }, + "contracts/libraries/bridge/CrossDomainEnabled.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\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 * Constructor *\n ***************/\n\n /**\n * @param _messenger Address of the CrossDomainMessenger on the current layer.\n */\n constructor(address _messenger) {\n messenger = _messenger;\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(address _sourceDomainAccount) {\n require(\n msg.sender == address(getCrossDomainMessenger()),\n \"OVM_XCHAIN: messenger contract unauthenticated\"\n );\n\n require(\n getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n \"OVM_XCHAIN: wrong sender of cross-domain message\"\n );\n\n _;\n }\n\n /**********************\n * Internal Functions *\n **********************/\n\n /**\n * 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() internal virtual returns (ICrossDomainMessenger) {\n return ICrossDomainMessenger(messenger);\n }\n\n /**q\n * Sends a message to an account on another domain\n * @param _crossDomainTarget The intended recipient on the destination domain\n * @param _message The data to send to the target (usually calldata to a function with\n * `onlyFromCrossDomainAccount()`)\n * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n */\n function sendCrossDomainMessage(\n address _crossDomainTarget,\n uint32 _gasLimit,\n bytes memory _message\n ) internal {\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n }\n}\n" + }, + "contracts/standards/IL2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface IL2StandardERC20 is IERC20, IERC165 {\n function l1Token() external returns (address);\n\n function mint(address _to, uint256 _amount) external;\n\n function burn(address _from, uint256 _amount) external;\n\n event Mint(address indexed _account, uint256 _amount);\n event Burn(address indexed _account, uint256 _amount);\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" + }, + "contracts/standards/L2StandardERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"./IL2StandardERC20.sol\";\n\ncontract L2StandardERC20 is IL2StandardERC20, ERC20 {\n address public l1Token;\n address public l2Bridge;\n\n /**\n * @param _l2Bridge Address of the L2 standard bridge.\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n constructor(\n address _l2Bridge,\n address _l1Token,\n string memory _name,\n string memory _symbol\n ) ERC20(_name, _symbol) {\n l1Token = _l1Token;\n l2Bridge = _l2Bridge;\n }\n\n modifier onlyL2Bridge() {\n require(msg.sender == l2Bridge, \"Only L2 Bridge can mint and burn\");\n _;\n }\n\n // slither-disable-next-line external-function\n function supportsInterface(bytes4 _interfaceId) public pure returns (bool) {\n bytes4 firstSupportedInterface = bytes4(keccak256(\"supportsInterface(bytes4)\")); // ERC165\n bytes4 secondSupportedInterface = IL2StandardERC20.l1Token.selector ^\n IL2StandardERC20.mint.selector ^\n IL2StandardERC20.burn.selector;\n return _interfaceId == firstSupportedInterface || _interfaceId == secondSupportedInterface;\n }\n\n // slither-disable-next-line external-function\n function mint(address _to, uint256 _amount) public virtual onlyL2Bridge {\n _mint(_to, _amount);\n\n emit Mint(_to, _amount);\n }\n\n // slither-disable-next-line external-function\n function burn(address _from, uint256 _amount) public virtual onlyL2Bridge {\n _burn(_from, _amount);\n\n emit Burn(_from, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `recipient` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * Requirements:\n *\n * - `sender` and `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n * - the caller must have allowance for ``sender``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n _transfer(sender, recipient, amount);\n\n uint256 currentAllowance = _allowances[sender][_msgSender()];\n require(currentAllowance >= amount, \"ERC20: transfer amount exceeds allowance\");\n unchecked {\n _approve(sender, _msgSender(), currentAllowance - amount);\n }\n\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n uint256 currentAllowance = _allowances[_msgSender()][spender];\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(_msgSender(), spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `sender` to `recipient`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `sender` cannot be the zero address.\n * - `recipient` cannot be the zero address.\n * - `sender` must have a balance of at least `amount`.\n */\n function _transfer(\n address sender,\n address recipient,\n uint256 amount\n ) internal virtual {\n require(sender != address(0), \"ERC20: transfer from the zero address\");\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(sender, recipient, amount);\n\n uint256 senderBalance = _balances[sender];\n require(senderBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[sender] = senderBalance - amount;\n }\n _balances[recipient] += amount;\n\n emit Transfer(sender, recipient, amount);\n\n _afterTokenTransfer(sender, recipient, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "contracts/L2/predeploys/OVM_ETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../standards/L2StandardERC20.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 */\ncontract OVM_ETH is L2StandardERC20 {\n /***************\n * Constructor *\n ***************/\n\n constructor()\n L2StandardERC20(Lib_PredeployAddresses.L2_STANDARD_BRIDGE, address(0), \"Ether\", \"ETH\")\n {}\n\n // ETH ERC20 features are disabled until further notice.\n // Discussion here: https://github.com/ethereum-optimism/optimism/discussions/1444\n\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n revert(\"OVM_ETH: transfer is disabled pending further community discussion.\");\n }\n\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n revert(\"OVM_ETH: approve is disabled pending further community discussion.\");\n }\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) public virtual override returns (bool) {\n revert(\"OVM_ETH: transferFrom is disabled pending further community discussion.\");\n }\n\n function increaseAllowance(address spender, uint256 addedValue)\n public\n virtual\n override\n returns (bool)\n {\n revert(\"OVM_ETH: increaseAllowance is disabled pending further community discussion.\");\n }\n\n function decreaseAllowance(address spender, uint256 subtractedValue)\n public\n virtual\n override\n returns (bool)\n {\n revert(\"OVM_ETH: decreaseAllowance is disabled pending further community discussion.\");\n }\n}\n" + }, + "contracts/L2/teleportr/TeleportrDisburser.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.9;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title TeleportrDisburser\n */\ncontract TeleportrDisburser is Ownable {\n /**\n * @notice A struct holding the address and amount to disbursement.\n */\n struct Disbursement {\n uint256 amount;\n address addr;\n }\n\n /// The total number of disbursements processed.\n uint256 public totalDisbursements;\n\n /**\n * @notice Emitted any time the balance is withdrawn by the owner.\n * @param owner The current owner and recipient of the funds.\n * @param balance The current contract balance paid to the owner.\n */\n event BalanceWithdrawn(address indexed owner, uint256 balance);\n\n /**\n * @notice Emitted any time a disbursement is successfuly sent.\n * @param depositId The unique sequence number identifying the deposit.\n * @param to The recipient of the disbursement.\n * @param amount The amount sent to the recipient.\n */\n event DisbursementSuccess(uint256 indexed depositId, address indexed to, uint256 amount);\n\n /**\n * @notice Emitted any time a disbursement fails to send.\n * @param depositId The unique sequence number identifying the deposit.\n * @param to The intended recipient of the disbursement.\n * @param amount The amount intended to be sent to the recipient.\n */\n event DisbursementFailed(uint256 indexed depositId, address indexed to, uint256 amount);\n\n /**\n * @notice Initializes a new TeleportrDisburser contract.\n */\n constructor() {\n totalDisbursements = 0;\n }\n\n /**\n * @notice Accepts a list of Disbursements and forwards the amount paid to\n * the contract to each recipient. The method reverts if there are zero\n * disbursements, the total amount to forward differs from the amount sent\n * in the transaction, or the _nextDepositId is unexpected. Failed\n * disbursements will not cause the method to revert, but will instead be\n * held by the contract and availabe for the owner to withdraw.\n * @param _nextDepositId The depositId of the first Dispursement.\n * @param _disbursements A list of Disbursements to process.\n */\n function disburse(uint256 _nextDepositId, Disbursement[] calldata _disbursements)\n external\n payable\n onlyOwner\n {\n // Ensure there are disbursements to process.\n uint256 _numDisbursements = _disbursements.length;\n require(_numDisbursements > 0, \"No disbursements\");\n\n // Ensure the _nextDepositId matches our expected value.\n uint256 _depositId = totalDisbursements;\n require(_depositId == _nextDepositId, \"Unexpected next deposit id\");\n unchecked {\n totalDisbursements += _numDisbursements;\n }\n\n // Ensure the amount sent in the transaction is equal to the sum of the\n // disbursements.\n uint256 _totalDisbursed = 0;\n for (uint256 i = 0; i < _numDisbursements; i++) {\n _totalDisbursed += _disbursements[i].amount;\n }\n require(_totalDisbursed == msg.value, \"Disbursement total != amount sent\");\n\n // Process disbursements.\n for (uint256 i = 0; i < _numDisbursements; i++) {\n uint256 _amount = _disbursements[i].amount;\n address _addr = _disbursements[i].addr;\n\n // Deliver the dispursement amount to the receiver. If the\n // disbursement fails, the amount will be kept by the contract\n // rather than reverting to prevent blocking progress on other\n // disbursements.\n\n // slither-disable-next-line calls-loop,reentrancy-events\n (bool success, ) = _addr.call{ value: _amount, gas: 2300 }(\"\");\n if (success) emit DisbursementSuccess(_depositId, _addr, _amount);\n else emit DisbursementFailed(_depositId, _addr, _amount);\n\n unchecked {\n _depositId += 1;\n }\n }\n }\n\n /**\n * @notice Sends the contract's current balance to the owner.\n */\n function withdrawBalance() external onlyOwner {\n address _owner = owner();\n uint256 balance = address(this).balance;\n emit BalanceWithdrawn(_owner, balance);\n payable(_owner).transfer(balance);\n }\n}\n" + }, + "contracts/L2/predeploys/OVM_GasPriceOracle.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* External Imports */\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title OVM_GasPriceOracle\n * @dev This contract exposes the current l2 gas price, a measure of how congested the network\n * currently is. This measure is used by the Sequencer to determine what fee to charge for\n * transactions. When the system is more congested, the l2 gas price will increase and fees\n * will also increase as a result.\n *\n * All public variables are set while generating the initial L2 state. The\n * constructor doesn't run in practice as the L2 state generation script uses\n * the deployed bytecode instead of running the initcode.\n */\ncontract OVM_GasPriceOracle is Ownable {\n /*************\n * Variables *\n *************/\n\n // Current L2 gas price\n uint256 public gasPrice;\n // Current L1 base fee\n uint256 public l1BaseFee;\n // Amortized cost of batch submission per transaction\n uint256 public overhead;\n // Value to scale the fee up by\n uint256 public scalar;\n // Number of decimals of the scalar\n uint256 public decimals;\n\n /***************\n * Constructor *\n ***************/\n\n /**\n * @param _owner Address that will initially own this contract.\n */\n constructor(address _owner) Ownable() {\n transferOwnership(_owner);\n }\n\n /**********\n * Events *\n **********/\n\n event GasPriceUpdated(uint256);\n event L1BaseFeeUpdated(uint256);\n event OverheadUpdated(uint256);\n event ScalarUpdated(uint256);\n event DecimalsUpdated(uint256);\n\n /********************\n * Public Functions *\n ********************/\n\n /**\n * Allows the owner to modify the l2 gas price.\n * @param _gasPrice New l2 gas price.\n */\n // slither-disable-next-line external-function\n function setGasPrice(uint256 _gasPrice) public onlyOwner {\n gasPrice = _gasPrice;\n emit GasPriceUpdated(_gasPrice);\n }\n\n /**\n * Allows the owner to modify the l1 base fee.\n * @param _baseFee New l1 base fee\n */\n // slither-disable-next-line external-function\n function setL1BaseFee(uint256 _baseFee) public onlyOwner {\n l1BaseFee = _baseFee;\n emit L1BaseFeeUpdated(_baseFee);\n }\n\n /**\n * Allows the owner to modify the overhead.\n * @param _overhead New overhead\n */\n // slither-disable-next-line external-function\n function setOverhead(uint256 _overhead) public onlyOwner {\n overhead = _overhead;\n emit OverheadUpdated(_overhead);\n }\n\n /**\n * Allows the owner to modify the scalar.\n * @param _scalar New scalar\n */\n // slither-disable-next-line external-function\n function setScalar(uint256 _scalar) public onlyOwner {\n scalar = _scalar;\n emit ScalarUpdated(_scalar);\n }\n\n /**\n * Allows the owner to modify the decimals.\n * @param _decimals New decimals\n */\n // slither-disable-next-line external-function\n function setDecimals(uint256 _decimals) public onlyOwner {\n decimals = _decimals;\n emit DecimalsUpdated(_decimals);\n }\n\n /**\n * Computes the L1 portion of the fee\n * based on the size of the RLP encoded tx\n * and the current l1BaseFee\n * @param _data Unsigned RLP encoded tx, 6 elements\n * @return L1 fee that should be paid for the tx\n */\n // slither-disable-next-line external-function\n function getL1Fee(bytes memory _data) public view returns (uint256) {\n uint256 l1GasUsed = getL1GasUsed(_data);\n uint256 l1Fee = l1GasUsed * l1BaseFee;\n uint256 divisor = 10**decimals;\n uint256 unscaled = l1Fee * scalar;\n uint256 scaled = unscaled / divisor;\n return scaled;\n }\n\n // solhint-disable max-line-length\n /**\n * Computes the amount of L1 gas used for a transaction\n * The overhead represents the per batch gas overhead of\n * posting both transaction and state roots to L1 given larger\n * batch sizes.\n * 4 gas for 0 byte\n * https://github.com/ethereum/go-ethereum/blob/9ada4a2e2c415e6b0b51c50e901336872e028872/params/protocol_params.go#L33\n * 16 gas for non zero byte\n * https://github.com/ethereum/go-ethereum/blob/9ada4a2e2c415e6b0b51c50e901336872e028872/params/protocol_params.go#L87\n * This will need to be updated if calldata gas prices change\n * Account for the transaction being unsigned\n * Padding is added to account for lack of signature on transaction\n * 1 byte for RLP V prefix\n * 1 byte for V\n * 1 byte for RLP R prefix\n * 32 bytes for R\n * 1 byte for RLP S prefix\n * 32 bytes for S\n * Total: 68 bytes of padding\n * @param _data Unsigned RLP encoded tx, 6 elements\n * @return Amount of L1 gas used for a transaction\n */\n // solhint-enable max-line-length\n function getL1GasUsed(bytes memory _data) public view returns (uint256) {\n uint256 total = 0;\n for (uint256 i = 0; i < _data.length; i++) {\n if (_data[i] == 0) {\n total += 4;\n } else {\n total += 16;\n }\n }\n uint256 unsigned = total + overhead;\n return unsigned + (68 * 16);\n }\n}\n" + }, + "contracts/L1/teleportr/TeleportrDeposit.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.9;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title TeleportrDeposit\n *\n * Shout out to 0xclem for providing the inspiration for this contract:\n * https://github.com/0xclem/teleportr/blob/main/contracts/BridgeDeposit.sol\n */\ncontract TeleportrDeposit is Ownable {\n /// The minimum amount that be deposited in a receive.\n uint256 public minDepositAmount;\n /// The maximum amount that be deposited in a receive.\n uint256 public maxDepositAmount;\n /// The maximum balance the contract can hold after a receive.\n uint256 public maxBalance;\n /// The total number of successful deposits received.\n uint256 public totalDeposits;\n\n /**\n * @notice Emitted any time the minimum deposit amount is set.\n * @param previousAmount The previous minimum deposit amount.\n * @param newAmount The new minimum deposit amount.\n */\n event MinDepositAmountSet(uint256 previousAmount, uint256 newAmount);\n\n /**\n * @notice Emitted any time the maximum deposit amount is set.\n * @param previousAmount The previous maximum deposit amount.\n * @param newAmount The new maximum deposit amount.\n */\n event MaxDepositAmountSet(uint256 previousAmount, uint256 newAmount);\n\n /**\n * @notice Emitted any time the contract maximum balance is set.\n * @param previousBalance The previous maximum contract balance.\n * @param newBalance The new maximum contract balance.\n */\n event MaxBalanceSet(uint256 previousBalance, uint256 newBalance);\n\n /**\n * @notice Emitted any time the balance is withdrawn by the owner.\n * @param owner The current owner and recipient of the funds.\n * @param balance The current contract balance paid to the owner.\n */\n event BalanceWithdrawn(address indexed owner, uint256 balance);\n\n /**\n * @notice Emitted any time a successful deposit is received.\n * @param depositId A unique sequencer number identifying the deposit.\n * @param emitter The sending address of the payer.\n * @param amount The amount deposited by the payer.\n */\n event EtherReceived(uint256 indexed depositId, address indexed emitter, uint256 indexed amount);\n\n /**\n * @notice Initializes a new TeleportrDeposit contract.\n * @param _minDepositAmount The initial minimum deposit amount.\n * @param _maxDepositAmount The initial maximum deposit amount.\n * @param _maxBalance The initial maximum contract balance.\n */\n constructor(\n uint256 _minDepositAmount,\n uint256 _maxDepositAmount,\n uint256 _maxBalance\n ) {\n minDepositAmount = _minDepositAmount;\n maxDepositAmount = _maxDepositAmount;\n maxBalance = _maxBalance;\n totalDeposits = 0;\n emit MinDepositAmountSet(0, _minDepositAmount);\n emit MaxDepositAmountSet(0, _maxDepositAmount);\n emit MaxBalanceSet(0, _maxBalance);\n }\n\n /**\n * @notice Accepts deposits that will be disbursed to the sender's address on L2.\n * The method reverts if the amount is less than the current\n * minDepositAmount, the amount is greater than the current\n * maxDepositAmount, or the amount causes the contract to exceed its maximum\n * allowed balance.\n */\n receive() external payable {\n require(msg.value >= minDepositAmount, \"Deposit amount is too small\");\n require(msg.value <= maxDepositAmount, \"Deposit amount is too big\");\n require(address(this).balance <= maxBalance, \"Contract max balance exceeded\");\n\n emit EtherReceived(totalDeposits, msg.sender, msg.value);\n unchecked {\n totalDeposits += 1;\n }\n }\n\n /**\n * @notice Sends the contract's current balance to the owner.\n */\n function withdrawBalance() external onlyOwner {\n address _owner = owner();\n uint256 _balance = address(this).balance;\n emit BalanceWithdrawn(_owner, _balance);\n payable(_owner).transfer(_balance);\n }\n\n /**\n * @notice Sets the minimum amount that can be deposited in a receive.\n * @param _minDepositAmount The new minimum deposit amount.\n */\n function setMinAmount(uint256 _minDepositAmount) external onlyOwner {\n emit MinDepositAmountSet(minDepositAmount, _minDepositAmount);\n minDepositAmount = _minDepositAmount;\n }\n\n /**\n * @notice Sets the maximum amount that can be deposited in a receive.\n * @param _maxDepositAmount The new maximum deposit amount.\n */\n function setMaxAmount(uint256 _maxDepositAmount) external onlyOwner {\n emit MaxDepositAmountSet(maxDepositAmount, _maxDepositAmount);\n maxDepositAmount = _maxDepositAmount;\n }\n\n /**\n * @notice Sets the maximum balance the contract can hold after a receive.\n * @param _maxBalance The new maximum contract balance.\n */\n function setMaxBalance(uint256 _maxBalance) external onlyOwner {\n emit MaxBalanceSet(maxBalance, _maxBalance);\n maxBalance = _maxBalance;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\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 (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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) 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(\n address target,\n bytes memory data,\n uint256 value\n ) 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(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) 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 (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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal 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 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/L1/messaging/L1StandardBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IL1StandardBridge } from \"./IL1StandardBridge.sol\";\nimport { IL1ERC20Bridge } from \"./IL1ERC20Bridge.sol\";\nimport { IL2ERC20Bridge } from \"../../L2/messaging/IL2ERC20Bridge.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/* Library Imports */\nimport { CrossDomainEnabled } from \"../../libraries/bridge/CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * @title L1StandardBridge\n * @dev The L1 ETH and ERC20 Bridge is a contract which stores deposited L1 funds and standard\n * tokens that are in use on L2. It synchronizes a corresponding L2 Bridge, informing it of deposits\n * and listening to it for newly finalized withdrawals.\n *\n */\ncontract L1StandardBridge is IL1StandardBridge, CrossDomainEnabled {\n using SafeERC20 for IERC20;\n\n /********************************\n * External Contract References *\n ********************************/\n\n address public l2TokenBridge;\n\n // Maps L1 token to L2 token to balance of the L1 token deposited\n mapping(address => mapping(address => uint256)) public deposits;\n\n /***************\n * Constructor *\n ***************/\n\n // This contract lives behind a proxy, so the constructor parameters will go unused.\n constructor() CrossDomainEnabled(address(0)) {}\n\n /******************\n * Initialization *\n ******************/\n\n /**\n * @param _l1messenger L1 Messenger address being used for cross-chain communications.\n * @param _l2TokenBridge L2 standard bridge address.\n */\n // slither-disable-next-line external-function\n function initialize(address _l1messenger, address _l2TokenBridge) public {\n require(messenger == address(0), \"Contract has already been initialized.\");\n messenger = _l1messenger;\n l2TokenBridge = _l2TokenBridge;\n }\n\n /**************\n * Depositing *\n **************/\n\n /** @dev Modifier requiring sender to be EOA. This check could be bypassed by a malicious\n * contract via initcode, but it takes care of the user error we want to avoid.\n */\n modifier onlyEOA() {\n // Used to stop deposits from contracts (avoid accidentally lost tokens)\n require(!Address.isContract(msg.sender), \"Account not EOA\");\n _;\n }\n\n /**\n * @dev This function can be called with no data\n * to deposit an amount of ETH to the caller's balance on L2.\n * Since the receive function doesn't take data, a conservative\n * default amount is forwarded to L2.\n */\n receive() external payable onlyEOA {\n _initiateETHDeposit(msg.sender, msg.sender, 200_000, bytes(\"\"));\n }\n\n /**\n * @inheritdoc IL1StandardBridge\n */\n function depositETH(uint32 _l2Gas, bytes calldata _data) external payable onlyEOA {\n _initiateETHDeposit(msg.sender, msg.sender, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc IL1StandardBridge\n */\n function depositETHTo(\n address _to,\n uint32 _l2Gas,\n bytes calldata _data\n ) external payable {\n _initiateETHDeposit(msg.sender, _to, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by storing the ETH and informing the L2 ETH Gateway of\n * the deposit.\n * @param _from Account to pull the deposit from on L1.\n * @param _to Account to give the deposit to on L2.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateETHDeposit(\n address _from,\n address _to,\n uint32 _l2Gas,\n bytes memory _data\n ) internal {\n // Construct calldata for finalizeDeposit call\n bytes memory message = abi.encodeWithSelector(\n IL2ERC20Bridge.finalizeDeposit.selector,\n address(0),\n Lib_PredeployAddresses.OVM_ETH,\n _from,\n _to,\n msg.value,\n _data\n );\n\n // Send calldata into L2\n // slither-disable-next-line reentrancy-events\n sendCrossDomainMessage(l2TokenBridge, _l2Gas, message);\n\n // slither-disable-next-line reentrancy-events\n emit ETHDepositInitiated(_from, _to, msg.value, _data);\n }\n\n /**\n * @inheritdoc IL1ERC20Bridge\n */\n function depositERC20(\n address _l1Token,\n address _l2Token,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external virtual onlyEOA {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, msg.sender, _amount, _l2Gas, _data);\n }\n\n /**\n * @inheritdoc IL1ERC20Bridge\n */\n function depositERC20To(\n address _l1Token,\n address _l2Token,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) external virtual {\n _initiateERC20Deposit(_l1Token, _l2Token, msg.sender, _to, _amount, _l2Gas, _data);\n }\n\n /**\n * @dev Performs the logic for deposits by informing the L2 Deposited Token\n * contract of the deposit and calling a handler to lock the L1 funds. (e.g. transferFrom)\n *\n * @param _l1Token Address of the L1 ERC20 we are depositing\n * @param _l2Token Address of the L1 respective L2 ERC20\n * @param _from Account to pull the deposit from on L1\n * @param _to Account to give the deposit to on L2\n * @param _amount Amount of the ERC20 to deposit.\n * @param _l2Gas Gas limit required to complete the deposit on L2.\n * @param _data Optional data to forward to L2. This data is provided\n * solely as a convenience for external contracts. Aside from enforcing a maximum\n * length, these contracts provide no guarantees about its content.\n */\n function _initiateERC20Deposit(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n uint32 _l2Gas,\n bytes calldata _data\n ) internal {\n // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future\n // withdrawals. safeTransferFrom also checks if the contract has code, so this will fail if\n // _from is an EOA or address(0).\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);\n\n // Construct calldata for _l2Token.finalizeDeposit(_to, _amount)\n bytes memory message = abi.encodeWithSelector(\n IL2ERC20Bridge.finalizeDeposit.selector,\n _l1Token,\n _l2Token,\n _from,\n _to,\n _amount,\n _data\n );\n\n // Send calldata into L2\n // slither-disable-next-line reentrancy-events, reentrancy-benign\n sendCrossDomainMessage(l2TokenBridge, _l2Gas, message);\n\n // slither-disable-next-line reentrancy-benign\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token] + _amount;\n\n // slither-disable-next-line reentrancy-events\n emit ERC20DepositInitiated(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*************************\n * Cross-chain Functions *\n *************************/\n\n /**\n * @inheritdoc IL1StandardBridge\n */\n function finalizeETHWithdrawal(\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external onlyFromCrossDomainAccount(l2TokenBridge) {\n // slither-disable-next-line reentrancy-events\n (bool success, ) = _to.call{ value: _amount }(new bytes(0));\n require(success, \"TransferHelper::safeTransferETH: ETH transfer failed\");\n\n // slither-disable-next-line reentrancy-events\n emit ETHWithdrawalFinalized(_from, _to, _amount, _data);\n }\n\n /**\n * @inheritdoc IL1ERC20Bridge\n */\n function finalizeERC20Withdrawal(\n address _l1Token,\n address _l2Token,\n address _from,\n address _to,\n uint256 _amount,\n bytes calldata _data\n ) external onlyFromCrossDomainAccount(l2TokenBridge) {\n deposits[_l1Token][_l2Token] = deposits[_l1Token][_l2Token] - _amount;\n\n // When a withdrawal is finalized on L1, the L1 Bridge transfers the funds to the withdrawer\n // slither-disable-next-line reentrancy-events\n IERC20(_l1Token).safeTransfer(_to, _amount);\n\n // slither-disable-next-line reentrancy-events\n emit ERC20WithdrawalFinalized(_l1Token, _l2Token, _from, _to, _amount, _data);\n }\n\n /*****************************\n * Temporary - Migrating ETH *\n *****************************/\n\n /**\n * @dev Adds ETH balance to the account. This is meant to allow for ETH\n * to be migrated from an old gateway to a new gateway.\n * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the\n * old contract\n */\n function donateETH() external payable {}\n}\n" + }, + "contracts/L2/messaging/L2StandardTokenFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Contract Imports */\nimport { L2StandardERC20 } from \"../../standards/L2StandardERC20.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/**\n * @title L2StandardTokenFactory\n * @dev Factory contract for creating standard L2 token representations of L1 ERC20s\n * compatible with and working on the standard bridge.\n */\ncontract L2StandardTokenFactory {\n event StandardL2TokenCreated(address indexed _l1Token, address indexed _l2Token);\n\n /**\n * @dev Creates an instance of the standard ERC20 token on L2.\n * @param _l1Token Address of the corresponding L1 token.\n * @param _name ERC20 name.\n * @param _symbol ERC20 symbol.\n */\n function createStandardL2Token(\n address _l1Token,\n string memory _name,\n string memory _symbol\n ) external {\n require(_l1Token != address(0), \"Must provide L1 token address\");\n\n L2StandardERC20 l2Token = new L2StandardERC20(\n Lib_PredeployAddresses.L2_STANDARD_BRIDGE,\n _l1Token,\n _name,\n _symbol\n );\n\n emit StandardL2TokenCreated(_l1Token, address(l2Token));\n }\n}\n" + }, + "contracts/test-libraries/bridge/TestLib_CrossDomainUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\n\n/**\n * @title TestLib_CrossDomainUtils\n */\nlibrary TestLib_CrossDomainUtils {\n function encodeXDomainCalldata(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public pure returns (bytes memory) {\n return\n Lib_CrossDomainUtils.encodeXDomainCalldata(_target, _sender, _message, _messageNonce);\n }\n}\n" + }, + "contracts/test-libraries/standards/TestLib_AddressAliasHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\n\n/**\n * @title TestLib_AddressAliasHelper\n */\ncontract TestLib_AddressAliasHelper {\n function applyL1ToL2Alias(address _address) public pure returns (address) {\n return AddressAliasHelper.applyL1ToL2Alias(_address);\n }\n\n function undoL1ToL2Alias(address _address) public pure returns (address) {\n return AddressAliasHelper.undoL1ToL2Alias(_address);\n }\n}\n" + }, + "contracts/test-libraries/trie/TestLib_SecureMerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_SecureMerkleTrie } from \"../../libraries/trie/Lib_SecureMerkleTrie.sol\";\n\n/**\n * @title TestLib_SecureMerkleTrie\n */\ncontract TestLib_SecureMerkleTrie {\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool) {\n return Lib_SecureMerkleTrie.verifyInclusionProof(_key, _value, _proof, _root);\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool, bytes memory) {\n return Lib_SecureMerkleTrie.get(_key, _proof, _root);\n }\n}\n" + }, + "contracts/test-libraries/trie/TestLib_MerkleTrie.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_MerkleTrie } from \"../../libraries/trie/Lib_MerkleTrie.sol\";\n\n/**\n * @title TestLib_MerkleTrie\n */\ncontract TestLib_MerkleTrie {\n function verifyInclusionProof(\n bytes memory _key,\n bytes memory _value,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool) {\n return Lib_MerkleTrie.verifyInclusionProof(_key, _value, _proof, _root);\n }\n\n function get(\n bytes memory _key,\n bytes memory _proof,\n bytes32 _root\n ) public pure returns (bool, bytes memory) {\n return Lib_MerkleTrie.get(_key, _proof, _root);\n }\n}\n" + }, + "contracts/test-libraries/rlp/TestLib_RLPWriter.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_RLPWriter } from \"../../libraries/rlp/Lib_RLPWriter.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_RLPWriter\n */\ncontract TestLib_RLPWriter {\n function writeBytes(bytes memory _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeBytes(_in);\n }\n\n function writeList(bytes[] memory _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeList(_in);\n }\n\n function writeString(string memory _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeString(_in);\n }\n\n function writeAddress(address _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeAddress(_in);\n }\n\n function writeUint(uint256 _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeUint(_in);\n }\n\n function writeBool(bool _in) public pure returns (bytes memory _out) {\n return Lib_RLPWriter.writeBool(_in);\n }\n\n function writeAddressWithTaintedMemory(address _in) public returns (bytes memory _out) {\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.8.9;\n\n// a test ERC20 token with an open mint function\ncontract TestERC20 {\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 => uint256) public balanceOf;\n mapping(address => mapping(address => uint256)) 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 + value;\n balanceOf[to] = balanceOf[to] + value;\n emit Transfer(address(0), to, value);\n }\n\n function _approve(\n address owner,\n address spender,\n uint256 value\n ) private {\n allowance[owner][spender] = value;\n emit Approval(owner, spender, value);\n }\n\n function _transfer(\n address from,\n address to,\n uint256 value\n ) private {\n balanceOf[from] = balanceOf[from] - value;\n balanceOf[to] = balanceOf[to] + 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(\n address from,\n address to,\n uint256 value\n ) external returns (bool) {\n if (allowance[from][msg.sender] != type(uint256).max) {\n allowance[from][msg.sender] = allowance[from][msg.sender] - value;\n }\n _transfer(from, to, value);\n return true;\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_BytesUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_BytesUtils } from \"../../libraries/utils/Lib_BytesUtils.sol\";\nimport { TestERC20 } from \"../../test-helpers/TestERC20.sol\";\n\n/**\n * @title TestLib_BytesUtils\n */\ncontract TestLib_BytesUtils {\n function concat(bytes memory _preBytes, bytes memory _postBytes)\n public\n pure\n returns (bytes memory)\n {\n return abi.encodePacked(_preBytes, _postBytes);\n }\n\n function slice(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) public pure returns (bytes memory) {\n return Lib_BytesUtils.slice(_bytes, _start, _length);\n }\n\n function toBytes32(bytes memory _bytes) public pure returns (bytes32) {\n return Lib_BytesUtils.toBytes32(_bytes);\n }\n\n function toUint256(bytes memory _bytes) public pure returns (uint256) {\n return Lib_BytesUtils.toUint256(_bytes);\n }\n\n function toNibbles(bytes memory _bytes) public pure returns (bytes memory) {\n return Lib_BytesUtils.toNibbles(_bytes);\n }\n\n function fromNibbles(bytes memory _bytes) public pure returns (bytes memory) {\n return Lib_BytesUtils.fromNibbles(_bytes);\n }\n\n function equal(bytes memory _bytes, bytes memory _other) public pure returns (bool) {\n return Lib_BytesUtils.equal(_bytes, _other);\n }\n\n function sliceWithTaintedMemory(\n bytes memory _bytes,\n uint256 _start,\n uint256 _length\n ) public returns (bytes memory) {\n new TestERC20();\n return Lib_BytesUtils.slice(_bytes, _start, _length);\n }\n}\n" + }, + "contracts/test-libraries/rlp/TestLib_RLPReader.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_RLPReader } from \"../../libraries/rlp/Lib_RLPReader.sol\";\n\n/**\n * @title TestLib_RLPReader\n */\ncontract TestLib_RLPReader {\n function readList(bytes memory _in) public pure returns (bytes[] memory) {\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(bytes memory _in) public pure returns (string memory) {\n return Lib_RLPReader.readString(_in);\n }\n\n function readBytes(bytes memory _in) public pure returns (bytes memory) {\n return Lib_RLPReader.readBytes(_in);\n }\n\n function readBytes32(bytes memory _in) public pure returns (bytes32) {\n return Lib_RLPReader.readBytes32(_in);\n }\n\n function readUint256(bytes memory _in) public pure returns (uint256) {\n return Lib_RLPReader.readUint256(_in);\n }\n\n function readBool(bytes memory _in) public pure returns (bool) {\n return Lib_RLPReader.readBool(_in);\n }\n\n function readAddress(bytes memory _in) public pure returns (address) {\n return Lib_RLPReader.readAddress(_in);\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_Bytes32Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_Bytes32Utils } from \"../../libraries/utils/Lib_Bytes32Utils.sol\";\n\n/**\n * @title TestLib_Byte32Utils\n */\ncontract TestLib_Bytes32Utils {\n function toBool(bytes32 _in) public pure returns (bool _out) {\n return Lib_Bytes32Utils.toBool(_in);\n }\n\n function fromBool(bool _in) public pure returns (bytes32 _out) {\n return Lib_Bytes32Utils.fromBool(_in);\n }\n\n function toAddress(bytes32 _in) public pure returns (address _out) {\n return Lib_Bytes32Utils.toAddress(_in);\n }\n\n function fromAddress(address _in) public pure returns (bytes32 _out) {\n return Lib_Bytes32Utils.fromAddress(_in);\n }\n}\n" + }, + "contracts/test-libraries/utils/TestLib_MerkleTree.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { Lib_MerkleTree } from \"../../libraries/utils/Lib_MerkleTree.sol\";\n\n/**\n * @title TestLib_MerkleTree\n */\ncontract TestLib_MerkleTree {\n function getMerkleRoot(bytes32[] memory _elements) public pure returns (bytes32) {\n return Lib_MerkleTree.getMerkleRoot(_elements);\n }\n\n function verify(\n bytes32 _root,\n bytes32 _leaf,\n uint256 _index,\n bytes32[] memory _siblings,\n uint256 _totalLeaves\n ) public pure returns (bool) {\n return Lib_MerkleTree.verify(_root, _leaf, _index, _siblings, _totalLeaves);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + }, + "libraries": {} + } +} \ No newline at end of file diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/453cf665b5e2b83b8253dcbd4b55e968.json b/packages/contracts/deployments/goerli-nightly/solcInputs/8e1d6ed52c0bdd4990c7a20b88a38f67.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/453cf665b5e2b83b8253dcbd4b55e968.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/8e1d6ed52c0bdd4990c7a20b88a38f67.json index 9204f0312b58..8c206bbf1e0b 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/453cf665b5e2b83b8253dcbd4b55e968.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/8e1d6ed52c0bdd4990c7a20b88a38f67.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/851ead2506cb170c280352cdcfc619e3.json b/packages/contracts/deployments/goerli-nightly/solcInputs/999646fff997914eb7b90b0ed773b33a.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/851ead2506cb170c280352cdcfc619e3.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/999646fff997914eb7b90b0ed773b33a.json index a10aa50a3338..2bddd4a6922a 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/851ead2506cb170c280352cdcfc619e3.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/999646fff997914eb7b90b0ed773b33a.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" @@ -246,14 +246,6 @@ "devdoc", "userdoc", "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", - "userdoc", - "devdoc", "userdoc" ], "": [ diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/ad04ab9565e42a9370aa7f055041028d.json b/packages/contracts/deployments/goerli-nightly/solcInputs/9b223da611bcb371fb03d40e6b1620c7.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/ad04ab9565e42a9370aa7f055041028d.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/9b223da611bcb371fb03d40e6b1620c7.json index 82dc637f14c3..f2d5e1bb582c 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/ad04ab9565e42a9370aa7f055041028d.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/9b223da611bcb371fb03d40e6b1620c7.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" diff --git a/packages/contracts/deployments/goerli-nightly/solcInputs/b4ecc4d6ec9067f0dc398c96f1aabdaf.json b/packages/contracts/deployments/goerli-nightly/solcInputs/d6c87ae3c9bb8c703d33a5e718b3cc75.json similarity index 99% rename from packages/contracts/deployments/goerli-nightly/solcInputs/b4ecc4d6ec9067f0dc398c96f1aabdaf.json rename to packages/contracts/deployments/goerli-nightly/solcInputs/d6c87ae3c9bb8c703d33a5e718b3cc75.json index 7dc1340f02c1..c9caddf1d93f 100644 --- a/packages/contracts/deployments/goerli-nightly/solcInputs/b4ecc4d6ec9067f0dc398c96f1aabdaf.json +++ b/packages/contracts/deployments/goerli-nightly/solcInputs/d6c87ae3c9bb8c703d33a5e718b3cc75.json @@ -116,7 +116,7 @@ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"../../libraries/bridge/ICrossDomainMessenger.sol\";\n\n/**\n * @title IL2CrossDomainMessenger\n */\ninterface IL2CrossDomainMessenger is ICrossDomainMessenger {\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/L2/messaging/L2CrossDomainMessenger.sol": { - "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Library Imports */\nimport { AddressAliasHelper } from \"../../standards/AddressAliasHelper.sol\";\nimport { Lib_CrossDomainUtils } from \"../../libraries/bridge/Lib_CrossDomainUtils.sol\";\nimport { Lib_DefaultValues } from \"../../libraries/constants/Lib_DefaultValues.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\n\n/* Interface Imports */\nimport { IL2CrossDomainMessenger } from \"./IL2CrossDomainMessenger.sol\";\nimport { iOVM_L2ToL1MessagePasser } from \"../predeploys/iOVM_L2ToL1MessagePasser.sol\";\n\n/**\n * @title 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 */\ncontract L2CrossDomainMessenger is IL2CrossDomainMessenger {\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 = Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER;\n address public l1CrossDomainMessenger;\n\n /***************\n * Constructor *\n ***************/\n\n constructor(address _l1CrossDomainMessenger) {\n l1CrossDomainMessenger = _l1CrossDomainMessenger;\n }\n\n /********************\n * Public Functions *\n ********************/\n\n // slither-disable-next-line external-function\n function xDomainMessageSender() public view returns (address) {\n require(\n xDomainMsgSender != Lib_DefaultValues.DEFAULT_XDOMAIN_SENDER,\n \"xDomainMessageSender is not set\"\n );\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 // slither-disable-next-line external-function\n function sendMessage(\n address _target,\n bytes memory _message,\n uint32 _gasLimit\n ) public {\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n msg.sender,\n _message,\n messageNonce\n );\n\n sentMessages[keccak256(xDomainCalldata)] = true;\n\n // Actually send the message.\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events\n iOVM_L2ToL1MessagePasser(Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER).passMessageToL1(\n xDomainCalldata\n );\n\n // Emit an event before we bump the nonce or the nonce will be off by one.\n // slither-disable-next-line reentrancy-events\n emit SentMessage(_target, msg.sender, _message, messageNonce, _gasLimit);\n // slither-disable-next-line reentrancy-no-eth\n messageNonce += 1;\n }\n\n /**\n * Relays a cross domain message to a contract.\n * @inheritdoc IL2CrossDomainMessenger\n */\n // slither-disable-next-line external-function\n function relayMessage(\n address _target,\n address _sender,\n bytes memory _message,\n uint256 _messageNonce\n ) public {\n // Since it is impossible to deploy a contract to an address on L2 which matches\n // the alias of the L1CrossDomainMessenger, this check can only pass when it is called in\n // the first call from of a deposit transaction. Thus reentrancy is prevented here.\n require(\n AddressAliasHelper.undoL1ToL2Alias(msg.sender) == l1CrossDomainMessenger,\n \"Provided message could not be verified.\"\n );\n\n bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(\n _target,\n _sender,\n _message,\n _messageNonce\n );\n\n bytes32 xDomainCalldataHash = keccak256(xDomainCalldata);\n\n require(\n successfulMessages[xDomainCalldataHash] == false,\n \"Provided message has already been received.\"\n );\n\n // Prevent calls to OVM_L2ToL1MessagePasser, which would enable\n // an attacker to maliciously craft the _message to spoof\n // a call from any L2 account.\n if (_target == Lib_PredeployAddresses.L2_TO_L1_MESSAGE_PASSER) {\n // Write to the successfulMessages mapping and return immediately.\n successfulMessages[xDomainCalldataHash] = true;\n return;\n }\n\n xDomainMsgSender = _sender;\n // slither-disable-next-line reentrancy-no-eth, reentrancy-events, reentrancy-benign\n (bool success, ) = _target.call(_message);\n // slither-disable-next-line reentrancy-benign\n xDomainMsgSender = Lib_DefaultValues.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 // slither-disable-next-line reentrancy-no-eth\n successfulMessages[xDomainCalldataHash] = true;\n // slither-disable-next-line reentrancy-events\n emit RelayedMessage(xDomainCalldataHash);\n } else {\n // slither-disable-next-line reentrancy-events\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(abi.encodePacked(xDomainCalldata, msg.sender, block.number));\n\n // slither-disable-next-line reentrancy-benign\n relayedMessages[relayId] = true;\n }\n}\n" }, "contracts/L2/predeploys/iOVM_L2ToL1MessagePasser.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title iOVM_L2ToL1MessagePasser\n */\ninterface iOVM_L2ToL1MessagePasser {\n /**********\n * Events *\n **********/\n\n event L2ToL1Message(uint256 _nonce, address _sender, bytes _data);\n\n /********************\n * Public Functions *\n ********************/\n\n function passMessageToL1(bytes calldata _message) external;\n}\n" diff --git a/packages/contracts/genesis/goerli-nightly.json b/packages/contracts/genesis/goerli-nightly.json index b10c767a81a7..1be6b4680796 100644 --- a/packages/contracts/genesis/goerli-nightly.json +++ b/packages/contracts/genesis/goerli-nightly.json @@ -1,5 +1,5 @@ { - "commit": "1df934a14dc8567ead5e50b4652f075fe1fe9a08", + "commit": "12bee3fe71514e64291fda96783288c2312e35d8", "config": { "chainId": 421, "homesteadBlock": 0, @@ -37,10 +37,10 @@ "balance": "00", "storage": { "0x0000000000000000000000000000000000000000000000000000000000000004": "0x000000000000000000000000000000000000000000000000000000000000dead", - "0x0000000000000000000000000000000000000000000000000000000000000005": "0x00000000000000000000000084a374c4082252fcec215c242513c15551b15976", + "0x0000000000000000000000000000000000000000000000000000000000000005": "0x000000000000000000000000497cdd0f36b3d3012c1fea605332e77e942c494a", "0x0000000000000000000000000000000000000000000000000000000000000003": "0x00000000000000000000000000000000000000000000000000000000000186a0" }, - "code": "0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063a71198691161005b578063a71198691461012a578063b1b1b2091461014a578063cbd4ece91461016d578063ecc704281461018057600080fd5b806321d800ec1461008d5780633dbb202b146100c55780636e296e45146100da57806382e3702d14610107575b600080fd5b6100b061009b366004610826565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6100d86100d3366004610942565b610197565b005b6100e26102e2565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100bc565b6100b0610115366004610826565b60026020526000908152604090205460ff1681565b6005546100e29073ffffffffffffffffffffffffffffffffffffffff1681565b6100b0610158366004610826565b60016020526000908152604090205460ff1681565b6100d861017b3660046109ad565b61038b565b61018960035481565b6040519081526020016100bc565b60006101a784338560035461078d565b80516020808301919091206000908152600290915260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517fcafa81dc0000000000000000000000000000000000000000000000000000000081529091507342000000000000000000000000000000000000009063cafa81dc9061023c908490600401610a89565b600060405180830381600087803b15801561025657600080fd5b505af115801561026a573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff167fcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a3385600354866040516102bc9493929190610aa3565b60405180910390a26001600360008282546102d79190610aef565b909155505050505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff1661dead141561036e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f78446f6d61696e4d65737361676553656e646572206973206e6f74207365740060448201526064015b60405180910390fd5b5060045473ffffffffffffffffffffffffffffffffffffffff1690565b60055473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff161461046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f50726f7669646564206d65737361676520636f756c64206e6f7420626520766560448201527f7269666965642e000000000000000000000000000000000000000000000000006064820152608401610365565b60006104788585858561078d565b8051602080830191909120600081815260019092526040909120549192509060ff1615610527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f50726f7669646564206d6573736167652068617320616c72656164792062656560448201527f6e2072656365697665642e0000000000000000000000000000000000000000006064820152608401610365565b73ffffffffffffffffffffffffffffffffffffffff8616734200000000000000000000000000000000000000141561059957600090815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909117905550610787565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff878116919091179091556040516000918816906105f2908790610b2e565b6000604051808303816000865af19150503d806000811461062f576040519150601f19603f3d011682016040523d82523d6000602084013e610634565b606091505b5050600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead1790559050801515600114156106d557600082815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555183917f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c91a2610701565b60405182907f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f90600090a25b600083334360405160200161071893929190610b4a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181528151602092830120600090815291829052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055505050505b50505050565b6060848484846040516024016107a69493929190610b9c565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fcbd4ece9000000000000000000000000000000000000000000000000000000001790529050949350505050565b60006020828403121561083857600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086357600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126108a857600080fd5b813567ffffffffffffffff808211156108c3576108c3610868565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561090957610909610868565b8160405283815286602085880101111561092257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561095757600080fd5b6109608461083f565b9250602084013567ffffffffffffffff81111561097c57600080fd5b61098886828701610897565b925050604084013563ffffffff811681146109a257600080fd5b809150509250925092565b600080600080608085870312156109c357600080fd5b6109cc8561083f565b93506109da6020860161083f565b9250604085013567ffffffffffffffff8111156109f657600080fd5b610a0287828801610897565b949793965093946060013593505050565b60005b83811015610a2e578181015183820152602001610a16565b838111156107875750506000910152565b60008151808452610a57816020860160208601610a13565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610a9c6020830184610a3f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201526000610ad26080830186610a3f565b905083604083015263ffffffff8316606083015295945050505050565b60008219821115610b29577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b60008251610b40818460208701610a13565b9190910192915050565b60008451610b5c818460208901610a13565b60609490941b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001691909301908152601481019190915260340192915050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525060806040830152610bd56080830185610a3f565b90508260608301529594505050505056fea2646970667358221220b811ce81cf7c8e6c3f95fd409f5df45ff3657ba48c1021d318de2a78cd45af6264736f6c63430008090033" + "code": "0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063a71198691161005b578063a71198691461012a578063b1b1b2091461014a578063cbd4ece91461016d578063ecc704281461018057600080fd5b806321d800ec1461008d5780633dbb202b146100c55780636e296e45146100da57806382e3702d14610107575b600080fd5b6100b061009b366004610826565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6100d86100d3366004610942565b610197565b005b6100e26102e2565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100bc565b6100b0610115366004610826565b60026020526000908152604090205460ff1681565b6005546100e29073ffffffffffffffffffffffffffffffffffffffff1681565b6100b0610158366004610826565b60016020526000908152604090205460ff1681565b6100d861017b3660046109ad565b61038b565b61018960035481565b6040519081526020016100bc565b60006101a784338560035461078d565b80516020808301919091206000908152600290915260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055517fcafa81dc0000000000000000000000000000000000000000000000000000000081529091507342000000000000000000000000000000000000009063cafa81dc9061023c908490600401610a89565b600060405180830381600087803b15801561025657600080fd5b505af115801561026a573d6000803e3d6000fd5b505050508373ffffffffffffffffffffffffffffffffffffffff167fcb0f7ffd78f9aee47a248fae8db181db6eee833039123e026dcbff529522e52a3385600354866040516102bc9493929190610aa3565b60405180910390a26001600360008282546102d79190610aef565b909155505050505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff1661dead141561036e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f78446f6d61696e4d65737361676553656e646572206973206e6f74207365740060448201526064015b60405180910390fd5b5060045473ffffffffffffffffffffffffffffffffffffffff1690565b60055473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffeeeeffffffffffffffffffffffffffffffffeeef330173ffffffffffffffffffffffffffffffffffffffff161461046a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f50726f7669646564206d65737361676520636f756c64206e6f7420626520766560448201527f7269666965642e000000000000000000000000000000000000000000000000006064820152608401610365565b60006104788585858561078d565b8051602080830191909120600081815260019092526040909120549192509060ff1615610527576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f50726f7669646564206d6573736167652068617320616c72656164792062656560448201527f6e2072656365697665642e0000000000000000000000000000000000000000006064820152608401610365565b73ffffffffffffffffffffffffffffffffffffffff8616734200000000000000000000000000000000000000141561059957600090815260016020819052604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909117905550610787565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff878116919091179091556040516000918816906105f2908790610b2e565b6000604051808303816000865af19150503d806000811461062f576040519150601f19603f3d011682016040523d82523d6000602084013e610634565b606091505b5050600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001661dead1790559050801515600114156106d557600082815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169092179091555183917f4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c91a2610701565b60405182907f99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f90600090a25b600083334360405160200161071893929190610b4a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181528151602092830120600090815291829052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055505050505b50505050565b6060848484846040516024016107a69493929190610b9c565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fcbd4ece9000000000000000000000000000000000000000000000000000000001790529050949350505050565b60006020828403121561083857600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461086357600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126108a857600080fd5b813567ffffffffffffffff808211156108c3576108c3610868565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561090957610909610868565b8160405283815286602085880101111561092257600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060006060848603121561095757600080fd5b6109608461083f565b9250602084013567ffffffffffffffff81111561097c57600080fd5b61098886828701610897565b925050604084013563ffffffff811681146109a257600080fd5b809150509250925092565b600080600080608085870312156109c357600080fd5b6109cc8561083f565b93506109da6020860161083f565b9250604085013567ffffffffffffffff8111156109f657600080fd5b610a0287828801610897565b949793965093946060013593505050565b60005b83811015610a2e578181015183820152602001610a16565b838111156107875750506000910152565b60008151808452610a57816020860160208601610a13565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610a9c6020830184610a3f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff85168152608060208201526000610ad26080830186610a3f565b905083604083015263ffffffff8316606083015295945050505050565b60008219821115610b29577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b500190565b60008251610b40818460208701610a13565b9190910192915050565b60008451610b5c818460208901610a13565b60609490941b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001691909301908152601481019190915260340192915050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525060806040830152610bd56080830185610a3f565b90508260608301529594505050505056fea26469706673582212200afb9537c52292543adecf37773b8e4d795c984adf4e80970731e434679b4ec264736f6c63430008090033" }, "0x420000000000000000000000000000000000000F": { "balance": "00", @@ -57,7 +57,7 @@ "0x4200000000000000000000000000000000000010": { "balance": "00", "storage": { - "0x0000000000000000000000000000000000000000000000000000000000000001": "0x000000000000000000000000e352dde5d101bb422f78c3ed77f2cd8f0b9b0f82", + "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000004600216a9c733658a48ef83ad218ba221514894e", "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000004200000000000000000000000000000000000007" }, "code": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80633cb747bf116100505780633cb747bf146100ca578063662a633a146100ea578063a3a79548146100fd57600080fd5b806332b7006d1461006c57806336c717c114610081575b600080fd5b61007f61007a366004610d0f565b610110565b005b6001546100a19073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000546100a19073ffffffffffffffffffffffffffffffffffffffff1681565b61007f6100f8366004610d80565b610126565b61007f61010b366004610e18565b6106c1565b61011f853333878787876106d8565b5050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1661015e60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461021d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f4f564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201527f6e61757468656e7469636174656400000000000000000000000000000000000060648201526084015b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1661025360005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561029857600080fd5b505afa1580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d09190610e9b565b73ffffffffffffffffffffffffffffffffffffffff1614610373576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f4f564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201527f732d646f6d61696e206d657373616765000000000000000000000000000000006064820152608401610214565b61039d877f1d1d8b6300000000000000000000000000000000000000000000000000000000610a32565b801561045357508673ffffffffffffffffffffffffffffffffffffffff1663c01e1bd66040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156103ec57600080fd5b505af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190610e9b565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16145b15610567576040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152602482018690528816906340c10f1990604401600060405180830381600087803b1580156104c857600080fd5b505af11580156104dc573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fb0444523268717a02698be47d0803aa7468c00acbed2f8bd93a0459cde61dd898888888860405161055a9493929190610f08565b60405180910390a46106b7565b600063a9f9e67560e01b8989888a89898960405160240161058e9796959493929190610f3e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001549091506106339073ffffffffffffffffffffffffffffffffffffffff16600083610a57565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167f7ea89a4591614515571c2b51f5ea06494056f261c10ab1ed8c03c7590d87bce0898989896040516106ad9493929190610f08565b60405180910390a4505b5050505050505050565b6106d0863387878787876106d8565b505050505050565b6040517f9dc29fac0000000000000000000000000000000000000000000000000000000081523360048201526024810185905273ffffffffffffffffffffffffffffffffffffffff881690639dc29fac90604401600060405180830381600087803b15801561074657600080fd5b505af115801561075a573d6000803e3d6000fd5b5050505060008773ffffffffffffffffffffffffffffffffffffffff1663c01e1bd66040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156107a857600080fd5b505af11580156107bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e09190610e9b565b9050606073ffffffffffffffffffffffffffffffffffffffff891673deaddeaddeaddeaddeaddeaddeaddeaddead000014156108d5576040517f1532ec340000000000000000000000000000000000000000000000000000000090610851908a908a908a9089908990602401610f9b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050610994565b6040517fa9f9e67500000000000000000000000000000000000000000000000000000000906109149084908c908c908c908c908b908b90602401610f3e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290505b6001546109b89073ffffffffffffffffffffffffffffffffffffffff168683610a57565b3373ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f73d170910aba9e6d50b102db522b1dbcd796216f5128b445aa2135272886497e8a8a89896040516106ad9493929190610f08565b6000610a3d83610ae8565b8015610a4e5750610a4e8383610b4c565b90505b92915050565b6000546040517f3dbb202b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633dbb202b90610ab190869085908790600401611016565b600060405180830381600087803b158015610acb57600080fd5b505af1158015610adf573d6000803e3d6000fd5b50505050505050565b6000610b14827f01ffc9a700000000000000000000000000000000000000000000000000000000610b4c565b8015610a515750610b45827fffffffff00000000000000000000000000000000000000000000000000000000610b4c565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790529051600091908290819073ffffffffffffffffffffffffffffffffffffffff87169061753090610c06908690611092565b6000604051808303818686fa925050503d8060008114610c42576040519150601f19603f3d011682016040523d82523d6000602084013e610c47565b606091505b5091509150602081511015610c625760009350505050610a51565b818015610c7e575080806020019051810190610c7e91906110ae565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610caa57600080fd5b50565b803563ffffffff81168114610cc157600080fd5b919050565b60008083601f840112610cd857600080fd5b50813567ffffffffffffffff811115610cf057600080fd5b602083019150836020828501011115610d0857600080fd5b9250929050565b600080600080600060808688031215610d2757600080fd5b8535610d3281610c88565b945060208601359350610d4760408701610cad565b9250606086013567ffffffffffffffff811115610d6357600080fd5b610d6f88828901610cc6565b969995985093965092949392505050565b600080600080600080600060c0888a031215610d9b57600080fd5b8735610da681610c88565b96506020880135610db681610c88565b95506040880135610dc681610c88565b94506060880135610dd681610c88565b93506080880135925060a088013567ffffffffffffffff811115610df957600080fd5b610e058a828b01610cc6565b989b979a50959850939692959293505050565b60008060008060008060a08789031215610e3157600080fd5b8635610e3c81610c88565b95506020870135610e4c81610c88565b945060408701359350610e6160608801610cad565b9250608087013567ffffffffffffffff811115610e7d57600080fd5b610e8989828a01610cc6565b979a9699509497509295939492505050565b600060208284031215610ead57600080fd5b8151610eb881610c88565b9392505050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff85168152836020820152606060408201526000610c7e606083018486610ebf565b600073ffffffffffffffffffffffffffffffffffffffff808a1683528089166020840152808816604084015280871660608401525084608083015260c060a0830152610f8e60c083018486610ebf565b9998505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808816835280871660208401525084604083015260806060830152610fdb608083018486610ebf565b979650505050505050565b60005b83811015611001578181015183820152602001610fe9565b83811115611010576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff841681526060602082015260008351806060840152611051816080850160208801610fe6565b63ffffffff93909316604083015250601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160160800192915050565b600082516110a4818460208701610fe6565b9190910192915050565b6000602082840312156110c057600080fd5b81518015158114610eb857600080fdfea2646970667358221220df892c82e9ba0fc965240aa38614ff1bd6af4d227ce2c0e9933d7f50711a886264736f6c63430008090033"