Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MOCAPFP
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // Compatible with OpenZeppelin Contracts ^0.8.20 pragma solidity ^0.8.22; import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import {ERC721BurnableUpgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {IERC4906} from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {TokenTraits} from "./lib/TokenTraits.sol"; import {IMOCAPFPDescriptor} from "./lib/IMOCAPFPDescriptor.sol"; /// @custom:security-contact [email protected] contract MOCAPFP is Initializable, ERC721Upgradeable, IMOCAPFPDescriptor, ERC721BurnableUpgradeable, OwnableUpgradeable, IERC4906 { uint256 private _nextTokenId; bool public isMintingEnabled; bool public treasuryMintExecuted; uint256 public PRICE; uint256 public constant MAX_SUPPLY = 10000; address public RECIPIENT; struct RevealTokenData { uint256 tokenId; TokenTraits traits; bytes32[] proof; } mapping(uint256 => TokenTraits) private _tokenTraits; mapping(address => bool) public _mintedFromWhitelist; bytes32 public traitValidationRoot; bytes32 public whitelistValidationRoot; string private contractURIHash; IMOCAPFPDescriptor public descriptor; bool public isDescriptorLocked; error ErrLocked(string message); error ErrNotFound(string message); event TraitValidationRootUpdated(bytes32 newRoot); event WhitelistValidationRootUpdated(bytes32 newRoot); event TokenMinted(uint256 tokenId, address owner); event SetTokenTraits(uint256 tokenId, TokenTraits traits); event MintingToggled(bool enabled); event PriceUpdated(uint256 newPrice); event RecipientUpdated(address newRecipient); event DescriptorUpdated(IMOCAPFPDescriptor descriptor); event DescriptorLocked(); /** * @notice Ensures the descriptor hasn't been permanently locked */ modifier whenDescriptorNotLocked() { if (isDescriptorLocked) revert ErrLocked("Descriptor is locked"); _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /** * @notice Initializes the contract with required parameters * @param initialOwner Address of the contract owner * @param _traitValidationRoot Merkle root for validating token traits * @param _contractURIHash IPFS hash for contract metadata * @param _descriptor Address of the descriptor contract for token metadata */ function initialize( address initialOwner, address _recipient, bytes32 _traitValidationRoot, bytes32 _whitelistValidationRoot, string memory _contractURIHash, IMOCAPFPDescriptor _descriptor ) initializer public { __ERC721_init("Art DeCC0s", "DECC0"); __ERC721Burnable_init(); __Ownable_init(initialOwner); traitValidationRoot = _traitValidationRoot; whitelistValidationRoot = _whitelistValidationRoot; contractURIHash = _contractURIHash; descriptor = _descriptor; RECIPIENT = _recipient; PRICE = 0.0242069 ether; isMintingEnabled = false; treasuryMintExecuted = false; emit PriceUpdated(PRICE); emit MintingToggled(isMintingEnabled); emit TraitValidationRootUpdated(_traitValidationRoot); emit WhitelistValidationRootUpdated(_whitelistValidationRoot); } /** * @notice Updates the recipient address for contract payments * @param _recipient New recipient address */ function updateRecipient(address _recipient) public onlyOwner { RECIPIENT = _recipient; emit RecipientUpdated(_recipient); } /** * @notice Updates the Merkle root used for trait validation * @param _traitValidationRoot New Merkle root value */ function updateTraitValidationRoot(bytes32 _traitValidationRoot) public onlyOwner { traitValidationRoot = _traitValidationRoot; emit TraitValidationRootUpdated(_traitValidationRoot); } /** * @notice Updates the Merkle root used for whitelist validation * @param _whitelistValidationRoot New Merkle root value */ function updateWhitelistValidationRoot(bytes32 _whitelistValidationRoot) public onlyOwner { whitelistValidationRoot = _whitelistValidationRoot; emit WhitelistValidationRootUpdated(_whitelistValidationRoot); } /** * @notice Toggles the minting state of the contract * @dev Can only be called by the contract owner */ function toggleMintingEnabled() public onlyOwner { isMintingEnabled = !isMintingEnabled; emit MintingToggled(isMintingEnabled); } /** * @notice Sets the price for minting tokens * @param _price New price in wei */ function setPrice(uint256 _price) public onlyOwner { PRICE = _price; emit PriceUpdated(_price); } /** * @notice Mints new tokens with specified IDs * @param _amount Number of tokens to mint * @dev Ensures token IDs are within the valid range, updates the highest token ID, and mints tokens to the sender */ function safeMint(uint256 _amount, bytes32[] memory _proof) public payable { require(isMintingEnabled, "Minting is disabled"); if (msg.value > 0) { require(msg.value >= PRICE * _amount, "Insufficient payment"); } else { require(_amount == 1, "Payment required"); require(_mintedFromWhitelist[_msgSender()] == false, "Already minted"); bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode( _msgSender() )))); require( MerkleProof.verify(_proof, whitelistValidationRoot, leaf), "Not whitelisted" ); _mintedFromWhitelist[_msgSender()] = true; } (bool success, ) = RECIPIENT.call{value: msg.value}(""); require(success, "Transfer failed"); for (uint i = 0; i < _amount; i++) { uint256 tokenId = _nextTokenId + 1; _nextTokenId = tokenId; require(tokenId <= MAX_SUPPLY, "Token exceeds maximum supply"); require(tokenId > 0, "Token must be greater than 0"); TokenTraits memory traits; traits.tokenId = tokenId; traits.imageURI = "QmTZkKv1f3kZL5BweAP8jipaQH9A15xoCm8iYT3P8wf3Lv"; traits.state = "Unrevealed"; _tokenTraits[tokenId] = traits; _safeMint(_msgSender(), tokenId); emit TokenMinted(tokenId, _msgSender()); } } /** * @notice Marks the treasury mint as executed * @dev Can only be called by the contract owner */ function executeTreasuryMint() public onlyOwner { treasuryMintExecuted = true; } /** * @notice Reveals token traits for specified tokens * @param _revealTokenData Array of RevealTokenData structs containing token ID, traits, and Merkle proof * @dev Validates token traits using Merkle proof before revealing and minting the token */ function revealToken(RevealTokenData[] memory _revealTokenData) public { for (uint i = 0; i < _revealTokenData.length; i++) { RevealTokenData memory data = _revealTokenData[i]; uint256 tokenId = data.tokenId; TokenTraits memory traits = data.traits; bytes32[] memory proof = data.proof; require(_ownerOf(tokenId) == _msgSender(), "Only owner can reveal"); bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode( tokenId, traits.background, traits.backgroundTexture, traits.character, traits.dnaLineage, traits.dnaMemetic, traits.dnaArtistSelfPortrait, traits.dnaMOCACollection, traits.characterCitation, traits.mood, traits.imageURI, "" )))); require( MerkleProof.verify(proof, traitValidationRoot, leaf), "Invalid traits" ); traits.state = "Revealed"; _tokenTraits[tokenId] = traits; emit SetTokenTraits(tokenId, traits); emit MetadataUpdate(tokenId); } } /** * @notice Updates the traits for a specific token * @param tokenId ID of the token * @param traits TokenTraits struct containing the token's traits * @dev Can only be called by the contract owner */ function updateTokenTraits(uint256 tokenId, TokenTraits memory traits) public onlyOwner { require(_ownerOf(tokenId) != address(0), "Token not exist"); _tokenTraits[tokenId] = traits; emit SetTokenTraits(tokenId, traits); emit MetadataUpdate(tokenId); } /** * @notice Retrieves traits for a specific token * @param tokenId ID of the token * @return TokenTraits struct containing the token's traits */ function tokenTraits(uint256 tokenId) public view returns (TokenTraits memory) { return _tokenTraits[tokenId]; } /** * @notice Returns the metadata URI for a specific token * @param tokenId ID of the token * @return URI string for the token metadata */ function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable, IMOCAPFPDescriptor) returns (string memory) { if (_ownerOf(tokenId) == address(0)) revert ErrNotFound("Token not exist"); return descriptor.tokenURI(tokenId); } /** * @notice Returns base64 encoded metadata directly * @param tokenId ID of the token * @return Encoded metadata string */ function dataURI(uint256 tokenId) public view override returns (string memory) { if (_ownerOf(tokenId) == address(0)) revert ErrNotFound("Token not exist"); return descriptor.dataURI(tokenId); } /** * @notice Returns the contract-level metadata URI * @return IPFS URI string for contract metadata */ function contractURI() public view returns (string memory) { return string(abi.encodePacked('ipfs://', contractURIHash)); } /** * @notice Updates the descriptor contract address * @param _descriptor New descriptor contract address * @dev Can only be called by owner when descriptor isn't locked */ function setDescriptor(IMOCAPFPDescriptor _descriptor) external onlyOwner whenDescriptorNotLocked { descriptor = _descriptor; emit DescriptorUpdated(_descriptor); emit BatchMetadataUpdate(0, _nextTokenId); } /** * @notice Permanently locks the descriptor from being changed * @dev Can only be called once by the owner */ function lockDescriptor() external onlyOwner whenDescriptorNotLocked { isDescriptorLocked = true; emit DescriptorLocked(); } /** * @notice Returns the total supply of tokens * @return Total number of tokens minted */ function totalSupply() public view returns (uint256) { return _nextTokenId; } // The following functions are overrides required by Solidity. function _update(address to, uint256 tokenId, address auth) internal override(ERC721Upgradeable) returns (address) { return super._update(to, tokenId, auth); } function _increaseBalance(address account, uint128 value) internal override(ERC721Upgradeable) { super._increaseBalance(account, value); } function supportsInterface(bytes4 interfaceId) public view override(ERC721Upgradeable, IERC165) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.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 reininitialization) 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 Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import {ERC721Utils} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Utils.sol"; import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol"; import {IERC721Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC-721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ abstract contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721, IERC721Metadata, IERC721Errors { using Strings for uint256; /// @custom:storage-location erc7201:openzeppelin.storage.ERC721 struct ERC721Storage { // Token name string _name; // Token symbol string _symbol; mapping(uint256 tokenId => address) _owners; mapping(address owner => uint256) _balances; mapping(uint256 tokenId => address) _tokenApprovals; mapping(address owner => mapping(address operator => bool)) _operatorApprovals; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300; function _getERC721Storage() private pure returns (ERC721Storage storage $) { assembly { $.slot := ERC721StorageLocation } } /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { ERC721Storage storage $ = _getERC721Storage(); $._name = name_; $._symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual returns (uint256) { ERC721Storage storage $ = _getERC721Storage(); if (owner == address(0)) { revert ERC721InvalidOwner(address(0)); } return $._balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return _requireOwned(tokenId); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual returns (string memory) { ERC721Storage storage $ = _getERC721Storage(); return $._name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual returns (string memory) { ERC721Storage storage $ = _getERC721Storage(); return $._symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { _requireOwned(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : ""; } /** * @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, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual { _approve(to, tokenId, _msgSender()); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual returns (address) { _requireOwned(tokenId); return _getApproved(tokenId); } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { ERC721Storage storage $ = _getERC721Storage(); return $._operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. address previousOwner = _update(to, tokenId, _msgSender()); if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { transferFrom(from, to, tokenId); ERC721Utils.checkOnERC721Received(_msgSender(), from, to, tokenId, data); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist * * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the * core ERC-721 logic MUST be matched with the use of {_increaseBalance} to keep balances * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`. */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { ERC721Storage storage $ = _getERC721Storage(); return $._owners[tokenId]; } /** * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted. */ function _getApproved(uint256 tokenId) internal view virtual returns (address) { ERC721Storage storage $ = _getERC721Storage(); return $._tokenApprovals[tokenId]; } /** * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in * particular (ignoring whether it is owned by `owner`). * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) { return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender); } /** * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner. * Reverts if: * - `spender` does not have approval from `owner` for `tokenId`. * - `spender` does not have approval to manage all of `owner`'s assets. * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual { if (!_isAuthorized(owner, spender, tokenId)) { if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } else { revert ERC721InsufficientApproval(spender, tokenId); } } } /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. * * WARNING: Increasing an account's balance using this function tends to be paired with an override of the * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership * remain consistent with one another. */ function _increaseBalance(address account, uint128 value) internal virtual { ERC721Storage storage $ = _getERC721Storage(); unchecked { $._balances[account] += value; } } /** * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. * * The `auth` argument is optional. If the value passed is non 0, then this function will check that * `auth` is either the owner of the token, or approved to operate on the token (by the owner). * * Emits a {Transfer} event. * * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. */ function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) { ERC721Storage storage $ = _getERC721Storage(); address from = _ownerOf(tokenId); // Perform (optional) operator check if (auth != address(0)) { _checkAuthorized(from, auth, tokenId); } // Execute the update if (from != address(0)) { // Clear approval. No need to re-authorize or emit the Approval event _approve(address(0), tokenId, address(0), false); unchecked { $._balances[from] -= 1; } } if (to != address(0)) { unchecked { $._balances[to] += 1; } } $._owners[tokenId] = to; emit Transfer(from, to, tokenId); return from; } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner != address(0)) { revert ERC721InvalidSender(address(0)); } } /** * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual { _mint(to, tokenId); ERC721Utils.checkOnERC721Received(_msgSender(), address(0), to, tokenId, data); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal { address previousOwner = _update(address(0), tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } else if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients * are aware of the ERC-721 standard to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is like {safeTransferFrom} in the sense that it invokes * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `tokenId` token must exist and be owned by `from`. * - `to` cannot be the zero address. * - `from` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId) internal { _safeTransfer(from, to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); ERC721Utils.checkOnERC721Received(_msgSender(), from, to, tokenId, data); } /** * @dev Approve `to` to operate on `tokenId` * * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is * either the owner of the token, or approved to operate on all tokens held by this owner. * * Emits an {Approval} event. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address to, uint256 tokenId, address auth) internal { _approve(to, tokenId, auth, true); } /** * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not * emitted in the context of transfers. */ function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual { ERC721Storage storage $ = _getERC721Storage(); // Avoid reading the owner unless necessary if (emitEvent || auth != address(0)) { address owner = _requireOwned(tokenId); // We do not use _isAuthorized because single-token approvals should not be able to call approve if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } if (emitEvent) { emit Approval(owner, to, tokenId); } } $._tokenApprovals[tokenId] = to; } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Requirements: * - operator can't be the address zero. * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { ERC721Storage storage $ = _getERC721Storage(); if (operator == address(0)) { revert ERC721InvalidOperator(operator); } $._operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned). * Returns the owner. * * Overrides to ownership logic should be done to {_ownerOf}. */ function _requireOwned(uint256 tokenId) internal view returns (address) { address owner = _ownerOf(tokenId); if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } return owner; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.20; import {ERC721Upgradeable} from "../ERC721Upgradeable.sol"; import {ContextUpgradeable} from "../../../utils/ContextUpgradeable.sol"; import {Initializable} from "../../../proxy/utils/Initializable.sol"; /** * @title ERC-721 Burnable Token * @dev ERC-721 Token that can be burned (destroyed). */ abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable { function __ERC721Burnable_init() internal onlyInitializing { } function __ERC721Burnable_init_unchained() internal onlyInitializing { } /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. _update(address(0), tokenId, _msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// 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.1.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC-20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC-721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC-1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC4906.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; import {IERC721} from "./IERC721.sol"; /// @title ERC-721 Metadata Update Extension interface IERC4906 is IERC165, IERC721 { /// @dev This event emits when the metadata of a token is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFT. event MetadataUpdate(uint256 _tokenId); /// @dev This event emits when the metadata of a range of tokens is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFTs. event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "../token/ERC721/IERC721.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC-721 compliant contract. */ interface IERC721 is IERC165 { /** * @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`. * * 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 calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC-721 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 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) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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; /** * @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; /** * @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 address zero. * * 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC-721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC-721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/utils/ERC721Utils.sol) pragma solidity ^0.8.20; import {IERC721Receiver} from "../IERC721Receiver.sol"; import {IERC721Errors} from "../../../interfaces/draft-IERC6093.sol"; /** * @dev Library that provide common ERC-721 utility functions. * * See https://eips.ethereum.org/EIPS/eip-721[ERC-721]. * * _Available since v5.1._ */ library ERC721Utils { /** * @dev Performs an acceptance check for the provided `operator` by calling {IERC721-onERC721Received} * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`). * * The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA). * Otherwise, the recipient must implement {IERC721Receiver-onERC721Received} and return the acceptance magic value to accept * the transfer. */ function checkOnERC721Received( address operator, address from, address to, uint256 tokenId, bytes memory data ) internal { if (to.code.length > 0) { try IERC721Receiver(to).onERC721Received(operator, from, tokenId, data) returns (bytes4 retval) { if (retval != IERC721Receiver.onERC721Received.selector) { // Token rejected revert IERC721Errors.ERC721InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-IERC721Receiver implementer revert IERC721Errors.ERC721InvalidReceiver(to); } else { assembly ("memory-safe") { revert(add(32, reason), mload(reason)) } } } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/Hashes.sol) pragma solidity ^0.8.20; /** * @dev Library of standard hash functions. * * _Available since v5.1._ */ library Hashes { /** * @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs. * * NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. */ function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) { return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly ("memory-safe") { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MerkleProof.sol) // This file was procedurally generated from scripts/generate/templates/MerkleProof.js. pragma solidity ^0.8.20; import {Hashes} from "./Hashes.sol"; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. * * IMPORTANT: Consider memory side-effects when using custom hashing functions * that access memory in an unsafe way. * * NOTE: This library supports proof verification for merkle trees built using * custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving * leaf inclusion in trees built using non-commutative hashing functions requires * additional logic that is not supported by this library. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in memory with the default hashing function. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in memory with the default hashing function. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in memory with a custom hashing function. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processProof(proof, leaf, hasher) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in memory with a custom hashing function. */ function processProof( bytes32[] memory proof, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = hasher(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in calldata with the default hashing function. */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in calldata with the default hashing function. */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. * * This version handles proofs in calldata with a custom hashing function. */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processProofCalldata(proof, leaf, hasher) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leaves & pre-images are assumed to be sorted. * * This version handles proofs in calldata with a custom hashing function. */ function processProofCalldata( bytes32[] calldata proof, bytes32 leaf, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = hasher(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in memory with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProof}. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in memory with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = Hashes.commutativeKeccak256(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in memory with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProof}. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processMultiProof(proof, proofFlags, leaves, hasher) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in memory with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = hasher(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in calldata with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProofCalldata}. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in calldata with the default hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = Hashes.commutativeKeccak256(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * This version handles multiproofs in calldata with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. * * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`. * The `leaves` must be validated independently. See {processMultiProofCalldata}. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * This version handles multiproofs in calldata with a custom hashing function. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op, * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not * validating the leaves elsewhere. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves, function(bytes32, bytes32) view returns (bytes32) hasher ) internal view returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofFlagsLen = proofFlags.length; // Check proof validity. if (leavesLen + proof.length != proofFlagsLen + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](proofFlagsLen); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < proofFlagsLen; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = hasher(a, b); } if (proofFlagsLen > 0) { if (proofPos != proof.length) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[proofFlagsLen - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } }
// 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/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 Returns the addition of two unsigned integers, with an success flag (no overflow). */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow). */ function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow). */ function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @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 { if (b == 0) return (false, 0); return (true, 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 { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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 { // 512-bit multiply [prod1 prod0] = 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 = prod1 * 2²⁵⁶ + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 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 prod0 / denominator; } // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0. if (denominator <= prod1) { Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW)); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, 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 { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, 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 prod1 into prod0. prod0 |= prod1 * 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 prod1 // is no longer required. result = prod0 * 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 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 value) internal pure returns (uint256) { uint256 result = 0; uint256 exp; unchecked { exp = 128 * SafeCast.toUint(value > (1 << 128) - 1); value >>= exp; result += exp; exp = 64 * SafeCast.toUint(value > (1 << 64) - 1); value >>= exp; result += exp; exp = 32 * SafeCast.toUint(value > (1 << 32) - 1); value >>= exp; result += exp; exp = 16 * SafeCast.toUint(value > (1 << 16) - 1); value >>= exp; result += exp; exp = 8 * SafeCast.toUint(value > (1 << 8) - 1); value >>= exp; result += exp; exp = 4 * SafeCast.toUint(value > (1 << 4) - 1); value >>= exp; result += exp; exp = 2 * SafeCast.toUint(value > (1 << 2) - 1); value >>= exp; result += exp; result += SafeCast.toUint(value > 1); } return result; } /** * @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 value) internal pure returns (uint256) { uint256 result = 0; uint256 isGt; unchecked { isGt = SafeCast.toUint(value > (1 << 128) - 1); value >>= isGt * 128; result += isGt * 16; isGt = SafeCast.toUint(value > (1 << 64) - 1); value >>= isGt * 64; result += isGt * 8; isGt = SafeCast.toUint(value > (1 << 32) - 1); value >>= isGt * 32; result += isGt * 4; isGt = SafeCast.toUint(value > (1 << 16) - 1); value >>= isGt * 16; result += isGt * 2; result += SafeCast.toUint(value > (1 << 8) - 1); } return result; } /** * @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/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)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; import {SafeCast} from "./SafeCast.sol"; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @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, int256 a, int256 b) internal pure returns (int256) { unchecked { // branchless ternary works because: // b ^ (a ^ b) == a // b ^ 0 == b return b ^ ((a ^ b) * int256(SafeCast.toUint(condition))); } } /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return ternary(a > b, a, b); } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return ternary(a < b, a, b); } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // Formula from the "Bit Twiddling Hacks" by Sean Eron Anderson. // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift, // taking advantage of the most significant (or "sign" bit) in two's complement representation. // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result, // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative). int256 mask = n >> 255; // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it. return uint256((n + mask) ^ mask); } } }
// 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/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; assembly ("memory-safe") { ptr := add(buffer, add(32, length)) } while (true) { ptr--; assembly ("memory-safe") { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal * representation, according to EIP-55. */ function toChecksumHexString(address addr) internal pure returns (string memory) { bytes memory buffer = bytes(toHexString(addr)); // hash the hex part of buffer (skip length + 2 bytes, length 40) uint256 hashValue; assembly ("memory-safe") { hashValue := shr(96, keccak256(add(buffer, 0x22), 40)) } for (uint256 i = 41; i > 1; --i) { // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f) if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) { // case shift by xoring with 0x20 buffer[i] ^= 0x20; } hashValue >>= 4; } return string(buffer); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: GPL-3.0 /// @title Interface for FloorDescriptor pragma solidity ^0.8.6; interface IMOCAPFPDescriptor { function tokenURI(uint256 tokenId) external view returns (string memory); function dataURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; struct TokenTraits { uint256 tokenId; string background; string backgroundTexture; string character; string dnaLineage; string dnaMemetic; string dnaArtistSelfPortrait; string dnaMOCACollection; string characterCitation; string mood; string imageURI; string state; }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"ErrLocked","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"ErrNotFound","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[],"name":"DescriptorLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IMOCAPFPDescriptor","name":"descriptor","type":"address"}],"name":"DescriptorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"MintingToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newRecipient","type":"address"}],"name":"RecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"background","type":"string"},{"internalType":"string","name":"backgroundTexture","type":"string"},{"internalType":"string","name":"character","type":"string"},{"internalType":"string","name":"dnaLineage","type":"string"},{"internalType":"string","name":"dnaMemetic","type":"string"},{"internalType":"string","name":"dnaArtistSelfPortrait","type":"string"},{"internalType":"string","name":"dnaMOCACollection","type":"string"},{"internalType":"string","name":"characterCitation","type":"string"},{"internalType":"string","name":"mood","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"state","type":"string"}],"indexed":false,"internalType":"struct TokenTraits","name":"traits","type":"tuple"}],"name":"SetTokenTraits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"TokenMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"TraitValidationRootUpdated","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"WhitelistValidationRootUpdated","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECIPIENT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_mintedFromWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"dataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"descriptor","outputs":[{"internalType":"contract IMOCAPFPDescriptor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"executeTreasuryMint","outputs":[],"stateMutability":"nonpayable","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":"initialOwner","type":"address"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"bytes32","name":"_traitValidationRoot","type":"bytes32"},{"internalType":"bytes32","name":"_whitelistValidationRoot","type":"bytes32"},{"internalType":"string","name":"_contractURIHash","type":"string"},{"internalType":"contract IMOCAPFPDescriptor","name":"_descriptor","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":[],"name":"isDescriptorLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMintingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockDescriptor","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":"","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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"background","type":"string"},{"internalType":"string","name":"backgroundTexture","type":"string"},{"internalType":"string","name":"character","type":"string"},{"internalType":"string","name":"dnaLineage","type":"string"},{"internalType":"string","name":"dnaMemetic","type":"string"},{"internalType":"string","name":"dnaArtistSelfPortrait","type":"string"},{"internalType":"string","name":"dnaMOCACollection","type":"string"},{"internalType":"string","name":"characterCitation","type":"string"},{"internalType":"string","name":"mood","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"state","type":"string"}],"internalType":"struct TokenTraits","name":"traits","type":"tuple"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"internalType":"struct MOCAPFP.RevealTokenData[]","name":"_revealTokenData","type":"tuple[]"}],"name":"revealToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"safeMint","outputs":[],"stateMutability":"payable","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":"nonpayable","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMOCAPFPDescriptor","name":"_descriptor","type":"address"}],"name":"setDescriptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","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":[],"name":"toggleMintingEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenTraits","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"background","type":"string"},{"internalType":"string","name":"backgroundTexture","type":"string"},{"internalType":"string","name":"character","type":"string"},{"internalType":"string","name":"dnaLineage","type":"string"},{"internalType":"string","name":"dnaMemetic","type":"string"},{"internalType":"string","name":"dnaArtistSelfPortrait","type":"string"},{"internalType":"string","name":"dnaMOCACollection","type":"string"},{"internalType":"string","name":"characterCitation","type":"string"},{"internalType":"string","name":"mood","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"state","type":"string"}],"internalType":"struct TokenTraits","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traitValidationRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryMintExecuted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"updateRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"background","type":"string"},{"internalType":"string","name":"backgroundTexture","type":"string"},{"internalType":"string","name":"character","type":"string"},{"internalType":"string","name":"dnaLineage","type":"string"},{"internalType":"string","name":"dnaMemetic","type":"string"},{"internalType":"string","name":"dnaArtistSelfPortrait","type":"string"},{"internalType":"string","name":"dnaMOCACollection","type":"string"},{"internalType":"string","name":"characterCitation","type":"string"},{"internalType":"string","name":"mood","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"state","type":"string"}],"internalType":"struct TokenTraits","name":"traits","type":"tuple"}],"name":"updateTokenTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_traitValidationRoot","type":"bytes32"}],"name":"updateTraitValidationRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_whitelistValidationRoot","type":"bytes32"}],"name":"updateWhitelistValidationRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelistValidationRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60808060405234620000bd577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009081549060ff8260401c16620000ae57506001600160401b036002600160401b03198282160162000068575b60405161567d9081620000c38239f35b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a138808062000058565b63f92ee8a960e01b8152600490fd5b600080fdfe6080604052600436101561001257600080fd5b60003560e01c806301b9a3971461493557806301ffc9a7146148c757806306fdde031461481d578063081812fc146147d2578063095ea7b3146146eb5780630d9019e1146146c25780630e568561146135c15780631071d9be146135a357806318160ddd146135855780631d89c0df1461354657806323b872dd1461352f57806325d6268b14613509578063303e74df146134e057806332cb6b0c146134c357806335bc49a31461221e57806341b5d0de1461218357806342842e0e1461215557806342966c6814611ff65780635196e06014611f9b57806355c7ba1414611f785780635ac1e3bb14611ef05780636352211e14611ec057806370a0823114611e6b578063715018a614611e0157806383f87b4c146110c057806388a99c57146110745780638d859f3e146110565780638da5cb5b1461102057806391b7f5ed14610fd457806395d89b4114610ef3578063997d5b1514610ec9578063a22cb46514610e29578063a735c1d214610ddd578063b73564cc14610dbf578063b88d4fde14610d54578063c1b8e4e114610d2e578063c87b56dd14610c3e578063dc1e4c74146104e8578063e05c57bf146103d8578063e8a3d485146102df578063e985e9c514610291578063f2fde38b146102665763feec756c146101f557600080fd5b34610261576020366003190112610261577f566f16f5ede69bb6f837d5da3a6cf41c863ba95621d677ff3c931aa687da646660206102316149e1565b6102396152b0565b600380546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b600080fd5b346102615760203660031901126102615761028f6102826149e1565b61028a6152b0565b61523c565b005b34610261576040366003190112610261576102aa6149e1565b6102bb6102b5614a3f565b91614d55565b9060018060a01b0316600052602052602060ff604060002054166040519015158152f35b346102615760003660031901126102615760405160209066697066733a2f2f60c81b602082015260276000926008549161031883614ebf565b926001908181169081156103ae575060011461035e575b61035a85610346818903601f198101835282614aa7565b604051918291602083526020830190614a1a565b0390f35b909192945060086000526000805160206155688339815191526000905b86821061039b57505050505061034681602761035a94820101938561032f565b805486830185015290840190820161037b565b905061035a96508593506027925061034694915060ff19168284015280151502820101938561032f565b34610261576020366003190112610261576103f1615184565b50600435600052600460205261035a60406000206104ce600b6040519261041784614a55565b8054845261042760018201614ef9565b602085015261043860028201614ef9565b604085015261044960038201614ef9565b606085015261045a60048201614ef9565b608085015261046b60058201614ef9565b60a085015261047c60068201614ef9565b60c085015261048d60078201614ef9565b60e085015261049e60088201614ef9565b6101008501526104b060098201614ef9565b6101208501526104c2600a8201614ef9565b61014085015201614ef9565b610160820152604051918291602083526020830190614dc3565b346102615760c0366003190112610261576105016149e1565b610509614a3f565b906084356001600160401b03811161026157610529903690600401614b31565b9160a435906001600160a01b0382168203610261576000805160206155c883398151915254926001600160401b03841680159081610c2e575b6001149081610c24575b159081610c1b575b50610c095760016001600160401b03198516176000805160206155c88339815191525560ff8460401c1615610bdc575b6040516105b081614a71565b600a8152694172742044654343307360b01b6020820152604051906105d482614a71565b6005825264044454343360dc1b60208301526105ee6154d8565b6105f66154d8565b8051906001600160401b03821161099357819061062160008051602061550883398151915254614ebf565b601f8111610b5b575b50602090601f8311600114610ac957600092610abe575b50508160011b916000199060031b1c191617600080516020615508833981519152555b8051906001600160401b0382116109935761068d60008051602061560883398151915254614ebf565b601f8111610a48575b50602090601f83116001146109b4576106ef939291600091836109a9575b50508160011b916000199060031b1c191617600080516020615608833981519152555b6106df6154d8565b6106e76154d8565b61028a6154d8565b60443560065560643560075583516001600160401b03811161099357610716600854614ebf565b601f8111610926575b506020601f82116001146108b157819060ff966000926108a6575b50508160011b916000199060031b1c1916176008555b6001600160601b0360a01b9160018060a01b031682600954161760095560018060a01b03169060035416176003557f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe060206656000c1b9d08008060025561ffff1960015416600155604051908152a17f6bdfe227d5db299c59aa56d5f846f40dbd73b271aaa78e18ed74fc3e00b8aa6b602060405160008152a17fe4234e67ea66db8774c20ef346e2ea56f28de6ec69c496f0905029e9e88563ca60206040516044358152a17f03acff7b614471676dd2e5022a4801eea2387114c7f8df34ce83cc377543a28360206040516064358152a160401c161561084d57005b68ff0000000000000000196000805160206155c883398151915254166000805160206155c8833981519152557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b01519050868061073a565b601f1982169560086000526000805160206155688339815191529660005b81811061090e57509160ff97918460019594106108f5575b505050811b01600855610750565b015160001960f88460031b161c191690558680806108e7565b838301518955600190980197602093840193016108cf565b6008600052601f820160051c60008051602061556883398151915201906020831061097d575b601f0160051c60008051602061556883398151915201905b818110610971575061071f565b60008155600101610964565b600080516020615568833981519152915061094c565b634e487b7160e01b600052604160045260246000fd5b0151905088806106b4565b906000805160206156088339815191526000526000805160206155288339815191529160005b601f1985168110610a3057509183916001936106ef9695601f19811610610a17575b505050811b01600080516020615608833981519152556106d7565b015160001960f88460031b161c191690558880806109fc565b919260206001819286850151815501940192016109da565b600080516020615608833981519152600052601f830160051c6000805160206155288339815191520160208410610aa9575b601f820160051c600080516020615528833981519152018110610a9d5750610696565b60008155600101610a7a565b50600080516020615528833981519152610a7a565b015190508880610641565b9250600080516020615508833981519152600052600080516020615628833981519152906000935b601f1984168510610b40576001945083601f19811610610b27575b505050811b0160008051602061550883398151915255610664565b015160001960f88460031b161c19169055888080610b0c565b81810151835560209485019460019093019290910190610af1565b909150600080516020615508833981519152600052601f830160051c6000805160206156288339815191520160208410610bc7575b908392915b601f820160051c600080516020615628833981519152018110610bb8575061062a565b60008155849350600101610b95565b50600080516020615628833981519152610b90565b68ffffffffffffffffff19841668010000000000000001176000805160206155c8833981519152556105a4565b60405163f92ee8a960e01b8152600490fd5b90501586610574565b303b15915061056c565b604086901c60ff16159150610562565b3461026157602036600319011261026157600435600081815260008051602061558883398151915260205260409020546001600160a01b0390811615610cf657600090600954169160246040518094819363c87b56dd60e01b835260048301525afa8015610cea5761035a91600091610cc7575b50604051918291602083526020830190614a1a565b610ce491503d806000833e610cdc8183614aa7565b8101906151de565b82610cb2565b6040513d6000823e3d90fd5b604051639f7f050d60e01b815260206004820152600f60248201526e151bdad95b881b9bdd08195e1a5cdd608a1b6044820152606490fd5b3461026157600036600319011261026157602060ff60095460a01c166040519015158152f35b3461026157608036600319011261026157610d6d6149e1565b610d75614a3f565b90604435606435926001600160401b038411610261573660238501121561026157610dad61028f943690602481600401359101614afa565b92610db9838383614fc8565b33615388565b34610261576000366003190112610261576020600754604051908152f35b34610261576020366003190112610261577f03acff7b614471676dd2e5022a4801eea2387114c7f8df34ce83cc377543a2836020600435610e1c6152b0565b80600755604051908152a1005b3461026157604036600319011261026157610e426149e1565b60243590811515809203610261576001600160a01b0316908115610eb057610e6933614d55565b82600052602052604060002060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b604051630b61174360e31b815260048101839052602490fd5b3461026157600036600319011261026157610ee26152b0565b6001805461ff001916610100179055005b34610261576000366003190112610261576040516000805160206156088339815191528054826000610f2483614ebf565b9283835260209460019186600182169182600014610fb2575050600114610f68575b5050610f5492500383614aa7565b61035a604051928284938452830190614a1a565b859250600052600080516020615528833981519152906000915b858310610f9a575050610f5493508201018580610f46565b80548389018501528794508693909201918101610f82565b9250935050610f5494915060ff191682840152151560051b8201018580610f46565b34610261576020366003190112610261577f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe060206004356110136152b0565b80600255604051908152a1005b3461026157600036600319011261026157600080516020615548833981519152546040516001600160a01b039091168152602090f35b34610261576000366003190112610261576020600254604051908152f35b34610261576020366003190112610261577fe4234e67ea66db8774c20ef346e2ea56f28de6ec69c496f0905029e9e88563ca60206004356110b36152b0565b80600655604051908152a1005b34610261576040366003190112610261576001600160401b03602435818111610261576110f1903690600401614b4f565b6110f96152b0565b600435600090815260008051602061558883398151915260205260409020546001600160a01b031615611dca576004356000526004602052604060002091815183556020820151928351828111610993576111576001830154614ebf565b601f8111611d7f575b506020601f8211600114611d10578192939495600092611d05575b50508160011b916000199060031b1c19161760018201555b6040830151928351838111610993576111af6002840154614ebf565b601f8111611cba575b506020601f8211600114611c4b578192939495600092611c40575b50508160011b916000199060031b1c19161760028301555b6060810151928351818111610993576112076003850154614ebf565b601f8111611bf9575b506020601f8211600114611b8a578192939495600092611b7f575b50508160011b916000199060031b1c19161760038401555b60808201519283518281116109935761125f6004830154614ebf565b601f8111611b38575b506020601f8211600114611ac9578192939495600092611abe575b50508160011b916000199060031b1c19161760048201555b60a0830151928351838111610993576112b76005840154614ebf565b601f8111611a77575b506020601f8211600114611a085781929394956000926119fd575b50508160011b916000199060031b1c19161760058301555b60c08101519283518181116109935761130f6006850154614ebf565b601f81116119b6575b506020601f821160011461194757819293949560009261193c575b50508160011b916000199060031b1c19161760068401555b60e0820151928351828111610993576113676007830154614ebf565b601f81116118f5575b506020601f821160011461188657819293949560009261187b575b50508160011b916000199060031b1c19161760078201555b610100830151928351838111610993576113c06008840154614ebf565b601f8111611834575b506020601f82116001146117c55781929394956000926117ba575b50508160011b916000199060031b1c19161760088301555b610120810151928351818111610993576114196009850154614ebf565b601f8111611773575b506020601f82116001146117045781929394956000926116f9575b50508160011b916000199060031b1c19161760098401555b61014082015192835182811161099357611472600a830154614ebf565b601f81116116b2575b506020601f821160011461163f578190600b949596600092611634575b50508160011b916000199060031b1c191617600a8201555b01906101608301518051918211610993576114cb8354614ebf565b601f81116115ec575b50602090601f831160011461157057918061153494926000805160206155e88339815191529694600092611565575b50508160011b916000199060031b1c19161790555b6040519182916004358352604060208401526040830190614dc3565b0390a17ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce760206040516004358152a1005b015190508680611503565b90601f198316918460005260206000209260005b8181106115d457509260019285926000805160206155e883398151915298966115349896106115bb575b505050811b019055611518565b015160001960f88460031b161c191690558680806115ae565b92936020600181928786015181550195019301611584565b836000526020600020601f840160051c8101916020851061162a575b601f0160051c01905b81811061161e57506114d4565b60008155600101611611565b9091508190611608565b015190508680611498565b600a830160005260206000209560005b601f198416811061169a5750958291600b959697600194601f19811610611681575b505050811b01600a8201556114b0565b015160001960f88460031b161c19169055868080611671565b8282015188556001909701966020928301920161164f565b600a83016000526020600020601f830160051c8101602084106116f2575b601f830160051c820181106116e657505061147b565b600081556001016116d0565b50806116d0565b01519050858061143d565b6009850160005260206000209060005b601f198416811061175b575060019394959683601f19811610611742575b505050811b016009840155611455565b015160001960f88460031b161c19169055858080611732565b9091602060018192858b015181550193019101611714565b600985016000526020600020601f830160051c8101602084106117b3575b601f830160051c820181106117a7575050611422565b60008155600101611791565b5080611791565b0151905085806113e4565b6008840160005260206000209060005b601f198416811061181c575060019394959683601f19811610611803575b505050811b0160088301556113fc565b015160001960f88460031b161c191690558580806117f3565b9091602060018192858b0151815501930191016117d5565b600884016000526020600020601f830160051c810160208410611874575b601f830160051c820181106118685750506113c9565b60008155600101611852565b5080611852565b01519050858061138b565b6007830160005260206000209060005b601f19841681106118dd575060019394959683601f198116106118c4575b505050811b0160078201556113a3565b015160001960f88460031b161c191690558580806118b4565b9091602060018192858b015181550193019101611896565b600783016000526020600020601f830160051c810160208410611935575b601f830160051c82018110611929575050611370565b60008155600101611913565b5080611913565b015190508580611333565b6006850160005260206000209060005b601f198416811061199e575060019394959683601f19811610611985575b505050811b01600684015561134b565b015160001960f88460031b161c19169055858080611975565b9091602060018192858b015181550193019101611957565b600685016000526020600020601f830160051c8101602084106119f6575b601f830160051c820181106119ea575050611318565b600081556001016119d4565b50806119d4565b0151905085806112db565b6005840160005260206000209060005b601f1984168110611a5f575060019394959683601f19811610611a46575b505050811b0160058301556112f3565b015160001960f88460031b161c19169055858080611a36565b9091602060018192858b015181550193019101611a18565b600584016000526020600020601f830160051c810160208410611ab7575b601f830160051c82018110611aab5750506112c0565b60008155600101611a95565b5080611a95565b015190508580611283565b6004830160005260206000209060005b601f1984168110611b20575060019394959683601f19811610611b07575b505050811b01600482015561129b565b015160001960f88460031b161c19169055858080611af7565b9091602060018192858b015181550193019101611ad9565b600483016000526020600020601f830160051c810160208410611b78575b601f830160051c82018110611b6c575050611268565b60008155600101611b56565b5080611b56565b01519050858061122b565b6003850160005260206000209060005b601f1984168110611be1575060019394959683601f19811610611bc8575b505050811b016003840155611243565b015160001960f88460031b161c19169055858080611bb8565b9091602060018192858b015181550193019101611b9a565b600385016000526020600020601f830160051c810160208410611c39575b601f830160051c82018110611c2d575050611210565b60008155600101611c17565b5080611c17565b0151905085806111d3565b6002840160005260206000209060005b601f1984168110611ca2575060019394959683601f19811610611c89575b505050811b0160028301556111eb565b015160001960f88460031b161c19169055858080611c79565b9091602060018192858b015181550193019101611c5b565b600284016000526020600020601f830160051c81019160208410611cfb575b601f0160051c01905b818110611cef57506111b8565b60008155600101611ce2565b9091508190611cd9565b01519050858061117b565b6001830160005260206000209060005b601f1984168110611d67575060019394959683601f19811610611d4e575b505050811b016001820155611193565b015160001960f88460031b161c19169055858080611d3e565b9091602060018192858b015181550193019101611d20565b600183016000526020600020601f830160051c81019160208410611dc0575b601f0160051c01905b818110611db45750611160565b60008155600101611da7565b9091508190611d9e565b60405162461bcd60e51b815260206004820152600f60248201526e151bdad95b881b9bdd08195e1a5cdd608a1b6044820152606490fd5b3461026157600036600319011261026157611e1a6152b0565b60008051602061554883398151915280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461026157602036600319011261026157611e846149e1565b6001600160a01b03811615611ea757611e9e602091614d1c565b54604051908152f35b6040516322718ad960e21b815260006004820152602490fd5b34610261576020366003190112610261576020611ede6004356152e9565b6040516001600160a01b039091168152f35b3461026157602036600319011261026157600435600081815260008051602061558883398151915260205260409020546001600160a01b0390811615610cf6576000906009541691602460405180948193635ac1e3bb60e01b835260048301525afa8015610cea5761035a91600091610cc75750604051918291602083526020830190614a1a565b3461026157600036600319011261026157602060ff600154166040519015158152f35b3461026157600036600319011261026157611fb46152b0565b7f6bdfe227d5db299c59aa56d5f846f40dbd73b271aaa78e18ed74fc3e00b8aa6b602060015460ff8082161516809160ff1916176001556040519015158152a1005b3461026157602036600319011261026157600435806000526000805160206155888339815191528060205260018060a01b039081604060002054169133151590816120a4575b50509060009181612086575b8383526020526040822080546001600160a01b03191690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4005b61208f846154ac565b61209882614d1c565b83198154019055612048565b816120f2575b50156120b757838061203c565b506120d45760249060405190637e27328960e01b82526004820152fd5b6044906040519063177e802f60e01b82523360048301526024820152fd5b33841491508115612134575b811561210c575b50846120aa565b9050836000526000805160206155a88339815191526020523390604060002054161484612105565b905061213f83614d55565b3360005260205260ff60406000205416906120fe565b346102615761028f61216636614d8e565b906040519261217484614a8c565b60008452610db9838383614fc8565b346102615760003660031901126102615761219c6152b0565b60095460ff8160a01c166121e15760ff60a01b1916600160a01b176009557f593e31e306c198bef259d839f7c6dc4ff7fc10c07f76fab193a210b03704105f600080a1005b604051631dd5050760e11b815260206004820152601460248201527311195cd8dc9a5c1d1bdc881a5cc81b1bd8dad95960621b6044820152606490fd5b6040366003190112610261576024356001600160401b03811161026157612249903690600401614cbc565b60ff6001541615613488573415613361575060025460043581029080820460043514901517156132d8573410613325575b60008080803460018060a01b03600354165af1612295615154565b50156132ee5760005b60043581106122a957005b600054906001820182116132d85760018201600055612710600183011161329357600182011561324e576122db615184565b6001830181526040518060608101106001600160401b036060830111176109935760608101604052602e81527f516d545a6b4b763166336b5a4c354277654150386a697061514839413135786f60208201526d21b69c34acaa19a81c3bb319a63b60911b604082015261014082015260405161235681614a71565b600a815269155b9c995d99585b195960b21b60208201526101608201526001830160005260046020526040600020908051825560208101518051906001600160401b038211610993576123ac6001850154614ebf565b601f8111613207575b50906020601f821160011461319757819260009261318c575b50508160011b916000199060031b1c19161760018301555b60408101518051906001600160401b038211610993576124096002850154614ebf565b601f8111613145575b50906020601f82116001146130d55781926000926130ca575b50508160011b916000199060031b1c19161760028301555b60608101518051906001600160401b038211610993576124666003850154614ebf565b601f8111613083575b50906020601f8211600114613013578192600092613008575b50508160011b916000199060031b1c19161760038301555b60808101518051906001600160401b038211610993576124c36004850154614ebf565b601f8111612fc1575b50906020601f8211600114612f51578192600092612f46575b50508160011b916000199060031b1c19161760048301555b60a08101518051906001600160401b038211610993576125206005850154614ebf565b601f8111612eff575b50906020601f8211600114612e8f578192600092612e84575b50508160011b916000199060031b1c19161760058301555b60c08101518051906001600160401b0382116109935761257d6006850154614ebf565b601f8111612e3d575b50906020601f8211600114612dcd578192600092612dc2575b50508160011b916000199060031b1c19161760068301555b60e08101518051906001600160401b038211610993576125da6007850154614ebf565b601f8111612d7b575b50906020601f8211600114612d0b578192600092612d00575b50508160011b916000199060031b1c19161760078301555b6101008101518051906001600160401b038211610993576126386008850154614ebf565b601f8111612cb9575b50906020601f8211600114612c49578192600092612c3e575b50508160011b916000199060031b1c19161760088301555b6101208101518051906001600160401b038211610993576126966009850154614ebf565b601f8111612bf7575b50906020601f8211600114612b87578192600092612b7c575b50508160011b916000199060031b1c19161760098301555b6101408101518051906001600160401b038211610993576126f4600a850154614ebf565b601f8111612b35575b50602090601f8311600114612ac15761016093929160009183612ab6575b50508160011b916000199060031b1c191617600a8401555b01518051906001600160401b03821161099357612753600b840154614ebf565b601f8111612a6f575b50602090601f83116001146129ff57600b9291600091836129f4575b50508160011b916000199060031b1c1916179101555b60405161279a81614a8c565b6000815233156129db5760018301600090815260008051602061558883398151915260205260409020546001600160a01b0316806129b9575b336129a4575b600184016000526000805160206155888339815191526020526040600020336001600160601b0360a01b8254161790556001840133827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a461298b57333b61287a575b507f3a5398bda6f1f57d6c96834fa9bf02b5517bdc847d14312015a917ba421c31c9604060019384825191018152336020820152a10161229e565b604051602081806128b7630a85bd0160e11b9586835233600484015260006024840152600189016044840152608060648401526084830190614a1a565b03816000335af160009181612946575b506128f9576128d4615154565b805190816128f457604051633250574960e11b8152336004820152602490fd5b602001fd5b6001600160e01b0319160361292e577f3a5398bda6f1f57d6c96834fa9bf02b5517bdc847d14312015a917ba421c31c961283f565b604051633250574960e11b8152336004820152602490fd5b9091506020813d602011612983575b8161296260209383614aa7565b8101031261026157516001600160e01b0319811681036102615790856128c7565b3d9150612955565b6040516339e3563760e11b815260006004820152602490fd5b6129ad33614d1c565b600181540190556127d9565b6129c5600185016154ac565b6129ce81614d1c565b80546000190190556127d3565b604051633250574960e11b815260006004820152602490fd5b015190508680612778565b90600b840160005260206000209160005b601f1985168110612a575750918391600193600b95601f19811610612a3e575b505050811b0191015561278e565b015160001960f88460031b161c19169055868080612a30565b91926020600181928685015181550194019201612a10565b600b84016000526020600020601f840160051c810160208510612aaf575b601f830160051c82018110612aa357505061275c565b60008155600101612a8d565b5080612a8d565b01519050878061271b565b90600a850160005260206000209160005b601f1985168110612b1d57509183916001936101609695601f19811610612b04575b505050811b01600a840155612733565b015160001960f88460031b161c19169055878080612af4565b91926020600181928685015181550194019201612ad2565b600a85016000526020600020601f840160051c810160208510612b75575b601f830160051c82018110612b695750506126fd565b60008155600101612b53565b5080612b53565b0151905086806126b8565b600985016000526020600020906000935b601f1984168510612bdc576001945083601f19811610612bc3575b505050811b0160098301556126d0565b015160001960f88460031b161c19169055868080612bb3565b81810151835560209485019460019093019290910190612b98565b600985016000526020600020601f840160051c810160208510612c37575b601f830160051c82018110612c2b57505061269f565b60008155600101612c15565b5080612c15565b01519050868061265a565b600885016000526020600020906000935b601f1984168510612c9e576001945083601f19811610612c85575b505050811b016008830155612672565b015160001960f88460031b161c19169055868080612c75565b81810151835560209485019460019093019290910190612c5a565b600885016000526020600020601f840160051c810160208510612cf9575b601f830160051c82018110612ced575050612641565b60008155600101612cd7565b5080612cd7565b0151905086806125fc565b600785016000526020600020906000935b601f1984168510612d60576001945083601f19811610612d47575b505050811b016007830155612614565b015160001960f88460031b161c19169055868080612d37565b81810151835560209485019460019093019290910190612d1c565b600785016000526020600020601f840160051c810160208510612dbb575b601f830160051c82018110612daf5750506125e3565b60008155600101612d99565b5080612d99565b01519050868061259f565b600685016000526020600020906000935b601f1984168510612e22576001945083601f19811610612e09575b505050811b0160068301556125b7565b015160001960f88460031b161c19169055868080612df9565b81810151835560209485019460019093019290910190612dde565b600685016000526020600020601f840160051c810160208510612e7d575b601f830160051c82018110612e71575050612586565b60008155600101612e5b565b5080612e5b565b015190508680612542565b600585016000526020600020906000935b601f1984168510612ee4576001945083601f19811610612ecb575b505050811b01600583015561255a565b015160001960f88460031b161c19169055868080612ebb565b81810151835560209485019460019093019290910190612ea0565b600585016000526020600020601f840160051c810160208510612f3f575b601f830160051c82018110612f33575050612529565b60008155600101612f1d565b5080612f1d565b0151905086806124e5565b600485016000526020600020906000935b601f1984168510612fa6576001945083601f19811610612f8d575b505050811b0160048301556124fd565b015160001960f88460031b161c19169055868080612f7d565b81810151835560209485019460019093019290910190612f62565b600485016000526020600020601f840160051c810160208510613001575b601f830160051c82018110612ff55750506124cc565b60008155600101612fdf565b5080612fdf565b015190508680612488565b600385016000526020600020906000935b601f1984168510613068576001945083601f1981161061304f575b505050811b0160038301556124a0565b015160001960f88460031b161c1916905586808061303f565b81810151835560209485019460019093019290910190613024565b600385016000526020600020601f840160051c8101602085106130c3575b601f830160051c820181106130b757505061246f565b600081556001016130a1565b50806130a1565b01519050868061242b565b600285016000526020600020906000935b601f198416851061312a576001945083601f19811610613111575b505050811b016002830155612443565b015160001960f88460031b161c19169055868080613101565b818101518355602094850194600190930192909101906130e6565b600285016000526020600020601f840160051c810160208510613185575b601f830160051c82018110613179575050612412565b60008155600101613163565b5080613163565b0151905086806123ce565b600185016000526020600020906000935b601f19841685106131ec576001945083601f198116106131d3575b505050811b0160018301556123e6565b015160001960f88460031b161c191690558680806131c3565b818101518355602094850194600190930192909101906131a8565b600185016000526020600020601f840160051c810160208510613247575b601f830160051c8201811061323b5750506123b5565b60008155600101613225565b5080613225565b60405162461bcd60e51b815260206004820152601c60248201527f546f6b656e206d7573742062652067726561746572207468616e2030000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f546f6b656e2065786365656473206d6178696d756d20737570706c79000000006044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606490fd5b60016004350361345057336000526020906005825260ff6040600020541661341a576133c2906040518381019033825284815261339d81614a71565b5190206040518481019182528481526133b581614a71565b5190209060075490615331565b156133e45760059033600052526040600020600160ff1982541617905561227a565b6064906040519062461bcd60e51b82526004820152600f60248201526e139bdd081dda1a5d195b1a5cdd1959608a1b6044820152fd5b60405162461bcd60e51b815260048101839052600e60248201526d105b1c9958591e481b5a5b9d195960921b6044820152606490fd5b60405162461bcd60e51b815260206004820152601060248201526f14185e5b595b9d081c995c5d5a5c995960821b6044820152606490fd5b60405162461bcd60e51b8152602060048201526013602482015272135a5b9d1a5b99c81a5cc8191a5cd8589b1959606a1b6044820152606490fd5b346102615760003660031901126102615760206040516127108152f35b34610261576000366003190112610261576009546040516001600160a01b039091168152602090f35b3461026157600036600319011261026157602060ff60015460081c166040519015158152f35b346102615761028f61354036614d8e565b91614fc8565b34610261576020366003190112610261576001600160a01b036135676149e1565b166000526005602052602060ff604060002054166040519015158152f35b34610261576000366003190112610261576020600054604051908152f35b34610261576000366003190112610261576020600654604051908152f35b34610261576020366003190112610261576004356001600160401b03811161026157366023820112156102615780600401356135fc81614ac8565b9161360a6040519384614aa7565b8183526024602084019260051b820101903682116102615760248101925b82841061461e578460005b815181101561028f576136468183614f9e565b5180519060406020820151910151826000526000805160206155888339815191526020523360018060a01b0360406000205416036145e157602082015160408301516060840151608085015160a086015160c087015160e088015191610100890151936101208a0151956101408b015197604051998d60208c015260408b0161018090526101a08b016136d891614a1a565b8a8103601f190160608c01526136ed91614a1a565b898103601f190160808b015261370291614a1a565b888103601f190160a08a015261371791614a1a565b878103601f190160c089015261372c91614a1a565b868103601f190160e088015261374191614a1a565b858103601f190161010087015261375791614a1a565b848103601f190161012086015261376d91614a1a565b838103601f190161014085015261378391614a1a565b828103601f190161016084015261379991614a1a565b81810390601f198201610180840152600090528082526020016137bc9082614aa7565b8051906020012060405160208101918252602081526137da81614a71565b5190206006546137e992615331565b156145ab576040516137fa81614a71565b600881526714995d99585b195960c21b602082015261016082015281600052600460205260406000208151815560208201518051906001600160401b03821161099357819061384c6001850154614ebf565b601f8111614558575b50602090601f83116001146144e6576000926144db575b50508160011b916000199060031b1c19161760018201555b60408201518051906001600160401b0382116109935781906138a96002850154614ebf565b601f8111614488575b50602090601f83116001146144165760009261440b575b50508160011b916000199060031b1c19161760028201555b60608201518051906001600160401b0382116109935781906139066003850154614ebf565b601f81116143b8575b50602090601f83116001146143465760009261433b575b50508160011b916000199060031b1c19161760038201555b60808201518051906001600160401b0382116109935781906139636004850154614ebf565b601f81116142e8575b50602090601f83116001146142765760009261426b575b50508160011b916000199060031b1c19161760048201555b60a08201518051906001600160401b0382116109935781906139c06005850154614ebf565b601f8111614218575b50602090601f83116001146141a65760009261419b575b50508160011b916000199060031b1c19161760058201555b60c08201518051906001600160401b038211610993578190613a1d6006850154614ebf565b601f8111614148575b50602090601f83116001146140d6576000926140cb575b50508160011b916000199060031b1c19161760068201555b60e08201518051906001600160401b038211610993578190613a7a6007850154614ebf565b601f8111614078575b50602090601f831160011461400657600092613ffb575b50508160011b916000199060031b1c19161760078201555b6101008201518051906001600160401b038211610993578190613ad86008850154614ebf565b601f8111613fa8575b50602090601f8311600114613f3657600092613f2b575b50508160011b916000199060031b1c19161760088201555b6101208201518051906001600160401b038211610993578190613b366009850154614ebf565b601f8111613ed8575b50602090601f8311600114613e6657600092613e5b575b50508160011b916000199060031b1c19161760098201555b6101408201518051906001600160401b038211610993578190613b94600a850154614ebf565b601f8111613e08575b50602090601f8311600114613d9657600092613d8b575b50508160011b916000199060031b1c191617600a8201555b6101608201518051906001600160401b03821161099357613bf0600b840154614ebf565b601f8111613d44575b50602090601f8311600114613c9a577ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce794602094600b8560019a99966000805160206155e883398151915296613c7f96600092613c8f575b5050600019600383901b1c1916908b1b179101555b6040519182918583526040878401526040830190614dc3565b0390a1604051908152a101613633565b015190508d80613c51565b90600b840160005260206000209160005b601f1985168110613d2c575094602094600b6001866000805160206155e883398151915296613c7f967ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79b849e9d9a601f19811610613d13575b505050811b01910155613c66565b015160001960f88460031b161c191690558d8080613d05565b91926020600181928685015181550194019201613cab565b600b84016000526020600020601f840160051c810160208510613d84575b601f830160051c82018110613d78575050613bf9565b60008155600101613d62565b5080613d62565b015190508780613bb4565b9250600a84016000526020600020906000935b601f1984168510613ded576001945083601f19811610613dd4575b505050811b01600a820155613bcc565b015160001960f88460031b161c19169055878080613dc4565b81810151835560209485019460019093019290910190613da9565b909150600a84016000526020600020601f840160051c810160208510613e54575b90849392915b601f830160051c82018110613e45575050613b9d565b60008155859450600101613e2f565b5080613e29565b015190508780613b56565b9250600984016000526020600020906000935b601f1984168510613ebd576001945083601f19811610613ea4575b505050811b016009820155613b6e565b015160001960f88460031b161c19169055878080613e94565b81810151835560209485019460019093019290910190613e79565b909150600984016000526020600020601f840160051c810160208510613f24575b90849392915b601f830160051c82018110613f15575050613b3f565b60008155859450600101613eff565b5080613ef9565b015190508780613af8565b9250600884016000526020600020906000935b601f1984168510613f8d576001945083601f19811610613f74575b505050811b016008820155613b10565b015160001960f88460031b161c19169055878080613f64565b81810151835560209485019460019093019290910190613f49565b909150600884016000526020600020601f840160051c810160208510613ff4575b90849392915b601f830160051c82018110613fe5575050613ae1565b60008155859450600101613fcf565b5080613fc9565b015190508780613a9a565b9250600784016000526020600020906000935b601f198416851061405d576001945083601f19811610614044575b505050811b016007820155613ab2565b015160001960f88460031b161c19169055878080614034565b81810151835560209485019460019093019290910190614019565b909150600784016000526020600020601f840160051c8101602085106140c4575b90849392915b601f830160051c820181106140b5575050613a83565b6000815585945060010161409f565b5080614099565b015190508780613a3d565b9250600684016000526020600020906000935b601f198416851061412d576001945083601f19811610614114575b505050811b016006820155613a55565b015160001960f88460031b161c19169055878080614104565b818101518355602094850194600190930192909101906140e9565b909150600684016000526020600020601f840160051c810160208510614194575b90849392915b601f830160051c82018110614185575050613a26565b6000815585945060010161416f565b5080614169565b0151905087806139e0565b9250600584016000526020600020906000935b601f19841685106141fd576001945083601f198116106141e4575b505050811b0160058201556139f8565b015160001960f88460031b161c191690558780806141d4565b818101518355602094850194600190930192909101906141b9565b909150600584016000526020600020601f840160051c810160208510614264575b90849392915b601f830160051c820181106142555750506139c9565b6000815585945060010161423f565b5080614239565b015190508780613983565b9250600484016000526020600020906000935b601f19841685106142cd576001945083601f198116106142b4575b505050811b01600482015561399b565b015160001960f88460031b161c191690558780806142a4565b81810151835560209485019460019093019290910190614289565b909150600484016000526020600020601f840160051c810160208510614334575b90849392915b601f830160051c8201811061432557505061396c565b6000815585945060010161430f565b5080614309565b015190508780613926565b9250600384016000526020600020906000935b601f198416851061439d576001945083601f19811610614384575b505050811b01600382015561393e565b015160001960f88460031b161c19169055878080614374565b81810151835560209485019460019093019290910190614359565b909150600384016000526020600020601f840160051c810160208510614404575b90849392915b601f830160051c820181106143f557505061390f565b600081558594506001016143df565b50806143d9565b0151905087806138c9565b9250600284016000526020600020906000935b601f198416851061446d576001945083601f19811610614454575b505050811b0160028201556138e1565b015160001960f88460031b161c19169055878080614444565b81810151835560209485019460019093019290910190614429565b909150600284016000526020600020601f840160051c8101602085106144d4575b90849392915b601f830160051c820181106144c55750506138b2565b600081558594506001016144af565b50806144a9565b01519050878061386c565b9250600184016000526020600020906000935b601f198416851061453d576001945083601f19811610614524575b505050811b016001820155613884565b015160001960f88460031b161c19169055878080614514565b818101518355602094850194600190930192909101906144f9565b909150600184016000526020600020601f840160051c8101602085106145a4575b90849392915b601f830160051c82018110614595575050613855565b6000815585945060010161457f565b5080614579565b60405162461bcd60e51b815260206004820152600e60248201526d496e76616c69642074726169747360901b6044820152606490fd5b60405162461bcd60e51b815260206004820152601560248201527413db9b1e481bdddb995c8818d85b881c995d99585b605a1b6044820152606490fd5b83356001600160401b038111610261578201606091826023198336030112610261576040519283018381106001600160401b03821117610993576040526024820135835260448201356001600160401b038111610261576146859060243691850101614b4f565b60208401526064820135926001600160401b038411610261576146b2602094936024869536920101614cbc565b6040820152815201930192613628565b34610261576000366003190112610261576003546040516001600160a01b039091168152602090f35b34610261576040366003190112610261576147046149e1565b602435614710816152e9565b331515806147bf575b8061479f575b614787576001600160a01b039283169282918491167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a460009081526000805160206155a88339815191526020526040902080546001600160a01b0319169091179055005b60405163a9fbf51f60e01b8152336004820152602490fd5b506147a981614d55565b3360005260205260ff604060002054161561471f565b506001600160a01b038116331415614719565b34610261576020366003190112610261576004356147ef816152e9565b506000526000805160206155a8833981519152602052602060018060a01b0360406000205416604051908152f35b3461026157600036600319011261026157604051600080516020615508833981519152805482600061484e83614ebf565b9283835260209460019186600182169182600014610fb257505060011461487d575050610f5492500383614aa7565b859250600052600080516020615628833981519152906000915b8583106148af575050610f5493508201018580610f46565b80548389018501528794508693909201918101614897565b346102615760203660031901126102615760043563ffffffff60e01b8116809103610261576020906380ac58cd60e01b8114908115614924575b8115614913575b506040519015158152f35b6301ffc9a760e01b14905082614908565b635b5e139f60e01b81149150614901565b346102615760203660031901126102615761494e6149e1565b6149566152b0565b6009549060ff8260a01c166121e1576001600160a01b03166001600160a01b03199190911681176009556040519081527f6e66ab22238a5471005895947c8f57db923c2a9c9c73180eff80864c21295c1b90602090a17f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6040600054815190600082526020820152a1005b600435906001600160a01b038216820361026157565b60005b838110614a0a5750506000910152565b81810151838201526020016149fa565b90602091614a33815180928185528580860191016149f7565b601f01601f1916010190565b602435906001600160a01b038216820361026157565b61018081019081106001600160401b0382111761099357604052565b604081019081106001600160401b0382111761099357604052565b602081019081106001600160401b0382111761099357604052565b90601f801991011681019081106001600160401b0382111761099357604052565b6001600160401b0381116109935760051b60200190565b6001600160401b03811161099357601f01601f191660200190565b929192614b0682614adf565b91614b146040519384614aa7565b829481845281830111610261578281602093846000960137010152565b9080601f8301121561026157816020614b4c93359101614afa565b90565b9190610180838203126102615760405190614b6982614a55565b8193803583526020810135916001600160401b03928381116102615781614b91918401614b31565b602085015260408201358381116102615781614bae918401614b31565b604085015260608201358381116102615781614bcb918401614b31565b606085015260808201358381116102615781614be8918401614b31565b608085015260a08201358381116102615781614c05918401614b31565b60a085015260c08201358381116102615781614c22918401614b31565b60c085015260e08201358381116102615781614c3f918401614b31565b60e0850152610100808301358481116102615782614c5e918501614b31565b90850152610120808301358481116102615782614c7c918501614b31565b90850152610140808301358481116102615782614c9a918501614b31565b90850152610160928383013590811161026157614cb79201614b31565b910152565b9080601f83011215610261576020908235614cd681614ac8565b93614ce46040519586614aa7565b81855260208086019260051b82010192831161026157602001905b828210614d0d575050505090565b81358152908301908301614cff565b6001600160a01b031660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793036020526040902090565b6001600160a01b031660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020526040902090565b6060906003190112610261576001600160a01b0390600435828116810361026157916024359081168103610261579060443590565b90614b4c91614eab614e97614e83614e6f614e5d614e4b614e39614e27614e15614e028b60208c816101809282849351865201519301528d0190614a1a565b60408b01518c6040818403910152614a1a565b60608a01518b820360608d0152614a1a565b60808901518a820360808c0152614a1a565b60a088015189820360a08b0152614a1a565b60c087015188820360c08a0152614a1a565b60e086015187820360e0890152614a1a565b610100808601519087830390880152614a1a565b610120808501519086830390870152614a1a565b610140808401519085830390860152614a1a565b916101608092015191818403910152614a1a565b90600182811c92168015614eef575b6020831014614ed957565b634e487b7160e01b600052602260045260246000fd5b91607f1691614ece565b90604051918260008254614f0c81614ebf565b90818452602094600191600181169081600014614f7c5750600114614f3d575b505050614f3b92500383614aa7565b565b600090815285812095935091905b818310614f64575050614f3b9350820101388080614f2c565b85548884018501529485019487945091830191614f4b565b92505050614f3b94925060ff191682840152151560051b820101388080614f2c565b8051821015614fb25760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03828116939184156129db57826000958187526000805160206155888339815191529586602052604097858982205416978892331515806150ae575b509061503d7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef93928561508f57614d1c565b8054600101905585825260205289812080546001600160a01b0319168517905580a4169283830361506e5750505050565b6064945051926364283d7b60e01b8452600484015260248301526044820152fd5b615098886154ac565b6150a186614d1c565b8054600019019055614d1c565b9193509193945080615105575b156150cc579187918794933861500b565b8887896150e9576024915190637e27328960e01b82526004820152fd5b604491519063177e802f60e01b82523360048301526024820152fd5b503388148015615138575b806150bb57508683526000805160206155a883398151915260205233868a85205416146150bb565b5061514288614d55565b33845260205260ff8984205416615110565b3d1561517f573d9061516582614adf565b916151736040519384614aa7565b82523d6000602084013e565b606090565b6040519061519182614a55565b816000815261016060609182602082015282604082015282808201528260808201528260a08201528260c08201528260e08201528261010082015282610120820152826101408201520152565b602081830312610261578051906001600160401b038211610261570181601f8201121561026157805161521081614adf565b9261521e6040519485614aa7565b8184526020828401011161026157614b4c91602080850191016149f7565b6001600160a01b039081169081156152975760008051602061554883398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b600080516020615548833981519152546001600160a01b031633036152d157565b60405163118cdaa760e01b8152336004820152602490fd5b600081815260008051602061558883398151915260205260409020546001600160a01b0316908115615319575090565b60249060405190637e27328960e01b82526004820152fd5b929091906000915b84518310156153805761534c8386614f9e565b519060008282101561536f5750600052602052600160406000205b920191615339565b604091600193825260205220615367565b915092501490565b9293823b615398575b5050505050565b6153dc9060018060a01b038094169560405194859481630a85bd0160e11b988988521660048701521660248501526044840152608060648401526084830190614a1a565b03906020816000938185885af19082908261545c575b505061542a5782615401615154565b805191908261542357604051633250574960e11b815260048101839052602490fd5b9050602001fd5b6001600160e01b0319160361544457503880808080615391565b60249060405190633250574960e11b82526004820152fd5b909192506020813d6020116154a4575b8161547960209383614aa7565b810103126154a05751906001600160e01b03198216820361549d57509038806153f2565b80fd5b5080fd5b3d915061546c565b6000526000805160206155a883398151915260205260406000206001600160601b0360a01b8154169055565b60ff6000805160206155c88339815191525460401c16156154f557565b604051631afcd79f60e31b8152600490fdfe80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300f4bad0a69248f59680a4f2b3000328cec71a413447c96781cfe5996daa8c456e9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300f3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee380bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930280bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079304f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00de7257f17940ea914bf0c19ce7ccf993ff9c177142446914b06742a64d3af89d80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930137c58c799b6609234b945e882912ee9ad34948a1dfaa20a97485e1a7752bbf81a2646970667358221220be35896d37e7523a27b5e8bd463baabb880a43fec26b4d825b05b4912785548e64736f6c63430008160033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c806301b9a3971461493557806301ffc9a7146148c757806306fdde031461481d578063081812fc146147d2578063095ea7b3146146eb5780630d9019e1146146c25780630e568561146135c15780631071d9be146135a357806318160ddd146135855780631d89c0df1461354657806323b872dd1461352f57806325d6268b14613509578063303e74df146134e057806332cb6b0c146134c357806335bc49a31461221e57806341b5d0de1461218357806342842e0e1461215557806342966c6814611ff65780635196e06014611f9b57806355c7ba1414611f785780635ac1e3bb14611ef05780636352211e14611ec057806370a0823114611e6b578063715018a614611e0157806383f87b4c146110c057806388a99c57146110745780638d859f3e146110565780638da5cb5b1461102057806391b7f5ed14610fd457806395d89b4114610ef3578063997d5b1514610ec9578063a22cb46514610e29578063a735c1d214610ddd578063b73564cc14610dbf578063b88d4fde14610d54578063c1b8e4e114610d2e578063c87b56dd14610c3e578063dc1e4c74146104e8578063e05c57bf146103d8578063e8a3d485146102df578063e985e9c514610291578063f2fde38b146102665763feec756c146101f557600080fd5b34610261576020366003190112610261577f566f16f5ede69bb6f837d5da3a6cf41c863ba95621d677ff3c931aa687da646660206102316149e1565b6102396152b0565b600380546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b600080fd5b346102615760203660031901126102615761028f6102826149e1565b61028a6152b0565b61523c565b005b34610261576040366003190112610261576102aa6149e1565b6102bb6102b5614a3f565b91614d55565b9060018060a01b0316600052602052602060ff604060002054166040519015158152f35b346102615760003660031901126102615760405160209066697066733a2f2f60c81b602082015260276000926008549161031883614ebf565b926001908181169081156103ae575060011461035e575b61035a85610346818903601f198101835282614aa7565b604051918291602083526020830190614a1a565b0390f35b909192945060086000526000805160206155688339815191526000905b86821061039b57505050505061034681602761035a94820101938561032f565b805486830185015290840190820161037b565b905061035a96508593506027925061034694915060ff19168284015280151502820101938561032f565b34610261576020366003190112610261576103f1615184565b50600435600052600460205261035a60406000206104ce600b6040519261041784614a55565b8054845261042760018201614ef9565b602085015261043860028201614ef9565b604085015261044960038201614ef9565b606085015261045a60048201614ef9565b608085015261046b60058201614ef9565b60a085015261047c60068201614ef9565b60c085015261048d60078201614ef9565b60e085015261049e60088201614ef9565b6101008501526104b060098201614ef9565b6101208501526104c2600a8201614ef9565b61014085015201614ef9565b610160820152604051918291602083526020830190614dc3565b346102615760c0366003190112610261576105016149e1565b610509614a3f565b906084356001600160401b03811161026157610529903690600401614b31565b9160a435906001600160a01b0382168203610261576000805160206155c883398151915254926001600160401b03841680159081610c2e575b6001149081610c24575b159081610c1b575b50610c095760016001600160401b03198516176000805160206155c88339815191525560ff8460401c1615610bdc575b6040516105b081614a71565b600a8152694172742044654343307360b01b6020820152604051906105d482614a71565b6005825264044454343360dc1b60208301526105ee6154d8565b6105f66154d8565b8051906001600160401b03821161099357819061062160008051602061550883398151915254614ebf565b601f8111610b5b575b50602090601f8311600114610ac957600092610abe575b50508160011b916000199060031b1c191617600080516020615508833981519152555b8051906001600160401b0382116109935761068d60008051602061560883398151915254614ebf565b601f8111610a48575b50602090601f83116001146109b4576106ef939291600091836109a9575b50508160011b916000199060031b1c191617600080516020615608833981519152555b6106df6154d8565b6106e76154d8565b61028a6154d8565b60443560065560643560075583516001600160401b03811161099357610716600854614ebf565b601f8111610926575b506020601f82116001146108b157819060ff966000926108a6575b50508160011b916000199060031b1c1916176008555b6001600160601b0360a01b9160018060a01b031682600954161760095560018060a01b03169060035416176003557f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe060206656000c1b9d08008060025561ffff1960015416600155604051908152a17f6bdfe227d5db299c59aa56d5f846f40dbd73b271aaa78e18ed74fc3e00b8aa6b602060405160008152a17fe4234e67ea66db8774c20ef346e2ea56f28de6ec69c496f0905029e9e88563ca60206040516044358152a17f03acff7b614471676dd2e5022a4801eea2387114c7f8df34ce83cc377543a28360206040516064358152a160401c161561084d57005b68ff0000000000000000196000805160206155c883398151915254166000805160206155c8833981519152557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b01519050868061073a565b601f1982169560086000526000805160206155688339815191529660005b81811061090e57509160ff97918460019594106108f5575b505050811b01600855610750565b015160001960f88460031b161c191690558680806108e7565b838301518955600190980197602093840193016108cf565b6008600052601f820160051c60008051602061556883398151915201906020831061097d575b601f0160051c60008051602061556883398151915201905b818110610971575061071f565b60008155600101610964565b600080516020615568833981519152915061094c565b634e487b7160e01b600052604160045260246000fd5b0151905088806106b4565b906000805160206156088339815191526000526000805160206155288339815191529160005b601f1985168110610a3057509183916001936106ef9695601f19811610610a17575b505050811b01600080516020615608833981519152556106d7565b015160001960f88460031b161c191690558880806109fc565b919260206001819286850151815501940192016109da565b600080516020615608833981519152600052601f830160051c6000805160206155288339815191520160208410610aa9575b601f820160051c600080516020615528833981519152018110610a9d5750610696565b60008155600101610a7a565b50600080516020615528833981519152610a7a565b015190508880610641565b9250600080516020615508833981519152600052600080516020615628833981519152906000935b601f1984168510610b40576001945083601f19811610610b27575b505050811b0160008051602061550883398151915255610664565b015160001960f88460031b161c19169055888080610b0c565b81810151835560209485019460019093019290910190610af1565b909150600080516020615508833981519152600052601f830160051c6000805160206156288339815191520160208410610bc7575b908392915b601f820160051c600080516020615628833981519152018110610bb8575061062a565b60008155849350600101610b95565b50600080516020615628833981519152610b90565b68ffffffffffffffffff19841668010000000000000001176000805160206155c8833981519152556105a4565b60405163f92ee8a960e01b8152600490fd5b90501586610574565b303b15915061056c565b604086901c60ff16159150610562565b3461026157602036600319011261026157600435600081815260008051602061558883398151915260205260409020546001600160a01b0390811615610cf657600090600954169160246040518094819363c87b56dd60e01b835260048301525afa8015610cea5761035a91600091610cc7575b50604051918291602083526020830190614a1a565b610ce491503d806000833e610cdc8183614aa7565b8101906151de565b82610cb2565b6040513d6000823e3d90fd5b604051639f7f050d60e01b815260206004820152600f60248201526e151bdad95b881b9bdd08195e1a5cdd608a1b6044820152606490fd5b3461026157600036600319011261026157602060ff60095460a01c166040519015158152f35b3461026157608036600319011261026157610d6d6149e1565b610d75614a3f565b90604435606435926001600160401b038411610261573660238501121561026157610dad61028f943690602481600401359101614afa565b92610db9838383614fc8565b33615388565b34610261576000366003190112610261576020600754604051908152f35b34610261576020366003190112610261577f03acff7b614471676dd2e5022a4801eea2387114c7f8df34ce83cc377543a2836020600435610e1c6152b0565b80600755604051908152a1005b3461026157604036600319011261026157610e426149e1565b60243590811515809203610261576001600160a01b0316908115610eb057610e6933614d55565b82600052602052604060002060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b604051630b61174360e31b815260048101839052602490fd5b3461026157600036600319011261026157610ee26152b0565b6001805461ff001916610100179055005b34610261576000366003190112610261576040516000805160206156088339815191528054826000610f2483614ebf565b9283835260209460019186600182169182600014610fb2575050600114610f68575b5050610f5492500383614aa7565b61035a604051928284938452830190614a1a565b859250600052600080516020615528833981519152906000915b858310610f9a575050610f5493508201018580610f46565b80548389018501528794508693909201918101610f82565b9250935050610f5494915060ff191682840152151560051b8201018580610f46565b34610261576020366003190112610261577f66cbca4f3c64fecf1dcb9ce094abcf7f68c3450a1d4e3a8e917dd621edb4ebe060206004356110136152b0565b80600255604051908152a1005b3461026157600036600319011261026157600080516020615548833981519152546040516001600160a01b039091168152602090f35b34610261576000366003190112610261576020600254604051908152f35b34610261576020366003190112610261577fe4234e67ea66db8774c20ef346e2ea56f28de6ec69c496f0905029e9e88563ca60206004356110b36152b0565b80600655604051908152a1005b34610261576040366003190112610261576001600160401b03602435818111610261576110f1903690600401614b4f565b6110f96152b0565b600435600090815260008051602061558883398151915260205260409020546001600160a01b031615611dca576004356000526004602052604060002091815183556020820151928351828111610993576111576001830154614ebf565b601f8111611d7f575b506020601f8211600114611d10578192939495600092611d05575b50508160011b916000199060031b1c19161760018201555b6040830151928351838111610993576111af6002840154614ebf565b601f8111611cba575b506020601f8211600114611c4b578192939495600092611c40575b50508160011b916000199060031b1c19161760028301555b6060810151928351818111610993576112076003850154614ebf565b601f8111611bf9575b506020601f8211600114611b8a578192939495600092611b7f575b50508160011b916000199060031b1c19161760038401555b60808201519283518281116109935761125f6004830154614ebf565b601f8111611b38575b506020601f8211600114611ac9578192939495600092611abe575b50508160011b916000199060031b1c19161760048201555b60a0830151928351838111610993576112b76005840154614ebf565b601f8111611a77575b506020601f8211600114611a085781929394956000926119fd575b50508160011b916000199060031b1c19161760058301555b60c08101519283518181116109935761130f6006850154614ebf565b601f81116119b6575b506020601f821160011461194757819293949560009261193c575b50508160011b916000199060031b1c19161760068401555b60e0820151928351828111610993576113676007830154614ebf565b601f81116118f5575b506020601f821160011461188657819293949560009261187b575b50508160011b916000199060031b1c19161760078201555b610100830151928351838111610993576113c06008840154614ebf565b601f8111611834575b506020601f82116001146117c55781929394956000926117ba575b50508160011b916000199060031b1c19161760088301555b610120810151928351818111610993576114196009850154614ebf565b601f8111611773575b506020601f82116001146117045781929394956000926116f9575b50508160011b916000199060031b1c19161760098401555b61014082015192835182811161099357611472600a830154614ebf565b601f81116116b2575b506020601f821160011461163f578190600b949596600092611634575b50508160011b916000199060031b1c191617600a8201555b01906101608301518051918211610993576114cb8354614ebf565b601f81116115ec575b50602090601f831160011461157057918061153494926000805160206155e88339815191529694600092611565575b50508160011b916000199060031b1c19161790555b6040519182916004358352604060208401526040830190614dc3565b0390a17ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce760206040516004358152a1005b015190508680611503565b90601f198316918460005260206000209260005b8181106115d457509260019285926000805160206155e883398151915298966115349896106115bb575b505050811b019055611518565b015160001960f88460031b161c191690558680806115ae565b92936020600181928786015181550195019301611584565b836000526020600020601f840160051c8101916020851061162a575b601f0160051c01905b81811061161e57506114d4565b60008155600101611611565b9091508190611608565b015190508680611498565b600a830160005260206000209560005b601f198416811061169a5750958291600b959697600194601f19811610611681575b505050811b01600a8201556114b0565b015160001960f88460031b161c19169055868080611671565b8282015188556001909701966020928301920161164f565b600a83016000526020600020601f830160051c8101602084106116f2575b601f830160051c820181106116e657505061147b565b600081556001016116d0565b50806116d0565b01519050858061143d565b6009850160005260206000209060005b601f198416811061175b575060019394959683601f19811610611742575b505050811b016009840155611455565b015160001960f88460031b161c19169055858080611732565b9091602060018192858b015181550193019101611714565b600985016000526020600020601f830160051c8101602084106117b3575b601f830160051c820181106117a7575050611422565b60008155600101611791565b5080611791565b0151905085806113e4565b6008840160005260206000209060005b601f198416811061181c575060019394959683601f19811610611803575b505050811b0160088301556113fc565b015160001960f88460031b161c191690558580806117f3565b9091602060018192858b0151815501930191016117d5565b600884016000526020600020601f830160051c810160208410611874575b601f830160051c820181106118685750506113c9565b60008155600101611852565b5080611852565b01519050858061138b565b6007830160005260206000209060005b601f19841681106118dd575060019394959683601f198116106118c4575b505050811b0160078201556113a3565b015160001960f88460031b161c191690558580806118b4565b9091602060018192858b015181550193019101611896565b600783016000526020600020601f830160051c810160208410611935575b601f830160051c82018110611929575050611370565b60008155600101611913565b5080611913565b015190508580611333565b6006850160005260206000209060005b601f198416811061199e575060019394959683601f19811610611985575b505050811b01600684015561134b565b015160001960f88460031b161c19169055858080611975565b9091602060018192858b015181550193019101611957565b600685016000526020600020601f830160051c8101602084106119f6575b601f830160051c820181106119ea575050611318565b600081556001016119d4565b50806119d4565b0151905085806112db565b6005840160005260206000209060005b601f1984168110611a5f575060019394959683601f19811610611a46575b505050811b0160058301556112f3565b015160001960f88460031b161c19169055858080611a36565b9091602060018192858b015181550193019101611a18565b600584016000526020600020601f830160051c810160208410611ab7575b601f830160051c82018110611aab5750506112c0565b60008155600101611a95565b5080611a95565b015190508580611283565b6004830160005260206000209060005b601f1984168110611b20575060019394959683601f19811610611b07575b505050811b01600482015561129b565b015160001960f88460031b161c19169055858080611af7565b9091602060018192858b015181550193019101611ad9565b600483016000526020600020601f830160051c810160208410611b78575b601f830160051c82018110611b6c575050611268565b60008155600101611b56565b5080611b56565b01519050858061122b565b6003850160005260206000209060005b601f1984168110611be1575060019394959683601f19811610611bc8575b505050811b016003840155611243565b015160001960f88460031b161c19169055858080611bb8565b9091602060018192858b015181550193019101611b9a565b600385016000526020600020601f830160051c810160208410611c39575b601f830160051c82018110611c2d575050611210565b60008155600101611c17565b5080611c17565b0151905085806111d3565b6002840160005260206000209060005b601f1984168110611ca2575060019394959683601f19811610611c89575b505050811b0160028301556111eb565b015160001960f88460031b161c19169055858080611c79565b9091602060018192858b015181550193019101611c5b565b600284016000526020600020601f830160051c81019160208410611cfb575b601f0160051c01905b818110611cef57506111b8565b60008155600101611ce2565b9091508190611cd9565b01519050858061117b565b6001830160005260206000209060005b601f1984168110611d67575060019394959683601f19811610611d4e575b505050811b016001820155611193565b015160001960f88460031b161c19169055858080611d3e565b9091602060018192858b015181550193019101611d20565b600183016000526020600020601f830160051c81019160208410611dc0575b601f0160051c01905b818110611db45750611160565b60008155600101611da7565b9091508190611d9e565b60405162461bcd60e51b815260206004820152600f60248201526e151bdad95b881b9bdd08195e1a5cdd608a1b6044820152606490fd5b3461026157600036600319011261026157611e1a6152b0565b60008051602061554883398151915280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b3461026157602036600319011261026157611e846149e1565b6001600160a01b03811615611ea757611e9e602091614d1c565b54604051908152f35b6040516322718ad960e21b815260006004820152602490fd5b34610261576020366003190112610261576020611ede6004356152e9565b6040516001600160a01b039091168152f35b3461026157602036600319011261026157600435600081815260008051602061558883398151915260205260409020546001600160a01b0390811615610cf6576000906009541691602460405180948193635ac1e3bb60e01b835260048301525afa8015610cea5761035a91600091610cc75750604051918291602083526020830190614a1a565b3461026157600036600319011261026157602060ff600154166040519015158152f35b3461026157600036600319011261026157611fb46152b0565b7f6bdfe227d5db299c59aa56d5f846f40dbd73b271aaa78e18ed74fc3e00b8aa6b602060015460ff8082161516809160ff1916176001556040519015158152a1005b3461026157602036600319011261026157600435806000526000805160206155888339815191528060205260018060a01b039081604060002054169133151590816120a4575b50509060009181612086575b8383526020526040822080546001600160a01b03191690557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4005b61208f846154ac565b61209882614d1c565b83198154019055612048565b816120f2575b50156120b757838061203c565b506120d45760249060405190637e27328960e01b82526004820152fd5b6044906040519063177e802f60e01b82523360048301526024820152fd5b33841491508115612134575b811561210c575b50846120aa565b9050836000526000805160206155a88339815191526020523390604060002054161484612105565b905061213f83614d55565b3360005260205260ff60406000205416906120fe565b346102615761028f61216636614d8e565b906040519261217484614a8c565b60008452610db9838383614fc8565b346102615760003660031901126102615761219c6152b0565b60095460ff8160a01c166121e15760ff60a01b1916600160a01b176009557f593e31e306c198bef259d839f7c6dc4ff7fc10c07f76fab193a210b03704105f600080a1005b604051631dd5050760e11b815260206004820152601460248201527311195cd8dc9a5c1d1bdc881a5cc81b1bd8dad95960621b6044820152606490fd5b6040366003190112610261576024356001600160401b03811161026157612249903690600401614cbc565b60ff6001541615613488573415613361575060025460043581029080820460043514901517156132d8573410613325575b60008080803460018060a01b03600354165af1612295615154565b50156132ee5760005b60043581106122a957005b600054906001820182116132d85760018201600055612710600183011161329357600182011561324e576122db615184565b6001830181526040518060608101106001600160401b036060830111176109935760608101604052602e81527f516d545a6b4b763166336b5a4c354277654150386a697061514839413135786f60208201526d21b69c34acaa19a81c3bb319a63b60911b604082015261014082015260405161235681614a71565b600a815269155b9c995d99585b195960b21b60208201526101608201526001830160005260046020526040600020908051825560208101518051906001600160401b038211610993576123ac6001850154614ebf565b601f8111613207575b50906020601f821160011461319757819260009261318c575b50508160011b916000199060031b1c19161760018301555b60408101518051906001600160401b038211610993576124096002850154614ebf565b601f8111613145575b50906020601f82116001146130d55781926000926130ca575b50508160011b916000199060031b1c19161760028301555b60608101518051906001600160401b038211610993576124666003850154614ebf565b601f8111613083575b50906020601f8211600114613013578192600092613008575b50508160011b916000199060031b1c19161760038301555b60808101518051906001600160401b038211610993576124c36004850154614ebf565b601f8111612fc1575b50906020601f8211600114612f51578192600092612f46575b50508160011b916000199060031b1c19161760048301555b60a08101518051906001600160401b038211610993576125206005850154614ebf565b601f8111612eff575b50906020601f8211600114612e8f578192600092612e84575b50508160011b916000199060031b1c19161760058301555b60c08101518051906001600160401b0382116109935761257d6006850154614ebf565b601f8111612e3d575b50906020601f8211600114612dcd578192600092612dc2575b50508160011b916000199060031b1c19161760068301555b60e08101518051906001600160401b038211610993576125da6007850154614ebf565b601f8111612d7b575b50906020601f8211600114612d0b578192600092612d00575b50508160011b916000199060031b1c19161760078301555b6101008101518051906001600160401b038211610993576126386008850154614ebf565b601f8111612cb9575b50906020601f8211600114612c49578192600092612c3e575b50508160011b916000199060031b1c19161760088301555b6101208101518051906001600160401b038211610993576126966009850154614ebf565b601f8111612bf7575b50906020601f8211600114612b87578192600092612b7c575b50508160011b916000199060031b1c19161760098301555b6101408101518051906001600160401b038211610993576126f4600a850154614ebf565b601f8111612b35575b50602090601f8311600114612ac15761016093929160009183612ab6575b50508160011b916000199060031b1c191617600a8401555b01518051906001600160401b03821161099357612753600b840154614ebf565b601f8111612a6f575b50602090601f83116001146129ff57600b9291600091836129f4575b50508160011b916000199060031b1c1916179101555b60405161279a81614a8c565b6000815233156129db5760018301600090815260008051602061558883398151915260205260409020546001600160a01b0316806129b9575b336129a4575b600184016000526000805160206155888339815191526020526040600020336001600160601b0360a01b8254161790556001840133827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a461298b57333b61287a575b507f3a5398bda6f1f57d6c96834fa9bf02b5517bdc847d14312015a917ba421c31c9604060019384825191018152336020820152a10161229e565b604051602081806128b7630a85bd0160e11b9586835233600484015260006024840152600189016044840152608060648401526084830190614a1a565b03816000335af160009181612946575b506128f9576128d4615154565b805190816128f457604051633250574960e11b8152336004820152602490fd5b602001fd5b6001600160e01b0319160361292e577f3a5398bda6f1f57d6c96834fa9bf02b5517bdc847d14312015a917ba421c31c961283f565b604051633250574960e11b8152336004820152602490fd5b9091506020813d602011612983575b8161296260209383614aa7565b8101031261026157516001600160e01b0319811681036102615790856128c7565b3d9150612955565b6040516339e3563760e11b815260006004820152602490fd5b6129ad33614d1c565b600181540190556127d9565b6129c5600185016154ac565b6129ce81614d1c565b80546000190190556127d3565b604051633250574960e11b815260006004820152602490fd5b015190508680612778565b90600b840160005260206000209160005b601f1985168110612a575750918391600193600b95601f19811610612a3e575b505050811b0191015561278e565b015160001960f88460031b161c19169055868080612a30565b91926020600181928685015181550194019201612a10565b600b84016000526020600020601f840160051c810160208510612aaf575b601f830160051c82018110612aa357505061275c565b60008155600101612a8d565b5080612a8d565b01519050878061271b565b90600a850160005260206000209160005b601f1985168110612b1d57509183916001936101609695601f19811610612b04575b505050811b01600a840155612733565b015160001960f88460031b161c19169055878080612af4565b91926020600181928685015181550194019201612ad2565b600a85016000526020600020601f840160051c810160208510612b75575b601f830160051c82018110612b695750506126fd565b60008155600101612b53565b5080612b53565b0151905086806126b8565b600985016000526020600020906000935b601f1984168510612bdc576001945083601f19811610612bc3575b505050811b0160098301556126d0565b015160001960f88460031b161c19169055868080612bb3565b81810151835560209485019460019093019290910190612b98565b600985016000526020600020601f840160051c810160208510612c37575b601f830160051c82018110612c2b57505061269f565b60008155600101612c15565b5080612c15565b01519050868061265a565b600885016000526020600020906000935b601f1984168510612c9e576001945083601f19811610612c85575b505050811b016008830155612672565b015160001960f88460031b161c19169055868080612c75565b81810151835560209485019460019093019290910190612c5a565b600885016000526020600020601f840160051c810160208510612cf9575b601f830160051c82018110612ced575050612641565b60008155600101612cd7565b5080612cd7565b0151905086806125fc565b600785016000526020600020906000935b601f1984168510612d60576001945083601f19811610612d47575b505050811b016007830155612614565b015160001960f88460031b161c19169055868080612d37565b81810151835560209485019460019093019290910190612d1c565b600785016000526020600020601f840160051c810160208510612dbb575b601f830160051c82018110612daf5750506125e3565b60008155600101612d99565b5080612d99565b01519050868061259f565b600685016000526020600020906000935b601f1984168510612e22576001945083601f19811610612e09575b505050811b0160068301556125b7565b015160001960f88460031b161c19169055868080612df9565b81810151835560209485019460019093019290910190612dde565b600685016000526020600020601f840160051c810160208510612e7d575b601f830160051c82018110612e71575050612586565b60008155600101612e5b565b5080612e5b565b015190508680612542565b600585016000526020600020906000935b601f1984168510612ee4576001945083601f19811610612ecb575b505050811b01600583015561255a565b015160001960f88460031b161c19169055868080612ebb565b81810151835560209485019460019093019290910190612ea0565b600585016000526020600020601f840160051c810160208510612f3f575b601f830160051c82018110612f33575050612529565b60008155600101612f1d565b5080612f1d565b0151905086806124e5565b600485016000526020600020906000935b601f1984168510612fa6576001945083601f19811610612f8d575b505050811b0160048301556124fd565b015160001960f88460031b161c19169055868080612f7d565b81810151835560209485019460019093019290910190612f62565b600485016000526020600020601f840160051c810160208510613001575b601f830160051c82018110612ff55750506124cc565b60008155600101612fdf565b5080612fdf565b015190508680612488565b600385016000526020600020906000935b601f1984168510613068576001945083601f1981161061304f575b505050811b0160038301556124a0565b015160001960f88460031b161c1916905586808061303f565b81810151835560209485019460019093019290910190613024565b600385016000526020600020601f840160051c8101602085106130c3575b601f830160051c820181106130b757505061246f565b600081556001016130a1565b50806130a1565b01519050868061242b565b600285016000526020600020906000935b601f198416851061312a576001945083601f19811610613111575b505050811b016002830155612443565b015160001960f88460031b161c19169055868080613101565b818101518355602094850194600190930192909101906130e6565b600285016000526020600020601f840160051c810160208510613185575b601f830160051c82018110613179575050612412565b60008155600101613163565b5080613163565b0151905086806123ce565b600185016000526020600020906000935b601f19841685106131ec576001945083601f198116106131d3575b505050811b0160018301556123e6565b015160001960f88460031b161c191690558680806131c3565b818101518355602094850194600190930192909101906131a8565b600185016000526020600020601f840160051c810160208510613247575b601f830160051c8201811061323b5750506123b5565b60008155600101613225565b5080613225565b60405162461bcd60e51b815260206004820152601c60248201527f546f6b656e206d7573742062652067726561746572207468616e2030000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601c60248201527f546f6b656e2065786365656473206d6178696d756d20737570706c79000000006044820152606490fd5b634e487b7160e01b600052601160045260246000fd5b60405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606490fd5b60405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606490fd5b60016004350361345057336000526020906005825260ff6040600020541661341a576133c2906040518381019033825284815261339d81614a71565b5190206040518481019182528481526133b581614a71565b5190209060075490615331565b156133e45760059033600052526040600020600160ff1982541617905561227a565b6064906040519062461bcd60e51b82526004820152600f60248201526e139bdd081dda1a5d195b1a5cdd1959608a1b6044820152fd5b60405162461bcd60e51b815260048101839052600e60248201526d105b1c9958591e481b5a5b9d195960921b6044820152606490fd5b60405162461bcd60e51b815260206004820152601060248201526f14185e5b595b9d081c995c5d5a5c995960821b6044820152606490fd5b60405162461bcd60e51b8152602060048201526013602482015272135a5b9d1a5b99c81a5cc8191a5cd8589b1959606a1b6044820152606490fd5b346102615760003660031901126102615760206040516127108152f35b34610261576000366003190112610261576009546040516001600160a01b039091168152602090f35b3461026157600036600319011261026157602060ff60015460081c166040519015158152f35b346102615761028f61354036614d8e565b91614fc8565b34610261576020366003190112610261576001600160a01b036135676149e1565b166000526005602052602060ff604060002054166040519015158152f35b34610261576000366003190112610261576020600054604051908152f35b34610261576000366003190112610261576020600654604051908152f35b34610261576020366003190112610261576004356001600160401b03811161026157366023820112156102615780600401356135fc81614ac8565b9161360a6040519384614aa7565b8183526024602084019260051b820101903682116102615760248101925b82841061461e578460005b815181101561028f576136468183614f9e565b5180519060406020820151910151826000526000805160206155888339815191526020523360018060a01b0360406000205416036145e157602082015160408301516060840151608085015160a086015160c087015160e088015191610100890151936101208a0151956101408b015197604051998d60208c015260408b0161018090526101a08b016136d891614a1a565b8a8103601f190160608c01526136ed91614a1a565b898103601f190160808b015261370291614a1a565b888103601f190160a08a015261371791614a1a565b878103601f190160c089015261372c91614a1a565b868103601f190160e088015261374191614a1a565b858103601f190161010087015261375791614a1a565b848103601f190161012086015261376d91614a1a565b838103601f190161014085015261378391614a1a565b828103601f190161016084015261379991614a1a565b81810390601f198201610180840152600090528082526020016137bc9082614aa7565b8051906020012060405160208101918252602081526137da81614a71565b5190206006546137e992615331565b156145ab576040516137fa81614a71565b600881526714995d99585b195960c21b602082015261016082015281600052600460205260406000208151815560208201518051906001600160401b03821161099357819061384c6001850154614ebf565b601f8111614558575b50602090601f83116001146144e6576000926144db575b50508160011b916000199060031b1c19161760018201555b60408201518051906001600160401b0382116109935781906138a96002850154614ebf565b601f8111614488575b50602090601f83116001146144165760009261440b575b50508160011b916000199060031b1c19161760028201555b60608201518051906001600160401b0382116109935781906139066003850154614ebf565b601f81116143b8575b50602090601f83116001146143465760009261433b575b50508160011b916000199060031b1c19161760038201555b60808201518051906001600160401b0382116109935781906139636004850154614ebf565b601f81116142e8575b50602090601f83116001146142765760009261426b575b50508160011b916000199060031b1c19161760048201555b60a08201518051906001600160401b0382116109935781906139c06005850154614ebf565b601f8111614218575b50602090601f83116001146141a65760009261419b575b50508160011b916000199060031b1c19161760058201555b60c08201518051906001600160401b038211610993578190613a1d6006850154614ebf565b601f8111614148575b50602090601f83116001146140d6576000926140cb575b50508160011b916000199060031b1c19161760068201555b60e08201518051906001600160401b038211610993578190613a7a6007850154614ebf565b601f8111614078575b50602090601f831160011461400657600092613ffb575b50508160011b916000199060031b1c19161760078201555b6101008201518051906001600160401b038211610993578190613ad86008850154614ebf565b601f8111613fa8575b50602090601f8311600114613f3657600092613f2b575b50508160011b916000199060031b1c19161760088201555b6101208201518051906001600160401b038211610993578190613b366009850154614ebf565b601f8111613ed8575b50602090601f8311600114613e6657600092613e5b575b50508160011b916000199060031b1c19161760098201555b6101408201518051906001600160401b038211610993578190613b94600a850154614ebf565b601f8111613e08575b50602090601f8311600114613d9657600092613d8b575b50508160011b916000199060031b1c191617600a8201555b6101608201518051906001600160401b03821161099357613bf0600b840154614ebf565b601f8111613d44575b50602090601f8311600114613c9a577ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce794602094600b8560019a99966000805160206155e883398151915296613c7f96600092613c8f575b5050600019600383901b1c1916908b1b179101555b6040519182918583526040878401526040830190614dc3565b0390a1604051908152a101613633565b015190508d80613c51565b90600b840160005260206000209160005b601f1985168110613d2c575094602094600b6001866000805160206155e883398151915296613c7f967ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79b849e9d9a601f19811610613d13575b505050811b01910155613c66565b015160001960f88460031b161c191690558d8080613d05565b91926020600181928685015181550194019201613cab565b600b84016000526020600020601f840160051c810160208510613d84575b601f830160051c82018110613d78575050613bf9565b60008155600101613d62565b5080613d62565b015190508780613bb4565b9250600a84016000526020600020906000935b601f1984168510613ded576001945083601f19811610613dd4575b505050811b01600a820155613bcc565b015160001960f88460031b161c19169055878080613dc4565b81810151835560209485019460019093019290910190613da9565b909150600a84016000526020600020601f840160051c810160208510613e54575b90849392915b601f830160051c82018110613e45575050613b9d565b60008155859450600101613e2f565b5080613e29565b015190508780613b56565b9250600984016000526020600020906000935b601f1984168510613ebd576001945083601f19811610613ea4575b505050811b016009820155613b6e565b015160001960f88460031b161c19169055878080613e94565b81810151835560209485019460019093019290910190613e79565b909150600984016000526020600020601f840160051c810160208510613f24575b90849392915b601f830160051c82018110613f15575050613b3f565b60008155859450600101613eff565b5080613ef9565b015190508780613af8565b9250600884016000526020600020906000935b601f1984168510613f8d576001945083601f19811610613f74575b505050811b016008820155613b10565b015160001960f88460031b161c19169055878080613f64565b81810151835560209485019460019093019290910190613f49565b909150600884016000526020600020601f840160051c810160208510613ff4575b90849392915b601f830160051c82018110613fe5575050613ae1565b60008155859450600101613fcf565b5080613fc9565b015190508780613a9a565b9250600784016000526020600020906000935b601f198416851061405d576001945083601f19811610614044575b505050811b016007820155613ab2565b015160001960f88460031b161c19169055878080614034565b81810151835560209485019460019093019290910190614019565b909150600784016000526020600020601f840160051c8101602085106140c4575b90849392915b601f830160051c820181106140b5575050613a83565b6000815585945060010161409f565b5080614099565b015190508780613a3d565b9250600684016000526020600020906000935b601f198416851061412d576001945083601f19811610614114575b505050811b016006820155613a55565b015160001960f88460031b161c19169055878080614104565b818101518355602094850194600190930192909101906140e9565b909150600684016000526020600020601f840160051c810160208510614194575b90849392915b601f830160051c82018110614185575050613a26565b6000815585945060010161416f565b5080614169565b0151905087806139e0565b9250600584016000526020600020906000935b601f19841685106141fd576001945083601f198116106141e4575b505050811b0160058201556139f8565b015160001960f88460031b161c191690558780806141d4565b818101518355602094850194600190930192909101906141b9565b909150600584016000526020600020601f840160051c810160208510614264575b90849392915b601f830160051c820181106142555750506139c9565b6000815585945060010161423f565b5080614239565b015190508780613983565b9250600484016000526020600020906000935b601f19841685106142cd576001945083601f198116106142b4575b505050811b01600482015561399b565b015160001960f88460031b161c191690558780806142a4565b81810151835560209485019460019093019290910190614289565b909150600484016000526020600020601f840160051c810160208510614334575b90849392915b601f830160051c8201811061432557505061396c565b6000815585945060010161430f565b5080614309565b015190508780613926565b9250600384016000526020600020906000935b601f198416851061439d576001945083601f19811610614384575b505050811b01600382015561393e565b015160001960f88460031b161c19169055878080614374565b81810151835560209485019460019093019290910190614359565b909150600384016000526020600020601f840160051c810160208510614404575b90849392915b601f830160051c820181106143f557505061390f565b600081558594506001016143df565b50806143d9565b0151905087806138c9565b9250600284016000526020600020906000935b601f198416851061446d576001945083601f19811610614454575b505050811b0160028201556138e1565b015160001960f88460031b161c19169055878080614444565b81810151835560209485019460019093019290910190614429565b909150600284016000526020600020601f840160051c8101602085106144d4575b90849392915b601f830160051c820181106144c55750506138b2565b600081558594506001016144af565b50806144a9565b01519050878061386c565b9250600184016000526020600020906000935b601f198416851061453d576001945083601f19811610614524575b505050811b016001820155613884565b015160001960f88460031b161c19169055878080614514565b818101518355602094850194600190930192909101906144f9565b909150600184016000526020600020601f840160051c8101602085106145a4575b90849392915b601f830160051c82018110614595575050613855565b6000815585945060010161457f565b5080614579565b60405162461bcd60e51b815260206004820152600e60248201526d496e76616c69642074726169747360901b6044820152606490fd5b60405162461bcd60e51b815260206004820152601560248201527413db9b1e481bdddb995c8818d85b881c995d99585b605a1b6044820152606490fd5b83356001600160401b038111610261578201606091826023198336030112610261576040519283018381106001600160401b03821117610993576040526024820135835260448201356001600160401b038111610261576146859060243691850101614b4f565b60208401526064820135926001600160401b038411610261576146b2602094936024869536920101614cbc565b6040820152815201930192613628565b34610261576000366003190112610261576003546040516001600160a01b039091168152602090f35b34610261576040366003190112610261576147046149e1565b602435614710816152e9565b331515806147bf575b8061479f575b614787576001600160a01b039283169282918491167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a460009081526000805160206155a88339815191526020526040902080546001600160a01b0319169091179055005b60405163a9fbf51f60e01b8152336004820152602490fd5b506147a981614d55565b3360005260205260ff604060002054161561471f565b506001600160a01b038116331415614719565b34610261576020366003190112610261576004356147ef816152e9565b506000526000805160206155a8833981519152602052602060018060a01b0360406000205416604051908152f35b3461026157600036600319011261026157604051600080516020615508833981519152805482600061484e83614ebf565b9283835260209460019186600182169182600014610fb257505060011461487d575050610f5492500383614aa7565b859250600052600080516020615628833981519152906000915b8583106148af575050610f5493508201018580610f46565b80548389018501528794508693909201918101614897565b346102615760203660031901126102615760043563ffffffff60e01b8116809103610261576020906380ac58cd60e01b8114908115614924575b8115614913575b506040519015158152f35b6301ffc9a760e01b14905082614908565b635b5e139f60e01b81149150614901565b346102615760203660031901126102615761494e6149e1565b6149566152b0565b6009549060ff8260a01c166121e1576001600160a01b03166001600160a01b03199190911681176009556040519081527f6e66ab22238a5471005895947c8f57db923c2a9c9c73180eff80864c21295c1b90602090a17f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6040600054815190600082526020820152a1005b600435906001600160a01b038216820361026157565b60005b838110614a0a5750506000910152565b81810151838201526020016149fa565b90602091614a33815180928185528580860191016149f7565b601f01601f1916010190565b602435906001600160a01b038216820361026157565b61018081019081106001600160401b0382111761099357604052565b604081019081106001600160401b0382111761099357604052565b602081019081106001600160401b0382111761099357604052565b90601f801991011681019081106001600160401b0382111761099357604052565b6001600160401b0381116109935760051b60200190565b6001600160401b03811161099357601f01601f191660200190565b929192614b0682614adf565b91614b146040519384614aa7565b829481845281830111610261578281602093846000960137010152565b9080601f8301121561026157816020614b4c93359101614afa565b90565b9190610180838203126102615760405190614b6982614a55565b8193803583526020810135916001600160401b03928381116102615781614b91918401614b31565b602085015260408201358381116102615781614bae918401614b31565b604085015260608201358381116102615781614bcb918401614b31565b606085015260808201358381116102615781614be8918401614b31565b608085015260a08201358381116102615781614c05918401614b31565b60a085015260c08201358381116102615781614c22918401614b31565b60c085015260e08201358381116102615781614c3f918401614b31565b60e0850152610100808301358481116102615782614c5e918501614b31565b90850152610120808301358481116102615782614c7c918501614b31565b90850152610140808301358481116102615782614c9a918501614b31565b90850152610160928383013590811161026157614cb79201614b31565b910152565b9080601f83011215610261576020908235614cd681614ac8565b93614ce46040519586614aa7565b81855260208086019260051b82010192831161026157602001905b828210614d0d575050505090565b81358152908301908301614cff565b6001600160a01b031660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793036020526040902090565b6001600160a01b031660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020526040902090565b6060906003190112610261576001600160a01b0390600435828116810361026157916024359081168103610261579060443590565b90614b4c91614eab614e97614e83614e6f614e5d614e4b614e39614e27614e15614e028b60208c816101809282849351865201519301528d0190614a1a565b60408b01518c6040818403910152614a1a565b60608a01518b820360608d0152614a1a565b60808901518a820360808c0152614a1a565b60a088015189820360a08b0152614a1a565b60c087015188820360c08a0152614a1a565b60e086015187820360e0890152614a1a565b610100808601519087830390880152614a1a565b610120808501519086830390870152614a1a565b610140808401519085830390860152614a1a565b916101608092015191818403910152614a1a565b90600182811c92168015614eef575b6020831014614ed957565b634e487b7160e01b600052602260045260246000fd5b91607f1691614ece565b90604051918260008254614f0c81614ebf565b90818452602094600191600181169081600014614f7c5750600114614f3d575b505050614f3b92500383614aa7565b565b600090815285812095935091905b818310614f64575050614f3b9350820101388080614f2c565b85548884018501529485019487945091830191614f4b565b92505050614f3b94925060ff191682840152151560051b820101388080614f2c565b8051821015614fb25760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03828116939184156129db57826000958187526000805160206155888339815191529586602052604097858982205416978892331515806150ae575b509061503d7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef93928561508f57614d1c565b8054600101905585825260205289812080546001600160a01b0319168517905580a4169283830361506e5750505050565b6064945051926364283d7b60e01b8452600484015260248301526044820152fd5b615098886154ac565b6150a186614d1c565b8054600019019055614d1c565b9193509193945080615105575b156150cc579187918794933861500b565b8887896150e9576024915190637e27328960e01b82526004820152fd5b604491519063177e802f60e01b82523360048301526024820152fd5b503388148015615138575b806150bb57508683526000805160206155a883398151915260205233868a85205416146150bb565b5061514288614d55565b33845260205260ff8984205416615110565b3d1561517f573d9061516582614adf565b916151736040519384614aa7565b82523d6000602084013e565b606090565b6040519061519182614a55565b816000815261016060609182602082015282604082015282808201528260808201528260a08201528260c08201528260e08201528261010082015282610120820152826101408201520152565b602081830312610261578051906001600160401b038211610261570181601f8201121561026157805161521081614adf565b9261521e6040519485614aa7565b8184526020828401011161026157614b4c91602080850191016149f7565b6001600160a01b039081169081156152975760008051602061554883398151915280546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b604051631e4fbdf760e01b815260006004820152602490fd5b600080516020615548833981519152546001600160a01b031633036152d157565b60405163118cdaa760e01b8152336004820152602490fd5b600081815260008051602061558883398151915260205260409020546001600160a01b0316908115615319575090565b60249060405190637e27328960e01b82526004820152fd5b929091906000915b84518310156153805761534c8386614f9e565b519060008282101561536f5750600052602052600160406000205b920191615339565b604091600193825260205220615367565b915092501490565b9293823b615398575b5050505050565b6153dc9060018060a01b038094169560405194859481630a85bd0160e11b988988521660048701521660248501526044840152608060648401526084830190614a1a565b03906020816000938185885af19082908261545c575b505061542a5782615401615154565b805191908261542357604051633250574960e11b815260048101839052602490fd5b9050602001fd5b6001600160e01b0319160361544457503880808080615391565b60249060405190633250574960e11b82526004820152fd5b909192506020813d6020116154a4575b8161547960209383614aa7565b810103126154a05751906001600160e01b03198216820361549d57509038806153f2565b80fd5b5080fd5b3d915061546c565b6000526000805160206155a883398151915260205260406000206001600160601b0360a01b8154169055565b60ff6000805160206155c88339815191525460401c16156154f557565b604051631afcd79f60e31b8152600490fdfe80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300f4bad0a69248f59680a4f2b3000328cec71a413447c96781cfe5996daa8c456e9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300f3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee380bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930280bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079304f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00de7257f17940ea914bf0c19ce7ccf993ff9c177142446914b06742a64d3af89d80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930137c58c799b6609234b945e882912ee9ad34948a1dfaa20a97485e1a7752bbf81a2646970667358221220be35896d37e7523a27b5e8bd463baabb880a43fec26b4d825b05b4912785548e64736f6c63430008160033
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.