Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- PreconfWhitelist
- Optimization enabled
- true
- Compiler version
- v0.8.30+commit.73712a01
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2026-08-26T14:03:10.957383Z
Constructor Arguments
0x0000000000000000000000004779d18931b35540f84b0cd0e9633855b84df7b8
Arg [0] (address) : 0x4779d18931b35540f84b0cd0e9633855b84df7b8
contracts/layer1/preconf/impl/PreconfWhitelist.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "../iface/IPreconfWhitelist.sol";
import "../libs/LibPreconfConstants.sol";
import "../libs/LibPreconfUtils.sol";
import "src/layer1/core/iface/IProposerChecker.sol";
import "src/shared/common/EssentialContract.sol";
import "./PreconfWhitelist_Layout.sol"; // DO NOT DELETE
/// @title PreconfWhitelist
/// @custom:security-contact security@taiko.xyz
contract PreconfWhitelist is EssentialContract, IPreconfWhitelist, IProposerChecker {
struct OperatorInfo {
uint32 activeSince; // Epoch when the operator becomes active.
uint32 deprecatedInactiveSince; // Deprecated. Kept for storage compatibility.
uint8 index; // Index in operatorMapping.
address sequencerAddress; // Sequencer address for this operator (for off-chain use).
}
// ---------------------------------------------------------------
// Constants
// ---------------------------------------------------------------
/// @dev The number of epochs before a newly added operator becomes active.
uint8 public constant OPERATOR_CHANGE_DELAY = 2;
/// @dev The number of epochs to use as delay when selecting an operator.
/// This needs to be 2 epochs or more to ensure the randomness seed source is stable
/// across epochs.
uint8 public constant RANDOMNESS_DELAY = 2;
// ---------------------------------------------------------------
// Immutable Variables
// ---------------------------------------------------------------
/// @dev Address authorized to manage ejecters alongside the owner.
address internal immutable _ejectorManager;
// ---------------------------------------------------------------
// State Variables
// ---------------------------------------------------------------
/// @dev An operator consists of a proposer address(the key to this mapping) and a sequencer
/// address.
/// The proposer address is their main identifier and is used on-chain to identify the
/// operator and decide if they are allowed to propose.
/// The sequencer address is used off-chain to identify the address that is emitting
/// preconfirmations.
/// NOTE: These two addresses may be the same, it is up to the operator to decide.
mapping(address proposer => OperatorInfo info) public operators;
mapping(uint256 index => address proposer) public operatorMapping;
/// @notice The total number of operators in the whitelist.
/// This includes both active and inactive operators.
uint8 public operatorCount;
/// @dev Deprecated variable. Kept for storage compatibility.
uint8 private _deprecatedOperatorChangeDelay;
/// @dev Deprecated variable. Kept for storage compatibility.
uint8 private _deprecatedRandomnessDelay;
/// @dev Deprecated variable. Kept for storage compatibility.
bool private _deprecatedHavingPerfectOperators;
/// @notice The epoch when the latest operator was or will be activated.
/// @dev No need to reinitialize the contract, this value starts at 0
/// (i.e. no pending activations)
uint32 public latestActivationEpoch;
/// @dev The addresses that can eject operators from the whitelist.
mapping(address ejecter => bool isEjecter) public ejecters;
uint256[45] private __gap;
modifier onlyOwnerOrEjecter() {
require(msg.sender == owner() || ejecters[msg.sender], NotOwnerOrEjecter());
_;
}
modifier onlyOwnerOrEjectorManager() {
require(msg.sender == owner() || msg.sender == _ejectorManager, NotOwnerOrEjectorManager());
_;
}
/// @notice Initializes immutable role configuration for ejecter management.
/// @param _ejectorManagerAddress Address authorized to manage ejecters.
constructor(address _ejectorManagerAddress) {
require(_ejectorManagerAddress != address(0), InvalidEjectorManager());
_ejectorManager = _ejectorManagerAddress;
}
function init(address _owner) external initializer {
__Essential_init(_owner);
}
/// @inheritdoc IPreconfWhitelist
/// @dev The operator only becomes active after `OPERATOR_CHANGE_DELAY` epochs.
function addOperator(address _proposer, address _sequencer) external onlyOwnerOrEjecter {
_addOperator(_proposer, _sequencer);
}
/// @inheritdoc IPreconfWhitelist
/// @dev IMPORTANT: The operator is removed immediately
function removeOperator(uint256 _operatorIndex) external onlyOwnerOrEjecter {
require(_operatorIndex < operatorCount, InvalidOperatorIndex());
_removeOperator(operatorMapping[_operatorIndex]);
}
/// @notice Removes an operator by proposer address, keeping the index mapping densely packed.
/// IMPORTANT: The operator is removed immediately
/// @param _proposer The proposer address of the operator to remove.
function removeOperatorByAddress(address _proposer) external onlyOwnerOrEjecter {
_removeOperator(_proposer);
}
/// @notice Sets the ejecter address.
/// @param _ejecter The new ejecter address.
/// @param _isEjecter Whether the address should be treated as an ejecter.
function setEjecter(
address _ejecter,
bool _isEjecter
)
external
onlyOwnerOrEjectorManager
{
ejecters[_ejecter] = _isEjecter;
emit EjecterUpdated(_ejecter, _isEjecter);
}
/// @inheritdoc IProposerChecker
function checkProposer(
address _proposer,
bytes calldata
)
external
view
override(IProposerChecker)
returns (uint48 endOfSubmissionWindowTimestamp_)
{
address operator = _getOperatorForEpoch(epochStartTimestamp(0));
require(operator != address(0), InvalidProposer());
require(operator == _proposer, InvalidProposer());
// Slashing is not enabled for whitelisted preconfers, so we return 0
endOfSubmissionWindowTimestamp_ = 0;
}
/// @inheritdoc IPreconfWhitelist
function getOperatorForCurrentEpoch() public view returns (address) {
return _getOperatorForEpoch(epochStartTimestamp(0));
}
/// @inheritdoc IPreconfWhitelist
function getOperatorForNextEpoch() external view returns (address) {
return _getOperatorForEpoch(epochStartTimestamp(1));
}
/// @notice Returns true if the operator is active in the given epoch.
/// @param _proposer The proposer address of the operator to check.
/// @param _epochTimestamp The timestamp of the epoch to check.
/// @return _ True if the operator is active in the given epoch, false otherwise.
function isOperatorActive(
address _proposer,
uint32 _epochTimestamp
)
public
view
returns (bool)
{
unchecked {
OperatorInfo storage info = operators[_proposer];
uint32 activeSince = info.activeSince;
return activeSince != 0 && _epochTimestamp >= activeSince;
}
}
/// @notice Returns the timestamp of the epoch start with the given offset
/// @param _offset The offset from the current epoch start.
/// @return The timestamp of the epoch start with the given offset.
function epochStartTimestamp(uint256 _offset) public view returns (uint32) {
return uint32(
LibPreconfUtils.getEpochTimestamp() + _offset * LibPreconfConstants.SECONDS_IN_EPOCH
);
}
/// @dev Checks if there is another active operator excluding the given operator
/// @param _excluded The proposer address of the operator to exclude.
/// @param _epochTimestamp The timestamp of the epoch to check.
/// @return True if there is another active operator, false otherwise.
function _hasAnotherActiveOperator(
address _excluded,
uint32 _epochTimestamp
)
internal
view
returns (bool)
{
uint8 _operatorCount = operatorCount;
for (uint8 i; i < _operatorCount; ++i) {
address operator = operatorMapping[i];
if (operator == _excluded) continue;
if (isOperatorActive(operator, _epochTimestamp)) return true;
}
return false;
}
/// @dev Adds an operator to the whitelist.
/// NOTE: The operator only becomes active after `OPERATOR_CHANGE_DELAY` epochs.
/// @param _proposer The proposer address of the operator to add.
/// @param _sequencer The sequencer address of the operator to add.
function _addOperator(address _proposer, address _sequencer) internal {
require(_proposer != address(0), InvalidOperatorAddress());
require(_sequencer != address(0), InvalidOperatorAddress());
OperatorInfo storage info = operators[_proposer];
// if they're already active, just revert
if (info.activeSince != 0) {
revert OperatorAlreadyExists();
}
uint32 activeSince = epochStartTimestamp(OPERATOR_CHANGE_DELAY);
uint8 idx = operatorCount;
info.index = idx;
operatorMapping[idx] = _proposer;
operatorCount = idx + 1;
info.activeSince = activeSince;
info.sequencerAddress = _sequencer;
latestActivationEpoch = activeSince;
emit OperatorAdded(_proposer, _sequencer, activeSince);
}
/// @dev Removes an operator immediately and backfills its slot with the last proposer so
/// operatorMapping stays packed from 0..operatorCount-1.
/// IMPORTANT: Reverts if no other operator is active.
/// @param _proposer The proposer address of the operator to remove.
function _removeOperator(address _proposer) internal {
require(operatorCount > 1, CannotRemoveLastOperator());
require(_proposer != address(0), InvalidOperatorAddress());
OperatorInfo storage info = operators[_proposer];
require(info.sequencerAddress != address(0), InvalidOperatorAddress());
uint32 currentEpochTs = epochStartTimestamp(0);
if (isOperatorActive(_proposer, currentEpochTs)) {
require(
_hasAnotherActiveOperator(_proposer, currentEpochTs), NoActiveOperatorRemaining()
);
}
address sequencer = info.sequencerAddress;
uint8 index = info.index;
uint8 lastIndex = operatorCount - 1;
if (index != lastIndex) {
address lastProposer = operatorMapping[lastIndex];
operatorMapping[index] = lastProposer;
operators[lastProposer].index = index;
}
delete operatorMapping[lastIndex];
delete operators[_proposer];
operatorCount = lastIndex;
emit OperatorRemoved(_proposer, sequencer, block.timestamp);
}
/// @dev Returns the operator for the given epoch
/// This function is not affected by operators that are added mid-epoch, since it filters
/// active ones.
/// NOTE: We optimize for the common case where all operators are active.
/// In that case we don't scan the entire operator set or check if the operator is active.
/// @param _epochTimestamp The timestamp of the epoch to get the operator for.
/// @return The operator for the given epoch.
function _getOperatorForEpoch(uint32 _epochTimestamp) internal view returns (address) {
unchecked {
// Get epoch-stable randomness with a delayed applied. This avoids querying future
// beacon roots.
uint256 delaySeconds = RANDOMNESS_DELAY * LibPreconfConstants.SECONDS_IN_EPOCH;
uint256 ts = uint256(_epochTimestamp);
uint32 randomnessTs = uint32(ts >= delaySeconds ? ts - delaySeconds : ts);
// One SLOAD
uint256 _operatorCount = operatorCount;
uint32 _latestActivationEpoch = latestActivationEpoch;
if (_operatorCount == 0) return address(0);
uint256 randomNumber = _getRandomNumber(randomnessTs);
if (_epochTimestamp >= _latestActivationEpoch) {
// Fast path: This means all operators are active, so we can just select one without
// checking
return operatorMapping[randomNumber % _operatorCount];
}
// Slow path: We need to check which operators are active
address[] memory candidates = new address[](_operatorCount);
uint256 count;
for (uint256 i; i < _operatorCount; ++i) {
address operator = operatorMapping[i];
if (isOperatorActive(operator, _epochTimestamp)) {
candidates[count++] = operator;
}
}
if (count == 0) return address(0);
return candidates[randomNumber % count];
}
}
function _getRandomNumber(uint32 _epochTimestamp) internal view returns (uint256) {
// Get the beacon root at the epoch start - this stays constant throughout the epoch
bytes32 beaconRoot = LibPreconfUtils.getBeaconBlockRootAtOrAfter(_epochTimestamp);
return uint256(beaconRoot);
}
// ---------------------------------------------------------------
// Errors
// ---------------------------------------------------------------
error CannotRemoveLastOperator();
error InvalidOperatorIndex();
error InvalidOperatorAddress();
error InvalidEjectorManager();
error OperatorAlreadyExists();
error NoActiveOperatorRemaining();
error NotOwnerOrEjecter();
error NotOwnerOrEjectorManager();
}
contracts/layer1/core/iface/IProposerChecker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title IProposerChecker
/// @notice Interface for checking if an address is authorized to propose blocks
/// @custom:security-contact security@taiko.xyz
interface IProposerChecker {
error InvalidProposer();
/// @notice Checks if an address is a valid proposer
/// @param _proposer The address to check
/// @param _lookaheadData Encoded lookahead metadata used by preconf-aware proposer checkers.
/// @return endOfSubmissionWindowTimestamp_ The timestamp of the last slot where the current
/// preconfer can propose.
/// @dev This function must revert if the address is not a valid proposer
function checkProposer(
address _proposer,
bytes calldata _lookaheadData
)
external
returns (uint48 endOfSubmissionWindowTimestamp_);
}
contracts/layer1/preconf/iface/IPreconfWhitelist.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title IPreconfWhitelist
/// @custom:security-contact security@taiko.xyz
interface IPreconfWhitelist {
/// @notice Emitted when a new operator is added to the whitelist.
/// @param proposer The proposer address of the operator that was added.
/// @param sequencer The sequencer address of the operator that was added.
/// @param activeSince The timestamp when the operator became active.
event OperatorAdded(address indexed proposer, address indexed sequencer, uint256 activeSince);
/// @notice Emitted when an operator is removed from the whitelist.
/// @param proposer The proposer address of the operator that was removed.
/// @param sequencer The sequencer address of the operator that was removed.
/// @param inactiveSince The timestamp when the operator became inactive.
event OperatorRemoved(
address indexed proposer, address indexed sequencer, uint256 inactiveSince
);
/// @notice Emitted when an ejecter is updated.
/// @param ejecter The address of the ejecter.
/// @param isEjecter Whether the address is an ejecter.
event EjecterUpdated(address indexed ejecter, bool isEjecter);
/// @notice Adds a new operator to the whitelist.
/// @param _proposer The proposer address of the operator to be added.
/// @param _sequencer The sequencer address of the operator to be added.
/// @dev Only callable by the owner or an authorized address.
function addOperator(address _proposer, address _sequencer) external;
/// @notice Removes an operator from the whitelist.
/// @param _operatorId The ID of the operator to be removed.
/// @dev Only callable by the owner or an authorized address.
/// @dev Reverts if the operator ID does not exist.
function removeOperator(uint256 _operatorId) external;
/// @notice Retrieves the address of the operator for the current epoch.
/// @dev Uses the beacon block root of the first block in the last epoch as the source
/// of randomness.
/// @return The address of the operator.
function getOperatorForCurrentEpoch() external view returns (address);
/// @notice Retrieves the address of the operator for the next epoch.
/// @dev Uses the beacon block root of the first block in the current epoch as the source
/// of randomness.
/// @return The address of the operator.
function getOperatorForNextEpoch() external view returns (address);
}
contracts/layer1/preconf/impl/PreconfWhitelist_Layout.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
/// @title PreconfWhitelistLayout
/// @notice Storage layout documentation for PreconfWhitelist
/// @dev This file is auto-generated by gen-layouts.sh. DO NOT EDIT MANUALLY.
/// @custom:security-contact security@taiko.xyz
// solhint-disable max-line-length
// _initialized | uint8 | Slot: 0 | Offset: 0 | Bytes: 1
// _initializing | bool | Slot: 0 | Offset: 1 | Bytes: 1
// __gap | uint256[50] | Slot: 1 | Offset: 0 | Bytes: 1600
// _owner | address | Slot: 51 | Offset: 0 | Bytes: 20
// __gap | uint256[49] | Slot: 52 | Offset: 0 | Bytes: 1568
// _pendingOwner | address | Slot: 101 | Offset: 0 | Bytes: 20
// __gap | uint256[49] | Slot: 102 | Offset: 0 | Bytes: 1568
// __gapFromOldAddressResolver | uint256[50] | Slot: 151 | Offset: 0 | Bytes: 1600
// __reentry | uint8 | Slot: 201 | Offset: 0 | Bytes: 1
// __paused | uint8 | Slot: 201 | Offset: 1 | Bytes: 1
// __gap | uint256[49] | Slot: 202 | Offset: 0 | Bytes: 1568
// operators | mapping(address => struct PreconfWhitelist.OperatorInfo) | Slot: 251 | Offset: 0 | Bytes: 32
// operatorMapping | mapping(uint256 => address) | Slot: 252 | Offset: 0 | Bytes: 32
// operatorCount | uint8 | Slot: 253 | Offset: 0 | Bytes: 1
// _deprecatedOperatorChangeDelay | uint8 | Slot: 253 | Offset: 1 | Bytes: 1
// _deprecatedRandomnessDelay | uint8 | Slot: 253 | Offset: 2 | Bytes: 1
// _deprecatedHavingPerfectOperators | bool | Slot: 253 | Offset: 3 | Bytes: 1
// latestActivationEpoch | uint32 | Slot: 253 | Offset: 4 | Bytes: 4
// ejecters | mapping(address => bool) | Slot: 254 | Offset: 0 | Bytes: 32
// __gap | uint256[45] | Slot: 255 | Offset: 0 | Bytes: 1440
contracts/layer1/preconf/libs/LibPreconfConstants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "src/shared/libs/LibNetwork.sol";
/// @title LibPreconfConstants
/// @custom:security-contact security@taiko.xyz
library LibPreconfConstants {
/// @dev https://eips.ethereum.org/EIPS/eip-4788 enforce to use this address across different
/// EVM chains.
address internal constant BEACON_BLOCK_ROOT_CONTRACT =
0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02;
uint256 internal constant ETHEREUM_MAINNET_BEACON_GENESIS = 1_606_824_023;
uint256 internal constant ETHEREUM_HOLESKY_BEACON_GENESIS = 1_695_902_400;
uint256 internal constant ETHEREUM_HELDER_BEACON_GENESIS = 1_718_967_660;
uint256 internal constant ETHEREUM_HOODI_BEACON_GENESIS = 1_742_213_400;
uint256 internal constant SECONDS_IN_SLOT = 12;
uint256 internal constant SECONDS_IN_EPOCH = SECONDS_IN_SLOT * 32;
uint256 internal constant TWO_EPOCHS = 2 * SECONDS_IN_EPOCH;
uint256 internal constant DISPUTE_PERIOD = 2 * SECONDS_IN_EPOCH;
uint256 internal constant RANDOMNESS_DELAY_EPOCHS = 2;
bytes32 internal constant PRECONF_DOMAIN_SEPARATOR = keccak256("TAIKO_ALETHIA_PRECONF");
function getGenesisTimestamp(uint256 _chainid) internal pure returns (uint256) {
if (_chainid == LibNetwork.ETHEREUM_MAINNET) {
return ETHEREUM_MAINNET_BEACON_GENESIS;
} else if (_chainid == LibNetwork.ETHEREUM_HOLESKY) {
return ETHEREUM_HOLESKY_BEACON_GENESIS;
} else if (_chainid == LibNetwork.ETHEREUM_HELDER) {
return ETHEREUM_HELDER_BEACON_GENESIS;
} else if (_chainid == LibNetwork.ETHEREUM_HOODI) {
return ETHEREUM_HOODI_BEACON_GENESIS;
}
return uint256(0);
}
}
contracts/layer1/preconf/libs/LibPreconfUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "./LibPreconfConstants.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";
/// @title LibPreconfUtils
/// @custom:security-contact security@taiko.xyz
library LibPreconfUtils {
using SafeCastUpgradeable for uint256;
uint256 private constant _MAX_QUERIES = 32;
/// @notice Retrieves the beacon block root that was posted to the execution layer at or after a
/// given timestamp.
/// @dev To obtain the block root of the Nth block, this function queries the root at block N +
/// 1. If block N + 1 is a missed slot, it continues querying up to 32 subsequent blocks (N + 2,
/// N + 3, etc.) until it finds a block that contains the root for the Nth block or the target
/// timestamp exceeds the current block timestamp.
/// @dev Caller should verify the returned value is not 0.
/// @param timestamp The timestamp for which the beacon block root is to be retrieved.
/// @return The beacon block root as a bytes32 value.
function getBeaconBlockRootAtOrAfter(uint256 timestamp) internal view returns (bytes32) {
if (timestamp < LibPreconfConstants.getGenesisTimestamp(block.chainid)) {
return bytes32(0);
}
timestamp = timestamp + LibPreconfConstants.SECONDS_IN_SLOT;
uint256 currentTimestamp = block.timestamp;
for (uint256 i; i < _MAX_QUERIES && timestamp <= currentTimestamp; ++i) {
bytes32 root = getBeaconBlockRootAt(timestamp);
if (root != 0) return root;
unchecked {
timestamp += LibPreconfConstants.SECONDS_IN_SLOT;
}
}
return bytes32(0);
}
/// @notice Retrieves the beacon block root at a specific timestamp.
/// @param timestamp The timestamp for which the beacon block root is to be retrieved.
/// @return root_ The beacon block root as a bytes32 value.
function getBeaconBlockRootAt(uint256 timestamp) internal view returns (bytes32 root_) {
(bool success, bytes memory result) =
LibPreconfConstants.BEACON_BLOCK_ROOT_CONTRACT.staticcall(abi.encode(timestamp));
if (success && result.length > 0) {
root_ = abi.decode(result, (bytes32));
}
}
/// @notice Calculates the timestamp of the current epoch based on the genesis timestamp.
/// @dev This function retrieves the genesis timestamp for the current chain ID, calculates
/// the time passed since the genesis, and determines the timestamp for the start of
/// the current epoch by rounding down to the nearest epoch boundary.
/// @return The timestamp of the current epoch.
function getEpochTimestamp() internal view returns (uint48) {
return getEpochTimestamp(0);
}
/// @notice Calculates the timestamp of a future epoch based on the genesis timestamp.
/// @param _epochOffset The offset from the current epoch.
/// @return The timestamp of the future epoch.
function getEpochTimestamp(uint256 _epochOffset) internal view returns (uint48) {
uint256 genesisTimestamp = LibPreconfConstants.getGenesisTimestamp(block.chainid);
uint256 timePassed = block.timestamp - genesisTimestamp;
/// forge-lint: disable-start(divide-before-multiply)
uint256 timePassedUptoCurrentEpoch = (timePassed / LibPreconfConstants.SECONDS_IN_EPOCH)
* LibPreconfConstants.SECONDS_IN_EPOCH;
/// forge-lint: disable-end
return (genesisTimestamp + timePassedUptoCurrentEpoch + _epochOffset
* LibPreconfConstants.SECONDS_IN_EPOCH).toUint48();
}
/// @notice Calculates the timestamp of the epoch containing the provided slot timestamp .
/// @param _slotTimestamp The timestamp of the slot.
/// @return The timestamp of the epoch.
function getEpochtimestampForSlot(uint256 _slotTimestamp) internal view returns (uint256) {
uint256 genesisTimestamp = LibPreconfConstants.getGenesisTimestamp(block.chainid);
uint256 timePassed = _slotTimestamp - genesisTimestamp;
uint256 timePassedUptoEpoch = (timePassed / LibPreconfConstants.SECONDS_IN_EPOCH)
* LibPreconfConstants.SECONDS_IN_EPOCH;
return genesisTimestamp + timePassedUptoEpoch;
}
}
contracts/shared/common/EssentialContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "./IResolver.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
/// @title EssentialContract
/// @custom:security-contact security@taiko.xyz
abstract contract EssentialContract is UUPSUpgradeable, Ownable2StepUpgradeable {
// ---------------------------------------------------------------
// Constants and Immutable Variables
// ---------------------------------------------------------------
uint8 internal constant _FALSE = 1;
uint8 internal constant _TRUE = 2;
/// @dev Transient-storage slot for the reentry lock: keccak256("ownerUUPS.reentry_slot") + 1.
/// The addition prevents collisions with EIP-1967-style slots (derived as keccak256(x) - 1)
/// and SignalService slots (derived directly as keccak256(x)).
bytes32 private constant _REENTRY_SLOT =
0xa5054f728453d3dbe953bdc43e4d0cb97e662ea32d7958190f3dc2da31d9721b;
address internal immutable __resolver;
// ---------------------------------------------------------------
// State Variables
// ---------------------------------------------------------------
uint256[50] private __gapFromOldAddressResolver;
/// @dev Slot 1. __reentry is deprecated: the reentry lock lives in transient storage
/// (_REENTRY_SLOT); the storage slot is retained only for layout compatibility.
uint8 private __reentry;
uint8 internal __paused;
uint256[49] private __gap;
// ---------------------------------------------------------------
// Events
// ---------------------------------------------------------------
/// @notice Emitted when the contract is paused.
/// @param account The account that paused the contract.
event Paused(address account);
/// @notice Emitted when the contract is unpaused.
/// @param account The account that unpaused the contract.
event Unpaused(address account);
error INVALID_PAUSE_STATUS();
error FUNC_NOT_IMPLEMENTED();
error REENTRANT_CALL();
error ACCESS_DENIED();
error ZERO_ADDRESS();
error ZERO_VALUE();
// ---------------------------------------------------------------
// Modifiers
// ---------------------------------------------------------------
/// @dev Modifier that ensures the caller is either the owner or a specified address.
/// @param _addr The address to check against.
modifier onlyFromOwnerOr(address _addr) {
_checkOwnerOr(_addr);
_;
}
/// @dev Modifier that reverts the function call, indicating it is not implemented.
modifier notImplemented() {
revert FUNC_NOT_IMPLEMENTED();
_;
}
/// @dev Modifier that prevents reentrant calls to a function.
modifier nonReentrant() {
_checkReentrancy();
_storeReentryLock(_TRUE);
_;
_storeReentryLock(_FALSE);
}
/// @dev Modifier that allows function execution only when the contract is paused.
modifier whenPaused() {
_checkPaused();
_;
}
/// @dev Modifier that allows function execution only when the contract is not paused.
modifier whenNotPaused() {
_checkNotPaused();
_;
}
/// @dev Modifier that ensures the provided address is not the zero address.
/// @param _addr The address to check.
modifier nonZeroAddr(address _addr) {
_checkNonZeroAddr(_addr);
_;
}
/// @dev Modifier that ensures the provided value is not zero.
/// @param _value The value to check.
modifier nonZeroValue(uint256 _value) {
_checkNonZeroValue(_value);
_;
}
/// @dev Modifier that ensures the provided bytes32 value is not zero.
/// @param _value The bytes32 value to check.
modifier nonZeroBytes32(bytes32 _value) {
_checkNonZeroBytes32(_value);
_;
}
/// @dev Modifier that ensures the caller is either of the two specified addresses.
/// @param _addr1 The first address to check against.
/// @param _addr2 The second address to check against.
modifier onlyFromEither(address _addr1, address _addr2) {
_checkFromEither(_addr1, _addr2);
_;
}
/// @dev Modifier that ensures the caller is the specified address.
/// @param _addr The address to check against.
modifier onlyFrom(address _addr) {
_checkFrom(_addr);
_;
}
/// @dev Modifier that ensures the caller is the specified address.
/// @param _addr The address to check against.
modifier onlyFromOptional(address _addr) {
_checkFromOptional(_addr);
_;
}
// ---------------------------------------------------------------
// Constructor
// ---------------------------------------------------------------
constructor() {
_disableInitializers();
}
// ---------------------------------------------------------------
// External & Public Functions
// ---------------------------------------------------------------
/// @notice Pauses the contract.
function pause() public whenNotPaused {
_pause();
emit Paused(msg.sender);
// We call the authorize function here to avoid:
// Warning (5740): Unreachable code.
_authorizePause(msg.sender, true);
}
/// @notice Unpauses the contract.
function unpause() public whenPaused {
_unpause();
emit Unpaused(msg.sender);
// We call the authorize function here to avoid:
// Warning (5740): Unreachable code.
_authorizePause(msg.sender, false);
}
function impl() public view returns (address) {
return _getImplementation();
}
/// @notice Returns true if the contract is paused, and false otherwise.
/// @return true if paused, false otherwise.
function paused() public view virtual returns (bool) {
return __paused == _TRUE;
}
function inNonReentrant() public view returns (bool) {
return _loadReentryLock() == _TRUE;
}
/// @notice Returns the address of this contract.
/// @return The address of this contract.
function resolver() public view virtual returns (address) {
return __resolver;
}
// ---------------------------------------------------------------
// Internal Functions
// ---------------------------------------------------------------
/// @notice Initializes the contract.
/// @param _owner The owner of this contract. msg.sender will be used if this value is zero.
function __Essential_init(address _owner) internal virtual onlyInitializing {
__Context_init();
_transferOwnership(_owner == address(0) ? msg.sender : _owner);
__paused = _FALSE;
}
function _pause() internal virtual {
__paused = _TRUE;
}
function _unpause() internal virtual {
__paused = _FALSE;
}
function _authorizeUpgrade(address) internal virtual override onlyOwner { }
function _authorizePause(address, bool) internal virtual onlyOwner { }
// Stores the reentry lock in transient storage (EIP-1153). This is deliberately not virtual:
// L1 and L2 run the same EVM version, so the transient-storage lock is the single reentrancy
// guard implementation.
function _storeReentryLock(uint8 _reentry) internal {
assembly {
tstore(_REENTRY_SLOT, _reentry)
}
}
// Loads the reentry lock
function _loadReentryLock() internal view returns (uint8 reentry_) {
assembly {
reentry_ := tload(_REENTRY_SLOT)
}
}
// ---------------------------------------------------------------
// Private Functions
// ---------------------------------------------------------------
function _checkOwnerOr(address _addr) private view {
require(msg.sender == owner() || msg.sender == _addr, ACCESS_DENIED());
}
function _checkReentrancy() private view {
require(_loadReentryLock() != _TRUE, REENTRANT_CALL());
}
function _checkPaused() private view {
require(paused(), INVALID_PAUSE_STATUS());
}
function _checkNotPaused() private view {
require(!paused(), INVALID_PAUSE_STATUS());
}
function _checkNonZeroAddr(address _addr) private pure {
require(_addr != address(0), ZERO_ADDRESS());
}
function _checkNonZeroValue(uint256 _value) private pure {
require(_value != 0, ZERO_VALUE());
}
function _checkNonZeroBytes32(bytes32 _value) private pure {
require(_value != 0, ZERO_VALUE());
}
function _checkFromEither(address _addr1, address _addr2) private view {
require(msg.sender == _addr1 || msg.sender == _addr2, ACCESS_DENIED());
}
function _checkFrom(address _addr) private view {
require(msg.sender == _addr, ACCESS_DENIED());
}
function _checkFromOptional(address _addr) private view {
require(_addr == address(0) || msg.sender == _addr, ACCESS_DENIED());
}
}
contracts/shared/common/IResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title IResolver
/// @notice This contract acts as a bridge for name-to-address resolution.
/// @custom:security-contact security@taiko.xyz
interface IResolver {
error RESOLVED_TO_ZERO_ADDRESS();
/// @notice Resolves a name to its address deployed on a specified chain.
/// @param _chainId The chainId of interest.
/// @param _name Name whose address is to be resolved.
/// @param _allowZeroAddress If set to true, does not throw if the resolved
/// address is `address(0)`.
/// @return Address associated with the given name on the specified
/// chain.
function resolve(
uint256 _chainId,
bytes32 _name,
bool _allowZeroAddress
)
external
view
returns (address);
}
contracts/shared/libs/LibNetwork.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title LibNetwork
library LibNetwork {
uint256 internal constant ETHEREUM_MAINNET = 1;
uint256 internal constant ETHEREUM_ROPSTEN = 3;
uint256 internal constant ETHEREUM_RINKEBY = 4;
uint256 internal constant ETHEREUM_GOERLI = 5;
uint256 internal constant ETHEREUM_KOVAN = 42;
uint256 internal constant ETHEREUM_HOLESKY = 17_000;
uint256 internal constant ETHEREUM_SEPOLIA = 11_155_111;
uint256 internal constant ETHEREUM_HELDER = 7_014_190_335;
uint256 internal constant ETHEREUM_HOODI = 560_048;
uint64 internal constant TAIKO_MAINNET = 167_000;
uint64 internal constant TAIKO_HEKLA = 167_009;
uint64 internal constant TAIKO_DEVNET = 167_001;
uint64 internal constant TAIKO_PRECONF = 167_010;
uint64 internal constant TAIKO_HOODI = 167_013;
uint256 internal constant ETHEREUM_BLOCK_TIME = 12 seconds;
/// @dev Checks if the chain ID represents an Ethereum testnet.
/// @param _chainId The chain ID.
/// @return true if the chain ID represents an Ethereum testnet, false otherwise.
function isEthereumTestnet(uint256 _chainId) internal pure returns (bool) {
return _chainId == LibNetwork.ETHEREUM_ROPSTEN || _chainId == LibNetwork.ETHEREUM_RINKEBY
|| _chainId == LibNetwork.ETHEREUM_GOERLI || _chainId == LibNetwork.ETHEREUM_KOVAN
|| _chainId == LibNetwork.ETHEREUM_HOLESKY || _chainId == LibNetwork.ETHEREUM_SEPOLIA
|| _chainId == LibNetwork.ETHEREUM_HELDER || _chainId == LibNetwork.ETHEREUM_HOODI;
}
/// @dev Checks if the chain ID represents an Ethereum testnet or the Etheruem mainnet.
/// @param _chainId The chain ID.
/// @return true if the chain ID represents an Ethereum testnet or the Etheruem mainnet, false
/// otherwise.
function isEthereumMainnetOrTestnet(uint256 _chainId) internal pure returns (bool) {
return _chainId == LibNetwork.ETHEREUM_MAINNET || isEthereumTestnet(_chainId);
}
/// @dev Checks if the chain ID represents the Taiko L2 mainnet.
/// @param _chainId The chain ID.
/// @return true if the chain ID represents the Taiko L2 mainnet.
function isTaikoMainnet(uint256 _chainId) internal pure returns (bool) {
return _chainId == TAIKO_MAINNET;
}
/// @dev Checks if the chain ID represents an internal Taiko devnet's base layer.
/// @param _chainId The chain ID.
/// @return true if the chain ID represents an internal Taiko devnet's base layer, false
/// otherwise.
function isTaikoDevnet(uint256 _chainId) internal pure returns (bool) {
return _chainId >= 32_300 && _chainId <= 32_400;
}
/// @dev Checks if the chain supports Dencun hardfork. Note that this check doesn't need to be
/// exhaustive.
/// @param _chainId The chain ID.
/// @return true if the chain supports Dencun hardfork, false otherwise.
function isDencunSupported(uint256 _chainId) internal pure returns (bool) {
return _chainId == LibNetwork.ETHEREUM_MAINNET || _chainId == LibNetwork.ETHEREUM_HOLESKY
|| _chainId == LibNetwork.ETHEREUM_SEPOLIA || _chainId == LibNetwork.ETHEREUM_HELDER
|| _chainId == LibNetwork.ETHEREUM_HOODI || isTaikoDevnet(_chainId);
}
}
node_modules/@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
node_modules/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./OwnableUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
function __Ownable2Step_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable2Step_init_unchained() internal onlyInitializing {
}
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() public virtual {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
node_modules/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
node_modules/@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCastUpgradeable {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
node_modules/@openzeppelin/contracts/interfaces/IERC1967.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}
node_modules/@openzeppelin/contracts/interfaces/draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}
node_modules/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967Upgrade is IERC1967 {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
}
node_modules/@openzeppelin/contracts/proxy/beacon/IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}
node_modules/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)
pragma solidity ^0.8.0;
import "../../interfaces/draft-IERC1822.sol";
import "../ERC1967/ERC1967Upgrade.sol";
/**
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
*
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
* `UUPSUpgradeable` with a custom implementation of upgrades.
*
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
*
* _Available since v4.1._
*/
abstract contract UUPSUpgradeable is IERC1822Proxiable, ERC1967Upgrade {
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
address private immutable __self = address(this);
/**
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
* a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
* function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
* fail.
*/
modifier onlyProxy() {
require(address(this) != __self, "Function must be called through delegatecall");
require(_getImplementation() == __self, "Function must be called through active proxy");
_;
}
/**
* @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, "UUPSUpgradeable: must not be called through delegatecall");
_;
}
/**
* @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
*/
function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
return _IMPLEMENTATION_SLOT;
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeTo(address newImplementation) public virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
}
/**
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
* encoded in `data`.
*
* Calls {_authorizeUpgrade}.
*
* Emits an {Upgraded} event.
*
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
*/
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
_authorizeUpgrade(newImplementation);
_upgradeToAndCallUUPS(newImplementation, data, true);
}
/**
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
* {upgradeTo} and {upgradeToAndCall}.
*
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
*
* ```solidity
* function _authorizeUpgrade(address) internal override onlyOwner {}
* ```
*/
function _authorizeUpgrade(address newImplementation) internal virtual;
}
node_modules/@openzeppelin/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}
Compiler Settings
{"viaIR":false,"remappings":["openzeppelin/=node_modules/@openzeppelin/","@openzeppelin/=node_modules/@openzeppelin/","@openzeppelin-upgrades/contracts/=node_modules/@openzeppelin/contracts-upgradeable/","@risc0/contracts/=node_modules/risc0-ethereum/contracts/src/","@solady/=node_modules/solady/","solady/src/=node_modules/solady/src/","solady/utils/=node_modules/solady/src/utils/","solady/auth/=node_modules/solady/src/auth/","@optimism/=node_modules/optimism/","@sp1-contracts/=node_modules/sp1-contracts/contracts/src/","forge-std/=node_modules/forge-std/","@p256-verifier/contracts/=node_modules/p256-verifier/src/","@eth-fabric/urc/=node_modules/urc/src/","@automata-network/on-chain-pccs/=node_modules/@automata-network/on-chain-pccs/src/","@automata-network/automata-dcap-attestation/=node_modules/@automata-network/automata-dcap-attestation/","risc0/=node_modules/risc0-ethereum/contracts/src/","ds-test/=node_modules/ds-test/","src/=contracts/","test/=test/","script/=script/","optimism/=node_modules/optimism/","p256-verifier/=node_modules/p256-verifier/","risc0-ethereum/=node_modules/risc0-ethereum/","sp1-contracts/=node_modules/sp1-contracts/","urc/=node_modules/urc/"],"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_ejectorManagerAddress","internalType":"address"}]},{"type":"error","name":"ACCESS_DENIED","inputs":[]},{"type":"error","name":"CannotRemoveLastOperator","inputs":[]},{"type":"error","name":"FUNC_NOT_IMPLEMENTED","inputs":[]},{"type":"error","name":"INVALID_PAUSE_STATUS","inputs":[]},{"type":"error","name":"InvalidEjectorManager","inputs":[]},{"type":"error","name":"InvalidOperatorAddress","inputs":[]},{"type":"error","name":"InvalidOperatorIndex","inputs":[]},{"type":"error","name":"InvalidProposer","inputs":[]},{"type":"error","name":"NoActiveOperatorRemaining","inputs":[]},{"type":"error","name":"NotOwnerOrEjecter","inputs":[]},{"type":"error","name":"NotOwnerOrEjectorManager","inputs":[]},{"type":"error","name":"OperatorAlreadyExists","inputs":[]},{"type":"error","name":"REENTRANT_CALL","inputs":[]},{"type":"error","name":"ZERO_ADDRESS","inputs":[]},{"type":"error","name":"ZERO_VALUE","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"EjecterUpdated","inputs":[{"type":"address","name":"ejecter","internalType":"address","indexed":true},{"type":"bool","name":"isEjecter","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OperatorAdded","inputs":[{"type":"address","name":"proposer","internalType":"address","indexed":true},{"type":"address","name":"sequencer","internalType":"address","indexed":true},{"type":"uint256","name":"activeSince","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OperatorRemoved","inputs":[{"type":"address","name":"proposer","internalType":"address","indexed":true},{"type":"address","name":"sequencer","internalType":"address","indexed":true},{"type":"uint256","name":"inactiveSince","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"OPERATOR_CHANGE_DELAY","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"RANDOMNESS_DELAY","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addOperator","inputs":[{"type":"address","name":"_proposer","internalType":"address"},{"type":"address","name":"_sequencer","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint48","name":"endOfSubmissionWindowTimestamp_","internalType":"uint48"}],"name":"checkProposer","inputs":[{"type":"address","name":"_proposer","internalType":"address"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"isEjecter","internalType":"bool"}],"name":"ejecters","inputs":[{"type":"address","name":"ejecter","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"epochStartTimestamp","inputs":[{"type":"uint256","name":"_offset","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getOperatorForCurrentEpoch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getOperatorForNextEpoch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"impl","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"inNonReentrant","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"init","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isOperatorActive","inputs":[{"type":"address","name":"_proposer","internalType":"address"},{"type":"uint32","name":"_epochTimestamp","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"latestActivationEpoch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"operatorCount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"proposer","internalType":"address"}],"name":"operatorMapping","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"activeSince","internalType":"uint32"},{"type":"uint32","name":"deprecatedInactiveSince","internalType":"uint32"},{"type":"uint8","name":"index","internalType":"uint8"},{"type":"address","name":"sequencerAddress","internalType":"address"}],"name":"operators","inputs":[{"type":"address","name":"proposer","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"uint256","name":"_operatorIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperatorByAddress","inputs":[{"type":"address","name":"_proposer","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"resolver","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEjecter","inputs":[{"type":"address","name":"_ejecter","internalType":"address"},{"type":"bool","name":"_isEjecter","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]}]
Contract Creation Code
0x60e060405230608052348015610013575f5ffd5b5060405161226e38038061226e8339810160408190526100329161012e565b61003a610072565b6001600160a01b038116610061576040516337a3b5f360e11b815260040160405180910390fd5b6001600160a01b031660c05261015b565b5f54610100900460ff16156100dd5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff9081161461012c575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b5f6020828403121561013e575f5ffd5b81516001600160a01b0381168114610154575f5ffd5b9392505050565b60805160a05160c0516120cd6101a15f395f610a8601525f6101e201525f81816107b8015281816107f80152818161090b0152818161094b01526109c201526120cd5ff3fe6080604052600436106101d0575f3560e01c8063715018a6116100fd5780638da5cb5b11610092578063e30c397811610062578063e30c3978146105e5578063f2fde38b14610602578063f46673f614610621578063f96214de14610312575f5ffd5b80638da5cb5b1461053f5780639b724f9e1461055c578063ac0004da1461057b578063cecad1f7146105b1575f5ffd5b80637f918e2c116100cd5780637f918e2c146104d45780638456cb59146104f85780638a1af4c41461050c5780638abf60771461052b575f5ffd5b8063715018a61461047f57806372a8a5511461049357806379ba5097146104a75780637c6f3158146104bb575f5ffd5b8063343f0a68116101735780634f1ef286116101435780634f1ef2861461040b57806352d1902d1461041e5780635c975abb146104405780636240b71c14610460575f5ffd5b8063343f0a68146103905780633659cfe6146103a45780633f4ba83a146103c357806342b83b8e146103d7575f5ffd5b806319ab453c116101ae57806319ab453c146102f15780632fb17ffc146103125780633075db5614610338578063316eae6a14610371575f5ffd5b806304f3bcec146101d4578063107538eb1461021f57806313e7c9d81461025d575b5f5ffd5b3480156101df575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561022a575f5ffd5b5061024d610239366004611c07565b60fe6020525f908152604090205460ff1681565b6040519015158152602001610216565b348015610268575f5ffd5b506102b8610277366004611c07565b60fb6020525f908152604090205463ffffffff80821691640100000000810490911690600160401b810460ff1690600160481b90046001600160a01b031684565b6040805163ffffffff958616815294909316602085015260ff909116918301919091526001600160a01b03166060820152608001610216565b3480156102fc575f5ffd5b5061031061030b366004611c07565b610640565b005b34801561031d575f5ffd5b50610326600281565b60405160ff9091168152602001610216565b348015610343575f5ffd5b5060027fa5054f728453d3dbe953bdc43e4d0cb97e662ea32d7958190f3dc2da31d9721b5c60ff161461024d565b34801561037c575f5ffd5b5061024d61038b366004611c20565b610752565b34801561039b575f5ffd5b50610202610797565b3480156103af575f5ffd5b506103106103be366004611c07565b6107ae565b3480156103ce575f5ffd5b50610310610875565b3480156103e2575f5ffd5b506103f66103f1366004611c5d565b6108d0565b60405163ffffffff9091168152602001610216565b610310610419366004611c88565b610901565b348015610429575f5ffd5b506104326109b6565b604051908152602001610216565b34801561044b575f5ffd5b5061024d60c954610100900460ff1660021490565b34801561046b575f5ffd5b5061031061047a366004611d4c565b610a67565b34801561048a575f5ffd5b50610310610b23565b34801561049e575f5ffd5b50610202610b34565b3480156104b2575f5ffd5b50610310610b42565b3480156104c6575f5ffd5b5060fd546103269060ff1681565b3480156104df575f5ffd5b5060fd546103f690640100000000900463ffffffff1681565b348015610503575f5ffd5b50610310610bb9565b348015610517575f5ffd5b50610310610526366004611d7a565b610c0e565b348015610536575f5ffd5b50610202610c5c565b34801561054a575f5ffd5b506033546001600160a01b0316610202565b348015610567575f5ffd5b50610310610576366004611c07565b610c65565b348015610586575f5ffd5b5061059a610595366004611dab565b610cb2565b60405165ffffffffffff9091168152602001610216565b3480156105bc575f5ffd5b506102026105cb366004611c5d565b60fc6020525f90815260409020546001600160a01b031681565b3480156105f0575f5ffd5b506065546001600160a01b0316610202565b34801561060d575f5ffd5b5061031061061c366004611c07565b610d25565b34801561062c575f5ffd5b5061031061063b366004611c5d565b610d96565b5f54610100900460ff161580801561065e57505f54600160ff909116105b806106775750303b15801561067757505f5460ff166001145b6106df5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff191660011790558015610700575f805461ff0019166101001790555b61070982610e1f565b801561074e575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6001600160a01b0382165f90815260fb60205260408120805463ffffffff16801580159061078c57508063ffffffff168463ffffffff1610155b925050505b92915050565b5f6107a96107a45f6108d0565b610e7d565b905090565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107f65760405162461bcd60e51b81526004016106d690611e29565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610828611028565b6001600160a01b03161461084e5760405162461bcd60e51b81526004016106d690611e75565b61085781611043565b604080515f808252602082019092526108729183919061104b565b50565b61087d6111ba565b61089160c9805461ff001916610100179055565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200160405180910390a16108ce335f6111eb565b565b5f6108dd600c6020611ed5565b6108e79083611ed5565b6108ef6111f3565b65ffffffffffff166107919190611eec565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036109495760405162461bcd60e51b81526004016106d690611e29565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661097b611028565b6001600160a01b0316146109a15760405162461bcd60e51b81526004016106d690611e75565b6109aa82611043565b61074e8282600161104b565b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a555760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106d6565b505f5160206120515f395f51905f5290565b6033546001600160a01b0316331480610aa85750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b610ac55760405163debe0a0160e01b815260040160405180910390fd5b6001600160a01b0382165f81815260fe6020908152604091829020805460ff191685151590811790915591519182527f4517b9cadd80ff3722ce16d2ab8a83d39a8e57ee04a761501325b52a627543f9910160405180910390a25050565b610b2b6111fd565b6108ce5f611257565b5f6107a96107a460016108d0565b60655433906001600160a01b03168114610bb05760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106d6565b61087281611257565b610bc1611270565b60c9805461ff0019166102001790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200160405180910390a16108ce3360016111eb565b6033546001600160a01b0316331480610c355750335f90815260fe602052604090205460ff165b610c52576040516319128cc360e01b815260040160405180910390fd5b61074e82826112a2565b5f6107a9611028565b6033546001600160a01b0316331480610c8c5750335f90815260fe602052604090205460ff165b610ca9576040516319128cc360e01b815260040160405180910390fd5b6108728161142c565b5f5f610cc06107a45f6108d0565b90506001600160a01b038116610ce957604051634100ac0360e01b815260040160405180910390fd5b846001600160a01b0316816001600160a01b031614610d1b57604051634100ac0360e01b815260040160405180910390fd5b505f949350505050565b610d2d6111fd565b606580546001600160a01b0383166001600160a01b03199091168117909155610d5e6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331480610dbd5750335f90815260fe602052604090205460ff165b610dda576040516319128cc360e01b815260040160405180910390fd5b60fd5460ff168110610dff576040516301fa53c760e11b815260040160405180910390fd5b5f81815260fc6020526040902054610872906001600160a01b031661142c565b5f54610100900460ff16610e455760405162461bcd60e51b81526004016106d690611eff565b610e4d61162d565b610e6b6001600160a01b03821615610e655781611257565b33611257565b5060c9805461ff001916610100179055565b5f61030063ffffffff83168282821015610e975781610e9b565b8282035b60fd5490915060ff811690640100000000900463ffffffff165f829003610ec857505f9695505050505050565b5f610ed284611653565b90508163ffffffff168863ffffffff1610610f1f5760fc5f848381610ef957610ef9611f4a565b06815260208101919091526040015f20546001600160a01b031698975050505050505050565b5f8367ffffffffffffffff811115610f3957610f39611c74565b604051908082528060200260200182016040528015610f62578160200160208202803683370190505b5090505f5f5b85811015610fd9575f81815260fc60205260409020546001600160a01b0316610f91818d610752565b15610fd05780848480600101955081518110610faf57610faf611f5e565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50600101610f68565b50805f03610ff057505f9998505050505050505050565b8181848161100057611000611f4a565b068151811061101157611011611f5e565b602002602001015198505050505050505050919050565b5f5160206120515f395f51905f52546001600160a01b031690565b6108726111fd565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156110835761107e8361166b565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110dd575060408051601f3d908101601f191682019092526110da91810190611f72565b60015b6111405760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106d6565b5f5160206120515f395f51905f5281146111ae5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106d6565b5061107e838383611706565b6111ce60c954610100900460ff1660021490565b6108ce5760405163bae6e2a960e01b815260040160405180910390fd5b61074e6111fd565b5f6107a95f611730565b6033546001600160a01b031633146108ce5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106d6565b606580546001600160a01b0319169055610872816117b4565b61128460c954610100900460ff1660021490565b156108ce5760405163bae6e2a960e01b815260040160405180910390fd5b6001600160a01b0382166112c95760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0381166112f05760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0382165f90815260fb60205260409020805463ffffffff161561132d57604051630a27252560e21b815260040160405180910390fd5b5f61133860026108d0565b60fd54835460ff60401b191660ff909116600160401b81029190911784555f81815260fc6020526040902080546001600160a01b0319166001600160a01b03881617905590915061138a816001611f89565b60fd805460ff191660ff92909216919091178155835463ffffffff841668ffffffffff00000001600160e81b03199091168117600160481b6001600160a01b03888116918202929092178755835467ffffffff0000000019166401000000008402179093556040519182528716907f20c899c9053446f0d7a408c709f0196e2c26c6a985dcad854dc19ad567c4531f9060200160405180910390a35050505050565b60fd54600160ff9091161161145457604051633c0e8c9360e11b815260040160405180910390fd5b6001600160a01b03811661147b5760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b038082165f90815260fb6020526040902080549091600160481b909104166114bd5760405163eb32d3bf60e01b815260040160405180910390fd5b5f6114c75f6108d0565b90506114d38382610752565b156114ff576114e28382611805565b6114ff57604051632437b50360e11b815260040160405180910390fd5b815460fd546001600160a01b03600160481b8304169160ff600160401b9091048116915f916115319160019116611fa2565b90508060ff168260ff161461159e5760ff8181165f90815260fc602090815260408083205493861680845281842080546001600160a01b039096166001600160a01b03199096168617905593835260fb9091529020805460ff60401b1916600160401b9092029190911790555b60ff81165f81815260fc6020908152604080832080546001600160a01b03191690556001600160a01b038a811680855260fb84529382902080546001600160e81b031916905560fd805460ff191690951790945551428152928616927fa85b3d3497f1e4522d447f02e1a1d16506431ba902da11611a51d8502400e4ea910160405180910390a3505050505050565b5f54610100900460ff166108ce5760405162461bcd60e51b81526004016106d690611eff565b5f5f6116648363ffffffff1661186e565b9392505050565b6001600160a01b0381163b6116d85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106d6565b5f5160206120515f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b61170f836118e6565b5f8251118061171b5750805b1561107e5761172a8383611925565b50505050565b5f5f61173b4661194a565b90505f6117488242611fbb565b90505f611757600c6020611ed5565b611763600c6020611ed5565b61176d9084611fce565b6117779190611ed5565b90506117ab611788600c6020611ed5565b6117929087611ed5565b61179c8386611eec565b6117a69190611eec565b6119a5565b95945050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60fd545f9060ff16815b8160ff168160ff161015610d1b5760ff81165f90815260fc60205260409020546001600160a01b0390811690861681036118495750611866565b6118538186610752565b156118645760019350505050610791565b505b60010161180f565b5f6118784661194a565b82101561188657505f919050565b611891600c83611eec565b9150425f5b6020811080156118a65750818411155b156118dd575f6118b585611a0f565b905080156118c557949350505050565b600c8501945050806118d690611fed565b9050611896565b505f9392505050565b6118ef8161166b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060611664838360405180606001604052806027815260200161207160279139611ace565b5f6001820361195e5750635fc63057919050565b614268820361197257506365156ac0919050565b6401a2140cff820361198957506366755d6c919050565b62088bb0820361199e57506367d81118919050565b505f919050565b5f65ffffffffffff821115611a0b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b60648201526084016106d6565b5090565b5f5f5f720f3df6d732807ef1319fb7b8bb8522d0beac026001600160a01b031684604051602001611a4291815260200190565b60408051601f1981840301815290829052611a5c91612005565b5f60405180830381855afa9150503d805f8114611a94576040519150601f19603f3d011682016040523d82523d5f602084013e611a99565b606091505b5091509150818015611aab57505f8151115b15611ac75780806020019051810190611ac49190611f72565b92505b5050919050565b60605f5f856001600160a01b031685604051611aea9190612005565b5f60405180830381855af49150503d805f8114611b22576040519150601f19603f3d011682016040523d82523d5f602084013e611b27565b606091505b5091509150611b3886838387611b42565b9695505050505050565b60608315611bb05782515f03611ba9576001600160a01b0385163b611ba95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106d6565b5081611bba565b611bba8383611bc2565b949350505050565b815115611bd25781518083602001fd5b8060405162461bcd60e51b81526004016106d6919061201b565b80356001600160a01b0381168114611c02575f5ffd5b919050565b5f60208284031215611c17575f5ffd5b61166482611bec565b5f5f60408385031215611c31575f5ffd5b611c3a83611bec565b9150602083013563ffffffff81168114611c52575f5ffd5b809150509250929050565b5f60208284031215611c6d575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215611c99575f5ffd5b611ca283611bec565b9150602083013567ffffffffffffffff811115611cbd575f5ffd5b8301601f81018513611ccd575f5ffd5b803567ffffffffffffffff811115611ce757611ce7611c74565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715611d1657611d16611c74565b604052818152828201602001871015611d2d575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f60408385031215611d5d575f5ffd5b611d6683611bec565b915060208301358015158114611c52575f5ffd5b5f5f60408385031215611d8b575f5ffd5b611d9483611bec565b9150611da260208401611bec565b90509250929050565b5f5f5f60408486031215611dbd575f5ffd5b611dc684611bec565b9250602084013567ffffffffffffffff811115611de1575f5ffd5b8401601f81018613611df1575f5ffd5b803567ffffffffffffffff811115611e07575f5ffd5b866020828401011115611e18575f5ffd5b939660209190910195509293505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761079157610791611ec1565b8082018082111561079157610791611ec1565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611f82575f5ffd5b5051919050565b60ff818116838216019081111561079157610791611ec1565b60ff828116828216039081111561079157610791611ec1565b8181038181111561079157610791611ec1565b5f82611fe857634e487b7160e01b5f52601260045260245ffd5b500490565b5f60018201611ffe57611ffe611ec1565b5060010190565b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a6c0b6582cc78e80fcbd753a094503cf3782be0b42466a146c7ddfbe87b93a1c64736f6c634300081e00330000000000000000000000004779d18931b35540f84b0cd0e9633855b84df7b8
Deployed ByteCode
0x6080604052600436106101d0575f3560e01c8063715018a6116100fd5780638da5cb5b11610092578063e30c397811610062578063e30c3978146105e5578063f2fde38b14610602578063f46673f614610621578063f96214de14610312575f5ffd5b80638da5cb5b1461053f5780639b724f9e1461055c578063ac0004da1461057b578063cecad1f7146105b1575f5ffd5b80637f918e2c116100cd5780637f918e2c146104d45780638456cb59146104f85780638a1af4c41461050c5780638abf60771461052b575f5ffd5b8063715018a61461047f57806372a8a5511461049357806379ba5097146104a75780637c6f3158146104bb575f5ffd5b8063343f0a68116101735780634f1ef286116101435780634f1ef2861461040b57806352d1902d1461041e5780635c975abb146104405780636240b71c14610460575f5ffd5b8063343f0a68146103905780633659cfe6146103a45780633f4ba83a146103c357806342b83b8e146103d7575f5ffd5b806319ab453c116101ae57806319ab453c146102f15780632fb17ffc146103125780633075db5614610338578063316eae6a14610371575f5ffd5b806304f3bcec146101d4578063107538eb1461021f57806313e7c9d81461025d575b5f5ffd5b3480156101df575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561022a575f5ffd5b5061024d610239366004611c07565b60fe6020525f908152604090205460ff1681565b6040519015158152602001610216565b348015610268575f5ffd5b506102b8610277366004611c07565b60fb6020525f908152604090205463ffffffff80821691640100000000810490911690600160401b810460ff1690600160481b90046001600160a01b031684565b6040805163ffffffff958616815294909316602085015260ff909116918301919091526001600160a01b03166060820152608001610216565b3480156102fc575f5ffd5b5061031061030b366004611c07565b610640565b005b34801561031d575f5ffd5b50610326600281565b60405160ff9091168152602001610216565b348015610343575f5ffd5b5060027fa5054f728453d3dbe953bdc43e4d0cb97e662ea32d7958190f3dc2da31d9721b5c60ff161461024d565b34801561037c575f5ffd5b5061024d61038b366004611c20565b610752565b34801561039b575f5ffd5b50610202610797565b3480156103af575f5ffd5b506103106103be366004611c07565b6107ae565b3480156103ce575f5ffd5b50610310610875565b3480156103e2575f5ffd5b506103f66103f1366004611c5d565b6108d0565b60405163ffffffff9091168152602001610216565b610310610419366004611c88565b610901565b348015610429575f5ffd5b506104326109b6565b604051908152602001610216565b34801561044b575f5ffd5b5061024d60c954610100900460ff1660021490565b34801561046b575f5ffd5b5061031061047a366004611d4c565b610a67565b34801561048a575f5ffd5b50610310610b23565b34801561049e575f5ffd5b50610202610b34565b3480156104b2575f5ffd5b50610310610b42565b3480156104c6575f5ffd5b5060fd546103269060ff1681565b3480156104df575f5ffd5b5060fd546103f690640100000000900463ffffffff1681565b348015610503575f5ffd5b50610310610bb9565b348015610517575f5ffd5b50610310610526366004611d7a565b610c0e565b348015610536575f5ffd5b50610202610c5c565b34801561054a575f5ffd5b506033546001600160a01b0316610202565b348015610567575f5ffd5b50610310610576366004611c07565b610c65565b348015610586575f5ffd5b5061059a610595366004611dab565b610cb2565b60405165ffffffffffff9091168152602001610216565b3480156105bc575f5ffd5b506102026105cb366004611c5d565b60fc6020525f90815260409020546001600160a01b031681565b3480156105f0575f5ffd5b506065546001600160a01b0316610202565b34801561060d575f5ffd5b5061031061061c366004611c07565b610d25565b34801561062c575f5ffd5b5061031061063b366004611c5d565b610d96565b5f54610100900460ff161580801561065e57505f54600160ff909116105b806106775750303b15801561067757505f5460ff166001145b6106df5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff191660011790558015610700575f805461ff0019166101001790555b61070982610e1f565b801561074e575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b6001600160a01b0382165f90815260fb60205260408120805463ffffffff16801580159061078c57508063ffffffff168463ffffffff1610155b925050505b92915050565b5f6107a96107a45f6108d0565b610e7d565b905090565b6001600160a01b037f000000000000000000000000470741340ecb00032ffd769c6f3238c58bc1221a1630036107f65760405162461bcd60e51b81526004016106d690611e29565b7f000000000000000000000000470741340ecb00032ffd769c6f3238c58bc1221a6001600160a01b0316610828611028565b6001600160a01b03161461084e5760405162461bcd60e51b81526004016106d690611e75565b61085781611043565b604080515f808252602082019092526108729183919061104b565b50565b61087d6111ba565b61089160c9805461ff001916610100179055565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200160405180910390a16108ce335f6111eb565b565b5f6108dd600c6020611ed5565b6108e79083611ed5565b6108ef6111f3565b65ffffffffffff166107919190611eec565b6001600160a01b037f000000000000000000000000470741340ecb00032ffd769c6f3238c58bc1221a1630036109495760405162461bcd60e51b81526004016106d690611e29565b7f000000000000000000000000470741340ecb00032ffd769c6f3238c58bc1221a6001600160a01b031661097b611028565b6001600160a01b0316146109a15760405162461bcd60e51b81526004016106d690611e75565b6109aa82611043565b61074e8282600161104b565b5f306001600160a01b037f000000000000000000000000470741340ecb00032ffd769c6f3238c58bc1221a1614610a555760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106d6565b505f5160206120515f395f51905f5290565b6033546001600160a01b0316331480610aa85750336001600160a01b037f0000000000000000000000004779d18931b35540f84b0cd0e9633855b84df7b816145b610ac55760405163debe0a0160e01b815260040160405180910390fd5b6001600160a01b0382165f81815260fe6020908152604091829020805460ff191685151590811790915591519182527f4517b9cadd80ff3722ce16d2ab8a83d39a8e57ee04a761501325b52a627543f9910160405180910390a25050565b610b2b6111fd565b6108ce5f611257565b5f6107a96107a460016108d0565b60655433906001600160a01b03168114610bb05760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106d6565b61087281611257565b610bc1611270565b60c9805461ff0019166102001790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200160405180910390a16108ce3360016111eb565b6033546001600160a01b0316331480610c355750335f90815260fe602052604090205460ff165b610c52576040516319128cc360e01b815260040160405180910390fd5b61074e82826112a2565b5f6107a9611028565b6033546001600160a01b0316331480610c8c5750335f90815260fe602052604090205460ff165b610ca9576040516319128cc360e01b815260040160405180910390fd5b6108728161142c565b5f5f610cc06107a45f6108d0565b90506001600160a01b038116610ce957604051634100ac0360e01b815260040160405180910390fd5b846001600160a01b0316816001600160a01b031614610d1b57604051634100ac0360e01b815260040160405180910390fd5b505f949350505050565b610d2d6111fd565b606580546001600160a01b0383166001600160a01b03199091168117909155610d5e6033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331480610dbd5750335f90815260fe602052604090205460ff165b610dda576040516319128cc360e01b815260040160405180910390fd5b60fd5460ff168110610dff576040516301fa53c760e11b815260040160405180910390fd5b5f81815260fc6020526040902054610872906001600160a01b031661142c565b5f54610100900460ff16610e455760405162461bcd60e51b81526004016106d690611eff565b610e4d61162d565b610e6b6001600160a01b03821615610e655781611257565b33611257565b5060c9805461ff001916610100179055565b5f61030063ffffffff83168282821015610e975781610e9b565b8282035b60fd5490915060ff811690640100000000900463ffffffff165f829003610ec857505f9695505050505050565b5f610ed284611653565b90508163ffffffff168863ffffffff1610610f1f5760fc5f848381610ef957610ef9611f4a565b06815260208101919091526040015f20546001600160a01b031698975050505050505050565b5f8367ffffffffffffffff811115610f3957610f39611c74565b604051908082528060200260200182016040528015610f62578160200160208202803683370190505b5090505f5f5b85811015610fd9575f81815260fc60205260409020546001600160a01b0316610f91818d610752565b15610fd05780848480600101955081518110610faf57610faf611f5e565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50600101610f68565b50805f03610ff057505f9998505050505050505050565b8181848161100057611000611f4a565b068151811061101157611011611f5e565b602002602001015198505050505050505050919050565b5f5160206120515f395f51905f52546001600160a01b031690565b6108726111fd565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156110835761107e8361166b565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110dd575060408051601f3d908101601f191682019092526110da91810190611f72565b60015b6111405760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106d6565b5f5160206120515f395f51905f5281146111ae5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106d6565b5061107e838383611706565b6111ce60c954610100900460ff1660021490565b6108ce5760405163bae6e2a960e01b815260040160405180910390fd5b61074e6111fd565b5f6107a95f611730565b6033546001600160a01b031633146108ce5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106d6565b606580546001600160a01b0319169055610872816117b4565b61128460c954610100900460ff1660021490565b156108ce5760405163bae6e2a960e01b815260040160405180910390fd5b6001600160a01b0382166112c95760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0381166112f05760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0382165f90815260fb60205260409020805463ffffffff161561132d57604051630a27252560e21b815260040160405180910390fd5b5f61133860026108d0565b60fd54835460ff60401b191660ff909116600160401b81029190911784555f81815260fc6020526040902080546001600160a01b0319166001600160a01b03881617905590915061138a816001611f89565b60fd805460ff191660ff92909216919091178155835463ffffffff841668ffffffffff00000001600160e81b03199091168117600160481b6001600160a01b03888116918202929092178755835467ffffffff0000000019166401000000008402179093556040519182528716907f20c899c9053446f0d7a408c709f0196e2c26c6a985dcad854dc19ad567c4531f9060200160405180910390a35050505050565b60fd54600160ff9091161161145457604051633c0e8c9360e11b815260040160405180910390fd5b6001600160a01b03811661147b5760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b038082165f90815260fb6020526040902080549091600160481b909104166114bd5760405163eb32d3bf60e01b815260040160405180910390fd5b5f6114c75f6108d0565b90506114d38382610752565b156114ff576114e28382611805565b6114ff57604051632437b50360e11b815260040160405180910390fd5b815460fd546001600160a01b03600160481b8304169160ff600160401b9091048116915f916115319160019116611fa2565b90508060ff168260ff161461159e5760ff8181165f90815260fc602090815260408083205493861680845281842080546001600160a01b039096166001600160a01b03199096168617905593835260fb9091529020805460ff60401b1916600160401b9092029190911790555b60ff81165f81815260fc6020908152604080832080546001600160a01b03191690556001600160a01b038a811680855260fb84529382902080546001600160e81b031916905560fd805460ff191690951790945551428152928616927fa85b3d3497f1e4522d447f02e1a1d16506431ba902da11611a51d8502400e4ea910160405180910390a3505050505050565b5f54610100900460ff166108ce5760405162461bcd60e51b81526004016106d690611eff565b5f5f6116648363ffffffff1661186e565b9392505050565b6001600160a01b0381163b6116d85760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106d6565b5f5160206120515f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b61170f836118e6565b5f8251118061171b5750805b1561107e5761172a8383611925565b50505050565b5f5f61173b4661194a565b90505f6117488242611fbb565b90505f611757600c6020611ed5565b611763600c6020611ed5565b61176d9084611fce565b6117779190611ed5565b90506117ab611788600c6020611ed5565b6117929087611ed5565b61179c8386611eec565b6117a69190611eec565b6119a5565b95945050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60fd545f9060ff16815b8160ff168160ff161015610d1b5760ff81165f90815260fc60205260409020546001600160a01b0390811690861681036118495750611866565b6118538186610752565b156118645760019350505050610791565b505b60010161180f565b5f6118784661194a565b82101561188657505f919050565b611891600c83611eec565b9150425f5b6020811080156118a65750818411155b156118dd575f6118b585611a0f565b905080156118c557949350505050565b600c8501945050806118d690611fed565b9050611896565b505f9392505050565b6118ef8161166b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060611664838360405180606001604052806027815260200161207160279139611ace565b5f6001820361195e5750635fc63057919050565b614268820361197257506365156ac0919050565b6401a2140cff820361198957506366755d6c919050565b62088bb0820361199e57506367d81118919050565b505f919050565b5f65ffffffffffff821115611a0b5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b60648201526084016106d6565b5090565b5f5f5f720f3df6d732807ef1319fb7b8bb8522d0beac026001600160a01b031684604051602001611a4291815260200190565b60408051601f1981840301815290829052611a5c91612005565b5f60405180830381855afa9150503d805f8114611a94576040519150601f19603f3d011682016040523d82523d5f602084013e611a99565b606091505b5091509150818015611aab57505f8151115b15611ac75780806020019051810190611ac49190611f72565b92505b5050919050565b60605f5f856001600160a01b031685604051611aea9190612005565b5f60405180830381855af49150503d805f8114611b22576040519150601f19603f3d011682016040523d82523d5f602084013e611b27565b606091505b5091509150611b3886838387611b42565b9695505050505050565b60608315611bb05782515f03611ba9576001600160a01b0385163b611ba95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106d6565b5081611bba565b611bba8383611bc2565b949350505050565b815115611bd25781518083602001fd5b8060405162461bcd60e51b81526004016106d6919061201b565b80356001600160a01b0381168114611c02575f5ffd5b919050565b5f60208284031215611c17575f5ffd5b61166482611bec565b5f5f60408385031215611c31575f5ffd5b611c3a83611bec565b9150602083013563ffffffff81168114611c52575f5ffd5b809150509250929050565b5f60208284031215611c6d575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215611c99575f5ffd5b611ca283611bec565b9150602083013567ffffffffffffffff811115611cbd575f5ffd5b8301601f81018513611ccd575f5ffd5b803567ffffffffffffffff811115611ce757611ce7611c74565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715611d1657611d16611c74565b604052818152828201602001871015611d2d575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f60408385031215611d5d575f5ffd5b611d6683611bec565b915060208301358015158114611c52575f5ffd5b5f5f60408385031215611d8b575f5ffd5b611d9483611bec565b9150611da260208401611bec565b90509250929050565b5f5f5f60408486031215611dbd575f5ffd5b611dc684611bec565b9250602084013567ffffffffffffffff811115611de1575f5ffd5b8401601f81018613611df1575f5ffd5b803567ffffffffffffffff811115611e07575f5ffd5b866020828401011115611e18575f5ffd5b939660209190910195509293505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761079157610791611ec1565b8082018082111561079157610791611ec1565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611f82575f5ffd5b5051919050565b60ff818116838216019081111561079157610791611ec1565b60ff828116828216039081111561079157610791611ec1565b8181038181111561079157610791611ec1565b5f82611fe857634e487b7160e01b5f52601260045260245ffd5b500490565b5f60018201611ffe57611ffe611ec1565b5060010190565b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a6c0b6582cc78e80fcbd753a094503cf3782be0b42466a146c7ddfbe87b93a1c64736f6c634300081e0033