Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StateCommitmentChain
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Library Imports */ import {Lib_BVMCodec} from "../../libraries/codec/Lib_BVMCodec.sol"; import {Lib_AddressResolver} from "../../libraries/resolver/Lib_AddressResolver.sol"; import {Lib_MerkleTree} from "../../libraries/utils/Lib_MerkleTree.sol"; import {CrossDomainEnabled} from "../../libraries/bridge/CrossDomainEnabled.sol"; /* Interface Imports */ import {IStateCommitmentChain} from "./IStateCommitmentChain.sol"; import {ICanonicalTransactionChain} from "./ICanonicalTransactionChain.sol"; import {IBondManager} from "../verification/IBondManager.sol"; import {IChainStorageContainer} from "./IChainStorageContainer.sol"; import {ITssGroupManager} from "../tss/ITssGroupManager.sol"; import {ITssRewardContract} from "../../L2/predeploys/iTssRewardContract.sol"; /** * @title StateCommitmentChain * @dev 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. * */ contract StateCommitmentChain is IStateCommitmentChain, Lib_AddressResolver, CrossDomainEnabled { /************* * Constants * *************/ uint256 public FRAUD_PROOF_WINDOW; uint256 public SEQUENCER_PUBLISH_WINDOW; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Address Manager. */ constructor( address _libAddressManager, address _l1messenger, uint256 _fraudProofWindow, uint256 _sequencerPublishWindow ) Lib_AddressResolver(_libAddressManager) CrossDomainEnabled(address(0)) { messenger = _l1messenger; FRAUD_PROOF_WINDOW = _fraudProofWindow; SEQUENCER_PUBLISH_WINDOW = _sequencerPublishWindow; } function setFraudProofWindow(uint256 _fraudProofWindow) public { require(msg.sender == libAddressManager.owner(), "Only callable by the libAddressManager owner."); FRAUD_PROOF_WINDOW = _fraudProofWindow; } function getFraudProofWindow() public view returns (uint256 _fraudProofWindow) { return uint256(FRAUD_PROOF_WINDOW); } /******************** * Public Functions * ********************/ /** * Accesses the batch storage container. * @return Reference to the batch storage container. */ function batches() public view returns (IChainStorageContainer) { return IChainStorageContainer(resolve("ChainStorageContainer-SCC-batches")); } /** * @inheritdoc IStateCommitmentChain */ function getTotalElements() public view returns (uint256 _totalElements) { (uint40 totalElements,) = _getBatchExtraData(); return uint256(totalElements); } /** * @inheritdoc IStateCommitmentChain */ function getTotalBatches() public view returns (uint256 _totalBatches) { return batches().length(); } /** * @inheritdoc IStateCommitmentChain */ // slither-disable-next-line external-function function getLastSequencerTimestamp() public view returns (uint256 _lastSequencerTimestamp) { (, uint40 lastSequencerTimestamp) = _getBatchExtraData(); return uint256(lastSequencerTimestamp); } /** * @inheritdoc IStateCommitmentChain */ // slither-disable-next-line external-function function appendStateBatch(bytes32[] memory _batch, uint256 _shouldStartAtElement, bytes memory _signature) public { // Fail fast in to make sure our batch roots aren't accidentally made fraudulent by the // publication of batches by some other user. require( _shouldStartAtElement == getTotalElements(), "Actual batch start index does not match expected start index." ); // Proposers must have previously staked at the BondManager require( IBondManager(resolve("BondManager")).isCollateralized(msg.sender), "Proposer does not have enough collateral posted" ); require(_batch.length > 0, "Cannot submit an empty state batch."); require( getTotalElements() + _batch.length <= ICanonicalTransactionChain(resolve("CanonicalTransactionChain")).getTotalElements(), "Number of state roots cannot exceed the number of canonical transactions." ); // Call tss group register contract to verify the signature _checkClusterSignature(_batch, _shouldStartAtElement, _signature); // Pass the block's timestamp and the publisher of the data // to be used in the fraud proofs _appendBatch(_batch, _signature, abi.encode(block.timestamp, msg.sender)); // Update distributed state batch, and emit message _distributeTssReward(_batch.length, _shouldStartAtElement); } /** * @inheritdoc IStateCommitmentChain */ // slither-disable-next-line external-function function deleteStateBatch(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) public { require( msg.sender == resolve("BVM_FraudVerifier"), "State batches can only be deleted by the BVM_FraudVerifier." ); require(_isValidBatchHeader(_batchHeader), "Invalid batch header."); require( insideFraudProofWindow(_batchHeader), "State batches can only be deleted within the fraud proof window." ); _deleteBatch(_batchHeader); } /** * @inheritdoc IStateCommitmentChain */ // slither-disable-next-line external-function function verifyStateCommitment( bytes32 _element, Lib_BVMCodec.ChainBatchHeader memory _batchHeader, Lib_BVMCodec.ChainInclusionProof memory _proof ) public view returns (bool) { require(_isValidBatchHeader(_batchHeader), "Invalid batch header."); require( Lib_MerkleTree.verify( _batchHeader.batchRoot, _element, _proof.index, _proof.siblings, _batchHeader.batchSize ), "Invalid inclusion proof." ); return true; } /** * @inheritdoc IStateCommitmentChain */ function insideFraudProofWindow(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) public view returns (bool _inside) { (uint256 timestamp,) = abi.decode(_batchHeader.extraData, (uint256, address)); require(timestamp != 0, "Batch header timestamp cannot be zero"); return (timestamp + FRAUD_PROOF_WINDOW) > block.timestamp; } /** * @inheritdoc IStateCommitmentChain */ // slither-disable-next-line external-function function rollBackL2Chain(uint256 _shouldRollBack, uint256 _shouldStartAtElement, bytes memory _signature) public { // Fail fast in to make sure our batch roots aren't accidentally made fraudulent by the // publication of batches by some other user. require( _shouldStartAtElement == getTotalElements(), "Actual batch start index does not match expected start index." ); // Proposers must have previously staked at the BondManager require( IBondManager(resolve("BondManager")).isCollateralized(msg.sender), "Proposer does not have enough collateral posted" ); _checkRollBackSignature(_shouldRollBack,_signature); } /********************** * Internal Functions * **********************/ /** * Parses the batch context from the extra data. * @return Total number of elements submitted. * @return Timestamp of the last batch submitted by the sequencer. */ function _getBatchExtraData() internal view returns (uint40, uint40) { bytes27 extraData = batches().getGlobalMetadata(); // solhint-disable max-line-length uint40 totalElements; uint40 lastSequencerTimestamp; assembly { extraData := shr(40, extraData) totalElements := and( extraData, 0x000000000000000000000000000000000000000000000000000000FFFFFFFFFF ) lastSequencerTimestamp := shr( 40, and(extraData, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000) ) } // solhint-enable max-line-length return (totalElements, lastSequencerTimestamp); } /** * Encodes the batch context for the extra data. * @param _totalElements Total number of elements submitted. * @param _lastSequencerTimestamp Timestamp of the last batch submitted by the sequencer. * @return Encoded batch context. */ function _makeBatchExtraData(uint40 _totalElements, uint40 _lastSequencerTimestamp) internal pure returns (bytes27) { bytes27 extraData; assembly { extraData := _totalElements extraData := or(extraData, shl(40, _lastSequencerTimestamp)) extraData := shl(40, extraData) } return extraData; } /** * Appends a batch to the chain. * @param _batch Elements within the batch. * @param _shouldStartAtElement Relative rollup block height. * @param _signature Signature of batch roots and rollup start height. */ function _checkClusterSignature(bytes32[] memory _batch, uint256 _shouldStartAtElement, bytes memory _signature) internal { // abi hash encode to bytes require( ITssGroupManager(resolve("Proxy__TSS_GroupManager")).verifySign( keccak256(abi.encode(_batch, _shouldStartAtElement)), _signature), "verify signature failed" ); } /** * Appends a batch to the chain. * @param _batch Elements within the batch. * @param _extraData Any extra data to append to the batch. */ function _appendBatch(bytes32[] memory _batch, bytes memory _signature, bytes memory _extraData) internal { address sequencer = resolve("BVM_Proposer"); (uint40 totalElements, uint40 lastSequencerTimestamp) = _getBatchExtraData(); if (msg.sender == sequencer) { lastSequencerTimestamp = uint40(block.timestamp); } else { // We keep track of the last batch submitted by the sequencer so there's a window in // which only the sequencer can publish state roots. A window like this just reduces // the chance of "system breaking" state roots being published while we're still in // testing mode. This window should be removed or significantly reduced in the future. require( lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp, "Cannot publish state roots within the sequencer publication window." ); } // For efficiency reasons getMerkleRoot modifies the `_batch` argument in place // while calculating the root hash therefore any arguments passed to it must not // be used again afterwards Lib_BVMCodec.ChainBatchHeader memory batchHeader = Lib_BVMCodec.ChainBatchHeader({ batchIndex : getTotalBatches(), batchRoot : Lib_MerkleTree.getMerkleRoot(_batch), batchSize : _batch.length, prevTotalElements : totalElements, signature : _signature, extraData : _extraData }); emit StateBatchAppended( batchHeader.batchIndex, batchHeader.batchRoot, batchHeader.batchSize, batchHeader.prevTotalElements, batchHeader.signature, batchHeader.extraData ); batches().push( Lib_BVMCodec.hashBatchHeader(batchHeader), _makeBatchExtraData( uint40(batchHeader.prevTotalElements + batchHeader.batchSize), lastSequencerTimestamp ) ); } /** * Removes a batch and all subsequent batches from the chain. * @param _batchHeader Header of the batch to remove. */ function _deleteBatch(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) internal { require(_batchHeader.batchIndex < batches().length(), "Invalid batch index."); require(_isValidBatchHeader(_batchHeader), "Invalid batch header."); // slither-disable-next-line reentrancy-events batches().deleteElementsAfterInclusive( _batchHeader.batchIndex, _makeBatchExtraData(uint40(_batchHeader.prevTotalElements), 0) ); // slither-disable-next-line reentrancy-events emit StateBatchDeleted(_batchHeader.batchIndex, _batchHeader.batchRoot); } /** * Distribute Reward to tss node. * @param _batch_length rollup batch. * @param _shouldStartAtElement. */ function _distributeTssReward(uint256 _batch_length, uint256 _shouldStartAtElement) internal { // get address of tss group member address[] memory tssMembers = ITssGroupManager(resolve("Proxy__TSS_GroupManager")).getTssGroupUnJailMembers(); require(tssMembers.length > 0, "get tss members in error"); // construct calldata for claimReward call bytes memory message = abi.encodeWithSelector( ITssRewardContract.claimReward.selector, _shouldStartAtElement, _batch_length, block.timestamp, tssMembers ); // send call data into L2, hardcode address sendCrossDomainMessage( address(0x4200000000000000000000000000000000000020), 2000000, message ); // emit message emit DistributeTssReward( _shouldStartAtElement, _batch_length, block.timestamp, tssMembers ); } /** * Checks that a batch header matches the stored hash for the given index. * @param _batchHeader Batch header to validate. * @return Whether or not the header matches the stored one. */ function _isValidBatchHeader(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) internal view returns (bool) { return Lib_BVMCodec.hashBatchHeader(_batchHeader) == batches().get(_batchHeader.batchIndex); } /** * roll back l2 chain to should start block number. * @param _shouldRollBack roll back number. * @param _signature Signature of roll back number. */ function _checkRollBackSignature(uint256 _shouldRollBack, bytes memory _signature) internal { // abi hash encode to bytes require( ITssGroupManager(resolve("Proxy__TSS_GroupManager")).verifySign( keccak256(abi.encode(_shouldRollBack)), _signature), "verify signature failed" ); bytes memory message = abi.encodeWithSignature( "rollBackMessage(uint256)", _shouldRollBack ); // send call data into L2, hardcode address sendCrossDomainMessage( address(0xDeADdeaDdEaDdeADdEaDDeADDEaddEaDDEad2222), 2000000, message ); //emit roll back l2chain from block number emit RollBackL2Chain(_shouldRollBack); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Library Imports */ import { Lib_RLPReader } from "../rlp/Lib_RLPReader.sol"; import { Lib_RLPWriter } from "../rlp/Lib_RLPWriter.sol"; import { Lib_BytesUtils } from "../utils/Lib_BytesUtils.sol"; import { Lib_Bytes32Utils } from "../utils/Lib_Bytes32Utils.sol"; /** * @title Lib_BVMCodec */ library Lib_BVMCodec { /********* * Enums * *********/ enum QueueOrigin { SEQUENCER_QUEUE, L1TOL2_QUEUE } /*********** * Structs * ***********/ struct EVMAccount { uint256 nonce; uint256 balance; bytes32 storageRoot; bytes32 codeHash; } struct ChainBatchHeader { uint256 batchIndex; bytes32 batchRoot; uint256 batchSize; uint256 prevTotalElements; bytes signature; bytes extraData; } struct ChainInclusionProof { uint256 index; bytes32[] siblings; } struct Transaction { uint256 timestamp; uint256 blockNumber; QueueOrigin l1QueueOrigin; address l1TxOrigin; address entrypoint; uint256 gasLimit; bytes data; } struct TransactionChainElement { bool isSequenced; uint256 queueIndex; // QUEUED TX ONLY uint256 timestamp; // SEQUENCER TX ONLY uint256 blockNumber; // SEQUENCER TX ONLY bytes txData; // SEQUENCER TX ONLY } struct QueueElement { bytes32 transactionHash; uint40 timestamp; uint40 blockNumber; } /********************** * Internal Functions * **********************/ /** * Encodes a standard BVM transaction. * @param _transaction BVM transaction to encode. * @return Encoded transaction bytes. */ function encodeTransaction(Transaction memory _transaction) internal pure returns (bytes memory) { return abi.encodePacked( _transaction.timestamp, _transaction.blockNumber, _transaction.l1QueueOrigin, _transaction.l1TxOrigin, _transaction.entrypoint, _transaction.gasLimit, _transaction.data ); } /** * Hashes a standard BVM transaction. * @param _transaction BVM transaction to encode. * @return Hashed transaction */ function hashTransaction(Transaction memory _transaction) internal pure returns (bytes32) { return keccak256(encodeTransaction(_transaction)); } /** * @notice Decodes an RLP-encoded account state into a useful struct. * @param _encoded RLP-encoded account state. * @return Account state struct. */ function decodeEVMAccount(bytes memory _encoded) internal pure returns (EVMAccount memory) { Lib_RLPReader.RLPItem[] memory accountState = Lib_RLPReader.readList(_encoded); return EVMAccount({ nonce: Lib_RLPReader.readUint256(accountState[0]), balance: Lib_RLPReader.readUint256(accountState[1]), storageRoot: Lib_RLPReader.readBytes32(accountState[2]), codeHash: Lib_RLPReader.readBytes32(accountState[3]) }); } /** * Calculates a hash for a given batch header. * @param _batchHeader Header to hash. * @return Hash of the header. */ function hashBatchHeader(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) internal pure returns (bytes32) { return keccak256( abi.encode( _batchHeader.batchRoot, _batchHeader.batchSize, _batchHeader.prevTotalElements, _batchHeader.signature, _batchHeader.extraData ) ); } }
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.9.0; /* Library Imports */ import { Lib_BVMCodec } from "../../libraries/codec/Lib_BVMCodec.sol"; /** * @title IStateCommitmentChain */ interface IStateCommitmentChain { /********** * Events * **********/ event StateBatchAppended( uint256 indexed _batchIndex, bytes32 _batchRoot, uint256 _batchSize, uint256 _prevTotalElements, bytes _signature, bytes _extraData ); event StateBatchDeleted(uint256 indexed _batchIndex, bytes32 _batchRoot); event DistributeTssReward( uint256 indexed _startBlockNumber, uint256 _length, uint256 indexed _batchTime, address[] _tssMembers ); event RollBackL2Chain(uint256 indexed _startBlockNumber); /******************** * Public Functions * ********************/ /** * Retrieves the total number of elements submitted. * @return _totalElements Total submitted elements. */ function getTotalElements() external view returns (uint256 _totalElements); /** * Retrieves the total number of batches submitted. * @return _totalBatches Total submitted batches. */ function getTotalBatches() external view returns (uint256 _totalBatches); /** * Retrieves the timestamp of the last batch submitted by the sequencer. * @return _lastSequencerTimestamp Last sequencer batch timestamp. */ function getLastSequencerTimestamp() external view returns (uint256 _lastSequencerTimestamp); /** * Appends a batch of state roots to the chain. * @param _batch Batch of state roots. * @param _shouldStartAtElement Index of the element at which this batch should start. * @param _signature tss group signature of state batches. */ function appendStateBatch(bytes32[] calldata _batch, uint256 _shouldStartAtElement, bytes memory _signature) external; /** * Deletes all state roots after (and including) a given batch. * @param _batchHeader Header of the batch to start deleting from. */ function deleteStateBatch(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) external; /** * Verifies a batch inclusion proof. * @param _element Hash of the element to verify a proof for. * @param _batchHeader Header of the batch in which the element was included. * @param _proof Merkle inclusion proof for the element. */ function verifyStateCommitment( bytes32 _element, Lib_BVMCodec.ChainBatchHeader memory _batchHeader, Lib_BVMCodec.ChainInclusionProof memory _proof ) external view returns (bool _verified); /** * Checks whether a given batch is still inside its fraud proof window. * @param _batchHeader Header of the batch to check. * @return _inside Whether or not the batch is inside the fraud proof window. */ function insideFraudProofWindow(Lib_BVMCodec.ChainBatchHeader memory _batchHeader) external view returns (bool _inside); /** * Emit event to notify sequencers to roll back. * @param _shouldRollBack roll back to should start . * @param _shouldStartAtElement Index of the element at which this batch should start * @param _signature signature of rollback message */ function rollBackL2Chain(uint256 _shouldRollBack,uint256 _shouldStartAtElement, bytes memory _signature) external; }
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.9.0; /* Interface Imports */ import { ICrossDomainMessenger } from "./ICrossDomainMessenger.sol"; /** * @title CrossDomainEnabled * @dev Helper contract for contracts performing cross-domain communications * * Compiler used: defined by inheriting contract */ contract CrossDomainEnabled { /************* * Variables * *************/ // Messenger contract used to send and recieve messages from the other domain. address public messenger; /*************** * Constructor * ***************/ /** * @param _messenger Address of the CrossDomainMessenger on the current layer. */ constructor(address _messenger) { messenger = _messenger; } /********************** * Function Modifiers * **********************/ /** * Enforces that the modified function is only callable by a specific cross-domain account. * @param _sourceDomainAccount The only account on the originating domain which is * authenticated to call this function. */ modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) { require( msg.sender == address(getCrossDomainMessenger()), "BVM_XCHAIN: messenger contract unauthenticated" ); require( getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount, "BVM_XCHAIN: wrong sender of cross-domain message" ); _; } /********************** * Internal Functions * **********************/ /** * Gets the messenger, usually from storage. This function is exposed in case a child contract * needs to override. * @return The address of the cross-domain messenger contract which should be used. */ function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) { return ICrossDomainMessenger(messenger); } /**q * Sends a message to an account on another domain * @param _crossDomainTarget The intended recipient on the destination domain * @param _message The data to send to the target (usually calldata to a function with * `onlyFromCrossDomainAccount()`) * @param _gasLimit The gasLimit for the receipt of the message on the target domain. */ function sendCrossDomainMessage( address _crossDomainTarget, uint32 _gasLimit, bytes memory _message ) internal { // slither-disable-next-line reentrancy-events, reentrancy-benign getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* Library Imports */ import { Lib_AddressManager } from "./Lib_AddressManager.sol"; /** * @title Lib_AddressResolver */ abstract contract Lib_AddressResolver { /************* * Variables * *************/ Lib_AddressManager public libAddressManager; /*************** * Constructor * ***************/ /** * @param _libAddressManager Address of the Lib_AddressManager. */ constructor(address _libAddressManager) { libAddressManager = Lib_AddressManager(_libAddressManager); } /******************** * Public Functions * ********************/ /** * Resolves the address associated with a given name. * @param _name Name to resolve an address for. * @return Address associated with the given name. */ function resolve(string memory _name) public view returns (address) { return libAddressManager.getAddress(_name); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title Lib_MerkleTree * @author River Keefer */ library Lib_MerkleTree { /********************** * Internal Functions * **********************/ /** * Calculates a merkle root for a list of 32-byte leaf hashes. WARNING: If the number * of leaves passed in is not a power of two, it pads out the tree with zero hashes. * If you do not know the original length of elements for the tree you are verifying, then * this may allow empty leaves past _elements.length to pass a verification check down the line. * Note that the _elements argument is modified, therefore it must not be used again afterwards * @param _elements Array of hashes from which to generate a merkle root. * @return Merkle root of the leaves, with zero hashes for non-powers-of-two (see above). */ function getMerkleRoot(bytes32[] memory _elements) internal pure returns (bytes32) { require(_elements.length > 0, "Lib_MerkleTree: Must provide at least one leaf hash."); if (_elements.length == 1) { return _elements[0]; } uint256[16] memory defaults = [ 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563, 0x633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d, 0x890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d, 0x3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd8, 0xecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da, 0xdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da5, 0x617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d7, 0x292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead, 0xe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e10, 0x7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f82, 0xe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e83636516, 0x3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c, 0xad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e, 0xa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab, 0x4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c862, 0x2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf10 ]; // Reserve memory space for our hashes. bytes memory buf = new bytes(64); // We'll need to keep track of left and right siblings. bytes32 leftSibling; bytes32 rightSibling; // Number of non-empty nodes at the current depth. uint256 rowSize = _elements.length; // Current depth, counting from 0 at the leaves uint256 depth = 0; // Common sub-expressions uint256 halfRowSize; // rowSize / 2 bool rowSizeIsOdd; // rowSize % 2 == 1 while (rowSize > 1) { halfRowSize = rowSize / 2; rowSizeIsOdd = rowSize % 2 == 1; for (uint256 i = 0; i < halfRowSize; i++) { leftSibling = _elements[(2 * i)]; rightSibling = _elements[(2 * i) + 1]; assembly { mstore(add(buf, 32), leftSibling) mstore(add(buf, 64), rightSibling) } _elements[i] = keccak256(buf); } if (rowSizeIsOdd) { leftSibling = _elements[rowSize - 1]; rightSibling = bytes32(defaults[depth]); assembly { mstore(add(buf, 32), leftSibling) mstore(add(buf, 64), rightSibling) } _elements[halfRowSize] = keccak256(buf); } rowSize = halfRowSize + (rowSizeIsOdd ? 1 : 0); depth++; } return _elements[0]; } /** * Verifies a merkle branch for the given leaf hash. Assumes the original length * of leaves generated is a known, correct input, and does not return true for indices * extending past that index (even if _siblings would be otherwise valid.) * @param _root The Merkle root to verify against. * @param _leaf The leaf hash to verify inclusion of. * @param _index The index in the tree of this leaf. * @param _siblings Array of sibline nodes in the inclusion proof, starting from depth 0 * (bottom of the tree). * @param _totalLeaves The total number of leaves originally passed into. * @return Whether or not the merkle branch and leaf passes verification. */ function verify( bytes32 _root, bytes32 _leaf, uint256 _index, bytes32[] memory _siblings, uint256 _totalLeaves ) internal pure returns (bool) { require(_totalLeaves > 0, "Lib_MerkleTree: Total leaves must be greater than zero."); require(_index < _totalLeaves, "Lib_MerkleTree: Index out of bounds."); require( _siblings.length == _ceilLog2(_totalLeaves), "Lib_MerkleTree: Total siblings does not correctly correspond to total leaves." ); bytes32 computedRoot = _leaf; for (uint256 i = 0; i < _siblings.length; i++) { if ((_index & 1) == 1) { computedRoot = keccak256(abi.encodePacked(_siblings[i], computedRoot)); } else { computedRoot = keccak256(abi.encodePacked(computedRoot, _siblings[i])); } _index >>= 1; } return _root == computedRoot; } /********************* * Private Functions * *********************/ /** * Calculates the integer ceiling of the log base 2 of an input. * @param _in Unsigned input to calculate the log. * @return ceil(log_base_2(_in)) */ function _ceilLog2(uint256 _in) private pure returns (uint256) { require(_in > 0, "Lib_MerkleTree: Cannot compute ceil(log_2) of 0."); if (_in == 1) { return 0; } // Find the highest set bit (will be floor(log_2)). // Borrowed with <3 from https://github.com/ethereum/solidity-examples uint256 val = _in; uint256 highest = 0; for (uint256 i = 128; i >= 1; i >>= 1) { if (val & (((uint256(1) << i) - 1) << i) != 0) { highest += i; val >>= i; } } // Increment by one if this is not a perfect logarithm. if ((uint256(1) << highest) != _in) { highest += 1; } return highest; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title ITssRewardContract */ interface ITssRewardContract { /********** * Events * **********/ event DistributeTssReward( uint256 lastBatchTime, uint256 batchTime, uint256 amount, address[] tssMembers ); event DistributeTssRewardByBlock( uint256 blockStartHeight, uint32 length, uint256 amount, address[] tssMembers ); event Claim( address owner, uint256 amount ); /******************** * Public Functions * ********************/ /** * @dev Query total undistributed balance. * @return Amount of undistributed rewards. */ function queryReward() external view returns (uint256); /** * @dev Auto distribute reward to tss members. * @param _blockStartHeight L2 rollup batch block start height. * @param _length Rollup batch length. * @param _batchTime rollup batch time. * @param _tssMembers Tss member address array. */ function claimReward(uint256 _blockStartHeight, uint32 _length, uint256 _batchTime, address[] calldata _tssMembers) external; /** * @dev clear contract(canonical). */ function withdraw() external; /** * @dev Claim reward and withdraw */ function claim() external; /** * @dev default claimer == staker, if staker is multi-signature address,must set claimer * @param _staker the address of staker * @param _claimer the address for staker to claim reward */ function setClaimer(address _staker, address _claimer) external; /** * @dev Initiate a request to claim */ function requestClaim() external returns (bool); /** * @dev Query the remaining time required to claim */ function queryClaimTime() external returns (uint256); function setSccAddr(address sccAddr) external; function setStakeSlashAddr(address ssAddr) external; function setSendAmountPerYear(uint256) external; function setWaitingTime(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.9.0; /* Library Imports */ import { Lib_BVMCodec } from "../../libraries/codec/Lib_BVMCodec.sol"; /* Interface Imports */ import { IChainStorageContainer } from "./IChainStorageContainer.sol"; /** * @title ICanonicalTransactionChain */ interface ICanonicalTransactionChain { /********** * Events * **********/ event L2GasParamsUpdated( uint256 l2GasDiscountDivisor, uint256 enqueueGasCost, uint256 enqueueL2GasPrepaid ); event TransactionEnqueued( address indexed _l1TxOrigin, address indexed _target, uint256 _gasLimit, bytes _data, uint256 indexed _queueIndex, uint256 _timestamp ); event QueueBatchAppended( uint256 _startingQueueIndex, uint256 _numQueueElements, uint256 _totalElements ); event SequencerBatchAppended( uint256 _startingQueueIndex, uint256 _numQueueElements, uint256 _totalElements ); event TransactionBatchAppended( uint256 indexed _batchIndex, bytes32 _batchRoot, uint256 _batchSize, uint256 _prevTotalElements, bytes _signature, bytes _extraData ); event CTCBatchReset( uint256 indexed _batchIndex, uint40 _nextqIndex, uint40 _totalElement, uint40 _batchSize, uint40 _numQueuedTransactions , uint40 _timestamp, uint40 _blockNumber ); /*********** * Structs * ***********/ struct BatchContext { uint256 numSequencedTransactions; uint256 numSubsequentQueueTransactions; uint256 timestamp; uint256 blockNumber; } /******************************* * Authorized Setter Functions * *******************************/ /** * 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. */ function setGasParams(uint256 _l2GasDiscountDivisor, uint256 _enqueueGasCost) external; /******************** * Public Functions * ********************/ /** * Accesses the batch storage container. * @return Reference to the batch storage container. */ function batches() external view returns (IChainStorageContainer); /** * Retrieves the total number of elements submitted. * @return _totalElements Total submitted elements. */ function getTotalElements() external view returns (uint256 _totalElements); /** * Retrieves the total number of batches submitted. * @return _totalBatches Total submitted batches. */ function getTotalBatches() external view returns (uint256 _totalBatches); /** * Returns the index of the next element to be enqueued. * @return Index for the next queue element. */ function getNextQueueIndex() external view returns (uint40); /** * Gets the queue element at a particular index. * @param _index Index of the queue element to access. * @return _element Queue element at the given index. */ function getQueueElement(uint256 _index) external view returns (Lib_BVMCodec.QueueElement memory _element); /** * Returns the timestamp of the last transaction. * @return Timestamp for the last transaction. */ function getLastTimestamp() external view returns (uint40); /** * Returns the blocknumber of the last transaction. * @return Blocknumber for the last transaction. */ function getLastBlockNumber() external view returns (uint40); /** * Get the number of queue elements which have not yet been included. * @return Number of pending queue elements. */ function getNumPendingQueueElements() external view returns (uint40); /** * Retrieves the length of the queue, including * both pending and canonical transactions. * @return Length of the queue. */ function getQueueLength() external view returns (uint40); /** * Adds a transaction to the queue. * @param _target Target contract to send the transaction to. * @param _gasLimit Gas limit for the given transaction. * @param _data Transaction data. */ function enqueue( address _target, uint256 _gasLimit, bytes memory _data ) external; /** * Allows the sequencer to append a batch of transactions. * @dev 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. */ function appendSequencerBatch( // uint40 _shouldStartAtElement, // uint24 _totalElementsToAppend, // BatchContext[] _contexts, // bytes[] _transactionDataFields ) external; function resetIndex(uint256 _batchIndex, uint40 _totalElement, uint40 _batchSize, uint40 _nextqIndex,uint40 _numQueuedTransactions , uint40 _timestamp, uint40 _blockNumber) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title IBondManager */ interface IBondManager { /******************** * Public Functions * ********************/ function isCollateralized(address _who) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.9.0; /** * @title IChainStorageContainer */ interface IChainStorageContainer { /******************** * Public Functions * ********************/ /** * 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. * @param _globalMetadata New global metadata to set. */ function setGlobalMetadata(bytes27 _globalMetadata) external; /** * Retrieves the container's global metadata field. * @return Container global metadata field. */ function getGlobalMetadata() external view returns (bytes27); /** * Retrieves the number of objects stored in the container. * @return Number of objects in the container. */ function length() external view returns (uint256); /** * Pushes an object into the container. * @param _object A 32 byte value to insert into the container. */ function push(bytes32 _object) external; /** * 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). * @param _object A 32 byte value to insert into the container. * @param _globalMetadata New global metadata for the container. */ function push(bytes32 _object, bytes27 _globalMetadata) external; /** * Retrieves an object from the container. * @param _index Index of the particular object to access. * @return 32 byte object value. */ function get(uint256 _index) external view returns (bytes32); /** * Removes all objects after and including a given index. * @param _index Object index to delete from. */ function deleteElementsAfterInclusive(uint256 _index) external; /** * Removes all objects after and including a given index. Also allows setting the global * metadata field. * @param _index Object index to delete from. * @param _globalMetadata New global metadata for the container. */ function deleteElementsAfterInclusive(uint256 _index, bytes27 _globalMetadata) external; }
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.9.0; interface ITssGroupManager { enum MemberStatus { unJail, jail } struct TssMember { bytes publicKey; address nodeAddress; MemberStatus status; } function setTssGroupMember(uint256 _threshold, bytes[] memory _batchPublicKey) external; function setGroupPublicKey(bytes memory _publicKey, bytes memory _groupPublicKey) external; function getTssGroupInfo() external returns (uint256, uint256, bytes memory, bytes[] memory); function getTssInactiveGroupInfo() external returns (uint256, uint256, bytes[] memory); function memberJail(bytes memory _publicKey) external; function memberUnJail(bytes memory _publicKey) external; function removeMember(bytes memory _publicKey) external; function getTssGroupUnJailMembers() external returns (address[] memory); function getTssGroupMembers() external returns (bytes[] memory); function getTssMember(bytes memory _publicKey) external returns (TssMember memory); function memberExistActive(bytes memory _publicKey) external returns (bool); function memberExistInActive(bytes memory _publicKey) external returns (bool); function inActiveIsEmpty() external returns (bool); function verifySign(bytes32 _message, bytes memory _sig) external returns (bool); function isTssGroupUnJailMembers(address _addr) external returns (bool); function memberExistActive(address _addr) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title Lib_RLPReader * @dev Adapted from "RLPReader" by Hamdi Allam ([email protected]). */ library Lib_RLPReader { /************* * Constants * *************/ uint256 internal constant MAX_LIST_LENGTH = 32; /********* * Enums * *********/ enum RLPItemType { DATA_ITEM, LIST_ITEM } /*********** * Structs * ***********/ struct RLPItem { uint256 length; uint256 ptr; } /********************** * Internal Functions * **********************/ /** * Converts bytes to a reference to memory position and length. * @param _in Input bytes to convert. * @return Output memory reference. */ function toRLPItem(bytes memory _in) internal pure returns (RLPItem memory) { uint256 ptr; assembly { ptr := add(_in, 32) } return RLPItem({ length: _in.length, ptr: ptr }); } /** * Reads an RLP list value into a list of RLP items. * @param _in RLP list value. * @return Decoded RLP list items. */ function readList(RLPItem memory _in) internal pure returns (RLPItem[] memory) { (uint256 listOffset, , RLPItemType itemType) = _decodeLength(_in); require(itemType == RLPItemType.LIST_ITEM, "Invalid RLP list value."); // Solidity in-memory arrays can't be increased in size, but *can* be decreased in size by // writing to the length. Since we can't know the number of RLP items without looping over // the entire input, we'd have to loop twice to accurately size this array. It's easier to // simply set a reasonable maximum list length and decrease the size before we finish. RLPItem[] memory out = new RLPItem[](MAX_LIST_LENGTH); uint256 itemCount = 0; uint256 offset = listOffset; while (offset < _in.length) { require(itemCount < MAX_LIST_LENGTH, "Provided RLP list exceeds max list length."); (uint256 itemOffset, uint256 itemLength, ) = _decodeLength( RLPItem({ length: _in.length - offset, ptr: _in.ptr + offset }) ); out[itemCount] = RLPItem({ length: itemLength + itemOffset, ptr: _in.ptr + offset }); itemCount += 1; offset += itemOffset + itemLength; } // Decrease the array size to match the actual item count. assembly { mstore(out, itemCount) } return out; } /** * Reads an RLP list value into a list of RLP items. * @param _in RLP list value. * @return Decoded RLP list items. */ function readList(bytes memory _in) internal pure returns (RLPItem[] memory) { return readList(toRLPItem(_in)); } /** * Reads an RLP bytes value into bytes. * @param _in RLP bytes value. * @return Decoded bytes. */ function readBytes(RLPItem memory _in) internal pure returns (bytes memory) { (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in); require(itemType == RLPItemType.DATA_ITEM, "Invalid RLP bytes value."); return _copy(_in.ptr, itemOffset, itemLength); } /** * Reads an RLP bytes value into bytes. * @param _in RLP bytes value. * @return Decoded bytes. */ function readBytes(bytes memory _in) internal pure returns (bytes memory) { return readBytes(toRLPItem(_in)); } /** * Reads an RLP string value into a string. * @param _in RLP string value. * @return Decoded string. */ function readString(RLPItem memory _in) internal pure returns (string memory) { return string(readBytes(_in)); } /** * Reads an RLP string value into a string. * @param _in RLP string value. * @return Decoded string. */ function readString(bytes memory _in) internal pure returns (string memory) { return readString(toRLPItem(_in)); } /** * Reads an RLP bytes32 value into a bytes32. * @param _in RLP bytes32 value. * @return Decoded bytes32. */ function readBytes32(RLPItem memory _in) internal pure returns (bytes32) { require(_in.length <= 33, "Invalid RLP bytes32 value."); (uint256 itemOffset, uint256 itemLength, RLPItemType itemType) = _decodeLength(_in); require(itemType == RLPItemType.DATA_ITEM, "Invalid RLP bytes32 value."); uint256 ptr = _in.ptr + itemOffset; bytes32 out; assembly { out := mload(ptr) // Shift the bytes over to match the item size. if lt(itemLength, 32) { out := div(out, exp(256, sub(32, itemLength))) } } return out; } /** * Reads an RLP bytes32 value into a bytes32. * @param _in RLP bytes32 value. * @return Decoded bytes32. */ function readBytes32(bytes memory _in) internal pure returns (bytes32) { return readBytes32(toRLPItem(_in)); } /** * Reads an RLP uint256 value into a uint256. * @param _in RLP uint256 value. * @return Decoded uint256. */ function readUint256(RLPItem memory _in) internal pure returns (uint256) { return uint256(readBytes32(_in)); } /** * Reads an RLP uint256 value into a uint256. * @param _in RLP uint256 value. * @return Decoded uint256. */ function readUint256(bytes memory _in) internal pure returns (uint256) { return readUint256(toRLPItem(_in)); } /** * Reads an RLP bool value into a bool. * @param _in RLP bool value. * @return Decoded bool. */ function readBool(RLPItem memory _in) internal pure returns (bool) { require(_in.length == 1, "Invalid RLP boolean value."); uint256 ptr = _in.ptr; uint256 out; assembly { out := byte(0, mload(ptr)) } require(out == 0 || out == 1, "Lib_RLPReader: Invalid RLP boolean value, must be 0 or 1"); return out != 0; } /** * Reads an RLP bool value into a bool. * @param _in RLP bool value. * @return Decoded bool. */ function readBool(bytes memory _in) internal pure returns (bool) { return readBool(toRLPItem(_in)); } /** * Reads an RLP address value into a address. * @param _in RLP address value. * @return Decoded address. */ function readAddress(RLPItem memory _in) internal pure returns (address) { if (_in.length == 1) { return address(0); } require(_in.length == 21, "Invalid RLP address value."); return address(uint160(readUint256(_in))); } /** * Reads an RLP address value into a address. * @param _in RLP address value. * @return Decoded address. */ function readAddress(bytes memory _in) internal pure returns (address) { return readAddress(toRLPItem(_in)); } /** * Reads the raw bytes of an RLP item. * @param _in RLP item to read. * @return Raw RLP bytes. */ function readRawBytes(RLPItem memory _in) internal pure returns (bytes memory) { return _copy(_in); } /********************* * Private Functions * *********************/ /** * Decodes the length of an RLP item. * @param _in RLP item to decode. * @return Offset of the encoded data. * @return Length of the encoded data. * @return RLP item type (LIST_ITEM or DATA_ITEM). */ function _decodeLength(RLPItem memory _in) private pure returns ( uint256, uint256, RLPItemType ) { require(_in.length > 0, "RLP item cannot be null."); uint256 ptr = _in.ptr; uint256 prefix; assembly { prefix := byte(0, mload(ptr)) } if (prefix <= 0x7f) { // Single byte. return (0, 1, RLPItemType.DATA_ITEM); } else if (prefix <= 0xb7) { // Short string. // slither-disable-next-line variable-scope uint256 strLen = prefix - 0x80; require(_in.length > strLen, "Invalid RLP short string."); return (1, strLen, RLPItemType.DATA_ITEM); } else if (prefix <= 0xbf) { // Long string. uint256 lenOfStrLen = prefix - 0xb7; require(_in.length > lenOfStrLen, "Invalid RLP long string length."); uint256 strLen; assembly { // Pick out the string length. strLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfStrLen))) } require(_in.length > lenOfStrLen + strLen, "Invalid RLP long string."); return (1 + lenOfStrLen, strLen, RLPItemType.DATA_ITEM); } else if (prefix <= 0xf7) { // Short list. // slither-disable-next-line variable-scope uint256 listLen = prefix - 0xc0; require(_in.length > listLen, "Invalid RLP short list."); return (1, listLen, RLPItemType.LIST_ITEM); } else { // Long list. uint256 lenOfListLen = prefix - 0xf7; require(_in.length > lenOfListLen, "Invalid RLP long list length."); uint256 listLen; assembly { // Pick out the list length. listLen := div(mload(add(ptr, 1)), exp(256, sub(32, lenOfListLen))) } require(_in.length > lenOfListLen + listLen, "Invalid RLP long list."); return (1 + lenOfListLen, listLen, RLPItemType.LIST_ITEM); } } /** * Copies the bytes from a memory location. * @param _src Pointer to the location to read from. * @param _offset Offset to start reading from. * @param _length Number of bytes to read. * @return Copied bytes. */ function _copy( uint256 _src, uint256 _offset, uint256 _length ) private pure returns (bytes memory) { bytes memory out = new bytes(_length); if (out.length == 0) { return out; } uint256 src = _src + _offset; uint256 dest; assembly { dest := add(out, 32) } // Copy over as many complete words as we can. for (uint256 i = 0; i < _length / 32; i++) { assembly { mstore(dest, mload(src)) } src += 32; dest += 32; } // Pick out the remaining bytes. uint256 mask; unchecked { mask = 256**(32 - (_length % 32)) - 1; } assembly { mstore(dest, or(and(mload(src), not(mask)), and(mload(dest), mask))) } return out; } /** * Copies an RLP item into bytes. * @param _in RLP item to copy. * @return Copied bytes. */ function _copy(RLPItem memory _in) private pure returns (bytes memory) { return _copy(_in.ptr, 0, _in.length); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title Lib_BytesUtils */ library Lib_BytesUtils { /********************** * Internal Functions * **********************/ function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_start + _length >= _start, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function slice(bytes memory _bytes, uint256 _start) internal pure returns (bytes memory) { if (_start >= _bytes.length) { return bytes(""); } return slice(_bytes, _start, _bytes.length - _start); } function toBytes32(bytes memory _bytes) internal pure returns (bytes32) { if (_bytes.length < 32) { bytes32 ret; assembly { ret := mload(add(_bytes, 32)) } return ret; } return abi.decode(_bytes, (bytes32)); // will truncate if input length > 32 bytes } function toUint256(bytes memory _bytes) internal pure returns (uint256) { return uint256(toBytes32(_bytes)); } function toNibbles(bytes memory _bytes) internal pure returns (bytes memory) { bytes memory nibbles = new bytes(_bytes.length * 2); for (uint256 i = 0; i < _bytes.length; i++) { nibbles[i * 2] = _bytes[i] >> 4; nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16); } return nibbles; } function fromNibbles(bytes memory _bytes) internal pure returns (bytes memory) { bytes memory ret = new bytes(_bytes.length / 2); for (uint256 i = 0; i < ret.length; i++) { ret[i] = (_bytes[i * 2] << 4) | (_bytes[i * 2 + 1]); } return ret; } function equal(bytes memory _bytes, bytes memory _other) internal pure returns (bool) { return keccak256(_bytes) == keccak256(_other); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title Lib_RLPWriter * @author Bakaoh (with modifications) */ library Lib_RLPWriter { /********************** * Internal Functions * **********************/ /** * RLP encodes a byte string. * @param _in The byte string to encode. * @return The RLP encoded string in bytes. */ function writeBytes(bytes memory _in) internal pure returns (bytes memory) { bytes memory encoded; if (_in.length == 1 && uint8(_in[0]) < 128) { encoded = _in; } else { encoded = abi.encodePacked(_writeLength(_in.length, 128), _in); } return encoded; } /** * RLP encodes a list of RLP encoded byte byte strings. * @param _in The list of RLP encoded byte strings. * @return The RLP encoded list of items in bytes. */ function writeList(bytes[] memory _in) internal pure returns (bytes memory) { bytes memory list = _flatten(_in); return abi.encodePacked(_writeLength(list.length, 192), list); } /** * RLP encodes a string. * @param _in The string to encode. * @return The RLP encoded string in bytes. */ function writeString(string memory _in) internal pure returns (bytes memory) { return writeBytes(bytes(_in)); } /** * RLP encodes an address. * @param _in The address to encode. * @return The RLP encoded address in bytes. */ function writeAddress(address _in) internal pure returns (bytes memory) { return writeBytes(abi.encodePacked(_in)); } /** * RLP encodes a uint. * @param _in The uint256 to encode. * @return The RLP encoded uint256 in bytes. */ function writeUint(uint256 _in) internal pure returns (bytes memory) { return writeBytes(_toBinary(_in)); } /** * RLP encodes a bool. * @param _in The bool to encode. * @return The RLP encoded bool in bytes. */ function writeBool(bool _in) internal pure returns (bytes memory) { bytes memory encoded = new bytes(1); encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80)); return encoded; } /********************* * Private Functions * *********************/ /** * Encode the first byte, followed by the `len` in binary form if `length` is more than 55. * @param _len The length of the string or the payload. * @param _offset 128 if item is string, 192 if item is list. * @return RLP encoded bytes. */ function _writeLength(uint256 _len, uint256 _offset) private pure returns (bytes memory) { bytes memory encoded; if (_len < 56) { encoded = new bytes(1); encoded[0] = bytes1(uint8(_len) + uint8(_offset)); } else { uint256 lenLen; uint256 i = 1; while (_len / i != 0) { lenLen++; i *= 256; } encoded = new bytes(lenLen + 1); encoded[0] = bytes1(uint8(lenLen) + uint8(_offset) + 55); for (i = 1; i <= lenLen; i++) { encoded[i] = bytes1(uint8((_len / (256**(lenLen - i))) % 256)); } } return encoded; } /** * Encode integer in big endian binary form with no leading zeroes. * @notice TODO: This should be optimized with assembly to save gas costs. * @param _x The integer to encode. * @return RLP encoded bytes. */ function _toBinary(uint256 _x) private pure returns (bytes memory) { bytes memory b = abi.encodePacked(_x); uint256 i = 0; for (; i < 32; i++) { if (b[i] != 0) { break; } } bytes memory res = new bytes(32 - i); for (uint256 j = 0; j < res.length; j++) { res[j] = b[i++]; } return res; } /** * Copies a piece of memory to another location. * @notice From: https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol. * @param _dest Destination location. * @param _src Source location. * @param _len Length of memory to copy. */ function _memcpy( uint256 _dest, uint256 _src, uint256 _len ) private pure { uint256 dest = _dest; uint256 src = _src; uint256 len = _len; for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } uint256 mask; unchecked { mask = 256**(32 - len) - 1; } assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } /** * Flattens a list of byte strings into one byte string. * @notice From: https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol. * @param _list List of byte strings to flatten. * @return The flattened byte string. */ function _flatten(bytes[] memory _list) private pure returns (bytes memory) { if (_list.length == 0) { return new bytes(0); } uint256 len; uint256 i = 0; for (; i < _list.length; i++) { len += _list[i].length; } bytes memory flattened = new bytes(len); uint256 flattenedPtr; assembly { flattenedPtr := add(flattened, 0x20) } for (i = 0; i < _list.length; i++) { bytes memory item = _list[i]; uint256 listPtr; assembly { listPtr := add(item, 0x20) } _memcpy(flattenedPtr, listPtr, item.length); flattenedPtr += _list[i].length; } return flattened; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /** * @title Lib_Byte32Utils */ library Lib_Bytes32Utils { /********************** * Internal Functions * **********************/ /** * Converts a bytes32 value to a boolean. Anything non-zero will be converted to "true." * @param _in Input bytes32 value. * @return Bytes32 as a boolean. */ function toBool(bytes32 _in) internal pure returns (bool) { return _in != 0; } /** * Converts a boolean to a bytes32 value. * @param _in Input boolean value. * @return Boolean as a bytes32. */ function fromBool(bool _in) internal pure returns (bytes32) { return bytes32(uint256(_in ? 1 : 0)); } /** * Converts a bytes32 value to an address. Takes the *last* 20 bytes. * @param _in Input bytes32 value. * @return Bytes32 as an address. */ function toAddress(bytes32 _in) internal pure returns (address) { return address(uint160(uint256(_in))); } /** * Converts an address to a bytes32. * @param _in Input address value. * @return Address as a bytes32. */ function fromAddress(address _in) internal pure returns (bytes32) { return bytes32(uint256(uint160(_in))); } }
// SPDX-License-Identifier: MIT pragma solidity >0.5.0 <0.9.0; /** * @title ICrossDomainMessenger */ interface ICrossDomainMessenger { /********** * Events * **********/ event SentMessage( address indexed target, address sender, bytes message, uint256 messageNonce, uint256 gasLimit ); event RelayedMessage(bytes32 indexed msgHash); event FailedRelayedMessage(bytes32 indexed msgHash); /************* * Variables * *************/ function xDomainMessageSender() external view returns (address); /******************** * Public Functions * ********************/ /** * Sends a cross domain message to the target messenger. * @param _target Target contract address. * @param _message Message to send to the target. * @param _gasLimit Gas limit for the provided message. */ function sendMessage( address _target, bytes calldata _message, uint32 _gasLimit ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /* External Imports */ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /** * @title Lib_AddressManager */ contract Lib_AddressManager is Ownable { /********** * Events * **********/ event AddressSet(string indexed _name, address _newAddress, address _oldAddress); /************* * Variables * *************/ mapping(bytes32 => address) private addresses; /******************** * Public Functions * ********************/ /** * Changes the address associated with a particular name. * @param _name String name to associate an address with. * @param _address Address to associate with the name. */ function setAddress(string memory _name, address _address) external onlyOwner { bytes32 nameHash = _getNameHash(_name); address oldAddress = addresses[nameHash]; addresses[nameHash] = _address; emit AddressSet(_name, _address, oldAddress); } /** * Retrieves the address associated with a given name. * @param _name Name to retrieve an address for. * @return Address associated with the given name. */ function getAddress(string memory _name) external view returns (address) { return addresses[_getNameHash(_name)]; } /********************** * Internal Functions * **********************/ /** * Computes the hash of a name. * @param _name Name to compute a hash for. * @return Hash of the given name. */ function _getNameHash(string memory _name) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_name)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev 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. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_libAddressManager","type":"address"},{"internalType":"address","name":"_l1messenger","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":"_startBlockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_length","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_batchTime","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"_tssMembers","type":"address[]"}],"name":"DistributeTssReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_startBlockNumber","type":"uint256"}],"name":"RollBackL2Chain","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":"_signature","type":"bytes"},{"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"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"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":"signature","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct Lib_BVMCodec.ChainBatchHeader","name":"_batchHeader","type":"tuple"}],"name":"deleteStateBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getFraudProofWindow","outputs":[{"internalType":"uint256","name":"_fraudProofWindow","type":"uint256"}],"stateMutability":"view","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":"signature","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct Lib_BVMCodec.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":[],"name":"messenger","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"resolve","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shouldRollBack","type":"uint256"},{"internalType":"uint256","name":"_shouldStartAtElement","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"rollBackL2Chain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fraudProofWindow","type":"uint256"}],"name":"setFraudProofWindow","outputs":[],"stateMutability":"nonpayable","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":"signature","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct Lib_BVMCodec.ChainBatchHeader","name":"_batchHeader","type":"tuple"},{"components":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bytes32[]","name":"siblings","type":"bytes32[]"}],"internalType":"struct Lib_BVMCodec.ChainInclusionProof","name":"_proof","type":"tuple"}],"name":"verifyStateCommitment","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200276f3803806200276f833981016040819052620000349162000090565b600080546001600160a01b039586166001600160a01b0319918216179091556001805494909516931692909217909255600291909155600355620000d8565b80516001600160a01b03811681146200008b57600080fd5b919050565b60008060008060808587031215620000a757600080fd5b620000b28562000073565b9350620000c26020860162000073565b6040860151606090960151949790965092505050565b61268780620000e86000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80637ad168a011610097578063b768bb1711610066578063b768bb17146101f7578063c17b291b1461020a578063cfdf677e14610213578063e561dddc1461021b57600080fd5b80637ad168a0146101b057806381eb62ef146101b857806389a1d980146101c1578063ab59f7b8146101e457600080fd5b8063461a4478116100d3578063461a44781461017057806355a17f8a146101835780635b4d90e2146101955780637aa63a86146101a857600080fd5b80630bf3b5f2146101055780632169f79f1461011a578063299ca4781461012d5780633cb747bf1461015d575b600080fd5b610118610113366004611e24565b610223565b005b610118610128366004611f03565b610322565b600054610140906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b600154610140906001600160a01b031681565b61014061017e366004611f66565b610602565b6002545b604051908152602001610154565b6101186101a336600461204e565b610689565b6101876107ef565b610187610808565b61018760035481565b6101d46101cf36600461204e565b610821565b6040519015158152602001610154565b6101186101f2366004612083565b6108b1565b6101d461020536600461209c565b6109b0565b61018760025481565b610140610a4a565b610187610a72565b61022b6107ef565b82146102525760405162461bcd60e51b815260040161024990612159565b60405180910390fd5b61027e6040518060400160405280600b81526020016a2137b73226b0b730b3b2b960a91b815250610602565b604051630156a69560e11b81523360048201526001600160a01b0391909116906302ad4d2a9060240160206040518083038186803b1580156102bf57600080fd5b505afa1580156102d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f791906121b6565b6103135760405162461bcd60e51b8152600401610249906121d8565b61031d8382610aec565b505050565b61032a6107ef565b82146103485760405162461bcd60e51b815260040161024990612159565b6103746040518060400160405280600b81526020016a2137b73226b0b730b3b2b960a91b815250610602565b604051630156a69560e11b81523360048201526001600160a01b0391909116906302ad4d2a9060240160206040518083038186803b1580156103b557600080fd5b505afa1580156103c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ed91906121b6565b6104095760405162461bcd60e51b8152600401610249906121d8565b60008351116104665760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460448201526231b41760e91b6064820152608401610249565b6104a46040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e00000000000000815250610602565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b1580156104dc57600080fd5b505afa1580156104f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105149190612227565b835161051e6107ef565b6105289190612256565b11156105ae5760405162461bcd60e51b815260206004820152604960248201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360448201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60648201526839b0b1ba34b7b7399760b91b608482015260a401610249565b6105b9838383610ca4565b6105f7838242336040516020016105e39291909182526001600160a01b0316602082015260400190565b604051602081830303815290604052610dc9565b61031d835183611002565b6000805460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906106339085906004016122bb565b60206040518083038186803b15801561064b57600080fd5b505afa15801561065f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068391906122e3565b92915050565b6106bb60405180604001604052806011815260200170212b26afa33930bab22b32b934b334b2b960791b815250610602565b6001600160a01b0316336001600160a01b0316146107415760405162461bcd60e51b815260206004820152603b60248201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f64206279207468652042564d5f467261756456657269666965722e00000000006064820152608401610249565b61074a816111b0565b6107665760405162461bcd60e51b815260040161024990612300565b61076f81610821565b6107e3576040805162461bcd60e51b81526020600482015260248101919091527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f642077697468696e207468652066726175642070726f6f662077696e646f772e6064820152608401610249565b6107ec8161124c565b50565b6000806107fa6113f8565b5064ffffffffff1692915050565b6000806108136113f8565b64ffffffffff169392505050565b6000808260a0015180602001905181019061083c919061232f565b5090508061089a5760405162461bcd60e51b815260206004820152602560248201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604482015264207a65726f60d81b6064820152608401610249565b42600254826108a99190612256565b119392505050565b60008054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fd57600080fd5b505afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093591906122e3565b6001600160a01b0316336001600160a01b0316146109ab5760405162461bcd60e51b815260206004820152602d60248201527f4f6e6c792063616c6c61626c6520627920746865206c6962416464726573734d60448201526c30b730b3b2b91037bbb732b91760991b6064820152608401610249565b600255565b60006109bb836111b0565b6109d75760405162461bcd60e51b815260040161024990612300565b6109f483602001518584600001518560200151876040015161148f565b610a405760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420696e636c7573696f6e2070726f6f662e00000000000000006044820152606401610249565b5060019392505050565b6000610a6d60405180606001604052806021815260200161263160219139610602565b905090565b6000610a7c610a4a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610ab457600080fd5b505afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d9190612227565b610b2460405180604001604052806017815260200176283937bc3cafafaa29a9afa3b937bab826b0b730b3b2b960491b815250610602565b6001600160a01b0316633231a7f083604051602001610b4591815260200190565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401610b7992919061235f565b602060405180830381600087803b158015610b9357600080fd5b505af1158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb91906121b6565b610c115760405162461bcd60e51b81526020600482015260176024820152761d995c9a599e481cda59db985d1d5c994819985a5b1959604a1b6044820152606401610249565b600082604051602401610c2691815260200190565b60408051601f198184030181529190526020810180516001600160e01b031663f523f40d60e01b1790529050610c7473deaddeaddeaddeaddeaddeaddeaddeaddead2222621e8480836116d4565b60405183907f8ef5d07412def056f6bfc680f359c8a0370cfacb2becaf67d01e2e372e08964a90600090a2505050565b610cdc60405180604001604052806017815260200176283937bc3cafafaa29a9afa3b937bab826b0b730b3b2b960491b815250610602565b6001600160a01b0316633231a7f08484604051602001610cfd929190612378565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401610d3192919061235f565b602060405180830381600087803b158015610d4b57600080fd5b505af1158015610d5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8391906121b6565b61031d5760405162461bcd60e51b81526020600482015260176024820152761d995c9a599e481cda59db985d1d5c994819985a5b1959604a1b6044820152606401610249565b6000610df86040518060400160405280600c81526020016b212b26afa83937b837b9b2b960a11b815250610602565b9050600080610e056113f8565b9092509050336001600160a01b0384161415610e22575042610eb7565b426003548264ffffffffff16610e389190612256565b10610eb75760405162461bcd60e51b815260206004820152604360248201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960448201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460648201526237bb9760e91b608482015260a401610249565b60006040518060c00160405280610ecc610a72565b8152602001610eda8961173f565b8152602001885181526020018464ffffffffff16815260200187815260200186815250905080600001517f9cf3ad24eae3fd6d461e2f566b35b95b6d671871d9fcb45f8ac8030e4a8d21b382602001518360400151846060015185608001518660a00151604051610f4f9594939291906123c0565b60405180910390a2610f5f610a4a565b6001600160a01b0316632015276c610f7683611c1a565b610f9b84604001518560600151610f8d9190612256565b602887811b91909117901b90565b6040516001600160e01b031960e085901b168152600481019290925264ffffffffff19166024820152604401600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505050505050505050565b600061103c60405180604001604052806017815260200176283937bc3cafafaa29a9afa3b937bab826b0b730b3b2b960491b815250610602565b6001600160a01b0316632cd00d536040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561107657600080fd5b505af115801561108a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110b29190810190612403565b905060008151116111055760405162461bcd60e51b815260206004820152601860248201527f67657420747373206d656d6265727320696e206572726f7200000000000000006044820152606401610249565b6000630fae75d960e01b8385428560405160240161112694939291906124e1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905061116f6020602160991b01621e8480836116d4565b42837ff533ef50019763ee9d95ad46e28350b533c11edd472ae7be93e8fae83c1b6d9986856040516111a2929190612510565b60405180910390a350505050565b60006111ba610a4a565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a916111ec9160040190815260200190565b60206040518083038186803b15801561120457600080fd5b505afa158015611218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123c9190612227565b61124583611c1a565b1492915050565b611254610a4a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561128c57600080fd5b505afa1580156112a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c49190612227565b81511061130a5760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b2103130ba31b41034b73232bc1760611b6044820152606401610249565b611313816111b0565b61132f5760405162461bcd60e51b815260040161024990612300565b611337610a4a565b815160608301516001600160a01b03929092169163167fd681919060281b6040516001600160e01b031960e085901b168152600481019290925264ffffffffff19166024820152604401600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd6482602001516040516113ed91815260200190565b60405180910390a250565b6000806000611405610a4a565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561143d57600080fd5b505afa158015611451573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114759190612529565b64ffffffffff602882901c169460509190911c9350915050565b60008082116115065760405162461bcd60e51b815260206004820152603760248201527f4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d757360448201527f742062652067726561746572207468616e207a65726f2e0000000000000000006064820152608401610249565b8184106115615760405162461bcd60e51b8152602060048201526024808201527f4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756044820152633732399760e11b6064820152608401610249565b61156a82611c63565b8351146115f55760405162461bcd60e51b815260206004820152604d60248201527f4c69625f4d65726b6c65547265653a20546f74616c207369626c696e6773206460448201527f6f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f2060648201526c3a37ba30b6103632b0bb32b99760991b608482015260a401610249565b8460005b84518110156116c75785600116600114156116605784818151811061162057611620612551565b602002602001015182604051602001611643929190918252602082015260400190565b6040516020818303038152906040528051906020012091506116ae565b8185828151811061167357611673612551565b6020026020010151604051602001611695929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b60019590951c94806116bf81612567565b9150506115f9565b5090951495945050505050565b600154604051633dbb202b60e01b81526001600160a01b0390911690633dbb202b9061170890869085908790600401612582565b600060405180830381600087803b15801561172257600080fd5b505af1158015611736573d6000803e3d6000fd5b50505050505050565b6000808251116117ae5760405162461bcd60e51b815260206004820152603460248201527f4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206044820152733632b0b9ba1037b732903632b0b3103430b9b41760611b6064820152608401610249565b8151600114156117da57816000815181106117cb576117cb612551565b60200260200101519050919050565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b6001841115611bf057611a8b6002856125d2565b9150611a986002856125e6565b600114905060005b82811015611b44578a611ab48260026125fa565b81518110611ac457611ac4612551565b602002602001015196508a816002611adc91906125fa565b611ae7906001612256565b81518110611af757611af7612551565b6020026020010151955086602089015285604089015287805190602001208b8281518110611b2757611b27612551565b602090810291909101015280611b3c81612567565b915050611aa0565b508015611bc05789611b57600186612619565b81518110611b6757611b67612551565b60200260200101519550878360108110611b8357611b83612551565b602002015160001b945085602088015284604088015286805190602001208a8381518110611bb357611bb3612551565b6020026020010181815250505b80611bcc576000611bcf565b60015b611bdc9060ff1683612256565b935082611be881612567565b935050611a77565b89600081518110611c0357611c03612551565b602002602001015198505050505050505050919050565b6020808201516040808401516060850151608086015160a08701519351600096611c46969591016123c0565b604051602081830303815290604052805190602001209050919050565b6000808211611ccd5760405162461bcd60e51b815260206004820152603060248201527f4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206360448201526f32b4b6143637b3af99149037b310181760811b6064820152608401610249565b8160011415611cde57506000919050565b81600060805b60018110611d1c5780611cfa600180831b612619565b901b831615611d1457611d0d8183612256565b92811c9291505b60011c611ce4565b506001811b8414611d3557611d32600182612256565b90505b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715611d7557611d75611d3c565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611da457611da4611d3c565b604052919050565b600067ffffffffffffffff831115611dc657611dc6611d3c565b611dd9601f8401601f1916602001611d7b565b9050828152838383011115611ded57600080fd5b828260208301376000602084830101529392505050565b600082601f830112611e1557600080fd5b611d3583833560208501611dac565b600080600060608486031215611e3957600080fd5b8335925060208401359150604084013567ffffffffffffffff811115611e5e57600080fd5b611e6a86828701611e04565b9150509250925092565b600067ffffffffffffffff821115611e8e57611e8e611d3c565b5060051b60200190565b600082601f830112611ea957600080fd5b81356020611ebe611eb983611e74565b611d7b565b82815260059290921b84018101918181019086841115611edd57600080fd5b8286015b84811015611ef85780358352918301918301611ee1565b509695505050505050565b600080600060608486031215611f1857600080fd5b833567ffffffffffffffff80821115611f3057600080fd5b611f3c87838801611e98565b9450602086013593506040860135915080821115611f5957600080fd5b50611e6a86828701611e04565b600060208284031215611f7857600080fd5b813567ffffffffffffffff811115611f8f57600080fd5b8201601f81018413611fa057600080fd5b611faf84823560208401611dac565b949350505050565b600060c08284031215611fc957600080fd5b611fd1611d52565b905081358152602082013560208201526040820135604082015260608201356060820152608082013567ffffffffffffffff8082111561201057600080fd5b61201c85838601611e04565b608084015260a084013591508082111561203557600080fd5b5061204284828501611e04565b60a08301525092915050565b60006020828403121561206057600080fd5b813567ffffffffffffffff81111561207757600080fd5b611faf84828501611fb7565b60006020828403121561209557600080fd5b5035919050565b6000806000606084860312156120b157600080fd5b83359250602084013567ffffffffffffffff808211156120d057600080fd5b6120dc87838801611fb7565b935060408601359150808211156120f257600080fd5b908501906040828803121561210657600080fd5b60405160408101818110838211171561212157612121611d3c565b6040528235815260208301358281111561213a57600080fd5b61214689828601611e98565b6020830152508093505050509250925092565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6000602082840312156121c857600080fd5b81518015158114611d3557600080fd5b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60006020828403121561223957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561226957612269612240565b500190565b6000815180845260005b8181101561229457602081850181015186830182015201612278565b818111156122a6576000602083870101525b50601f01601f19169290920160200192915050565b602081526000611d35602083018461226e565b6001600160a01b03811681146107ec57600080fd5b6000602082840312156122f557600080fd5b8151611d35816122ce565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b6000806040838503121561234257600080fd5b825191506020830151612354816122ce565b809150509250929050565b828152604060208201526000611faf604083018461226e565b604080825283519082018190526000906020906060840190828701845b828110156123b157815184529284019290840190600101612395565b50505092019290925292915050565b85815284602082015283604082015260a0606082015260006123e560a083018561226e565b82810360808401526123f7818561226e565b98975050505050505050565b6000602080838503121561241657600080fd5b825167ffffffffffffffff81111561242d57600080fd5b8301601f8101851361243e57600080fd5b805161244c611eb982611e74565b81815260059190911b8201830190838101908783111561246b57600080fd5b928401925b82841015612492578351612483816122ce565b82529284019290840190612470565b979650505050505050565b600081518084526020808501945080840160005b838110156124d65781516001600160a01b0316875295820195908201906001016124b1565b509495945050505050565b848152836020820152826040820152608060608201526000612506608083018461249d565b9695505050505050565b828152604060208201526000611faf604083018461249d565b60006020828403121561253b57600080fd5b815164ffffffffff1981168114611d3557600080fd5b634e487b7160e01b600052603260045260246000fd5b600060001982141561257b5761257b612240565b5060010190565b6001600160a01b03841681526060602082018190526000906125a69083018561226e565b905063ffffffff83166040830152949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826125e1576125e16125bc565b500490565b6000826125f5576125f56125bc565b500690565b600081600019048311821515161561261457612614612240565b500290565b60008282101561262b5761262b612240565b50039056fe436861696e53746f72616765436f6e7461696e65722d5343432d62617463686573a2646970667358221220a5535ff5cd353b344d35a54fa67fb2411baea65e6004476dc7c0b0750c418bc064736f6c634300080900330000000000000000000000006968f3f16c3e64003f02e121cf0d5ccbf5625a42000000000000000000000000676a795fe6e43c17c668de16730c3f690feb71200000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000c02380
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80637ad168a011610097578063b768bb1711610066578063b768bb17146101f7578063c17b291b1461020a578063cfdf677e14610213578063e561dddc1461021b57600080fd5b80637ad168a0146101b057806381eb62ef146101b857806389a1d980146101c1578063ab59f7b8146101e457600080fd5b8063461a4478116100d3578063461a44781461017057806355a17f8a146101835780635b4d90e2146101955780637aa63a86146101a857600080fd5b80630bf3b5f2146101055780632169f79f1461011a578063299ca4781461012d5780633cb747bf1461015d575b600080fd5b610118610113366004611e24565b610223565b005b610118610128366004611f03565b610322565b600054610140906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b600154610140906001600160a01b031681565b61014061017e366004611f66565b610602565b6002545b604051908152602001610154565b6101186101a336600461204e565b610689565b6101876107ef565b610187610808565b61018760035481565b6101d46101cf36600461204e565b610821565b6040519015158152602001610154565b6101186101f2366004612083565b6108b1565b6101d461020536600461209c565b6109b0565b61018760025481565b610140610a4a565b610187610a72565b61022b6107ef565b82146102525760405162461bcd60e51b815260040161024990612159565b60405180910390fd5b61027e6040518060400160405280600b81526020016a2137b73226b0b730b3b2b960a91b815250610602565b604051630156a69560e11b81523360048201526001600160a01b0391909116906302ad4d2a9060240160206040518083038186803b1580156102bf57600080fd5b505afa1580156102d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f791906121b6565b6103135760405162461bcd60e51b8152600401610249906121d8565b61031d8382610aec565b505050565b61032a6107ef565b82146103485760405162461bcd60e51b815260040161024990612159565b6103746040518060400160405280600b81526020016a2137b73226b0b730b3b2b960a91b815250610602565b604051630156a69560e11b81523360048201526001600160a01b0391909116906302ad4d2a9060240160206040518083038186803b1580156103b557600080fd5b505afa1580156103c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ed91906121b6565b6104095760405162461bcd60e51b8152600401610249906121d8565b60008351116104665760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f74207375626d697420616e20656d7074792073746174652062617460448201526231b41760e91b6064820152608401610249565b6104a46040518060400160405280601981526020017f43616e6f6e6963616c5472616e73616374696f6e436861696e00000000000000815250610602565b6001600160a01b0316637aa63a866040518163ffffffff1660e01b815260040160206040518083038186803b1580156104dc57600080fd5b505afa1580156104f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105149190612227565b835161051e6107ef565b6105289190612256565b11156105ae5760405162461bcd60e51b815260206004820152604960248201527f4e756d626572206f6620737461746520726f6f74732063616e6e6f742065786360448201527f65656420746865206e756d626572206f662063616e6f6e6963616c207472616e60648201526839b0b1ba34b7b7399760b91b608482015260a401610249565b6105b9838383610ca4565b6105f7838242336040516020016105e39291909182526001600160a01b0316602082015260400190565b604051602081830303815290604052610dc9565b61031d835183611002565b6000805460405163bf40fac160e01b81526001600160a01b039091169063bf40fac1906106339085906004016122bb565b60206040518083038186803b15801561064b57600080fd5b505afa15801561065f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068391906122e3565b92915050565b6106bb60405180604001604052806011815260200170212b26afa33930bab22b32b934b334b2b960791b815250610602565b6001600160a01b0316336001600160a01b0316146107415760405162461bcd60e51b815260206004820152603b60248201527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f64206279207468652042564d5f467261756456657269666965722e00000000006064820152608401610249565b61074a816111b0565b6107665760405162461bcd60e51b815260040161024990612300565b61076f81610821565b6107e3576040805162461bcd60e51b81526020600482015260248101919091527f537461746520626174636865732063616e206f6e6c792062652064656c65746560448201527f642077697468696e207468652066726175642070726f6f662077696e646f772e6064820152608401610249565b6107ec8161124c565b50565b6000806107fa6113f8565b5064ffffffffff1692915050565b6000806108136113f8565b64ffffffffff169392505050565b6000808260a0015180602001905181019061083c919061232f565b5090508061089a5760405162461bcd60e51b815260206004820152602560248201527f4261746368206865616465722074696d657374616d702063616e6e6f74206265604482015264207a65726f60d81b6064820152608401610249565b42600254826108a99190612256565b119392505050565b60008054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fd57600080fd5b505afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093591906122e3565b6001600160a01b0316336001600160a01b0316146109ab5760405162461bcd60e51b815260206004820152602d60248201527f4f6e6c792063616c6c61626c6520627920746865206c6962416464726573734d60448201526c30b730b3b2b91037bbb732b91760991b6064820152608401610249565b600255565b60006109bb836111b0565b6109d75760405162461bcd60e51b815260040161024990612300565b6109f483602001518584600001518560200151876040015161148f565b610a405760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420696e636c7573696f6e2070726f6f662e00000000000000006044820152606401610249565b5060019392505050565b6000610a6d60405180606001604052806021815260200161263160219139610602565b905090565b6000610a7c610a4a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b158015610ab457600080fd5b505afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6d9190612227565b610b2460405180604001604052806017815260200176283937bc3cafafaa29a9afa3b937bab826b0b730b3b2b960491b815250610602565b6001600160a01b0316633231a7f083604051602001610b4591815260200190565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401610b7992919061235f565b602060405180830381600087803b158015610b9357600080fd5b505af1158015610ba7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bcb91906121b6565b610c115760405162461bcd60e51b81526020600482015260176024820152761d995c9a599e481cda59db985d1d5c994819985a5b1959604a1b6044820152606401610249565b600082604051602401610c2691815260200190565b60408051601f198184030181529190526020810180516001600160e01b031663f523f40d60e01b1790529050610c7473deaddeaddeaddeaddeaddeaddeaddeaddead2222621e8480836116d4565b60405183907f8ef5d07412def056f6bfc680f359c8a0370cfacb2becaf67d01e2e372e08964a90600090a2505050565b610cdc60405180604001604052806017815260200176283937bc3cafafaa29a9afa3b937bab826b0b730b3b2b960491b815250610602565b6001600160a01b0316633231a7f08484604051602001610cfd929190612378565b60405160208183030381529060405280519060200120836040518363ffffffff1660e01b8152600401610d3192919061235f565b602060405180830381600087803b158015610d4b57600080fd5b505af1158015610d5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8391906121b6565b61031d5760405162461bcd60e51b81526020600482015260176024820152761d995c9a599e481cda59db985d1d5c994819985a5b1959604a1b6044820152606401610249565b6000610df86040518060400160405280600c81526020016b212b26afa83937b837b9b2b960a11b815250610602565b9050600080610e056113f8565b9092509050336001600160a01b0384161415610e22575042610eb7565b426003548264ffffffffff16610e389190612256565b10610eb75760405162461bcd60e51b815260206004820152604360248201527f43616e6e6f74207075626c69736820737461746520726f6f747320776974686960448201527f6e207468652073657175656e636572207075626c69636174696f6e2077696e6460648201526237bb9760e91b608482015260a401610249565b60006040518060c00160405280610ecc610a72565b8152602001610eda8961173f565b8152602001885181526020018464ffffffffff16815260200187815260200186815250905080600001517f9cf3ad24eae3fd6d461e2f566b35b95b6d671871d9fcb45f8ac8030e4a8d21b382602001518360400151846060015185608001518660a00151604051610f4f9594939291906123c0565b60405180910390a2610f5f610a4a565b6001600160a01b0316632015276c610f7683611c1a565b610f9b84604001518560600151610f8d9190612256565b602887811b91909117901b90565b6040516001600160e01b031960e085901b168152600481019290925264ffffffffff19166024820152604401600060405180830381600087803b158015610fe157600080fd5b505af1158015610ff5573d6000803e3d6000fd5b5050505050505050505050565b600061103c60405180604001604052806017815260200176283937bc3cafafaa29a9afa3b937bab826b0b730b3b2b960491b815250610602565b6001600160a01b0316632cd00d536040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561107657600080fd5b505af115801561108a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110b29190810190612403565b905060008151116111055760405162461bcd60e51b815260206004820152601860248201527f67657420747373206d656d6265727320696e206572726f7200000000000000006044820152606401610249565b6000630fae75d960e01b8385428560405160240161112694939291906124e1565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905061116f6020602160991b01621e8480836116d4565b42837ff533ef50019763ee9d95ad46e28350b533c11edd472ae7be93e8fae83c1b6d9986856040516111a2929190612510565b60405180910390a350505050565b60006111ba610a4a565b8251604051634a83e9cd60e11b81526001600160a01b039290921691639507d39a916111ec9160040190815260200190565b60206040518083038186803b15801561120457600080fd5b505afa158015611218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123c9190612227565b61124583611c1a565b1492915050565b611254610a4a565b6001600160a01b0316631f7b6d326040518163ffffffff1660e01b815260040160206040518083038186803b15801561128c57600080fd5b505afa1580156112a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c49190612227565b81511061130a5760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b2103130ba31b41034b73232bc1760611b6044820152606401610249565b611313816111b0565b61132f5760405162461bcd60e51b815260040161024990612300565b611337610a4a565b815160608301516001600160a01b03929092169163167fd681919060281b6040516001600160e01b031960e085901b168152600481019290925264ffffffffff19166024820152604401600060405180830381600087803b15801561139b57600080fd5b505af11580156113af573d6000803e3d6000fd5b5050505080600001517f8747b69ce8fdb31c3b9b0a67bd8049ad8c1a69ea417b69b12174068abd9cbd6482602001516040516113ed91815260200190565b60405180910390a250565b6000806000611405610a4a565b6001600160a01b031663ccf8f9696040518163ffffffff1660e01b815260040160206040518083038186803b15801561143d57600080fd5b505afa158015611451573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114759190612529565b64ffffffffff602882901c169460509190911c9350915050565b60008082116115065760405162461bcd60e51b815260206004820152603760248201527f4c69625f4d65726b6c65547265653a20546f74616c206c6561766573206d757360448201527f742062652067726561746572207468616e207a65726f2e0000000000000000006064820152608401610249565b8184106115615760405162461bcd60e51b8152602060048201526024808201527f4c69625f4d65726b6c65547265653a20496e646578206f7574206f6620626f756044820152633732399760e11b6064820152608401610249565b61156a82611c63565b8351146115f55760405162461bcd60e51b815260206004820152604d60248201527f4c69625f4d65726b6c65547265653a20546f74616c207369626c696e6773206460448201527f6f6573206e6f7420636f72726563746c7920636f72726573706f6e6420746f2060648201526c3a37ba30b6103632b0bb32b99760991b608482015260a401610249565b8460005b84518110156116c75785600116600114156116605784818151811061162057611620612551565b602002602001015182604051602001611643929190918252602082015260400190565b6040516020818303038152906040528051906020012091506116ae565b8185828151811061167357611673612551565b6020026020010151604051602001611695929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b60019590951c94806116bf81612567565b9150506115f9565b5090951495945050505050565b600154604051633dbb202b60e01b81526001600160a01b0390911690633dbb202b9061170890869085908790600401612582565b600060405180830381600087803b15801561172257600080fd5b505af1158015611736573d6000803e3d6000fd5b50505050505050565b6000808251116117ae5760405162461bcd60e51b815260206004820152603460248201527f4c69625f4d65726b6c65547265653a204d7573742070726f76696465206174206044820152733632b0b9ba1037b732903632b0b3103430b9b41760611b6064820152608401610249565b8151600114156117da57816000815181106117cb576117cb612551565b60200260200101519050919050565b60408051610200810182527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56381527f633dc4d7da7256660a892f8f1604a44b5432649cc8ec5cb3ced4c4e6ac94dd1d60208201527f890740a8eb06ce9be422cb8da5cdafc2b58c0a5e24036c578de2a433c828ff7d818301527f3b8ec09e026fdc305365dfc94e189a81b38c7597b3d941c279f042e8206e0bd86060808301919091527fecd50eee38e386bd62be9bedb990706951b65fe053bd9d8a521af753d139e2da60808301527fdefff6d330bb5403f63b14f33b578274160de3a50df4efecf0e0db73bcdd3da560a08301527f617bdd11f7c0a11f49db22f629387a12da7596f9d1704d7465177c63d88ec7d760c08301527f292c23a9aa1d8bea7e2435e555a4a60e379a5a35f3f452bae60121073fb6eead60e08301527fe1cea92ed99acdcb045a6726b2f87107e8a61620a232cf4d7d5b5766b3952e106101008301527f7ad66c0a68c72cb89e4fb4303841966e4062a76ab97451e3b9fb526a5ceb7f826101208301527fe026cc5a4aed3c22a58cbd3d2ac754c9352c5436f638042dca99034e836365166101408301527f3d04cffd8b46a874edf5cfae63077de85f849a660426697b06a829c70dd1409c6101608301527fad676aa337a485e4728a0b240d92b3ef7b3c372d06d189322bfd5f61f1e7203e6101808301527fa2fca4a49658f9fab7aa63289c91b7c7b6c832a6d0e69334ff5b0a3483d09dab6101a08301527f4ebfd9cd7bca2505f7bef59cc1c12ecc708fff26ae4af19abe852afe9e20c8626101c08301527f2def10d13dd169f550f578bda343d9717a138562e0093b380a1120789d53cf106101e083015282518381529081018352909160009190602082018180368337505085519192506000918291508180805b6001841115611bf057611a8b6002856125d2565b9150611a986002856125e6565b600114905060005b82811015611b44578a611ab48260026125fa565b81518110611ac457611ac4612551565b602002602001015196508a816002611adc91906125fa565b611ae7906001612256565b81518110611af757611af7612551565b6020026020010151955086602089015285604089015287805190602001208b8281518110611b2757611b27612551565b602090810291909101015280611b3c81612567565b915050611aa0565b508015611bc05789611b57600186612619565b81518110611b6757611b67612551565b60200260200101519550878360108110611b8357611b83612551565b602002015160001b945085602088015284604088015286805190602001208a8381518110611bb357611bb3612551565b6020026020010181815250505b80611bcc576000611bcf565b60015b611bdc9060ff1683612256565b935082611be881612567565b935050611a77565b89600081518110611c0357611c03612551565b602002602001015198505050505050505050919050565b6020808201516040808401516060850151608086015160a08701519351600096611c46969591016123c0565b604051602081830303815290604052805190602001209050919050565b6000808211611ccd5760405162461bcd60e51b815260206004820152603060248201527f4c69625f4d65726b6c65547265653a2043616e6e6f7420636f6d70757465206360448201526f32b4b6143637b3af99149037b310181760811b6064820152608401610249565b8160011415611cde57506000919050565b81600060805b60018110611d1c5780611cfa600180831b612619565b901b831615611d1457611d0d8183612256565b92811c9291505b60011c611ce4565b506001811b8414611d3557611d32600182612256565b90505b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715611d7557611d75611d3c565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611da457611da4611d3c565b604052919050565b600067ffffffffffffffff831115611dc657611dc6611d3c565b611dd9601f8401601f1916602001611d7b565b9050828152838383011115611ded57600080fd5b828260208301376000602084830101529392505050565b600082601f830112611e1557600080fd5b611d3583833560208501611dac565b600080600060608486031215611e3957600080fd5b8335925060208401359150604084013567ffffffffffffffff811115611e5e57600080fd5b611e6a86828701611e04565b9150509250925092565b600067ffffffffffffffff821115611e8e57611e8e611d3c565b5060051b60200190565b600082601f830112611ea957600080fd5b81356020611ebe611eb983611e74565b611d7b565b82815260059290921b84018101918181019086841115611edd57600080fd5b8286015b84811015611ef85780358352918301918301611ee1565b509695505050505050565b600080600060608486031215611f1857600080fd5b833567ffffffffffffffff80821115611f3057600080fd5b611f3c87838801611e98565b9450602086013593506040860135915080821115611f5957600080fd5b50611e6a86828701611e04565b600060208284031215611f7857600080fd5b813567ffffffffffffffff811115611f8f57600080fd5b8201601f81018413611fa057600080fd5b611faf84823560208401611dac565b949350505050565b600060c08284031215611fc957600080fd5b611fd1611d52565b905081358152602082013560208201526040820135604082015260608201356060820152608082013567ffffffffffffffff8082111561201057600080fd5b61201c85838601611e04565b608084015260a084013591508082111561203557600080fd5b5061204284828501611e04565b60a08301525092915050565b60006020828403121561206057600080fd5b813567ffffffffffffffff81111561207757600080fd5b611faf84828501611fb7565b60006020828403121561209557600080fd5b5035919050565b6000806000606084860312156120b157600080fd5b83359250602084013567ffffffffffffffff808211156120d057600080fd5b6120dc87838801611fb7565b935060408601359150808211156120f257600080fd5b908501906040828803121561210657600080fd5b60405160408101818110838211171561212157612121611d3c565b6040528235815260208301358281111561213a57600080fd5b61214689828601611e98565b6020830152508093505050509250925092565b6020808252603d908201527f41637475616c20626174636820737461727420696e64657820646f6573206e6f60408201527f74206d6174636820657870656374656420737461727420696e6465782e000000606082015260800190565b6000602082840312156121c857600080fd5b81518015158114611d3557600080fd5b6020808252602f908201527f50726f706f73657220646f6573206e6f74206861766520656e6f75676820636f60408201526e1b1b185d195c985b081c1bdcdd1959608a1b606082015260800190565b60006020828403121561223957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561226957612269612240565b500190565b6000815180845260005b8181101561229457602081850181015186830182015201612278565b818111156122a6576000602083870101525b50601f01601f19169290920160200192915050565b602081526000611d35602083018461226e565b6001600160a01b03811681146107ec57600080fd5b6000602082840312156122f557600080fd5b8151611d35816122ce565b60208082526015908201527424b73b30b634b2103130ba31b4103432b0b232b91760591b604082015260600190565b6000806040838503121561234257600080fd5b825191506020830151612354816122ce565b809150509250929050565b828152604060208201526000611faf604083018461226e565b604080825283519082018190526000906020906060840190828701845b828110156123b157815184529284019290840190600101612395565b50505092019290925292915050565b85815284602082015283604082015260a0606082015260006123e560a083018561226e565b82810360808401526123f7818561226e565b98975050505050505050565b6000602080838503121561241657600080fd5b825167ffffffffffffffff81111561242d57600080fd5b8301601f8101851361243e57600080fd5b805161244c611eb982611e74565b81815260059190911b8201830190838101908783111561246b57600080fd5b928401925b82841015612492578351612483816122ce565b82529284019290840190612470565b979650505050505050565b600081518084526020808501945080840160005b838110156124d65781516001600160a01b0316875295820195908201906001016124b1565b509495945050505050565b848152836020820152826040820152608060608201526000612506608083018461249d565b9695505050505050565b828152604060208201526000611faf604083018461249d565b60006020828403121561253b57600080fd5b815164ffffffffff1981168114611d3557600080fd5b634e487b7160e01b600052603260045260246000fd5b600060001982141561257b5761257b612240565b5060010190565b6001600160a01b03841681526060602082018190526000906125a69083018561226e565b905063ffffffff83166040830152949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826125e1576125e16125bc565b500490565b6000826125f5576125f56125bc565b500690565b600081600019048311821515161561261457612614612240565b500290565b60008282101561262b5761262b612240565b50039056fe436861696e53746f72616765436f6e7461696e65722d5343432d62617463686573a2646970667358221220a5535ff5cd353b344d35a54fa67fb2411baea65e6004476dc7c0b0750c418bc064736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006968f3f16c3e64003f02e121cf0d5ccbf5625a42000000000000000000000000676a795fe6e43c17c668de16730c3f690feb71200000000000000000000000000000000000000000000000000000000000093a800000000000000000000000000000000000000000000000000000000000c02380
-----Decoded View---------------
Arg [0] : _libAddressManager (address): 0x6968f3F16C3e64003F02E121cf0D5CCBf5625a42
Arg [1] : _l1messenger (address): 0x676A795fe6E43C17c668de16730c3F690FEB7120
Arg [2] : _fraudProofWindow (uint256): 604800
Arg [3] : _sequencerPublishWindow (uint256): 12592000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000006968f3f16c3e64003f02e121cf0d5ccbf5625a42
Arg [1] : 000000000000000000000000676a795fe6e43c17c668de16730c3f690feb7120
Arg [2] : 0000000000000000000000000000000000000000000000000000000000093a80
Arg [3] : 0000000000000000000000000000000000000000000000000000000000c02380
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.