Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SequencerInbox
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import {
AlreadyInit,
HadZeroInit,
NotOrigin,
DataTooLarge,
DelayedBackwards,
DelayedTooFar,
ForceIncludeBlockTooSoon,
IncorrectMessagePreimage,
NotBatchPoster,
BadSequencerNumber,
AlreadyValidDASKeyset,
NoSuchKeyset,
NotForked,
NotBatchPosterManager,
NotCodelessOrigin,
RollupNotChanged,
DataBlobsNotSupported,
InitParamZero,
MissingDataHashes,
NotOwner,
InvalidHeaderFlag,
NativeTokenMismatch,
BadMaxTimeVariation,
Deprecated,
CannotSetFeeTokenPricer,
NotDelayBufferable,
InvalidDelayedAccPreimage,
DelayProofRequired,
BadBufferConfig,
ExtraGasNotUint64,
KeysetTooLarge
} from "../libraries/Error.sol";
import "./IBridge.sol";
import "./IInboxBase.sol";
import "./ISequencerInbox.sol";
import "../rollup/IRollupLogic.sol";
import "./Messages.sol";
import "../precompiles/ArbGasInfo.sol";
import "../precompiles/ArbSys.sol";
import "../libraries/CallerChecker.sol";
import "../libraries/IReader4844.sol";
import "../libraries/DelegateCallAware.sol";
import {IGasRefunder} from "../libraries/IGasRefunder.sol";
import {GasRefundEnabled} from "../libraries/GasRefundEnabled.sol";
import "../libraries/ArbitrumChecker.sol";
import {IERC20Bridge} from "./IERC20Bridge.sol";
import "./DelayBuffer.sol";
/**
* @title Accepts batches from the sequencer and adds them to the rollup inbox.
* @notice Contains the inbox accumulator which is the ordering of all data and transactions to be processed by the rollup.
* As part of submitting a batch the sequencer is also expected to include items enqueued
* in the delayed inbox (Bridge.sol). If items in the delayed inbox are not included by a
* sequencer within a time limit they can be force included into the rollup inbox by anyone.
*/
contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox {
using DelayBuffer for BufferData;
uint256 public totalDelayedMessagesRead;
IBridge public bridge;
/// @inheritdoc ISequencerInbox
uint256 public constant HEADER_LENGTH = 40;
/// @inheritdoc ISequencerInbox
bytes1 public constant DATA_AUTHENTICATED_FLAG = 0x40;
/// @inheritdoc ISequencerInbox
bytes1 public constant DATA_BLOB_HEADER_FLAG = DATA_AUTHENTICATED_FLAG | 0x10;
/// @inheritdoc ISequencerInbox
bytes1 public constant DAS_MESSAGE_HEADER_FLAG = 0x80;
/// @inheritdoc ISequencerInbox
bytes1 public constant TREE_DAS_MESSAGE_HEADER_FLAG = 0x08;
/// @inheritdoc ISequencerInbox
bytes1 public constant BROTLI_MESSAGE_HEADER_FLAG = 0x00;
/// @inheritdoc ISequencerInbox
bytes1 public constant ZERO_HEAVY_MESSAGE_HEADER_FLAG = 0x20;
// GAS_PER_BLOB from EIP-4844
uint256 internal constant GAS_PER_BLOB = 1 << 17;
IOwnable public rollup;
mapping(address => bool) public isBatchPoster;
// we previously stored the max time variation in a (uint,uint,uint,uint) struct here
// solhint-disable-next-line var-name-mixedcase
ISequencerInbox.MaxTimeVariation private __LEGACY_MAX_TIME_VARIATION;
mapping(bytes32 => DasKeySetInfo) public dasKeySetInfo;
modifier onlyRollupOwner() {
if (msg.sender != rollup.owner()) revert NotOwner(msg.sender, rollup.owner());
_;
}
modifier onlyRollupOwnerOrBatchPosterManager() {
if (msg.sender != rollup.owner() && msg.sender != batchPosterManager) {
revert NotBatchPosterManager(msg.sender);
}
_;
}
mapping(address => bool) public isSequencer;
IReader4844 public immutable reader4844;
// see ISequencerInbox.MaxTimeVariation
uint64 internal delayBlocks;
uint64 internal futureBlocks;
uint64 internal delaySeconds;
uint64 internal futureSeconds;
/// @inheritdoc ISequencerInbox
address public batchPosterManager;
BufferData public buffer;
/// @inheritdoc ISequencerInbox
IFeeTokenPricer public feeTokenPricer;
// On L1 this should be set to 117964: 90% of Geth's 128KB tx size limit, leaving ~13KB for proving
uint256 public immutable maxDataSize;
uint256 internal immutable deployTimeChainId = block.chainid;
// If the chain this SequencerInbox is deployed on is an Arbitrum chain.
bool internal immutable hostChainIsArbitrum = ArbitrumChecker.runningOnArbitrum();
// True if the chain this SequencerInbox is deployed on uses custom fee token
bool public immutable isUsingFeeToken;
// True if the SequencerInbox is delay bufferable
bool public immutable isDelayBufferable;
constructor(
uint256 _maxDataSize,
IReader4844 reader4844_,
bool _isUsingFeeToken,
bool _isDelayBufferable
) {
maxDataSize = _maxDataSize;
if (hostChainIsArbitrum) {
if (reader4844_ != IReader4844(address(0))) revert DataBlobsNotSupported();
} else {
if (reader4844_ == IReader4844(address(0))) revert InitParamZero("Reader4844");
}
reader4844 = reader4844_;
isUsingFeeToken = _isUsingFeeToken;
isDelayBufferable = _isDelayBufferable;
}
function _chainIdChanged() internal view returns (bool) {
return deployTimeChainId != block.chainid;
}
function postUpgradeInit(
BufferConfig memory bufferConfig_
) external onlyDelegated onlyProxyOwner {
if (!isDelayBufferable) revert NotDelayBufferable();
// Assuming we would not upgrade from a version that does not have the buffer initialized
// If that is the case, postUpgradeInit do not need to be called
if (buffer.bufferBlocks != 0) {
revert AlreadyInit();
}
_setBufferConfig(bufferConfig_);
}
function initialize(
IBridge bridge_,
ISequencerInbox.MaxTimeVariation calldata maxTimeVariation_,
BufferConfig memory bufferConfig_,
IFeeTokenPricer feeTokenPricer_
) external onlyDelegated {
if (bridge != IBridge(address(0))) revert AlreadyInit();
if (bridge_ == IBridge(address(0))) revert HadZeroInit();
// Make sure logic contract was created by proper value for 'isUsingFeeToken'.
// Bridge in ETH based chains doesn't implement nativeToken(). In future it might implement it and return address(0)
bool actualIsUsingFeeToken = false;
try IERC20Bridge(address(bridge_)).nativeToken() returns (address feeToken) {
if (feeToken != address(0)) {
actualIsUsingFeeToken = true;
}
} catch {}
if (isUsingFeeToken != actualIsUsingFeeToken) {
revert NativeTokenMismatch();
}
bridge = bridge_;
rollup = bridge_.rollup();
_setMaxTimeVariation(maxTimeVariation_);
if (isDelayBufferable) {
_setBufferConfig(bufferConfig_);
}
if (!isUsingFeeToken && feeTokenPricer_ != IFeeTokenPricer(address(0))) {
revert CannotSetFeeTokenPricer();
}
feeTokenPricer = feeTokenPricer_;
}
/// @notice Allows the rollup owner to sync the rollup address
function updateRollupAddress() external {
if (msg.sender != IOwnable(rollup).owner()) {
revert NotOwner(msg.sender, IOwnable(rollup).owner());
}
IOwnable newRollup = bridge.rollup();
if (rollup == newRollup) revert RollupNotChanged();
rollup = newRollup;
}
function getTimeBounds() internal view virtual returns (IBridge.TimeBounds memory) {
IBridge.TimeBounds memory bounds;
(uint64 delayBlocks_, uint64 futureBlocks_, uint64 delaySeconds_, uint64 futureSeconds_) =
maxTimeVariationInternal();
if (block.timestamp > delaySeconds_) {
bounds.minTimestamp = uint64(block.timestamp) - delaySeconds_;
}
bounds.maxTimestamp = uint64(block.timestamp) + futureSeconds_;
if (block.number > delayBlocks_) {
bounds.minBlockNumber = uint64(block.number) - delayBlocks_;
}
bounds.maxBlockNumber = uint64(block.number) + futureBlocks_;
return bounds;
}
/// @inheritdoc ISequencerInbox
function removeDelayAfterFork() external {
if (!_chainIdChanged()) revert NotForked();
delayBlocks = 1;
futureBlocks = 1;
delaySeconds = 1;
futureSeconds = 1;
}
function maxTimeVariation() external view returns (uint256, uint256, uint256, uint256) {
(uint64 delayBlocks_, uint64 futureBlocks_, uint64 delaySeconds_, uint64 futureSeconds_) =
maxTimeVariationInternal();
return (
uint256(delayBlocks_),
uint256(futureBlocks_),
uint256(delaySeconds_),
uint256(futureSeconds_)
);
}
function maxTimeVariationInternal() internal view returns (uint64, uint64, uint64, uint64) {
if (_chainIdChanged()) {
return (1, 1, 1, 1);
} else {
return (delayBlocks, futureBlocks, delaySeconds, futureSeconds);
}
}
/// @inheritdoc ISequencerInbox
function forceInclusion(
uint256 _totalDelayedMessagesRead,
uint8 kind,
uint64[2] calldata l1BlockAndTime,
uint256 baseFeeL1,
address sender,
bytes32 messageDataHash
) external {
if (_totalDelayedMessagesRead <= totalDelayedMessagesRead) revert DelayedBackwards();
bytes32 messageHash = Messages.messageHash(
kind,
sender,
l1BlockAndTime[0],
l1BlockAndTime[1],
_totalDelayedMessagesRead - 1,
baseFeeL1,
messageDataHash
);
uint256 delayBlocks_ = delayBlocks;
if (isDelayBufferable) {
// proactively apply any pending delay buffer updates before the force included message l1BlockAndTime
buffer.update(l1BlockAndTime[0]);
delayBlocks_ = delayBufferableBlocks(buffer.bufferBlocks);
}
// Can only force-include after the Sequencer-only window has expired.
if (l1BlockAndTime[0] + delayBlocks_ >= block.number) revert ForceIncludeBlockTooSoon();
// Verify that message hash represents the last message sequence of delayed message to be included
bytes32 prevDelayedAcc = 0;
if (_totalDelayedMessagesRead > 1) {
prevDelayedAcc = bridge.delayedInboxAccs(_totalDelayedMessagesRead - 2);
}
if (
bridge.delayedInboxAccs(_totalDelayedMessagesRead - 1)
!= Messages.accumulateInboxMessage(prevDelayedAcc, messageHash)
) revert IncorrectMessagePreimage();
(bytes32 dataHash, IBridge.TimeBounds memory timeBounds) =
formEmptyDataHash(_totalDelayedMessagesRead);
uint256 __totalDelayedMessagesRead = _totalDelayedMessagesRead;
uint256 prevSeqMsgCount = bridge.sequencerReportedSubMessageCount();
uint256 newSeqMsgCount = prevSeqMsgCount; // force inclusion should not modify sequencer message count
(uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 afterAcc) =
addSequencerL2BatchImpl(
dataHash, __totalDelayedMessagesRead, 0, prevSeqMsgCount, newSeqMsgCount
);
emit SequencerBatchDelivered(
seqMessageIndex,
beforeAcc,
afterAcc,
delayedAcc,
totalDelayedMessagesRead,
timeBounds,
IBridge.BatchDataLocation.NoData
);
}
/// @inheritdoc ISequencerInbox
function addSequencerL2BatchFromOrigin(
uint256,
bytes calldata,
uint256,
IGasRefunder
) external pure {
revert Deprecated();
}
/// @inheritdoc ISequencerInbox
function addSequencerL2BatchFromOrigin(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external refundsGas(gasRefunder, IReader4844(address(0))) {
if (!CallerChecker.isCallerCodelessOrigin()) revert NotCodelessOrigin();
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
if (isDelayProofRequired(afterDelayedMessagesRead)) revert DelayProofRequired();
addSequencerL2BatchFromCalldataImpl(
sequenceNumber, data, afterDelayedMessagesRead, prevMessageCount, newMessageCount, true
);
}
/// @inheritdoc ISequencerInbox
function addSequencerL2BatchFromBlobs(
uint256 sequenceNumber,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external refundsGas(gasRefunder, reader4844) {
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
if (isDelayProofRequired(afterDelayedMessagesRead)) revert DelayProofRequired();
addSequencerL2BatchFromBlobsImpl(
sequenceNumber, afterDelayedMessagesRead, prevMessageCount, newMessageCount
);
}
/// @inheritdoc ISequencerInbox
function addSequencerL2BatchFromBlobsDelayProof(
uint256 sequenceNumber,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount,
DelayProof calldata delayProof
) external refundsGas(gasRefunder, reader4844) {
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
if (!isDelayBufferable) revert NotDelayBufferable();
delayProofImpl(afterDelayedMessagesRead, delayProof);
addSequencerL2BatchFromBlobsImpl(
sequenceNumber, afterDelayedMessagesRead, prevMessageCount, newMessageCount
);
}
/// @inheritdoc ISequencerInbox
function addSequencerL2BatchFromOriginDelayProof(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount,
DelayProof calldata delayProof
) external refundsGas(gasRefunder, IReader4844(address(0))) {
if (!CallerChecker.isCallerCodelessOrigin()) revert NotCodelessOrigin();
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
if (!isDelayBufferable) revert NotDelayBufferable();
delayProofImpl(afterDelayedMessagesRead, delayProof);
addSequencerL2BatchFromCalldataImpl(
sequenceNumber, data, afterDelayedMessagesRead, prevMessageCount, newMessageCount, true
);
}
function addSequencerL2BatchFromBlobsImpl(
uint256 sequenceNumber,
uint256 afterDelayedMessagesRead,
uint256 prevMessageCount,
uint256 newMessageCount
) internal {
(bytes32 dataHash, IBridge.TimeBounds memory timeBounds, uint256 blobGas) =
formBlobDataHash(afterDelayedMessagesRead);
// we use addSequencerL2BatchImpl for submitting the message
// normally this would also submit a batch spending report but that is skipped if we pass
// an empty call data size, then we submit a separate batch spending report later
(uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 afterAcc) =
addSequencerL2BatchImpl(
dataHash, afterDelayedMessagesRead, 0, prevMessageCount, newMessageCount
);
// ~uint256(0) is type(uint256).max, but ever so slightly cheaper
if (seqMessageIndex != sequenceNumber && sequenceNumber != ~uint256(0)) {
revert BadSequencerNumber(seqMessageIndex, sequenceNumber);
}
emit SequencerBatchDelivered(
sequenceNumber,
beforeAcc,
afterAcc,
delayedAcc,
totalDelayedMessagesRead,
timeBounds,
IBridge.BatchDataLocation.Blob
);
// blobs are currently not supported on host arbitrum chains, when support is added it may
// consume gas in a different way to L1, so explicitly block host arb chains so that if support for blobs
// on arb is added it will need to explicitly turned on in the sequencer inbox
if (hostChainIsArbitrum) revert DataBlobsNotSupported();
// submit a batch spending report to refund the entity that produced the blob batch data
// same as using calldata, we only submit spending report if the caller is the origin and is codeless
// such that one cannot "double-claim" batch posting refund in the same tx
if (CallerChecker.isCallerCodelessOrigin()) {
submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, blobGas);
}
}
function addSequencerL2BatchFromCalldataImpl(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
uint256 prevMessageCount,
uint256 newMessageCount,
bool isFromCodelessOrigin
) internal {
(bytes32 dataHash, IBridge.TimeBounds memory timeBounds) =
formCallDataHash(data, afterDelayedMessagesRead);
(uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 afterAcc) =
addSequencerL2BatchImpl(
dataHash,
afterDelayedMessagesRead,
isFromCodelessOrigin ? data.length : 0,
prevMessageCount,
newMessageCount
);
// ~uint256(0) is type(uint256).max, but ever so slightly cheaper
if (seqMessageIndex != sequenceNumber && sequenceNumber != ~uint256(0)) {
revert BadSequencerNumber(seqMessageIndex, sequenceNumber);
}
emit SequencerBatchDelivered(
seqMessageIndex,
beforeAcc,
afterAcc,
delayedAcc,
totalDelayedMessagesRead,
timeBounds,
isFromCodelessOrigin
? IBridge.BatchDataLocation.TxInput
: IBridge.BatchDataLocation.SeparateBatchEvent
);
if (!isFromCodelessOrigin) {
emit SequencerBatchData(seqMessageIndex, data);
}
}
/// @inheritdoc ISequencerInbox
function addSequencerL2Batch(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external override refundsGas(gasRefunder, IReader4844(address(0))) {
if (!isBatchPoster[msg.sender] && msg.sender != address(rollup)) revert NotBatchPoster();
if (isDelayProofRequired(afterDelayedMessagesRead)) revert DelayProofRequired();
addSequencerL2BatchFromCalldataImpl(
sequenceNumber, data, afterDelayedMessagesRead, prevMessageCount, newMessageCount, false
);
}
/// @inheritdoc ISequencerInbox
function addSequencerL2BatchDelayProof(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount,
DelayProof calldata delayProof
) external refundsGas(gasRefunder, IReader4844(address(0))) {
if (!isBatchPoster[msg.sender] && msg.sender != address(rollup)) revert NotBatchPoster();
if (!isDelayBufferable) revert NotDelayBufferable();
delayProofImpl(afterDelayedMessagesRead, delayProof);
addSequencerL2BatchFromCalldataImpl(
sequenceNumber, data, afterDelayedMessagesRead, prevMessageCount, newMessageCount, false
);
}
function delayProofImpl(
uint256 afterDelayedMessagesRead,
DelayProof memory delayProof
) internal {
// buffer update depends on new delayed messages. if none are read, no buffer update is proccessed
if (afterDelayedMessagesRead > totalDelayedMessagesRead) {
if (buffer.isUpdatable()) {
// delayedAcc of the 1st new delayed message
bytes32 delayedAcc = bridge.delayedInboxAccs(totalDelayedMessagesRead);
// validate delayProof against the delayed accumulator
if (
!Messages.isValidDelayedAccPreimage(
delayedAcc, delayProof.beforeDelayedAcc, delayProof.delayedMessage
)
) {
revert InvalidDelayedAccPreimage();
}
buffer.update(delayProof.delayedMessage.blockNumber);
}
}
}
function isDelayProofRequired(
uint256 afterDelayedMessagesRead
) internal view returns (bool) {
// if no new delayed messages are read, no buffer updates can be applied, so no proof required
// if the buffer is synced, the buffer cannot be depleted, so no proof is required
return isDelayBufferable && afterDelayedMessagesRead > totalDelayedMessagesRead
&& !buffer.isSynced();
}
function packHeader(
uint256 afterDelayedMessagesRead
) internal view returns (bytes memory, IBridge.TimeBounds memory) {
IBridge.TimeBounds memory timeBounds = getTimeBounds();
bytes memory header = abi.encodePacked(
timeBounds.minTimestamp,
timeBounds.maxTimestamp,
timeBounds.minBlockNumber,
timeBounds.maxBlockNumber,
uint64(afterDelayedMessagesRead)
);
// This must always be true from the packed encoding
assert(header.length == HEADER_LENGTH);
return (header, timeBounds);
}
/// @dev Form a hash for a sequencer message with no batch data
/// @param afterDelayedMessagesRead The delayed messages count read up to
/// @return The data hash
/// @return The timebounds within which the message should be processed
function formEmptyDataHash(
uint256 afterDelayedMessagesRead
) internal view returns (bytes32, IBridge.TimeBounds memory) {
(bytes memory header, IBridge.TimeBounds memory timeBounds) =
packHeader(afterDelayedMessagesRead);
return (keccak256(header), timeBounds);
}
/// @dev Since the data is supplied from calldata, the batch poster can choose the data type
/// We need to ensure that this data cannot cause a collision with data supplied via another method (eg blobs)
/// therefore we restrict which flags can be provided as a header in this field
/// This also safe guards unused flags for future use, as we know they would have been disallowed up until this point
/// @param headerByte The first byte in the calldata
function isValidCallDataFlag(
bytes1 headerByte
) internal pure returns (bool) {
return headerByte == BROTLI_MESSAGE_HEADER_FLAG || headerByte == DAS_MESSAGE_HEADER_FLAG
|| (headerByte == (DAS_MESSAGE_HEADER_FLAG | TREE_DAS_MESSAGE_HEADER_FLAG))
|| headerByte == ZERO_HEAVY_MESSAGE_HEADER_FLAG;
}
/// @dev Form a hash of the data taken from the calldata
/// @param data The calldata to be hashed
/// @param afterDelayedMessagesRead The delayed messages count read up to
/// @return The data hash
/// @return The timebounds within which the message should be processed
function formCallDataHash(
bytes calldata data,
uint256 afterDelayedMessagesRead
) internal view returns (bytes32, IBridge.TimeBounds memory) {
uint256 fullDataLen = HEADER_LENGTH + data.length;
if (fullDataLen > maxDataSize) revert DataTooLarge(fullDataLen, maxDataSize);
(bytes memory header, IBridge.TimeBounds memory timeBounds) =
packHeader(afterDelayedMessagesRead);
// the batch poster is allowed to submit an empty batch, they can use this to progress the
// delayed inbox without providing extra batch data
if (data.length > 0) {
// The first data byte cannot be the same as any that have been set via other methods (eg 4844 blob header) as this
// would allow the supplier of the data to spoof an incorrect 4844 data batch
if (!isValidCallDataFlag(data[0])) revert InvalidHeaderFlag(data[0]);
// the first byte is used to identify the type of batch data
// das batches expect to have the type byte set, followed by the keyset (so they should have at least 33 bytes)
// if invalid data is supplied here the state transition function will process it as an empty block
// however we can provide a nice additional check here for the batch poster
if (data[0] & DAS_MESSAGE_HEADER_FLAG != 0 && data.length >= 33) {
// we skip the first byte, then read the next 32 bytes for the keyset
bytes32 dasKeysetHash = bytes32(data[1:33]);
if (!dasKeySetInfo[dasKeysetHash].isValidKeyset) revert NoSuchKeyset(dasKeysetHash);
}
}
return (keccak256(bytes.concat(header, data)), timeBounds);
}
/// @dev Form a hash of the data being provided in 4844 data blobs
/// @param afterDelayedMessagesRead The delayed messages count read up to
/// @return The data hash
/// @return The timebounds within which the message should be processed
/// @return The normalized amount of gas used for blob posting
function formBlobDataHash(
uint256 afterDelayedMessagesRead
) internal view virtual returns (bytes32, IBridge.TimeBounds memory, uint256) {
bytes32[] memory dataHashes = reader4844.getDataHashes();
if (dataHashes.length == 0) revert MissingDataHashes();
(bytes memory header, IBridge.TimeBounds memory timeBounds) =
packHeader(afterDelayedMessagesRead);
uint256 blobCost = reader4844.getBlobBaseFee() * GAS_PER_BLOB * dataHashes.length;
return (
keccak256(bytes.concat(header, DATA_BLOB_HEADER_FLAG, abi.encodePacked(dataHashes))),
timeBounds,
block.basefee > 0 ? blobCost / block.basefee : 0
);
}
/// @dev Submit a batch spending report message so that the batch poster can be reimbursed on the rollup
/// This function expect msg.sender is tx.origin, and will always record tx.origin as the spender
/// @param dataHash The hash of the message the spending report is being submitted for
/// @param seqMessageIndex The index of the message to submit the spending report for
/// @param gasPrice The gas price that was paid for the data (standard gas or data gas)
function submitBatchSpendingReport(
bytes32 dataHash,
uint256 seqMessageIndex,
uint256 gasPrice,
uint256 extraGas
) internal {
// When using a fee token the batch poster needs to be reimbursed on the child chain in units of the child chain fee token.
// We need to get the exchange rate between the child chain fee token and the parent chain fee token using the pricer.
// If the pricer is not set, then we do not send batch reports and batch poster never gets reimbursed
IFeeTokenPricer _feeTokenPricer = feeTokenPricer;
if (isUsingFeeToken && address(_feeTokenPricer) == address(0)) {
return;
}
// report the account who paid the gas (tx.origin) for the tx as batch poster
// if msg.sender is used and is a contract, it might not be able to spend the refund on l2
// solhint-disable-next-line avoid-tx-origin
address batchPoster = tx.origin;
if (hostChainIsArbitrum) {
// Include extra gas for the host chain's L1 gas charging
uint256 l1Fees = ArbGasInfo(address(0x6c)).getCurrentTxL1GasFees();
extraGas += l1Fees / block.basefee;
}
if (extraGas > type(uint64).max) revert ExtraGasNotUint64();
if (isUsingFeeToken && address(_feeTokenPricer) != address(0)) {
// gasPrice is originally denominated in parent chain's native token and we want to scale it to the child
// chain's fee token. For that we need the exchange rate which tells us how many child chain fee tokens
// we get for 1 parent chain fee token. Exchange rate is denominated in 18 decimals.
uint256 exchangeRate = _feeTokenPricer.getExchangeRate();
gasPrice = (gasPrice * exchangeRate) / 1e18;
}
// this msg isn't included in the current sequencer batch, but instead added to
// the delayed messages queue that is yet to be included
bytes memory spendingReportMsg = abi.encodePacked(
block.timestamp, batchPoster, dataHash, seqMessageIndex, gasPrice, uint64(extraGas)
);
uint256 msgNum = bridge.submitBatchSpendingReport(batchPoster, keccak256(spendingReportMsg));
// this is the same event used by Inbox.sol after including a message to the delayed message accumulator
emit InboxMessageDelivered(msgNum, spendingReportMsg);
}
function addSequencerL2BatchImpl(
bytes32 dataHash,
uint256 afterDelayedMessagesRead,
uint256 calldataLengthPosted,
uint256 prevMessageCount,
uint256 newMessageCount
)
internal
returns (uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 acc)
{
if (afterDelayedMessagesRead < totalDelayedMessagesRead) revert DelayedBackwards();
if (afterDelayedMessagesRead > bridge.delayedMessageCount()) revert DelayedTooFar();
(seqMessageIndex, beforeAcc, delayedAcc, acc) = bridge.enqueueSequencerMessage(
dataHash, afterDelayedMessagesRead, prevMessageCount, newMessageCount
);
totalDelayedMessagesRead = afterDelayedMessagesRead;
if (calldataLengthPosted > 0) {
submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, 0);
}
}
function inboxAccs(
uint256 index
) external view returns (bytes32) {
return bridge.sequencerInboxAccs(index);
}
function batchCount() external view returns (uint256) {
return bridge.sequencerMessageCount();
}
/// @inheritdoc ISequencerInbox
function forceInclusionDeadline(
uint64 blockNumber
) external view returns (uint64) {
uint64 _delayBlocks = delayBlocks;
if (isDelayBufferable) {
uint64 _buffer = buffer.calcPendingBuffer(blockNumber);
_delayBlocks = delayBufferableBlocks(_buffer);
}
return blockNumber + _delayBlocks;
}
/// @notice Calculates the buffer dependent delay blocks
function delayBufferableBlocks(
uint64 _buffer
) internal view returns (uint64) {
return _buffer < delayBlocks ? _buffer : delayBlocks;
}
function _setBufferConfig(
BufferConfig memory bufferConfig_
) internal {
if (!isDelayBufferable) revert NotDelayBufferable();
if (!DelayBuffer.isValidBufferConfig(bufferConfig_)) revert BadBufferConfig();
if (buffer.bufferBlocks == 0 || buffer.bufferBlocks > bufferConfig_.max) {
buffer.bufferBlocks = bufferConfig_.max;
}
if (buffer.bufferBlocks < bufferConfig_.threshold) {
buffer.bufferBlocks = bufferConfig_.threshold;
}
buffer.max = bufferConfig_.max;
buffer.threshold = bufferConfig_.threshold;
buffer.replenishRateInBasis = bufferConfig_.replenishRateInBasis;
// if all delayed messages are read, the buffer is considered synced
if (bridge.delayedMessageCount() == totalDelayedMessagesRead) {
buffer.update(uint64(block.number));
}
}
function _setMaxTimeVariation(
ISequencerInbox.MaxTimeVariation memory maxTimeVariation_
) internal {
if (
maxTimeVariation_.delayBlocks > type(uint64).max
|| maxTimeVariation_.futureBlocks > type(uint64).max
|| maxTimeVariation_.delaySeconds > type(uint64).max
|| maxTimeVariation_.futureSeconds > type(uint64).max
) {
revert BadMaxTimeVariation();
}
delayBlocks = uint64(maxTimeVariation_.delayBlocks);
futureBlocks = uint64(maxTimeVariation_.futureBlocks);
delaySeconds = uint64(maxTimeVariation_.delaySeconds);
futureSeconds = uint64(maxTimeVariation_.futureSeconds);
}
/// @inheritdoc ISequencerInbox
function setMaxTimeVariation(
ISequencerInbox.MaxTimeVariation memory maxTimeVariation_
) external onlyRollupOwner {
_setMaxTimeVariation(maxTimeVariation_);
emit MaxTimeVariationSet(maxTimeVariation_);
emit OwnerFunctionCalled(0);
}
/// @inheritdoc ISequencerInbox
function setIsBatchPoster(
address addr,
bool isBatchPoster_
) external onlyRollupOwnerOrBatchPosterManager {
isBatchPoster[addr] = isBatchPoster_;
emit BatchPosterSet(addr, isBatchPoster_);
emit OwnerFunctionCalled(1);
}
/// @inheritdoc ISequencerInbox
function setValidKeyset(
bytes calldata keysetBytes
) external onlyRollupOwner {
uint256 ksWord = uint256(keccak256(bytes.concat(hex"fe", keccak256(keysetBytes))));
bytes32 ksHash = bytes32(ksWord ^ (1 << 255));
if (keysetBytes.length >= 64 * 1024) revert KeysetTooLarge();
if (dasKeySetInfo[ksHash].isValidKeyset) revert AlreadyValidDASKeyset(ksHash);
uint256 creationBlock = block.number;
if (hostChainIsArbitrum) {
creationBlock = ArbSys(address(100)).arbBlockNumber();
}
dasKeySetInfo[ksHash] =
DasKeySetInfo({isValidKeyset: true, creationBlock: uint64(creationBlock)});
emit SetValidKeyset(ksHash, keysetBytes);
emit OwnerFunctionCalled(2);
}
/// @inheritdoc ISequencerInbox
function invalidateKeysetHash(
bytes32 ksHash
) external onlyRollupOwner {
if (!dasKeySetInfo[ksHash].isValidKeyset) revert NoSuchKeyset(ksHash);
// we don't delete the block creation value since its used to fetch the SetValidKeyset
// event efficiently. The event provides the hash preimage of the key.
// this is still needed when syncing the chain after a keyset is invalidated.
dasKeySetInfo[ksHash].isValidKeyset = false;
emit InvalidateKeyset(ksHash);
emit OwnerFunctionCalled(3);
}
/// @inheritdoc ISequencerInbox
function setIsSequencer(
address addr,
bool isSequencer_
) external onlyRollupOwnerOrBatchPosterManager {
isSequencer[addr] = isSequencer_;
emit SequencerSet(addr, isSequencer_);
emit OwnerFunctionCalled(4);
}
/// @inheritdoc ISequencerInbox
function setBatchPosterManager(
address newBatchPosterManager
) external onlyRollupOwner {
batchPosterManager = newBatchPosterManager;
emit BatchPosterManagerSet(newBatchPosterManager);
emit OwnerFunctionCalled(5);
}
/// @inheritdoc ISequencerInbox
function setFeeTokenPricer(
IFeeTokenPricer feeTokenPricer_
) external onlyRollupOwner {
if (!isUsingFeeToken) {
revert CannotSetFeeTokenPricer();
}
feeTokenPricer = feeTokenPricer_;
emit FeeTokenPricerSet(address(feeTokenPricer_));
emit OwnerFunctionCalled(6);
}
function setBufferConfig(
BufferConfig memory bufferConfig_
) external onlyRollupOwner {
_setBufferConfig(bufferConfig_);
emit BufferConfigSet(bufferConfig_);
}
function isValidKeysetHash(
bytes32 ksHash
) external view returns (bool) {
return dasKeySetInfo[ksHash].isValidKeyset;
}
/// @inheritdoc ISequencerInbox
function getKeysetCreationBlock(
bytes32 ksHash
) external view returns (uint256) {
DasKeySetInfo memory ksInfo = dasKeySetInfo[ksHash];
if (ksInfo.creationBlock == 0) revert NoSuchKeyset(ksHash);
return uint256(ksInfo.creationBlock);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./Messages.sol";
import "./DelayBufferTypes.sol";
/**
* @title Manages the delay buffer for the sequencer (SequencerInbox.sol)
* @notice Messages are expected to be delayed up to a threshold, beyond which they are unexpected
* and deplete a delay buffer. Buffer depletion is preveneted from decreasing too quickly by only
* depleting by as many blocks as elapsed in the delayed message queue.
*/
library DelayBuffer {
uint256 public constant BASIS = 10000;
/// @dev Depletion is limited by the elapsed blocks in the delayed message queue to avoid double counting and potential L2 reorgs.
/// Eg. 2 simultaneous batches sequencing multiple delayed messages with the same 100 blocks delay each
/// should count once as a single 100 block delay, not twice as a 200 block delay. This also prevents L2 reorg risk in edge cases.
/// Eg. If the buffer is 300 blocks, decrementing the buffer when processing the first batch would allow the second delay message to be force included before the sequencer could add the second batch.
/// Buffer depletion also saturates at the threshold instead of zero to allow a recovery margin.
/// Eg. when the sequencer recovers from an outage, it is able to wait threshold > finality time before queueing delayed messages to avoid L1 reorgs.
/// @notice Conditionally updates the buffer. Replenishes the buffer and depletes if delay is unexpected.
/// @param start The beginning reference point
/// @param end The ending reference point
/// @param buffer The buffer to be updated
/// @param sequenced The reference point when messages were sequenced
/// @param threshold The threshold to saturate at
/// @param max The maximum buffer
/// @param replenishRateInBasis The amount to replenish the buffer per block in basis points.
function calcBuffer(
uint256 start,
uint256 end,
uint256 buffer,
uint256 sequenced,
uint256 threshold,
uint256 max,
uint256 replenishRateInBasis
) internal pure returns (uint256) {
uint256 elapsed = end > start ? end - start : 0;
uint256 delay = sequenced > start ? sequenced - start : 0;
// replenishment rounds down and will not overflow since all inputs including
// replenishRateInBasis are cast from uint64 in calcPendingBuffer
buffer += (elapsed * replenishRateInBasis) / BASIS;
uint256 unexpectedDelay = delay > threshold ? delay - threshold : 0;
if (unexpectedDelay > elapsed) {
unexpectedDelay = elapsed;
}
// decrease the buffer
if (buffer > unexpectedDelay) {
buffer -= unexpectedDelay;
if (buffer > threshold) {
// saturating above at the max
return buffer > max ? max : buffer;
}
}
// saturating below at the threshold
return threshold;
}
/// @notice Applies update to buffer data
/// @param self The delay buffer data
/// @param blockNumber The update block number
function update(BufferData storage self, uint64 blockNumber) internal {
self.bufferBlocks = calcPendingBuffer(self, blockNumber);
// store a new starting reference point
// any buffer updates will be applied retroactively in the next batch post
self.prevBlockNumber = blockNumber;
self.prevSequencedBlockNumber = uint64(block.number);
}
/// @dev The delay buffer can change due to pending depletion / replenishment due to previous delays.
/// This function applies pending buffer changes to calculate buffer updates.
/// @notice Calculates the buffer changes up to the requested block number
/// @param self The delay buffer data
/// @param blockNumber The block number to process the delay up to
function calcPendingBuffer(
BufferData storage self,
uint64 blockNumber
) internal view returns (uint64) {
// bufferUpdate will not overflow since inputs are uint64
return uint64(
calcBuffer({
start: self.prevBlockNumber,
end: blockNumber,
buffer: self.bufferBlocks,
threshold: self.threshold,
sequenced: self.prevSequencedBlockNumber,
max: self.max,
replenishRateInBasis: self.replenishRateInBasis
})
);
}
/// @dev This is the `sync validity window` during which no proofs are required.
/// @notice Returns true if the inbox is in a synced state (no unexpected delays are possible)
function isSynced(
BufferData storage self
) internal view returns (bool) {
return block.number - self.prevBlockNumber <= self.threshold;
}
function isUpdatable(
BufferData storage self
) internal view returns (bool) {
// if synced, the buffer can't be depleted
// if full, the buffer can't be replenished
// if neither synced nor full, the buffer updatable (depletable / replenishable)
return !isSynced(self) || self.bufferBlocks < self.max;
}
function isValidBufferConfig(
BufferConfig memory config
) internal pure returns (bool) {
return config.threshold != 0 && config.max != 0 && config.replenishRateInBasis <= BASIS
&& config.threshold <= config.max;
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
import "./Messages.sol";
pragma solidity >=0.6.9 <0.9.0;
/// @notice Delay buffer and delay threshold settings
/// @param threshold The maximum amount of blocks that a message is expected to be delayed
/// @param max The maximum buffer in blocks
/// @param replenishRateInBasis The amount to replenish the buffer per block in basis points.
struct BufferConfig {
uint64 threshold;
uint64 max;
uint64 replenishRateInBasis;
}
/// @notice The delay buffer data.
/// @param bufferBlocks The buffer in blocks.
/// @param max The maximum buffer in blocks
/// @param threshold The maximum amount of blocks that a message is expected to be delayed
/// @param prevBlockNumber The blocknumber of the last included delay message.
/// @param replenishRateInBasis The amount to replenish the buffer per block in basis points.
/// @param prevSequencedBlockNumber The blocknumber when last included delay message was sequenced.
struct BufferData {
uint64 bufferBlocks;
uint64 max;
uint64 threshold;
uint64 prevBlockNumber;
uint64 replenishRateInBasis;
uint64 prevSequencedBlockNumber;
}
struct DelayProof {
bytes32 beforeDelayedAcc;
Messages.Message delayedMessage;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
import "./IOwnable.sol";
interface IBridge {
/// @dev This is an instruction to offchain readers to inform them where to look
/// for sequencer inbox batch data. This is not the type of data (eg. das, brotli encoded, or blob versioned hash)
/// and this enum is not used in the state transition function, rather it informs an offchain
/// reader where to find the data so that they can supply it to the replay binary
enum BatchDataLocation {
/// @notice The data can be found in the transaction call data
TxInput,
/// @notice The data can be found in an event emitted during the transaction
SeparateBatchEvent,
/// @notice This batch contains no data
NoData,
/// @notice The data can be found in the 4844 data blobs on this transaction
Blob
}
struct TimeBounds {
uint64 minTimestamp;
uint64 maxTimestamp;
uint64 minBlockNumber;
uint64 maxBlockNumber;
}
event MessageDelivered(
uint256 indexed messageIndex,
bytes32 indexed beforeInboxAcc,
address inbox,
uint8 kind,
address sender,
bytes32 messageDataHash,
uint256 baseFeeL1,
uint64 timestamp
);
event BridgeCallTriggered(
address indexed outbox, address indexed to, uint256 value, bytes data
);
event InboxToggle(address indexed inbox, bool enabled);
event OutboxToggle(address indexed outbox, bool enabled);
event SequencerInboxUpdated(address newSequencerInbox);
event RollupUpdated(address rollup);
function allowedDelayedInboxList(
uint256
) external returns (address);
function allowedOutboxList(
uint256
) external returns (address);
/// @dev Accumulator for delayed inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.
function delayedInboxAccs(
uint256
) external view returns (bytes32);
/// @dev Accumulator for sequencer inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.
function sequencerInboxAccs(
uint256
) external view returns (bytes32);
function rollup() external view returns (IOwnable);
function sequencerInbox() external view returns (address);
function activeOutbox() external view returns (address);
function allowedDelayedInboxes(
address inbox
) external view returns (bool);
function allowedOutboxes(
address outbox
) external view returns (bool);
function sequencerReportedSubMessageCount() external view returns (uint256);
function executeCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success, bytes memory returnData);
function delayedMessageCount() external view returns (uint256);
function sequencerMessageCount() external view returns (uint256);
// ---------- onlySequencerInbox functions ----------
function enqueueSequencerMessage(
bytes32 dataHash,
uint256 afterDelayedMessagesRead,
uint256 prevMessageCount,
uint256 newMessageCount
)
external
returns (uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 acc);
/**
* @dev Allows the sequencer inbox to submit a delayed message of the batchPostingReport type
* This is done through a separate function entrypoint instead of allowing the sequencer inbox
* to call `enqueueDelayedMessage` to avoid the gas overhead of an extra SLOAD in either
* every delayed inbox or every sequencer inbox call.
*/
function submitBatchSpendingReport(
address batchPoster,
bytes32 dataHash
) external returns (uint256 msgNum);
// ---------- onlyRollupOrOwner functions ----------
function setSequencerInbox(
address _sequencerInbox
) external;
function setDelayedInbox(address inbox, bool enabled) external;
function setOutbox(address inbox, bool enabled) external;
function updateRollupAddress(
IOwnable _rollup
) external;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
interface IDelayedMessageProvider {
/// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator
event InboxMessageDelivered(uint256 indexed messageNum, bytes data);
/// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator
/// same as InboxMessageDelivered but the batch data is available in tx.input
event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
import "./IOwnable.sol";
import "./IBridge.sol";
interface IERC20Bridge is IBridge {
/**
* @dev token that is escrowed in bridge on L1 side and minted on L2 as native currency.
* Fees are paid in this token. There are certain restrictions on the native token:
* - The token can't be rebasing or have a transfer fee
* - The token must only be transferrable via a call to the token address itself
* - The token must only be able to set allowance via a call to the token address itself
* - The token must not have a callback on transfer, and more generally a user must not be able to make a transfer to themselves revert
*/
function nativeToken() external view returns (address);
/**
* @dev number of decimals used by the native token
* This is set on bridge initialization using nativeToken.decimals()
* If the token does not have decimals() method, we assume it have 0 decimals
*/
function nativeTokenDecimals() external view returns (uint8);
/**
* @dev Enqueue a message in the delayed inbox accumulator.
* These messages are later sequenced in the SequencerInbox, either
* by the sequencer as part of a normal batch, or by force inclusion.
*/
function enqueueDelayedMessage(
uint8 kind,
address sender,
bytes32 messageDataHash,
uint256 tokenFeeAmount
) external returns (uint256);
// ---------- initializer ----------
function initialize(IOwnable rollup_, address nativeToken_) external;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
import "./IBridge.sol";
import "./IDelayedMessageProvider.sol";
import "./ISequencerInbox.sol";
interface IInboxBase is IDelayedMessageProvider {
function bridge() external view returns (IBridge);
function sequencerInbox() external view returns (ISequencerInbox);
function maxDataSize() external view returns (uint256);
/**
* @notice Send a generic L2 message to the chain
* @dev This method is an optimization to avoid having to emit the entirety of the messageData in a log. Instead validators are expected to be able to parse the data from the transaction's input
* @param messageData Data of the message being sent
*/
function sendL2MessageFromOrigin(
bytes calldata messageData
) external returns (uint256);
/**
* @notice Send a generic L2 message to the chain
* @dev This method can be used to send any type of message that doesn't require L1 validation
* @param messageData Data of the message being sent
*/
function sendL2Message(
bytes calldata messageData
) external returns (uint256);
function sendUnsignedTransaction(
uint256 gasLimit,
uint256 maxFeePerGas,
uint256 nonce,
address to,
uint256 value,
bytes calldata data
) external returns (uint256);
function sendContractTransaction(
uint256 gasLimit,
uint256 maxFeePerGas,
address to,
uint256 value,
bytes calldata data
) external returns (uint256);
/**
* @notice Get the L1 fee for submitting a retryable
* @dev This fee can be paid by funds already in the L2 aliased address or by the current message value
* @dev This formula may change in the future, to future proof your code query this method instead of inlining!!
* @param dataLength The length of the retryable's calldata, in bytes
* @param baseFee The block basefee when the retryable is included in the chain, if 0 current block.basefee will be used
*/
function calculateRetryableSubmissionFee(
uint256 dataLength,
uint256 baseFee
) external view returns (uint256);
// ---------- onlyRollupOrOwner functions ----------
/// @notice pauses all inbox functionality
function pause() external;
/// @notice unpauses all inbox functionality
function unpause() external;
/// @notice add or remove users from allowList
function setAllowList(address[] memory user, bool[] memory val) external;
/// @notice enable or disable allowList
function setAllowListEnabled(
bool _allowListEnabled
) external;
/// @notice check if user is in allowList
function isAllowed(
address user
) external view returns (bool);
/// @notice check if allowList is enabled
function allowListEnabled() external view returns (bool);
function initialize(IBridge _bridge, ISequencerInbox _sequencerInbox) external;
/// @notice returns the current admin
function getProxyAdmin() external view returns (address);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
import "./IBridge.sol";
interface IOutbox {
event SendRootUpdated(bytes32 indexed outputRoot, bytes32 indexed l2BlockHash);
event OutBoxTransactionExecuted(
address indexed to, address indexed l2Sender, uint256 indexed zero, uint256 transactionIndex
);
function initialize(
IBridge _bridge
) external;
function rollup() external view returns (address); // the rollup contract
function bridge() external view returns (IBridge); // the bridge contract
function spent(
uint256
) external view returns (bytes32); // packed spent bitmap
function roots(
bytes32
) external view returns (bytes32); // maps root hashes => L2 block hash
// solhint-disable-next-line func-name-mixedcase
function OUTBOX_VERSION() external view returns (uint128); // the outbox version
function updateSendRoot(bytes32 sendRoot, bytes32 l2BlockHash) external;
function updateRollupAddress() external;
/// @notice When l2ToL1Sender returns a nonzero address, the message was originated by an L2 account
/// When the return value is zero, that means this is a system message
/// @dev the l2ToL1Sender behaves as the tx.origin, the msg.sender should be validated to protect against reentrancies
function l2ToL1Sender() external view returns (address);
/// @return l2Block return L2 block when the L2 tx was initiated or 0 if no L2 to L1 transaction is active
function l2ToL1Block() external view returns (uint256);
/// @return l1Block return L1 block when the L2 tx was initiated or 0 if no L2 to L1 transaction is active
function l2ToL1EthBlock() external view returns (uint256);
/// @return timestamp return L2 timestamp when the L2 tx was initiated or 0 if no L2 to L1 transaction is active
function l2ToL1Timestamp() external view returns (uint256);
/// @return outputId returns the unique output identifier of the L2 to L1 tx or 0 if no L2 to L1 transaction is active
function l2ToL1OutputId() external view returns (bytes32);
/**
* @notice Executes a messages in an Outbox entry.
* @dev Reverts if dispute period hasn't expired, since the outbox entry
* is only created once the rollup confirms the respective assertion.
* @dev it is not possible to execute any L2-to-L1 transaction which contains data
* to a contract address without any code (as enforced by the Bridge contract).
* @param proof Merkle proof of message inclusion in send root
* @param index Merkle path to message
* @param l2Sender sender if original message (i.e., caller of ArbSys.sendTxToL1)
* @param to destination address for L1 contract call
* @param l2Block l2 block number at which sendTxToL1 call was made
* @param l1Block l1 block number at which sendTxToL1 call was made
* @param l2Timestamp l2 Timestamp at which sendTxToL1 call was made
* @param value wei in L1 message
* @param data abi-encoded L1 message data
*/
function executeTransaction(
bytes32[] calldata proof,
uint256 index,
address l2Sender,
address to,
uint256 l2Block,
uint256 l1Block,
uint256 l2Timestamp,
uint256 value,
bytes calldata data
) external;
/**
* @dev function used to simulate the result of a particular function call from the outbox
* it is useful for things such as gas estimates. This function includes all costs except for
* proof validation (which can be considered offchain as a somewhat of a fixed cost - it's
* not really a fixed cost, but can be treated as so with a fixed overhead for gas estimation).
* We can't include the cost of proof validation since this is intended to be used to simulate txs
* that are included in yet-to-be confirmed merkle roots. The simulation entrypoint could instead pretend
* to confirm a pending merkle root, but that would be less practical for integrating with tooling.
* It is only possible to trigger it when the msg sender is address zero, which should be impossible
* unless under simulation in an eth_call or eth_estimateGas
*/
function executeTransactionSimulation(
uint256 index,
address l2Sender,
address to,
uint256 l2Block,
uint256 l1Block,
uint256 l2Timestamp,
uint256 value,
bytes calldata data
) external;
/**
* @param index Merkle path to message
* @return true if the message has been spent
*/
function isSpent(
uint256 index
) external view returns (bool);
function calculateItemHash(
address l2Sender,
address to,
uint256 l2Block,
uint256 l1Block,
uint256 l2Timestamp,
uint256 value,
bytes calldata data
) external pure returns (bytes32);
function calculateMerkleRoot(
bytes32[] memory proof,
uint256 path,
bytes32 item
) external pure returns (bytes32);
/**
* @dev function to be called one time during the outbox upgrade process
* this is used to fix the storage slots
*/
function postUpgradeInit() external;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.4.21 <0.9.0;
interface IOwnable {
function owner() external view returns (address);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
pragma experimental ABIEncoderV2;
import "../libraries/IGasRefunder.sol";
import "./IDelayedMessageProvider.sol";
import "./IBridge.sol";
import "./Messages.sol";
import "./DelayBufferTypes.sol";
interface ISequencerInbox is IDelayedMessageProvider {
/// @notice The maximum amount of time variatin between a message being posted on the L1 and being executed on the L2
/// @param delayBlocks The max amount of blocks in the past that a message can be received on L2
/// @param futureBlocks The max amount of blocks in the future that a message can be received on L2
/// @param delaySeconds The max amount of seconds in the past that a message can be received on L2
/// @param futureSeconds The max amount of seconds in the future that a message can be received on L2
struct MaxTimeVariation {
uint256 delayBlocks;
uint256 futureBlocks;
uint256 delaySeconds;
uint256 futureSeconds;
}
event SequencerBatchDelivered(
uint256 indexed batchSequenceNumber,
bytes32 indexed beforeAcc,
bytes32 indexed afterAcc,
bytes32 delayedAcc,
uint256 afterDelayedMessagesRead,
IBridge.TimeBounds timeBounds,
IBridge.BatchDataLocation dataLocation
);
event OwnerFunctionCalled(uint256 indexed id);
/// @dev a separate event that emits batch data when this isn't easily accessible in the tx.input
event SequencerBatchData(uint256 indexed batchSequenceNumber, bytes data);
/// @dev a valid keyset was added
event SetValidKeyset(bytes32 indexed keysetHash, bytes keysetBytes);
/// @dev a keyset was invalidated
event InvalidateKeyset(bytes32 indexed keysetHash);
/// @dev Owner set max time variation.
/// This event may have been introduced in an upgrade and therefore might not give the full history.
/// To get the full history, search for `OwnerFunctionCalled(0)` events.
event MaxTimeVariationSet(MaxTimeVariation maxTimeVariation);
/// @dev Owner set a batch poster.
/// This event may have been introduced in an upgrade and therefore might not give the full history.
/// To get the full history, search for `OwnerFunctionCalled(1)` events.
event BatchPosterSet(address batchPoster, bool isBatchPoster);
/// @dev Owner or batch poster manager set a sequencer.
/// This event may have been introduced in an upgrade and therefore might not give the full history.
/// To get the full history, search for `OwnerFunctionCalled(4)` events.
event SequencerSet(address addr, bool isSequencer);
/// @dev Owner set the batch poster manager.
/// This event may have been introduced in an upgrade and therefore might not give the full history.
/// To get the full history, search for `OwnerFunctionCalled(5)` events.
event BatchPosterManagerSet(address newBatchPosterManager);
/// @dev Owner set the buffer config.
event BufferConfigSet(BufferConfig bufferConfig);
/// @dev Owner set the fee token pricer.
event FeeTokenPricerSet(address feeTokenPricer);
function totalDelayedMessagesRead() external view returns (uint256);
function bridge() external view returns (IBridge);
/// @dev The size of the batch header
// solhint-disable-next-line func-name-mixedcase
function HEADER_LENGTH() external view returns (uint256);
/// @dev If the first batch data byte after the header has this bit set,
/// the sequencer inbox has authenticated the data. Currently only used for 4844 blob support.
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function DATA_AUTHENTICATED_FLAG() external view returns (bytes1);
/// @dev If the first data byte after the header has this bit set,
/// then the batch data is to be found in 4844 data blobs
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function DATA_BLOB_HEADER_FLAG() external view returns (bytes1);
/// @dev If the first data byte after the header has this bit set,
/// then the batch data is a das message
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function DAS_MESSAGE_HEADER_FLAG() external view returns (bytes1);
/// @dev If the first data byte after the header has this bit set,
/// then the batch data is a das message that employs a merklesization strategy
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function TREE_DAS_MESSAGE_HEADER_FLAG() external view returns (bytes1);
/// @dev If the first data byte after the header has this bit set,
/// then the batch data has been brotli compressed
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function BROTLI_MESSAGE_HEADER_FLAG() external view returns (bytes1);
/// @dev If the first data byte after the header has this bit set,
/// then the batch data uses a zero heavy encoding
/// See: https://github.com/OffchainLabs/nitro/blob/69de0603abf6f900a4128cab7933df60cad54ded/arbstate/das_reader.go
// solhint-disable-next-line func-name-mixedcase
function ZERO_HEAVY_MESSAGE_HEADER_FLAG() external view returns (bytes1);
function rollup() external view returns (IOwnable);
function isBatchPoster(
address
) external view returns (bool);
function isSequencer(
address
) external view returns (bool);
/// @notice True is the sequencer inbox is delay bufferable
function isDelayBufferable() external view returns (bool);
function maxDataSize() external view returns (uint256);
/// @notice The batch poster manager has the ability to change the batch poster addresses
/// This enables the batch poster to do key rotation
function batchPosterManager() external view returns (address);
/// @notice The fee token pricer is used to get the exchange rate between the child chain's fee token
/// and parent chain's fee token. This is needed when the child chain uses a custom fee
/// token which is different from the parent chain's fee token. The exchange rate is
/// used to correctly report converted gas price in the batch spending reports, so
/// the batch poster can get properly reimbursed on the child chain. If the chain uses
/// a custom fee token, but the pricer is not set, then the batch poster reports won't be reported
/// and the batch poster won't get reimbursed.
function feeTokenPricer() external view returns (IFeeTokenPricer);
struct DasKeySetInfo {
bool isValidKeyset;
uint64 creationBlock;
}
/// @dev returns 4 uint256 to be compatible with older version
function maxTimeVariation()
external
view
returns (
uint256 delayBlocks,
uint256 futureBlocks,
uint256 delaySeconds,
uint256 futureSeconds
);
function dasKeySetInfo(
bytes32
) external view returns (bool, uint64);
/// @notice Remove force inclusion delay after a L1 chainId fork
function removeDelayAfterFork() external;
/// @notice Force messages from the delayed inbox to be included in the chain
/// Callable by any address, but message can only be force-included after maxTimeVariation.delayBlocks
/// has elapsed. As part of normal behaviour the sequencer will include these
/// messages so it's only necessary to call this if the sequencer is down, or not including any delayed messages.
/// @param _totalDelayedMessagesRead The total number of messages to read up to
/// @param kind The kind of the last message to be included
/// @param l1BlockAndTime The l1 block and the l1 timestamp of the last message to be included
/// @param baseFeeL1 The l1 gas price of the last message to be included
/// @param sender The sender of the last message to be included
/// @param messageDataHash The messageDataHash of the last message to be included
function forceInclusion(
uint256 _totalDelayedMessagesRead,
uint8 kind,
uint64[2] calldata l1BlockAndTime,
uint256 baseFeeL1,
address sender,
bytes32 messageDataHash
) external;
function inboxAccs(
uint256 index
) external view returns (bytes32);
function batchCount() external view returns (uint256);
function isValidKeysetHash(
bytes32 ksHash
) external view returns (bool);
/// @notice the creation block is intended to still be available after a keyset is deleted
function getKeysetCreationBlock(
bytes32 ksHash
) external view returns (uint256);
/// @dev The delay buffer can change due to pending depletion/replenishment.
/// This function applies pending buffer changes to proactively calculate the force inclusion deadline.
/// This is only relevant when the buffer is less than the delayBlocks (unhappy case), otherwise force inclusion deadline is fixed at delayBlocks.
/// @notice Calculates the upper bounds of the delay buffer
/// @param blockNumber The block number when a delayed message was created
/// @return blockNumberDeadline The block number at when the message can be force included
function forceInclusionDeadline(
uint64 blockNumber
) external view returns (uint64 blockNumberDeadline);
// ---------- BatchPoster functions ----------
/// @dev Deprecated, kept for abi generation and will be removed in the future
function addSequencerL2BatchFromOrigin(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder
) external;
/// @dev Will be deprecated due to EIP-3074, use `addSequencerL2Batch` instead
function addSequencerL2BatchFromOrigin(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external;
function addSequencerL2Batch(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external;
function addSequencerL2BatchFromBlobs(
uint256 sequenceNumber,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount
) external;
/// @dev Proves message delays, updates delay buffers, and posts an L2 batch with blob data.
/// DelayProof proves the delay of the message and syncs the delay buffer.
function addSequencerL2BatchFromBlobsDelayProof(
uint256 sequenceNumber,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount,
DelayProof calldata delayProof
) external;
/// @dev Proves message delays, updates delay buffers, and posts an L2 batch with calldata posted from an EOA.
/// DelayProof proves the delay of the message and syncs the delay buffer.
/// Will be deprecated due to EIP-3074, use `addSequencerL2BatchDelayProof` instead
function addSequencerL2BatchFromOriginDelayProof(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount,
DelayProof calldata delayProof
) external;
/// @dev Proves message delays, updates delay buffers, and posts an L2 batch with calldata.
/// delayProof is used to prove the delay of the message and syncs the delay buffer.
function addSequencerL2BatchDelayProof(
uint256 sequenceNumber,
bytes calldata data,
uint256 afterDelayedMessagesRead,
IGasRefunder gasRefunder,
uint256 prevMessageCount,
uint256 newMessageCount,
DelayProof calldata delayProof
) external;
// ---------- onlyRollupOrOwner functions ----------
/**
* @notice Set max delay for sequencer inbox
* @param maxTimeVariation_ the maximum time variation parameters
*/
function setMaxTimeVariation(
MaxTimeVariation memory maxTimeVariation_
) external;
/**
* @notice Updates whether an address is authorized to be a batch poster at the sequencer inbox
* @param addr the address
* @param isBatchPoster_ if the specified address should be authorized as a batch poster
*/
function setIsBatchPoster(address addr, bool isBatchPoster_) external;
/**
* @notice Makes Data Availability Service keyset valid
* @param keysetBytes bytes of the serialized keyset
*/
function setValidKeyset(
bytes calldata keysetBytes
) external;
/**
* @notice Invalidates a Data Availability Service keyset
* @param ksHash hash of the keyset
*/
function invalidateKeysetHash(
bytes32 ksHash
) external;
/**
* @notice Updates whether an address is authorized to be a sequencer.
* @dev The IsSequencer information is used only off-chain by the nitro node to validate sequencer feed signer.
* @param addr the address
* @param isSequencer_ if the specified address should be authorized as a sequencer
*/
function setIsSequencer(address addr, bool isSequencer_) external;
/**
* @notice Updates the batch poster manager, the address which has the ability to rotate batch poster keys
* @param newBatchPosterManager The new batch poster manager to be set
*/
function setBatchPosterManager(
address newBatchPosterManager
) external;
/**
* @notice Updates the fee token pricer, the contract which is used to get the exchange rate between child
* chain's fee token and parent chain's fee token in rollups that use a custom fee token.
* @param newFeeTokenPricer The new fee token pricer to be set
*/
function setFeeTokenPricer(
IFeeTokenPricer newFeeTokenPricer
) external;
/// @notice Allows the rollup owner to sync the rollup address
function updateRollupAddress() external;
// ---------- initializer ----------
function initialize(
IBridge bridge_,
MaxTimeVariation calldata maxTimeVariation_,
BufferConfig calldata bufferConfig_,
IFeeTokenPricer feeTokenPricer_
) external;
}
interface IFeeTokenPricer {
/**
* @notice Get the number of child chain fee tokens per 1 parent chain fee token. Exchange rate must be
* denominated in 18 decimals. Function is mutable so it allows the pricer to keep internal state.
* @dev For example, parent chain's native token is ETH, fee token is DAI. If price of 1ETH = 2000DAI, then function should return 2000*1e18.
* If fee token is USDC instead and price of 1ETH = 2000USDC, function should still return 2000*1e18, despite USDC using 6 decimals.
*/
function getExchangeRate() external returns (uint256);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
pragma experimental ABIEncoderV2;
library Messages {
struct Message {
uint8 kind;
address sender;
uint64 blockNumber;
uint64 timestamp;
uint256 inboxSeqNum;
uint256 baseFeeL1;
bytes32 messageDataHash;
}
function messageHash(
Message memory message
) internal pure returns (bytes32) {
return messageHash(
message.kind,
message.sender,
message.blockNumber,
message.timestamp,
message.inboxSeqNum,
message.baseFeeL1,
message.messageDataHash
);
}
function messageHash(
uint8 kind,
address sender,
uint64 blockNumber,
uint64 timestamp,
uint256 inboxSeqNum,
uint256 baseFeeL1,
bytes32 messageDataHash
) internal pure returns (bytes32) {
return keccak256(
abi.encodePacked(
kind, sender, blockNumber, timestamp, inboxSeqNum, baseFeeL1, messageDataHash
)
);
}
function accumulateInboxMessage(
bytes32 prevAcc,
bytes32 message
) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(prevAcc, message));
}
/// @dev Validates a delayed accumulator preimage
/// @param delayedAcc The delayed accumulator to validate against
/// @param beforeDelayedAcc The previous delayed accumulator
/// @param message The message to validate
function isValidDelayedAccPreimage(
bytes32 delayedAcc,
bytes32 beforeDelayedAcc,
Message memory message
) internal pure returns (bool) {
return delayedAcc == accumulateInboxMessage(beforeDelayedAcc, messageHash(message));
}
}// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
//
pragma solidity ^0.8.0;
import "../bridge/IBridge.sol";
import "../osp/IOneStepProofEntry.sol";
import "../rollup/Assertion.sol";
/// @title Assertion chain interface
/// @notice The interface required by the EdgeChallengeManager for requesting assertion data from the AssertionChain
interface IAssertionChain {
function bridge() external view returns (IBridge);
function validateAssertionHash(
bytes32 assertionHash,
AssertionState calldata state,
bytes32 prevAssertionHash,
bytes32 inboxAcc
) external view;
function validateConfig(bytes32 assertionHash, ConfigData calldata configData) external view;
function getFirstChildCreationBlock(
bytes32 assertionHash
) external view returns (uint64);
function getSecondChildCreationBlock(
bytes32 assertionHash
) external view returns (uint64);
function isFirstChild(
bytes32 assertionHash
) external view returns (bool);
function isPending(
bytes32 assertionHash
) external view returns (bool);
function isValidator(
address
) external view returns (bool);
function getValidators() external view returns (address[] memory);
function validatorWhitelistDisabled() external view returns (bool);
}// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
//
pragma solidity ^0.8.0;
import "./IAssertionChain.sol";
import "./libraries/Structs.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title EdgeChallengeManager interface
interface IEdgeChallengeManager {
/// @notice Initialize the EdgeChallengeManager. EdgeChallengeManagers are upgradeable
/// so use the initializer paradigm
/// @param _assertionChain The assertion chain contract
/// @param _challengePeriodBlocks The amount of cumulative time an edge must spend unrivaled before it can be confirmed
/// This should be the censorship period + the cumulative amount of time needed to do any
/// offchain calculation. We currently estimate around 10 mins for each layer zero edge and 1
/// one minute for each other edge.
/// @param _oneStepProofEntry The one step proof logic
/// @param layerZeroBlockEdgeHeight The end height of layer zero edges of type Block
/// @param layerZeroBigStepEdgeHeight The end height of layer zero edges of type BigStep
/// @param layerZeroSmallStepEdgeHeight The end height of layer zero edges of type SmallStep
/// @param _stakeToken The token that stake will be provided in when creating zero layer block edges
/// @param _excessStakeReceiver The address that excess stake will be sent to when 2nd+ block edge is created
/// @param _numBigStepLevel The number of bigstep levels
/// @param _stakeAmounts The stake amount for each level. (first element is for block level)
function initialize(
IAssertionChain _assertionChain,
uint64 _challengePeriodBlocks,
IOneStepProofEntry _oneStepProofEntry,
uint256 layerZeroBlockEdgeHeight,
uint256 layerZeroBigStepEdgeHeight,
uint256 layerZeroSmallStepEdgeHeight,
IERC20 _stakeToken,
address _excessStakeReceiver,
uint8 _numBigStepLevel,
uint256[] calldata _stakeAmounts
) external;
function stakeToken() external view returns (IERC20);
function stakeAmounts(
uint256
) external view returns (uint256);
function challengePeriodBlocks() external view returns (uint64);
/// @notice The one step proof resolver used to decide between rival SmallStep edges of length 1
function oneStepProofEntry() external view returns (IOneStepProofEntry);
/// @notice Performs necessary checks and creates a new layer zero edge
/// @param args Edge creation args
function createLayerZeroEdge(
CreateEdgeArgs calldata args
) external returns (bytes32);
/// @notice Bisect an edge. This creates two child edges:
/// lowerChild: has the same start root and height as this edge, but a different end root and height
/// upperChild: has the same end root and height as this edge, but a different start root and height
/// The lower child end root and height are equal to the upper child start root and height. This height
/// is the mandatoryBisectionHeight.
/// The lower child may already exist, however it's not possible for the upper child to exist as that would
/// mean that the edge has already been bisected
/// @param edgeId Edge to bisect
/// @param bisectionHistoryRoot The new history root to be used in the lower and upper children
/// @param prefixProof A proof to show that the bisectionHistoryRoot commits to a prefix of the current endHistoryRoot
/// @return lowerChildId The id of the newly created lower child edge
/// @return upperChildId The id of the newly created upper child edge
function bisectEdge(
bytes32 edgeId,
bytes32 bisectionHistoryRoot,
bytes calldata prefixProof
) external returns (bytes32, bytes32);
/// @notice An edge can be confirmed if the total amount of time it and a single chain of its direct ancestors
/// has spent unrivaled is greater than the challenge period.
/// @dev Edges inherit time from their parents, so the sum of unrivaled timers is compared against the threshold.
/// Given that an edge cannot become unrivaled after becoming rivaled, once the threshold is passed
/// it will always remain passed. The direct ancestors of an edge are linked by parent-child links for edges
/// of the same level, and claimId-edgeId links for zero layer edges that claim an edge in the level below.
/// This method also includes the amount of time the assertion being claimed spent without a sibling
/// @param edgeId The id of the edge to confirm
function confirmEdgeByTime(
bytes32 edgeId,
AssertionStateData calldata claimStateData
) external;
/// @notice Update multiple edges' timer cache by their children. Equivalent to calling updateTimerCacheByChildren for each edge.
/// May update timer cache above maximum if the last edge's timer cache was below maximumCachedTime.
/// Revert when the last edge's timer cache is already equal to or above maximumCachedTime.
/// @param edgeIds The ids of the edges to update
/// @param maximumCachedTime The maximum amount of cached time allowed on the last edge (β∗)
function multiUpdateTimeCacheByChildren(
bytes32[] calldata edgeIds,
uint256 maximumCachedTime
) external;
/// @notice Update an edge's timer cache by its children.
/// Sets the edge's timer cache to its timeUnrivaled + (minimum timer cache of its children).
/// May update timer cache above maximum if the last edge's timer cache was below maximumCachedTime.
/// Revert when the edge's timer cache is already equal to or above maximumCachedTime.
/// @param edgeId The id of the edge to update
/// @param maximumCachedTime The maximum amount of cached time allowed on the edge (β∗)
function updateTimerCacheByChildren(bytes32 edgeId, uint256 maximumCachedTime) external;
/// @notice Given a one step fork edge and an edge with matching claim id,
/// set the one step fork edge's timer cache to its timeUnrivaled + claiming edge's timer cache.
/// May update timer cache above maximum if the last edge's timer cache was below maximumCachedTime.
/// Revert when the edge's timer cache is already equal to or above maximumCachedTime.
/// @param edgeId The id of the edge to update
/// @param claimingEdgeId The id of the edge which has a claimId equal to edgeId
/// @param maximumCachedTime The maximum amount of cached time allowed on the edge (β∗)
function updateTimerCacheByClaim(
bytes32 edgeId,
bytes32 claimingEdgeId,
uint256 maximumCachedTime
) external;
/// @notice Confirm an edge by executing a one step proof
/// @dev One step proofs can only be executed against edges that have length one and of type SmallStep
/// @param edgeId The id of the edge to confirm
/// @param oneStepData Input data to the one step proof
/// @param prevConfig Data about the config set in prev
/// @param beforeHistoryInclusionProof Proof that the state which is the start of the edge is committed to by the startHistoryRoot
/// @param afterHistoryInclusionProof Proof that the state which is the end of the edge is committed to by the endHistoryRoot
function confirmEdgeByOneStepProof(
bytes32 edgeId,
OneStepData calldata oneStepData,
ConfigData calldata prevConfig,
bytes32[] calldata beforeHistoryInclusionProof,
bytes32[] calldata afterHistoryInclusionProof
) external;
/// @notice When zero layer block edges are created a stake is also provided
/// The stake on this edge can be refunded if the edge is confirme
function refundStake(
bytes32 edgeId
) external;
/// @notice Zero layer edges have to be a fixed height.
/// This function returns the end height for a given edge type
function getLayerZeroEndHeight(
EdgeType eType
) external view returns (uint256);
/// @notice Calculate the unique id of an edge
/// @param level The level of the edge
/// @param originId The origin id of the edge
/// @param startHeight The start height of the edge
/// @param startHistoryRoot The start history root of the edge
/// @param endHeight The end height of the edge
/// @param endHistoryRoot The end history root of the edge
function calculateEdgeId(
uint8 level,
bytes32 originId,
uint256 startHeight,
bytes32 startHistoryRoot,
uint256 endHeight,
bytes32 endHistoryRoot
) external pure returns (bytes32);
/// @notice Calculate the mutual id of the edge
/// Edges that are rivals share the same mutual id
/// @param level The level of the edge
/// @param originId The origin id of the edge
/// @param startHeight The start height of the edge
/// @param startHistoryRoot The start history root of the edge
/// @param endHeight The end height of the edge
function calculateMutualId(
uint8 level,
bytes32 originId,
uint256 startHeight,
bytes32 startHistoryRoot,
uint256 endHeight
) external pure returns (bytes32);
/// @notice Has the edge already been stored in the manager
function edgeExists(
bytes32 edgeId
) external view returns (bool);
/// @notice Get full edge data for an edge
function getEdge(
bytes32 edgeId
) external view returns (ChallengeEdge memory);
/// @notice The length of the edge, from start height to end height
function edgeLength(
bytes32 edgeId
) external view returns (uint256);
/// @notice Does this edge currently have one or more rivals
/// Rival edges share the same mutual id
function hasRival(
bytes32 edgeId
) external view returns (bool);
/// @notice The confirmed rival of this mutual id
/// Returns 0 if one does not exist
function confirmedRival(
bytes32 mutualId
) external view returns (bytes32);
/// @notice Does the edge have at least one rival, and it has length one
function hasLengthOneRival(
bytes32 edgeId
) external view returns (bool);
/// @notice The amount of time this edge has spent without rivals
/// This value is increasing whilst an edge is unrivaled, once a rival is created
/// it is fixed. If an edge has rivals from the moment it is created then it will have
/// a zero time unrivaled
function timeUnrivaled(
bytes32 edgeId
) external view returns (uint256);
/// @notice Get the id of the prev assertion that this edge is originates from
/// @dev Uses the parent chain to traverse upwards SmallStep->BigStep->Block->Assertion
/// until it gets to the origin assertion
function getPrevAssertionHash(
bytes32 edgeId
) external view returns (bytes32);
/// @notice Fetch the raw first rival record for the given mutual id
/// @dev Returns 0 if there is no edge with the given mutual id
/// Returns a magic value if there is one edge but it is unrivaled
/// Returns the id of the second edge created with the mutual id, if > 1 exists
function firstRival(
bytes32 mutualId
) external view returns (bytes32);
/// @notice True if an account has made a layer zero edge with the given mutual id.
/// This is only tracked when the validator whitelist is enabled
function hasMadeLayerZeroRival(
address account,
bytes32 mutualId
) external view returns (bool);
}// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
//
pragma solidity ^0.8.17;
/// @notice The status of the edge
/// - Pending: Yet to be confirmed. Not all edges can be confirmed.
/// - Confirmed: Once confirmed it cannot transition back to pending
enum EdgeStatus {
Pending,
Confirmed
}
/// @notice The type of the edge. Challenges are decomposed into 3 types of subchallenge
/// represented here by the edge type. Edges are initially created of type Block
/// and are then bisected until they have length one. After that new BigStep edges are
/// added that claim a Block type edge, and are then bisected until they have length one.
/// Then a SmallStep edge is added that claims a length one BigStep edge, and these
/// SmallStep edges are bisected until they reach length one. A length one small step edge
/// can then be directly executed using a one-step proof.
enum EdgeType {
Block,
BigStep,
SmallStep
}// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
//
pragma solidity ^0.8.0;
import "./Enums.sol";
import "../../rollup/AssertionState.sol";
/// @notice An execution state and proof to show that it's valid
struct AssertionStateData {
/// @notice An execution state
AssertionState assertionState;
/// @notice assertion Hash of the prev assertion
bytes32 prevAssertionHash;
/// @notice Inbox accumulator of the assertion
bytes32 inboxAcc;
}
/// @notice Data for creating a layer zero edge
struct CreateEdgeArgs {
/// @notice The level of edge to be created. Challenges are decomposed into multiple levels.
/// The first (level 0) being of type Block, followed by n (set by NUM_BIGSTEP_LEVEL) levels of type BigStep, and finally
/// followed by a single level of type SmallStep. Each level is bisected until an edge
/// of length one is reached before proceeding to the next level. The first edge in each level (the layer zero edge)
/// makes a claim about an assertion or assertion in the lower level.
/// Finally in the last level, a SmallStep edge is added that claims a lower level length one BigStep edge, and these
/// SmallStep edges are bisected until they reach length one. A length one small step edge
/// can then be directly executed using a one-step proof.
uint8 level;
/// @notice The end history root of the edge to be created
bytes32 endHistoryRoot;
/// @notice The end height of the edge to be created.
/// @dev End height is deterministic for different levels but supplying it here gives the
/// caller a bit of extra security that they are supplying data for the correct level of edge
uint256 endHeight;
/// @notice The edge, or assertion, that is being claimed correct by the newly created edge.
bytes32 claimId;
/// @notice Proof that the start history root commits to a prefix of the states that
/// end history root commits to
bytes prefixProof;
/// @notice Edge type specific data
/// For Block type edges this is the abi encoding of:
/// bytes32[]: Inclusion proof - proof to show that the end state is the last state in the end history root
/// AssertionStateData: the before state of the edge
/// AssertionStateData: the after state of the edge
/// bytes32 predecessorId: id of the prev assertion
/// bytes32 inboxAcc: the inbox accumulator of the assertion
/// For BigStep and SmallStep edges this is the abi encoding of:
/// bytes32: Start state - first state the edge commits to
/// bytes32: End state - last state the edge commits to
/// bytes32[]: Claim start inclusion proof - proof to show the start state is the first state in the claim edge
/// bytes32[]: Claim end inclusion proof - proof to show the end state is the last state in the claim edge
/// bytes32[]: Inclusion proof - proof to show that the end state is the last state in the end history root
bytes proof;
}
/// @notice Data parsed raw proof data
struct ProofData {
/// @notice The first state being committed to by an edge
bytes32 startState;
/// @notice The last state being committed to by an edge
bytes32 endState;
/// @notice A proof that the end state is included in the edge
bytes32[] inclusionProof;
}
/// @notice Stores all edges and their rival status
struct EdgeStore {
/// @notice A mapping of edge id to edges. Edges are never deleted, only created, and potentially confirmed.
mapping(bytes32 => ChallengeEdge) edges;
/// @notice A mapping of mutualId to edge id. Rivals share the same mutual id, and here we
/// store the edge id of the second edge that was created with the same mutual id - the first rival
/// When only one edge exists for a specific mutual id then a special magic string hash is stored instead
/// of the first rival id, to signify that a single edge does exist with this mutual id
mapping(bytes32 => bytes32) firstRivals;
/// @notice A mapping of mutualId to the edge id of the confirmed rival with that mutualId
/// @dev Each group of rivals (edges sharing mutual id) can only have at most one confirmed edge
mapping(bytes32 => bytes32) confirmedRivals;
/// @notice A mapping of account -> mutualId -> bool indicating if the account has created a layer zero edge with a mutual id
mapping(address => mapping(bytes32 => bool)) hasMadeLayerZeroRival;
}
/// @notice Input data to a one step proof
struct OneStepData {
/// @notice The hash of the state that's being executed from
bytes32 beforeHash;
/// @notice Proof data to accompany the execution context
bytes proof;
}
/// @notice Data about a recently added edge
struct EdgeAddedData {
bytes32 edgeId;
bytes32 mutualId;
bytes32 originId;
bytes32 claimId;
uint256 length;
uint8 level;
bool hasRival;
bool isLayerZero;
}
/// @notice Data about an assertion that is being claimed by an edge
/// @dev This extra information that is needed in order to verify that a block edge can be created
struct AssertionReferenceData {
/// @notice The id of the assertion - will be used in a sanity check
bytes32 assertionHash;
/// @notice The predecessor of the assertion
bytes32 predecessorId;
/// @notice Is the assertion pending
bool isPending;
/// @notice Does the assertion have a sibling
bool hasSibling;
/// @notice The execution state of the predecessor assertion
AssertionState startState;
/// @notice The execution state of the assertion being claimed
AssertionState endState;
}
/// @notice An edge committing to a range of states. These edges will be bisected, slowly
/// reducing them in length until they reach length one. At that point new edges of a different
/// level will be added that claim the result of this edge, or a one step proof will be calculated
/// if the edge level is already of type SmallStep.
struct ChallengeEdge {
/// @notice The origin id is a link from the edge to an edge or assertion at a lower level.
/// Intuitively all edges with the same origin id agree on the information committed to in the origin id
/// For a SmallStep edge the origin id is the 'mutual' id of the length one BigStep edge being claimed by the zero layer ancestors of this edge
/// For a BigStep edge the origin id is the 'mutual' id of the length one Block edge being claimed by the zero layer ancestors of this edge
/// For a Block edge the origin id is the assertion hash of the assertion that is the root of the challenge - all edges in this challenge agree
/// that that assertion hash is valid.
/// The purpose of the origin id is to ensure that only edges that agree on a common start position
/// are being compared against one another.
bytes32 originId;
/// @notice A root of all the states in the history up to the startHeight
bytes32 startHistoryRoot;
/// @notice The height of the start history root
uint256 startHeight;
/// @notice A root of all the states in the history up to the endHeight. Since endHeight > startHeight, the startHistoryRoot must
/// commit to a prefix of the states committed to by the endHistoryRoot
bytes32 endHistoryRoot;
/// @notice The height of the end history root
uint256 endHeight;
/// @notice Edges can be bisected into two children. If this edge has been bisected the id of the
/// lower child is populated here, until that time this value is 0. The lower child has startHistoryRoot and startHeight
/// equal to this edge, but endHistoryRoot and endHeight equal to some prefix of the endHistoryRoot of this edge
bytes32 lowerChildId;
/// @notice Edges can be bisected into two children. If this edge has been bisected the id of the
/// upper child is populated here, until that time this value is 0. The upper child has startHistoryRoot and startHeight
/// equal to some prefix of the endHistoryRoot of this edge, and endHistoryRoot and endHeight equal to this edge
bytes32 upperChildId;
/// @notice The edge or assertion in the upper level that this edge claims to be true.
/// Only populated on zero layer edges
bytes32 claimId;
/// @notice The entity that supplied a mini-stake accompanying this edge
/// Only populated on zero layer edges
address staker;
/// @notice The block number when this edge was created
uint64 createdAtBlock;
/// @notice The block number at which this edge was confirmed
/// Zero if not confirmed
uint64 confirmedAtBlock;
/// @notice Current status of this edge. All edges are created Pending, and may be updated to Confirmed
/// Once Confirmed they cannot transition back to Pending
EdgeStatus status;
/// @notice The level of this edge.
/// Level 0 is type Block
/// Last level (defined by NUM_BIGSTEP_LEVEL + 1) is type SmallStep
/// All levels in between are of type BigStep
uint8 level;
/// @notice Set to true when the staker has been refunded. Can only be set to true if the status is Confirmed
/// and the staker is non zero.
bool refunded;
/// @notice TODO
uint64 totalTimeUnrivaledCache;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "../precompiles/ArbSys.sol";
library ArbitrumChecker {
function runningOnArbitrum() internal view returns (bool) {
(bool ok, bytes memory data) =
address(100).staticcall(abi.encodeWithSelector(ArbSys.arbOSVersion.selector));
return ok && data.length == 32;
}
}// Copyright 2021-2024, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
library CallerChecker {
/**
* @notice A EIP-7702 safe check to ensure the caller is the origin and is codeless
* @return bool true if the caller is the origin and is codeless, false otherwise
* @dev If the caller is the origin and is codeless, then msg.data is guaranteed to be same as tx.data
* It also mean the caller would not be able to call a contract multiple times with the same transaction
*/
function isCallerCodelessOrigin() internal view returns (bool) {
// solhint-disable-next-line avoid-tx-origin
return msg.sender == tx.origin && msg.sender.code.length == 0;
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import {NotOwner} from "./Error.sol";
/// @dev A stateless contract that allows you to infer if the current call has been delegated or not
/// Pattern used here is from UUPS implementation by the OpenZeppelin team
abstract contract DelegateCallAware {
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegate call. This allows a function to be
* callable on the proxy contract but not on the logic contract.
*/
modifier onlyDelegated() {
require(address(this) != __self, "Function must be called through delegatecall");
_;
}
/**
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
* callable on the implementing contract but not through proxies.
*/
modifier notDelegated() {
require(address(this) == __self, "Function must not be called through delegatecall");
_;
}
/// @dev Check that msg.sender is the current EIP 1967 proxy admin
modifier onlyProxyOwner() {
// Storage slot with the admin of the proxy contract
// This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1
bytes32 slot = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
address admin;
assembly {
admin := sload(slot)
}
if (msg.sender != admin) revert NotOwner(msg.sender, admin);
_;
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;
/// @dev Init was already called
error AlreadyInit();
/// @dev Init was called with param set to zero that must be nonzero
error HadZeroInit();
/// @dev Thrown when post upgrade init validation fails
error BadPostUpgradeInit();
/// @dev Thrown when the caller is not a codeless origin
error NotCodelessOrigin();
/// @dev Thrown when non owner tries to access an only-owner function
/// @param sender The msg.sender who is not the owner
/// @param owner The owner address
error NotOwner(address sender, address owner);
/// @dev Thrown when an address that is not the rollup tries to call an only-rollup function
/// @param sender The sender who is not the rollup
/// @param rollup The rollup address authorized to call this function
error NotRollup(address sender, address rollup);
/// @dev Thrown when the contract was not called directly from the origin ie msg.sender != tx.origin
error NotOrigin();
/// @dev Provided data was too large
/// @param dataLength The length of the data that is too large
/// @param maxDataLength The max length the data can be
error DataTooLarge(uint256 dataLength, uint256 maxDataLength);
/// @dev The provided is not a contract and was expected to be
/// @param addr The adddress in question
error NotContract(address addr);
/// @dev The merkle proof provided was too long
/// @param actualLength The length of the merkle proof provided
/// @param maxProofLength The max length a merkle proof can have
error MerkleProofTooLong(uint256 actualLength, uint256 maxProofLength);
/// @dev Thrown when an un-authorized address tries to access an admin function
/// @param sender The un-authorized sender
/// @param rollup The rollup, which would be authorized
/// @param owner The rollup's owner, which would be authorized
error NotRollupOrOwner(address sender, address rollup, address owner);
// Bridge Errors
/// @dev Thrown when an un-authorized address tries to access an only-inbox function
/// @param sender The un-authorized sender
error NotDelayedInbox(address sender);
/// @dev Thrown when an un-authorized address tries to access an only-sequencer-inbox function
/// @param sender The un-authorized sender
error NotSequencerInbox(address sender);
/// @dev Thrown when an un-authorized address tries to access an only-outbox function
/// @param sender The un-authorized sender
error NotOutbox(address sender);
/// @dev the provided outbox address isn't valid
/// @param outbox address of outbox being set
error InvalidOutboxSet(address outbox);
/// @dev The provided token address isn't valid
/// @param token address of token being set
error InvalidTokenSet(address token);
/// @dev Call to this specific address is not allowed
/// @param target address of the call receiver
error CallTargetNotAllowed(address target);
/// @dev Call that changes the balance of ERC20Bridge is not allowed
error CallNotAllowed();
// Inbox Errors
/// @dev msg.value sent to the inbox isn't high enough
error InsufficientValue(uint256 expected, uint256 actual);
/// @dev submission cost provided isn't enough to create retryable ticket
error InsufficientSubmissionCost(uint256 expected, uint256 actual);
/// @dev address not allowed to interact with the given contract
error NotAllowedOrigin(address origin);
/// @dev used to convey retryable tx data in eth calls without requiring a tx trace
/// this follows a pattern similar to EIP-3668 where reverts surface call information
error RetryableData(
address from,
address to,
uint256 l2CallValue,
uint256 deposit,
uint256 maxSubmissionCost,
address excessFeeRefundAddress,
address callValueRefundAddress,
uint256 gasLimit,
uint256 maxFeePerGas,
bytes data
);
/// @dev Thrown when a L1 chainId fork is detected
error L1Forked();
/// @dev Thrown when a L1 chainId fork is not detected
error NotForked();
/// @dev The provided gasLimit is larger than uint64
error GasLimitTooLarge();
/// @dev The provided amount cannot be adjusted to 18 decimals due to overflow
error AmountTooLarge(uint256 amount);
/// @dev Number of native token's decimals is restricted to enable conversions to 18 decimals
error NativeTokenDecimalsTooLarge(uint256 decimals);
// Outbox Errors
/// @dev The provided proof was too long
/// @param proofLength The length of the too-long proof
error ProofTooLong(uint256 proofLength);
/// @dev The output index was greater than the maximum
/// @param index The output index
/// @param maxIndex The max the index could be
error PathNotMinimal(uint256 index, uint256 maxIndex);
/// @dev The calculated root does not exist
/// @param root The calculated root
error UnknownRoot(bytes32 root);
/// @dev The record has already been spent
/// @param index The index of the spent record
error AlreadySpent(uint256 index);
/// @dev A call to the bridge failed with no return data
error BridgeCallFailed();
// Sequencer Inbox Errors
/// @dev Thrown when someone attempts to read fewer messages than have already been read
error DelayedBackwards();
/// @dev Thrown when someone attempts to read more messages than exist
error DelayedTooFar();
/// @dev Force include can only read messages more blocks old than the delay period
error ForceIncludeBlockTooSoon();
/// @dev The message provided did not match the hash in the delayed inbox
error IncorrectMessagePreimage();
/// @dev This can only be called by the batch poster
error NotBatchPoster();
/// @dev The sequence number provided to this message was inconsistent with the number of batches already included
error BadSequencerNumber(uint256 stored, uint256 received);
/// @dev The sequence message number provided to this message was inconsistent with the previous one
error BadSequencerMessageNumber(uint256 stored, uint256 received);
/// @dev Tried to create an already valid Data Availability Service keyset
error AlreadyValidDASKeyset(bytes32);
/// @dev Tried to use or invalidate an already invalid Data Availability Service keyset
error NoSuchKeyset(bytes32);
/// @dev Thrown when the provided address is not the designated batch poster manager
error NotBatchPosterManager(address);
/// @dev Thrown when a data blob feature is attempted to be used on a chain that doesnt support it
error DataBlobsNotSupported();
/// @dev Thrown when batches are posted without buffer proof, this is only allowed in a sync state or when no new delayed messages are read
error DelayProofRequired();
/// @dev The DelayedAccPreimage is invalid
error InvalidDelayedAccPreimage();
/// @dev Thrown when the sequencer attempts to post a batch with delay / sync proofs without delay bufferability enabled
error NotDelayBufferable();
/// @dev Thrown when an init param was supplied as empty
error InitParamZero(string name);
/// @dev Thrown when data hashes where expected but not where present on the tx
error MissingDataHashes();
/// @dev Thrown when rollup is not updated with updateRollupAddress
error RollupNotChanged();
/// @dev Unsupported header flag was provided
error InvalidHeaderFlag(bytes1);
/// @dev SequencerInbox and Bridge are not in the same feeToken/ETH mode
error NativeTokenMismatch();
/// @dev Thrown when a deprecated function is called
error Deprecated();
/// @dev Thrown when any component of maxTimeVariation is over uint64
error BadMaxTimeVariation();
/// @dev Thrown when a fee token pricer is provided but the chain doesn't use a fee token
error CannotSetFeeTokenPricer();
/// @dev Thrown when any component of bufferConfig is zero
error BadBufferConfig();
/// @dev Thrown when extra gas is not a uint64
error ExtraGasNotUint64();
/// @dev Thrown when keysetBytes is too large
error KeysetTooLarge();// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;
import "./IReader4844.sol";
import "./IGasRefunder.sol";
import "../libraries/CallerChecker.sol";
abstract contract GasRefundEnabled {
uint256 internal immutable gasPerBlob = 2 ** 17;
/// @dev this refunds the sender for execution costs of the tx
/// calldata costs are only refunded if `msg.sender == tx.origin` to guarantee the value refunded relates to charging
/// for the `tx.input`. this avoids a possible attack where you generate large calldata from a contract and get over-refunded
modifier refundsGas(IGasRefunder gasRefunder, IReader4844 reader4844) {
uint256 startGasLeft = gasleft();
_;
if (address(gasRefunder) != address(0)) {
uint256 calldataSize = msg.data.length;
uint256 calldataWords = (calldataSize + 31) / 32;
// account for the CALLDATACOPY cost of the proxy contract, including the memory expansion cost
startGasLeft += calldataWords * 6 + (calldataWords ** 2) / 512;
// if triggered in a contract call, the spender may be overrefunded by appending dummy data to the call
// so we check if it is a top level call, which would mean the sender paid calldata as part of tx.input
if (!CallerChecker.isCallerCodelessOrigin()) {
// We can't be sure if this calldata came from the top level tx,
// so to be safe we tell the gas refunder there was no calldata.
calldataSize = 0;
} else {
// for similar reasons to above we only refund blob gas when the tx.origin is the msg.sender
// this avoids the caller being able to send blobs to other contracts and still get refunded here
if (address(reader4844) != address(0)) {
// add any cost for 4844 data, the data hash reader throws an error prior to 4844 being activated
// we do this addition here rather in the GasRefunder so that we can check the msg.sender is the tx.origin
try reader4844.getDataHashes() returns (bytes32[] memory dataHashes) {
if (dataHashes.length != 0) {
uint256 blobBasefee = reader4844.getBlobBaseFee();
startGasLeft +=
(dataHashes.length * gasPerBlob * blobBasefee) / block.basefee;
}
} catch {}
}
}
gasRefunder.onGasSpent(payable(msg.sender), startGasLeft - gasleft(), calldataSize);
}
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.9 <0.9.0;
interface IGasRefunder {
function onGasSpent(
address payable spender,
uint256 gasUsed,
uint256 calldataSize
) external returns (bool success);
}// Copyright 2023-2024, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.6.9 <0.9.0;
interface IReader4844 {
/// @notice Returns the current BLOBBASEFEE
function getBlobBaseFee() external view returns (uint256);
/// @notice Returns all the data hashes of all the blobs on the current transaction
function getDataHashes() external view returns (bytes32[] memory);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./IOneStepProver.sol";
import "../state/Machine.sol";
library OneStepProofEntryLib {
uint256 internal constant MAX_STEPS = 1 << 43;
}
struct ExecutionState {
GlobalState globalState;
MachineStatus machineStatus;
}
interface IOneStepProofEntry {
function getStartMachineHash(
bytes32 globalStateHash,
bytes32 wasmModuleRoot
) external pure returns (bytes32);
function proveOneStep(
ExecutionContext calldata execCtx,
uint256 machineStep,
bytes32 beforeHash,
bytes calldata proof
) external view returns (bytes32 afterHash);
function getMachineHash(
ExecutionState calldata execState
) external pure returns (bytes32);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "../state/Machine.sol";
import "../state/Module.sol";
import "../state/Instructions.sol";
import "../state/GlobalState.sol";
import "../bridge/ISequencerInbox.sol";
import "../bridge/IBridge.sol";
struct ExecutionContext {
uint256 maxInboxMessagesRead;
IBridge bridge;
bytes32 initialWasmModuleRoot;
}
abstract contract IOneStepProver {
function executeOneStep(
ExecutionContext memory execCtx,
Machine calldata mach,
Module calldata mod,
Instruction calldata instruction,
bytes calldata proof
) external view virtual returns (Machine memory result, Module memory resultMod);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.4.21 <0.9.0;
/// @title Provides insight into the cost of using the chain.
/// @notice These methods have been adjusted to account for Nitro's heavy use of calldata compression.
/// Of note to end-users, we no longer make a distinction between non-zero and zero-valued calldata bytes.
/// Precompiled contract that exists in every Arbitrum chain at 0x000000000000000000000000000000000000006c.
interface ArbGasInfo {
/// @notice Get gas prices for a provided aggregator
/// @return return gas prices in wei
/// (
/// per L2 tx,
/// per L1 calldata byte
/// per storage allocation,
/// per ArbGas base,
/// per ArbGas congestion,
/// per ArbGas total
/// )
function getPricesInWeiWithAggregator(
address aggregator
) external view returns (uint256, uint256, uint256, uint256, uint256, uint256);
/// @notice Get gas prices. Uses the caller's preferred aggregator, or the default if the caller doesn't have a preferred one.
/// @return return gas prices in wei
/// (
/// per L2 tx,
/// per L1 calldata byte
/// per storage allocation,
/// per ArbGas base,
/// per ArbGas congestion,
/// per ArbGas total
/// )
function getPricesInWei()
external
view
returns (uint256, uint256, uint256, uint256, uint256, uint256);
/// @notice Get prices in ArbGas for the supplied aggregator
/// @return (per L2 tx, per L1 calldata byte, per storage allocation)
function getPricesInArbGasWithAggregator(
address aggregator
) external view returns (uint256, uint256, uint256);
/// @notice Get prices in ArbGas. Assumes the callers preferred validator, or the default if caller doesn't have a preferred one.
/// @return (per L2 tx, per L1 calldata byte, per storage allocation)
function getPricesInArbGas() external view returns (uint256, uint256, uint256);
/// @notice Get the gas accounting parameters. `gasPoolMax` is always zero, as the exponential pricing model has no such notion.
/// @return (speedLimitPerSecond, gasPoolMax, maxTxGasLimit)
function getGasAccountingParams() external view returns (uint256, uint256, uint256);
/// @notice Get the minimum gas price needed for a tx to succeed
function getMinimumGasPrice() external view returns (uint256);
/// @notice Get ArbOS's estimate of the L1 basefee in wei
function getL1BaseFeeEstimate() external view returns (uint256);
/// @notice Get how slowly ArbOS updates its estimate of the L1 basefee
function getL1BaseFeeEstimateInertia() external view returns (uint64);
/// @notice Get the L1 pricer reward rate, in wei per unit
/// Available in ArbOS version 11
function getL1RewardRate() external view returns (uint64);
/// @notice Get the L1 pricer reward recipient
/// Available in ArbOS version 11
function getL1RewardRecipient() external view returns (address);
/// @notice Deprecated -- Same as getL1BaseFeeEstimate()
function getL1GasPriceEstimate() external view returns (uint256);
/// @notice Get L1 gas fees paid by the current transaction
function getCurrentTxL1GasFees() external view returns (uint256);
/// @notice Get the backlogged amount of gas burnt in excess of the speed limit
function getGasBacklog() external view returns (uint64);
/// @notice Get how slowly ArbOS updates the L2 basefee in response to backlogged gas
function getPricingInertia() external view returns (uint64);
/// @notice Get the forgivable amount of backlogged gas ArbOS will ignore when raising the basefee
function getGasBacklogTolerance() external view returns (uint64);
/// @notice Returns the surplus of funds for L1 batch posting payments (may be negative).
function getL1PricingSurplus() external view returns (int256);
/// @notice Returns the base charge (in L1 gas) attributed to each data batch in the calldata pricer
function getPerBatchGasCharge() external view returns (int64);
/// @notice Returns the cost amortization cap in basis points
function getAmortizedCostCapBips() external view returns (uint64);
/// @notice Returns the available funds from L1 fees
function getL1FeesAvailable() external view returns (uint256);
/// @notice Returns the equilibration units parameter for L1 price adjustment algorithm
/// Available in ArbOS version 20
function getL1PricingEquilibrationUnits() external view returns (uint256);
/// @notice Returns the last time the L1 calldata pricer was updated.
/// Available in ArbOS version 20
function getLastL1PricingUpdateTime() external view returns (uint64);
/// @notice Returns the amount of L1 calldata payments due for rewards (per the L1 reward rate)
/// Available in ArbOS version 20
function getL1PricingFundsDueForRewards() external view returns (uint256);
/// @notice Returns the amount of L1 calldata posted since the last update.
/// Available in ArbOS version 20
function getL1PricingUnitsSinceUpdate() external view returns (uint64);
/// @notice Returns the L1 pricing surplus as of the last update (may be negative).
/// Available in ArbOS version 20
function getLastL1PricingSurplus() external view returns (int256);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.4.21 <0.9.0;
/**
* @title System level functionality
* @notice For use by contracts to interact with core L2-specific functionality.
* Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064.
*/
interface ArbSys {
/**
* @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)
* @return block number as int
*/
function arbBlockNumber() external view returns (uint256);
/**
* @notice Get Arbitrum block hash (reverts unless currentBlockNum-256 <= arbBlockNum < currentBlockNum)
* @return block hash
*/
function arbBlockHash(
uint256 arbBlockNum
) external view returns (bytes32);
/**
* @notice Gets the rollup's unique chain identifier
* @return Chain identifier as int
*/
function arbChainID() external view returns (uint256);
/**
* @notice Get internal version number identifying an ArbOS build, this is `55 + nitroArbOS version number`
* e.g. on ArbOS 31 this would return 86. This is the only function that have the 55 offset.
* @return version number as int
*/
function arbOSVersion() external view returns (uint256);
/**
* @notice Returns 0 since Nitro has no concept of storage gas
* @return uint 0
*/
function getStorageGasAvailable() external view returns (uint256);
/**
* @notice (deprecated) check if current call is top level (meaning it was triggered by an EoA or a L1 contract)
* @dev this call has been deprecated and may be removed in a future release
* @return true if current execution frame is not a call by another L2 contract
*/
function isTopLevelCall() external view returns (bool);
/**
* @notice map L1 sender contract address to its L2 alias
* @param sender sender address
* @param unused argument no longer used
* @return aliased sender address
*/
function mapL1SenderContractAddressToL2Alias(
address sender,
address unused
) external pure returns (address);
/**
* @notice check if the caller (of this caller of this) is an aliased L1 contract address
* @return true iff the caller's address is an alias for an L1 contract address
*/
function wasMyCallersAddressAliased() external view returns (bool);
/**
* @notice return the address of the caller (of this caller of this), without applying L1 contract address aliasing
* @return address of the caller's caller, without applying L1 contract address aliasing
*/
function myCallersAddressWithoutAliasing() external view returns (address);
/**
* @notice Send given amount of Eth to dest from sender.
* This is a convenience function, which is equivalent to calling sendTxToL1 with empty data.
* @param destination recipient address on L1
* @return unique identifier for this L2-to-L1 transaction.
*/
function withdrawEth(
address destination
) external payable returns (uint256);
/**
* @notice Send a transaction to L1
* @dev it is not possible to execute on the L1 any L2-to-L1 transaction which contains data
* to a contract address without any code (as enforced by the Bridge contract).
* @param destination recipient address on L1
* @param data (optional) calldata for L1 contract call
* @return a unique identifier for this L2-to-L1 transaction.
*/
function sendTxToL1(
address destination,
bytes calldata data
) external payable returns (uint256);
/**
* @notice Get send Merkle tree state
* @return size number of sends in the history
* @return root root hash of the send history
* @return partials hashes of partial subtrees in the send history tree
*/
function sendMerkleTreeState()
external
view
returns (uint256 size, bytes32 root, bytes32[] memory partials);
/**
* @notice creates a send txn from L2 to L1
* @param position = (level << 192) + leaf = (0 << 192) + leaf = leaf
*/
event L2ToL1Tx(
address caller,
address indexed destination,
uint256 indexed hash,
uint256 indexed position,
uint256 arbBlockNum,
uint256 ethBlockNum,
uint256 timestamp,
uint256 callvalue,
bytes data
);
/// @dev DEPRECATED in favour of the new L2ToL1Tx event above after the nitro upgrade
event L2ToL1Transaction(
address caller,
address indexed destination,
uint256 indexed uniqueId,
uint256 indexed batchNumber,
uint256 indexInBatch,
uint256 arbBlockNum,
uint256 ethBlockNum,
uint256 timestamp,
uint256 callvalue,
bytes data
);
/**
* @notice logs a merkle branch for proof synthesis
* @param reserved an index meant only to align the 4th index with L2ToL1Transaction's 4th event
* @param hash the merkle hash
* @param position = (level << 192) + leaf
*/
event SendMerkleUpdate(
uint256 indexed reserved, bytes32 indexed hash, uint256 indexed position
);
error InvalidBlockNumber(uint256 requested, uint256 current);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./AssertionState.sol";
enum AssertionStatus {
// No assertion at this index
NoAssertion,
// Assertion is being computed
Pending,
// Assertion is confirmed
Confirmed
}
struct AssertionNode {
// This value starts at zero and is set to a value when the first child is created. After that it is constant until the assertion is destroyed or the owner destroys pending assertions
uint64 firstChildBlock;
// This value starts at zero and is set to a value when the second child is created. After that it is constant until the assertion is destroyed or the owner destroys pending assertions
uint64 secondChildBlock;
// The block number when this assertion was created
uint64 createdAtBlock;
// True if this assertion is the first child of its prev
bool isFirstChild;
// Status of the Assertion
AssertionStatus status;
// A hash of the context available at the time of this assertions creation. It should contain information that is not specific
// to this assertion, but instead to the environment at the time of creation. This is necessary to store on the assertion
// as this environment can change and we need to know what it was like at the time this assertion was created. An example
// of this is the wasm module root which determines the state transition function on the L2. If the wasm module root
// changes we need to know that previous assertions were made under a different root, so that we can understand that they
// were valid at the time. So when resolving a challenge by one step, the edge challenge manager finds the wasm module root
// that was recorded on the prev of the assertions being disputed and uses it to resolve the one step proof.
bytes32 configHash;
}
struct BeforeStateData {
// The assertion hash of the prev of the beforeState(prev)
bytes32 prevPrevAssertionHash;
// The sequencer inbox accumulator asserted by the beforeState(prev)
bytes32 sequencerBatchAcc;
// below are the components of config hash
ConfigData configData;
}
struct AssertionInputs {
// Additional data used to validate the before state
BeforeStateData beforeStateData;
AssertionState beforeState;
AssertionState afterState;
}
struct ConfigData {
bytes32 wasmModuleRoot;
uint256 requiredStake;
address challengeManager;
uint64 confirmPeriodBlocks;
uint64 nextInboxPosition;
}
/**
* @notice Utility functions for Assertion
*/
library AssertionNodeLib {
/**
* @notice Initialize a Assertion
*/
function createAssertion(
bool _isFirstChild,
bytes32 _configHash
) internal view returns (AssertionNode memory) {
AssertionNode memory assertion;
assertion.createdAtBlock = uint64(block.number);
assertion.isFirstChild = _isFirstChild;
assertion.configHash = _configHash;
assertion.status = AssertionStatus.Pending;
return assertion;
}
/**
* @notice Update child properties
*/
function childCreated(
AssertionNode storage self
) internal {
if (self.firstChildBlock == 0) {
self.firstChildBlock = uint64(block.number);
} else if (self.secondChildBlock == 0) {
self.secondChildBlock = uint64(block.number);
}
}
function requireExists(
AssertionNode memory self
) internal pure {
require(self.status != AssertionStatus.NoAssertion, "ASSERTION_NOT_EXIST");
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "../state/GlobalState.sol";
import "../state/Machine.sol";
import "../osp/IOneStepProofEntry.sol";
struct AssertionState {
GlobalState globalState;
MachineStatus machineStatus;
bytes32 endHistoryRoot;
}
library AssertionStateLib {
function toExecutionState(
AssertionState memory state
) internal pure returns (ExecutionState memory) {
return ExecutionState(state.globalState, state.machineStatus);
}
function hash(
AssertionState memory state
) internal pure returns (bytes32) {
return keccak256(abi.encode(state));
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./Assertion.sol";
import "../bridge/IBridge.sol";
import "../bridge/IOutbox.sol";
import "../bridge/IInboxBase.sol";
import "./IRollupEventInbox.sol";
import "../challengeV2/IEdgeChallengeManager.sol";
import "../challengeV2/IAssertionChain.sol";
interface IRollupCore is IAssertionChain {
struct Staker {
uint256 amountStaked;
bytes32 latestStakedAssertion;
uint64 index;
bool isStaked;
address withdrawalAddress;
}
event RollupInitialized(bytes32 machineHash, uint256 chainId);
event AssertionCreated(
bytes32 indexed assertionHash,
bytes32 indexed parentAssertionHash,
AssertionInputs assertion,
bytes32 afterInboxBatchAcc,
uint256 inboxMaxCount,
bytes32 wasmModuleRoot,
uint256 requiredStake,
address challengeManager,
uint64 confirmPeriodBlocks
);
event AssertionConfirmed(bytes32 indexed assertionHash, bytes32 blockHash, bytes32 sendRoot);
event RollupChallengeStarted(
uint64 indexed challengeIndex,
address asserter,
address challenger,
uint64 challengedAssertion
);
event UserStakeUpdated(
address indexed user,
address indexed withdrawalAddress,
uint256 initialBalance,
uint256 finalBalance
);
event UserWithdrawableFundsUpdated(
address indexed user, uint256 initialBalance, uint256 finalBalance
);
function confirmPeriodBlocks() external view returns (uint64);
function validatorAfkBlocks() external view returns (uint64);
function chainId() external view returns (uint256);
function baseStake() external view returns (uint256);
function wasmModuleRoot() external view returns (bytes32);
function bridge() external view returns (IBridge);
function sequencerInbox() external view returns (ISequencerInbox);
function outbox() external view returns (IOutbox);
function rollupEventInbox() external view returns (IRollupEventInbox);
function challengeManager() external view returns (IEdgeChallengeManager);
function loserStakeEscrow() external view returns (address);
function stakeToken() external view returns (address);
function minimumAssertionPeriod() external view returns (uint256);
function genesisAssertionHash() external pure returns (bytes32);
/**
* @notice Get the Assertion for the given id.
*/
function getAssertion(
bytes32 assertionHash
) external view returns (AssertionNode memory);
/**
* @notice Returns the block in which the given assertion was created for looking up its creation event.
* Unlike the assertion's createdAtBlock field, this will be the ArbSys blockNumber if the host chain is an Arbitrum chain.
* That means that the block number returned for this is usable for event queries.
* This function will revert if the given assertion hash does not exist.
* @dev This function is meant for internal use only and has no stability guarantees.
*/
function getAssertionCreationBlockForLogLookup(
bytes32 assertionHash
) external view returns (uint256);
/**
* @notice Get the address of the staker at the given index
* @param stakerNum Index of the staker
* @return Address of the staker
*/
function getStakerAddress(
uint64 stakerNum
) external view returns (address);
/**
* @notice Check whether the given staker is staked
* @param staker Staker address to check
* @return True or False for whether the staker was staked
*/
function isStaked(
address staker
) external view returns (bool);
/**
* @notice Get the latest staked assertion of the given staker
* @param staker Staker address to lookup
* @return Latest assertion staked of the staker
*/
function latestStakedAssertion(
address staker
) external view returns (bytes32);
/**
* @notice Get the amount staked of the given staker
* @param staker Staker address to lookup
* @return Amount staked of the staker
*/
function amountStaked(
address staker
) external view returns (uint256);
/**
* @notice Get the withdrawal address of the given staker
* @param staker Staker address to lookup
* @return Withdrawal address of the staker
*/
function withdrawalAddress(
address staker
) external view returns (address);
/**
* @notice Retrieves stored information about a requested staker
* @param staker Staker address to retrieve
* @return A structure with information about the requested staker
*/
function getStaker(
address staker
) external view returns (Staker memory);
/**
* @notice Get the amount of funds withdrawable by the given address
* @param owner Address to check the funds of
* @return Amount of funds withdrawable by owner
*/
function withdrawableFunds(
address owner
) external view returns (uint256);
/// @return Hash of the latest confirmed assertion
function latestConfirmed() external view returns (bytes32);
/// @return Number of active stakers currently staked
function stakerCount() external view returns (uint64);
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "../bridge/IBridge.sol";
interface IRollupEventInbox {
function bridge() external view returns (IBridge);
function initialize(
IBridge _bridge
) external;
function rollup() external view returns (address);
function updateRollupAddress() external;
function rollupInitialized(uint256 chainId, string calldata chainConfig) external;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./IRollupCore.sol";
import "../bridge/ISequencerInbox.sol";
import "../bridge/IOutbox.sol";
import "../bridge/IOwnable.sol";
interface IRollupUser is IRollupCore, IOwnable {
/// @dev the user logic just validated configuration and shouldn't write to state during init
/// this allows the admin logic to ensure consistency on parameters.
function initialize(
address stakeToken
) external view;
function removeWhitelistAfterFork() external;
function removeWhitelistAfterValidatorAfk() external;
function confirmAssertion(
bytes32 assertionHash,
bytes32 prevAssertionHash,
AssertionState calldata confirmState,
bytes32 winningEdgeId,
ConfigData calldata prevConfig,
bytes32 inboxAcc
) external;
function stakeOnNewAssertion(
AssertionInputs calldata assertion,
bytes32 expectedAssertionHash
) external;
function returnOldDeposit() external;
function returnOldDepositFor(
address stakerAddress
) external;
function reduceDeposit(
uint256 target
) external;
function withdrawStakerFunds() external returns (uint256);
function newStakeOnNewAssertion(
uint256 tokenAmount,
AssertionInputs calldata assertion,
bytes32 expectedAssertionHash
) external;
function newStakeOnNewAssertion(
uint256 tokenAmount,
AssertionInputs calldata assertion,
bytes32 expectedAssertionHash,
address withdrawalAddress
) external;
function newStake(uint256 tokenAmount, address withdrawalAddress) external;
function addToDeposit(
address stakerAddress,
address expectedWithdrawalAddress,
uint256 tokenAmount
) external;
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
struct GlobalState {
bytes32[2] bytes32Vals;
uint64[2] u64Vals;
}
library GlobalStateLib {
using GlobalStateLib for GlobalState;
uint16 internal constant BYTES32_VALS_NUM = 2;
uint16 internal constant U64_VALS_NUM = 2;
function hash(
GlobalState memory state
) internal pure returns (bytes32) {
return keccak256(
abi.encodePacked(
"Global state:",
state.bytes32Vals[0],
state.bytes32Vals[1],
state.u64Vals[0],
state.u64Vals[1]
)
);
}
function getBlockHash(
GlobalState memory state
) internal pure returns (bytes32) {
return state.bytes32Vals[0];
}
function getSendRoot(
GlobalState memory state
) internal pure returns (bytes32) {
return state.bytes32Vals[1];
}
function getInboxPosition(
GlobalState memory state
) internal pure returns (uint64) {
return state.u64Vals[0];
}
function getPositionInMessage(
GlobalState memory state
) internal pure returns (uint64) {
return state.u64Vals[1];
}
function isEmpty(
GlobalState calldata state
) internal pure returns (bool) {
return (
state.bytes32Vals[0] == bytes32(0) && state.bytes32Vals[1] == bytes32(0)
&& state.u64Vals[0] == 0 && state.u64Vals[1] == 0
);
}
function comparePositions(
GlobalState calldata a,
GlobalState calldata b
) internal pure returns (int256) {
uint64 aPos = a.getInboxPosition();
uint64 bPos = b.getInboxPosition();
if (aPos < bPos) {
return -1;
} else if (aPos > bPos) {
return 1;
} else {
uint64 aMsg = a.getPositionInMessage();
uint64 bMsg = b.getPositionInMessage();
if (aMsg < bMsg) {
return -1;
} else if (aMsg > bMsg) {
return 1;
} else {
return 0;
}
}
}
function comparePositionsAgainstStartOfBatch(
GlobalState calldata a,
uint256 bPos
) internal pure returns (int256) {
uint64 aPos = a.getInboxPosition();
if (aPos < bPos) {
return -1;
} else if (aPos > bPos) {
return 1;
} else {
if (a.getPositionInMessage() > 0) {
return 1;
} else {
return 0;
}
}
}
}// Copyright 2021-2023, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
struct Instruction {
uint16 opcode;
uint256 argumentData;
}
library Instructions {
uint16 internal constant UNREACHABLE = 0x00;
uint16 internal constant NOP = 0x01;
uint16 internal constant RETURN = 0x0F;
uint16 internal constant CALL = 0x10;
uint16 internal constant CALL_INDIRECT = 0x11;
uint16 internal constant LOCAL_GET = 0x20;
uint16 internal constant LOCAL_SET = 0x21;
uint16 internal constant GLOBAL_GET = 0x23;
uint16 internal constant GLOBAL_SET = 0x24;
uint16 internal constant I32_LOAD = 0x28;
uint16 internal constant I64_LOAD = 0x29;
uint16 internal constant F32_LOAD = 0x2A;
uint16 internal constant F64_LOAD = 0x2B;
uint16 internal constant I32_LOAD8_S = 0x2C;
uint16 internal constant I32_LOAD8_U = 0x2D;
uint16 internal constant I32_LOAD16_S = 0x2E;
uint16 internal constant I32_LOAD16_U = 0x2F;
uint16 internal constant I64_LOAD8_S = 0x30;
uint16 internal constant I64_LOAD8_U = 0x31;
uint16 internal constant I64_LOAD16_S = 0x32;
uint16 internal constant I64_LOAD16_U = 0x33;
uint16 internal constant I64_LOAD32_S = 0x34;
uint16 internal constant I64_LOAD32_U = 0x35;
uint16 internal constant I32_STORE = 0x36;
uint16 internal constant I64_STORE = 0x37;
uint16 internal constant F32_STORE = 0x38;
uint16 internal constant F64_STORE = 0x39;
uint16 internal constant I32_STORE8 = 0x3A;
uint16 internal constant I32_STORE16 = 0x3B;
uint16 internal constant I64_STORE8 = 0x3C;
uint16 internal constant I64_STORE16 = 0x3D;
uint16 internal constant I64_STORE32 = 0x3E;
uint16 internal constant MEMORY_SIZE = 0x3F;
uint16 internal constant MEMORY_GROW = 0x40;
uint16 internal constant DROP = 0x1A;
uint16 internal constant SELECT = 0x1B;
uint16 internal constant I32_CONST = 0x41;
uint16 internal constant I64_CONST = 0x42;
uint16 internal constant F32_CONST = 0x43;
uint16 internal constant F64_CONST = 0x44;
uint16 internal constant I32_EQZ = 0x45;
uint16 internal constant I32_RELOP_BASE = 0x46;
uint16 internal constant IRELOP_EQ = 0;
uint16 internal constant IRELOP_NE = 1;
uint16 internal constant IRELOP_LT_S = 2;
uint16 internal constant IRELOP_LT_U = 3;
uint16 internal constant IRELOP_GT_S = 4;
uint16 internal constant IRELOP_GT_U = 5;
uint16 internal constant IRELOP_LE_S = 6;
uint16 internal constant IRELOP_LE_U = 7;
uint16 internal constant IRELOP_GE_S = 8;
uint16 internal constant IRELOP_GE_U = 9;
uint16 internal constant IRELOP_LAST = IRELOP_GE_U;
uint16 internal constant I64_EQZ = 0x50;
uint16 internal constant I64_RELOP_BASE = 0x51;
uint16 internal constant I32_UNOP_BASE = 0x67;
uint16 internal constant IUNOP_CLZ = 0;
uint16 internal constant IUNOP_CTZ = 1;
uint16 internal constant IUNOP_POPCNT = 2;
uint16 internal constant IUNOP_LAST = IUNOP_POPCNT;
uint16 internal constant I32_ADD = 0x6A;
uint16 internal constant I32_SUB = 0x6B;
uint16 internal constant I32_MUL = 0x6C;
uint16 internal constant I32_DIV_S = 0x6D;
uint16 internal constant I32_DIV_U = 0x6E;
uint16 internal constant I32_REM_S = 0x6F;
uint16 internal constant I32_REM_U = 0x70;
uint16 internal constant I32_AND = 0x71;
uint16 internal constant I32_OR = 0x72;
uint16 internal constant I32_XOR = 0x73;
uint16 internal constant I32_SHL = 0x74;
uint16 internal constant I32_SHR_S = 0x75;
uint16 internal constant I32_SHR_U = 0x76;
uint16 internal constant I32_ROTL = 0x77;
uint16 internal constant I32_ROTR = 0x78;
uint16 internal constant I64_UNOP_BASE = 0x79;
uint16 internal constant I64_ADD = 0x7C;
uint16 internal constant I64_SUB = 0x7D;
uint16 internal constant I64_MUL = 0x7E;
uint16 internal constant I64_DIV_S = 0x7F;
uint16 internal constant I64_DIV_U = 0x80;
uint16 internal constant I64_REM_S = 0x81;
uint16 internal constant I64_REM_U = 0x82;
uint16 internal constant I64_AND = 0x83;
uint16 internal constant I64_OR = 0x84;
uint16 internal constant I64_XOR = 0x85;
uint16 internal constant I64_SHL = 0x86;
uint16 internal constant I64_SHR_S = 0x87;
uint16 internal constant I64_SHR_U = 0x88;
uint16 internal constant I64_ROTL = 0x89;
uint16 internal constant I64_ROTR = 0x8A;
uint16 internal constant I32_WRAP_I64 = 0xA7;
uint16 internal constant I64_EXTEND_I32_S = 0xAC;
uint16 internal constant I64_EXTEND_I32_U = 0xAD;
uint16 internal constant I32_REINTERPRET_F32 = 0xBC;
uint16 internal constant I64_REINTERPRET_F64 = 0xBD;
uint16 internal constant F32_REINTERPRET_I32 = 0xBE;
uint16 internal constant F64_REINTERPRET_I64 = 0xBF;
uint16 internal constant I32_EXTEND_8S = 0xC0;
uint16 internal constant I32_EXTEND_16S = 0xC1;
uint16 internal constant I64_EXTEND_8S = 0xC2;
uint16 internal constant I64_EXTEND_16S = 0xC3;
uint16 internal constant I64_EXTEND_32S = 0xC4;
uint16 internal constant INIT_FRAME = 0x8002;
uint16 internal constant ARBITRARY_JUMP = 0x8003;
uint16 internal constant ARBITRARY_JUMP_IF = 0x8004;
uint16 internal constant MOVE_FROM_STACK_TO_INTERNAL = 0x8005;
uint16 internal constant MOVE_FROM_INTERNAL_TO_STACK = 0x8006;
uint16 internal constant DUP = 0x8008;
uint16 internal constant CROSS_MODULE_CALL = 0x8009;
uint16 internal constant CALLER_MODULE_INTERNAL_CALL = 0x800A;
uint16 internal constant CROSS_MODULE_FORWARD = 0x800B;
uint16 internal constant CROSS_MODULE_INTERNAL_CALL = 0x800C;
uint16 internal constant GET_GLOBAL_STATE_BYTES32 = 0x8010;
uint16 internal constant SET_GLOBAL_STATE_BYTES32 = 0x8011;
uint16 internal constant GET_GLOBAL_STATE_U64 = 0x8012;
uint16 internal constant SET_GLOBAL_STATE_U64 = 0x8013;
uint16 internal constant READ_PRE_IMAGE = 0x8020;
uint16 internal constant READ_INBOX_MESSAGE = 0x8021;
uint16 internal constant HALT_AND_SET_FINISHED = 0x8022;
uint16 internal constant LINK_MODULE = 0x8023;
uint16 internal constant UNLINK_MODULE = 0x8024;
uint16 internal constant NEW_COTHREAD = 0x8030;
uint16 internal constant POP_COTHREAD = 0x8031;
uint16 internal constant SWITCH_COTHREAD = 0x8032;
uint256 internal constant INBOX_INDEX_SEQUENCER = 0;
uint256 internal constant INBOX_INDEX_DELAYED = 1;
function hash(
Instruction[] memory code
) internal pure returns (bytes32) {
// To avoid quadratic expense, we declare a `bytes` early and populate its contents.
bytes memory data = new bytes(13 + 1 + 34 * code.length);
assembly {
// Represents the string "Instructions:", which we place after the length word.
mstore(
add(data, 32), 0x496e737472756374696f6e733a00000000000000000000000000000000000000
)
}
// write the instruction count
uint256 offset = 13;
data[offset] = bytes1(uint8(code.length));
offset++;
// write each instruction
for (uint256 i = 0; i < code.length; i++) {
Instruction memory inst = code[i];
data[offset] = bytes1(uint8(inst.opcode >> 8));
data[offset + 1] = bytes1(uint8(inst.opcode));
offset += 2;
uint256 argumentData = inst.argumentData;
assembly {
mstore(add(add(data, 32), offset), argumentData)
}
offset += 32;
}
return keccak256(data);
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./ValueStack.sol";
import "./Instructions.sol";
import "./MultiStack.sol";
import "./StackFrame.sol";
enum MachineStatus {
RUNNING,
FINISHED,
ERRORED
}
struct Machine {
MachineStatus status;
ValueStack valueStack;
MultiStack valueMultiStack;
ValueStack internalStack;
StackFrameWindow frameStack;
MultiStack frameMultiStack;
bytes32 globalStateHash;
uint32 moduleIdx;
uint32 functionIdx;
uint32 functionPc;
bytes32 recoveryPc;
bytes32 modulesRoot;
}
library MachineLib {
using StackFrameLib for StackFrameWindow;
using ValueStackLib for ValueStack;
using MultiStackLib for MultiStack;
bytes32 internal constant NO_RECOVERY_PC = ~bytes32(0);
function hash(
Machine memory mach
) internal pure returns (bytes32) {
// Warning: the non-running hashes are replicated in Challenge
if (mach.status == MachineStatus.RUNNING) {
bytes32 valueMultiHash =
mach.valueMultiStack.hash(mach.valueStack.hash(), mach.recoveryPc != NO_RECOVERY_PC);
bytes32 frameMultiHash =
mach.frameMultiStack.hash(mach.frameStack.hash(), mach.recoveryPc != NO_RECOVERY_PC);
bytes memory preimage = abi.encodePacked(
"Machine running:",
valueMultiHash,
mach.internalStack.hash(),
frameMultiHash,
mach.globalStateHash,
mach.moduleIdx,
mach.functionIdx,
mach.functionPc,
mach.recoveryPc,
mach.modulesRoot
);
return keccak256(preimage);
} else if (mach.status == MachineStatus.FINISHED) {
return keccak256(abi.encodePacked("Machine finished:", mach.globalStateHash));
} else if (mach.status == MachineStatus.ERRORED) {
return keccak256(abi.encodePacked("Machine errored:", mach.globalStateHash));
} else {
revert("BAD_MACH_STATUS");
}
}
function switchCoThreadStacks(
Machine memory mach
) internal pure {
bytes32 newActiveValue = mach.valueMultiStack.inactiveStackHash;
bytes32 newActiveFrame = mach.frameMultiStack.inactiveStackHash;
if (
newActiveFrame == MultiStackLib.NO_STACK_HASH
|| newActiveValue == MultiStackLib.NO_STACK_HASH
) {
mach.status = MachineStatus.ERRORED;
return;
}
mach.frameMultiStack.inactiveStackHash = mach.frameStack.hash();
mach.valueMultiStack.inactiveStackHash = mach.valueStack.hash();
mach.frameStack.overwrite(newActiveFrame);
mach.valueStack.overwrite(newActiveValue);
}
function setPcFromData(Machine memory mach, uint256 data) internal pure returns (bool) {
if (data >> 96 != 0) {
return false;
}
mach.functionPc = uint32(data);
mach.functionIdx = uint32(data >> 32);
mach.moduleIdx = uint32(data >> 64);
return true;
}
function setPcFromRecovery(
Machine memory mach
) internal pure returns (bool) {
if (!setPcFromData(mach, uint256(mach.recoveryPc))) {
return false;
}
mach.recoveryPc = NO_RECOVERY_PC;
return true;
}
function setRecoveryFromPc(Machine memory mach, uint32 offset) internal pure returns (bool) {
if (mach.recoveryPc != NO_RECOVERY_PC) {
return false;
}
uint256 result;
result = uint256(mach.moduleIdx) << 64;
result = result | (uint256(mach.functionIdx) << 32);
result = result | uint256(mach.functionPc + offset - 1);
mach.recoveryPc = bytes32(result);
return true;
}
function setPc(Machine memory mach, Value memory pc) internal pure {
if (pc.valueType == ValueType.REF_NULL) {
mach.status = MachineStatus.ERRORED;
return;
}
if (pc.valueType != ValueType.INTERNAL_REF) {
mach.status = MachineStatus.ERRORED;
return;
}
if (!setPcFromData(mach, pc.contents)) {
mach.status = MachineStatus.ERRORED;
return;
}
}
}// Copyright 2021-2023, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./ModuleMemoryCompact.sol";
struct Module {
bytes32 globalsMerkleRoot;
ModuleMemory moduleMemory;
bytes32 tablesMerkleRoot;
bytes32 functionsMerkleRoot;
bytes32 extraHash;
uint32 internalsOffset;
}
library ModuleLib {
using ModuleMemoryCompactLib for ModuleMemory;
function hash(
Module memory mod
) internal pure returns (bytes32) {
return keccak256(
abi.encodePacked(
"Module:",
mod.globalsMerkleRoot,
mod.moduleMemory.hash(),
mod.tablesMerkleRoot,
mod.functionsMerkleRoot,
mod.extraHash,
mod.internalsOffset
)
);
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
struct ModuleMemory {
uint64 size;
uint64 maxSize;
bytes32 merkleRoot;
}
library ModuleMemoryCompactLib {
function hash(
ModuleMemory memory mem
) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("Memory:", mem.size, mem.maxSize, mem.merkleRoot));
}
}// Copyright 2021-2024, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
struct MultiStack {
bytes32 inactiveStackHash; // NO_STACK_HASH if no stack, 0 if empty stack
bytes32 remainingHash; // 0 if less than 2 cothreads exist
}
library MultiStackLib {
bytes32 internal constant NO_STACK_HASH = ~bytes32(0);
function hash(
MultiStack memory multi,
bytes32 activeStackHash,
bool cothread
) internal pure returns (bytes32) {
require(activeStackHash != NO_STACK_HASH, "MULTISTACK_NOSTACK_ACTIVE");
if (cothread) {
require(multi.inactiveStackHash != NO_STACK_HASH, "MULTISTACK_NOSTACK_MAIN");
return keccak256(
abi.encodePacked(
"multistack:", multi.inactiveStackHash, activeStackHash, multi.remainingHash
)
);
} else {
return keccak256(
abi.encodePacked(
"multistack:", activeStackHash, multi.inactiveStackHash, multi.remainingHash
)
);
}
}
function setEmpty(
MultiStack memory multi
) internal pure {
multi.inactiveStackHash = NO_STACK_HASH;
multi.remainingHash = 0;
}
function pushNew(
MultiStack memory multi
) internal pure {
if (multi.inactiveStackHash != NO_STACK_HASH) {
multi.remainingHash = keccak256(
abi.encodePacked("cothread:", multi.inactiveStackHash, multi.remainingHash)
);
}
multi.inactiveStackHash = 0;
}
}// Copyright 2021-2023, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./Value.sol";
struct StackFrame {
Value returnPc;
bytes32 localsMerkleRoot;
uint32 callerModule;
uint32 callerModuleInternals;
}
struct StackFrameWindow {
StackFrame[] proved;
bytes32 remainingHash;
}
library StackFrameLib {
using ValueLib for Value;
function hash(
StackFrame memory frame
) internal pure returns (bytes32) {
return keccak256(
abi.encodePacked(
"Stack frame:",
frame.returnPc.hash(),
frame.localsMerkleRoot,
frame.callerModule,
frame.callerModuleInternals
)
);
}
function hash(
StackFrameWindow memory window
) internal pure returns (bytes32 h) {
h = window.remainingHash;
for (uint256 i = 0; i < window.proved.length; i++) {
h = keccak256(abi.encodePacked("Stack frame stack:", hash(window.proved[i]), h));
}
}
function peek(
StackFrameWindow memory window
) internal pure returns (StackFrame memory) {
require(window.proved.length == 1, "BAD_WINDOW_LENGTH");
return window.proved[0];
}
function pop(
StackFrameWindow memory window
) internal pure returns (StackFrame memory frame) {
require(window.proved.length == 1, "BAD_WINDOW_LENGTH");
frame = window.proved[0];
window.proved = new StackFrame[](0);
}
function push(StackFrameWindow memory window, StackFrame memory frame) internal pure {
StackFrame[] memory newProved = new StackFrame[](window.proved.length + 1);
for (uint256 i = 0; i < window.proved.length; i++) {
newProved[i] = window.proved[i];
}
newProved[window.proved.length] = frame;
window.proved = newProved;
}
function overwrite(StackFrameWindow memory window, bytes32 root) internal pure {
window.remainingHash = root;
delete window.proved;
}
}// Copyright 2021-2023, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
enum ValueType {
I32,
I64,
F32,
F64,
REF_NULL,
FUNC_REF,
INTERNAL_REF
}
struct Value {
ValueType valueType;
uint256 contents;
}
library ValueLib {
function hash(
Value memory val
) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("Value:", val.valueType, val.contents));
}
function maxValueType() internal pure returns (ValueType) {
return ValueType.INTERNAL_REF;
}
function assumeI32(
Value memory val
) internal pure returns (uint32) {
uint256 uintval = uint256(val.contents);
require(val.valueType == ValueType.I32, "NOT_I32");
require(uintval < (1 << 32), "BAD_I32");
return uint32(uintval);
}
function assumeI64(
Value memory val
) internal pure returns (uint64) {
uint256 uintval = uint256(val.contents);
require(val.valueType == ValueType.I64, "NOT_I64");
require(uintval < (1 << 64), "BAD_I64");
return uint64(uintval);
}
function newRefNull() internal pure returns (Value memory) {
return Value({valueType: ValueType.REF_NULL, contents: 0});
}
function newI32(
uint32 x
) internal pure returns (Value memory) {
return Value({valueType: ValueType.I32, contents: uint256(x)});
}
function newI64(
uint64 x
) internal pure returns (Value memory) {
return Value({valueType: ValueType.I64, contents: uint256(x)});
}
function newBoolean(
bool x
) internal pure returns (Value memory) {
if (x) {
return newI32(uint32(1));
} else {
return newI32(uint32(0));
}
}
function newPc(
uint32 funcPc,
uint32 func,
uint32 module
) internal pure returns (Value memory) {
uint256 data = 0;
data |= funcPc;
data |= uint256(func) << 32;
data |= uint256(module) << 64;
return Value({valueType: ValueType.INTERNAL_REF, contents: data});
}
}// Copyright 2021-2022, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./Value.sol";
struct ValueArray {
Value[] inner;
}
library ValueArrayLib {
function get(ValueArray memory arr, uint256 index) internal pure returns (Value memory) {
return arr.inner[index];
}
function set(ValueArray memory arr, uint256 index, Value memory val) internal pure {
arr.inner[index] = val;
}
function length(
ValueArray memory arr
) internal pure returns (uint256) {
return arr.inner.length;
}
function push(ValueArray memory arr, Value memory val) internal pure {
Value[] memory newInner = new Value[](arr.inner.length + 1);
for (uint256 i = 0; i < arr.inner.length; i++) {
newInner[i] = arr.inner[i];
}
newInner[arr.inner.length] = val;
arr.inner = newInner;
}
function pop(
ValueArray memory arr
) internal pure returns (Value memory popped) {
popped = arr.inner[arr.inner.length - 1];
Value[] memory newInner = new Value[](arr.inner.length - 1);
for (uint256 i = 0; i < newInner.length; i++) {
newInner[i] = arr.inner[i];
}
arr.inner = newInner;
}
}// Copyright 2021-2023, Offchain Labs, Inc.
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import "./Value.sol";
import "./ValueArray.sol";
struct ValueStack {
ValueArray proved;
bytes32 remainingHash;
}
library ValueStackLib {
using ValueLib for Value;
using ValueArrayLib for ValueArray;
function hash(
ValueStack memory stack
) internal pure returns (bytes32 h) {
h = stack.remainingHash;
uint256 len = stack.proved.length();
for (uint256 i = 0; i < len; i++) {
h = keccak256(abi.encodePacked("Value stack:", stack.proved.get(i).hash(), h));
}
}
function peek(
ValueStack memory stack
) internal pure returns (Value memory) {
uint256 len = stack.proved.length();
return stack.proved.get(len - 1);
}
function pop(
ValueStack memory stack
) internal pure returns (Value memory) {
return stack.proved.pop();
}
function push(ValueStack memory stack, Value memory val) internal pure {
return stack.proved.push(val);
}
function overwrite(ValueStack memory stack, bytes32 root) internal pure {
stack.remainingHash = root;
delete stack.proved;
}
}{
"optimizer": {
"enabled": true,
"runs": 2000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"_maxDataSize","type":"uint256"},{"internalType":"contract IReader4844","name":"reader4844_","type":"address"},{"internalType":"bool","name":"_isUsingFeeToken","type":"bool"},{"internalType":"bool","name":"_isDelayBufferable","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInit","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"AlreadyValidDASKeyset","type":"error"},{"inputs":[],"name":"BadBufferConfig","type":"error"},{"inputs":[],"name":"BadMaxTimeVariation","type":"error"},{"inputs":[{"internalType":"uint256","name":"stored","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"name":"BadSequencerNumber","type":"error"},{"inputs":[],"name":"CannotSetFeeTokenPricer","type":"error"},{"inputs":[],"name":"DataBlobsNotSupported","type":"error"},{"inputs":[{"internalType":"uint256","name":"dataLength","type":"uint256"},{"internalType":"uint256","name":"maxDataLength","type":"uint256"}],"name":"DataTooLarge","type":"error"},{"inputs":[],"name":"DelayProofRequired","type":"error"},{"inputs":[],"name":"DelayedBackwards","type":"error"},{"inputs":[],"name":"DelayedTooFar","type":"error"},{"inputs":[],"name":"Deprecated","type":"error"},{"inputs":[],"name":"ExtraGasNotUint64","type":"error"},{"inputs":[],"name":"ForceIncludeBlockTooSoon","type":"error"},{"inputs":[],"name":"HadZeroInit","type":"error"},{"inputs":[],"name":"IncorrectMessagePreimage","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"InitParamZero","type":"error"},{"inputs":[],"name":"InvalidDelayedAccPreimage","type":"error"},{"inputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"name":"InvalidHeaderFlag","type":"error"},{"inputs":[],"name":"KeysetTooLarge","type":"error"},{"inputs":[],"name":"MissingDataHashes","type":"error"},{"inputs":[],"name":"NativeTokenMismatch","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"NoSuchKeyset","type":"error"},{"inputs":[],"name":"NotBatchPoster","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"NotBatchPosterManager","type":"error"},{"inputs":[],"name":"NotCodelessOrigin","type":"error"},{"inputs":[],"name":"NotDelayBufferable","type":"error"},{"inputs":[],"name":"NotForked","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"NotOwner","type":"error"},{"inputs":[],"name":"RollupNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newBatchPosterManager","type":"address"}],"name":"BatchPosterManagerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"batchPoster","type":"address"},{"indexed":false,"internalType":"bool","name":"isBatchPoster","type":"bool"}],"name":"BatchPosterSet","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint64","name":"threshold","type":"uint64"},{"internalType":"uint64","name":"max","type":"uint64"},{"internalType":"uint64","name":"replenishRateInBasis","type":"uint64"}],"indexed":false,"internalType":"struct BufferConfig","name":"bufferConfig","type":"tuple"}],"name":"BufferConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeTokenPricer","type":"address"}],"name":"FeeTokenPricerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"messageNum","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"InboxMessageDelivered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"messageNum","type":"uint256"}],"name":"InboxMessageDeliveredFromOrigin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"keysetHash","type":"bytes32"}],"name":"InvalidateKeyset","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"delayBlocks","type":"uint256"},{"internalType":"uint256","name":"futureBlocks","type":"uint256"},{"internalType":"uint256","name":"delaySeconds","type":"uint256"},{"internalType":"uint256","name":"futureSeconds","type":"uint256"}],"indexed":false,"internalType":"struct ISequencerInbox.MaxTimeVariation","name":"maxTimeVariation","type":"tuple"}],"name":"MaxTimeVariationSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"OwnerFunctionCalled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchSequenceNumber","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"SequencerBatchData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"batchSequenceNumber","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"beforeAcc","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"afterAcc","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"delayedAcc","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"components":[{"internalType":"uint64","name":"minTimestamp","type":"uint64"},{"internalType":"uint64","name":"maxTimestamp","type":"uint64"},{"internalType":"uint64","name":"minBlockNumber","type":"uint64"},{"internalType":"uint64","name":"maxBlockNumber","type":"uint64"}],"indexed":false,"internalType":"struct IBridge.TimeBounds","name":"timeBounds","type":"tuple"},{"indexed":false,"internalType":"enum IBridge.BatchDataLocation","name":"dataLocation","type":"uint8"}],"name":"SequencerBatchDelivered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bool","name":"isSequencer","type":"bool"}],"name":"SequencerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"keysetHash","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"keysetBytes","type":"bytes"}],"name":"SetValidKeyset","type":"event"},{"inputs":[],"name":"BROTLI_MESSAGE_HEADER_FLAG","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAS_MESSAGE_HEADER_FLAG","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DATA_AUTHENTICATED_FLAG","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DATA_BLOB_HEADER_FLAG","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HEADER_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREE_DAS_MESSAGE_HEADER_FLAG","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZERO_HEAVY_MESSAGE_HEADER_FLAG","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sequenceNumber","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"internalType":"contract IGasRefunder","name":"gasRefunder","type":"address"},{"internalType":"uint256","name":"prevMessageCount","type":"uint256"},{"internalType":"uint256","name":"newMessageCount","type":"uint256"}],"name":"addSequencerL2Batch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sequenceNumber","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"internalType":"contract IGasRefunder","name":"gasRefunder","type":"address"},{"internalType":"uint256","name":"prevMessageCount","type":"uint256"},{"internalType":"uint256","name":"newMessageCount","type":"uint256"},{"components":[{"internalType":"bytes32","name":"beforeDelayedAcc","type":"bytes32"},{"components":[{"internalType":"uint8","name":"kind","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint64","name":"blockNumber","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint256","name":"inboxSeqNum","type":"uint256"},{"internalType":"uint256","name":"baseFeeL1","type":"uint256"},{"internalType":"bytes32","name":"messageDataHash","type":"bytes32"}],"internalType":"struct Messages.Message","name":"delayedMessage","type":"tuple"}],"internalType":"struct DelayProof","name":"delayProof","type":"tuple"}],"name":"addSequencerL2BatchDelayProof","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sequenceNumber","type":"uint256"},{"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"internalType":"contract IGasRefunder","name":"gasRefunder","type":"address"},{"internalType":"uint256","name":"prevMessageCount","type":"uint256"},{"internalType":"uint256","name":"newMessageCount","type":"uint256"}],"name":"addSequencerL2BatchFromBlobs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sequenceNumber","type":"uint256"},{"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"internalType":"contract IGasRefunder","name":"gasRefunder","type":"address"},{"internalType":"uint256","name":"prevMessageCount","type":"uint256"},{"internalType":"uint256","name":"newMessageCount","type":"uint256"},{"components":[{"internalType":"bytes32","name":"beforeDelayedAcc","type":"bytes32"},{"components":[{"internalType":"uint8","name":"kind","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint64","name":"blockNumber","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint256","name":"inboxSeqNum","type":"uint256"},{"internalType":"uint256","name":"baseFeeL1","type":"uint256"},{"internalType":"bytes32","name":"messageDataHash","type":"bytes32"}],"internalType":"struct Messages.Message","name":"delayedMessage","type":"tuple"}],"internalType":"struct DelayProof","name":"delayProof","type":"tuple"}],"name":"addSequencerL2BatchFromBlobsDelayProof","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"contract IGasRefunder","name":"","type":"address"}],"name":"addSequencerL2BatchFromOrigin","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"sequenceNumber","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"internalType":"contract IGasRefunder","name":"gasRefunder","type":"address"},{"internalType":"uint256","name":"prevMessageCount","type":"uint256"},{"internalType":"uint256","name":"newMessageCount","type":"uint256"}],"name":"addSequencerL2BatchFromOrigin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"sequenceNumber","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"afterDelayedMessagesRead","type":"uint256"},{"internalType":"contract IGasRefunder","name":"gasRefunder","type":"address"},{"internalType":"uint256","name":"prevMessageCount","type":"uint256"},{"internalType":"uint256","name":"newMessageCount","type":"uint256"},{"components":[{"internalType":"bytes32","name":"beforeDelayedAcc","type":"bytes32"},{"components":[{"internalType":"uint8","name":"kind","type":"uint8"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint64","name":"blockNumber","type":"uint64"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint256","name":"inboxSeqNum","type":"uint256"},{"internalType":"uint256","name":"baseFeeL1","type":"uint256"},{"internalType":"bytes32","name":"messageDataHash","type":"bytes32"}],"internalType":"struct Messages.Message","name":"delayedMessage","type":"tuple"}],"internalType":"struct DelayProof","name":"delayProof","type":"tuple"}],"name":"addSequencerL2BatchFromOriginDelayProof","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"batchCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"batchPosterManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"contract IBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buffer","outputs":[{"internalType":"uint64","name":"bufferBlocks","type":"uint64"},{"internalType":"uint64","name":"max","type":"uint64"},{"internalType":"uint64","name":"threshold","type":"uint64"},{"internalType":"uint64","name":"prevBlockNumber","type":"uint64"},{"internalType":"uint64","name":"replenishRateInBasis","type":"uint64"},{"internalType":"uint64","name":"prevSequencedBlockNumber","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"dasKeySetInfo","outputs":[{"internalType":"bool","name":"isValidKeyset","type":"bool"},{"internalType":"uint64","name":"creationBlock","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeTokenPricer","outputs":[{"internalType":"contract IFeeTokenPricer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalDelayedMessagesRead","type":"uint256"},{"internalType":"uint8","name":"kind","type":"uint8"},{"internalType":"uint64[2]","name":"l1BlockAndTime","type":"uint64[2]"},{"internalType":"uint256","name":"baseFeeL1","type":"uint256"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes32","name":"messageDataHash","type":"bytes32"}],"name":"forceInclusion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"blockNumber","type":"uint64"}],"name":"forceInclusionDeadline","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"ksHash","type":"bytes32"}],"name":"getKeysetCreationBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"inboxAccs","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBridge","name":"bridge_","type":"address"},{"components":[{"internalType":"uint256","name":"delayBlocks","type":"uint256"},{"internalType":"uint256","name":"futureBlocks","type":"uint256"},{"internalType":"uint256","name":"delaySeconds","type":"uint256"},{"internalType":"uint256","name":"futureSeconds","type":"uint256"}],"internalType":"struct ISequencerInbox.MaxTimeVariation","name":"maxTimeVariation_","type":"tuple"},{"components":[{"internalType":"uint64","name":"threshold","type":"uint64"},{"internalType":"uint64","name":"max","type":"uint64"},{"internalType":"uint64","name":"replenishRateInBasis","type":"uint64"}],"internalType":"struct BufferConfig","name":"bufferConfig_","type":"tuple"},{"internalType":"contract IFeeTokenPricer","name":"feeTokenPricer_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"ksHash","type":"bytes32"}],"name":"invalidateKeysetHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isBatchPoster","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isDelayBufferable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isSequencer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isUsingFeeToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"ksHash","type":"bytes32"}],"name":"isValidKeysetHash","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDataSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTimeVariation","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"threshold","type":"uint64"},{"internalType":"uint64","name":"max","type":"uint64"},{"internalType":"uint64","name":"replenishRateInBasis","type":"uint64"}],"internalType":"struct BufferConfig","name":"bufferConfig_","type":"tuple"}],"name":"postUpgradeInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reader4844","outputs":[{"internalType":"contract IReader4844","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeDelayAfterFork","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rollup","outputs":[{"internalType":"contract IOwnable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newBatchPosterManager","type":"address"}],"name":"setBatchPosterManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"threshold","type":"uint64"},{"internalType":"uint64","name":"max","type":"uint64"},{"internalType":"uint64","name":"replenishRateInBasis","type":"uint64"}],"internalType":"struct BufferConfig","name":"bufferConfig_","type":"tuple"}],"name":"setBufferConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFeeTokenPricer","name":"feeTokenPricer_","type":"address"}],"name":"setFeeTokenPricer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"isBatchPoster_","type":"bool"}],"name":"setIsBatchPoster","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"isSequencer_","type":"bool"}],"name":"setIsSequencer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"delayBlocks","type":"uint256"},{"internalType":"uint256","name":"futureBlocks","type":"uint256"},{"internalType":"uint256","name":"delaySeconds","type":"uint256"},{"internalType":"uint256","name":"futureSeconds","type":"uint256"}],"internalType":"struct ISequencerInbox.MaxTimeVariation","name":"maxTimeVariation_","type":"tuple"}],"name":"setMaxTimeVariation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"keysetBytes","type":"bytes"}],"name":"setValidKeyset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalDelayedMessagesRead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updateRollupAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
610180604052306080526202000060a05246610100526200002b62000109602090811b6200315417901c565b1515610120523480156200003e57600080fd5b50604051620058b9380380620058b98339810160408190526200006191620001bc565b60e084905261012051156200009f576001600160a01b0383161562000099576040516386657a5360e01b815260040160405180910390fd5b620000e8565b6001600160a01b038316620000e8576040516380fc2c0360e01b815260206004820152600a60248201526914995859195c8d0e0d0d60b21b604482015260640160405180910390fd5b6001600160a01b0390921660c052151561014052151561016052506200024f565b60408051600481526024810182526020810180516001600160e01b03166302881c7960e11b1790529051600091829182916064916200014991906200021e565b600060405180830381855afa9150503d806000811462000186576040519150601f19603f3d011682016040523d82523d6000602084013e6200018b565b606091505b50915091508180156200019f575080516020145b9250505090565b80518015158114620001b757600080fd5b919050565b60008060008060808587031215620001d357600080fd5b845160208601519094506001600160a01b0381168114620001f357600080fd5b92506200020360408601620001a6565b91506200021360608601620001a6565b905092959194509250565b6000825160005b8181101562000241576020818601810151858301520162000225565b506000920191825250919050565b60805160a05160c05160e051610100516101205161014051610160516155476200037260003960008181610478015281816112ca015281816117be01528181611e9a015281816123010152818161268701528181612c9f01528181612e340152818161321c015261345e01526000818161061d0152818161098301528181612546015281816126b60152818161404b0152614172015260008181612a800152818161356a015261408b01526000818161215c01526139d701526000818161074a01528181614439015261448e0152600081816105d001528181610f6801528181611e4301528181613e360152613f1101526000818161114d0152818161148b01528181611d3801526120520152600081816121db015261239901526155476000f3fe608060405234801561001057600080fd5b506004361061030a5760003560e01c80637fa3a40e1161019c578063cc2a1a0c116100ee578063e78cea9211610097578063edaafe2011610071578063edaafe2014610794578063f19815781461081d578063f60a50911461083057600080fd5b8063e78cea9214610732578063e8eb1dc314610745578063ebea461d1461076c57600080fd5b8063dd44e6e0116100c8578063dd44e6e0146106cc578063e0bc9729146106f8578063e5a358c81461070b57600080fd5b8063cc2a1a0c14610693578063d1ce8da8146106a6578063d9dd67ab146106b957600080fd5b806392d9f78211610150578063a84840b71161012a578063a84840b71461065a578063b31761f81461066d578063cb23bcb51461068057600080fd5b806392d9f7821461061857806396cc5c781461063f578063a655d9371461064757600080fd5b80638d910dde116101815780638d910dde146105cb5780638f111f3c146105f2578063917cf8ac1461060557600080fd5b80637fa3a40e146105af57806384420860146105b857600080fd5b80632f3985a7116102605780636d46e987116102095780636f12b0c9116101e35780636f12b0c914610525578063715ea34b1461053857806371c3e6fe1461058c57600080fd5b80636d46e987146104dc5780636e620055146104ff5780636e7df3e71461051257600080fd5b806369cacded1161023a57806369cacded1461049a5780636ae71f12146104ad5780636c890450146104b557600080fd5b80632f3985a71461044d5780633e5aa082146104605780634b678a661461047357600080fd5b80631f956632116102c2578063258f04951161029c578063258f04951461040b57806327957a491461041e5780632cbf74e51461042657600080fd5b80631f956632146103ba5780631ff64790146103cd57806322291e8d146103e057600080fd5b806306f13056116102f357806306f13056146103695780631637be481461037f57806316af91a7146103b257600080fd5b806302c992751461030f578063036f7ed314610354575b600080fd5b6103367f200000000000000000000000000000000000000000000000000000000000000081565b6040516001600160f81b031990911681526020015b60405180910390f35b61036761036236600461496f565b61083b565b005b610371610a65565b60405190815260200161034b565b6103a261038d36600461498c565b60009081526008602052604090205460ff1690565b604051901515815260200161034b565b610336600081565b6103676103c83660046149b3565b610aef565b6103676103db36600461496f565b610c5a565b600e546103f3906001600160a01b031681565b6040516001600160a01b03909116815260200161034b565b61037161041936600461498c565b610dbf565b610371602881565b6103367f500000000000000000000000000000000000000000000000000000000000000081565b61036761045b366004614b0b565b610e2c565b61036761046e366004614b27565b610f65565b6103a27f000000000000000000000000000000000000000000000000000000000000000081565b6103676104a8366004614bd2565b611253565b610367611593565b6103367f080000000000000000000000000000000000000000000000000000000000000081565b6103a26104ea36600461496f565b60096020526000908152604090205460ff1681565b61036761050d366004614bd2565b61176b565b6103676105203660046149b3565b61181d565b610367610533366004614c60565b611988565b61056c61054636600461498c565b60086020526000908152604090205460ff811690610100900467ffffffffffffffff1682565b60408051921515835267ffffffffffffffff90911660208301520161034b565b6103a261059a36600461496f565b60036020526000908152604090205460ff1681565b61037160005481565b6103676105c636600461498c565b6119ba565b6103f37f000000000000000000000000000000000000000000000000000000000000000081565b610367610600366004614ccb565b611b2f565b610367610613366004614d48565b611e40565b6103a27f000000000000000000000000000000000000000000000000000000000000000081565b610367612159565b610367610655366004614b0b565b6121d1565b610367610668366004614da4565b61238f565b61036761067b366004614e0b565b612754565b6002546103f3906001600160a01b031681565b600b546103f3906001600160a01b031681565b6103676106b4366004614e71565b6128b3565b6103716106c736600461498c565b612c00565b6106df6106da366004614eb3565b612c8d565b60405167ffffffffffffffff909116815260200161034b565b610367610706366004614ccb565b612cf0565b6103367f400000000000000000000000000000000000000000000000000000000000000081565b6001546103f3906001600160a01b031681565b6103717f000000000000000000000000000000000000000000000000000000000000000081565b610774612d78565b60408051948552602085019390935291830152606082015260800161034b565b600c54600d546107da9167ffffffffffffffff8082169268010000000000000000808404831693600160801b8104841693600160c01b9091048116928082169290041686565b6040805167ffffffffffffffff978816815295871660208701529386169385019390935290841660608401528316608083015290911660a082015260c00161034b565b61036761082b366004614edf565b612db1565b610336600160ff1b81565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b29190614f47565b6001600160a01b0316336001600160a01b0316146109815760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109379190614f47565b6040517f23295f0e0000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152911660248201526044015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006109d8576040517fe13123b400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fe83d6153add50e41b8ee6c1115c4178687349bb12bc3902a50b1f6ad78a0c5419060200160405180910390a16040516006907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a250565b600154604080517e84120c00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916284120c9160048083019260209291908290030181865afa158015610ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aea9190614f64565b905090565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b669190614f47565b6001600160a01b0316336001600160a01b031614158015610b925750600b546001600160a01b03163314155b15610bcb576040517f660b3b42000000000000000000000000000000000000000000000000000000008152336004820152602401610978565b6001600160a01b038216600081815260096020908152604091829020805460ff19168515159081179091558251938452908301527feb12a9a53eec138c91b27b4f912a257bd690c18fc8bde744be92a0365eb9b87e910160405180910390a16040516004907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a25050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd19190614f47565b6001600160a01b0316336001600160a01b031614610d325760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f3cd6c184800297a0f2b00926a683cbe76890bb7fd01480ac0a10ed6c8f7f66599060200160405180910390a16040516005907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a250565b600081815260086020908152604080832081518083019092525460ff811615158252610100900467ffffffffffffffff16918101829052908203610e185760405162f20c5d60e01b815260048101849052602401610978565b6020015167ffffffffffffffff1692915050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea39190614f47565b6001600160a01b0316336001600160a01b031614610f045760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b610f0d8161321a565b60408051825167ffffffffffffffff908116825260208085015182169083015283830151168183015290517faa7a2d8175dee3b637814ad6346005dfcc357165396fb8327f649effe8abcf859181900360600190a150565b827f000000000000000000000000000000000000000000000000000000000000000060005a3360009081526003602052604090205490915060ff16610fbd57604051632dd9fc9760e01b815260040160405180910390fd5b610fc68761345a565b15610fe457604051630e5da8fb60e01b815260040160405180910390fd5b610ff0888887876134a2565b6001600160a01b0383161561124957366000602061100f83601f614f93565b6110199190614fa6565b90506102006110296002836150ac565b6110339190614fa6565b61103e8260066150bb565b6110489190614f93565b6110529084614f93565b925061105c6135d9565b611069576000915061119c565b6001600160a01b0384161561119c57836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa9250505080156110d757506040513d6000823e601f3d908101601f191682016040526110d491908101906150d2565b60015b1561119c5780511561119a576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611123573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111479190614f64565b905048817f0000000000000000000000000000000000000000000000000000000000000000845161117891906150bb565b61118291906150bb565b61118c9190614fa6565b6111969086614f93565b9450505b505b846001600160a01b031663e3db8a49335a6111b79087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af1158015611221573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611245919061518b565b5050505b5050505050505050565b836000805a90506112626135d9565b611298576040517fc8958ead00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526003602052604090205460ff166112c857604051632dd9fc9760e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061130657604051631192b39960e31b815260040160405180910390fd5b61131e88611319368790038701876151a8565b6135ec565b61132e8b8b8b8b8a8a60016136f9565b6001600160a01b0383161561124557366000602061134d83601f614f93565b6113579190614fa6565b90506102006113676002836150ac565b6113719190614fa6565b61137c8260066150bb565b6113869190614f93565b6113909084614f93565b925061139a6135d9565b6113a757600091506114da565b6001600160a01b038416156114da57836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561141557506040513d6000823e601f3d908101601f1916820160405261141291908101906150d2565b60015b156114da578051156114d8576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114859190614f64565b905048817f000000000000000000000000000000000000000000000000000000000000000084516114b691906150bb565b6114c091906150bb565b6114ca9190614fa6565b6114d49086614f93565b9450505b505b846001600160a01b031663e3db8a49335a6114f59087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af115801561155f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611583919061518b565b5050505050505050505050505050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190614f47565b6001600160a01b0316336001600160a01b03161461166b5760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b600154604080517fcb23bcb500000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cb23bcb59160048083019260209291908290030181865afa1580156116ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f29190614f47565b6002549091506001600160a01b0380831691160361173c576040517fd054909f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b836000805a3360009081526003602052604090205490915060ff1615801561179e57506002546001600160a01b03163314155b156117bc57604051632dd9fc9760e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006117fa57604051631192b39960e31b815260040160405180910390fd5b61180d88611319368790038701876151a8565b61132e8b8b8b8b8a8a60006136f9565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611870573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118949190614f47565b6001600160a01b0316336001600160a01b0316141580156118c05750600b546001600160a01b03163314155b156118f9576040517f660b3b42000000000000000000000000000000000000000000000000000000008152336004820152602401610978565b6001600160a01b038216600081815260036020908152604091829020805460ff19168515159081179091558251938452908301527f28bcc5626d357efe966b4b0876aa1ee8ab99e26da4f131f6a2623f1800701c21910160405180910390a16040516001907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a25050565b6040517fc73b9d7c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a319190614f47565b6001600160a01b0316336001600160a01b031614611a925760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b60008181526008602052604090205460ff16611ac35760405162f20c5d60e01b815260048101829052602401610978565b600081815260086020526040808220805460ff191690555182917f5cb4218b272fd214168ac43e90fb4d05d6c36f0b17ffb4c2dd07c234d744eb2a91a26040516003907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a250565b826000805a9050611b3e6135d9565b611b74576040517fc8958ead00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526003602052604090205460ff16611ba457604051632dd9fc9760e01b815260040160405180910390fd5b611bad8761345a565b15611bcb57604051630e5da8fb60e01b815260040160405180910390fd5b611bdb8a8a8a8a898960016136f9565b6001600160a01b03831615611e34573660006020611bfa83601f614f93565b611c049190614fa6565b9050610200611c146002836150ac565b611c1e9190614fa6565b611c298260066150bb565b611c339190614f93565b611c3d9084614f93565b9250611c476135d9565b611c545760009150611d87565b6001600160a01b03841615611d8757836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa925050508015611cc257506040513d6000823e601f3d908101601f19168201604052611cbf91908101906150d2565b60015b15611d8757805115611d85576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d329190614f64565b905048817f00000000000000000000000000000000000000000000000000000000000000008451611d6391906150bb565b611d6d91906150bb565b611d779190614fa6565b611d819086614f93565b9450505b505b846001600160a01b031663e3db8a49335a611da29087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af1158015611e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e30919061518b565b5050505b50505050505050505050565b837f000000000000000000000000000000000000000000000000000000000000000060005a3360009081526003602052604090205490915060ff16611e9857604051632dd9fc9760e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000611ed657604051631192b39960e31b815260040160405180910390fd5b611ee988611319368790038701876151a8565b611ef5898988886134a2565b6001600160a01b0383161561214e573660006020611f1483601f614f93565b611f1e9190614fa6565b9050610200611f2e6002836150ac565b611f389190614fa6565b611f438260066150bb565b611f4d9190614f93565b611f579084614f93565b9250611f616135d9565b611f6e57600091506120a1565b6001600160a01b038416156120a157836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa925050508015611fdc57506040513d6000823e601f3d908101601f19168201604052611fd991908101906150d2565b60015b156120a15780511561209f576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204c9190614f64565b905048817f0000000000000000000000000000000000000000000000000000000000000000845161207d91906150bb565b61208791906150bb565b6120919190614fa6565b61209b9086614f93565b9450505b505b846001600160a01b031663e3db8a49335a6120bc9087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af1158015612126573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214a919061518b565b5050505b505050505050505050565b467f0000000000000000000000000000000000000000000000000000000000000000036121b2576040517fa301bb0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7801000000000000000100000000000000010000000000000001600a55565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003612289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610978565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61038054336001600160a01b038216146122ff576040517f23295f0e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0382166024820152604401610978565b7f000000000000000000000000000000000000000000000000000000000000000061233d57604051631192b39960e31b815260040160405180910390fd5b600c5467ffffffffffffffff1615612381576040517fef34ca5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61238a8361321a565b505050565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003612447576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610978565b6001546001600160a01b03161561248a576040517fef34ca5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166124ca576040517f1ad0f74300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000846001600160a01b031663e1758bd86040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612526575060408051601f3d908101601f1916820190925261252391810190614f47565b60015b15612541576001600160a01b0381161561253f57600191505b505b8015157f000000000000000000000000000000000000000000000000000000000000000015151461259e576040517fc3e31f8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155604080517fcb23bcb5000000000000000000000000000000000000000000000000000000008152905163cb23bcb5916004808201926020929091908290030181865afa15801561261d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126419190614f47565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039290921691909117905561268561268036869003860186614e0b565b613824565b7f0000000000000000000000000000000000000000000000000000000000000000156126b4576126b48361321a565b7f00000000000000000000000000000000000000000000000000000000000000001580156126ea57506001600160a01b03821615155b15612721576040517fe13123b400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50600e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055505050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127cb9190614f47565b6001600160a01b0316336001600160a01b03161461282c5760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b61283581613824565b60408051825181526020808401519082015282820151818301526060808401519082015290517faa6a58dad31128ff7ecc2b80987ee6e003df80bc50cd8d0b0d1af0e07da6d19d9181900360800190a16040516000907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e908290a250565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a9190614f47565b6001600160a01b0316336001600160a01b03161461298b5760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b6000828260405161299d929190615256565b6040519081900381207ffe000000000000000000000000000000000000000000000000000000000000006020830152602182015260410160408051601f1981840301815291905280516020909101209050600160ff1b8118620100008310612a31576040517fb3d1f41200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526008602052604090205460ff1615612a7d576040517ffa2fddda00000000000000000000000000000000000000000000000000000000815260048101829052602401610978565b437f000000000000000000000000000000000000000000000000000000000000000015612b0a5760646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b079190614f64565b90505b6040805180820182526001815267ffffffffffffffff8381166020808401918252600087815260089091528490209251835491517fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000009092169015157fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ff161761010091909216021790555182907fabca9b7986bc22ad0160eb0cb88ae75411eacfba4052af0b457a9335ef65572290612bc59088908890615266565b60405180910390a26040516002907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a25050505050565b6001546040517f16bf5579000000000000000000000000000000000000000000000000000000008152600481018390526000916001600160a01b0316906316bf557990602401602060405180830381865afa158015612c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c879190614f64565b92915050565b600a5460009067ffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000015612cdf576000612cd0600c85613950565b9050612cdb8161399f565b9150505b612ce98184615295565b9392505050565b826000805a3360009081526003602052604090205490915060ff16158015612d2357506002546001600160a01b03163314155b15612d4157604051632dd9fc9760e01b815260040160405180910390fd5b612d4a8761345a565b15612d6857604051630e5da8fb60e01b815260040160405180910390fd5b611bdb8a8a8a8a898960006136f9565b600080600080600080600080612d8c6139cf565b67ffffffffffffffff9384169b50918316995082169750169450505050505b90919293565b6000548611612dec576040517f7d73e6fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612e228684612e006020890189614eb3565b612e1060408a0160208b01614eb3565b612e1b60018d615178565b8988613a46565b600a5490915067ffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000015612e9357612e70612e686020880188614eb3565b600c90613aeb565b600c54612e869067ffffffffffffffff1661399f565b67ffffffffffffffff1690505b4381612ea26020890189614eb3565b67ffffffffffffffff16612eb69190614f93565b10612eed576040517fad3515d900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006001891115612f76576001546001600160a01b031663d5719dc2612f1460028c615178565b6040518263ffffffff1660e01b8152600401612f3291815260200190565b602060405180830381865afa158015612f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f739190614f64565b90505b60408051602080820184905281830186905282518083038401815260609092019092528051910120600180546001600160a01b03169063d5719dc290612fbc908d615178565b6040518263ffffffff1660e01b8152600401612fda91815260200190565b602060405180830381865afa158015612ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301b9190614f64565b14613052576040517f13947fd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061305e8b613b71565b9150915060008b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316635fca4a166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e09190614f64565b90508060008080806130f58988838880613bb6565b93509350935093508083857f7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7856000548d600260405161313894939291906152d3565b60405180910390a4505050505050505050505050505050505050565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f051038f2000000000000000000000000000000000000000000000000000000001790529051600091829182916064916131c0919061536c565b600060405180830381855afa9150503d80600081146131fb576040519150601f19603f3d011682016040523d82523d6000602084013e613200565b606091505b5091509150818015613213575080516020145b9250505090565b7f000000000000000000000000000000000000000000000000000000000000000061325857604051631192b39960e31b815260040160405180910390fd5b61326181613d73565b613297576040517fda1c8eb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c5467ffffffffffffffff1615806132c357506020810151600c5467ffffffffffffffff9182169116115b156132ef576020810151600c805467ffffffffffffffff191667ffffffffffffffff9092169190911790555b8051600c5467ffffffffffffffff9182169116101561332c578051600c805467ffffffffffffffff191667ffffffffffffffff9092169190911790555b602081810151600c805484517fffffffffffffffff00000000000000000000000000000000ffffffffffffffff9091166801000000000000000067ffffffffffffffff948516027fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff1617600160801b91841691909102179055604080840151600d805467ffffffffffffffff1916919093161790915560005460015482517feca067ad000000000000000000000000000000000000000000000000000000008152925191936001600160a01b039091169263eca067ad92600480830193928290030181865afa158015613423573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134479190614f64565b0361345757613457600c43613aeb565b50565b60007f0000000000000000000000000000000000000000000000000000000000000000801561348a575060005482115b8015612c87575061349b600c613ddb565b1592915050565b60008060006134b086613e0e565b9250925092506000806000806134ca878b60008c8c613bb6565b93509350935093508a84141580156134e457506000198b14155b15613525576040517fac7411c900000000000000000000000000000000000000000000000000000000815260048101859052602481018c9052604401610978565b80838c7f7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7856000548b600360405161356094939291906152d3565b60405180910390a47f0000000000000000000000000000000000000000000000000000000000000000156135c0576040517f86657a5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6135c86135d9565b15611245576112458785488861403d565b60003332148015610aea575050333b1590565b6000548211156136f557613600600c61438f565b156136f557600154600080546040517fd5719dc200000000000000000000000000000000000000000000000000000000815291926001600160a01b03169163d5719dc2916136549160040190815260200190565b602060405180830381865afa158015613671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136959190614f64565b90506136aa81836000015184602001516143c0565b6136e0576040517fc334542d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208201516040015161238a90600c90613aeb565b5050565b600080613707888888614405565b9150915060008060008061372b868b89613722576000613724565b8d5b8c8c613bb6565b93509350935093508c841415801561374557506000198d14155b15613786576040517fac7411c900000000000000000000000000000000000000000000000000000000815260048101859052602481018e9052604401610978565b8083857f7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7856000548a8d6137bb5760016137be565b60005b6040516137ce94939291906152d3565b60405180910390a486611e3057837ffe325ca1efe4c5c1062c981c3ee74b781debe4ea9440306a96d2a55759c66c208d8d60405161380d929190615266565b60405180910390a250505050505050505050505050565b805167ffffffffffffffff10806138465750602081015167ffffffffffffffff105b8061385c5750604081015167ffffffffffffffff105b806138725750606081015167ffffffffffffffff105b156138a9576040517f09cfba7500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051600a80546020840151604085015160609095015167ffffffffffffffff908116600160c01b0277ffffffffffffffffffffffffffffffffffffffffffffffff968216600160801b02969096166fffffffffffffffffffffffffffffffff92821668010000000000000000027fffffffffffffffffffffffffffffffff000000000000000000000000000000009094169190951617919091171691909117919091179055565b81546001830154600091612ce99167ffffffffffffffff600160c01b8304811692868216928282169268010000000000000000808304821693600160801b810483169391900482169116614613565b600a5460009067ffffffffffffffff908116908316106139cb57600a5467ffffffffffffffff16612c87565b5090565b6000808080467f000000000000000000000000000000000000000000000000000000000000000014613a0c57506001925082915081905080612dab565b5050600a5467ffffffffffffffff808216935068010000000000000000820481169250600160801b8204811691600160c01b900416612dab565b6040516001600160f81b031960f889901b1660208201526bffffffffffffffffffffffff19606088901b1660218201527fffffffffffffffff00000000000000000000000000000000000000000000000060c087811b8216603584015286901b16603d82015260458101849052606581018390526085810182905260009060a5016040516020818303038152906040528051906020012090505b979650505050505050565b613af58282613950565b825467ffffffffffffffff928316600160c01b0277ffffffffffffffffffffffffffffffff000000000000000090911691831691909117178255600190910180544390921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055565b6040805160808101825260008082526020820181905291810182905260608101829052600080613ba0856146da565b8151602090920191909120969095509350505050565b600080600080600054881015613bf8576040517f7d73e6fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a90046001600160a01b03166001600160a01b031663eca067ad6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c6f9190614f64565b881115613ca8576040517f925f8bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040517f86598a56000000000000000000000000000000000000000000000000000000008152600481018b9052602481018a905260448101889052606481018790526001600160a01b03909116906386598a56906084016080604051808303816000875af1158015613d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d459190615388565b60008c9055929650909450925090508615613d6757613d67898548600061403d565b95509550955095915050565b805160009067ffffffffffffffff1615801590613d9d5750602082015167ffffffffffffffff1615155b8015613db95750612710826040015167ffffffffffffffff1611155b8015612c875750506020810151905167ffffffffffffffff9182169116111590565b805460009067ffffffffffffffff600160801b8204811691613e0691600160c01b9091041643615178565b111592915050565b60408051608081018252600080825260208201819052918101829052606081018290526000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa158015613e92573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613eba91908101906150d2565b90508051600003613ef7576040517f3cd27eb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080613f03876146da565b9150915060008351620200007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f919190614f64565b613f9b91906150bb565b613fa591906150bb565b60405190915083907f500000000000000000000000000000000000000000000000000000000000000090613fdd9087906020016153be565b60408051601f1981840301815290829052613ffc9392916020016153f4565b60405160208183030381529060405280519060200120826000481161402257600061402c565b61402c4884614fa6565b965096509650505050509193909250565b600e546001600160a01b03167f0000000000000000000000000000000000000000000000000000000000000000801561407d57506001600160a01b038116155b156140885750614389565b327f00000000000000000000000000000000000000000000000000000000000000001561412e576000606c6001600160a01b031663c6f7de0e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156140f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141149190614f64565b90506141204882614fa6565b61412a9085614f93565b9350505b67ffffffffffffffff831115614170576040517f04d5501200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000080156141a557506001600160a01b03821615155b15614233576000826001600160a01b031663e6aa216c6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156141ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142109190614f64565b9050670de0b6b3a764000061422582876150bb565b61422f9190614fa6565b9450505b604080514260208201526bffffffffffffffffffffffff19606084901b16918101919091526054810187905260748101869052609481018590527fffffffffffffffff00000000000000000000000000000000000000000000000060c085901b1660b482015260009060bc0160408051808303601f1901815290829052600154815160208301207f7a88b1070000000000000000000000000000000000000000000000000000000084526001600160a01b0386811660048601526024850191909152919350600092911690637a88b107906044016020604051808303816000875af1158015614326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061434a9190614f64565b9050807fff64905f73a67fb594e0f940a8075a860db489ad991e032f48c81123eb52d60b8360405161437c9190615437565b60405180910390a2505050505b50505050565b600061439a82613ddb565b1580612c875750505467ffffffffffffffff680100000000000000008204811691161090565b60006143fb836143cf846147b2565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9093149392505050565b60408051608081018252600080825260208201819052918101829052606081018290526000614435856028614f93565b90507f00000000000000000000000000000000000000000000000000000000000000008111156144ba576040517f4634691b000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000000006024820152604401610978565b6000806144c6866146da565b909250905086156145d9576144f6888860008181106144e7576144e76152bd565b9050013560f81c60f81b6147df565b61454e578787600081811061450d5761450d6152bd565b6040517f6b3333560000000000000000000000000000000000000000000000000000000081529201356001600160f81b031916600483015250602401610978565b600160ff1b8888600081614564576145646152bd565b6001600160f81b031992013592909216161580159150614585575060218710155b156145d957600061459a602160018a8c61546a565b6145a391615494565b60008181526008602052604090205490915060ff166145d75760405162f20c5d60e01b815260048101829052602401610978565b505b8188886040516020016145ee939291906154b2565b60408051601f1981840301815291905280516020909101209890975095505050505050565b60008088881161462457600061462e565b61462e8989615178565b9050600089871161464057600061464a565b61464a8a88615178565b905061271061465985846150bb565b6146639190614fa6565b61466d9089614f93565b9750600086821161467f576000614689565b6146898783615178565b9050828111156146965750815b808911156146cb576146a8818a615178565b9850868911156146cb578589116146bf57886146c1565b855b9350505050613ae0565b50949998505050505050505050565b60408051608081018252600080825260208201819052918101829052606080820183905291614707614872565b9050600081600001518260200151836040015184606001518860405160200161478795949392919060c095861b7fffffffffffffffff000000000000000000000000000000000000000000000000908116825294861b8516600882015292851b8416601084015290841b8316601883015290921b16602082015260280190565b604051602081830303815290604052905060288151146147a9576147a96154da565b94909350915050565b6000612c87826000015183602001518460400151856060015186608001518760a001518860c00151613a46565b60006001600160f81b03198216158061480557506001600160f81b03198216600160ff1b145b8061483957506001600160f81b031982167f8800000000000000000000000000000000000000000000000000000000000000145b80612c8757506001600160f81b031982167f20000000000000000000000000000000000000000000000000000000000000001492915050565b6040805160808101825260008082526020820181905291810182905260608101919091526040805160808101825260008082526020820181905291810182905260608101919091526000806000806148c86139cf565b93509350935093508167ffffffffffffffff164211156148f9576148ec82426154f0565b67ffffffffffffffff1685525b6149038142615295565b67ffffffffffffffff908116602087015284164311156149375761492784436154f0565b67ffffffffffffffff1660408601525b6149418343615295565b67ffffffffffffffff1660608601525092949350505050565b6001600160a01b038116811461345757600080fd5b60006020828403121561498157600080fd5b8135612ce98161495a565b60006020828403121561499e57600080fd5b5035919050565b801515811461345757600080fd5b600080604083850312156149c657600080fd5b82356149d18161495a565b915060208301356149e1816149a5565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715614a2557614a256149ec565b60405290565b60405160e0810167ffffffffffffffff81118282101715614a2557614a256149ec565b604051601f8201601f1916810167ffffffffffffffff81118282101715614a7757614a776149ec565b604052919050565b803567ffffffffffffffff81168114614a9757600080fd5b919050565b600060608284031215614aae57600080fd5b6040516060810181811067ffffffffffffffff82111715614ad157614ad16149ec565b604052905080614ae083614a7f565b8152614aee60208401614a7f565b6020820152614aff60408401614a7f565b60408201525092915050565b600060608284031215614b1d57600080fd5b612ce98383614a9c565b600080600080600060a08688031215614b3f57600080fd5b85359450602086013593506040860135614b588161495a565b94979396509394606081013594506080013592915050565b60008083601f840112614b8257600080fd5b50813567ffffffffffffffff811115614b9a57600080fd5b602083019150836020828501011115614bb257600080fd5b9250929050565b60006101008284031215614bcc57600080fd5b50919050565b6000806000806000806000806101c0898b031215614bef57600080fd5b88359750602089013567ffffffffffffffff811115614c0d57600080fd5b614c198b828c01614b70565b909850965050604089013594506060890135614c348161495a565b93506080890135925060a08901359150614c518a60c08b01614bb9565b90509295985092959890939650565b600080600080600060808688031215614c7857600080fd5b85359450602086013567ffffffffffffffff811115614c9657600080fd5b614ca288828901614b70565b909550935050604086013591506060860135614cbd8161495a565b809150509295509295909350565b600080600080600080600060c0888a031215614ce657600080fd5b87359650602088013567ffffffffffffffff811115614d0457600080fd5b614d108a828b01614b70565b909750955050604088013593506060880135614d2b8161495a565b969995985093969295946080840135945060a09093013592915050565b6000806000806000806101a08789031215614d6257600080fd5b86359550602087013594506040870135614d7b8161495a565b93506060870135925060808701359150614d988860a08901614bb9565b90509295509295509295565b600080600080848603610120811215614dbc57600080fd5b8535614dc78161495a565b94506080601f1982011215614ddb57600080fd5b50602085019250614def8660a08701614a9c565b9150610100850135614e008161495a565b939692955090935050565b600060808284031215614e1d57600080fd5b6040516080810181811067ffffffffffffffff82111715614e4057614e406149ec565b8060405250823581526020830135602082015260408301356040820152606083013560608201528091505092915050565b60008060208385031215614e8457600080fd5b823567ffffffffffffffff811115614e9b57600080fd5b614ea785828601614b70565b90969095509350505050565b600060208284031215614ec557600080fd5b612ce982614a7f565b803560ff81168114614a9757600080fd5b60008060008060008060e08789031215614ef857600080fd5b86359550614f0860208801614ece565b94506080870188811115614f1b57600080fd5b60408801945035925060a0870135614f328161495a565b8092505060c087013590509295509295509295565b600060208284031215614f5957600080fd5b8151612ce98161495a565b600060208284031215614f7657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115612c8757612c87614f7d565b600082614fc357634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115615003578160001904821115614fe957614fe9614f7d565b80851615614ff657918102915b93841c9390800290614fcd565b509250929050565b60008261501a57506001612c87565b8161502757506000612c87565b816001811461503d576002811461504757615063565b6001915050612c87565b60ff84111561505857615058614f7d565b50506001821b612c87565b5060208310610133831016604e8410600b8410161715615086575081810a612c87565b6150908383614fc8565b80600019048211156150a4576150a4614f7d565b029392505050565b6000612ce960ff84168361500b565b8082028115828204841417612c8757612c87614f7d565b600060208083850312156150e557600080fd5b825167ffffffffffffffff808211156150fd57600080fd5b818501915085601f83011261511157600080fd5b815181811115615123576151236149ec565b8060051b9150615134848301614a4e565b818152918301840191848101908884111561514e57600080fd5b938501935b8385101561516c57845182529385019390850190615153565b98975050505050505050565b81810381811115612c8757612c87614f7d565b60006020828403121561519d57600080fd5b8151612ce9816149a5565b60008183036101008112156151bc57600080fd5b6151c4614a02565b8335815260e0601f19830112156151da57600080fd5b6151e2614a2b565b91506151f060208501614ece565b825260408401356152008161495a565b602083015261521160608501614a7f565b604083015261522260808501614a7f565b606083015260a0840135608083015260c084013560a083015260e084013560c0830152816020820152809250505092915050565b8183823760009101908152919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b67ffffffffffffffff8181168382160190808211156152b6576152b6614f7d565b5092915050565b634e487b7160e01b600052603260045260246000fd5b600060e08201905085825284602083015267ffffffffffffffff8085511660408401528060208601511660608401528060408601511660808401528060608601511660a0840152506004831061533957634e487b7160e01b600052602160045260246000fd5b8260c083015295945050505050565b60005b8381101561536357818101518382015260200161534b565b50506000910152565b6000825161537e818460208701615348565b9190910192915050565b6000806000806080858703121561539e57600080fd5b505082516020840151604085015160609095015191969095509092509050565b815160009082906020808601845b838110156153e8578151855293820193908201906001016153cc565b50929695505050505050565b60008451615406818460208901615348565b6001600160f81b03198516908301908152835161542a816001840160208801615348565b0160010195945050505050565b6020815260008251806020840152615456816040850160208701615348565b601f01601f19169190910160400192915050565b6000808585111561547a57600080fd5b8386111561548757600080fd5b5050820193919092039150565b80356020831015612c8757600019602084900360031b1b1692915050565b600084516154c4818460208901615348565b8201838582376000930192835250909392505050565b634e487b7160e01b600052600160045260246000fd5b67ffffffffffffffff8281168282160390808211156152b6576152b6614f7d56fea26469706673582212206610ccdd5a5a7e68d327d0ef40009a9ecf999cf5ddde22a0d0560b27b94fa98664736f6c634300081100330000000000000000000000000000000000000000000000000000000000019999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061030a5760003560e01c80637fa3a40e1161019c578063cc2a1a0c116100ee578063e78cea9211610097578063edaafe2011610071578063edaafe2014610794578063f19815781461081d578063f60a50911461083057600080fd5b8063e78cea9214610732578063e8eb1dc314610745578063ebea461d1461076c57600080fd5b8063dd44e6e0116100c8578063dd44e6e0146106cc578063e0bc9729146106f8578063e5a358c81461070b57600080fd5b8063cc2a1a0c14610693578063d1ce8da8146106a6578063d9dd67ab146106b957600080fd5b806392d9f78211610150578063a84840b71161012a578063a84840b71461065a578063b31761f81461066d578063cb23bcb51461068057600080fd5b806392d9f7821461061857806396cc5c781461063f578063a655d9371461064757600080fd5b80638d910dde116101815780638d910dde146105cb5780638f111f3c146105f2578063917cf8ac1461060557600080fd5b80637fa3a40e146105af57806384420860146105b857600080fd5b80632f3985a7116102605780636d46e987116102095780636f12b0c9116101e35780636f12b0c914610525578063715ea34b1461053857806371c3e6fe1461058c57600080fd5b80636d46e987146104dc5780636e620055146104ff5780636e7df3e71461051257600080fd5b806369cacded1161023a57806369cacded1461049a5780636ae71f12146104ad5780636c890450146104b557600080fd5b80632f3985a71461044d5780633e5aa082146104605780634b678a661461047357600080fd5b80631f956632116102c2578063258f04951161029c578063258f04951461040b57806327957a491461041e5780632cbf74e51461042657600080fd5b80631f956632146103ba5780631ff64790146103cd57806322291e8d146103e057600080fd5b806306f13056116102f357806306f13056146103695780631637be481461037f57806316af91a7146103b257600080fd5b806302c992751461030f578063036f7ed314610354575b600080fd5b6103367f200000000000000000000000000000000000000000000000000000000000000081565b6040516001600160f81b031990911681526020015b60405180910390f35b61036761036236600461496f565b61083b565b005b610371610a65565b60405190815260200161034b565b6103a261038d36600461498c565b60009081526008602052604090205460ff1690565b604051901515815260200161034b565b610336600081565b6103676103c83660046149b3565b610aef565b6103676103db36600461496f565b610c5a565b600e546103f3906001600160a01b031681565b6040516001600160a01b03909116815260200161034b565b61037161041936600461498c565b610dbf565b610371602881565b6103367f500000000000000000000000000000000000000000000000000000000000000081565b61036761045b366004614b0b565b610e2c565b61036761046e366004614b27565b610f65565b6103a27f000000000000000000000000000000000000000000000000000000000000000181565b6103676104a8366004614bd2565b611253565b610367611593565b6103367f080000000000000000000000000000000000000000000000000000000000000081565b6103a26104ea36600461496f565b60096020526000908152604090205460ff1681565b61036761050d366004614bd2565b61176b565b6103676105203660046149b3565b61181d565b610367610533366004614c60565b611988565b61056c61054636600461498c565b60086020526000908152604090205460ff811690610100900467ffffffffffffffff1682565b60408051921515835267ffffffffffffffff90911660208301520161034b565b6103a261059a36600461496f565b60036020526000908152604090205460ff1681565b61037160005481565b6103676105c636600461498c565b6119ba565b6103f37f000000000000000000000000000000000000000000000000000000000000000081565b610367610600366004614ccb565b611b2f565b610367610613366004614d48565b611e40565b6103a27f000000000000000000000000000000000000000000000000000000000000000081565b610367612159565b610367610655366004614b0b565b6121d1565b610367610668366004614da4565b61238f565b61036761067b366004614e0b565b612754565b6002546103f3906001600160a01b031681565b600b546103f3906001600160a01b031681565b6103676106b4366004614e71565b6128b3565b6103716106c736600461498c565b612c00565b6106df6106da366004614eb3565b612c8d565b60405167ffffffffffffffff909116815260200161034b565b610367610706366004614ccb565b612cf0565b6103367f400000000000000000000000000000000000000000000000000000000000000081565b6001546103f3906001600160a01b031681565b6103717f000000000000000000000000000000000000000000000000000000000001999981565b610774612d78565b60408051948552602085019390935291830152606082015260800161034b565b600c54600d546107da9167ffffffffffffffff8082169268010000000000000000808404831693600160801b8104841693600160c01b9091048116928082169290041686565b6040805167ffffffffffffffff978816815295871660208701529386169385019390935290841660608401528316608083015290911660a082015260c00161034b565b61036761082b366004614edf565b612db1565b610336600160ff1b81565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561088e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b29190614f47565b6001600160a01b0316336001600160a01b0316146109815760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109379190614f47565b6040517f23295f0e0000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152911660248201526044015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006109d8576040517fe13123b400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527fe83d6153add50e41b8ee6c1115c4178687349bb12bc3902a50b1f6ad78a0c5419060200160405180910390a16040516006907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a250565b600154604080517e84120c00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916284120c9160048083019260209291908290030181865afa158015610ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aea9190614f64565b905090565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b669190614f47565b6001600160a01b0316336001600160a01b031614158015610b925750600b546001600160a01b03163314155b15610bcb576040517f660b3b42000000000000000000000000000000000000000000000000000000008152336004820152602401610978565b6001600160a01b038216600081815260096020908152604091829020805460ff19168515159081179091558251938452908301527feb12a9a53eec138c91b27b4f912a257bd690c18fc8bde744be92a0365eb9b87e910160405180910390a16040516004907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a25050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd19190614f47565b6001600160a01b0316336001600160a01b031614610d325760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f3cd6c184800297a0f2b00926a683cbe76890bb7fd01480ac0a10ed6c8f7f66599060200160405180910390a16040516005907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a250565b600081815260086020908152604080832081518083019092525460ff811615158252610100900467ffffffffffffffff16918101829052908203610e185760405162f20c5d60e01b815260048101849052602401610978565b6020015167ffffffffffffffff1692915050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea39190614f47565b6001600160a01b0316336001600160a01b031614610f045760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b610f0d8161321a565b60408051825167ffffffffffffffff908116825260208085015182169083015283830151168183015290517faa7a2d8175dee3b637814ad6346005dfcc357165396fb8327f649effe8abcf859181900360600190a150565b827f000000000000000000000000000000000000000000000000000000000000000060005a3360009081526003602052604090205490915060ff16610fbd57604051632dd9fc9760e01b815260040160405180910390fd5b610fc68761345a565b15610fe457604051630e5da8fb60e01b815260040160405180910390fd5b610ff0888887876134a2565b6001600160a01b0383161561124957366000602061100f83601f614f93565b6110199190614fa6565b90506102006110296002836150ac565b6110339190614fa6565b61103e8260066150bb565b6110489190614f93565b6110529084614f93565b925061105c6135d9565b611069576000915061119c565b6001600160a01b0384161561119c57836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa9250505080156110d757506040513d6000823e601f3d908101601f191682016040526110d491908101906150d2565b60015b1561119c5780511561119a576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611123573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111479190614f64565b905048817f0000000000000000000000000000000000000000000000000000000000020000845161117891906150bb565b61118291906150bb565b61118c9190614fa6565b6111969086614f93565b9450505b505b846001600160a01b031663e3db8a49335a6111b79087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af1158015611221573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611245919061518b565b5050505b5050505050505050565b836000805a90506112626135d9565b611298576040517fc8958ead00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526003602052604090205460ff166112c857604051632dd9fc9760e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000161130657604051631192b39960e31b815260040160405180910390fd5b61131e88611319368790038701876151a8565b6135ec565b61132e8b8b8b8b8a8a60016136f9565b6001600160a01b0383161561124557366000602061134d83601f614f93565b6113579190614fa6565b90506102006113676002836150ac565b6113719190614fa6565b61137c8260066150bb565b6113869190614f93565b6113909084614f93565b925061139a6135d9565b6113a757600091506114da565b6001600160a01b038416156114da57836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa92505050801561141557506040513d6000823e601f3d908101601f1916820160405261141291908101906150d2565b60015b156114da578051156114d8576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114859190614f64565b905048817f000000000000000000000000000000000000000000000000000000000002000084516114b691906150bb565b6114c091906150bb565b6114ca9190614fa6565b6114d49086614f93565b9450505b505b846001600160a01b031663e3db8a49335a6114f59087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af115801561155f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611583919061518b565b5050505050505050505050505050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190614f47565b6001600160a01b0316336001600160a01b03161461166b5760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b600154604080517fcb23bcb500000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cb23bcb59160048083019260209291908290030181865afa1580156116ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f29190614f47565b6002549091506001600160a01b0380831691160361173c576040517fd054909f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b836000805a3360009081526003602052604090205490915060ff1615801561179e57506002546001600160a01b03163314155b156117bc57604051632dd9fc9760e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000016117fa57604051631192b39960e31b815260040160405180910390fd5b61180d88611319368790038701876151a8565b61132e8b8b8b8b8a8a60006136f9565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611870573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118949190614f47565b6001600160a01b0316336001600160a01b0316141580156118c05750600b546001600160a01b03163314155b156118f9576040517f660b3b42000000000000000000000000000000000000000000000000000000008152336004820152602401610978565b6001600160a01b038216600081815260036020908152604091829020805460ff19168515159081179091558251938452908301527f28bcc5626d357efe966b4b0876aa1ee8ab99e26da4f131f6a2623f1800701c21910160405180910390a16040516001907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a25050565b6040517fc73b9d7c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a319190614f47565b6001600160a01b0316336001600160a01b031614611a925760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b60008181526008602052604090205460ff16611ac35760405162f20c5d60e01b815260048101829052602401610978565b600081815260086020526040808220805460ff191690555182917f5cb4218b272fd214168ac43e90fb4d05d6c36f0b17ffb4c2dd07c234d744eb2a91a26040516003907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a250565b826000805a9050611b3e6135d9565b611b74576040517fc8958ead00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526003602052604090205460ff16611ba457604051632dd9fc9760e01b815260040160405180910390fd5b611bad8761345a565b15611bcb57604051630e5da8fb60e01b815260040160405180910390fd5b611bdb8a8a8a8a898960016136f9565b6001600160a01b03831615611e34573660006020611bfa83601f614f93565b611c049190614fa6565b9050610200611c146002836150ac565b611c1e9190614fa6565b611c298260066150bb565b611c339190614f93565b611c3d9084614f93565b9250611c476135d9565b611c545760009150611d87565b6001600160a01b03841615611d8757836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa925050508015611cc257506040513d6000823e601f3d908101601f19168201604052611cbf91908101906150d2565b60015b15611d8757805115611d85576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d329190614f64565b905048817f00000000000000000000000000000000000000000000000000000000000200008451611d6391906150bb565b611d6d91906150bb565b611d779190614fa6565b611d819086614f93565b9450505b505b846001600160a01b031663e3db8a49335a611da29087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af1158015611e0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e30919061518b565b5050505b50505050505050505050565b837f000000000000000000000000000000000000000000000000000000000000000060005a3360009081526003602052604090205490915060ff16611e9857604051632dd9fc9760e01b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000001611ed657604051631192b39960e31b815260040160405180910390fd5b611ee988611319368790038701876151a8565b611ef5898988886134a2565b6001600160a01b0383161561214e573660006020611f1483601f614f93565b611f1e9190614fa6565b9050610200611f2e6002836150ac565b611f389190614fa6565b611f438260066150bb565b611f4d9190614f93565b611f579084614f93565b9250611f616135d9565b611f6e57600091506120a1565b6001600160a01b038416156120a157836001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa925050508015611fdc57506040513d6000823e601f3d908101601f19168201604052611fd991908101906150d2565b60015b156120a15780511561209f576000856001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204c9190614f64565b905048817f0000000000000000000000000000000000000000000000000000000000020000845161207d91906150bb565b61208791906150bb565b6120919190614fa6565b61209b9086614f93565b9450505b505b846001600160a01b031663e3db8a49335a6120bc9087615178565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604481018590526064016020604051808303816000875af1158015612126573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214a919061518b565b5050505b505050505050505050565b467f000000000000000000000000000000000000000000000000000000000000a4b1036121b2576040517fa301bb0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7801000000000000000100000000000000010000000000000001600a55565b6001600160a01b037f000000000000000000000000feb2537afd8519d16d0ccea741a70f97f3d4288b163003612289576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610978565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61038054336001600160a01b038216146122ff576040517f23295f0e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b0382166024820152604401610978565b7f000000000000000000000000000000000000000000000000000000000000000161233d57604051631192b39960e31b815260040160405180910390fd5b600c5467ffffffffffffffff1615612381576040517fef34ca5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61238a8361321a565b505050565b6001600160a01b037f000000000000000000000000feb2537afd8519d16d0ccea741a70f97f3d4288b163003612447576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c00000000000000000000000000000000000000006064820152608401610978565b6001546001600160a01b03161561248a576040517fef34ca5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0384166124ca576040517f1ad0f74300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000846001600160a01b031663e1758bd86040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612526575060408051601f3d908101601f1916820190925261252391810190614f47565b60015b15612541576001600160a01b0381161561253f57600191505b505b8015157f000000000000000000000000000000000000000000000000000000000000000015151461259e576040517fc3e31f8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038716908117909155604080517fcb23bcb5000000000000000000000000000000000000000000000000000000008152905163cb23bcb5916004808201926020929091908290030181865afa15801561261d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126419190614f47565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039290921691909117905561268561268036869003860186614e0b565b613824565b7f0000000000000000000000000000000000000000000000000000000000000001156126b4576126b48361321a565b7f00000000000000000000000000000000000000000000000000000000000000001580156126ea57506001600160a01b03821615155b15612721576040517fe13123b400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50600e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055505050565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127cb9190614f47565b6001600160a01b0316336001600160a01b03161461282c5760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b61283581613824565b60408051825181526020808401519082015282820151818301526060808401519082015290517faa6a58dad31128ff7ecc2b80987ee6e003df80bc50cd8d0b0d1af0e07da6d19d9181900360800190a16040516000907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e908290a250565b600260009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a9190614f47565b6001600160a01b0316336001600160a01b03161461298b5760025460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b9160048083019260209291908290030181865afa158015610913573d6000803e3d6000fd5b6000828260405161299d929190615256565b6040519081900381207ffe000000000000000000000000000000000000000000000000000000000000006020830152602182015260410160408051601f1981840301815291905280516020909101209050600160ff1b8118620100008310612a31576040517fb3d1f41200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526008602052604090205460ff1615612a7d576040517ffa2fddda00000000000000000000000000000000000000000000000000000000815260048101829052602401610978565b437f000000000000000000000000000000000000000000000000000000000000000115612b0a5760646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b079190614f64565b90505b6040805180820182526001815267ffffffffffffffff8381166020808401918252600087815260089091528490209251835491517fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000009092169015157fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ff161761010091909216021790555182907fabca9b7986bc22ad0160eb0cb88ae75411eacfba4052af0b457a9335ef65572290612bc59088908890615266565b60405180910390a26040516002907fea8787f128d10b2cc0317b0c3960f9ad447f7f6c1ed189db1083ccffd20f456e90600090a25050505050565b6001546040517f16bf5579000000000000000000000000000000000000000000000000000000008152600481018390526000916001600160a01b0316906316bf557990602401602060405180830381865afa158015612c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c879190614f64565b92915050565b600a5460009067ffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000115612cdf576000612cd0600c85613950565b9050612cdb8161399f565b9150505b612ce98184615295565b9392505050565b826000805a3360009081526003602052604090205490915060ff16158015612d2357506002546001600160a01b03163314155b15612d4157604051632dd9fc9760e01b815260040160405180910390fd5b612d4a8761345a565b15612d6857604051630e5da8fb60e01b815260040160405180910390fd5b611bdb8a8a8a8a898960006136f9565b600080600080600080600080612d8c6139cf565b67ffffffffffffffff9384169b50918316995082169750169450505050505b90919293565b6000548611612dec576040517f7d73e6fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612e228684612e006020890189614eb3565b612e1060408a0160208b01614eb3565b612e1b60018d615178565b8988613a46565b600a5490915067ffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000115612e9357612e70612e686020880188614eb3565b600c90613aeb565b600c54612e869067ffffffffffffffff1661399f565b67ffffffffffffffff1690505b4381612ea26020890189614eb3565b67ffffffffffffffff16612eb69190614f93565b10612eed576040517fad3515d900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006001891115612f76576001546001600160a01b031663d5719dc2612f1460028c615178565b6040518263ffffffff1660e01b8152600401612f3291815260200190565b602060405180830381865afa158015612f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f739190614f64565b90505b60408051602080820184905281830186905282518083038401815260609092019092528051910120600180546001600160a01b03169063d5719dc290612fbc908d615178565b6040518263ffffffff1660e01b8152600401612fda91815260200190565b602060405180830381865afa158015612ff7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301b9190614f64565b14613052576040517f13947fd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008061305e8b613b71565b9150915060008b90506000600160009054906101000a90046001600160a01b03166001600160a01b0316635fca4a166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e09190614f64565b90508060008080806130f58988838880613bb6565b93509350935093508083857f7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7856000548d600260405161313894939291906152d3565b60405180910390a4505050505050505050505050505050505050565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f051038f2000000000000000000000000000000000000000000000000000000001790529051600091829182916064916131c0919061536c565b600060405180830381855afa9150503d80600081146131fb576040519150601f19603f3d011682016040523d82523d6000602084013e613200565b606091505b5091509150818015613213575080516020145b9250505090565b7f000000000000000000000000000000000000000000000000000000000000000161325857604051631192b39960e31b815260040160405180910390fd5b61326181613d73565b613297576040517fda1c8eb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c5467ffffffffffffffff1615806132c357506020810151600c5467ffffffffffffffff9182169116115b156132ef576020810151600c805467ffffffffffffffff191667ffffffffffffffff9092169190911790555b8051600c5467ffffffffffffffff9182169116101561332c578051600c805467ffffffffffffffff191667ffffffffffffffff9092169190911790555b602081810151600c805484517fffffffffffffffff00000000000000000000000000000000ffffffffffffffff9091166801000000000000000067ffffffffffffffff948516027fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff1617600160801b91841691909102179055604080840151600d805467ffffffffffffffff1916919093161790915560005460015482517feca067ad000000000000000000000000000000000000000000000000000000008152925191936001600160a01b039091169263eca067ad92600480830193928290030181865afa158015613423573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134479190614f64565b0361345757613457600c43613aeb565b50565b60007f0000000000000000000000000000000000000000000000000000000000000001801561348a575060005482115b8015612c87575061349b600c613ddb565b1592915050565b60008060006134b086613e0e565b9250925092506000806000806134ca878b60008c8c613bb6565b93509350935093508a84141580156134e457506000198b14155b15613525576040517fac7411c900000000000000000000000000000000000000000000000000000000815260048101859052602481018c9052604401610978565b80838c7f7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7856000548b600360405161356094939291906152d3565b60405180910390a47f0000000000000000000000000000000000000000000000000000000000000001156135c0576040517f86657a5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6135c86135d9565b15611245576112458785488861403d565b60003332148015610aea575050333b1590565b6000548211156136f557613600600c61438f565b156136f557600154600080546040517fd5719dc200000000000000000000000000000000000000000000000000000000815291926001600160a01b03169163d5719dc2916136549160040190815260200190565b602060405180830381865afa158015613671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136959190614f64565b90506136aa81836000015184602001516143c0565b6136e0576040517fc334542d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208201516040015161238a90600c90613aeb565b5050565b600080613707888888614405565b9150915060008060008061372b868b89613722576000613724565b8d5b8c8c613bb6565b93509350935093508c841415801561374557506000198d14155b15613786576040517fac7411c900000000000000000000000000000000000000000000000000000000815260048101859052602481018e9052604401610978565b8083857f7394f4a19a13c7b92b5bb71033245305946ef78452f7b4986ac1390b5df4ebd7856000548a8d6137bb5760016137be565b60005b6040516137ce94939291906152d3565b60405180910390a486611e3057837ffe325ca1efe4c5c1062c981c3ee74b781debe4ea9440306a96d2a55759c66c208d8d60405161380d929190615266565b60405180910390a250505050505050505050505050565b805167ffffffffffffffff10806138465750602081015167ffffffffffffffff105b8061385c5750604081015167ffffffffffffffff105b806138725750606081015167ffffffffffffffff105b156138a9576040517f09cfba7500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051600a80546020840151604085015160609095015167ffffffffffffffff908116600160c01b0277ffffffffffffffffffffffffffffffffffffffffffffffff968216600160801b02969096166fffffffffffffffffffffffffffffffff92821668010000000000000000027fffffffffffffffffffffffffffffffff000000000000000000000000000000009094169190951617919091171691909117919091179055565b81546001830154600091612ce99167ffffffffffffffff600160c01b8304811692868216928282169268010000000000000000808304821693600160801b810483169391900482169116614613565b600a5460009067ffffffffffffffff908116908316106139cb57600a5467ffffffffffffffff16612c87565b5090565b6000808080467f000000000000000000000000000000000000000000000000000000000000a4b114613a0c57506001925082915081905080612dab565b5050600a5467ffffffffffffffff808216935068010000000000000000820481169250600160801b8204811691600160c01b900416612dab565b6040516001600160f81b031960f889901b1660208201526bffffffffffffffffffffffff19606088901b1660218201527fffffffffffffffff00000000000000000000000000000000000000000000000060c087811b8216603584015286901b16603d82015260458101849052606581018390526085810182905260009060a5016040516020818303038152906040528051906020012090505b979650505050505050565b613af58282613950565b825467ffffffffffffffff928316600160c01b0277ffffffffffffffffffffffffffffffff000000000000000090911691831691909117178255600190910180544390921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055565b6040805160808101825260008082526020820181905291810182905260608101829052600080613ba0856146da565b8151602090920191909120969095509350505050565b600080600080600054881015613bf8576040517f7d73e6fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160009054906101000a90046001600160a01b03166001600160a01b031663eca067ad6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c6f9190614f64565b881115613ca8576040517f925f8bd300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001546040517f86598a56000000000000000000000000000000000000000000000000000000008152600481018b9052602481018a905260448101889052606481018790526001600160a01b03909116906386598a56906084016080604051808303816000875af1158015613d21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d459190615388565b60008c9055929650909450925090508615613d6757613d67898548600061403d565b95509550955095915050565b805160009067ffffffffffffffff1615801590613d9d5750602082015167ffffffffffffffff1615155b8015613db95750612710826040015167ffffffffffffffff1611155b8015612c875750506020810151905167ffffffffffffffff9182169116111590565b805460009067ffffffffffffffff600160801b8204811691613e0691600160c01b9091041643615178565b111592915050565b60408051608081018252600080825260208201819052918101829052606081018290526000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e83a2d826040518163ffffffff1660e01b8152600401600060405180830381865afa158015613e92573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613eba91908101906150d2565b90508051600003613ef7576040517f3cd27eb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080613f03876146da565b9150915060008351620200007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631f6d6ef76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f919190614f64565b613f9b91906150bb565b613fa591906150bb565b60405190915083907f500000000000000000000000000000000000000000000000000000000000000090613fdd9087906020016153be565b60408051601f1981840301815290829052613ffc9392916020016153f4565b60405160208183030381529060405280519060200120826000481161402257600061402c565b61402c4884614fa6565b965096509650505050509193909250565b600e546001600160a01b03167f0000000000000000000000000000000000000000000000000000000000000000801561407d57506001600160a01b038116155b156140885750614389565b327f00000000000000000000000000000000000000000000000000000000000000011561412e576000606c6001600160a01b031663c6f7de0e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156140f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141149190614f64565b90506141204882614fa6565b61412a9085614f93565b9350505b67ffffffffffffffff831115614170576040517f04d5501200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000080156141a557506001600160a01b03821615155b15614233576000826001600160a01b031663e6aa216c6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156141ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142109190614f64565b9050670de0b6b3a764000061422582876150bb565b61422f9190614fa6565b9450505b604080514260208201526bffffffffffffffffffffffff19606084901b16918101919091526054810187905260748101869052609481018590527fffffffffffffffff00000000000000000000000000000000000000000000000060c085901b1660b482015260009060bc0160408051808303601f1901815290829052600154815160208301207f7a88b1070000000000000000000000000000000000000000000000000000000084526001600160a01b0386811660048601526024850191909152919350600092911690637a88b107906044016020604051808303816000875af1158015614326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061434a9190614f64565b9050807fff64905f73a67fb594e0f940a8075a860db489ad991e032f48c81123eb52d60b8360405161437c9190615437565b60405180910390a2505050505b50505050565b600061439a82613ddb565b1580612c875750505467ffffffffffffffff680100000000000000008204811691161090565b60006143fb836143cf846147b2565b604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b9093149392505050565b60408051608081018252600080825260208201819052918101829052606081018290526000614435856028614f93565b90507f00000000000000000000000000000000000000000000000000000000000199998111156144ba576040517f4634691b000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000000000000000000000000000000000000000199996024820152604401610978565b6000806144c6866146da565b909250905086156145d9576144f6888860008181106144e7576144e76152bd565b9050013560f81c60f81b6147df565b61454e578787600081811061450d5761450d6152bd565b6040517f6b3333560000000000000000000000000000000000000000000000000000000081529201356001600160f81b031916600483015250602401610978565b600160ff1b8888600081614564576145646152bd565b6001600160f81b031992013592909216161580159150614585575060218710155b156145d957600061459a602160018a8c61546a565b6145a391615494565b60008181526008602052604090205490915060ff166145d75760405162f20c5d60e01b815260048101829052602401610978565b505b8188886040516020016145ee939291906154b2565b60408051601f1981840301815291905280516020909101209890975095505050505050565b60008088881161462457600061462e565b61462e8989615178565b9050600089871161464057600061464a565b61464a8a88615178565b905061271061465985846150bb565b6146639190614fa6565b61466d9089614f93565b9750600086821161467f576000614689565b6146898783615178565b9050828111156146965750815b808911156146cb576146a8818a615178565b9850868911156146cb578589116146bf57886146c1565b855b9350505050613ae0565b50949998505050505050505050565b60408051608081018252600080825260208201819052918101829052606080820183905291614707614872565b9050600081600001518260200151836040015184606001518860405160200161478795949392919060c095861b7fffffffffffffffff000000000000000000000000000000000000000000000000908116825294861b8516600882015292851b8416601084015290841b8316601883015290921b16602082015260280190565b604051602081830303815290604052905060288151146147a9576147a96154da565b94909350915050565b6000612c87826000015183602001518460400151856060015186608001518760a001518860c00151613a46565b60006001600160f81b03198216158061480557506001600160f81b03198216600160ff1b145b8061483957506001600160f81b031982167f8800000000000000000000000000000000000000000000000000000000000000145b80612c8757506001600160f81b031982167f20000000000000000000000000000000000000000000000000000000000000001492915050565b6040805160808101825260008082526020820181905291810182905260608101919091526040805160808101825260008082526020820181905291810182905260608101919091526000806000806148c86139cf565b93509350935093508167ffffffffffffffff164211156148f9576148ec82426154f0565b67ffffffffffffffff1685525b6149038142615295565b67ffffffffffffffff908116602087015284164311156149375761492784436154f0565b67ffffffffffffffff1660408601525b6149418343615295565b67ffffffffffffffff1660608601525092949350505050565b6001600160a01b038116811461345757600080fd5b60006020828403121561498157600080fd5b8135612ce98161495a565b60006020828403121561499e57600080fd5b5035919050565b801515811461345757600080fd5b600080604083850312156149c657600080fd5b82356149d18161495a565b915060208301356149e1816149a5565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715614a2557614a256149ec565b60405290565b60405160e0810167ffffffffffffffff81118282101715614a2557614a256149ec565b604051601f8201601f1916810167ffffffffffffffff81118282101715614a7757614a776149ec565b604052919050565b803567ffffffffffffffff81168114614a9757600080fd5b919050565b600060608284031215614aae57600080fd5b6040516060810181811067ffffffffffffffff82111715614ad157614ad16149ec565b604052905080614ae083614a7f565b8152614aee60208401614a7f565b6020820152614aff60408401614a7f565b60408201525092915050565b600060608284031215614b1d57600080fd5b612ce98383614a9c565b600080600080600060a08688031215614b3f57600080fd5b85359450602086013593506040860135614b588161495a565b94979396509394606081013594506080013592915050565b60008083601f840112614b8257600080fd5b50813567ffffffffffffffff811115614b9a57600080fd5b602083019150836020828501011115614bb257600080fd5b9250929050565b60006101008284031215614bcc57600080fd5b50919050565b6000806000806000806000806101c0898b031215614bef57600080fd5b88359750602089013567ffffffffffffffff811115614c0d57600080fd5b614c198b828c01614b70565b909850965050604089013594506060890135614c348161495a565b93506080890135925060a08901359150614c518a60c08b01614bb9565b90509295985092959890939650565b600080600080600060808688031215614c7857600080fd5b85359450602086013567ffffffffffffffff811115614c9657600080fd5b614ca288828901614b70565b909550935050604086013591506060860135614cbd8161495a565b809150509295509295909350565b600080600080600080600060c0888a031215614ce657600080fd5b87359650602088013567ffffffffffffffff811115614d0457600080fd5b614d108a828b01614b70565b909750955050604088013593506060880135614d2b8161495a565b969995985093969295946080840135945060a09093013592915050565b6000806000806000806101a08789031215614d6257600080fd5b86359550602087013594506040870135614d7b8161495a565b93506060870135925060808701359150614d988860a08901614bb9565b90509295509295509295565b600080600080848603610120811215614dbc57600080fd5b8535614dc78161495a565b94506080601f1982011215614ddb57600080fd5b50602085019250614def8660a08701614a9c565b9150610100850135614e008161495a565b939692955090935050565b600060808284031215614e1d57600080fd5b6040516080810181811067ffffffffffffffff82111715614e4057614e406149ec565b8060405250823581526020830135602082015260408301356040820152606083013560608201528091505092915050565b60008060208385031215614e8457600080fd5b823567ffffffffffffffff811115614e9b57600080fd5b614ea785828601614b70565b90969095509350505050565b600060208284031215614ec557600080fd5b612ce982614a7f565b803560ff81168114614a9757600080fd5b60008060008060008060e08789031215614ef857600080fd5b86359550614f0860208801614ece565b94506080870188811115614f1b57600080fd5b60408801945035925060a0870135614f328161495a565b8092505060c087013590509295509295509295565b600060208284031215614f5957600080fd5b8151612ce98161495a565b600060208284031215614f7657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115612c8757612c87614f7d565b600082614fc357634e487b7160e01b600052601260045260246000fd5b500490565b600181815b80851115615003578160001904821115614fe957614fe9614f7d565b80851615614ff657918102915b93841c9390800290614fcd565b509250929050565b60008261501a57506001612c87565b8161502757506000612c87565b816001811461503d576002811461504757615063565b6001915050612c87565b60ff84111561505857615058614f7d565b50506001821b612c87565b5060208310610133831016604e8410600b8410161715615086575081810a612c87565b6150908383614fc8565b80600019048211156150a4576150a4614f7d565b029392505050565b6000612ce960ff84168361500b565b8082028115828204841417612c8757612c87614f7d565b600060208083850312156150e557600080fd5b825167ffffffffffffffff808211156150fd57600080fd5b818501915085601f83011261511157600080fd5b815181811115615123576151236149ec565b8060051b9150615134848301614a4e565b818152918301840191848101908884111561514e57600080fd5b938501935b8385101561516c57845182529385019390850190615153565b98975050505050505050565b81810381811115612c8757612c87614f7d565b60006020828403121561519d57600080fd5b8151612ce9816149a5565b60008183036101008112156151bc57600080fd5b6151c4614a02565b8335815260e0601f19830112156151da57600080fd5b6151e2614a2b565b91506151f060208501614ece565b825260408401356152008161495a565b602083015261521160608501614a7f565b604083015261522260808501614a7f565b606083015260a0840135608083015260c084013560a083015260e084013560c0830152816020820152809250505092915050565b8183823760009101908152919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b67ffffffffffffffff8181168382160190808211156152b6576152b6614f7d565b5092915050565b634e487b7160e01b600052603260045260246000fd5b600060e08201905085825284602083015267ffffffffffffffff8085511660408401528060208601511660608401528060408601511660808401528060608601511660a0840152506004831061533957634e487b7160e01b600052602160045260246000fd5b8260c083015295945050505050565b60005b8381101561536357818101518382015260200161534b565b50506000910152565b6000825161537e818460208701615348565b9190910192915050565b6000806000806080858703121561539e57600080fd5b505082516020840151604085015160609095015191969095509092509050565b815160009082906020808601845b838110156153e8578151855293820193908201906001016153cc565b50929695505050505050565b60008451615406818460208901615348565b6001600160f81b03198516908301908152835161542a816001840160208801615348565b0160010195945050505050565b6020815260008251806020840152615456816040850160208701615348565b601f01601f19169190910160400192915050565b6000808585111561547a57600080fd5b8386111561548757600080fd5b5050820193919092039150565b80356020831015612c8757600019602084900360031b1b1692915050565b600084516154c4818460208901615348565b8201838582376000930192835250909392505050565b634e487b7160e01b600052600160045260246000fd5b67ffffffffffffffff8281168282160390808211156152b6576152b6614f7d56fea26469706673582212206610ccdd5a5a7e68d327d0ef40009a9ecf999cf5ddde22a0d0560b27b94fa98664736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000019999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _maxDataSize (uint256): 104857
Arg [1] : reader4844_ (address): 0x0000000000000000000000000000000000000000
Arg [2] : _isUsingFeeToken (bool): False
Arg [3] : _isDelayBufferable (bool): True
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000019999
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.