Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
AkibaharaTokyouSeeds
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
import { ERC721AUpgradeable } from "ERC721A-Upgradeable/ERC721AUpgradeable.sol";
import { IERC721AUpgradeable } from "ERC721A-Upgradeable/IERC721AUpgradeable.sol";
import { ERC721AQueryableUpgradeable } from "ERC721A-Upgradeable/extensions/ERC721AQueryableUpgradeable.sol";
import { ERC2981Upgradeable } from "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { OwnableRoles } from "solady/auth/OwnableRoles.sol";
import { SeedsStorage } from "./storage/SeedsStorage.sol";
import { IAkibaharaTokyouToken } from "./interfaces/IAkibaharaTokyouToken.sol";
import { IAkibaharaTokyouCharacter } from "./interfaces/IAkibaharaTokyouCharacter.sol";
contract AkibaharaTokyouSeeds is
Initializable,
OwnableRoles,
ERC721AUpgradeable,
ERC721AQueryableUpgradeable,
ERC2981Upgradeable,
IAkibaharaTokyouToken
{
using EnumerableSet for EnumerableSet.UintSet;
error TransfersNotAllowed();
error InvalidQuantity();
error MaxSupplyReached();
error InvalidArguments();
error RevealNotEnabled();
error NotTokenOwner();
uint256 public constant ADMIN_ROLE = 1;
uint256 public constant MINTER_ROLE = 2;
uint256 public constant BURNER_ROLE = 3;
modifier preventTransfers(address from, uint256 tokenId) virtual {
SeedsStorage.Layout storage $ = SeedsStorage.layout();
if (!$._enableTransfers || $._lockedTokenIds[tokenId]) {
revert TransfersNotAllowed();
}
_;
}
constructor() {
_disableInitializers();
}
function initialize(
string memory name_,
string memory symbol_,
address owner_,
uint256 maxSupply_,
address characters_
) external initializerERC721A initializer {
SeedsStorage.Layout storage $ = SeedsStorage.layout();
__ERC721A_init(name_, symbol_);
_initializeOwner(owner_);
$._maxSupply = maxSupply_;
$._characters = characters_;
}
function setEnableTransfers(
bool enableTransfers_
) external onlyOwnerOrRoles(ADMIN_ROLE) {
SeedsStorage.layout()._enableTransfers = enableTransfers_;
}
function setEnableReveal(
bool enableReveal_
) external onlyOwnerOrRoles(ADMIN_ROLE) {
SeedsStorage.layout()._enableReveal = enableReveal_;
}
function setLockedTokenIds(
uint256[] calldata tokenIds_,
bool locked_
) external onlyOwnerOrRoles(ADMIN_ROLE) {
SeedsStorage.Layout storage $ = SeedsStorage.layout();
uint256 tokenIdsLength = tokenIds_.length;
for (uint256 i = 0; i < tokenIdsLength; ) {
$._lockedTokenIds[tokenIds_[i]] = locked_;
unchecked {
i++;
}
}
}
function batchAirdrop(
uint64[] calldata quantities,
address[] calldata recipients
) external onlyRolesOrOwner(ADMIN_ROLE) {
SeedsStorage.Layout storage $ = SeedsStorage.layout();
uint256 length = recipients.length;
if (quantities.length != length) revert InvalidArguments();
for (uint256 i = 0; i < length; ) {
uint256 quantity = quantities[i];
if (quantity == 0) revert InvalidQuantity();
if (totalSupply() + quantity > $._maxSupply) revert MaxSupplyReached();
_mint(recipients[i], quantity);
unchecked {
i++;
}
}
}
function mint(
address to,
uint256 quantity
) external onlyRolesOrOwner(MINTER_ROLE) {
SeedsStorage.Layout storage $ = SeedsStorage.layout();
if (totalSupply() + quantity > $._maxSupply) revert MaxSupplyReached();
_mint(to, quantity);
}
function burn(uint256 tokenId) external onlyRolesOrOwner(BURNER_ROLE) {
_burn(tokenId);
}
function reveal(uint256 tokenId) external {
SeedsStorage.Layout storage $ = SeedsStorage.layout();
if (!$._enableReveal) revert RevealNotEnabled();
if (ownerOf(tokenId) != msg.sender) revert NotTokenOwner();
_burn(tokenId);
IAkibaharaTokyouCharacter($._characters).mintWithSeed(msg.sender, tokenId);
}
function setBaseURI(
string memory baseURI_
) external onlyOwnerOrRoles(ADMIN_ROLE) {
SeedsStorage.layout()._baseURI = baseURI_;
}
function setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) external onlyOwnerOrRoles(ADMIN_ROLE) {
_setDefaultRoyalty(receiver, feeNumerator);
}
function _baseURI() internal view override returns (string memory) {
return SeedsStorage.layout()._baseURI;
}
function _startTokenId() internal pure override returns (uint256) {
return 1;
}
function setApprovalForAll(
address operator,
bool approved
)
public
override(IERC721AUpgradeable, ERC721AUpgradeable)
preventTransfers(operator, 0)
{
super.setApprovalForAll(operator, approved);
}
function approve(
address operator,
uint256 tokenId
)
public
payable
override(IERC721AUpgradeable, ERC721AUpgradeable)
preventTransfers(operator, tokenId)
{
super.approve(operator, tokenId);
}
function transferFrom(
address from,
address to,
uint256 tokenId
)
public
payable
override(IERC721AUpgradeable, ERC721AUpgradeable)
preventTransfers(from, tokenId)
{
super.transferFrom(from, to, tokenId);
}
function supportsInterface(
bytes4 interfaceId
)
public
view
override(ERC721AUpgradeable, IERC721AUpgradeable, ERC2981Upgradeable)
returns (bool)
{
return
ERC721AUpgradeable.supportsInterface(interfaceId) ||
ERC2981Upgradeable.supportsInterface(interfaceId);
}
receive() external payable virtual {}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721AUpgradeable.sol';
import {ERC721AStorage} from './ERC721AStorage.sol';
import './ERC721A__Initializable.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721ReceiverUpgradeable {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* The `_sequentialUpTo()` function can be overriden to enable spot mints
* (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable {
using ERC721AStorage for ERC721AStorage.Layout;
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// CONSTRUCTOR
// =============================================================
function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
__ERC721A_init_unchained(name_, symbol_);
}
function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
ERC721AStorage.layout()._name = name_;
ERC721AStorage.layout()._symbol = symbol_;
ERC721AStorage.layout()._currentIndex = _startTokenId();
if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector);
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID for sequential mints.
*
* Override this function to change the starting token ID for sequential mints.
*
* Note: The value returned must never change after any tokens have been minted.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the maximum token ID (inclusive) for sequential mints.
*
* Override this function to return a value less than 2**256 - 1,
* but greater than `_startTokenId()`, to enable spot (non-sequential) mints.
*
* Note: The value returned must never change after any tokens have been minted.
*/
function _sequentialUpTo() internal view virtual returns (uint256) {
return type(uint256).max;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return ERC721AStorage.layout()._currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256 result) {
// Counter underflow is impossible as `_burnCounter` cannot be incremented
// more than `_currentIndex + _spotMinted - _startTokenId()` times.
unchecked {
// With spot minting, the intermediate `result` can be temporarily negative,
// and the computation must be unchecked.
result = ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
if (_sequentialUpTo() != type(uint256).max) result += ERC721AStorage.layout()._spotMinted;
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256 result) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
result = ERC721AStorage.layout()._currentIndex - _startTokenId();
if (_sequentialUpTo() != type(uint256).max) result += ERC721AStorage.layout()._spotMinted;
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return ERC721AStorage.layout()._burnCounter;
}
/**
* @dev Returns the total number of tokens that are spot-minted.
*/
function _totalSpotMinted() internal view virtual returns (uint256) {
return ERC721AStorage.layout()._spotMinted;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);
return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return
(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return
(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal virtual {
uint256 packed = ERC721AStorage.layout()._packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
ERC721AStorage.layout()._packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return ERC721AStorage.layout()._symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(ERC721AStorage.layout()._packedOwnerships[index]);
}
/**
* @dev Returns whether the ownership slot at `index` is initialized.
* An uninitialized slot does not necessarily mean that the slot has no owner.
*/
function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {
return ERC721AStorage.layout()._packedOwnerships[index] != 0;
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (ERC721AStorage.layout()._packedOwnerships[index] == 0) {
ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* @dev Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
if (_startTokenId() <= tokenId) {
packed = ERC721AStorage.layout()._packedOwnerships[tokenId];
if (tokenId > _sequentialUpTo()) {
if (_packedOwnershipExists(packed)) return packed;
_revert(OwnerQueryForNonexistentToken.selector);
}
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) {
if (tokenId >= ERC721AStorage.layout()._currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `tokenId` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
for (;;) {
unchecked {
packed = ERC721AStorage.layout()._packedOwnerships[--tokenId];
}
if (packed == 0) continue;
if (packed & _BITMASK_BURNED == 0) return packed;
// Otherwise, the token is burned, and we must revert.
// This handles the case of batch burned tokens, where only the burned bit
// of the starting slot is set, and remaining slots are left uninitialized.
_revert(OwnerQueryForNonexistentToken.selector);
}
}
// Otherwise, the data exists and we can skip the scan.
// This is possible because we have already achieved the target condition.
// This saves 2143 gas on transfers of initialized tokens.
// If the token is not burned, return `packed`. Otherwise, revert.
if (packed & _BITMASK_BURNED == 0) return packed;
}
_revert(OwnerQueryForNonexistentToken.selector);
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
_approve(to, tokenId, true);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector);
return ERC721AStorage.layout()._tokenApprovals[tokenId].value;
}
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return ERC721AStorage.layout()._operatorApprovals[owner][operator];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool result) {
if (_startTokenId() <= tokenId) {
if (tokenId > _sequentialUpTo())
return _packedOwnershipExists(ERC721AStorage.layout()._packedOwnerships[tokenId]);
if (tokenId < ERC721AStorage.layout()._currentIndex) {
uint256 packed;
while ((packed = ERC721AStorage.layout()._packedOwnerships[tokenId]) == 0) --tokenId;
result = packed & _BITMASK_BURNED == 0;
}
}
}
/**
* @dev Returns whether `packed` represents a token that exists.
*/
function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {
assembly {
// The following is equivalent to `owner != address(0) && burned == false`.
// Symbolically tested.
result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED))
}
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
// Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));
if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`.
++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
from, // `from`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
if (toMasked == 0) _revert(TransferToZeroAddress.selector);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
}
/**
* @dev Hook that is called before a set of serially-ordered token IDs
* are about to be transferred. This includes minting.
* And also called before burning one token.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try
ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data)
returns (bytes4 retval) {
return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
assembly {
revert(add(32, reason), mload(reason))
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
if (quantity == 0) _revert(MintZeroQuantity.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
uint256 end = startTokenId + quantity;
uint256 tokenId = startTokenId;
if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);
do {
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
// The `!=` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
} while (++tokenId != end);
ERC721AStorage.layout()._currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
if (to == address(0)) _revert(MintToZeroAddress.selector);
if (quantity == 0) _revert(MintZeroQuantity.selector);
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
ERC721AStorage.layout()._currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = ERC721AStorage.layout()._currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
} while (index < end);
// This prevents reentrancy to `_safeMint`.
// It does not prevent reentrancy to `_safeMintSpot`.
if (ERC721AStorage.layout()._currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
/**
* @dev Mints a single token at `tokenId`.
*
* Note: A spot-minted `tokenId` that has been burned can be re-minted again.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` must be greater than `_sequentialUpTo()`.
* - `tokenId` must not exist.
*
* Emits a {Transfer} event for each mint.
*/
function _mintSpot(address to, uint256 tokenId) internal virtual {
if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector);
uint256 prevOwnershipPacked = ERC721AStorage.layout()._packedOwnerships[tokenId];
if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector);
_beforeTokenTransfers(address(0), to, tokenId, 1);
// Overflows are incredibly unrealistic.
// The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1.
// `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1.
unchecked {
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `true` (as `quantity == 1`).
ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
to,
_nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked)
);
// Updates:
// - `balance += 1`.
// - `numberMinted += 1`.
//
// We can directly add to the `balance` and `numberMinted`.
ERC721AStorage.layout()._packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1;
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
if (toMasked == 0) _revert(MintToZeroAddress.selector);
assembly {
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
tokenId // `tokenId`.
)
}
++ERC721AStorage.layout()._spotMinted;
}
_afterTokenTransfers(address(0), to, tokenId, 1);
}
/**
* @dev Safely mints a single token at `tokenId`.
*
* Note: A spot-minted `tokenId` that has been burned can be re-minted again.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}.
* - `tokenId` must be greater than `_sequentialUpTo()`.
* - `tokenId` must not exist.
*
* See {_mintSpot}.
*
* Emits a {Transfer} event.
*/
function _safeMintSpot(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mintSpot(to, tokenId);
unchecked {
if (to.code.length != 0) {
uint256 currentSpotMinted = ERC721AStorage.layout()._spotMinted;
if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) {
_revert(TransferToNonERC721ReceiverImplementer.selector);
}
// This prevents reentrancy to `_safeMintSpot`.
// It does not prevent reentrancy to `_safeMint`.
if (ERC721AStorage.layout()._spotMinted != currentSpotMinted) revert();
}
}
}
/**
* @dev Equivalent to `_safeMintSpot(to, tokenId, '')`.
*/
function _safeMintSpot(address to, uint256 tokenId) internal virtual {
_safeMintSpot(to, tokenId, '');
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_approve(to, tokenId, false)`.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_approve(to, tokenId, false);
}
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck && _msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
_revert(ApprovalCallerNotOwnerNorApproved.selector);
}
ERC721AStorage.layout()._tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector);
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
ERC721AStorage.layout()._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times.
unchecked {
ERC721AStorage.layout()._burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = ERC721AStorage.layout()._packedOwnerships[index];
if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
ERC721AStorage.layout()._packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit), but
// we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
// We will need 1 word for the trailing zeros padding, 1 word for the length,
// and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
let m := add(mload(0x40), 0xa0)
// Update the free memory pointer to allocate.
mstore(0x40, m)
// Assign the `str` to the end.
str := sub(m, 0x20)
// Zeroize the slot after the string.
mstore(str, 0)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
/**
* @dev For more efficient reverts.
*/
function _revert(bytes4 errorSelector) internal pure {
assembly {
mstore(0x00, errorSelector)
revert(0x00, 0x04)
}
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721AUpgradeable {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
/**
* `_sequentialUpTo()` must be greater than `_startTokenId()`.
*/
error SequentialUpToTooSmall();
/**
* The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`.
*/
error SequentialMintExceedsLimit();
/**
* Spot minting requires a `tokenId` greater than `_sequentialUpTo()`.
*/
error SpotMintTokenIdTooSmall();
/**
* Cannot mint over a token that already exists.
*/
error TokenAlreadyExists();
/**
* The feature is not compatible with spot mints.
*/
error NotCompatibleWithSpotMints();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables
* (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`,
* checking first that contract recipients are aware of the ERC721 protocol
* to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move
* this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external payable;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721AQueryableUpgradeable.sol';
import '../ERC721AUpgradeable.sol';
import '../ERC721A__Initializable.sol';
/**
* @title ERC721AQueryable.
*
* @dev ERC721A subclass with convenience query functions.
*/
abstract contract ERC721AQueryableUpgradeable is
ERC721A__Initializable,
ERC721AUpgradeable,
IERC721AQueryableUpgradeable
{
function __ERC721AQueryable_init() internal onlyInitializingERC721A {
__ERC721AQueryable_init_unchained();
}
function __ERC721AQueryable_init_unchained() internal onlyInitializingERC721A {}
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId)
public
view
virtual
override
returns (TokenOwnership memory ownership)
{
unchecked {
if (tokenId >= _startTokenId()) {
if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId);
if (tokenId < _nextTokenId()) {
// If the `tokenId` is within bounds,
// scan backwards for the initialized ownership slot.
while (!_ownershipIsInitialized(tokenId)) --tokenId;
return _ownershipAt(tokenId);
}
}
}
}
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] calldata tokenIds)
external
view
virtual
override
returns (TokenOwnership[] memory)
{
TokenOwnership[] memory ownerships;
uint256 i = tokenIds.length;
assembly {
// Grab the free memory pointer.
ownerships := mload(0x40)
// Store the length.
mstore(ownerships, i)
// Allocate one word for the length,
// `tokenIds.length` words for the pointers.
i := shl(5, i) // Multiply `i` by 32.
mstore(0x40, add(add(ownerships, 0x20), i))
}
while (i != 0) {
uint256 tokenId;
assembly {
i := sub(i, 0x20)
tokenId := calldataload(add(tokenIds.offset, i))
}
TokenOwnership memory ownership = explicitOwnershipOf(tokenId);
assembly {
// Store the pointer of `ownership` in the `ownerships` array.
mstore(add(add(ownerships, 0x20), i), ownership)
}
}
return ownerships;
}
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view virtual override returns (uint256[] memory) {
return _tokensOfOwnerIn(owner, start, stop);
}
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
// If spot mints are enabled, full-range scan is disabled.
if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector);
uint256 start = _startTokenId();
uint256 stop = _nextTokenId();
uint256[] memory tokenIds;
if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop);
return tokenIds;
}
/**
* @dev Helper function for returning an array of token IDs owned by `owner`.
*
* Note that this function is optimized for smaller bytecode size over runtime gas,
* since it is meant to be called off-chain.
*/
function _tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) private view returns (uint256[] memory tokenIds) {
unchecked {
if (start >= stop) _revert(InvalidQueryRange.selector);
// Set `start = max(start, _startTokenId())`.
if (start < _startTokenId()) start = _startTokenId();
uint256 nextTokenId = _nextTokenId();
// If spot mints are enabled, scan all the way until the specified `stop`.
uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId;
// Set `stop = min(stop, stopLimit)`.
if (stop >= stopLimit) stop = stopLimit;
// Number of tokens to scan.
uint256 tokenIdsMaxLength = balanceOf(owner);
// Set `tokenIdsMaxLength` to zero if the range contains no tokens.
if (start >= stop) tokenIdsMaxLength = 0;
// If there are one or more tokens to scan.
if (tokenIdsMaxLength != 0) {
// Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`.
if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start;
uint256 m; // Start of available memory.
assembly {
// Grab the free memory pointer.
tokenIds := mload(0x40)
// Allocate one word for the length, and `tokenIdsMaxLength` words
// for the data. `shl(5, x)` is equivalent to `mul(32, x)`.
m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1)))
mstore(0x40, m)
}
// We need to call `explicitOwnershipOf(start)`,
// because the slot at `start` may not be initialized.
TokenOwnership memory ownership = explicitOwnershipOf(start);
address currOwnershipAddr;
// If the starting slot exists (i.e. not burned),
// initialize `currOwnershipAddr`.
// `ownership.address` will not be zero,
// as `start` is clamped to the valid token ID range.
if (!ownership.burned) currOwnershipAddr = ownership.addr;
uint256 tokenIdsIdx;
// Use a do-while, which is slightly more efficient for this case,
// as the array will at least contain one element.
do {
if (_sequentialUpTo() != type(uint256).max) {
// Skip the remaining unused sequential slots.
if (start == nextTokenId) start = _sequentialUpTo() + 1;
// Reset `currOwnershipAddr`, as each spot-minted token is a batch of one.
if (start > _sequentialUpTo()) currOwnershipAddr = address(0);
}
ownership = _ownershipAt(start); // This implicitly allocates memory.
assembly {
switch mload(add(ownership, 0x40))
// if `ownership.burned == false`.
case 0 {
// if `ownership.addr != address(0)`.
// The `addr` already has it's upper 96 bits clearned,
// since it is written to memory with regular Solidity.
if mload(ownership) {
currOwnershipAddr := mload(ownership)
}
// if `currOwnershipAddr == owner`.
// The `shl(96, x)` is to make the comparison agnostic to any
// dirty upper 96 bits in `owner`.
if iszero(shl(96, xor(currOwnershipAddr, owner))) {
tokenIdsIdx := add(tokenIdsIdx, 1)
mstore(add(tokenIds, shl(5, tokenIdsIdx)), start)
}
}
// Otherwise, reset `currOwnershipAddr`.
// This handles the case of batch burned tokens
// (burned bit of first slot set, remaining slots left uninitialized).
default {
currOwnershipAddr := 0
}
start := add(start, 1)
// Free temporary memory implicitly allocated for ownership
// to avoid quadratic memory expansion costs.
mstore(0x40, m)
}
} while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength));
// Store the length of the array.
assembly {
mstore(tokenIds, tokenIdsIdx)
}
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.20;
import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*/
abstract contract ERC2981Upgradeable is Initializable, IERC2981, ERC165Upgradeable {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
/// @custom:storage-location erc7201:openzeppelin.storage.ERC2981
struct ERC2981Storage {
RoyaltyInfo _defaultRoyaltyInfo;
mapping(uint256 tokenId => RoyaltyInfo) _tokenRoyaltyInfo;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC2981")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant ERC2981StorageLocation = 0xdaedc9ab023613a7caf35e703657e986ccfad7e3eb0af93a2853f8d65dd86b00;
function _getERC2981Storage() private pure returns (ERC2981Storage storage $) {
assembly {
$.slot := ERC2981StorageLocation
}
}
/**
* @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);
/**
* @dev The default royalty receiver is invalid.
*/
error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);
/**
* @dev The royalty set for a specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
*/
error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);
/**
* @dev The royalty receiver for `tokenId` is invalid.
*/
error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);
function __ERC2981_init() internal onlyInitializing {
}
function __ERC2981_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165Upgradeable) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) public view virtual returns (address receiver, uint256 amount) {
ERC2981Storage storage $ = _getERC2981Storage();
RoyaltyInfo storage _royaltyInfo = $._tokenRoyaltyInfo[tokenId];
address royaltyReceiver = _royaltyInfo.receiver;
uint96 royaltyFraction = _royaltyInfo.royaltyFraction;
if (royaltyReceiver == address(0)) {
royaltyReceiver = $._defaultRoyaltyInfo.receiver;
royaltyFraction = $._defaultRoyaltyInfo.royaltyFraction;
}
uint256 royaltyAmount = (salePrice * royaltyFraction) / _feeDenominator();
return (royaltyReceiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
ERC2981Storage storage $ = _getERC2981Storage();
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
}
$._defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
ERC2981Storage storage $ = _getERC2981Storage();
delete $._defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
ERC2981Storage storage $ = _getERC2981Storage();
uint256 denominator = _feeDenominator();
if (feeNumerator > denominator) {
// Royalty fee will exceed the sale price
revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
}
if (receiver == address(0)) {
revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
}
$._tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
ERC2981Storage storage $ = _getERC2981Storage();
delete $._tokenRoyaltyInfo[tokenId];
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @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 Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reinitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._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 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._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() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @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 {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
*
* NOTE: Consider following the ERC-7201 formula to derive storage locations.
*/
function _initializableStorageSlot() internal pure virtual returns (bytes32) {
return INITIALIZABLE_STORAGE;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
bytes32 slot = _initializableStorageSlot();
assembly {
$.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
import {Arrays} from "../Arrays.sol";
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
* - Set can be cleared (all elements removed) in O(n).
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function _clear(Set storage set) private {
uint256 len = _length(set);
for (uint256 i = 0; i < len; ++i) {
delete set._positions[set._values[i]];
}
Arrays.unsafeSetLength(set._values, 0);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(Bytes32Set storage set) internal {
_clear(set._inner);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(AddressSet storage set) internal {
_clear(set._inner);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(UintSet storage set) internal {
_clear(set._inner);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, bytes memory returndata) = recipient.call{value: amount}("");
if (!success) {
_revert(returndata);
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) 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
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {Ownable} from "./Ownable.sol";
/// @notice Simple single owner and multiroles authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/OwnableRoles.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract OwnableRoles is Ownable {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The `user`'s roles is updated to `roles`.
/// Each bit of `roles` represents whether the role is set.
event RolesUpdated(address indexed user, uint256 indexed roles);
/// @dev `keccak256(bytes("RolesUpdated(address,uint256)"))`.
uint256 private constant _ROLES_UPDATED_EVENT_SIGNATURE =
0x715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe26;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STORAGE */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The role slot of `user` is given by:
/// ```
/// mstore(0x00, or(shl(96, user), _ROLE_SLOT_SEED))
/// let roleSlot := keccak256(0x00, 0x20)
/// ```
/// This automatically ignores the upper bits of the `user` in case
/// they are not clean, as well as keep the `keccak256` under 32-bytes.
///
/// Note: This is equivalent to `uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))`.
uint256 private constant _ROLE_SLOT_SEED = 0x8b78c6d8;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Overwrite the roles directly without authorization guard.
function _setRoles(address user, uint256 roles) internal virtual {
/// @solidity memory-safe-assembly
assembly {
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, user)
// Store the new value.
sstore(keccak256(0x0c, 0x20), roles)
// Emit the {RolesUpdated} event.
log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), roles)
}
}
/// @dev Updates the roles directly without authorization guard.
/// If `on` is true, each set bit of `roles` will be turned on,
/// otherwise, each set bit of `roles` will be turned off.
function _updateRoles(address user, uint256 roles, bool on) internal virtual {
/// @solidity memory-safe-assembly
assembly {
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, user)
let roleSlot := keccak256(0x0c, 0x20)
// Load the current value.
let current := sload(roleSlot)
// Compute the updated roles if `on` is true.
let updated := or(current, roles)
// Compute the updated roles if `on` is false.
// Use `and` to compute the intersection of `current` and `roles`,
// `xor` it with `current` to flip the bits in the intersection.
if iszero(on) { updated := xor(current, and(current, roles)) }
// Then, store the new value.
sstore(roleSlot, updated)
// Emit the {RolesUpdated} event.
log3(0, 0, _ROLES_UPDATED_EVENT_SIGNATURE, shr(96, mload(0x0c)), updated)
}
}
/// @dev Grants the roles directly without authorization guard.
/// Each bit of `roles` represents the role to turn on.
function _grantRoles(address user, uint256 roles) internal virtual {
_updateRoles(user, roles, true);
}
/// @dev Removes the roles directly without authorization guard.
/// Each bit of `roles` represents the role to turn off.
function _removeRoles(address user, uint256 roles) internal virtual {
_updateRoles(user, roles, false);
}
/// @dev Throws if the sender does not have any of the `roles`.
function _checkRoles(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
// of the value and `roles` is zero, revert.
if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Throws if the sender is not the owner,
/// and does not have any of the `roles`.
/// Checks for ownership first, then lazily checks for roles.
function _checkOwnerOrRoles(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// If the caller is not the stored owner.
// Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
// of the value and `roles` is zero, revert.
if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
}
/// @dev Throws if the sender does not have any of the `roles`,
/// and is not the owner.
/// Checks for roles first, then lazily checks for ownership.
function _checkRolesOrOwner(uint256 roles) internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, caller())
// Load the stored value, and if the `and` intersection
// of the value and `roles` is zero, revert.
if iszero(and(sload(keccak256(0x0c, 0x20)), roles)) {
// If the caller is not the stored owner.
// Note: `_ROLE_SLOT_SEED` is equal to `_OWNER_SLOT_NOT`.
if iszero(eq(caller(), sload(not(_ROLE_SLOT_SEED)))) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
}
/// @dev Convenience function to return a `roles` bitmap from an array of `ordinals`.
/// This is meant for frontends like Etherscan, and is therefore not fully optimized.
/// Not recommended to be called on-chain.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _rolesFromOrdinals(uint8[] memory ordinals) internal pure returns (uint256 roles) {
/// @solidity memory-safe-assembly
assembly {
for { let i := shl(5, mload(ordinals)) } i { i := sub(i, 0x20) } {
// We don't need to mask the values of `ordinals`, as Solidity
// cleans dirty upper bits when storing variables into memory.
roles := or(shl(mload(add(ordinals, i)), 1), roles)
}
}
}
/// @dev Convenience function to return an array of `ordinals` from the `roles` bitmap.
/// This is meant for frontends like Etherscan, and is therefore not fully optimized.
/// Not recommended to be called on-chain.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _ordinalsFromRoles(uint256 roles) internal pure returns (uint8[] memory ordinals) {
/// @solidity memory-safe-assembly
assembly {
// Grab the pointer to the free memory.
ordinals := mload(0x40)
let ptr := add(ordinals, 0x20)
let o := 0
// The absence of lookup tables, De Bruijn, etc., here is intentional for
// smaller bytecode, as this function is not meant to be called on-chain.
for { let t := roles } 1 {} {
mstore(ptr, o)
// `shr` 5 is equivalent to multiplying by 0x20.
// Push back into the ordinals array if the bit is set.
ptr := add(ptr, shl(5, and(t, 1)))
o := add(o, 1)
t := shr(o, roles)
if iszero(t) { break }
}
// Store the length of `ordinals`.
mstore(ordinals, shr(5, sub(ptr, add(ordinals, 0x20))))
// Allocate the memory.
mstore(0x40, ptr)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC UPDATE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Allows the owner to grant `user` `roles`.
/// If the `user` already has a role, then it will be an no-op for the role.
function grantRoles(address user, uint256 roles) public payable virtual onlyOwner {
_grantRoles(user, roles);
}
/// @dev Allows the owner to remove `user` `roles`.
/// If the `user` does not have a role, then it will be an no-op for the role.
function revokeRoles(address user, uint256 roles) public payable virtual onlyOwner {
_removeRoles(user, roles);
}
/// @dev Allow the caller to remove their own roles.
/// If the caller does not have a role, then it will be an no-op for the role.
function renounceRoles(uint256 roles) public payable virtual {
_removeRoles(msg.sender, roles);
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC READ FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the roles of `user`.
function rolesOf(address user) public view virtual returns (uint256 roles) {
/// @solidity memory-safe-assembly
assembly {
// Compute the role slot.
mstore(0x0c, _ROLE_SLOT_SEED)
mstore(0x00, user)
// Load the stored value.
roles := sload(keccak256(0x0c, 0x20))
}
}
/// @dev Returns whether `user` has any of `roles`.
function hasAnyRole(address user, uint256 roles) public view virtual returns (bool) {
return rolesOf(user) & roles != 0;
}
/// @dev Returns whether `user` has all of `roles`.
function hasAllRoles(address user, uint256 roles) public view virtual returns (bool) {
return rolesOf(user) & roles == roles;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MODIFIERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Marks a function as only callable by an account with `roles`.
modifier onlyRoles(uint256 roles) virtual {
_checkRoles(roles);
_;
}
/// @dev Marks a function as only callable by the owner or by an account
/// with `roles`. Checks for ownership first, then lazily checks for roles.
modifier onlyOwnerOrRoles(uint256 roles) virtual {
_checkOwnerOrRoles(roles);
_;
}
/// @dev Marks a function as only callable by an account with `roles`
/// or the owner. Checks for roles first, then lazily checks for ownership.
modifier onlyRolesOrOwner(uint256 roles) virtual {
_checkRolesOrOwner(roles);
_;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ROLE CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// IYKYK
uint256 internal constant _ROLE_0 = 1 << 0;
uint256 internal constant _ROLE_1 = 1 << 1;
uint256 internal constant _ROLE_2 = 1 << 2;
uint256 internal constant _ROLE_3 = 1 << 3;
uint256 internal constant _ROLE_4 = 1 << 4;
uint256 internal constant _ROLE_5 = 1 << 5;
uint256 internal constant _ROLE_6 = 1 << 6;
uint256 internal constant _ROLE_7 = 1 << 7;
uint256 internal constant _ROLE_8 = 1 << 8;
uint256 internal constant _ROLE_9 = 1 << 9;
uint256 internal constant _ROLE_10 = 1 << 10;
uint256 internal constant _ROLE_11 = 1 << 11;
uint256 internal constant _ROLE_12 = 1 << 12;
uint256 internal constant _ROLE_13 = 1 << 13;
uint256 internal constant _ROLE_14 = 1 << 14;
uint256 internal constant _ROLE_15 = 1 << 15;
uint256 internal constant _ROLE_16 = 1 << 16;
uint256 internal constant _ROLE_17 = 1 << 17;
uint256 internal constant _ROLE_18 = 1 << 18;
uint256 internal constant _ROLE_19 = 1 << 19;
uint256 internal constant _ROLE_20 = 1 << 20;
uint256 internal constant _ROLE_21 = 1 << 21;
uint256 internal constant _ROLE_22 = 1 << 22;
uint256 internal constant _ROLE_23 = 1 << 23;
uint256 internal constant _ROLE_24 = 1 << 24;
uint256 internal constant _ROLE_25 = 1 << 25;
uint256 internal constant _ROLE_26 = 1 << 26;
uint256 internal constant _ROLE_27 = 1 << 27;
uint256 internal constant _ROLE_28 = 1 << 28;
uint256 internal constant _ROLE_29 = 1 << 29;
uint256 internal constant _ROLE_30 = 1 << 30;
uint256 internal constant _ROLE_31 = 1 << 31;
uint256 internal constant _ROLE_32 = 1 << 32;
uint256 internal constant _ROLE_33 = 1 << 33;
uint256 internal constant _ROLE_34 = 1 << 34;
uint256 internal constant _ROLE_35 = 1 << 35;
uint256 internal constant _ROLE_36 = 1 << 36;
uint256 internal constant _ROLE_37 = 1 << 37;
uint256 internal constant _ROLE_38 = 1 << 38;
uint256 internal constant _ROLE_39 = 1 << 39;
uint256 internal constant _ROLE_40 = 1 << 40;
uint256 internal constant _ROLE_41 = 1 << 41;
uint256 internal constant _ROLE_42 = 1 << 42;
uint256 internal constant _ROLE_43 = 1 << 43;
uint256 internal constant _ROLE_44 = 1 << 44;
uint256 internal constant _ROLE_45 = 1 << 45;
uint256 internal constant _ROLE_46 = 1 << 46;
uint256 internal constant _ROLE_47 = 1 << 47;
uint256 internal constant _ROLE_48 = 1 << 48;
uint256 internal constant _ROLE_49 = 1 << 49;
uint256 internal constant _ROLE_50 = 1 << 50;
uint256 internal constant _ROLE_51 = 1 << 51;
uint256 internal constant _ROLE_52 = 1 << 52;
uint256 internal constant _ROLE_53 = 1 << 53;
uint256 internal constant _ROLE_54 = 1 << 54;
uint256 internal constant _ROLE_55 = 1 << 55;
uint256 internal constant _ROLE_56 = 1 << 56;
uint256 internal constant _ROLE_57 = 1 << 57;
uint256 internal constant _ROLE_58 = 1 << 58;
uint256 internal constant _ROLE_59 = 1 << 59;
uint256 internal constant _ROLE_60 = 1 << 60;
uint256 internal constant _ROLE_61 = 1 << 61;
uint256 internal constant _ROLE_62 = 1 << 62;
uint256 internal constant _ROLE_63 = 1 << 63;
uint256 internal constant _ROLE_64 = 1 << 64;
uint256 internal constant _ROLE_65 = 1 << 65;
uint256 internal constant _ROLE_66 = 1 << 66;
uint256 internal constant _ROLE_67 = 1 << 67;
uint256 internal constant _ROLE_68 = 1 << 68;
uint256 internal constant _ROLE_69 = 1 << 69;
uint256 internal constant _ROLE_70 = 1 << 70;
uint256 internal constant _ROLE_71 = 1 << 71;
uint256 internal constant _ROLE_72 = 1 << 72;
uint256 internal constant _ROLE_73 = 1 << 73;
uint256 internal constant _ROLE_74 = 1 << 74;
uint256 internal constant _ROLE_75 = 1 << 75;
uint256 internal constant _ROLE_76 = 1 << 76;
uint256 internal constant _ROLE_77 = 1 << 77;
uint256 internal constant _ROLE_78 = 1 << 78;
uint256 internal constant _ROLE_79 = 1 << 79;
uint256 internal constant _ROLE_80 = 1 << 80;
uint256 internal constant _ROLE_81 = 1 << 81;
uint256 internal constant _ROLE_82 = 1 << 82;
uint256 internal constant _ROLE_83 = 1 << 83;
uint256 internal constant _ROLE_84 = 1 << 84;
uint256 internal constant _ROLE_85 = 1 << 85;
uint256 internal constant _ROLE_86 = 1 << 86;
uint256 internal constant _ROLE_87 = 1 << 87;
uint256 internal constant _ROLE_88 = 1 << 88;
uint256 internal constant _ROLE_89 = 1 << 89;
uint256 internal constant _ROLE_90 = 1 << 90;
uint256 internal constant _ROLE_91 = 1 << 91;
uint256 internal constant _ROLE_92 = 1 << 92;
uint256 internal constant _ROLE_93 = 1 << 93;
uint256 internal constant _ROLE_94 = 1 << 94;
uint256 internal constant _ROLE_95 = 1 << 95;
uint256 internal constant _ROLE_96 = 1 << 96;
uint256 internal constant _ROLE_97 = 1 << 97;
uint256 internal constant _ROLE_98 = 1 << 98;
uint256 internal constant _ROLE_99 = 1 << 99;
uint256 internal constant _ROLE_100 = 1 << 100;
uint256 internal constant _ROLE_101 = 1 << 101;
uint256 internal constant _ROLE_102 = 1 << 102;
uint256 internal constant _ROLE_103 = 1 << 103;
uint256 internal constant _ROLE_104 = 1 << 104;
uint256 internal constant _ROLE_105 = 1 << 105;
uint256 internal constant _ROLE_106 = 1 << 106;
uint256 internal constant _ROLE_107 = 1 << 107;
uint256 internal constant _ROLE_108 = 1 << 108;
uint256 internal constant _ROLE_109 = 1 << 109;
uint256 internal constant _ROLE_110 = 1 << 110;
uint256 internal constant _ROLE_111 = 1 << 111;
uint256 internal constant _ROLE_112 = 1 << 112;
uint256 internal constant _ROLE_113 = 1 << 113;
uint256 internal constant _ROLE_114 = 1 << 114;
uint256 internal constant _ROLE_115 = 1 << 115;
uint256 internal constant _ROLE_116 = 1 << 116;
uint256 internal constant _ROLE_117 = 1 << 117;
uint256 internal constant _ROLE_118 = 1 << 118;
uint256 internal constant _ROLE_119 = 1 << 119;
uint256 internal constant _ROLE_120 = 1 << 120;
uint256 internal constant _ROLE_121 = 1 << 121;
uint256 internal constant _ROLE_122 = 1 << 122;
uint256 internal constant _ROLE_123 = 1 << 123;
uint256 internal constant _ROLE_124 = 1 << 124;
uint256 internal constant _ROLE_125 = 1 << 125;
uint256 internal constant _ROLE_126 = 1 << 126;
uint256 internal constant _ROLE_127 = 1 << 127;
uint256 internal constant _ROLE_128 = 1 << 128;
uint256 internal constant _ROLE_129 = 1 << 129;
uint256 internal constant _ROLE_130 = 1 << 130;
uint256 internal constant _ROLE_131 = 1 << 131;
uint256 internal constant _ROLE_132 = 1 << 132;
uint256 internal constant _ROLE_133 = 1 << 133;
uint256 internal constant _ROLE_134 = 1 << 134;
uint256 internal constant _ROLE_135 = 1 << 135;
uint256 internal constant _ROLE_136 = 1 << 136;
uint256 internal constant _ROLE_137 = 1 << 137;
uint256 internal constant _ROLE_138 = 1 << 138;
uint256 internal constant _ROLE_139 = 1 << 139;
uint256 internal constant _ROLE_140 = 1 << 140;
uint256 internal constant _ROLE_141 = 1 << 141;
uint256 internal constant _ROLE_142 = 1 << 142;
uint256 internal constant _ROLE_143 = 1 << 143;
uint256 internal constant _ROLE_144 = 1 << 144;
uint256 internal constant _ROLE_145 = 1 << 145;
uint256 internal constant _ROLE_146 = 1 << 146;
uint256 internal constant _ROLE_147 = 1 << 147;
uint256 internal constant _ROLE_148 = 1 << 148;
uint256 internal constant _ROLE_149 = 1 << 149;
uint256 internal constant _ROLE_150 = 1 << 150;
uint256 internal constant _ROLE_151 = 1 << 151;
uint256 internal constant _ROLE_152 = 1 << 152;
uint256 internal constant _ROLE_153 = 1 << 153;
uint256 internal constant _ROLE_154 = 1 << 154;
uint256 internal constant _ROLE_155 = 1 << 155;
uint256 internal constant _ROLE_156 = 1 << 156;
uint256 internal constant _ROLE_157 = 1 << 157;
uint256 internal constant _ROLE_158 = 1 << 158;
uint256 internal constant _ROLE_159 = 1 << 159;
uint256 internal constant _ROLE_160 = 1 << 160;
uint256 internal constant _ROLE_161 = 1 << 161;
uint256 internal constant _ROLE_162 = 1 << 162;
uint256 internal constant _ROLE_163 = 1 << 163;
uint256 internal constant _ROLE_164 = 1 << 164;
uint256 internal constant _ROLE_165 = 1 << 165;
uint256 internal constant _ROLE_166 = 1 << 166;
uint256 internal constant _ROLE_167 = 1 << 167;
uint256 internal constant _ROLE_168 = 1 << 168;
uint256 internal constant _ROLE_169 = 1 << 169;
uint256 internal constant _ROLE_170 = 1 << 170;
uint256 internal constant _ROLE_171 = 1 << 171;
uint256 internal constant _ROLE_172 = 1 << 172;
uint256 internal constant _ROLE_173 = 1 << 173;
uint256 internal constant _ROLE_174 = 1 << 174;
uint256 internal constant _ROLE_175 = 1 << 175;
uint256 internal constant _ROLE_176 = 1 << 176;
uint256 internal constant _ROLE_177 = 1 << 177;
uint256 internal constant _ROLE_178 = 1 << 178;
uint256 internal constant _ROLE_179 = 1 << 179;
uint256 internal constant _ROLE_180 = 1 << 180;
uint256 internal constant _ROLE_181 = 1 << 181;
uint256 internal constant _ROLE_182 = 1 << 182;
uint256 internal constant _ROLE_183 = 1 << 183;
uint256 internal constant _ROLE_184 = 1 << 184;
uint256 internal constant _ROLE_185 = 1 << 185;
uint256 internal constant _ROLE_186 = 1 << 186;
uint256 internal constant _ROLE_187 = 1 << 187;
uint256 internal constant _ROLE_188 = 1 << 188;
uint256 internal constant _ROLE_189 = 1 << 189;
uint256 internal constant _ROLE_190 = 1 << 190;
uint256 internal constant _ROLE_191 = 1 << 191;
uint256 internal constant _ROLE_192 = 1 << 192;
uint256 internal constant _ROLE_193 = 1 << 193;
uint256 internal constant _ROLE_194 = 1 << 194;
uint256 internal constant _ROLE_195 = 1 << 195;
uint256 internal constant _ROLE_196 = 1 << 196;
uint256 internal constant _ROLE_197 = 1 << 197;
uint256 internal constant _ROLE_198 = 1 << 198;
uint256 internal constant _ROLE_199 = 1 << 199;
uint256 internal constant _ROLE_200 = 1 << 200;
uint256 internal constant _ROLE_201 = 1 << 201;
uint256 internal constant _ROLE_202 = 1 << 202;
uint256 internal constant _ROLE_203 = 1 << 203;
uint256 internal constant _ROLE_204 = 1 << 204;
uint256 internal constant _ROLE_205 = 1 << 205;
uint256 internal constant _ROLE_206 = 1 << 206;
uint256 internal constant _ROLE_207 = 1 << 207;
uint256 internal constant _ROLE_208 = 1 << 208;
uint256 internal constant _ROLE_209 = 1 << 209;
uint256 internal constant _ROLE_210 = 1 << 210;
uint256 internal constant _ROLE_211 = 1 << 211;
uint256 internal constant _ROLE_212 = 1 << 212;
uint256 internal constant _ROLE_213 = 1 << 213;
uint256 internal constant _ROLE_214 = 1 << 214;
uint256 internal constant _ROLE_215 = 1 << 215;
uint256 internal constant _ROLE_216 = 1 << 216;
uint256 internal constant _ROLE_217 = 1 << 217;
uint256 internal constant _ROLE_218 = 1 << 218;
uint256 internal constant _ROLE_219 = 1 << 219;
uint256 internal constant _ROLE_220 = 1 << 220;
uint256 internal constant _ROLE_221 = 1 << 221;
uint256 internal constant _ROLE_222 = 1 << 222;
uint256 internal constant _ROLE_223 = 1 << 223;
uint256 internal constant _ROLE_224 = 1 << 224;
uint256 internal constant _ROLE_225 = 1 << 225;
uint256 internal constant _ROLE_226 = 1 << 226;
uint256 internal constant _ROLE_227 = 1 << 227;
uint256 internal constant _ROLE_228 = 1 << 228;
uint256 internal constant _ROLE_229 = 1 << 229;
uint256 internal constant _ROLE_230 = 1 << 230;
uint256 internal constant _ROLE_231 = 1 << 231;
uint256 internal constant _ROLE_232 = 1 << 232;
uint256 internal constant _ROLE_233 = 1 << 233;
uint256 internal constant _ROLE_234 = 1 << 234;
uint256 internal constant _ROLE_235 = 1 << 235;
uint256 internal constant _ROLE_236 = 1 << 236;
uint256 internal constant _ROLE_237 = 1 << 237;
uint256 internal constant _ROLE_238 = 1 << 238;
uint256 internal constant _ROLE_239 = 1 << 239;
uint256 internal constant _ROLE_240 = 1 << 240;
uint256 internal constant _ROLE_241 = 1 << 241;
uint256 internal constant _ROLE_242 = 1 << 242;
uint256 internal constant _ROLE_243 = 1 << 243;
uint256 internal constant _ROLE_244 = 1 << 244;
uint256 internal constant _ROLE_245 = 1 << 245;
uint256 internal constant _ROLE_246 = 1 << 246;
uint256 internal constant _ROLE_247 = 1 << 247;
uint256 internal constant _ROLE_248 = 1 << 248;
uint256 internal constant _ROLE_249 = 1 << 249;
uint256 internal constant _ROLE_250 = 1 << 250;
uint256 internal constant _ROLE_251 = 1 << 251;
uint256 internal constant _ROLE_252 = 1 << 252;
uint256 internal constant _ROLE_253 = 1 << 253;
uint256 internal constant _ROLE_254 = 1 << 254;
uint256 internal constant _ROLE_255 = 1 << 255;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
library SeedsStorage {
bytes32 private constant STORAGE_SLOT =
keccak256("akibahara.tokyou.seeds.storage");
struct Layout {
string _baseURI;
uint256 _maxSupply;
bool _enableTransfers;
mapping(uint256 => bool) _lockedTokenIds;
address _characters;
bool _enableReveal;
}
function layout() internal pure returns (Layout storage ds) {
bytes32 position = STORAGE_SLOT;
assembly {
ds.slot := position
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
interface IAkibaharaTokyouToken {
/**
* @dev Mints `quantity` tokens to `to` address
* @param to The address to mint tokens to
* @param quantity The number of tokens to mint
*/
function mint(address to, uint256 quantity) external;
/**
* @dev Burns the token with the specified `tokenId`
* @param tokenId The ID of the token to burn
*/
function burn(uint256 tokenId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
interface IAkibaharaTokyouCharacter {
function mintWithSeed(address to, uint256 seedId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library ERC721AStorage {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
struct Layout {
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 _currentIndex;
// The number of tokens burned.
uint256 _burnCounter;
// Token name
string _name;
// Token symbol
string _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) _operatorApprovals;
// The amount of tokens minted above `_sequentialUpTo()`.
// We call these spot mints (i.e. non-sequential mints).
uint256 _spotMinted;
}
bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A');
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable diamond facet 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.
*
* 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.
*/
import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol';
abstract contract ERC721A__Initializable {
using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializerERC721A() {
// If the contract is initializing we ignore whether _initialized is set in order to support multiple
// inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
// contract may have been reentered.
require(
ERC721A__InitializableStorage.layout()._initializing
? _isConstructor()
: !ERC721A__InitializableStorage.layout()._initialized,
'ERC721A__Initializable: contract is already initialized'
);
bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing;
if (isTopLevelCall) {
ERC721A__InitializableStorage.layout()._initializing = true;
ERC721A__InitializableStorage.layout()._initialized = true;
}
_;
if (isTopLevelCall) {
ERC721A__InitializableStorage.layout()._initializing = false;
}
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} modifier, directly or indirectly.
*/
modifier onlyInitializingERC721A() {
require(
ERC721A__InitializableStorage.layout()._initializing,
'ERC721A__Initializable: contract is not initializing'
);
_;
}
/// @dev Returns true if and only if the function is running in the constructor
function _isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly {
cs := extcodesize(self)
}
return cs == 0;
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '../IERC721AUpgradeable.sol';
/**
* @dev Interface of ERC721AQueryable.
*/
interface IERC721AQueryableUpgradeable is IERC721AUpgradeable {
/**
* Invalid query range (`start` >= `stop`).
*/
error InvalidQueryRange();
/**
* @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
*
* If the `tokenId` is out of bounds:
*
* - `addr = address(0)`
* - `startTimestamp = 0`
* - `burned = false`
* - `extraData = 0`
*
* If the `tokenId` is burned:
*
* - `addr = <Address of owner before token was burned>`
* - `startTimestamp = <Timestamp when token was burned>`
* - `burned = true`
* - `extraData = <Extra data when token was burned>`
*
* Otherwise:
*
* - `addr = <Address of owner>`
* - `startTimestamp = <Timestamp of start of ownership>`
* - `burned = false`
* - `extraData = <Extra data at start of ownership>`
*/
function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);
/**
* @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
* See {ERC721AQueryable-explicitOwnershipOf}
*/
function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`,
* in the range [`start`, `stop`)
* (i.e. `start <= tokenId < stop`).
*
* This function allows for tokens to be queried if the collection
* grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
*
* Requirements:
*
* - `start < stop`
*/
function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
) external view returns (uint256[] memory);
/**
* @dev Returns an array of token IDs owned by `owner`.
*
* This function scans the ownership mapping and is O(`totalSupply`) in complexity.
* It is meant to be called off-chain.
*
* See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
* multiple smaller scans if the collection is large enough to cause
* an out-of-gas error (10K collections should be fine).
*/
function tokensOfOwner(address owner) external view returns (uint256[] memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*
* NOTE: ERC-2981 allows setting the royalty to 100% of the price. In that case all the price would be sent to the
* royalty receiver and 0 tokens to the seller. Contracts dealing with royalty should consider empty transfers.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165Upgradeable is Initializable, IERC165 {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Arrays.sol)
// This file was procedurally generated from scripts/generate/templates/Arrays.js.
pragma solidity ^0.8.20;
import {Comparators} from "./Comparators.sol";
import {SlotDerivation} from "./SlotDerivation.sol";
import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using SlotDerivation for bytes32;
using StorageSlot for bytes32;
/**
* @dev Sort an array of uint256 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
uint256[] memory array,
function(uint256, uint256) pure returns (bool) comp
) internal pure returns (uint256[] memory) {
_quickSort(_begin(array), _end(array), comp);
return array;
}
/**
* @dev Variant of {sort} that sorts an array of uint256 in increasing order.
*/
function sort(uint256[] memory array) internal pure returns (uint256[] memory) {
sort(array, Comparators.lt);
return array;
}
/**
* @dev Sort an array of address (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
address[] memory array,
function(address, address) pure returns (bool) comp
) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of address in increasing order.
*/
function sort(address[] memory array) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Sort an array of bytes32 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
bytes32[] memory array,
function(bytes32, bytes32) pure returns (bool) comp
) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of bytes32 in increasing order.
*/
function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops
* at end (exclusive). Sorting follows the `comp` comparator.
*
* Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls.
*
* IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should
* be used only if the limits are within a memory array.
*/
function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure {
unchecked {
if (end - begin < 0x40) return;
// Use first element as pivot
uint256 pivot = _mload(begin);
// Position where the pivot should be at the end of the loop
uint256 pos = begin;
for (uint256 it = begin + 0x20; it < end; it += 0x20) {
if (comp(_mload(it), pivot)) {
// If the value stored at the iterator's position comes before the pivot, we increment the
// position of the pivot and move the value there.
pos += 0x20;
_swap(pos, it);
}
}
_swap(begin, pos); // Swap pivot into place
_quickSort(begin, pos, comp); // Sort the left side of the pivot
_quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot
}
}
/**
* @dev Pointer to the memory location of the first element of `array`.
*/
function _begin(uint256[] memory array) private pure returns (uint256 ptr) {
assembly ("memory-safe") {
ptr := add(array, 0x20)
}
}
/**
* @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word
* that comes just after the last element of the array.
*/
function _end(uint256[] memory array) private pure returns (uint256 ptr) {
unchecked {
return _begin(array) + array.length * 0x20;
}
}
/**
* @dev Load memory word (as a uint256) at location `ptr`.
*/
function _mload(uint256 ptr) private pure returns (uint256 value) {
assembly {
value := mload(ptr)
}
}
/**
* @dev Swaps the elements memory location `ptr1` and `ptr2`.
*/
function _swap(uint256 ptr1, uint256 ptr2) private pure {
assembly {
let value1 := mload(ptr1)
let value2 := mload(ptr2)
mstore(ptr1, value2)
mstore(ptr2, value1)
}
}
/// @dev Helper: low level cast address memory array to uint256 memory array
function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 memory array to uint256 memory array
function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast address comp function to uint256 comp function
function _castToUint256Comp(
function(address, address) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 comp function to uint256 comp function
function _castToUint256Comp(
function(bytes32, bytes32) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* NOTE: The `array` is expected to be sorted in ascending order, and to
* contain no repeated elements.
*
* IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks
* support for repeated elements in the array. The {lowerBound} function should
* be used instead.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value greater or equal than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].
*/
function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value strictly greater than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound].
*/
function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Same as {lowerBound}, but with an array in memory.
*/
function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Same as {upperBound}, but with an array in memory.
*/
function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(address[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(bytes32[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(uint256[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The caller is not authorized to call the function.
error Unauthorized();
/// @dev The `newOwner` cannot be the zero address.
error NewOwnerIsZeroAddress();
/// @dev The `pendingOwner` does not have a valid handover request.
error NoHandoverRequest();
/// @dev Cannot double-initialize.
error AlreadyInitialized();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ownership is transferred from `oldOwner` to `newOwner`.
/// This event is intentionally kept the same as OpenZeppelin's Ownable to be
/// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
/// despite it not being as lightweight as a single argument event.
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
/// @dev An ownership handover to `pendingOwner` has been requested.
event OwnershipHandoverRequested(address indexed pendingOwner);
/// @dev The ownership handover to `pendingOwner` has been canceled.
event OwnershipHandoverCanceled(address indexed pendingOwner);
/// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
/// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;
/// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STORAGE */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The owner slot is given by:
/// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
/// It is intentionally chosen to be a high value
/// to avoid collision with lower slots.
/// The choice of manual storage layout is to enable compatibility
/// with both regular and upgradeable contracts.
bytes32 internal constant _OWNER_SLOT =
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;
/// The ownership handover slot of `newOwner` is given by:
/// ```
/// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
/// let handoverSlot := keccak256(0x00, 0x20)
/// ```
/// It stores the expiry timestamp of the two-step ownership handover.
uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
function _guardInitializeOwner() internal pure virtual returns (bool guard) {}
/// @dev Initializes the owner directly without authorization guard.
/// This function must be called upon initialization,
/// regardless of whether the contract is upgradeable or not.
/// This is to enable generalization to both regular and upgradeable contracts,
/// and to save gas in case the initial owner is not the caller.
/// For performance reasons, this function will not check if there
/// is an existing owner.
function _initializeOwner(address newOwner) internal virtual {
if (_guardInitializeOwner()) {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
if sload(ownerSlot) {
mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
revert(0x1c, 0x04)
}
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Store the new value.
sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
}
} else {
/// @solidity memory-safe-assembly
assembly {
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Store the new value.
sstore(_OWNER_SLOT, newOwner)
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
}
}
}
/// @dev Sets the owner directly without authorization guard.
function _setOwner(address newOwner) internal virtual {
if (_guardInitializeOwner()) {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
// Store the new value.
sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
}
} else {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
// Store the new value.
sstore(ownerSlot, newOwner)
}
}
}
/// @dev Throws if the sender is not the owner.
function _checkOwner() internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// If the caller is not the stored owner, revert.
if iszero(eq(caller(), sload(_OWNER_SLOT))) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Returns how long a two-step ownership handover is valid for in seconds.
/// Override to return a different value if needed.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
return 48 * 3600;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC UPDATE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Allows the owner to transfer the ownership to `newOwner`.
function transferOwnership(address newOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
if iszero(shl(96, newOwner)) {
mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
revert(0x1c, 0x04)
}
}
_setOwner(newOwner);
}
/// @dev Allows the owner to renounce their ownership.
function renounceOwnership() public payable virtual onlyOwner {
_setOwner(address(0));
}
/// @dev Request a two-step ownership handover to the caller.
/// The request will automatically expire in 48 hours (172800 seconds) by default.
function requestOwnershipHandover() public payable virtual {
unchecked {
uint256 expires = block.timestamp + _ownershipHandoverValidFor();
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to `expires`.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x20), expires)
// Emit the {OwnershipHandoverRequested} event.
log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
}
}
}
/// @dev Cancels the two-step ownership handover to the caller, if any.
function cancelOwnershipHandover() public payable virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x20), 0)
// Emit the {OwnershipHandoverCanceled} event.
log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
}
}
/// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
/// Reverts if there is no existing ownership handover requested by `pendingOwner`.
function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
let handoverSlot := keccak256(0x0c, 0x20)
// If the handover does not exist, or has expired.
if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
// Set the handover slot to 0.
sstore(handoverSlot, 0)
}
_setOwner(pendingOwner);
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC READ FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the owner of the contract.
function owner() public view virtual returns (address result) {
/// @solidity memory-safe-assembly
assembly {
result := sload(_OWNER_SLOT)
}
}
/// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
function ownershipHandoverExpiresAt(address pendingOwner)
public
view
virtual
returns (uint256 result)
{
/// @solidity memory-safe-assembly
assembly {
// Compute the handover slot.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
// Load the handover slot.
result := sload(keccak256(0x0c, 0x20))
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MODIFIERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Marks a function as only callable by the owner.
modifier onlyOwner() virtual {
_checkOwner();
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev This is a base storage for the initialization function for upgradeable diamond facet contracts
**/
library ERC721A__InitializableStorage {
struct Layout {
/*
* Indicates that the contract has been initialized.
*/
bool _initialized;
/*
* Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet');
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides a set of functions to compare values.
*
* _Available since v5.1._
*/
library Comparators {
function lt(uint256 a, uint256 b) internal pure returns (bool) {
return a < b;
}
function gt(uint256 a, uint256 b) internal pure returns (bool) {
return a > b;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/SlotDerivation.sol)
// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js.
pragma solidity ^0.8.20;
/**
* @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots
* corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
* the solidity language / compiler.
*
* See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.].
*
* Example usage:
* ```solidity
* contract Example {
* // Add the library methods
* using StorageSlot for bytes32;
* using SlotDerivation for bytes32;
*
* // Declare a namespace
* string private constant _NAMESPACE = "<namespace>"; // eg. OpenZeppelin.Slot
*
* function setValueInNamespace(uint256 key, address newValue) internal {
* _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue;
* }
*
* function getValueInNamespace(uint256 key) internal view returns (address) {
* return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value;
* }
* }
* ```
*
* TIP: Consider using this library along with {StorageSlot}.
*
* NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking
* upgrade safety will ignore the slots accessed through this library.
*
* _Available since v5.1._
*/
library SlotDerivation {
/**
* @dev Derive an ERC-7201 slot from a string (namespace).
*/
function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) {
assembly ("memory-safe") {
mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1))
slot := and(keccak256(0x00, 0x20), not(0xff))
}
}
/**
* @dev Add an offset to a slot to get the n-th element of a structure or an array.
*/
function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) {
unchecked {
return bytes32(uint256(slot) + pos);
}
}
/**
* @dev Derive the location of the first element in an array from the slot where the length is stored.
*/
function deriveArray(bytes32 slot) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, slot)
result := keccak256(0x00, 0x20)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, and(key, shr(96, not(0))))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, iszero(iszero(key)))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @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 ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 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) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
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) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
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) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
import {Panic} from "../Panic.sol";
import {SafeCast} from "./SafeCast.sol";
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Return the 512-bit addition of two uint256.
*
* The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
*/
function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
assembly ("memory-safe") {
low := add(a, b)
high := lt(low, a)
}
}
/**
* @dev Return the 512-bit multiplication of two uint256.
*
* The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
*/
function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
// 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = high * 2²⁵⁶ + low.
assembly ("memory-safe") {
let mm := mulmod(a, b, not(0))
low := mul(a, b)
high := sub(sub(mm, low), lt(mm, low))
}
}
/**
* @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
success = c >= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a - b;
success = c <= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a * b;
assembly ("memory-safe") {
// Only true when the multiplication doesn't overflow
// (c / a == b) || (a == 0)
success := or(eq(div(c, a), b), iszero(a))
}
// equivalent to: success ? c : 0
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `DIV` opcode returns zero when the denominator is 0.
result := div(a, b)
}
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `MOD` opcode returns zero when the denominator is 0.
result := mod(a, b)
}
}
}
/**
* @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryAdd(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
*/
function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
(, uint256 result) = trySub(a, b);
return result;
}
/**
* @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryMul(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a < b, a, b);
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
// Handle non-overflow cases, 256 by 256 division.
if (high == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return low / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= high) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [high low].
uint256 remainder;
assembly ("memory-safe") {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
high := sub(high, gt(remainder, low))
low := sub(low, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly ("memory-safe") {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [high low] by twos.
low := div(low, twos)
// Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from high into low.
low |= high * twos;
// Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high
// is no longer required.
result = low * inverse;
return result;
}
}
/**
* @dev Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
*/
function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
if (high >= 1 << n) {
Panic.panic(Panic.UNDER_OVERFLOW);
}
return (high << (256 - n)) | (low >> n);
}
}
/**
* @dev Calculates x * y >> n with full precision, following the selected rounding direction.
*/
function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// If upper 8 bits of 16-bit half set, add 8 to result
r |= SafeCast.toUint((x >> r) > 0xff) << 3;
// If upper 4 bits of 8-bit half set, add 4 to result
r |= SafeCast.toUint((x >> r) > 0xf) << 2;
// Shifts value right by the current result and use it as an index into this lookup table:
//
// | x (4 bits) | index | table[index] = MSB position |
// |------------|---------|-----------------------------|
// | 0000 | 0 | table[0] = 0 |
// | 0001 | 1 | table[1] = 0 |
// | 0010 | 2 | table[2] = 1 |
// | 0011 | 3 | table[3] = 1 |
// | 0100 | 4 | table[4] = 2 |
// | 0101 | 5 | table[5] = 2 |
// | 0110 | 6 | table[6] = 2 |
// | 0111 | 7 | table[7] = 2 |
// | 1000 | 8 | table[8] = 3 |
// | 1001 | 9 | table[9] = 3 |
// | 1010 | 10 | table[10] = 3 |
// | 1011 | 11 | table[11] = 3 |
// | 1100 | 12 | table[12] = 3 |
// | 1101 | 13 | table[13] = 3 |
// | 1110 | 14 | table[14] = 3 |
// | 1111 | 15 | table[15] = 3 |
//
// The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
assembly ("memory-safe") {
r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
}
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX/bool 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.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @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
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
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
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
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
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
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
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
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
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
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
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
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
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
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
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
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
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
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
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
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
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
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
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
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
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
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
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
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
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
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
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
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
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
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
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
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
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
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
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
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
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
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
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
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
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
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
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
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
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
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
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
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
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
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
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
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
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
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
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
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
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
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
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @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
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @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
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @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
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @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
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @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
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @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
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @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
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @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
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @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
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @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
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @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
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @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
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @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
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @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
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @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
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @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
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @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
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @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
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @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
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @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
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @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
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @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
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @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
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @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
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @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
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @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
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @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
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @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
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @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
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @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
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solady/=lib/solady/src/"
],
"optimizer": {
"enabled": false,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"InvalidArguments","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidQuantity","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotTokenOwner","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"RevealNotEnabled","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"TransfersNotAllowed","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"roles","type":"uint256"}],"name":"RolesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"quantities","type":"uint64[]"},{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"batchAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership","name":"ownership","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"grantRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAllRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"hasAnyRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"owner_","type":"address"},{"internalType":"uint256","name":"maxSupply_","type":"uint256"},{"internalType":"address","name":"characters_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"renounceRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"roles","type":"uint256"}],"name":"revokeRoles","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"rolesOf","outputs":[{"internalType":"uint256","name":"roles","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enableReveal_","type":"bool"}],"name":"setEnableReveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enableTransfers_","type":"bool"}],"name":"setEnableTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds_","type":"uint256[]"},{"internalType":"bool","name":"locked_","type":"bool"}],"name":"setLockedTokenIds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052346200002d57620000146200003d565b6200001e62000033565b615236620002af823961523690f35b62000039565b60405190565b5f80fd5b6200004762000159565b565b60401c90565b60ff1690565b620000646200006a9162000049565b6200004f565b90565b62000079905462000055565b90565b5f0190565b5f1c90565b60018060401b031690565b620000a0620000a69162000081565b62000086565b90565b620000b5905462000091565b90565b60018060401b031690565b5f1b90565b90620000db60018060401b0391620000c3565b9181191691161790565b90565b62000101620000fb6200010792620000b8565b620000e5565b620000b8565b90565b90565b9062000127620001216200012f92620000e8565b6200010a565b8254620000c8565b9055565b6200013e90620000b8565b9052565b919062000157905f6020850194019062000133565b565b620001636200022f565b620001705f82016200006d565b6200020857620001825f8201620000a9565b6200019e6200019760018060401b03620000b8565b91620000b8565b03620001a8575b50565b620001bd905f60018060401b0391016200010d565b60018060401b03620001fe7fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d291620001f462000033565b9182918262000142565b0390a15f620001a5565b6200021262000033565b63f92ee8a960e01b8152806200022b600482016200007c565b0390fd5b6200023962000296565b90565b5f90565b90565b90565b6200025f62000259620002659262000240565b620000c3565b62000243565b90565b620002937ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0062000246565b90565b620002a06200023c565b50620002ab62000268565b9056fe60806040526004361015610015575b3661168257005b61001f5f356102ee565b806301ffc9a7146102e957806304634d8d146102e457806306fdde03146102df578063081812fc146102da578063095ea7b3146102d557806318160ddd146102d0578063183a4f6e146102cb5780631c10893f146102c65780631cd64df4146102c157806323b872dd146102bc57806325692962146102b7578063282c51f3146102b25780632a55205a146102ad5780632de94807146102a857806340c10f19146102a357806342842e0e1461029e57806342966c68146102995780634a4ee7b114610294578063514e62fc1461028f57806354d1f13d1461028a57806355c7fe671461028557806355f804b3146102805780635bbb21771461027b5780636352211e1461027657806370a0823114610271578063715018a61461026c57806375b238fc146102675780638462151c146102625780638da5cb5b1461025d57806395d89b411461025857806399a2557a14610253578063a1dd6a2e1461024e578063a22cb46514610249578063ada7e28414610244578063b88d4fde1461023f578063c23dc68f1461023a578063c2ca0ac514610235578063c87b56dd14610230578063d53913931461022b578063d53ab50114610226578063dab56b0e14610221578063e985e9c51461021c578063f04e283e14610217578063f2fde38b146102125763fee81cf40361000e5761164d565b611624565b6115fb565b6115c5565b611565565b61152e565b61141c565b6113b0565b61137d565b611348565b6112be565b6111b0565b61115e565b6110fa565b61103e565b610fcf565b610f9a565b610f65565b610e91565b610e31565b610dfc565b610dc7565b610d91565b610c05565b610abf565b6109e3565b6109ad565b610983565b610950565b610926565b6108f2565b6108bd565b610868565b6107e3565b610780565b610756565b6106e6565b6106bc565b610693565b61065e565b610612565b6105b0565b610515565b61044f565b61037a565b60e01c90565b60405190565b5f80fd5b5f80fd5b5f80fd5b63ffffffff60e01b1690565b61031b81610306565b0361032257565b5f80fd5b9050359061033382610312565b565b9060208282031261034e5761034b915f01610326565b90565b6102fe565b151590565b61036190610353565b9052565b9190610378905f60208501940190610358565b565b346103aa576103a6610395610390366004610335565b61168a565b61039d6102f4565b91829182610365565b0390f35b6102fa565b60018060a01b031690565b6103c3906103af565b90565b6103cf816103ba565b036103d657565b5f80fd5b905035906103e7826103c6565b565b6bffffffffffffffffffffffff1690565b610403816103e9565b0361040a57565b5f80fd5b9050359061041b826103fa565b565b91906040838203126104455780610439610442925f86016103da565b9360200161040e565b90565b6102fe565b5f0190565b3461047e5761046861046236600461041d565b906116e0565b6104706102f4565b8061047a8161044a565b0390f35b6102fa565b5f91031261048d57565b6102fe565b5190565b60209181520190565b5f5b8381106104b1575050905f910152565b8060209183015181850152016104a1565b601f801991011690565b6104eb6104f46020936104f9936104e281610492565b93848093610496565b9586910161049f565b6104c2565b0190565b6105129160208201915f8184039101526104cc565b90565b3461054557610525366004610483565b610541610530611808565b6105386102f4565b918291826104fd565b0390f35b6102fa565b90565b6105568161054a565b0361055d57565b5f80fd5b9050359061056e8261054d565b565b9060208282031261058957610586915f01610561565b90565b6102fe565b610597906103ba565b9052565b91906105ae905f6020850194019061058e565b565b346105e0576105dc6105cb6105c6366004610570565b61188e565b6105d36102f4565b9182918261059b565b0390f35b6102fa565b919060408382031261060d578061060161060a925f86016103da565b93602001610561565b90565b6102fe565b6106266106203660046105e5565b9061199e565b61062e6102f4565b806106388161044a565b0390f35b6106459061054a565b9052565b919061065c905f6020850194019061063c565b565b3461068e5761066e366004610483565b61068a6106796119ee565b6106816102f4565b91829182610649565b0390f35b6102fa565b6106a66106a1366004610570565b611a7e565b6106ae6102f4565b806106b88161044a565b0390f35b6106d06106ca3660046105e5565b90611aaa565b6106d86102f4565b806106e28161044a565b0390f35b34610717576107136107026106fc3660046105e5565b90611ab6565b61070a6102f4565b91829182610365565b0390f35b6102fa565b90916060828403126107515761074e610737845f85016103da565b9361074581602086016103da565b93604001610561565b90565b6102fe565b61076a61076436600461071c565b91611b6a565b6107726102f4565b8061077c8161044a565b0390f35b61078b366004610483565b610793611b93565b61079b6102f4565b806107a58161044a565b0390f35b90565b90565b6107c36107be6107c8926107a9565b6107ac565b61054a565b90565b6107d560036107af565b90565b6107e06107cb565b90565b34610813576107f3366004610483565b61080f6107fe6107d8565b6108066102f4565b91829182610649565b0390f35b6102fa565b9190604083820312610840578061083461083d925f8601610561565b93602001610561565b90565b6102fe565b91602061086692949361085f60408201965f83019061058e565b019061063c565b565b3461089a5761088161087b366004610818565b90611cfc565b9061089661088d6102f4565b92839283610845565b0390f35b6102fa565b906020828203126108b8576108b5915f016103da565b90565b6102fe565b346108ed576108e96108d86108d336600461089f565b611dc9565b6108e06102f4565b91829182610649565b0390f35b6102fa565b346109215761090b6109053660046105e5565b90611e91565b6109136102f4565b8061091d8161044a565b0390f35b6102fa565b61093a61093436600461071c565b91611ecb565b6109426102f4565b8061094c8161044a565b0390f35b3461097e57610968610963366004610570565b611f07565b6109706102f4565b8061097a8161044a565b0390f35b6102fa565b6109976109913660046105e5565b90611f32565b61099f6102f4565b806109a98161044a565b0390f35b346109de576109da6109c96109c33660046105e5565b90611f5a565b6109d16102f4565b91829182610365565b0390f35b6102fa565b6109ee366004610483565b6109f6611f84565b6109fe6102f4565b80610a088161044a565b0390f35b5f80fd5b5f80fd5b5f80fd5b909182601f83011215610a525781359167ffffffffffffffff8311610a4d576020019260208302840111610a4857565b610a14565b610a10565b610a0c565b610a6081610353565b03610a6757565b5f80fd5b90503590610a7882610a57565b565b91604083830312610aba575f83013567ffffffffffffffff8111610ab557610aa783610ab2928601610a18565b939094602001610a6b565b90565b610302565b6102fe565b34610aee57610ad8610ad2366004610a7a565b916120ea565b610ae06102f4565b80610aea8161044a565b0390f35b6102fa565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b90610b15906104c2565b810190811067ffffffffffffffff821117610b2f57604052565b610af7565b90610b47610b406102f4565b9283610b0b565b565b67ffffffffffffffff8111610b6757610b636020916104c2565b0190565b610af7565b90825f939282370152565b90929192610b8c610b8782610b49565b610b34565b93818552602085019082840111610ba857610ba692610b6c565b565b610af3565b9080601f83011215610bcb57816020610bc893359101610b77565b90565b610a0c565b90602082820312610c00575f82013567ffffffffffffffff8111610bfb57610bf89201610bad565b90565b610302565b6102fe565b34610c3357610c1d610c18366004610bd0565b61230f565b610c256102f4565b80610c2f8161044a565b0390f35b6102fa565b90602082820312610c69575f82013567ffffffffffffffff8111610c6457610c609201610a18565b9091565b610302565b6102fe565b5190565b60209181520190565b60200190565b610c8a906103ba565b9052565b67ffffffffffffffff1690565b610ca490610c8e565b9052565b610cb190610353565b9052565b62ffffff1690565b610cc690610cb5565b9052565b90606080610d1093610ce25f8201515f860190610c81565b610cf460208201516020860190610c9b565b610d0660408201516040860190610ca8565b0151910190610cbd565b565b90610d1f81608093610cca565b0190565b60200190565b90610d46610d40610d3984610c6e565b8093610c72565b92610c7b565b905f5b818110610d565750505090565b909192610d6f610d696001928651610d12565b94610d23565b9101919091610d49565b610d8e9160208201915f818403910152610d29565b90565b34610dc257610dbe610dad610da7366004610c38565b9061231f565b610db56102f4565b91829182610d79565b0390f35b6102fa565b34610df757610df3610de2610ddd366004610570565b6123db565b610dea6102f4565b9182918261059b565b0390f35b6102fa565b34610e2c57610e28610e17610e1236600461089f565b612455565b610e1f6102f4565b91829182610649565b0390f35b6102fa565b610e3c366004610483565b610e446124d8565b610e4c6102f4565b80610e568161044a565b0390f35b90565b610e71610e6c610e7692610e5a565b6107ac565b61054a565b90565b610e836001610e5d565b90565b610e8e610e79565b90565b34610ec157610ea1366004610483565b610ebd610eac610e86565b610eb46102f4565b91829182610649565b0390f35b6102fa565b5190565b60209181520190565b60200190565b610ee29061054a565b9052565b90610ef381602093610ed9565b0190565b60200190565b90610f1a610f14610f0d84610ec6565b8093610eca565b92610ed3565b905f5b818110610f2a5750505090565b909192610f43610f3d6001928651610ee6565b94610ef7565b9101919091610f1d565b610f629160208201915f818403910152610efd565b90565b34610f9557610f91610f80610f7b36600461089f565b6124e7565b610f886102f4565b91829182610f4d565b0390f35b6102fa565b34610fca57610faa366004610483565b610fc6610fb561256a565b610fbd6102f4565b9182918261059b565b0390f35b6102fa565b34610fff57610fdf366004610483565b610ffb610fea61257d565b610ff26102f4565b918291826104fd565b0390f35b6102fa565b90916060828403126110395761103661101f845f85016103da565b9361102d8160208601610561565b93604001610561565b90565b6102fe565b3461106f5761106b61105a611054366004611004565b9161259c565b6110626102f4565b91829182610f4d565b0390f35b6102fa565b919060a0838203126110f5575f83013567ffffffffffffffff81116110f0578161109f918501610bad565b92602081013567ffffffffffffffff81116110eb57826110c0918301610bad565b926110e86110d184604085016103da565b936110df8160608601610561565b936080016103da565b90565b610302565b610302565b6102fe565b3461112c5761111661110d366004611074565b93929092612af6565b61111e6102f4565b806111288161044a565b0390f35b6102fa565b9190604083820312611159578061114d611156925f86016103da565b93602001610a6b565b90565b6102fe565b3461118d57611177611171366004611131565b90612b93565b61117f6102f4565b806111898161044a565b0390f35b6102fa565b906020828203126111ab576111a8915f01610a6b565b90565b6102fe565b346111de576111c86111c3366004611192565b612bd0565b6111d06102f4565b806111da8161044a565b0390f35b6102fa565b67ffffffffffffffff8111611201576111fd6020916104c2565b0190565b610af7565b9092919261121b611216826111e3565b610b34565b938185526020850190828401116112375761123592610b6c565b565b610af3565b9080601f8301121561125a5781602061125793359101611206565b90565b610a0c565b906080828203126112b957611276815f84016103da565b9261128482602085016103da565b926112928360408301610561565b92606082013567ffffffffffffffff81116112b4576112b1920161123c565b90565b610302565b6102fe565b6112d56112cc36600461125f565b92919091612bdb565b6112dd6102f4565b806112e78161044a565b0390f35b90606080611331936113035f8201515f860190610c81565b61131560208201516020860190610c9b565b61132760408201516040860190610ca8565b0151910190610cbd565b565b9190611346905f608085019401906112eb565b565b346113785761137461136361135e366004610570565b612caf565b61136b6102f4565b91829182611333565b0390f35b6102fa565b346113ab57611395611390366004610570565b612dcd565b61139d6102f4565b806113a78161044a565b0390f35b6102fa565b346113e0576113dc6113cb6113c6366004610570565b612f54565b6113d36102f4565b918291826104fd565b0390f35b6102fa565b90565b6113fc6113f7611401926113e5565b6107ac565b61054a565b90565b61140e60026113e8565b90565b611419611404565b90565b3461144c5761142c366004610483565b611448611437611411565b61143f6102f4565b91829182610649565b0390f35b6102fa565b909182601f8301121561148b5781359167ffffffffffffffff831161148657602001926020830284011161148157565b610a14565b610a10565b610a0c565b909182601f830112156114ca5781359167ffffffffffffffff83116114c55760200192602083028401116114c057565b610a14565b610a10565b610a0c565b9091604082840312611529575f82013567ffffffffffffffff811161152457836114fa918401611451565b929093602082013567ffffffffffffffff811161151f5761151b9201611490565b9091565b610302565b610302565b6102fe565b346115605761154a6115413660046114cf565b929190916131e5565b6115526102f4565b8061155c8161044a565b0390f35b6102fa565b346115935761157d611578366004611192565b613263565b6115856102f4565b8061158f8161044a565b0390f35b6102fa565b91906040838203126115c057806115b46115bd925f86016103da565b936020016103da565b90565b6102fe565b346115f6576115f26115e16115db366004611598565b9061329a565b6115e96102f4565b91829182610365565b0390f35b6102fa565b61160e61160936600461089f565b613311565b6116166102f4565b806116208161044a565b0390f35b61163761163236600461089f565b613350565b61163f6102f4565b806116498161044a565b0390f35b3461167d5761167961166861166336600461089f565b61335b565b6116706102f4565b91829182610649565b0390f35b6102fa565b5f80fd5b5f90565b611692611686565b5061169c816133d4565b9081156116a8575b5090565b6116b29150613445565b5f6116a4565b906116d2916116cd6116c8610e79565b613485565b6116d4565b565b906116de916135d4565b565b906116ea916116b8565b565b606090565b634e487b7160e01b5f52602260045260245ffd5b9060016002830492168015611725575b602083101461172057565b6116f1565b91607f1691611715565b60209181520190565b5f5260205f2090565b905f929180549061175b61175483611705565b809461172f565b916001811690815f146117b25750600114611776575b505050565b6117839192939450611738565b915f925b81841061179a57505001905f8080611771565b60018160209295939554848601520191019290611787565b92949550505060ff19168252151560200201905f8080611771565b906117d791611741565b90565b906117fa6117f3926117ea6102f4565b938480926117cd565b0383610b0b565b565b611805906117da565b90565b6118106116ec565b50611824600261181e6136ce565b016117fc565b90565b5f90565b61183f61183a6118449261054a565b6107ac565b61054a565b90565b906118519061182b565b5f5260205260405f2090565b5f1c90565b60018060a01b031690565b61187961187e9161185d565b611862565b90565b61188b905461186d565b90565b611896611827565b506118a96118a38261373a565b15610353565b6118ce575f6118c56118cb9260066118bf6136ce565b01611847565b01611881565b90565b6333d1c03960e21b613856565b60ff1690565b6118ed6118f29161185d565b6118db565b90565b6118ff90546118e1565b90565b9061190c9061182b565b5f5260205260405f2090565b9080611922613881565b90611938611932600284016118f5565b15610353565b918215611974575b50506119515761194f91611992565b565b6119596102f4565b63ab064ad360e01b8152806119706004820161044a565b0390fd5b61198b92509060036119869201611902565b6118f5565b5f80611940565b9061199c9161388c565b565b906119a891611918565b565b5f90565b90565b6119bd6119c29161185d565b6119ae565b90565b6119cf90546119b1565b90565b906119dd910361054a565b90565b906119eb910161054a565b90565b6119f66119aa565b50611a36611a28611a0f5f611a096136ce565b016119c5565b611a226001611a1c6136ce565b016119c5565b906119d2565b611a3061389c565b906119d2565b90611a3f6138b2565b611a52611a4c5f1961054a565b9161054a565b03611a5a575b565b90611a7890611a726008611a6c6136ce565b016119c5565b906119e0565b90611a58565b611a8890336138c0565b565b90611a9c91611a976138cf565b611a9e565b565b90611aa8916138eb565b565b90611ab491611a8a565b565b611ad6611ace611adc92611ac8611686565b50611dc9565b83169261054a565b9161054a565b1490565b919081611aeb613881565b90611b01611afb600284016118f5565b15610353565b918215611b3d575b5050611b1a57611b1892611b5b565b565b611b226102f4565b63ab064ad360e01b815280611b396004820161044a565b0390fd5b611b549250906003611b4f9201611902565b6118f5565b5f80611b09565b91611b6892919091613983565b565b90611b759291611ae0565b565b611b8b611b86611b9092610c8e565b6107ac565b61054a565b90565b611bad42611ba7611ba2613c4a565b611b77565b906119e0565b63389a75e1600c52335f526020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2565b90611bef9061182b565b5f5260205260405f2090565b90565b60a01c90565b6bffffffffffffffffffffffff1690565b611c21611c2691611bfe565b611c04565b90565b611c339054611c15565b90565b90565b611c4d611c48611c5292611c36565b6107ac565b6103af565b90565b611c5e90611c39565b90565b611c75611c70611c7a926103e9565b6107ac565b61054a565b90565b634e487b7160e01b5f52601160045260245ffd5b611ca0611ca69193929361054a565b9261054a565b91611cb283820261054a565b928184041490151715611cc157565b611c7d565b634e487b7160e01b5f52601260045260245ffd5b611ce6611cec9161054a565b9161054a565b908115611cf7570490565b611cc6565b919091611d07611827565b50611d106119aa565b50611d2e611d29611d1f613c62565b9260018401611be5565b611bfb565b92611d455f611d3e818701611881565b9501611c29565b9184611d61611d5b611d565f611c55565b6103ba565b916103ba565b14611d98575b50611d9591611d79611d7f9291611c61565b90611c91565b611d8f611d8a613ca9565b611c61565b90611cda565b90565b9350611d959150611d7f90611d79611dc05f80611db881808b0101611881565b980101611c29565b93505090611d67565b611dd16119aa565b50638b78c6d8600c525f526020600c205490565b90611dff91611dfa611df5611404565b613cc0565b611e26565b565b611e10611e169193929361054a565b9261054a565b8201809211611e2157565b611c7d565b90611e2f613881565b611e5e611e58611e536001611e4c611e456119ee565b8790611e01565b94016119c5565b61054a565b9161054a565b11611e6e57611e6c91613d56565b565b611e766102f4565b63d05cb60960e01b815280611e8d6004820161044a565b0390fd5b90611e9b91611de5565b565b90611eaf611eaa83610b49565b610b34565b918252565b611ebd5f611e9d565b90565b611ec8611eb4565b90565b91611edf9291611ed9611ec0565b92612bdb565b565b611efa90611ef5611ef06107cb565b613cc0565b611efc565b565b611f0590613f36565b565b611f1090611ee1565b565b90611f2491611f1f6138cf565b611f26565b565b90611f30916138c0565b565b90611f3c91611f12565b565b611f52611f4d611f5792611c36565b6107ac565b61054a565b90565b611f6c90611f66611686565b50611dc9565b16611f7f611f795f611f3e565b9161054a565b141590565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b90611fd89291611fd3611fce610e79565b613485565b61206d565b565b5090565b634e487b7160e01b5f52603260045260245ffd5b9190811015612002576020020190565b611fde565b356120118161054d565b90565b5f1b90565b9061202560ff91612014565b9181191691161790565b61203890610353565b90565b90565b9061205361204e61205a9261202f565b61203b565b8254612019565b9055565b600161206a910161054a565b90565b90929192612079613881565b93612085838390611fda565b9361208f5f611f3e565b5b806120a361209d8861054a565b9161054a565b10156120e1576120dc906120d7846120d260038b016120cc6120c78b8b8891611ff2565b612007565b90611902565b61203e565b61205e565b612090565b50945050505050565b906120f59291611fbd565b565b6121109061210b612106610e79565b613485565b6122fa565b565b601f602091010490565b1b90565b9190600861213b9102916121355f198461211c565b9261211c565b9181191691161790565b90565b919061215e6121596121669361182b565b612145565b908354612120565b9055565b61217c916121766119aa565b91612148565b565b5b81811061218a575050565b806121975f60019361216a565b0161217f565b9190601f81116121ad575b505050565b6121b96121de93611738565b9060206121c584612112565b830193106121e6575b6121d790612112565b019061217e565b5f80806121a8565b91506121d7819290506121ce565b1c90565b90612208905f19906008026121f4565b191690565b81612217916121f8565b906002021790565b9061222981610492565b9067ffffffffffffffff82116122e95761224d826122478554611705565b8561219d565b602090601f831160011461228157918091612270935f92612275575b505061220d565b90555b565b90915001515f80612269565b601f1983169161229085611738565b925f5b8181106122d1575091600293918560019694106122b7575b50505002019055612273565b6122c7910151601f8416906121f8565b90555f80806122ab565b91936020600181928787015181550195019201612293565b610af7565b906122f89161221f565b565b61230d905f612307613881565b016122ee565b565b612318906120f7565b565b606090565b9061233c9061232c61231a565b5061233561231a565b5082611fda565b916040519280845260051b8060208501016040525b8061236461235e5f611f3e565b9161054a565b14612390576020906123746119aa565b50039061238382840135612caf565b8260208601015290612351565b5091905090565b6123ab6123a66123b09261054a565b6107ac565b6103af565b90565b6123c76123c26123cc926103af565b6107ac565b6103af565b90565b6123d8906123b3565b90565b6123f86123f36123fd926123ed611827565b50613f43565b612397565b6123cf565b90565b612409906123cf565b90565b9061241690612400565b5f5260205260405f2090565b90565b61243961243461243e92612422565b6107ac565b61054a565b90565b61245267ffffffffffffffff612425565b90565b61245d6119aa565b508061247961247361246e5f611c55565b6103ba565b916103ba565b146124a65761249561249a91600561248f6136ce565b0161240c565b6119c5565b6124a2612441565b1690565b6323d3ad8160e21b613856565b6124bb6138cf565b6124c36124c5565b565b6124d66124d15f611c55565b6140cf565b565b6124e06124b3565b565b606090565b6124ef6124e2565b506124f86138b2565b61250b6125055f1961054a565b9161054a565b0361255d5761251861389c565b612520614157565b6125286124e2565b928261253c6125368461054a565b9161054a565b03612548575b50505090565b6125559350919091614182565b5f8080612542565b63bdba09d760e01b613856565b612572611827565b50638b78c6d8195490565b6125856116ec565b5061259960036125936136ce565b016117fc565b90565b916125b2926125a96124e2565b50919091614182565b90565b60081c90565b6125c76125cc916125b5565b6118db565b90565b6125d990546125bb565b90565b60207f20697320616c726561647920696e697469616c697a6564000000000000000000917f455243373231415f5f496e697469616c697a61626c653a20636f6e74726163745f8201520152565b6126366037604092610496565b61263f816125dc565b0190565b6126589060208101905f818303910152612629565b90565b1561266257565b61266a6102f4565b62461bcd60e51b81528061268060048201612643565b0390fd5b60081b90565b9061269761ff0091612684565b9181191691161790565b906126b66126b16126bd9261202f565b61203b565b825461268a565b9055565b939161271893916126da5f6126d46144be565b016125cf565b5f14612764576126f16126eb6144d5565b5b61265b565b61270c6127065f6127006144be565b016125cf565b15610353565b9586612737575b6128e2565b61271f575b565b6127325f8061272c6144be565b016126a1565b61271d565b61274b60015f6127456144be565b016126a1565b61275f60015f6127596144be565b0161203e565b612713565b6126f161278261277c5f6127766144be565b016118f5565b15610353565b6126ec565b60401c90565b61279961279e91612787565b6118db565b90565b6127ab905461278d565b90565b67ffffffffffffffff1690565b6127c76127cc9161185d565b6127ae565b90565b6127d990546127bb565b90565b6127f06127eb6127f592611c36565b6107ac565b610c8e565b90565b61280c61280761281192610e5a565b6107ac565b610c8e565b90565b61281d906123cf565b90565b9061283367ffffffffffffffff91612014565b9181191691161790565b61285161284c61285692610c8e565b6107ac565b610c8e565b90565b90565b9061287161286c6128789261283d565b612859565b8254612820565b9055565b60401b90565b9061289668ff00000000000000009161287c565b9181191691161790565b906128b56128b06128bc9261202f565b61203b565b8254612882565b9055565b6128c9906127f8565b9052565b91906128e0905f602085019401906128c0565b565b919390926128ee614507565b946129036128fd5f88016127a1565b15610353565b9461290f5f88016127cf565b8061292261291c5f6127dc565b91610c8e565b1480612a43575b9061293d61293760016127f8565b91610c8e565b1480612a1b575b61294f909115610353565b9081612a0a575b506129e75761297f9461297461296c60016127f8565b5f8a0161285c565b866129d5575b612abe565b612987575b50565b612994905f8091016128a0565b60016129cc7fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2916129c36102f4565b918291826128cd565b0390a15f612984565b6129e260015f8a016128a0565b61297a565b6129ef6102f4565b63f92ee8a960e01b815280612a066004820161044a565b0390fd5b612a15915015610353565b5f612956565b5061294f612a2830612814565b3b612a3b612a355f611f3e565b9161054a565b149050612944565b5086612929565b90612a565f1991612014565b9181191691161790565b90612a75612a70612a7c9261182b565b612145565b8254612a4a565b9055565b90612a9160018060a01b0391612014565b9181191691161790565b90565b90612ab3612aae612aba92612400565b612a9b565b8254612a80565b9055565b92612aed90612ae4600494612adf612af49895612ad9613881565b986145ec565b6145f8565b60018501612a60565b9101612a9e565b565b90612b03949392916126c1565b565b90612b0f5f611f3e565b612b17613881565b90612b2d612b27600284016118f5565b15610353565b918215612b69575b5050612b4657612b4491612b87565b565b612b4e6102f4565b63ab064ad360e01b815280612b656004820161044a565b0390fd5b612b809250906003612b7b9201611902565b6118f5565b5f80612b35565b90612b9191614690565b565b90612b9d91612b05565b565b612bb890612bb3612bae610e79565b613485565b612bba565b565b612bce906002612bc8613881565b0161203e565b565b612bd990612b9f565b565b9192612be983838691611b6a565b813b612bfd612bf75f611f3e565b9161054a565b03612c09575b50505050565b612c2093612c1a9392909192614850565b15610353565b612c2d575f808080612c03565b6368d2bf6b60e11b613856565b612c446080610b34565b90565b5f90565b5f90565b5f90565b5f90565b612c5f612c3a565b90602080808085612c6e612c47565b815201612c79612c4b565b815201612c84612c4f565b815201612c8f612c53565b81525050565b612c9d612c57565b90565b6001612cac910361054a565b90565b90612cb8612c95565b9180612cd3612ccd612cc861389c565b61054a565b9161054a565b1015612cdd575b50565b80612cf7612cf1612cec6138b2565b61054a565b9161054a565b11612d515780612d16612d10612d0b614157565b61054a565b9161054a565b1015612cda579091505b612d32612d2c82614985565b15610353565b15612d4557612d4090612ca0565b612d20565b612d4e90614955565b90565b612d5c919250614955565b90565b612d6b612d7091611bfe565b6118db565b90565b612d7d9054612d5f565b90565b612d89906123b3565b90565b612d9590612d80565b90565b612da1906123cf565b90565b5f80fd5b60e01b90565b5f910312612db857565b6102fe565b612dc56102f4565b3d5f823e3d90fd5b612dd5613881565b612dea612de460048301612d73565b15610353565b612ed757612df7826123db565b612e09612e03336103ba565b916103ba565b03612eb457612e2e612e296004612e3393612e2386613f36565b01611881565b612d8c565b612d98565b9063e89fe31d90339092803b15612eaf57612e615f8094612e6c612e556102f4565b97889687958694612da8565b845260048401610845565b03925af18015612eaa57612e7e575b50565b612e9d905f3d8111612ea3575b612e958183610b0b565b810190612dae565b5f612e7b565b503d612e8b565b612dbd565b612da4565b612ebc6102f4565b6359dc379f60e01b815280612ed36004820161044a565b0390fd5b612edf6102f4565b633e2e78cb60e21b815280612ef66004820161044a565b0390fd5b90565b5190565b612f09611eb4565b90565b905090565b612f36612f2d92602092612f2481610492565b94858093612f0c565b9384910161049f565b0190565b612f4890612f4e9392612f11565b90612f11565b90565b90565b612f5c6116ec565b50612f6f612f698261373a565b15610353565b612ff657612f7b6149c1565b90612f8d612f8883612efa565b612efd565b612f9f612f995f611f3e565b9161054a565b14155f14612fe757612fde612fb7612fe393926149df565b91612fcf612fc36102f4565b93849260208401612f3a565b60208201810382520382610b0b565b612f51565b5b90565b5050612ff1612f01565b612fe4565b630a14c4b560e41b613856565b9061301f93929161301a613015610e79565b613cc0565b613081565b565b5090565b5090565b9190811015613039576020020190565b611fde565b61304781610c8e565b0361304e57565b5f80fd5b3561305c8161303e565b90565b919081101561306f576020020190565b611fde565b3561307e816103c6565b90565b9093929361308d613881565b91613099848790613021565b946130a5828490613025565b6130b76130b18861054a565b9161054a565b036131c2576130c55f611f3e565b5b806130d96130d38961054a565b9161054a565b10156131b8576130fb6130f66130f185878591613029565b613052565b611b77565b908161310f6131095f611f3e565b9161054a565b146131955761312661311f6119ee565b8390611e01565b61314361313d61313860018a016119c5565b61054a565b9161054a565b116131725761316861316d9261316361315e8a8d869161305f565b613074565b613d56565b61205e565b6130c6565b61317a6102f4565b63d05cb60960e01b8152806131916004820161044a565b0390fd5b61319d6102f4565b63524f409b60e01b8152806131b46004820161044a565b0390fd5b5095505050505050565b6131ca6102f4565b6317dbc4cb60e21b8152806131e16004820161044a565b0390fd5b906131f1939291613003565b565b61320c90613207613202610e79565b613485565b61324d565b565b60a01b90565b9061322360ff60a01b9161320e565b9181191691161790565b9061324261323d6132499261202f565b61203b565b8254613214565b9055565b61326190600461325b613881565b0161322d565b565b61326c906131f3565b565b9061327890612400565b5f5260205260405f2090565b9061328e90612400565b5f5260205260405f2090565b6132c8916132be6132c3926132ad611686565b5060076132b86136ce565b0161326e565b613284565b6118f5565b90565b6132dc906132d76138cf565b6132de565b565b63389a75e1600c52805f526020600c209081544211613304575f61330292556140cf565b565b636f5e88185f526004601cfd5b61331a906132cb565b565b61332d906133286138cf565b61332f565b565b8060601b1561334357613341906140cf565b565b637448fbae5f526004601cfd5b6133599061331c565b565b6133636119aa565b5063389a75e1600c525f526020600c205490565b90565b61338e61338961339392613377565b612da8565b610306565b90565b90565b6133ad6133a86133b292613396565b612da8565b610306565b90565b90565b6133cc6133c76133d1926133b5565b612da8565b610306565b90565b6133dc611686565b50806133f46133ee6301ffc9a761337a565b91610306565b148015613427575b908115613408575b5090565b905061342061341a635b5e139f6133b8565b91610306565b145f613404565b508061343f6134396380ac58cd613399565b91610306565b146133fc565b61344d611686565b508061346861346263152a902d60e11b610306565b91610306565b14908115613475575b5090565b61347f9150614a2c565b5f613471565b638b78c6d819543303613496575b50565b638b78c6d8600c52335f526020600c205416156134b3575f613493565b6382b429005f526004601cfd5b6134c990611c61565b9052565b9160206134ee9294936134e760408201965f8301906134c0565b019061063c565b565b6134fa6040610b34565b90565b90613507906103ba565b9052565b90613515906103e9565b9052565b61352390516103ba565b90565b61353090516103e9565b90565b9061354d6bffffffffffffffffffffffff60a01b9161320e565b9181191691161790565b61356b613566613570926103e9565b6107ac565b6103e9565b90565b90565b9061358b61358661359292613557565b613573565b8254613533565b9055565b906135c060205f6135c6946135b88282016135b2848801613519565b90612a9e565b019201613526565b90613576565b565b906135d291613596565b565b906135dd613c62565b916135ee6135e9613ca9565b611c61565b826136016135fb8361054a565b91611c61565b1161368457508061362261361c6136175f611c55565b6103ba565b916103ba565b14613656576136549261364e5f929361364561363c6134f0565b958587016134fd565b6020850161350b565b016135c8565b565b6136806136625f611c55565b61366a6102f4565b918291635b6cc80560e11b83526004830161059b565b0390fd5b826136a66136906102f4565b928392636f483d0960e01b8452600484016134cd565b0390fd5b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6136d66136aa565b90565b906136e39061182b565b5f5260205260405f2090565b6136f89061054a565b5f8114613706576001900390565b611c7d565b90565b61372261371d6137279261370b565b6107ac565b61054a565b90565b613737600160e01b61370e565b90565b90613743611686565b9161374c61389c565b61375e6137588361054a565b9161054a565b1115613768575b50565b8061378261377c6137776138b2565b61054a565b9161054a565b1161382c57806137ab6137a56137a05f61379a6136ce565b016119c5565b61054a565b9161054a565b106137b6575b613765565b9091506137c16119aa565b505b6137e06137db60046137d36136ce565b0183906136d9565b6119c5565b90816137f46137ee5f611f3e565b9161054a565b036138085761380391506136ef565b6137c3565b5061381161372a565b1661382461381e5f611f3e565b9161054a565b14905f6137b1565b61385391925061384961384e9160046138436136ce565b016136d9565b6119c5565b614a52565b90565b5f5260045ffd5b7f615c3d332aa4e80a8368065a0cc0cbdbccb062dccf55dbc7f3538f0989d714e290565b61388961385d565b90565b9061389a9190600191614a6f565b565b6138a46119aa565b506138af6001610e5d565b90565b6138ba6119aa565b505f1990565b906138cd91905f91614b49565b565b638b78c6d8195433036138de57565b6382b429005f526004601cfd5b906138f99190600191614b49565b565b613904906123b3565b90565b61391b613916613920926103af565b6107ac565b61054a565b90565b90565b61393a61393561393f92613923565b6107ac565b61054a565b90565b61395160018060a01b03613926565b90565b90565b61396b61396661397092613954565b6107ac565b61054a565b90565b613980600160e11b613957565b90565b9190916139b96139b46139a66139a161399b86613f43565b946138fb565b613907565b6139ae613942565b16612397565b6123cf565b926139cb6139c683612397565b6123cf565b6139dd6139d7866103ba565b916103ba565b03613c1b576139eb83614baa565b929092613a0a613a0482886139fe614bde565b91614beb565b15610353565b613be6575b90613ae693613ae19392613bdd575b50613a4e613a376005613a2f6136ce565b01889061240c565b613a48613a43826119c5565b612ca0565b90612a60565b613a7d613a666005613a5e6136ce565b01849061240c565b613a77613a72826119c5565b61205e565b90612a60565b613ab9613a9f83613a8c613973565b613a988a878791614c9b565b1790614ce8565b613ab46004613aac6136ce565b0188906136d9565b612a60565b80613ac2613973565b16613ad5613acf5f611f3e565b9161054a565b14613b3b575b506138fb565b613907565b613aee613942565b1680927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a4613b27613b215f611f3e565b9161054a565b14613b2e57565b633a954ecd60e21b613856565b613b4f85613b496001610e5d565b906119e0565b613b6c613b676004613b5f6136ce565b0183906136d9565b6119c5565b613b7e613b785f611f3e565b9161054a565b14613b8a575b50613adb565b80613bae613ba8613ba35f613b9d6136ce565b016119c5565b61054a565b9161054a565b03613bb9575b613b84565b613bd1613bd692916004613bcb6136ce565b016136d9565b612a60565b5f80613bb4565b5f90555f613a1e565b9190613c03613bfd87613bf7614bde565b9061329a565b15610353565b613c0e579091613a0f565b632ce44b5f60e11b613856565b62a1148160e81b613856565b5f90565b90565b613c42613c3d613c4792613c2b565b6107ac565b610c8e565b90565b613c52613c27565b50613c5f6202a300613c2e565b90565b7fdaedc9ab023613a7caf35e703657e986ccfad7e3eb0af93a2853f8d65dd86b0090565b5f90565b90565b613ca1613c9c613ca692613c8a565b6107ac565b6103e9565b90565b613cb1613c86565b50613cbd612710613c8d565b90565b638b78c6d8600c52335f526020600c20541615613cda575b565b638b78c6d81954330315613cd8576382b429005f526004601cfd5b90565b613d0c613d07613d1192613cf5565b6107ac565b61054a565b90565b613d1e6040613cf8565b90565b613d4090613d3a613d34613d459461054a565b9161054a565b9061211c565b61054a565b90565b90613d53910261054a565b90565b613d685f613d626136ce565b016119c5565b9082613d7c613d765f611f3e565b9161054a565b14613f2957613e3a81613dd5613dbb613e3f94613d9888614d03565b613db4613da45f611c55565b86613dae5f611f3e565b91614c9b565b1790614ce8565b613dd06004613dc86136ce565b0187906136d9565b612a60565b613e35613e0886613df76001613df2613dec613d14565b91610e5d565b613d21565b613e016001610e5d565b1790613d48565b613e2f613e206005613e186136ce565b01859061240c565b91613e2a836119c5565b6119e0565b90612a60565b6138fb565b613907565b613e47613942565b169182613e5c613e565f611f3e565b9161054a565b14613f1d57613e6b90826119e0565b9092613e8182613e7b6001610e5d565b906119d2565b613e9a613e94613e8f6138b2565b61054a565b9161054a565b11613f105760015b15613ed5575b5f84845f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4613ea2565b92613edf9061205e565b9283613ef3613eed8461054a565b9161054a565b03613ea8579250613f0e91505f613f086136ce565b01612a60565b565b6340b23f1d60e11b613856565b622e076360e81b613856565b63b562e8dd60e01b613856565b613f41905f90614d42565b565b613f4b6119aa565b50613f5461389c565b613f66613f608361054a565b9161054a565b1115613f7a575b636f96cda160e11b613856565b613f97613f926004613f8a6136ce565b0183906136d9565b6119c5565b9080613fb2613fac613fa76138b2565b61054a565b9161054a565b116140b15781613fca613fc45f611f3e565b9161054a565b14613ff4575080613fd961372a565b16613fec613fe65f611f3e565b9161054a565b03613f6d5790565b80915061401a61401461400f5f6140096136ce565b016119c5565b61054a565b9161054a565b10156140a4575b61404861404361403b60046140346136ce565b0193612ca0565b9283906136d9565b6119c5565b908161405c6140565f611f3e565b9161054a565b1461409357508061406b61372a565b1661407e6140785f611f3e565b9161054a565b1461409057636f96cda160e11b613856565b90565b614048915061404390915050614021565b636f96cda160e11b613856565b506140bb81614a52565b6140cc57636f96cda160e11b613856565b90565b6140d7614fc5565b5f1461411c57638b78c6d8199060601b60601c8082547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3801560ff1b1790555b565b638b78c6d8199060601b60601c908181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35561411a565b61415f6119aa565b506141725f61416c6136ce565b016119c5565b90565b61417f9051610353565b90565b9291909261418e6124e2565b93806141a261419c8561054a565b9161054a565b101561448d57806141c26141bc6141b761389c565b61054a565b9161054a565b1061447f575b6141d0614157565b926141d96138b2565b6141ec6141e65f1961054a565b9161054a565b14155f1461447957805b816142096142038361054a565b9161054a565b1015614471575b5061421a83612455565b908261422e6142288361054a565b9161054a565b1015614460575b816142486142425f611f3e565b9161054a565b03614255575b5050505050565b9091929395506142668184906119d2565b6142786142728461054a565b9161054a565b111561444d575b6142876119aa565b50604051916001810160051b830195866040526142a385612caf565b916142ac611827565b926142c26142bc60408301614175565b15610353565b614439575b505f959295506142d56119aa565b9360015b156143db575b5f966142e96138b2565b6142fc6142f65f1961054a565b9161054a565b0361436b575b61430b85614955565b60408101515f1461432b57505060015f945b0196896040529693966142d9565b8095919551614360575b5088851860601b1561434a575b60019061431d565b94600180910195808760051b8901529050614342565b90945051935f614335565b8461437e6143788d61054a565b9161054a565b146143b8575b8461439e6143986143936138b2565b61054a565b9161054a565b116143a9575b614302565b506143b35f611c55565b6143a4565b93506143d56143c56138b2565b6143cf6001610e5d565b906119e0565b93614384565b836143ee6143e88361054a565b9161054a565b14801561441a575b6144009015610353565b6142df575050955050925093505082525f8080808061424e565b506144008561443161442b8561054a565b9161054a565b1490506143f6565b6144469193505f01613519565b915f6142c7565b905061445a8183906119d2565b9061427f565b905061446b5f611f3e565b90614235565b90505f614210565b836141f6565b5061448861389c565b6141c8565b631960ccad60e11b613856565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f90565b6144c661449a565b90565b6144d2906123cf565b90565b6144dd611686565b506144e7306144c9565b6144ef6119aa565b503b6145036144fd5f611f3e565b9161054a565b1490565b61450f615022565b90565b60207f206973206e6f7420696e697469616c697a696e67000000000000000000000000917f455243373231415f5f496e697469616c697a61626c653a20636f6e74726163745f8201520152565b61456c6034604092610496565b61457581614512565b0190565b61458e9060208101905f81830391015261455f565b90565b1561459857565b6145a06102f4565b62461bcd60e51b8152806145b660048201614579565b0390fd5b906145de916145d96145d45f6145ce6144be565b016125cf565b614591565b6145e0565b565b906145ea916150d3565b565b906145f6916145ba565b565b614600614fc5565b5f1461465857638b78c6d81990815461464b5760601b60601c90811560ff1b821790555f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b565b630dc149f05f526004601cfd5b60601b60601c80638b78c6d819555f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3614649565b906146c0816146bb6146b460076146a56136ce565b016146ae614bde565b9061326e565b8590613284565b61203e565b6146c8614bde565b9190916147136147016146fb7f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3193612400565b93612400565b9361470a6102f4565b91829182610365565b0390a3565b614721906123b3565b90565b61472d90614718565b90565b614739906123cf565b90565b9050519061474982610312565b565b9060208282031261476457614761915f0161473c565b90565b6102fe565b60209181520190565b61479161479a60209361479f9361478881612efd565b93848093614769565b9586910161049f565b6104c2565b0190565b90926147d6906147cc6147e396946147c260808601975f87019061058e565b602085019061058e565b604083019061063c565b6060818403910152614772565b90565b63ffffffff1690565b6148036147fe614808926147e6565b612da8565b610306565b90565b9061481d614818836111e3565b610b34565b918252565b606090565b3d5f14614842576148373d61480b565b903d5f602084013e5b565b61484a614822565b90614840565b602091949361489a5f61487261486d614867611686565b99614724565b614730565b926148a563150b7a0291614884614bde565b969861488e6102f4565b998a9889978896612da8565b8652600486016147a3565b03925af180915f92614925575b50155f14614900575060016148c357565b6148cb614827565b6148d481612efd565b6148e66148e05f611f3e565b9161054a565b146148f357805190602001fd5b6368d2bf6b60e11b613856565b90915061492161491b61491663150b7a026147ef565b610306565b91610306565b1490565b61494791925060203d811161494e575b61493f8183610b0b565b81019061474b565b905f6148b2565b503d614935565b61497d61497861498292614967612c95565b5060046149726136ce565b016136d9565b6119c5565b615151565b90565b6149a56149aa91614994611686565b50600461499f6136ce565b016136d9565b6119c5565b6149bc6149b65f611f3e565b9161054a565b141590565b6149c96116ec565b506149dc5f6149d6613881565b016117fc565b90565b906149e86116ec565b50602060a0604051018060405203915f8352600a60018492945b0393818106603001855304928315614a1e576001600a91614a02565b809350602091039203918252565b614a34611686565b50614a4e614a486301ffc9a760e01b610306565b91610306565b1490565b614a5a611686565b50600160e01b81169060018060a01b03161190565b91614a79826123db565b9080614b27575b614afa575b614aa5835f614a9f6006614a976136ce565b018690611847565b01612a9e565b91614ae2614adc614ad67f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92595612400565b92612400565b9261182b565b92614aeb6102f4565b80614af58161044a565b0390a4565b614b15614b0f82614b09614bde565b9061329a565b15610353565b15614a85576367d9dca160e11b613856565b50614b30614bde565b614b42614b3c836103ba565b916103ba565b1415614a80565b919091638b78c6d8600c525f526020600c20918254908082179215614b9a575b5050809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3565b9080925016185f80614b69565b90565b614bd3614bd891614bb96119aa565b50614bc2611827565b506006614bcd6136ce565b01611847565b614ba7565b90815490565b614be6611827565b503390565b9190614bf5611686565b5060018060a01b03169060018060a01b031691821491141790565b90565b614c27614c22614c2c92614c10565b6107ac565b61054a565b90565b614c3960e8614c13565b90565b614c5b90614c55614c4f614c609461054a565b9161054a565b906121f4565b61054a565b90565b614c77614c72614c7c9261054a565b6107ac565b610cb5565b90565b614c93614c8e614c9892610cb5565b6107ac565b61054a565b90565b614cd791614cd291614cc9614cc4614ce596614cb56119aa565b50614cbe614c2f565b90614c3c565b614c63565b909190916151f2565b614c7f565b614cdf614c2f565b90613d21565b90565b614cf06119aa565b5060018060a01b0316904260a01b171790565b600190614d0e6119aa565b501460e11b90565b90565b614d2d614d28614d3292614d16565b6107ac565b61054a565b90565b614d3f6080614d19565b90565b90614d4c82613f43565b614d5d614d5882612397565b6123cf565b91614d6784614baa565b91909190614f72575b614f69575b50614dd4614da7614d976001614d92614d8c614d35565b91610e5d565b613d21565b614da16001610e5d565b906119d2565b614dce614dbf6005614db76136ce565b01869061240c565b91614dc9836119c5565b6119e0565b90612a60565b614e21614e0783614de361372a565b614deb613973565b17614e0086614df95f611c55565b8791614c9b565b1790614ce8565b614e1c6004614e146136ce565b0186906136d9565b612a60565b80614e2a613973565b16614e3d614e375f611f3e565b9161054a565b14614ec7575b5090614e4e5f611c55565b614e8a614e84614e7e7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95612400565b92612400565b9261182b565b92614e936102f4565b80614e9d8161044a565b0390a4614ec56001614ead6136ce565b01614ebf614eba826119c5565b61205e565b90612a60565b565b614edb83614ed56001610e5d565b906119e0565b614ef8614ef36004614eeb6136ce565b0183906136d9565b6119c5565b614f0a614f045f611f3e565b9161054a565b14614f16575b50614e43565b80614f3a614f34614f2f5f614f296136ce565b016119c5565b61054a565b9161054a565b03614f45575b614f10565b614f5d614f6292916004614f576136ce565b016136d9565b612a60565b5f80614f40565b5f90555f614d75565b614f8e614f888286614f82614bde565b91614beb565b15610353565b614f98575b614d70565b614fb3614fad85614fa7614bde565b9061329a565b15610353565b15614f9357632ce44b5f60e11b613856565b614fcd611686565b90565b5f90565b90565b90565b614fee614fe9614ff392614fd4565b612014565b614fd7565b90565b61501f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00614fda565b90565b61502a614fd0565b50615033614ff6565b90565b9061505a916150556150505f61504a6144be565b016125cf565b614591565b61505c565b565b9061507461508492600261506e6136ce565b016122ee565b600361507e6136ce565b016122ee565b61509e61508f61389c565b5f6150986136ce565b01612a60565b6150a66138b2565b6150bf6150b96150b461389c565b61054a565b9161054a565b106150c657565b63fed8210f60e01b613856565b906150dd91615036565b565b90565b6150f66150f16150fb926150df565b6107ac565b61054a565b90565b61510860a06150e2565b90565b61511f61511a6151249261054a565b6107ac565b610c8e565b90565b9061513190610c8e565b9052565b9061513f90610353565b9052565b9061514d90610cb5565b9052565b906151ec6151e36151de615163612c95565b9461518061517861517383612397565b6123cf565b5f88016134fd565b6151a661519d615198836151926150fe565b90614c3c565b61510b565b60208801615127565b6151d0816151b261372a565b166151c56151bf5f611f3e565b9161054a565b141560408801615135565b6151d8614c2f565b90614c3c565b614c63565b60608401615143565b565b5f90565b5050506151fd6151ee565b9056fea2646970667358221220e91166828004ad83951b79b774f13aaed3d1bb83c9d270db7be337ca368b39e064736f6c63430008180033
Deployed Bytecode
0x60806040526004361015610015575b3661168257005b61001f5f356102ee565b806301ffc9a7146102e957806304634d8d146102e457806306fdde03146102df578063081812fc146102da578063095ea7b3146102d557806318160ddd146102d0578063183a4f6e146102cb5780631c10893f146102c65780631cd64df4146102c157806323b872dd146102bc57806325692962146102b7578063282c51f3146102b25780632a55205a146102ad5780632de94807146102a857806340c10f19146102a357806342842e0e1461029e57806342966c68146102995780634a4ee7b114610294578063514e62fc1461028f57806354d1f13d1461028a57806355c7fe671461028557806355f804b3146102805780635bbb21771461027b5780636352211e1461027657806370a0823114610271578063715018a61461026c57806375b238fc146102675780638462151c146102625780638da5cb5b1461025d57806395d89b411461025857806399a2557a14610253578063a1dd6a2e1461024e578063a22cb46514610249578063ada7e28414610244578063b88d4fde1461023f578063c23dc68f1461023a578063c2ca0ac514610235578063c87b56dd14610230578063d53913931461022b578063d53ab50114610226578063dab56b0e14610221578063e985e9c51461021c578063f04e283e14610217578063f2fde38b146102125763fee81cf40361000e5761164d565b611624565b6115fb565b6115c5565b611565565b61152e565b61141c565b6113b0565b61137d565b611348565b6112be565b6111b0565b61115e565b6110fa565b61103e565b610fcf565b610f9a565b610f65565b610e91565b610e31565b610dfc565b610dc7565b610d91565b610c05565b610abf565b6109e3565b6109ad565b610983565b610950565b610926565b6108f2565b6108bd565b610868565b6107e3565b610780565b610756565b6106e6565b6106bc565b610693565b61065e565b610612565b6105b0565b610515565b61044f565b61037a565b60e01c90565b60405190565b5f80fd5b5f80fd5b5f80fd5b63ffffffff60e01b1690565b61031b81610306565b0361032257565b5f80fd5b9050359061033382610312565b565b9060208282031261034e5761034b915f01610326565b90565b6102fe565b151590565b61036190610353565b9052565b9190610378905f60208501940190610358565b565b346103aa576103a6610395610390366004610335565b61168a565b61039d6102f4565b91829182610365565b0390f35b6102fa565b60018060a01b031690565b6103c3906103af565b90565b6103cf816103ba565b036103d657565b5f80fd5b905035906103e7826103c6565b565b6bffffffffffffffffffffffff1690565b610403816103e9565b0361040a57565b5f80fd5b9050359061041b826103fa565b565b91906040838203126104455780610439610442925f86016103da565b9360200161040e565b90565b6102fe565b5f0190565b3461047e5761046861046236600461041d565b906116e0565b6104706102f4565b8061047a8161044a565b0390f35b6102fa565b5f91031261048d57565b6102fe565b5190565b60209181520190565b5f5b8381106104b1575050905f910152565b8060209183015181850152016104a1565b601f801991011690565b6104eb6104f46020936104f9936104e281610492565b93848093610496565b9586910161049f565b6104c2565b0190565b6105129160208201915f8184039101526104cc565b90565b3461054557610525366004610483565b610541610530611808565b6105386102f4565b918291826104fd565b0390f35b6102fa565b90565b6105568161054a565b0361055d57565b5f80fd5b9050359061056e8261054d565b565b9060208282031261058957610586915f01610561565b90565b6102fe565b610597906103ba565b9052565b91906105ae905f6020850194019061058e565b565b346105e0576105dc6105cb6105c6366004610570565b61188e565b6105d36102f4565b9182918261059b565b0390f35b6102fa565b919060408382031261060d578061060161060a925f86016103da565b93602001610561565b90565b6102fe565b6106266106203660046105e5565b9061199e565b61062e6102f4565b806106388161044a565b0390f35b6106459061054a565b9052565b919061065c905f6020850194019061063c565b565b3461068e5761066e366004610483565b61068a6106796119ee565b6106816102f4565b91829182610649565b0390f35b6102fa565b6106a66106a1366004610570565b611a7e565b6106ae6102f4565b806106b88161044a565b0390f35b6106d06106ca3660046105e5565b90611aaa565b6106d86102f4565b806106e28161044a565b0390f35b34610717576107136107026106fc3660046105e5565b90611ab6565b61070a6102f4565b91829182610365565b0390f35b6102fa565b90916060828403126107515761074e610737845f85016103da565b9361074581602086016103da565b93604001610561565b90565b6102fe565b61076a61076436600461071c565b91611b6a565b6107726102f4565b8061077c8161044a565b0390f35b61078b366004610483565b610793611b93565b61079b6102f4565b806107a58161044a565b0390f35b90565b90565b6107c36107be6107c8926107a9565b6107ac565b61054a565b90565b6107d560036107af565b90565b6107e06107cb565b90565b34610813576107f3366004610483565b61080f6107fe6107d8565b6108066102f4565b91829182610649565b0390f35b6102fa565b9190604083820312610840578061083461083d925f8601610561565b93602001610561565b90565b6102fe565b91602061086692949361085f60408201965f83019061058e565b019061063c565b565b3461089a5761088161087b366004610818565b90611cfc565b9061089661088d6102f4565b92839283610845565b0390f35b6102fa565b906020828203126108b8576108b5915f016103da565b90565b6102fe565b346108ed576108e96108d86108d336600461089f565b611dc9565b6108e06102f4565b91829182610649565b0390f35b6102fa565b346109215761090b6109053660046105e5565b90611e91565b6109136102f4565b8061091d8161044a565b0390f35b6102fa565b61093a61093436600461071c565b91611ecb565b6109426102f4565b8061094c8161044a565b0390f35b3461097e57610968610963366004610570565b611f07565b6109706102f4565b8061097a8161044a565b0390f35b6102fa565b6109976109913660046105e5565b90611f32565b61099f6102f4565b806109a98161044a565b0390f35b346109de576109da6109c96109c33660046105e5565b90611f5a565b6109d16102f4565b91829182610365565b0390f35b6102fa565b6109ee366004610483565b6109f6611f84565b6109fe6102f4565b80610a088161044a565b0390f35b5f80fd5b5f80fd5b5f80fd5b909182601f83011215610a525781359167ffffffffffffffff8311610a4d576020019260208302840111610a4857565b610a14565b610a10565b610a0c565b610a6081610353565b03610a6757565b5f80fd5b90503590610a7882610a57565b565b91604083830312610aba575f83013567ffffffffffffffff8111610ab557610aa783610ab2928601610a18565b939094602001610a6b565b90565b610302565b6102fe565b34610aee57610ad8610ad2366004610a7a565b916120ea565b610ae06102f4565b80610aea8161044a565b0390f35b6102fa565b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b90610b15906104c2565b810190811067ffffffffffffffff821117610b2f57604052565b610af7565b90610b47610b406102f4565b9283610b0b565b565b67ffffffffffffffff8111610b6757610b636020916104c2565b0190565b610af7565b90825f939282370152565b90929192610b8c610b8782610b49565b610b34565b93818552602085019082840111610ba857610ba692610b6c565b565b610af3565b9080601f83011215610bcb57816020610bc893359101610b77565b90565b610a0c565b90602082820312610c00575f82013567ffffffffffffffff8111610bfb57610bf89201610bad565b90565b610302565b6102fe565b34610c3357610c1d610c18366004610bd0565b61230f565b610c256102f4565b80610c2f8161044a565b0390f35b6102fa565b90602082820312610c69575f82013567ffffffffffffffff8111610c6457610c609201610a18565b9091565b610302565b6102fe565b5190565b60209181520190565b60200190565b610c8a906103ba565b9052565b67ffffffffffffffff1690565b610ca490610c8e565b9052565b610cb190610353565b9052565b62ffffff1690565b610cc690610cb5565b9052565b90606080610d1093610ce25f8201515f860190610c81565b610cf460208201516020860190610c9b565b610d0660408201516040860190610ca8565b0151910190610cbd565b565b90610d1f81608093610cca565b0190565b60200190565b90610d46610d40610d3984610c6e565b8093610c72565b92610c7b565b905f5b818110610d565750505090565b909192610d6f610d696001928651610d12565b94610d23565b9101919091610d49565b610d8e9160208201915f818403910152610d29565b90565b34610dc257610dbe610dad610da7366004610c38565b9061231f565b610db56102f4565b91829182610d79565b0390f35b6102fa565b34610df757610df3610de2610ddd366004610570565b6123db565b610dea6102f4565b9182918261059b565b0390f35b6102fa565b34610e2c57610e28610e17610e1236600461089f565b612455565b610e1f6102f4565b91829182610649565b0390f35b6102fa565b610e3c366004610483565b610e446124d8565b610e4c6102f4565b80610e568161044a565b0390f35b90565b610e71610e6c610e7692610e5a565b6107ac565b61054a565b90565b610e836001610e5d565b90565b610e8e610e79565b90565b34610ec157610ea1366004610483565b610ebd610eac610e86565b610eb46102f4565b91829182610649565b0390f35b6102fa565b5190565b60209181520190565b60200190565b610ee29061054a565b9052565b90610ef381602093610ed9565b0190565b60200190565b90610f1a610f14610f0d84610ec6565b8093610eca565b92610ed3565b905f5b818110610f2a5750505090565b909192610f43610f3d6001928651610ee6565b94610ef7565b9101919091610f1d565b610f629160208201915f818403910152610efd565b90565b34610f9557610f91610f80610f7b36600461089f565b6124e7565b610f886102f4565b91829182610f4d565b0390f35b6102fa565b34610fca57610faa366004610483565b610fc6610fb561256a565b610fbd6102f4565b9182918261059b565b0390f35b6102fa565b34610fff57610fdf366004610483565b610ffb610fea61257d565b610ff26102f4565b918291826104fd565b0390f35b6102fa565b90916060828403126110395761103661101f845f85016103da565b9361102d8160208601610561565b93604001610561565b90565b6102fe565b3461106f5761106b61105a611054366004611004565b9161259c565b6110626102f4565b91829182610f4d565b0390f35b6102fa565b919060a0838203126110f5575f83013567ffffffffffffffff81116110f0578161109f918501610bad565b92602081013567ffffffffffffffff81116110eb57826110c0918301610bad565b926110e86110d184604085016103da565b936110df8160608601610561565b936080016103da565b90565b610302565b610302565b6102fe565b3461112c5761111661110d366004611074565b93929092612af6565b61111e6102f4565b806111288161044a565b0390f35b6102fa565b9190604083820312611159578061114d611156925f86016103da565b93602001610a6b565b90565b6102fe565b3461118d57611177611171366004611131565b90612b93565b61117f6102f4565b806111898161044a565b0390f35b6102fa565b906020828203126111ab576111a8915f01610a6b565b90565b6102fe565b346111de576111c86111c3366004611192565b612bd0565b6111d06102f4565b806111da8161044a565b0390f35b6102fa565b67ffffffffffffffff8111611201576111fd6020916104c2565b0190565b610af7565b9092919261121b611216826111e3565b610b34565b938185526020850190828401116112375761123592610b6c565b565b610af3565b9080601f8301121561125a5781602061125793359101611206565b90565b610a0c565b906080828203126112b957611276815f84016103da565b9261128482602085016103da565b926112928360408301610561565b92606082013567ffffffffffffffff81116112b4576112b1920161123c565b90565b610302565b6102fe565b6112d56112cc36600461125f565b92919091612bdb565b6112dd6102f4565b806112e78161044a565b0390f35b90606080611331936113035f8201515f860190610c81565b61131560208201516020860190610c9b565b61132760408201516040860190610ca8565b0151910190610cbd565b565b9190611346905f608085019401906112eb565b565b346113785761137461136361135e366004610570565b612caf565b61136b6102f4565b91829182611333565b0390f35b6102fa565b346113ab57611395611390366004610570565b612dcd565b61139d6102f4565b806113a78161044a565b0390f35b6102fa565b346113e0576113dc6113cb6113c6366004610570565b612f54565b6113d36102f4565b918291826104fd565b0390f35b6102fa565b90565b6113fc6113f7611401926113e5565b6107ac565b61054a565b90565b61140e60026113e8565b90565b611419611404565b90565b3461144c5761142c366004610483565b611448611437611411565b61143f6102f4565b91829182610649565b0390f35b6102fa565b909182601f8301121561148b5781359167ffffffffffffffff831161148657602001926020830284011161148157565b610a14565b610a10565b610a0c565b909182601f830112156114ca5781359167ffffffffffffffff83116114c55760200192602083028401116114c057565b610a14565b610a10565b610a0c565b9091604082840312611529575f82013567ffffffffffffffff811161152457836114fa918401611451565b929093602082013567ffffffffffffffff811161151f5761151b9201611490565b9091565b610302565b610302565b6102fe565b346115605761154a6115413660046114cf565b929190916131e5565b6115526102f4565b8061155c8161044a565b0390f35b6102fa565b346115935761157d611578366004611192565b613263565b6115856102f4565b8061158f8161044a565b0390f35b6102fa565b91906040838203126115c057806115b46115bd925f86016103da565b936020016103da565b90565b6102fe565b346115f6576115f26115e16115db366004611598565b9061329a565b6115e96102f4565b91829182610365565b0390f35b6102fa565b61160e61160936600461089f565b613311565b6116166102f4565b806116208161044a565b0390f35b61163761163236600461089f565b613350565b61163f6102f4565b806116498161044a565b0390f35b3461167d5761167961166861166336600461089f565b61335b565b6116706102f4565b91829182610649565b0390f35b6102fa565b5f80fd5b5f90565b611692611686565b5061169c816133d4565b9081156116a8575b5090565b6116b29150613445565b5f6116a4565b906116d2916116cd6116c8610e79565b613485565b6116d4565b565b906116de916135d4565b565b906116ea916116b8565b565b606090565b634e487b7160e01b5f52602260045260245ffd5b9060016002830492168015611725575b602083101461172057565b6116f1565b91607f1691611715565b60209181520190565b5f5260205f2090565b905f929180549061175b61175483611705565b809461172f565b916001811690815f146117b25750600114611776575b505050565b6117839192939450611738565b915f925b81841061179a57505001905f8080611771565b60018160209295939554848601520191019290611787565b92949550505060ff19168252151560200201905f8080611771565b906117d791611741565b90565b906117fa6117f3926117ea6102f4565b938480926117cd565b0383610b0b565b565b611805906117da565b90565b6118106116ec565b50611824600261181e6136ce565b016117fc565b90565b5f90565b61183f61183a6118449261054a565b6107ac565b61054a565b90565b906118519061182b565b5f5260205260405f2090565b5f1c90565b60018060a01b031690565b61187961187e9161185d565b611862565b90565b61188b905461186d565b90565b611896611827565b506118a96118a38261373a565b15610353565b6118ce575f6118c56118cb9260066118bf6136ce565b01611847565b01611881565b90565b6333d1c03960e21b613856565b60ff1690565b6118ed6118f29161185d565b6118db565b90565b6118ff90546118e1565b90565b9061190c9061182b565b5f5260205260405f2090565b9080611922613881565b90611938611932600284016118f5565b15610353565b918215611974575b50506119515761194f91611992565b565b6119596102f4565b63ab064ad360e01b8152806119706004820161044a565b0390fd5b61198b92509060036119869201611902565b6118f5565b5f80611940565b9061199c9161388c565b565b906119a891611918565b565b5f90565b90565b6119bd6119c29161185d565b6119ae565b90565b6119cf90546119b1565b90565b906119dd910361054a565b90565b906119eb910161054a565b90565b6119f66119aa565b50611a36611a28611a0f5f611a096136ce565b016119c5565b611a226001611a1c6136ce565b016119c5565b906119d2565b611a3061389c565b906119d2565b90611a3f6138b2565b611a52611a4c5f1961054a565b9161054a565b03611a5a575b565b90611a7890611a726008611a6c6136ce565b016119c5565b906119e0565b90611a58565b611a8890336138c0565b565b90611a9c91611a976138cf565b611a9e565b565b90611aa8916138eb565b565b90611ab491611a8a565b565b611ad6611ace611adc92611ac8611686565b50611dc9565b83169261054a565b9161054a565b1490565b919081611aeb613881565b90611b01611afb600284016118f5565b15610353565b918215611b3d575b5050611b1a57611b1892611b5b565b565b611b226102f4565b63ab064ad360e01b815280611b396004820161044a565b0390fd5b611b549250906003611b4f9201611902565b6118f5565b5f80611b09565b91611b6892919091613983565b565b90611b759291611ae0565b565b611b8b611b86611b9092610c8e565b6107ac565b61054a565b90565b611bad42611ba7611ba2613c4a565b611b77565b906119e0565b63389a75e1600c52335f526020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2565b90611bef9061182b565b5f5260205260405f2090565b90565b60a01c90565b6bffffffffffffffffffffffff1690565b611c21611c2691611bfe565b611c04565b90565b611c339054611c15565b90565b90565b611c4d611c48611c5292611c36565b6107ac565b6103af565b90565b611c5e90611c39565b90565b611c75611c70611c7a926103e9565b6107ac565b61054a565b90565b634e487b7160e01b5f52601160045260245ffd5b611ca0611ca69193929361054a565b9261054a565b91611cb283820261054a565b928184041490151715611cc157565b611c7d565b634e487b7160e01b5f52601260045260245ffd5b611ce6611cec9161054a565b9161054a565b908115611cf7570490565b611cc6565b919091611d07611827565b50611d106119aa565b50611d2e611d29611d1f613c62565b9260018401611be5565b611bfb565b92611d455f611d3e818701611881565b9501611c29565b9184611d61611d5b611d565f611c55565b6103ba565b916103ba565b14611d98575b50611d9591611d79611d7f9291611c61565b90611c91565b611d8f611d8a613ca9565b611c61565b90611cda565b90565b9350611d959150611d7f90611d79611dc05f80611db881808b0101611881565b980101611c29565b93505090611d67565b611dd16119aa565b50638b78c6d8600c525f526020600c205490565b90611dff91611dfa611df5611404565b613cc0565b611e26565b565b611e10611e169193929361054a565b9261054a565b8201809211611e2157565b611c7d565b90611e2f613881565b611e5e611e58611e536001611e4c611e456119ee565b8790611e01565b94016119c5565b61054a565b9161054a565b11611e6e57611e6c91613d56565b565b611e766102f4565b63d05cb60960e01b815280611e8d6004820161044a565b0390fd5b90611e9b91611de5565b565b90611eaf611eaa83610b49565b610b34565b918252565b611ebd5f611e9d565b90565b611ec8611eb4565b90565b91611edf9291611ed9611ec0565b92612bdb565b565b611efa90611ef5611ef06107cb565b613cc0565b611efc565b565b611f0590613f36565b565b611f1090611ee1565b565b90611f2491611f1f6138cf565b611f26565b565b90611f30916138c0565b565b90611f3c91611f12565b565b611f52611f4d611f5792611c36565b6107ac565b61054a565b90565b611f6c90611f66611686565b50611dc9565b16611f7f611f795f611f3e565b9161054a565b141590565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b90611fd89291611fd3611fce610e79565b613485565b61206d565b565b5090565b634e487b7160e01b5f52603260045260245ffd5b9190811015612002576020020190565b611fde565b356120118161054d565b90565b5f1b90565b9061202560ff91612014565b9181191691161790565b61203890610353565b90565b90565b9061205361204e61205a9261202f565b61203b565b8254612019565b9055565b600161206a910161054a565b90565b90929192612079613881565b93612085838390611fda565b9361208f5f611f3e565b5b806120a361209d8861054a565b9161054a565b10156120e1576120dc906120d7846120d260038b016120cc6120c78b8b8891611ff2565b612007565b90611902565b61203e565b61205e565b612090565b50945050505050565b906120f59291611fbd565b565b6121109061210b612106610e79565b613485565b6122fa565b565b601f602091010490565b1b90565b9190600861213b9102916121355f198461211c565b9261211c565b9181191691161790565b90565b919061215e6121596121669361182b565b612145565b908354612120565b9055565b61217c916121766119aa565b91612148565b565b5b81811061218a575050565b806121975f60019361216a565b0161217f565b9190601f81116121ad575b505050565b6121b96121de93611738565b9060206121c584612112565b830193106121e6575b6121d790612112565b019061217e565b5f80806121a8565b91506121d7819290506121ce565b1c90565b90612208905f19906008026121f4565b191690565b81612217916121f8565b906002021790565b9061222981610492565b9067ffffffffffffffff82116122e95761224d826122478554611705565b8561219d565b602090601f831160011461228157918091612270935f92612275575b505061220d565b90555b565b90915001515f80612269565b601f1983169161229085611738565b925f5b8181106122d1575091600293918560019694106122b7575b50505002019055612273565b6122c7910151601f8416906121f8565b90555f80806122ab565b91936020600181928787015181550195019201612293565b610af7565b906122f89161221f565b565b61230d905f612307613881565b016122ee565b565b612318906120f7565b565b606090565b9061233c9061232c61231a565b5061233561231a565b5082611fda565b916040519280845260051b8060208501016040525b8061236461235e5f611f3e565b9161054a565b14612390576020906123746119aa565b50039061238382840135612caf565b8260208601015290612351565b5091905090565b6123ab6123a66123b09261054a565b6107ac565b6103af565b90565b6123c76123c26123cc926103af565b6107ac565b6103af565b90565b6123d8906123b3565b90565b6123f86123f36123fd926123ed611827565b50613f43565b612397565b6123cf565b90565b612409906123cf565b90565b9061241690612400565b5f5260205260405f2090565b90565b61243961243461243e92612422565b6107ac565b61054a565b90565b61245267ffffffffffffffff612425565b90565b61245d6119aa565b508061247961247361246e5f611c55565b6103ba565b916103ba565b146124a65761249561249a91600561248f6136ce565b0161240c565b6119c5565b6124a2612441565b1690565b6323d3ad8160e21b613856565b6124bb6138cf565b6124c36124c5565b565b6124d66124d15f611c55565b6140cf565b565b6124e06124b3565b565b606090565b6124ef6124e2565b506124f86138b2565b61250b6125055f1961054a565b9161054a565b0361255d5761251861389c565b612520614157565b6125286124e2565b928261253c6125368461054a565b9161054a565b03612548575b50505090565b6125559350919091614182565b5f8080612542565b63bdba09d760e01b613856565b612572611827565b50638b78c6d8195490565b6125856116ec565b5061259960036125936136ce565b016117fc565b90565b916125b2926125a96124e2565b50919091614182565b90565b60081c90565b6125c76125cc916125b5565b6118db565b90565b6125d990546125bb565b90565b60207f20697320616c726561647920696e697469616c697a6564000000000000000000917f455243373231415f5f496e697469616c697a61626c653a20636f6e74726163745f8201520152565b6126366037604092610496565b61263f816125dc565b0190565b6126589060208101905f818303910152612629565b90565b1561266257565b61266a6102f4565b62461bcd60e51b81528061268060048201612643565b0390fd5b60081b90565b9061269761ff0091612684565b9181191691161790565b906126b66126b16126bd9261202f565b61203b565b825461268a565b9055565b939161271893916126da5f6126d46144be565b016125cf565b5f14612764576126f16126eb6144d5565b5b61265b565b61270c6127065f6127006144be565b016125cf565b15610353565b9586612737575b6128e2565b61271f575b565b6127325f8061272c6144be565b016126a1565b61271d565b61274b60015f6127456144be565b016126a1565b61275f60015f6127596144be565b0161203e565b612713565b6126f161278261277c5f6127766144be565b016118f5565b15610353565b6126ec565b60401c90565b61279961279e91612787565b6118db565b90565b6127ab905461278d565b90565b67ffffffffffffffff1690565b6127c76127cc9161185d565b6127ae565b90565b6127d990546127bb565b90565b6127f06127eb6127f592611c36565b6107ac565b610c8e565b90565b61280c61280761281192610e5a565b6107ac565b610c8e565b90565b61281d906123cf565b90565b9061283367ffffffffffffffff91612014565b9181191691161790565b61285161284c61285692610c8e565b6107ac565b610c8e565b90565b90565b9061287161286c6128789261283d565b612859565b8254612820565b9055565b60401b90565b9061289668ff00000000000000009161287c565b9181191691161790565b906128b56128b06128bc9261202f565b61203b565b8254612882565b9055565b6128c9906127f8565b9052565b91906128e0905f602085019401906128c0565b565b919390926128ee614507565b946129036128fd5f88016127a1565b15610353565b9461290f5f88016127cf565b8061292261291c5f6127dc565b91610c8e565b1480612a43575b9061293d61293760016127f8565b91610c8e565b1480612a1b575b61294f909115610353565b9081612a0a575b506129e75761297f9461297461296c60016127f8565b5f8a0161285c565b866129d5575b612abe565b612987575b50565b612994905f8091016128a0565b60016129cc7fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2916129c36102f4565b918291826128cd565b0390a15f612984565b6129e260015f8a016128a0565b61297a565b6129ef6102f4565b63f92ee8a960e01b815280612a066004820161044a565b0390fd5b612a15915015610353565b5f612956565b5061294f612a2830612814565b3b612a3b612a355f611f3e565b9161054a565b149050612944565b5086612929565b90612a565f1991612014565b9181191691161790565b90612a75612a70612a7c9261182b565b612145565b8254612a4a565b9055565b90612a9160018060a01b0391612014565b9181191691161790565b90565b90612ab3612aae612aba92612400565b612a9b565b8254612a80565b9055565b92612aed90612ae4600494612adf612af49895612ad9613881565b986145ec565b6145f8565b60018501612a60565b9101612a9e565b565b90612b03949392916126c1565b565b90612b0f5f611f3e565b612b17613881565b90612b2d612b27600284016118f5565b15610353565b918215612b69575b5050612b4657612b4491612b87565b565b612b4e6102f4565b63ab064ad360e01b815280612b656004820161044a565b0390fd5b612b809250906003612b7b9201611902565b6118f5565b5f80612b35565b90612b9191614690565b565b90612b9d91612b05565b565b612bb890612bb3612bae610e79565b613485565b612bba565b565b612bce906002612bc8613881565b0161203e565b565b612bd990612b9f565b565b9192612be983838691611b6a565b813b612bfd612bf75f611f3e565b9161054a565b03612c09575b50505050565b612c2093612c1a9392909192614850565b15610353565b612c2d575f808080612c03565b6368d2bf6b60e11b613856565b612c446080610b34565b90565b5f90565b5f90565b5f90565b5f90565b612c5f612c3a565b90602080808085612c6e612c47565b815201612c79612c4b565b815201612c84612c4f565b815201612c8f612c53565b81525050565b612c9d612c57565b90565b6001612cac910361054a565b90565b90612cb8612c95565b9180612cd3612ccd612cc861389c565b61054a565b9161054a565b1015612cdd575b50565b80612cf7612cf1612cec6138b2565b61054a565b9161054a565b11612d515780612d16612d10612d0b614157565b61054a565b9161054a565b1015612cda579091505b612d32612d2c82614985565b15610353565b15612d4557612d4090612ca0565b612d20565b612d4e90614955565b90565b612d5c919250614955565b90565b612d6b612d7091611bfe565b6118db565b90565b612d7d9054612d5f565b90565b612d89906123b3565b90565b612d9590612d80565b90565b612da1906123cf565b90565b5f80fd5b60e01b90565b5f910312612db857565b6102fe565b612dc56102f4565b3d5f823e3d90fd5b612dd5613881565b612dea612de460048301612d73565b15610353565b612ed757612df7826123db565b612e09612e03336103ba565b916103ba565b03612eb457612e2e612e296004612e3393612e2386613f36565b01611881565b612d8c565b612d98565b9063e89fe31d90339092803b15612eaf57612e615f8094612e6c612e556102f4565b97889687958694612da8565b845260048401610845565b03925af18015612eaa57612e7e575b50565b612e9d905f3d8111612ea3575b612e958183610b0b565b810190612dae565b5f612e7b565b503d612e8b565b612dbd565b612da4565b612ebc6102f4565b6359dc379f60e01b815280612ed36004820161044a565b0390fd5b612edf6102f4565b633e2e78cb60e21b815280612ef66004820161044a565b0390fd5b90565b5190565b612f09611eb4565b90565b905090565b612f36612f2d92602092612f2481610492565b94858093612f0c565b9384910161049f565b0190565b612f4890612f4e9392612f11565b90612f11565b90565b90565b612f5c6116ec565b50612f6f612f698261373a565b15610353565b612ff657612f7b6149c1565b90612f8d612f8883612efa565b612efd565b612f9f612f995f611f3e565b9161054a565b14155f14612fe757612fde612fb7612fe393926149df565b91612fcf612fc36102f4565b93849260208401612f3a565b60208201810382520382610b0b565b612f51565b5b90565b5050612ff1612f01565b612fe4565b630a14c4b560e41b613856565b9061301f93929161301a613015610e79565b613cc0565b613081565b565b5090565b5090565b9190811015613039576020020190565b611fde565b61304781610c8e565b0361304e57565b5f80fd5b3561305c8161303e565b90565b919081101561306f576020020190565b611fde565b3561307e816103c6565b90565b9093929361308d613881565b91613099848790613021565b946130a5828490613025565b6130b76130b18861054a565b9161054a565b036131c2576130c55f611f3e565b5b806130d96130d38961054a565b9161054a565b10156131b8576130fb6130f66130f185878591613029565b613052565b611b77565b908161310f6131095f611f3e565b9161054a565b146131955761312661311f6119ee565b8390611e01565b61314361313d61313860018a016119c5565b61054a565b9161054a565b116131725761316861316d9261316361315e8a8d869161305f565b613074565b613d56565b61205e565b6130c6565b61317a6102f4565b63d05cb60960e01b8152806131916004820161044a565b0390fd5b61319d6102f4565b63524f409b60e01b8152806131b46004820161044a565b0390fd5b5095505050505050565b6131ca6102f4565b6317dbc4cb60e21b8152806131e16004820161044a565b0390fd5b906131f1939291613003565b565b61320c90613207613202610e79565b613485565b61324d565b565b60a01b90565b9061322360ff60a01b9161320e565b9181191691161790565b9061324261323d6132499261202f565b61203b565b8254613214565b9055565b61326190600461325b613881565b0161322d565b565b61326c906131f3565b565b9061327890612400565b5f5260205260405f2090565b9061328e90612400565b5f5260205260405f2090565b6132c8916132be6132c3926132ad611686565b5060076132b86136ce565b0161326e565b613284565b6118f5565b90565b6132dc906132d76138cf565b6132de565b565b63389a75e1600c52805f526020600c209081544211613304575f61330292556140cf565b565b636f5e88185f526004601cfd5b61331a906132cb565b565b61332d906133286138cf565b61332f565b565b8060601b1561334357613341906140cf565b565b637448fbae5f526004601cfd5b6133599061331c565b565b6133636119aa565b5063389a75e1600c525f526020600c205490565b90565b61338e61338961339392613377565b612da8565b610306565b90565b90565b6133ad6133a86133b292613396565b612da8565b610306565b90565b90565b6133cc6133c76133d1926133b5565b612da8565b610306565b90565b6133dc611686565b50806133f46133ee6301ffc9a761337a565b91610306565b148015613427575b908115613408575b5090565b905061342061341a635b5e139f6133b8565b91610306565b145f613404565b508061343f6134396380ac58cd613399565b91610306565b146133fc565b61344d611686565b508061346861346263152a902d60e11b610306565b91610306565b14908115613475575b5090565b61347f9150614a2c565b5f613471565b638b78c6d819543303613496575b50565b638b78c6d8600c52335f526020600c205416156134b3575f613493565b6382b429005f526004601cfd5b6134c990611c61565b9052565b9160206134ee9294936134e760408201965f8301906134c0565b019061063c565b565b6134fa6040610b34565b90565b90613507906103ba565b9052565b90613515906103e9565b9052565b61352390516103ba565b90565b61353090516103e9565b90565b9061354d6bffffffffffffffffffffffff60a01b9161320e565b9181191691161790565b61356b613566613570926103e9565b6107ac565b6103e9565b90565b90565b9061358b61358661359292613557565b613573565b8254613533565b9055565b906135c060205f6135c6946135b88282016135b2848801613519565b90612a9e565b019201613526565b90613576565b565b906135d291613596565b565b906135dd613c62565b916135ee6135e9613ca9565b611c61565b826136016135fb8361054a565b91611c61565b1161368457508061362261361c6136175f611c55565b6103ba565b916103ba565b14613656576136549261364e5f929361364561363c6134f0565b958587016134fd565b6020850161350b565b016135c8565b565b6136806136625f611c55565b61366a6102f4565b918291635b6cc80560e11b83526004830161059b565b0390fd5b826136a66136906102f4565b928392636f483d0960e01b8452600484016134cd565b0390fd5b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6136d66136aa565b90565b906136e39061182b565b5f5260205260405f2090565b6136f89061054a565b5f8114613706576001900390565b611c7d565b90565b61372261371d6137279261370b565b6107ac565b61054a565b90565b613737600160e01b61370e565b90565b90613743611686565b9161374c61389c565b61375e6137588361054a565b9161054a565b1115613768575b50565b8061378261377c6137776138b2565b61054a565b9161054a565b1161382c57806137ab6137a56137a05f61379a6136ce565b016119c5565b61054a565b9161054a565b106137b6575b613765565b9091506137c16119aa565b505b6137e06137db60046137d36136ce565b0183906136d9565b6119c5565b90816137f46137ee5f611f3e565b9161054a565b036138085761380391506136ef565b6137c3565b5061381161372a565b1661382461381e5f611f3e565b9161054a565b14905f6137b1565b61385391925061384961384e9160046138436136ce565b016136d9565b6119c5565b614a52565b90565b5f5260045ffd5b7f615c3d332aa4e80a8368065a0cc0cbdbccb062dccf55dbc7f3538f0989d714e290565b61388961385d565b90565b9061389a9190600191614a6f565b565b6138a46119aa565b506138af6001610e5d565b90565b6138ba6119aa565b505f1990565b906138cd91905f91614b49565b565b638b78c6d8195433036138de57565b6382b429005f526004601cfd5b906138f99190600191614b49565b565b613904906123b3565b90565b61391b613916613920926103af565b6107ac565b61054a565b90565b90565b61393a61393561393f92613923565b6107ac565b61054a565b90565b61395160018060a01b03613926565b90565b90565b61396b61396661397092613954565b6107ac565b61054a565b90565b613980600160e11b613957565b90565b9190916139b96139b46139a66139a161399b86613f43565b946138fb565b613907565b6139ae613942565b16612397565b6123cf565b926139cb6139c683612397565b6123cf565b6139dd6139d7866103ba565b916103ba565b03613c1b576139eb83614baa565b929092613a0a613a0482886139fe614bde565b91614beb565b15610353565b613be6575b90613ae693613ae19392613bdd575b50613a4e613a376005613a2f6136ce565b01889061240c565b613a48613a43826119c5565b612ca0565b90612a60565b613a7d613a666005613a5e6136ce565b01849061240c565b613a77613a72826119c5565b61205e565b90612a60565b613ab9613a9f83613a8c613973565b613a988a878791614c9b565b1790614ce8565b613ab46004613aac6136ce565b0188906136d9565b612a60565b80613ac2613973565b16613ad5613acf5f611f3e565b9161054a565b14613b3b575b506138fb565b613907565b613aee613942565b1680927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a4613b27613b215f611f3e565b9161054a565b14613b2e57565b633a954ecd60e21b613856565b613b4f85613b496001610e5d565b906119e0565b613b6c613b676004613b5f6136ce565b0183906136d9565b6119c5565b613b7e613b785f611f3e565b9161054a565b14613b8a575b50613adb565b80613bae613ba8613ba35f613b9d6136ce565b016119c5565b61054a565b9161054a565b03613bb9575b613b84565b613bd1613bd692916004613bcb6136ce565b016136d9565b612a60565b5f80613bb4565b5f90555f613a1e565b9190613c03613bfd87613bf7614bde565b9061329a565b15610353565b613c0e579091613a0f565b632ce44b5f60e11b613856565b62a1148160e81b613856565b5f90565b90565b613c42613c3d613c4792613c2b565b6107ac565b610c8e565b90565b613c52613c27565b50613c5f6202a300613c2e565b90565b7fdaedc9ab023613a7caf35e703657e986ccfad7e3eb0af93a2853f8d65dd86b0090565b5f90565b90565b613ca1613c9c613ca692613c8a565b6107ac565b6103e9565b90565b613cb1613c86565b50613cbd612710613c8d565b90565b638b78c6d8600c52335f526020600c20541615613cda575b565b638b78c6d81954330315613cd8576382b429005f526004601cfd5b90565b613d0c613d07613d1192613cf5565b6107ac565b61054a565b90565b613d1e6040613cf8565b90565b613d4090613d3a613d34613d459461054a565b9161054a565b9061211c565b61054a565b90565b90613d53910261054a565b90565b613d685f613d626136ce565b016119c5565b9082613d7c613d765f611f3e565b9161054a565b14613f2957613e3a81613dd5613dbb613e3f94613d9888614d03565b613db4613da45f611c55565b86613dae5f611f3e565b91614c9b565b1790614ce8565b613dd06004613dc86136ce565b0187906136d9565b612a60565b613e35613e0886613df76001613df2613dec613d14565b91610e5d565b613d21565b613e016001610e5d565b1790613d48565b613e2f613e206005613e186136ce565b01859061240c565b91613e2a836119c5565b6119e0565b90612a60565b6138fb565b613907565b613e47613942565b169182613e5c613e565f611f3e565b9161054a565b14613f1d57613e6b90826119e0565b9092613e8182613e7b6001610e5d565b906119d2565b613e9a613e94613e8f6138b2565b61054a565b9161054a565b11613f105760015b15613ed5575b5f84845f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4613ea2565b92613edf9061205e565b9283613ef3613eed8461054a565b9161054a565b03613ea8579250613f0e91505f613f086136ce565b01612a60565b565b6340b23f1d60e11b613856565b622e076360e81b613856565b63b562e8dd60e01b613856565b613f41905f90614d42565b565b613f4b6119aa565b50613f5461389c565b613f66613f608361054a565b9161054a565b1115613f7a575b636f96cda160e11b613856565b613f97613f926004613f8a6136ce565b0183906136d9565b6119c5565b9080613fb2613fac613fa76138b2565b61054a565b9161054a565b116140b15781613fca613fc45f611f3e565b9161054a565b14613ff4575080613fd961372a565b16613fec613fe65f611f3e565b9161054a565b03613f6d5790565b80915061401a61401461400f5f6140096136ce565b016119c5565b61054a565b9161054a565b10156140a4575b61404861404361403b60046140346136ce565b0193612ca0565b9283906136d9565b6119c5565b908161405c6140565f611f3e565b9161054a565b1461409357508061406b61372a565b1661407e6140785f611f3e565b9161054a565b1461409057636f96cda160e11b613856565b90565b614048915061404390915050614021565b636f96cda160e11b613856565b506140bb81614a52565b6140cc57636f96cda160e11b613856565b90565b6140d7614fc5565b5f1461411c57638b78c6d8199060601b60601c8082547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3801560ff1b1790555b565b638b78c6d8199060601b60601c908181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35561411a565b61415f6119aa565b506141725f61416c6136ce565b016119c5565b90565b61417f9051610353565b90565b9291909261418e6124e2565b93806141a261419c8561054a565b9161054a565b101561448d57806141c26141bc6141b761389c565b61054a565b9161054a565b1061447f575b6141d0614157565b926141d96138b2565b6141ec6141e65f1961054a565b9161054a565b14155f1461447957805b816142096142038361054a565b9161054a565b1015614471575b5061421a83612455565b908261422e6142288361054a565b9161054a565b1015614460575b816142486142425f611f3e565b9161054a565b03614255575b5050505050565b9091929395506142668184906119d2565b6142786142728461054a565b9161054a565b111561444d575b6142876119aa565b50604051916001810160051b830195866040526142a385612caf565b916142ac611827565b926142c26142bc60408301614175565b15610353565b614439575b505f959295506142d56119aa565b9360015b156143db575b5f966142e96138b2565b6142fc6142f65f1961054a565b9161054a565b0361436b575b61430b85614955565b60408101515f1461432b57505060015f945b0196896040529693966142d9565b8095919551614360575b5088851860601b1561434a575b60019061431d565b94600180910195808760051b8901529050614342565b90945051935f614335565b8461437e6143788d61054a565b9161054a565b146143b8575b8461439e6143986143936138b2565b61054a565b9161054a565b116143a9575b614302565b506143b35f611c55565b6143a4565b93506143d56143c56138b2565b6143cf6001610e5d565b906119e0565b93614384565b836143ee6143e88361054a565b9161054a565b14801561441a575b6144009015610353565b6142df575050955050925093505082525f8080808061424e565b506144008561443161442b8561054a565b9161054a565b1490506143f6565b6144469193505f01613519565b915f6142c7565b905061445a8183906119d2565b9061427f565b905061446b5f611f3e565b90614235565b90505f614210565b836141f6565b5061448861389c565b6141c8565b631960ccad60e11b613856565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f90565b6144c661449a565b90565b6144d2906123cf565b90565b6144dd611686565b506144e7306144c9565b6144ef6119aa565b503b6145036144fd5f611f3e565b9161054a565b1490565b61450f615022565b90565b60207f206973206e6f7420696e697469616c697a696e67000000000000000000000000917f455243373231415f5f496e697469616c697a61626c653a20636f6e74726163745f8201520152565b61456c6034604092610496565b61457581614512565b0190565b61458e9060208101905f81830391015261455f565b90565b1561459857565b6145a06102f4565b62461bcd60e51b8152806145b660048201614579565b0390fd5b906145de916145d96145d45f6145ce6144be565b016125cf565b614591565b6145e0565b565b906145ea916150d3565b565b906145f6916145ba565b565b614600614fc5565b5f1461465857638b78c6d81990815461464b5760601b60601c90811560ff1b821790555f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a35b565b630dc149f05f526004601cfd5b60601b60601c80638b78c6d819555f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a3614649565b906146c0816146bb6146b460076146a56136ce565b016146ae614bde565b9061326e565b8590613284565b61203e565b6146c8614bde565b9190916147136147016146fb7f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3193612400565b93612400565b9361470a6102f4565b91829182610365565b0390a3565b614721906123b3565b90565b61472d90614718565b90565b614739906123cf565b90565b9050519061474982610312565b565b9060208282031261476457614761915f0161473c565b90565b6102fe565b60209181520190565b61479161479a60209361479f9361478881612efd565b93848093614769565b9586910161049f565b6104c2565b0190565b90926147d6906147cc6147e396946147c260808601975f87019061058e565b602085019061058e565b604083019061063c565b6060818403910152614772565b90565b63ffffffff1690565b6148036147fe614808926147e6565b612da8565b610306565b90565b9061481d614818836111e3565b610b34565b918252565b606090565b3d5f14614842576148373d61480b565b903d5f602084013e5b565b61484a614822565b90614840565b602091949361489a5f61487261486d614867611686565b99614724565b614730565b926148a563150b7a0291614884614bde565b969861488e6102f4565b998a9889978896612da8565b8652600486016147a3565b03925af180915f92614925575b50155f14614900575060016148c357565b6148cb614827565b6148d481612efd565b6148e66148e05f611f3e565b9161054a565b146148f357805190602001fd5b6368d2bf6b60e11b613856565b90915061492161491b61491663150b7a026147ef565b610306565b91610306565b1490565b61494791925060203d811161494e575b61493f8183610b0b565b81019061474b565b905f6148b2565b503d614935565b61497d61497861498292614967612c95565b5060046149726136ce565b016136d9565b6119c5565b615151565b90565b6149a56149aa91614994611686565b50600461499f6136ce565b016136d9565b6119c5565b6149bc6149b65f611f3e565b9161054a565b141590565b6149c96116ec565b506149dc5f6149d6613881565b016117fc565b90565b906149e86116ec565b50602060a0604051018060405203915f8352600a60018492945b0393818106603001855304928315614a1e576001600a91614a02565b809350602091039203918252565b614a34611686565b50614a4e614a486301ffc9a760e01b610306565b91610306565b1490565b614a5a611686565b50600160e01b81169060018060a01b03161190565b91614a79826123db565b9080614b27575b614afa575b614aa5835f614a9f6006614a976136ce565b018690611847565b01612a9e565b91614ae2614adc614ad67f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92595612400565b92612400565b9261182b565b92614aeb6102f4565b80614af58161044a565b0390a4565b614b15614b0f82614b09614bde565b9061329a565b15610353565b15614a85576367d9dca160e11b613856565b50614b30614bde565b614b42614b3c836103ba565b916103ba565b1415614a80565b919091638b78c6d8600c525f526020600c20918254908082179215614b9a575b5050809155600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3565b9080925016185f80614b69565b90565b614bd3614bd891614bb96119aa565b50614bc2611827565b506006614bcd6136ce565b01611847565b614ba7565b90815490565b614be6611827565b503390565b9190614bf5611686565b5060018060a01b03169060018060a01b031691821491141790565b90565b614c27614c22614c2c92614c10565b6107ac565b61054a565b90565b614c3960e8614c13565b90565b614c5b90614c55614c4f614c609461054a565b9161054a565b906121f4565b61054a565b90565b614c77614c72614c7c9261054a565b6107ac565b610cb5565b90565b614c93614c8e614c9892610cb5565b6107ac565b61054a565b90565b614cd791614cd291614cc9614cc4614ce596614cb56119aa565b50614cbe614c2f565b90614c3c565b614c63565b909190916151f2565b614c7f565b614cdf614c2f565b90613d21565b90565b614cf06119aa565b5060018060a01b0316904260a01b171790565b600190614d0e6119aa565b501460e11b90565b90565b614d2d614d28614d3292614d16565b6107ac565b61054a565b90565b614d3f6080614d19565b90565b90614d4c82613f43565b614d5d614d5882612397565b6123cf565b91614d6784614baa565b91909190614f72575b614f69575b50614dd4614da7614d976001614d92614d8c614d35565b91610e5d565b613d21565b614da16001610e5d565b906119d2565b614dce614dbf6005614db76136ce565b01869061240c565b91614dc9836119c5565b6119e0565b90612a60565b614e21614e0783614de361372a565b614deb613973565b17614e0086614df95f611c55565b8791614c9b565b1790614ce8565b614e1c6004614e146136ce565b0186906136d9565b612a60565b80614e2a613973565b16614e3d614e375f611f3e565b9161054a565b14614ec7575b5090614e4e5f611c55565b614e8a614e84614e7e7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef95612400565b92612400565b9261182b565b92614e936102f4565b80614e9d8161044a565b0390a4614ec56001614ead6136ce565b01614ebf614eba826119c5565b61205e565b90612a60565b565b614edb83614ed56001610e5d565b906119e0565b614ef8614ef36004614eeb6136ce565b0183906136d9565b6119c5565b614f0a614f045f611f3e565b9161054a565b14614f16575b50614e43565b80614f3a614f34614f2f5f614f296136ce565b016119c5565b61054a565b9161054a565b03614f45575b614f10565b614f5d614f6292916004614f576136ce565b016136d9565b612a60565b5f80614f40565b5f90555f614d75565b614f8e614f888286614f82614bde565b91614beb565b15610353565b614f98575b614d70565b614fb3614fad85614fa7614bde565b9061329a565b15610353565b15614f9357632ce44b5f60e11b613856565b614fcd611686565b90565b5f90565b90565b90565b614fee614fe9614ff392614fd4565b612014565b614fd7565b90565b61501f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00614fda565b90565b61502a614fd0565b50615033614ff6565b90565b9061505a916150556150505f61504a6144be565b016125cf565b614591565b61505c565b565b9061507461508492600261506e6136ce565b016122ee565b600361507e6136ce565b016122ee565b61509e61508f61389c565b5f6150986136ce565b01612a60565b6150a66138b2565b6150bf6150b96150b461389c565b61054a565b9161054a565b106150c657565b63fed8210f60e01b613856565b906150dd91615036565b565b90565b6150f66150f16150fb926150df565b6107ac565b61054a565b90565b61510860a06150e2565b90565b61511f61511a6151249261054a565b6107ac565b610c8e565b90565b9061513190610c8e565b9052565b9061513f90610353565b9052565b9061514d90610cb5565b9052565b906151ec6151e36151de615163612c95565b9461518061517861517383612397565b6123cf565b5f88016134fd565b6151a661519d615198836151926150fe565b90614c3c565b61510b565b60208801615127565b6151d0816151b261372a565b166151c56151bf5f611f3e565b9161054a565b141560408801615135565b6151d8614c2f565b90614c3c565b614c63565b60608401615143565b565b5f90565b5050506151fd6151ee565b9056fea2646970667358221220e91166828004ad83951b79b774f13aaed3d1bb83c9d270db7be337ca368b39e064736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.