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
- prague
- Verified at
- 2026-05-10T12:36:21.212374Z
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 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/ILookaheadStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "@eth-fabric/urc/ISlasher.sol";
/// @title ILookaheadStore
/// @custom:security-contact security@taiko.xyz
interface ILookaheadStore {
// An array of LookaheadSlot structs is used in two ways:
// 1. It is byte-encoded to form the payload of the lookahead commitment
// 2. The same array is hashed (using keccak256) and stored in the lookahead store
struct LookaheadSlot {
// The preconfer operator's committer address that is fetched from the slashing commitment.
address committer;
// Timestamp of the slot.
uint256 timestamp;
// URC registration root of the operator
bytes32 registrationRoot;
// Index of the Operator's registration merkle tree leaf that contains the validator for the
// slot.
uint256 validatorLeafIndex;
}
struct LookaheadHash {
// The timestamp of the epoch.
uint48 epochTimestamp;
// Keccak hash of the lookahead slots for the epoch.
bytes26 lookaheadHash;
}
struct LookaheadStoreConfig {
// The size of the lookahead buffer.
uint16 lookaheadBufferSize;
// The minimum collateral for a registered operator to post the lookahead.
uint80 minCollateralForPosting;
// The minimum collateral for a registered operator to preconf.
uint80 minCollateralForPreconfing;
}
struct LookaheadData {
/// @notice Index of the slot of the proposer in the current lookahead.
/// @dev Must be set to type(uint256).max if the proposer is from the next epoch
uint256 slotIndex;
/// @notice URC registration root of the lookahead poster
bytes32 registrationRoot;
/// @notice Current epoch lookahead slots. It is only used for validation
/// @dev Must be provided exactly as originally posted by the previous lookahead poster
LookaheadSlot[] currLookahead;
/// @notice Next epoch lookahead slots. If there's no lookahead stored for next epoch, it
/// will be updated with this value
/// @dev IMPORTANT: Must take into account blacklist status as of one slot before the
/// current epoch start
/// @dev Can be empty for same-epoch proposers when next epoch lookahead already exists
/// on-chain (gas optimization). Must be provided for cross-epoch proposers (need slot
/// info) and fallback preconfers (responsible for posting/validation)
LookaheadSlot[] nextLookahead;
/// @notice Commitment signature for the lookahead poster
/// @dev Must be set to an empty bytes if the lookahead poster is a whitelisted preconfer
bytes commitmentSignature;
}
struct ProposerContext {
// `True` if the expected proposer is the fallback preconfer
bool isFallback;
// Address of the expected proposer (opted-in or fallback)
address proposer;
// Starting timestamp of the preconfing window
uint256 submissionWindowStart;
// Ending timestamp of the preconfing window
uint256 submissionWindowEnd;
// The lookahead slot covering the current preconfing window
LookaheadSlot lookaheadSlot;
}
error CommitmentSignerMismatch();
error CommitterMismatch();
error InvalidLookahead();
error InvalidLookaheadEpoch();
error InvalidLookaheadTimestamp();
error InvalidSlotIndex();
error InvalidSlotTimestamp();
error InvalidValidatorLeafIndex();
error LookaheadNotRequired();
error NotInbox();
error OperatorHasBeenBlacklisted();
error OperatorHasBeenSlashed();
error OperatorHasInsufficientCollateral();
error OperatorHasNotOptedIn();
error OperatorHasNotRegistered();
error OperatorHasUnregistered();
error ProposerIsNotPreconfer();
error ProposerIsNotFallbackPreconfer();
error SlotTimestampIsNotIncrementing();
event LookaheadPosted(
uint256 indexed epochTimestamp, bytes32 lookaheadHash, LookaheadSlot[] lookaheadSlots
);
/// @notice Calculates the lookahead hash for a given epoch and lookahead slots.
/// @param _epochTimestamp The timestamp of the epoch.
/// @param _lookaheadSlots The lookahead slots.
/// @return The lookahead hash.
function calculateLookaheadHash(
uint256 _epochTimestamp,
LookaheadSlot[] memory _lookaheadSlots
)
external
pure
returns (bytes26);
/// @notice Returns the proposer context for the given lookahead input and epoch.
/// @dev Useful for off-chain nodes to determine the next proposer/preconfer.
/// @param _data The lookahead data for the proposer's epoch, plus the next epoch.
/// @param _epochTimestamp The timestamp of the proposer's epoch.
/// @return context_ The proposer context, including the proposer and submission window bounds.
function getProposerContext(
LookaheadData memory _data,
uint256 _epochTimestamp
)
external
view
returns (ProposerContext memory context_);
/// @notice Returns true if the lookahead is required for the next epoch.
/// @return True if the lookahead is required for the next epoch, false otherwise.
function isLookaheadRequired() external view returns (bool);
/// @notice Returns the lookahead hash for an epoch.
/// @param _epochTimestamp The timestamp of the epoch.
/// @return The lookahead hash. If the epoch is not found, returns 0.
function getLookaheadHash(uint256 _epochTimestamp) external view returns (bytes26);
/// @notice Returns the configuration of the lookahead store.
/// @return The configuration of the lookahead store.
function getLookaheadStoreConfig() external pure returns (LookaheadStoreConfig memory);
/// @notice Checks if a lookahead operator is valid for the next epoch.
/// @dev Reverts if the operator is not valid
/// @param _epochTimestamp The timestamp of the epoch for which the lookahead is posted.
/// @param _registrationRoot The URC registration root of the operator.
/// @return True if the operator is valid
function isLookaheadOperatorValid(
uint256 _epochTimestamp,
bytes32 _registrationRoot
)
external
view
returns (bool);
/// @notice Checks if a lookahead poster is valid for the next epoch.
/// @dev Reverts if the operator is not valid
/// @param _epochTimestamp The timestamp of the next epoch.
/// @param _registrationRoot The URC registration root of the poster.
/// @return True if the poster is valid
function isLookaheadPosterValid(
uint256 _epochTimestamp,
bytes32 _registrationRoot
)
external
view
returns (bool);
}
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 "../iface/ILookaheadStore.sol";
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 Calculates the lookahead hash.
/// @param _epochTimestamp The timestamp of the epoch.
/// @param _lookaheadSlots The lookahead slots array.
/// @return The hash of the abi.encoded timestamp and lookahed slots.
function calculateLookaheadHash(
uint256 _epochTimestamp,
ILookaheadStore.LookaheadSlot[] memory _lookaheadSlots
)
internal
pure
returns (bytes26)
{
return bytes26(keccak256(abi.encode(_epochTimestamp, _lookaheadSlots)));
}
/// @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;
address internal immutable __resolver;
// ---------------------------------------------------------------
// State Variables
// ---------------------------------------------------------------
uint256[50] private __gapFromOldAddressResolver;
/// @dev Slot 1.
uint8 internal __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
function _storeReentryLock(uint8 _reentry) internal virtual {
__reentry = _reentry;
}
// Loads the reentry lock
function _loadReentryLock() internal view virtual returns (uint8 reentry_) {
reentry_ = __reentry;
}
// ---------------------------------------------------------------
// 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-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/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/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
}
}
}
node_modules/solady/src/utils/ext/ithaca/BLS.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @notice BLS wrapper.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/BLS.sol)
/// @author Ithaca (https://github.com/ithacaxyz/odyssey-examples/blob/main/chapter1/contracts/src/libraries/BLS.sol)
///
/// @dev Precompile addresses come from the BLS addresses submodule in AlphaNet, see
/// See: (https://github.com/paradigmxyz/alphanet/blob/main/crates/precompile/src/addresses.rs)
///
/// Note:
/// - This implementation uses `mcopy`, since any chain that is edgy enough to
/// implement the BLS precompiles will definitely have implemented cancun.
/// - For efficiency, we use the legacy `staticcall` to call the precompiles.
/// For the intended use case in an entry points that requires gas-introspection,
/// which requires legacy bytecode, this won't be a blocker.
library BLS {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STRUCTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// We use flattened structs to make encoding more efficient.
// All structs use Big endian encoding.
// See: https://eips.ethereum.org/EIPS/eip-2537
/// @dev A representation of a base field element (Fp) in the BLS12-381 curve.
/// Due to the size of `p`,
/// `0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab`
/// the top 16 bytes are always zeroes.
struct Fp {
bytes32 a; // Upper 32 bytes.
bytes32 b; // Lower 32 bytes.
}
/// @dev A representation of an extension field element (Fp2) in the BLS12-381 curve.
struct Fp2 {
bytes32 c0_a;
bytes32 c0_b;
bytes32 c1_a;
bytes32 c1_b;
}
/// @dev A representation of a point on the G1 curve of BLS12-381.
struct G1Point {
bytes32 x_a;
bytes32 x_b;
bytes32 y_a;
bytes32 y_b;
}
/// @dev A representation of a point on the G2 curve of BLS12-381.
struct G2Point {
bytes32 x_c0_a;
bytes32 x_c0_b;
bytes32 x_c1_a;
bytes32 x_c1_b;
bytes32 y_c0_a;
bytes32 y_c0_b;
bytes32 y_c1_a;
bytes32 y_c1_b;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PRECOMPILE ADDRESSES */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev For addition of two points on the BLS12-381 G1 curve,
address internal constant BLS12_G1ADD = 0x000000000000000000000000000000000000000b;
/// @dev For multi-scalar multiplication (MSM) on the BLS12-381 G1 curve.
address internal constant BLS12_G1MSM = 0x000000000000000000000000000000000000000C;
/// @dev For addition of two points on the BLS12-381 G2 curve.
address internal constant BLS12_G2ADD = 0x000000000000000000000000000000000000000d;
/// @dev For multi-scalar multiplication (MSM) on the BLS12-381 G2 curve.
address internal constant BLS12_G2MSM = 0x000000000000000000000000000000000000000E;
/// @dev For performing a pairing check on the BLS12-381 curve.
address internal constant BLS12_PAIRING_CHECK = 0x000000000000000000000000000000000000000F;
/// @dev For mapping a Fp to a point on the BLS12-381 G1 curve.
address internal constant BLS12_MAP_FP_TO_G1 = 0x0000000000000000000000000000000000000010;
/// @dev For mapping a Fp2 to a point on the BLS12-381 G2 curve.
address internal constant BLS12_MAP_FP2_TO_G2 = 0x0000000000000000000000000000000000000011;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// A custom error for each precompile helps us in debugging which precompile has failed.
/// @dev The G1Add operation failed.
error G1AddFailed();
/// @dev The G1MSM operation failed.
error G1MSMFailed();
/// @dev The G2Add operation failed.
error G2AddFailed();
/// @dev The G2MSM operation failed.
error G2MSMFailed();
/// @dev The pairing operation failed.
error PairingFailed();
/// @dev The MapFpToG1 operation failed.
error MapFpToG1Failed();
/// @dev The MapFpToG2 operation failed.
error MapFp2ToG2Failed();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Adds two G1 points. Returns a new G1 point.
function add(G1Point memory point0, G1Point memory point1)
internal
view
returns (G1Point memory result)
{
assembly ("memory-safe") {
mcopy(result, point0, 0x80)
mcopy(add(result, 0x80), point1, 0x80)
if iszero(
and(
eq(returndatasize(), 0x80),
staticcall(gas(), BLS12_G1ADD, result, 0x100, result, 0x80)
)
) {
mstore(0x00, 0xd6cc76eb) // `G1AddFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Multi-scalar multiplication of G1 points with scalars. Returns a new G1 point.
function msm(G1Point[] memory points, bytes32[] memory scalars)
internal
view
returns (G1Point memory result)
{
assembly ("memory-safe") {
let k := mload(points)
let d := sub(scalars, points)
for { let i := 0 } iszero(eq(i, k)) { i := add(i, 1) } {
points := add(points, 0x20)
let o := add(result, mul(0xa0, i))
mcopy(o, mload(points), 0x80)
mstore(add(o, 0x80), mload(add(points, d)))
}
if iszero(
and(
and(eq(k, mload(scalars)), eq(returndatasize(), 0x80)),
staticcall(gas(), BLS12_G1MSM, result, mul(0xa0, k), result, 0x80)
)
) {
mstore(0x00, 0x5f776986) // `G1MSMFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Adds two G2 points. Returns a new G2 point.
function add(G2Point memory point0, G2Point memory point1)
internal
view
returns (G2Point memory result)
{
assembly ("memory-safe") {
mcopy(result, point0, 0x100)
mcopy(add(result, 0x100), point1, 0x100)
if iszero(
and(
eq(returndatasize(), 0x100),
staticcall(gas(), BLS12_G2ADD, result, 0x200, result, 0x100)
)
) {
mstore(0x00, 0xc55e5e33) // `G2AddFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Multi-scalar multiplication of G2 points with scalars. Returns a new G2 point.
function msm(G2Point[] memory points, bytes32[] memory scalars)
internal
view
returns (G2Point memory result)
{
assembly ("memory-safe") {
let k := mload(points)
let d := sub(scalars, points)
for { let i := 0 } iszero(eq(i, k)) { i := add(i, 1) } {
points := add(points, 0x20)
let o := add(result, mul(0x120, i))
mcopy(o, mload(points), 0x100)
mstore(add(o, 0x100), mload(add(d, points)))
}
if iszero(
and(
and(eq(k, mload(scalars)), eq(returndatasize(), 0x100)),
staticcall(gas(), BLS12_G2MSM, result, mul(0x120, k), result, 0x100)
)
) {
mstore(0x00, 0xe3dc5425) // `G2MSMFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Checks the pairing of G1 points with G2 points. Returns whether the pairing is valid.
function pairing(G1Point[] memory g1Points, G2Point[] memory g2Points)
internal
view
returns (bool result)
{
assembly ("memory-safe") {
let k := mload(g1Points)
let m := mload(0x40)
let d := sub(g2Points, g1Points)
for { let i := 0 } iszero(eq(i, k)) { i := add(i, 1) } {
g1Points := add(g1Points, 0x20)
let o := add(m, mul(0x180, i))
mcopy(o, mload(g1Points), 0x80)
mcopy(add(o, 0x80), mload(add(d, g1Points)), 0x100)
}
if iszero(
and(
and(eq(k, mload(g2Points)), eq(returndatasize(), 0x20)),
staticcall(gas(), BLS12_PAIRING_CHECK, m, mul(0x180, k), 0x00, 0x20)
)
) {
mstore(0x00, 0x4df45e2f) // `PairingFailed()`.
revert(0x1c, 0x04)
}
result := mload(0x00)
}
}
/// @dev Maps a Fp element to a G1 point.
function toG1(Fp memory element) internal view returns (G1Point memory result) {
assembly ("memory-safe") {
if iszero(
and(
eq(returndatasize(), 0x80),
staticcall(gas(), BLS12_MAP_FP_TO_G1, element, 0x40, result, 0x80)
)
) {
mstore(0x00, 0x24a289fc) // `MapFpToG1Failed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Maps a Fp2 element to a G2 point.
function toG2(Fp2 memory element) internal view returns (G2Point memory result) {
assembly ("memory-safe") {
if iszero(
and(
eq(returndatasize(), 0x100),
staticcall(gas(), BLS12_MAP_FP2_TO_G2, element, 0x80, result, 0x100)
)
) {
mstore(0x00, 0x89083b91) // `MapFp2ToG2Failed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Computes a point in G2 from a message.
function hashToG2(bytes memory message) internal view returns (G2Point memory result) {
assembly ("memory-safe") {
function dstPrime(o_, i_) -> _o {
mstore8(o_, i_) // 1.
mstore(add(o_, 0x01), "BLS_SIG_BLS12381G2_XMD:SHA-256_S") // 32.
mstore(add(o_, 0x21), "SWU_RO_NUL_\x2b") // 12.
_o := add(0x2d, o_)
}
function sha2(data_, n_) -> _h {
if iszero(
and(eq(returndatasize(), 0x20), staticcall(gas(), 2, data_, n_, 0x00, 0x20))
) { revert(calldatasize(), 0x00) }
_h := mload(0x00)
}
function modfield(s_, b_) {
mcopy(add(s_, 0x60), b_, 0x40)
if iszero(
and(eq(returndatasize(), 0x40), staticcall(gas(), 5, s_, 0x100, b_, 0x40))
) { revert(calldatasize(), 0x00) }
}
function mapToG2(s_, r_) {
if iszero(
and(
eq(returndatasize(), 0x100),
staticcall(gas(), BLS12_MAP_FP2_TO_G2, s_, 0x80, r_, 0x100)
)
) {
mstore(0x00, 0x89083b91) // `MapFp2ToG2Failed()`.
revert(0x1c, 0x04)
}
}
let b := mload(0x40)
let s := add(b, 0x100)
calldatacopy(s, calldatasize(), 0x40)
mcopy(add(0x40, s), add(0x20, message), mload(message))
let o := add(add(0x40, s), mload(message))
mstore(o, shl(240, 256))
let b0 := sha2(s, sub(dstPrime(add(0x02, o), 0), s))
mstore(0x20, b0)
mstore(s, b0)
mstore(b, sha2(s, sub(dstPrime(add(0x20, s), 1), s)))
let j := b
for { let i := 2 } 1 {} {
mstore(s, xor(b0, mload(j)))
j := add(j, 0x20)
mstore(j, sha2(s, sub(dstPrime(add(0x20, s), i), s)))
i := add(i, 1)
if eq(i, 9) { break }
}
mstore(add(s, 0x00), 0x40)
mstore(add(s, 0x20), 0x20)
mstore(add(s, 0x40), 0x40)
mstore(add(s, 0xa0), 1)
mstore(add(s, 0xc0), 0x000000000000000000000000000000001a0111ea397fe69a4b1ba7b6434bacd7)
mstore(add(s, 0xe0), 0x64774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab)
modfield(s, add(b, 0x00))
modfield(s, add(b, 0x40))
modfield(s, add(b, 0x80))
modfield(s, add(b, 0xc0))
mapToG2(b, result)
mapToG2(add(0x80, b), add(0x100, result))
if iszero(
and(
eq(returndatasize(), 0x100),
staticcall(gas(), BLS12_G2ADD, result, 0x200, result, 0x100)
)
) {
mstore(0x00, 0xc55e5e33) // `G2AddFailed()`.
revert(0x1c, 0x04)
}
}
}
}
node_modules/urc/src/ISlasher.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0 <0.9.0;
import { BLS } from "solady/utils/ext/ithaca/BLS.sol";
interface ISlasher {
/// @notice A Delegation message from a proposer's BLS key to a delegate's BLS and ECDSA key
struct Delegation {
/// The proposer's BLS public key
BLS.G1Point proposer;
/// The delegate's BLS public key for Constraints API
BLS.G1Point delegate;
/// The address of the delegate's ECDSA key for signing commitments
address committer;
/// The slot number the delegation is valid for
uint64 slot;
/// Arbitrary metadata reserved for future use
bytes metadata;
}
/// @notice A delegation message signed by a proposer's BLS key
struct SignedDelegation {
/// The delegation message
Delegation delegation;
/// The signature of the delegation message
BLS.G2Point signature;
}
/// @notice A Commitment message binding an opaque payload to a slasher contract
struct Commitment {
/// The type of commitment
uint64 commitmentType;
/// The payload of the commitment
bytes payload;
/// The address of the slasher contract
address slasher;
}
/// @notice A commitment message signed by a delegate's ECDSA key
struct SignedCommitment {
/// The commitment message
Commitment commitment;
/// The signature of the commitment message
bytes signature;
}
/// @notice Slash a proposer's BLS key for a given delegation and a commitment
/// @dev The URC will call this function to slash a registered operator if supplied with valid evidence
/// @dev Note that the `delegation` may be optional in cases where the slashing is due
/// @dev to a commitment that is not associated with an off-chain delegation
/// @dev Note when implementing this function, if the `evidence` is unused, the contract should assert it is empty to prevent replaying slashings on the URC.
/// @dev Note when implementing this function, the contract should not allow permutations of the `evidence` to result in the same slashing result to prevent replaying slashings on the URC.
/// @param delegation The delegation message
/// @param commitment The commitment message
/// @param committer The address of the committer
/// @param evidence Arbitrary evidence for the slashing
/// @param challenger The address of the challenger
/// @return slashAmountWei The amount of WEI slashed
function slash(
Delegation calldata delegation,
Commitment calldata commitment,
address committer,
bytes calldata evidence,
address challenger
) external returns (uint256 slashAmountWei);
}
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/","@optimism/=node_modules/optimism/","@sp1-contracts/=node_modules/sp1-contracts/contracts/","forge-std/=node_modules/forge-std/","@p256-verifier/contracts/=node_modules/p256-verifier/src/","@eth-fabric/urc/=node_modules/urc/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":{},"evmVersion":"prague"}
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
0x60e060405230608052348015610013575f5ffd5b506040516122613803806122618339810160408190526100329161012e565b61003a610072565b6001600160a01b038116610061576040516337a3b5f360e11b815260040160405180910390fd5b6001600160a01b031660c05261015b565b5f54610100900460ff16156100dd5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff9081161461012c575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b5f6020828403121561013e575f5ffd5b81516001600160a01b0381168114610154575f5ffd5b9392505050565b60805160a05160c0516120c06101a15f395f610a7901525f6101e201525f81816107ab015281816107eb015281816108fe0152818161093e01526109b501526120c05ff3fe6080604052600436106101d0575f3560e01c8063715018a6116100fd5780638da5cb5b11610092578063e30c397811610062578063e30c3978146105c0578063f2fde38b146105dd578063f46673f6146105fc578063f96214de14610312575f5ffd5b80638da5cb5b1461051a5780639b724f9e14610537578063ac0004da14610556578063cecad1f71461058c575f5ffd5b80637f918e2c116100cd5780637f918e2c146104af5780638456cb59146104d35780638a1af4c4146104e75780638abf607714610506575f5ffd5b8063715018a61461045a57806372a8a5511461046e57806379ba5097146104825780637c6f315814610496575f5ffd5b8063343f0a68116101735780634f1ef286116101435780634f1ef286146103e657806352d1902d146103f95780635c975abb1461041b5780636240b71c1461043b575f5ffd5b8063343f0a681461036b5780633659cfe61461037f5780633f4ba83a1461039e57806342b83b8e146103b2575f5ffd5b806319ab453c116101ae57806319ab453c146102f15780632fb17ffc146103125780633075db5614610338578063316eae6a1461034c575f5ffd5b806304f3bcec146101d4578063107538eb1461021f57806313e7c9d81461025d575b5f5ffd5b3480156101df575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561022a575f5ffd5b5061024d610239366004611bfa565b60fe6020525f908152604090205460ff1681565b6040519015158152602001610216565b348015610268575f5ffd5b506102b8610277366004611bfa565b60fb6020525f908152604090205463ffffffff80821691640100000000810490911690600160401b810460ff1690600160481b90046001600160a01b031684565b6040805163ffffffff958616815294909316602085015260ff909116918301919091526001600160a01b03166060820152608001610216565b3480156102fc575f5ffd5b5061031061030b366004611bfa565b61061b565b005b34801561031d575f5ffd5b50610326600281565b60405160ff9091168152602001610216565b348015610343575f5ffd5b5061024d61072d565b348015610357575f5ffd5b5061024d610366366004611c13565b610745565b348015610376575f5ffd5b5061020261078a565b34801561038a575f5ffd5b50610310610399366004611bfa565b6107a1565b3480156103a9575f5ffd5b50610310610868565b3480156103bd575f5ffd5b506103d16103cc366004611c50565b6108c3565b60405163ffffffff9091168152602001610216565b6103106103f4366004611c7b565b6108f4565b348015610404575f5ffd5b5061040d6109a9565b604051908152602001610216565b348015610426575f5ffd5b5061024d60c954610100900460ff1660021490565b348015610446575f5ffd5b50610310610455366004611d3f565b610a5a565b348015610465575f5ffd5b50610310610b16565b348015610479575f5ffd5b50610202610b27565b34801561048d575f5ffd5b50610310610b35565b3480156104a1575f5ffd5b5060fd546103269060ff1681565b3480156104ba575f5ffd5b5060fd546103d190640100000000900463ffffffff1681565b3480156104de575f5ffd5b50610310610bac565b3480156104f2575f5ffd5b50610310610501366004611d6d565b610c01565b348015610511575f5ffd5b50610202610c4f565b348015610525575f5ffd5b506033546001600160a01b0316610202565b348015610542575f5ffd5b50610310610551366004611bfa565b610c58565b348015610561575f5ffd5b50610575610570366004611d9e565b610ca5565b60405165ffffffffffff9091168152602001610216565b348015610597575f5ffd5b506102026105a6366004611c50565b60fc6020525f90815260409020546001600160a01b031681565b3480156105cb575f5ffd5b506065546001600160a01b0316610202565b3480156105e8575f5ffd5b506103106105f7366004611bfa565b610d18565b348015610607575f5ffd5b50610310610616366004611c50565b610d89565b5f54610100900460ff161580801561063957505f54600160ff909116105b806106525750303b15801561065257505f5460ff166001145b6106ba5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff1916600117905580156106db575f805461ff0019166101001790555b6106e482610e12565b8015610729575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b5f600261073c60c95460ff1690565b60ff1614905090565b6001600160a01b0382165f90815260fb60205260408120805463ffffffff16801580159061077f57508063ffffffff168463ffffffff1610155b925050505b92915050565b5f61079c6107975f6108c3565b610e70565b905090565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036107e95760405162461bcd60e51b81526004016106b190611e1c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661081b61101b565b6001600160a01b0316146108415760405162461bcd60e51b81526004016106b190611e68565b61084a81611036565b604080515f808252602082019092526108659183919061103e565b50565b6108706111ad565b61088460c9805461ff001916610100179055565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200160405180910390a16108c1335f6111de565b565b5f6108d0600c6020611ec8565b6108da9083611ec8565b6108e26111e6565b65ffffffffffff166107849190611edf565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361093c5760405162461bcd60e51b81526004016106b190611e1c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661096e61101b565b6001600160a01b0316146109945760405162461bcd60e51b81526004016106b190611e68565b61099d82611036565b6107298282600161103e565b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a485760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106b1565b505f5160206120445f395f51905f5290565b6033546001600160a01b0316331480610a9b5750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b610ab85760405163debe0a0160e01b815260040160405180910390fd5b6001600160a01b0382165f81815260fe6020908152604091829020805460ff191685151590811790915591519182527f4517b9cadd80ff3722ce16d2ab8a83d39a8e57ee04a761501325b52a627543f9910160405180910390a25050565b610b1e6111f0565b6108c15f61124a565b5f61079c61079760016108c3565b60655433906001600160a01b03168114610ba35760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106b1565b6108658161124a565b610bb4611263565b60c9805461ff0019166102001790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200160405180910390a16108c13360016111de565b6033546001600160a01b0316331480610c285750335f90815260fe602052604090205460ff165b610c45576040516319128cc360e01b815260040160405180910390fd5b6107298282611295565b5f61079c61101b565b6033546001600160a01b0316331480610c7f5750335f90815260fe602052604090205460ff165b610c9c576040516319128cc360e01b815260040160405180910390fd5b6108658161141f565b5f5f610cb36107975f6108c3565b90506001600160a01b038116610cdc57604051634100ac0360e01b815260040160405180910390fd5b846001600160a01b0316816001600160a01b031614610d0e57604051634100ac0360e01b815260040160405180910390fd5b505f949350505050565b610d206111f0565b606580546001600160a01b0383166001600160a01b03199091168117909155610d516033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331480610db05750335f90815260fe602052604090205460ff165b610dcd576040516319128cc360e01b815260040160405180910390fd5b60fd5460ff168110610df2576040516301fa53c760e11b815260040160405180910390fd5b5f81815260fc6020526040902054610865906001600160a01b031661141f565b5f54610100900460ff16610e385760405162461bcd60e51b81526004016106b190611ef2565b610e40611620565b610e5e6001600160a01b03821615610e58578161124a565b3361124a565b5060c9805461ff001916610100179055565b5f61030063ffffffff83168282821015610e8a5781610e8e565b8282035b60fd5490915060ff811690640100000000900463ffffffff165f829003610ebb57505f9695505050505050565b5f610ec584611646565b90508163ffffffff168863ffffffff1610610f125760fc5f848381610eec57610eec611f3d565b06815260208101919091526040015f20546001600160a01b031698975050505050505050565b5f8367ffffffffffffffff811115610f2c57610f2c611c67565b604051908082528060200260200182016040528015610f55578160200160208202803683370190505b5090505f5f5b85811015610fcc575f81815260fc60205260409020546001600160a01b0316610f84818d610745565b15610fc35780848480600101955081518110610fa257610fa2611f51565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50600101610f5b565b50805f03610fe357505f9998505050505050505050565b81818481610ff357610ff3611f3d565b068151811061100457611004611f51565b602002602001015198505050505050505050919050565b5f5160206120445f395f51905f52546001600160a01b031690565b6108656111f0565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611076576110718361165e565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110d0575060408051601f3d908101601f191682019092526110cd91810190611f65565b60015b6111335760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106b1565b5f5160206120445f395f51905f5281146111a15760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106b1565b506110718383836116f9565b6111c160c954610100900460ff1660021490565b6108c15760405163bae6e2a960e01b815260040160405180910390fd5b6107296111f0565b5f61079c5f611723565b6033546001600160a01b031633146108c15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b1565b606580546001600160a01b0319169055610865816117a7565b61127760c954610100900460ff1660021490565b156108c15760405163bae6e2a960e01b815260040160405180910390fd5b6001600160a01b0382166112bc5760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0381166112e35760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0382165f90815260fb60205260409020805463ffffffff161561132057604051630a27252560e21b815260040160405180910390fd5b5f61132b60026108c3565b60fd54835460ff60401b191660ff909116600160401b81029190911784555f81815260fc6020526040902080546001600160a01b0319166001600160a01b03881617905590915061137d816001611f7c565b60fd805460ff191660ff92909216919091178155835463ffffffff841668ffffffffff00000001600160e81b03199091168117600160481b6001600160a01b03888116918202929092178755835467ffffffff0000000019166401000000008402179093556040519182528716907f20c899c9053446f0d7a408c709f0196e2c26c6a985dcad854dc19ad567c4531f9060200160405180910390a35050505050565b60fd54600160ff9091161161144757604051633c0e8c9360e11b815260040160405180910390fd5b6001600160a01b03811661146e5760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b038082165f90815260fb6020526040902080549091600160481b909104166114b05760405163eb32d3bf60e01b815260040160405180910390fd5b5f6114ba5f6108c3565b90506114c68382610745565b156114f2576114d583826117f8565b6114f257604051632437b50360e11b815260040160405180910390fd5b815460fd546001600160a01b03600160481b8304169160ff600160401b9091048116915f916115249160019116611f95565b90508060ff168260ff16146115915760ff8181165f90815260fc602090815260408083205493861680845281842080546001600160a01b039096166001600160a01b03199096168617905593835260fb9091529020805460ff60401b1916600160401b9092029190911790555b60ff81165f81815260fc6020908152604080832080546001600160a01b03191690556001600160a01b038a811680855260fb84529382902080546001600160e81b031916905560fd805460ff191690951790945551428152928616927fa85b3d3497f1e4522d447f02e1a1d16506431ba902da11611a51d8502400e4ea910160405180910390a3505050505050565b5f54610100900460ff166108c15760405162461bcd60e51b81526004016106b190611ef2565b5f5f6116578363ffffffff16611861565b9392505050565b6001600160a01b0381163b6116cb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106b1565b5f5160206120445f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b611702836118d9565b5f8251118061170e5750805b156110715761171d8383611918565b50505050565b5f5f61172e4661193d565b90505f61173b8242611fae565b90505f61174a600c6020611ec8565b611756600c6020611ec8565b6117609084611fc1565b61176a9190611ec8565b905061179e61177b600c6020611ec8565b6117859087611ec8565b61178f8386611edf565b6117999190611edf565b611998565b95945050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60fd545f9060ff16815b8160ff168160ff161015610d0e5760ff81165f90815260fc60205260409020546001600160a01b03908116908616810361183c5750611859565b6118468186610745565b156118575760019350505050610784565b505b600101611802565b5f61186b4661193d565b82101561187957505f919050565b611884600c83611edf565b9150425f5b6020811080156118995750818411155b156118d0575f6118a885611a02565b905080156118b857949350505050565b600c8501945050806118c990611fe0565b9050611889565b505f9392505050565b6118e28161165e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060611657838360405180606001604052806027815260200161206460279139611ac1565b5f600182036119515750635fc63057919050565b614268820361196557506365156ac0919050565b6401a2140cff820361197c57506366755d6c919050565b62088bb0820361199157506367d81118919050565b505f919050565b5f65ffffffffffff8211156119fe5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b60648201526084016106b1565b5090565b5f5f5f720f3df6d732807ef1319fb7b8bb8522d0beac026001600160a01b031684604051602001611a3591815260200190565b60408051601f1981840301815290829052611a4f91611ff8565b5f60405180830381855afa9150503d805f8114611a87576040519150601f19603f3d011682016040523d82523d5f602084013e611a8c565b606091505b5091509150818015611a9e57505f8151115b15611aba5780806020019051810190611ab79190611f65565b92505b5050919050565b60605f5f856001600160a01b031685604051611add9190611ff8565b5f60405180830381855af49150503d805f8114611b15576040519150601f19603f3d011682016040523d82523d5f602084013e611b1a565b606091505b5091509150611b2b86838387611b35565b9695505050505050565b60608315611ba35782515f03611b9c576001600160a01b0385163b611b9c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b1565b5081611bad565b611bad8383611bb5565b949350505050565b815115611bc55781518083602001fd5b8060405162461bcd60e51b81526004016106b1919061200e565b80356001600160a01b0381168114611bf5575f5ffd5b919050565b5f60208284031215611c0a575f5ffd5b61165782611bdf565b5f5f60408385031215611c24575f5ffd5b611c2d83611bdf565b9150602083013563ffffffff81168114611c45575f5ffd5b809150509250929050565b5f60208284031215611c60575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215611c8c575f5ffd5b611c9583611bdf565b9150602083013567ffffffffffffffff811115611cb0575f5ffd5b8301601f81018513611cc0575f5ffd5b803567ffffffffffffffff811115611cda57611cda611c67565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715611d0957611d09611c67565b604052818152828201602001871015611d20575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f60408385031215611d50575f5ffd5b611d5983611bdf565b915060208301358015158114611c45575f5ffd5b5f5f60408385031215611d7e575f5ffd5b611d8783611bdf565b9150611d9560208401611bdf565b90509250929050565b5f5f5f60408486031215611db0575f5ffd5b611db984611bdf565b9250602084013567ffffffffffffffff811115611dd4575f5ffd5b8401601f81018613611de4575f5ffd5b803567ffffffffffffffff811115611dfa575f5ffd5b866020828401011115611e0b575f5ffd5b939660209190910195509293505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761078457610784611eb4565b8082018082111561078457610784611eb4565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611f75575f5ffd5b5051919050565b60ff818116838216019081111561078457610784611eb4565b60ff828116828216039081111561078457610784611eb4565b8181038181111561078457610784611eb4565b5f82611fdb57634e487b7160e01b5f52601260045260245ffd5b500490565b5f60018201611ff157611ff1611eb4565b5060010190565b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220882b29a6f47efe65577affcd2ae0ad134393dbf20eb4204120a3824d0263e31464736f6c634300081e00330000000000000000000000004779d18931b35540f84b0cd0e9633855b84df7b8
Deployed ByteCode
0x6080604052600436106101d0575f3560e01c8063715018a6116100fd5780638da5cb5b11610092578063e30c397811610062578063e30c3978146105c0578063f2fde38b146105dd578063f46673f6146105fc578063f96214de14610312575f5ffd5b80638da5cb5b1461051a5780639b724f9e14610537578063ac0004da14610556578063cecad1f71461058c575f5ffd5b80637f918e2c116100cd5780637f918e2c146104af5780638456cb59146104d35780638a1af4c4146104e75780638abf607714610506575f5ffd5b8063715018a61461045a57806372a8a5511461046e57806379ba5097146104825780637c6f315814610496575f5ffd5b8063343f0a68116101735780634f1ef286116101435780634f1ef286146103e657806352d1902d146103f95780635c975abb1461041b5780636240b71c1461043b575f5ffd5b8063343f0a681461036b5780633659cfe61461037f5780633f4ba83a1461039e57806342b83b8e146103b2575f5ffd5b806319ab453c116101ae57806319ab453c146102f15780632fb17ffc146103125780633075db5614610338578063316eae6a1461034c575f5ffd5b806304f3bcec146101d4578063107538eb1461021f57806313e7c9d81461025d575b5f5ffd5b3480156101df575f5ffd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561022a575f5ffd5b5061024d610239366004611bfa565b60fe6020525f908152604090205460ff1681565b6040519015158152602001610216565b348015610268575f5ffd5b506102b8610277366004611bfa565b60fb6020525f908152604090205463ffffffff80821691640100000000810490911690600160401b810460ff1690600160481b90046001600160a01b031684565b6040805163ffffffff958616815294909316602085015260ff909116918301919091526001600160a01b03166060820152608001610216565b3480156102fc575f5ffd5b5061031061030b366004611bfa565b61061b565b005b34801561031d575f5ffd5b50610326600281565b60405160ff9091168152602001610216565b348015610343575f5ffd5b5061024d61072d565b348015610357575f5ffd5b5061024d610366366004611c13565b610745565b348015610376575f5ffd5b5061020261078a565b34801561038a575f5ffd5b50610310610399366004611bfa565b6107a1565b3480156103a9575f5ffd5b50610310610868565b3480156103bd575f5ffd5b506103d16103cc366004611c50565b6108c3565b60405163ffffffff9091168152602001610216565b6103106103f4366004611c7b565b6108f4565b348015610404575f5ffd5b5061040d6109a9565b604051908152602001610216565b348015610426575f5ffd5b5061024d60c954610100900460ff1660021490565b348015610446575f5ffd5b50610310610455366004611d3f565b610a5a565b348015610465575f5ffd5b50610310610b16565b348015610479575f5ffd5b50610202610b27565b34801561048d575f5ffd5b50610310610b35565b3480156104a1575f5ffd5b5060fd546103269060ff1681565b3480156104ba575f5ffd5b5060fd546103d190640100000000900463ffffffff1681565b3480156104de575f5ffd5b50610310610bac565b3480156104f2575f5ffd5b50610310610501366004611d6d565b610c01565b348015610511575f5ffd5b50610202610c4f565b348015610525575f5ffd5b506033546001600160a01b0316610202565b348015610542575f5ffd5b50610310610551366004611bfa565b610c58565b348015610561575f5ffd5b50610575610570366004611d9e565b610ca5565b60405165ffffffffffff9091168152602001610216565b348015610597575f5ffd5b506102026105a6366004611c50565b60fc6020525f90815260409020546001600160a01b031681565b3480156105cb575f5ffd5b506065546001600160a01b0316610202565b3480156105e8575f5ffd5b506103106105f7366004611bfa565b610d18565b348015610607575f5ffd5b50610310610616366004611c50565b610d89565b5f54610100900460ff161580801561063957505f54600160ff909116105b806106525750303b15801561065257505f5460ff166001145b6106ba5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b5f805460ff1916600117905580156106db575f805461ff0019166101001790555b6106e482610e12565b8015610729575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b5f600261073c60c95460ff1690565b60ff1614905090565b6001600160a01b0382165f90815260fb60205260408120805463ffffffff16801580159061077f57508063ffffffff168463ffffffff1610155b925050505b92915050565b5f61079c6107975f6108c3565b610e70565b905090565b6001600160a01b037f000000000000000000000000604c61d6618aacdf7a7a2fe4c42e35ecba32ae751630036107e95760405162461bcd60e51b81526004016106b190611e1c565b7f000000000000000000000000604c61d6618aacdf7a7a2fe4c42e35ecba32ae756001600160a01b031661081b61101b565b6001600160a01b0316146108415760405162461bcd60e51b81526004016106b190611e68565b61084a81611036565b604080515f808252602082019092526108659183919061103e565b50565b6108706111ad565b61088460c9805461ff001916610100179055565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa9060200160405180910390a16108c1335f6111de565b565b5f6108d0600c6020611ec8565b6108da9083611ec8565b6108e26111e6565b65ffffffffffff166107849190611edf565b6001600160a01b037f000000000000000000000000604c61d6618aacdf7a7a2fe4c42e35ecba32ae7516300361093c5760405162461bcd60e51b81526004016106b190611e1c565b7f000000000000000000000000604c61d6618aacdf7a7a2fe4c42e35ecba32ae756001600160a01b031661096e61101b565b6001600160a01b0316146109945760405162461bcd60e51b81526004016106b190611e68565b61099d82611036565b6107298282600161103e565b5f306001600160a01b037f000000000000000000000000604c61d6618aacdf7a7a2fe4c42e35ecba32ae751614610a485760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016106b1565b505f5160206120445f395f51905f5290565b6033546001600160a01b0316331480610a9b5750336001600160a01b037f0000000000000000000000004779d18931b35540f84b0cd0e9633855b84df7b816145b610ab85760405163debe0a0160e01b815260040160405180910390fd5b6001600160a01b0382165f81815260fe6020908152604091829020805460ff191685151590811790915591519182527f4517b9cadd80ff3722ce16d2ab8a83d39a8e57ee04a761501325b52a627543f9910160405180910390a25050565b610b1e6111f0565b6108c15f61124a565b5f61079c61079760016108c3565b60655433906001600160a01b03168114610ba35760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084016106b1565b6108658161124a565b610bb4611263565b60c9805461ff0019166102001790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200160405180910390a16108c13360016111de565b6033546001600160a01b0316331480610c285750335f90815260fe602052604090205460ff165b610c45576040516319128cc360e01b815260040160405180910390fd5b6107298282611295565b5f61079c61101b565b6033546001600160a01b0316331480610c7f5750335f90815260fe602052604090205460ff165b610c9c576040516319128cc360e01b815260040160405180910390fd5b6108658161141f565b5f5f610cb36107975f6108c3565b90506001600160a01b038116610cdc57604051634100ac0360e01b815260040160405180910390fd5b846001600160a01b0316816001600160a01b031614610d0e57604051634100ac0360e01b815260040160405180910390fd5b505f949350505050565b610d206111f0565b606580546001600160a01b0383166001600160a01b03199091168117909155610d516033546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b6033546001600160a01b0316331480610db05750335f90815260fe602052604090205460ff165b610dcd576040516319128cc360e01b815260040160405180910390fd5b60fd5460ff168110610df2576040516301fa53c760e11b815260040160405180910390fd5b5f81815260fc6020526040902054610865906001600160a01b031661141f565b5f54610100900460ff16610e385760405162461bcd60e51b81526004016106b190611ef2565b610e40611620565b610e5e6001600160a01b03821615610e58578161124a565b3361124a565b5060c9805461ff001916610100179055565b5f61030063ffffffff83168282821015610e8a5781610e8e565b8282035b60fd5490915060ff811690640100000000900463ffffffff165f829003610ebb57505f9695505050505050565b5f610ec584611646565b90508163ffffffff168863ffffffff1610610f125760fc5f848381610eec57610eec611f3d565b06815260208101919091526040015f20546001600160a01b031698975050505050505050565b5f8367ffffffffffffffff811115610f2c57610f2c611c67565b604051908082528060200260200182016040528015610f55578160200160208202803683370190505b5090505f5f5b85811015610fcc575f81815260fc60205260409020546001600160a01b0316610f84818d610745565b15610fc35780848480600101955081518110610fa257610fa2611f51565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50600101610f5b565b50805f03610fe357505f9998505050505050505050565b81818481610ff357610ff3611f3d565b068151811061100457611004611f51565b602002602001015198505050505050505050919050565b5f5160206120445f395f51905f52546001600160a01b031690565b6108656111f0565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615611076576110718361165e565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156110d0575060408051601f3d908101601f191682019092526110cd91810190611f65565b60015b6111335760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016106b1565b5f5160206120445f395f51905f5281146111a15760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016106b1565b506110718383836116f9565b6111c160c954610100900460ff1660021490565b6108c15760405163bae6e2a960e01b815260040160405180910390fd5b6107296111f0565b5f61079c5f611723565b6033546001600160a01b031633146108c15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b1565b606580546001600160a01b0319169055610865816117a7565b61127760c954610100900460ff1660021490565b156108c15760405163bae6e2a960e01b815260040160405180910390fd5b6001600160a01b0382166112bc5760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0381166112e35760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b0382165f90815260fb60205260409020805463ffffffff161561132057604051630a27252560e21b815260040160405180910390fd5b5f61132b60026108c3565b60fd54835460ff60401b191660ff909116600160401b81029190911784555f81815260fc6020526040902080546001600160a01b0319166001600160a01b03881617905590915061137d816001611f7c565b60fd805460ff191660ff92909216919091178155835463ffffffff841668ffffffffff00000001600160e81b03199091168117600160481b6001600160a01b03888116918202929092178755835467ffffffff0000000019166401000000008402179093556040519182528716907f20c899c9053446f0d7a408c709f0196e2c26c6a985dcad854dc19ad567c4531f9060200160405180910390a35050505050565b60fd54600160ff9091161161144757604051633c0e8c9360e11b815260040160405180910390fd5b6001600160a01b03811661146e5760405163eb32d3bf60e01b815260040160405180910390fd5b6001600160a01b038082165f90815260fb6020526040902080549091600160481b909104166114b05760405163eb32d3bf60e01b815260040160405180910390fd5b5f6114ba5f6108c3565b90506114c68382610745565b156114f2576114d583826117f8565b6114f257604051632437b50360e11b815260040160405180910390fd5b815460fd546001600160a01b03600160481b8304169160ff600160401b9091048116915f916115249160019116611f95565b90508060ff168260ff16146115915760ff8181165f90815260fc602090815260408083205493861680845281842080546001600160a01b039096166001600160a01b03199096168617905593835260fb9091529020805460ff60401b1916600160401b9092029190911790555b60ff81165f81815260fc6020908152604080832080546001600160a01b03191690556001600160a01b038a811680855260fb84529382902080546001600160e81b031916905560fd805460ff191690951790945551428152928616927fa85b3d3497f1e4522d447f02e1a1d16506431ba902da11611a51d8502400e4ea910160405180910390a3505050505050565b5f54610100900460ff166108c15760405162461bcd60e51b81526004016106b190611ef2565b5f5f6116578363ffffffff16611861565b9392505050565b6001600160a01b0381163b6116cb5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016106b1565b5f5160206120445f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b611702836118d9565b5f8251118061170e5750805b156110715761171d8383611918565b50505050565b5f5f61172e4661193d565b90505f61173b8242611fae565b90505f61174a600c6020611ec8565b611756600c6020611ec8565b6117609084611fc1565b61176a9190611ec8565b905061179e61177b600c6020611ec8565b6117859087611ec8565b61178f8386611edf565b6117999190611edf565b611998565b95945050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60fd545f9060ff16815b8160ff168160ff161015610d0e5760ff81165f90815260fc60205260409020546001600160a01b03908116908616810361183c5750611859565b6118468186610745565b156118575760019350505050610784565b505b600101611802565b5f61186b4661193d565b82101561187957505f919050565b611884600c83611edf565b9150425f5b6020811080156118995750818411155b156118d0575f6118a885611a02565b905080156118b857949350505050565b600c8501945050806118c990611fe0565b9050611889565b505f9392505050565b6118e28161165e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b6060611657838360405180606001604052806027815260200161206460279139611ac1565b5f600182036119515750635fc63057919050565b614268820361196557506365156ac0919050565b6401a2140cff820361197c57506366755d6c919050565b62088bb0820361199157506367d81118919050565b505f919050565b5f65ffffffffffff8211156119fe5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203460448201526538206269747360d01b60648201526084016106b1565b5090565b5f5f5f720f3df6d732807ef1319fb7b8bb8522d0beac026001600160a01b031684604051602001611a3591815260200190565b60408051601f1981840301815290829052611a4f91611ff8565b5f60405180830381855afa9150503d805f8114611a87576040519150601f19603f3d011682016040523d82523d5f602084013e611a8c565b606091505b5091509150818015611a9e57505f8151115b15611aba5780806020019051810190611ab79190611f65565b92505b5050919050565b60605f5f856001600160a01b031685604051611add9190611ff8565b5f60405180830381855af49150503d805f8114611b15576040519150601f19603f3d011682016040523d82523d5f602084013e611b1a565b606091505b5091509150611b2b86838387611b35565b9695505050505050565b60608315611ba35782515f03611b9c576001600160a01b0385163b611b9c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b1565b5081611bad565b611bad8383611bb5565b949350505050565b815115611bc55781518083602001fd5b8060405162461bcd60e51b81526004016106b1919061200e565b80356001600160a01b0381168114611bf5575f5ffd5b919050565b5f60208284031215611c0a575f5ffd5b61165782611bdf565b5f5f60408385031215611c24575f5ffd5b611c2d83611bdf565b9150602083013563ffffffff81168114611c45575f5ffd5b809150509250929050565b5f60208284031215611c60575f5ffd5b5035919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f60408385031215611c8c575f5ffd5b611c9583611bdf565b9150602083013567ffffffffffffffff811115611cb0575f5ffd5b8301601f81018513611cc0575f5ffd5b803567ffffffffffffffff811115611cda57611cda611c67565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715611d0957611d09611c67565b604052818152828201602001871015611d20575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b5f5f60408385031215611d50575f5ffd5b611d5983611bdf565b915060208301358015158114611c45575f5ffd5b5f5f60408385031215611d7e575f5ffd5b611d8783611bdf565b9150611d9560208401611bdf565b90509250929050565b5f5f5f60408486031215611db0575f5ffd5b611db984611bdf565b9250602084013567ffffffffffffffff811115611dd4575f5ffd5b8401601f81018613611de4575f5ffd5b803567ffffffffffffffff811115611dfa575f5ffd5b866020828401011115611e0b575f5ffd5b939660209190910195509293505050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761078457610784611eb4565b8082018082111561078457610784611eb4565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b5f52601260045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611f75575f5ffd5b5051919050565b60ff818116838216019081111561078457610784611eb4565b60ff828116828216039081111561078457610784611eb4565b8181038181111561078457610784611eb4565b5f82611fdb57634e487b7160e01b5f52601260045260245ffd5b500490565b5f60018201611ff157611ff1611eb4565b5060010190565b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220882b29a6f47efe65577affcd2ae0ad134393dbf20eb4204120a3824d0263e31464736f6c634300081e0033