Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 11 from a total of 11 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint Public | 2517758 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517727 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517612 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517601 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517576 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517548 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517448 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Mint Public | 2517387 | 88 days ago | IN | 15 APE | 0.00077599 | ||||
Mint Public | 2517227 | 88 days ago | IN | 15 APE | 0.00077599 | ||||
Mint Public | 2517150 | 88 days ago | IN | 13.45 APE | 0.00077599 | ||||
Set Approval For... | 2515302 | 88 days ago | IN | 0 APE | 0.00117697 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PufflesERC721Main
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "erc721a-upgradeable/contracts/extensions/ERC721AQueryableUpgradeable.sol"; import "@openzeppelin/[email protected]/access/OwnableUpgradeable.sol"; import "@openzeppelin/[email protected]/token/common/ERC2981Upgradeable.sol"; import "@openzeppelin/[email protected]/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/[email protected]/finance/PaymentSplitterUpgradeable.sol"; import "./ICommon.sol"; struct SaleState { uint64 numPhases; mapping(uint256 => PhaseSettings) phases; } error PhaseNotActive(); error InvalidPhase(); /// @title ERC-721 Multi-Phase Drop Contract contract PufflesERC721Main is ERC721AQueryableUpgradeable, OwnableUpgradeable, ERC2981Upgradeable, PaymentSplitterUpgradeable { string public _baseTokenURI; SaleState public saleState; BaseSettings public baseSettings; uint256 public maxSupply; address[] public withdrawAddresses; mapping(address => mapping(uint256 => uint64)) private amountMintedForPhase; //setting public true because now it can be started with timestamp bool public isPublicActive = true; bool private allowBurning; event TokensMinted(address indexed to, uint256 quantity); event TokenBurned(address indexed owner, uint256 tokenId); event TokensAirdropped(uint256 numRecipients, uint256 numTokens); event PhasesActivated(uint256[] phaseIds, bool activatedPublic); event PhasesPaused(uint256[] phaseIds, bool pausedPublic); event PhaseEnded(uint256 phaseIds); event BurnStatusChanged(bool burnActive); event PhaseSettingsUpdated(uint256 phaseId, PhaseSettings settings); event BaseSettingsUpdated(BaseSettings settings); event BaseURIUpdated(string baseURI); event RoyaltyUpdated(address royaltyAddress, uint96 royaltyAmount); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( string memory _name, string memory _symbol, string memory _baseUri, RoyaltySettings calldata _royaltySettings, PhaseSettings[] calldata _phases, BaseSettings calldata _baseSettings, PaymentSplitterSettings calldata _paymentSplitterSettings, uint256 _maxIntendedSupply, bool _allowBurning, address _deployer ) public initializerERC721A initializer { __ERC721A_init(_name, _symbol); __Ownable_init(); __PaymentSplitter_init( _paymentSplitterSettings.payees, _paymentSplitterSettings.shares ); uint64 numPhases = uint64(_phases.length); uint256 supplyValidationCount = _baseSettings.maxSupply; for (uint256 i = 0; i < numPhases; ) { saleState.phases[i] = _phases[i]; supplyValidationCount += _phases[i].maxSupply; // numPhases has a maximum value of 2^64 - 1 unchecked { ++i; } } require( supplyValidationCount == _maxIntendedSupply, "Supply of all phases must equal maxIntendedSupply" ); _baseTokenURI = _baseUri; withdrawAddresses = _paymentSplitterSettings.payees; saleState.numPhases = numPhases; baseSettings = _baseSettings; allowBurning = _allowBurning; maxSupply = _maxIntendedSupply; _setDefaultRoyalty( _royaltySettings.royaltyAddress, _royaltySettings.royaltyAmount ); transferOwnership(_deployer); isPublicActive = true; } // ========= EXTERNAL MINTING METHODS ========= /** * @notice Mint tokens for an allowlisted phase * @dev Calling this function for a phase that doesn't have an allowlist will fail */ function mintPhaseAllowlist( uint256 phaseIndex, uint64 quantity, bytes32[] calldata proof ) external payable { uint64 updatedAmountMinted = _checkAllowlistPhaseMintConditions( msg.sender, quantity, proof, phaseIndex, msg.value ); _checkGlobalPerWalletMax(msg.sender, quantity); saleState.phases[phaseIndex].amountMinted += quantity; amountMintedForPhase[msg.sender][phaseIndex] = updatedAmountMinted; _mint(msg.sender, quantity); emit TokensMinted(msg.sender, quantity); } /** * @notice Mint tokens for a non-allowlist phase. * @dev Calling this function for a phase that has an allowlist will fail */ function mintPhase(uint256 phaseIndex, uint64 quantity) external payable { uint64 updatedAmountMinted = _checkPhaseMintConditions( msg.sender, quantity, phaseIndex, msg.value ); _checkGlobalPerWalletMax(msg.sender, quantity); saleState.phases[phaseIndex].amountMinted += quantity; amountMintedForPhase[msg.sender][phaseIndex] = updatedAmountMinted; _mint(msg.sender, quantity); emit TokensMinted(msg.sender, quantity); } /** * @notice Mint tokens in the public sale */ function mintPublic(uint64 quantity) external payable { uint64 updatedAmountMinted = _checkPublicMintConditions( quantity, msg.value ); _checkGlobalPerWalletMax(msg.sender, quantity); baseSettings.amountMinted = updatedAmountMinted; _mint(msg.sender, quantity); emit TokensMinted(msg.sender, quantity); } /** * @notice Mint tokens in all possible phases (including public sale) */ function mintBatch( uint64[] calldata quantities, bytes32[][] calldata proofs, uint256[] calldata phaseIndices, uint64 publicQuantity ) external payable { uint256 phaseLength = phaseIndices.length; if ( phaseLength > saleState.numPhases || phaseLength != quantities.length || phaseLength != proofs.length ) { revert InvalidPhase(); } uint256 balance = msg.value; uint256 quantityToMint; for (uint256 i = 0; i < phaseLength; ) { uint64 updatedAmount; uint256 phaseIndex = phaseIndices[i]; uint64 quantity = quantities[i]; bytes32[] calldata proof = proofs[i]; PhaseSettings storage phase = saleState.phases[phaseIndex]; uint256 priceForPhase = phase.price * quantity; // Since price is strictly checked in the _check* functions below, // we have an additional check here to ensure that the balance doesn't underflow if (balance < priceForPhase) { revert InvalidPrice(); } // if the phase has no allowlist, the merkleRoot will be zeroed out. if (phase.merkleRoot == bytes32(0)) { updatedAmount = _checkPhaseMintConditions( msg.sender, quantity, phaseIndex, priceForPhase ); } else { updatedAmount = _checkAllowlistPhaseMintConditions( msg.sender, quantity, proof, phaseIndex, priceForPhase ); } // quantity & phaseLength have a maximum value of 2^64 - 1 // balance underflow is checked above unchecked { saleState.phases[phaseIndex].amountMinted += quantity; amountMintedForPhase[msg.sender][phaseIndex] = updatedAmount; balance -= priceForPhase; quantityToMint += quantity; ++i; } } uint256 totalMintQuantity = quantityToMint; if (publicQuantity > 0) { _checkPublicMintConditions(publicQuantity, balance); // publicQuantity has a max value of 2^64 - 1 unchecked { baseSettings.amountMinted += publicQuantity; totalMintQuantity += publicQuantity; } } _checkGlobalPerWalletMax(msg.sender, totalMintQuantity); _mint(msg.sender, totalMintQuantity); emit TokensMinted(msg.sender, totalMintQuantity); } /** * @notice Burn a token, if the contract allows for it */ function burn(uint256 tokenId) external { if (!allowBurning) { revert BurningNotAllowed(); } _burn(tokenId, true); emit TokenBurned(msg.sender, tokenId); } // ========= OWNER METHODS ========= /** * @notice Perform a batch airdrop for a particular phase. * @dev Minted tokens are pulled from the phase that is specified in the airdropper. */ function airdropForPhase( uint256 phaseIndex, uint64[] calldata quantities, address[] calldata recipients ) external onlyOwner { uint256 numRecipients = recipients.length; uint256 totalAirdropped; if (numRecipients != quantities.length) revert InvalidAirdrop(); PhaseSettings storage phase = saleState.phases[phaseIndex]; for (uint256 i = 0; i < numRecipients; ) { uint64 updatedAmountMinted = phase.amountMinted + quantities[i]; if (updatedAmountMinted > phase.maxSupply) { revert SoldOut(); } // airdrops are not subject to the per-wallet mint limits, // but we track how much is minted for the phase phase.amountMinted = updatedAmountMinted; totalAirdropped += quantities[i]; _mint(recipients[i], quantities[i]); // numRecipients has a maximum value of 2^256 - 1 unchecked { ++i; } } emit TokensAirdropped(numRecipients, totalAirdropped); } /** * @notice Perform a batch airdrop for the public phase. * @dev Minted tokens are pulled from the public phase. */ function airdropPublic( uint64[] calldata quantities, address[] calldata recipients ) external onlyOwner { uint256 numRecipients = recipients.length; uint256 totalAirdropped; if (numRecipients != quantities.length) revert InvalidAirdrop(); for (uint256 i = 0; i < numRecipients; ) { uint64 updatedAmountMinted = baseSettings.amountMinted + quantities[i]; if (updatedAmountMinted > baseSettings.maxSupply) { revert SoldOut(); } // airdrops are not subject to the per-wallet mint limits, // but we track how much is minted for the phase baseSettings.amountMinted = updatedAmountMinted; totalAirdropped += quantities[i]; _mint(recipients[i], quantities[i]); // numRecipients has a maximum value of 2^256 - 1 unchecked { ++i; } } emit TokensAirdropped(numRecipients, totalAirdropped); } /** * @notice Specify which phases are active. * Public sale can be activated by setting `activatePublic` to true. */ function activatePhases( uint256[] calldata phaseIndices, bool activatePublic ) external onlyOwner { uint256 numPhases = phaseIndices.length; // activate all the phases provided in phaseIndices for (uint256 i = 0; i < numPhases; ) { uint256 phaseIndex = phaseIndices[i]; if (phaseIndex >= saleState.numPhases) { // phaseIndex is out of bounds revert InvalidPhase(); } saleState.phases[phaseIndices[i]].isActive = true; // numPhases has a maximum value of 2^256 - 1 unchecked { ++i; } } if (activatePublic) { isPublicActive = true; } emit PhasesActivated(phaseIndices, activatePublic); } /** * @notice Specify which phases are inactive (paused). * Public sale can be paused by setting `pausePublic` to true. * Pausing is separate from ending, since ending permanently closes the phase. */ function pausePhases( uint256[] calldata phaseIndices, bool pausePublic ) external onlyOwner { uint256 numPhases = phaseIndices.length; for (uint256 i = 0; i < numPhases; ) { uint256 phaseIndex = phaseIndices[i]; if (phaseIndex >= saleState.numPhases) { // phaseIndex is out of bounds revert InvalidPhase(); } saleState.phases[phaseIndex].isActive = false; // numPhases has a maximum value of 2^256 - 1 unchecked { ++i; } } // calling this function with pausePublic=false only indicates the public sale // is not intended to be paused, but it does not pause it. if (pausePublic) { isPublicActive = false; } emit PhasesPaused(phaseIndices, pausePublic); } /** * @notice If enabled, the token can be burned, for approved operators. * @dev The burn method will revert unless this is enabled */ function toggleBurning() external onlyOwner { allowBurning = !allowBurning; emit BurnStatusChanged(allowBurning); } /** * @notice Permanently closes a phase by capping the supply & releasing it */ function endPhase(uint256 phaseIndex) public onlyOwner { PhaseSettings storage phase = saleState.phases[phaseIndex]; // if the phase never had supply, there is nothing to do if (phase.maxSupply == 0) { revert InvalidPhase(); } // transfer the remaining supply into the base settings (used for public sale accounting) baseSettings.maxSupply += phase.maxSupply - phase.amountMinted; // remove the supply from the phase phase.maxSupply = 0; emit PhaseEnded(phaseIndex); } function endPhases(uint64[] calldata phaseIndices) external onlyOwner { uint256 phaseIndicesLength = phaseIndices.length; // ensure that phaseIndices argument will only ever be as large as the number of phases if (phaseIndicesLength > saleState.numPhases) { revert InvalidPhase(); } for (uint256 i = 0; i < phaseIndicesLength; ) { endPhase(phaseIndices[i]); // phaseIndicesLength has a maximum value of 2^256 - 1 unchecked { ++i; } } } /** * @notice Updates the minting rules for a particular phase * @dev supply & amountMinted are not changeable */ function updatePhaseSettings( uint256 phaseIndex, PhaseSettings calldata phase ) external onlyOwner { uint64 existingAmountMinted = saleState.phases[phaseIndex].amountMinted; uint64 existingMaxSupply = saleState.phases[phaseIndex].maxSupply; bool existingStatus = saleState.phases[phaseIndex].isActive; saleState.phases[phaseIndex] = phase; // ensure that the amountMinted, maxSupply, and status values cannot be set saleState.phases[phaseIndex].amountMinted = existingAmountMinted; saleState.phases[phaseIndex].maxSupply = existingMaxSupply; saleState.phases[phaseIndex].isActive = existingStatus; emit PhaseSettingsUpdated(phaseIndex, phase); } /** * @notice Updates the the base minting settings * The global maxPerWallet setting applies to all phases * Pricing and other fields will apply to the public sale * * @dev maxSupply & amountMinted are not changeable */ function updateBaseSettings( BaseSettings calldata _baseSettings ) external onlyOwner { uint64 existingMaxSupply = baseSettings.maxSupply; uint64 existingAmountMinted = baseSettings.amountMinted; baseSettings = _baseSettings; // ensure that the maxSupply & amountMinted value cannot be set baseSettings.maxSupply = existingMaxSupply; baseSettings.amountMinted = existingAmountMinted; emit BaseSettingsUpdated(_baseSettings); } /** * @dev Payment can be pulled via PaymentSplitter.release * this method is provided for convenience to release all payee funds */ function withdraw() external onlyOwner { uint256 numAddresses = withdrawAddresses.length; for (uint256 i = 0; i < numAddresses; ) { address payable withdrawAddress = payable(withdrawAddresses[i]); if (releasable(withdrawAddress) > 0) { release(withdrawAddress); } // numAddresses has a maximum value of 2^256 - 1 unchecked { ++i; } } } function setBaseURI(string memory baseURI) external onlyOwner { _baseTokenURI = baseURI; emit BaseURIUpdated(baseURI); } function setRoyaltyInfo( address receiver, uint96 feeBasisPoints ) external onlyOwner { _setDefaultRoyalty(receiver, feeBasisPoints); emit RoyaltyUpdated(receiver, feeBasisPoints); } // ========= VIEW METHODS ========= function _startTokenId() internal view virtual override returns (uint256) { return 1; } function _checkAllowlistPhaseMintConditions( address wallet, uint64 quantity, bytes32[] calldata proof, uint256 phaseIndex, uint256 balance ) internal view returns (uint64) { PhaseSettings storage phase = saleState.phases[phaseIndex]; if (!phase.isActive) { revert PhaseNotActive(); } if (block.timestamp < phase.startTime) { revert PhaseTimeNotStarted(); } // there should be a valid merkle root for the phase if (phase.merkleRoot == bytes32(0)) { revert InvalidMintFunction(); } if (phase.amountMinted + quantity > phase.maxSupply) { revert SoldOut(); } if (balance != quantity * phase.price) { revert InvalidPrice(); } if ( !MerkleProof.verify( proof, phase.merkleRoot, keccak256(abi.encodePacked(wallet)) ) ) { revert InvalidProof(); } uint256 amountMinted = amountMintedForPhase[wallet][phaseIndex]; uint256 updatedAmountMinted = amountMinted + quantity; // phases can have a maxPerWallet if ( phase.maxPerWallet > 0 && updatedAmountMinted > phase.maxPerWallet ) { revert ExceedMaxPerWallet(); } return uint64(updatedAmountMinted); } function _checkPhaseMintConditions( address wallet, uint256 quantity, uint256 phaseIndex, uint256 balance ) internal view returns (uint64) { PhaseSettings storage phase = saleState.phases[phaseIndex]; if (!phase.isActive) { revert PhaseNotActive(); } if (phase.startTime != 0 && block.timestamp < phase.startTime) { revert PhaseTimeNotStarted(); } if (block.timestamp >= phase.endTime && phase.endTime != 0) { revert PhaseTimeEnded(); } // the phase should not have a merkleRoot if (phase.merkleRoot != bytes32(0)) { revert InvalidMintFunction(); } if (phase.amountMinted + quantity > phase.maxSupply) { revert SoldOut(); } if (balance != quantity * phase.price) { revert InvalidPrice(); } uint256 amountMinted = amountMintedForPhase[wallet][phaseIndex]; uint256 updatedAmountMinted = amountMinted + quantity; // phases can have a maxPerWallet if ( phase.maxPerWallet > 0 && updatedAmountMinted > phase.maxPerWallet ) { revert ExceedMaxPerWallet(); } return uint64(updatedAmountMinted); } function _checkPublicMintConditions( uint256 quantity, uint256 balance ) internal view returns (uint64) { if (!isPublicActive) { revert PhaseNotActive(); } if (baseSettings.startTime != 0 && block.timestamp < baseSettings.startTime) { revert PhaseTimeNotStarted(); } uint256 updatedAmountMinted = baseSettings.amountMinted + quantity; uint256 totalLeftSupply = calculateTotalLeftSupply(); if (updatedAmountMinted > totalLeftSupply) { revert SoldOut(); } if (balance != quantity * baseSettings.price) { revert InvalidPrice(); } return uint64(updatedAmountMinted); } function calculateTotalLeftSupply() public view returns (uint256) { uint256 totalLeftSupply = baseSettings.maxSupply; for (uint256 i = 0; i < saleState.numPhases; i++) { PhaseSettings storage phase = saleState.phases[i]; // Check if the phase's end time has passed if (block.timestamp >= phase.endTime && phase.endTime != 0) { // Calculate the remaining supply for this phase uint256 leftSupply = phase.maxSupply - phase.amountMinted; totalLeftSupply += leftSupply; } } return totalLeftSupply; } function _checkGlobalPerWalletMax( address wallet, uint256 quantity ) internal view { if ( baseSettings.maxPerWallet > 0 && _numberMinted(wallet) + quantity > baseSettings.maxPerWallet ) { revert ExceedMaxPerWallet(); } } function getDataForPhase( uint256 phaseIndex ) external view returns (PhaseSettings memory) { return saleState.phases[phaseIndex]; } function getMintBalance(address wallet) external view returns (uint256) { return _numberMinted(wallet); } function getAmountMintedForPhase( uint256 phaseIndex, address wallet ) external view returns (uint64) { return amountMintedForPhase[wallet][phaseIndex]; } function getAmountMintedForOwner( address wallet ) external view returns (uint256[] memory) { uint256[] memory amountMintedPerPhase = new uint256[]( saleState.numPhases + 1 ); for (uint64 i = 0; i < saleState.numPhases; ) { amountMintedPerPhase[i] = amountMintedForPhase[wallet][i]; // numPhases has a maximum value of 2^64 - 1 unchecked { ++i; } } amountMintedPerPhase[saleState.numPhases] = _numberMinted(wallet); return amountMintedPerPhase; } /** * @dev See {ERC721-_baseURI}. */ function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function supportsInterface( bytes4 interfaceId ) public view virtual override(IERC721AUpgradeable, ERC721AUpgradeable, ERC2981Upgradeable) returns (bool) { return ERC721AUpgradeable.supportsInterface(interfaceId) || ERC2981Upgradeable.supportsInterface(interfaceId); } // ========= OPERATOR FILTERER OVERRIDES ========= function setApprovalForAll( address operator, bool approved ) public override(ERC721AUpgradeable, IERC721AUpgradeable) { super.setApprovalForAll(operator, approved); } function approve( address operator, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) { super.approve(operator, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/[email protected]/proxy/Clones.sol"; import "@openzeppelin/[email protected]/access/AccessControl.sol"; import "./PufflesERC721Main.sol"; contract PufflesDeployFactory is AccessControl { address private drop721Implementation; event ContractCreated(address creator, address contractAddress); constructor() { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); } function update721Implementation( address newImplementation ) external onlyRole(DEFAULT_ADMIN_ROLE) { drop721Implementation = newImplementation; } function get721ImplementationAddress() external view returns (address) { return drop721Implementation; } function deploy721Drop( string memory _name, string memory _symbol, string memory _baseUri, RoyaltySettings calldata _royaltySettings, PhaseSettings[] calldata _phases, BaseSettings calldata _baseSettings, PaymentSplitterSettings calldata _paymentSplitterSettings, uint256 _maxIntendedSupply, bool _allowBurning ) external { require(drop721Implementation != address(0), "Implementation contract not set"); address payable clone = payable(Clones.clone(drop721Implementation)); PufflesERC721Main(clone).initialize( _name, _symbol, _baseUri, _royaltySettings, _phases, _baseSettings, _paymentSplitterSettings, _maxIntendedSupply, _allowBurning, msg.sender ); emit ContractCreated(msg.sender, clone); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; error InvalidPrice(); error SoldOut(); error ExceedMaxPerWallet(); error InvalidProof(); error InvalidMintFunction(); error InvalidAirdrop(); error BurningNotAllowed(); error PhaseTimeNotStarted(); error PhaseTimeEnded(); struct PaymentSplitterSettings { address[] payees; uint256[] shares; } struct RoyaltySettings { address royaltyAddress; uint96 royaltyAmount; } struct PhaseSettings { /// @dev phase supply. This can be released to public by ending the phase. uint64 maxSupply; /// @dev tracks the total amount minted in the phase uint64 amountMinted; /// @dev wallet maximum for the phase uint64 maxPerWallet; /// @dev merkle root for the phase (if applicable, otherwise bytes32(0)) bytes32 merkleRoot; /// @dev whether the phase is active bool isActive; /// @dev price for the phase (or free if 0) uint256 price; /// @dev start time for phase uint256 startTime; /// @dev end time fot phase uint256 endTime; } struct BaseSettings { /// @dev public sale supply. ending a phase will carry supply into this value uint64 maxSupply; /// @dev global wallet maximum across all phases (including public) uint64 maxPerWallet; /// @dev tracks the total amount minted in the public sale uint64 amountMinted; /// @dev price for the public sale (or free if 0) uint256 price; /// @dev start time for phase uint256 startTime; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol) pragma solidity ^0.8.0; import "../token/ERC20/utils/SafeERC20Upgradeable.sol"; import "../utils/AddressUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the * time of contract deployment and can't be updated thereafter. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitterUpgradeable is Initializable, ContextUpgradeable { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased(IERC20Upgradeable indexed token, address to, uint256 amount); event PaymentReceived(address from, uint256 amount); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; mapping(IERC20Upgradeable => uint256) private _erc20TotalReleased; mapping(IERC20Upgradeable => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ function __PaymentSplitter_init(address[] memory payees, uint256[] memory shares_) internal onlyInitializing { __PaymentSplitter_init_unchained(payees, shares_); } function __PaymentSplitter_init_unchained(address[] memory payees, uint256[] memory shares_) internal onlyInitializing { require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch"); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20Upgradeable token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20Upgradeable token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Getter for the amount of payee's releasable Ether. */ function releasable(address account) public view returns (uint256) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } /** * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an * IERC20 contract. */ function releasable(IERC20Upgradeable token, address account) public view returns (uint256) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _totalReleased is the sum of all values in _released. // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. _totalReleased += payment; unchecked { _released[account] += payment; } AddressUpgradeable.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20Upgradeable token, address account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 payment = releasable(token, account); require(payment != 0, "PaymentSplitter: account is not due payment"); // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment" // cannot overflow. _erc20TotalReleased[token] += payment; unchecked { _erc20Released[token][account] += payment; } SafeERC20Upgradeable.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require(account != address(0), "PaymentSplitter: account is the zero address"); require(shares_ > 0, "PaymentSplitter: shares are 0"); require(_shares[account] == 0, "PaymentSplitter: account already has shares"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[43] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @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. */ library MerkleProof { /** * @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. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ 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 leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(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}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ 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. * * 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). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild 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 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // 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[](totalHashes); 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 for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild 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 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // 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[](totalHashes); 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 for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981Upgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryableUpgradeable.sol'; import '../ERC721AUpgradeable.sol'; import '../ERC721A__Initializable.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryableUpgradeable is ERC721A__Initializable, ERC721AUpgradeable, IERC721AQueryableUpgradeable { function __ERC721AQueryable_init() internal onlyInitializingERC721A { __ERC721AQueryable_init_unchained(); } function __ERC721AQueryable_init_unchained() internal onlyInitializingERC721A {} /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @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) { 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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 Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol'; abstract contract ERC721A__Initializable { using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializerERC721A() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require( ERC721A__InitializableStorage.layout()._initializing ? _isConstructor() : !ERC721A__InitializableStorage.layout()._initialized, 'ERC721A__Initializable: contract is already initialized' ); bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = true; ERC721A__InitializableStorage.layout()._initialized = true; } _; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializingERC721A() { require( ERC721A__InitializableStorage.layout()._initializing, 'ERC721A__Initializable: contract is not initializing' ); _; } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AUpgradeable.sol'; import {ERC721AStorage} from './ERC721AStorage.sol'; import './ERC721A__Initializable.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721ReceiverUpgradeable { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable { using ERC721AStorage for ERC721AStorage.Layout; // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // CONSTRUCTOR // ============================================================= function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A { ERC721AStorage.layout()._name = name_; ERC721AStorage.layout()._symbol = symbol_; ERC721AStorage.layout()._currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return ERC721AStorage.layout()._currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return ERC721AStorage.layout()._currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return ERC721AStorage.layout()._burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = ERC721AStorage.layout()._packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); ERC721AStorage.layout()._packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return ERC721AStorage.layout()._name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return ERC721AStorage.layout()._symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(ERC721AStorage.layout()._packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (ERC721AStorage.layout()._packedOwnerships[index] == 0) { ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = ERC721AStorage.layout()._packedOwnerships[tokenId]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken(); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = ERC721AStorage.layout()._packedOwnerships[--tokenId]; } if (packed == 0) continue; return packed; } } // Otherwise, the data exists and is not burned. We can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. return packed; } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return ERC721AStorage.layout()._tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return ERC721AStorage.layout()._operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds, ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`. ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (bytes4 retval) { return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); ERC721AStorage.layout()._currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); ERC721AStorage.layout()._currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = ERC721AStorage.layout()._currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (ERC721AStorage.layout()._currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck) if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } ERC721AStorage.layout()._tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. ERC721AStorage.layout()._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { ERC721AStorage.layout()._burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = ERC721AStorage.layout()._packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); ERC721AStorage.layout()._packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721AUpgradeable.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryableUpgradeable is IERC721AUpgradeable { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * 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[EIP 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 v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return 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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev 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^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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^256 / 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^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. 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^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // 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^256. Since the preconditions guarantee that the outcome is // less than 2^256, 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; } } /** * @notice 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) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { 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 log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 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); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721AUpgradeable { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base storage for the initialization function for upgradeable diamond facet contracts **/ library ERC721A__InitializableStorage { struct Layout { /* * Indicates that the contract has been initialized. */ bool _initialized; /* * Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library ERC721AStorage { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } struct Layout { // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 _currentIndex; // The number of tokens burned. uint256 _burnCounter; // Token name string _name; // Token symbol string _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) _operatorApprovals; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @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[EIP 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 v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [] }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BurningNotAllowed","type":"error"},{"inputs":[],"name":"ExceedMaxPerWallet","type":"error"},{"inputs":[],"name":"InvalidAirdrop","type":"error"},{"inputs":[],"name":"InvalidMintFunction","type":"error"},{"inputs":[],"name":"InvalidPhase","type":"error"},{"inputs":[],"name":"InvalidPrice","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PhaseNotActive","type":"error"},{"inputs":[],"name":"PhaseTimeEnded","type":"error"},{"inputs":[],"name":"PhaseTimeNotStarted","type":"error"},{"inputs":[],"name":"SoldOut","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","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":[{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"}],"indexed":false,"internalType":"struct BaseSettings","name":"settings","type":"tuple"}],"name":"BaseSettingsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"burnActive","type":"bool"}],"name":"BurnStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"phaseIds","type":"uint256"}],"name":"PhaseEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"phaseId","type":"uint256"},{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"indexed":false,"internalType":"struct PhaseSettings","name":"settings","type":"tuple"}],"name":"PhaseSettingsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"phaseIds","type":"uint256[]"},{"indexed":false,"internalType":"bool","name":"activatedPublic","type":"bool"}],"name":"PhasesActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"phaseIds","type":"uint256[]"},{"indexed":false,"internalType":"bool","name":"pausedPublic","type":"bool"}],"name":"PhasesPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"royaltyAddress","type":"address"},{"indexed":false,"internalType":"uint96","name":"royaltyAmount","type":"uint96"}],"name":"RoyaltyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"numRecipients","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"numTokens","type":"uint256"}],"name":"TokensAirdropped","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"TokensMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"_baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"phaseIndices","type":"uint256[]"},{"internalType":"bool","name":"activatePublic","type":"bool"}],"name":"activatePhases","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"},{"internalType":"uint64[]","name":"quantities","type":"uint64[]"},{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"airdropForPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"quantities","type":"uint64[]"},{"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"airdropPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseSettings","outputs":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"calculateTotalLeftSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"}],"name":"endPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"phaseIndices","type":"uint64[]"}],"name":"endPhases","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getAmountMintedForOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"},{"internalType":"address","name":"wallet","type":"address"}],"name":"getAmountMintedForPhase","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"}],"name":"getDataForPhase","outputs":[{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct PhaseSettings","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getMintBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_baseUri","type":"string"},{"components":[{"internalType":"address","name":"royaltyAddress","type":"address"},{"internalType":"uint96","name":"royaltyAmount","type":"uint96"}],"internalType":"struct RoyaltySettings","name":"_royaltySettings","type":"tuple"},{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct PhaseSettings[]","name":"_phases","type":"tuple[]"},{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"}],"internalType":"struct BaseSettings","name":"_baseSettings","type":"tuple"},{"components":[{"internalType":"address[]","name":"payees","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct PaymentSplitterSettings","name":"_paymentSplitterSettings","type":"tuple"},{"internalType":"uint256","name":"_maxIntendedSupply","type":"uint256"},{"internalType":"bool","name":"_allowBurning","type":"bool"},{"internalType":"address","name":"_deployer","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":"isPublicActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"quantities","type":"uint64[]"},{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"},{"internalType":"uint256[]","name":"phaseIndices","type":"uint256[]"},{"internalType":"uint64","name":"publicQuantity","type":"uint64"}],"name":"mintBatch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"},{"internalType":"uint64","name":"quantity","type":"uint64"}],"name":"mintPhase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"},{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mintPhaseAllowlist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"quantity","type":"uint64"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","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":[{"internalType":"uint256[]","name":"phaseIndices","type":"uint256[]"},{"internalType":"bool","name":"pausePublic","type":"bool"}],"name":"pausePhases","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"saleState","outputs":[{"internalType":"uint64","name":"numPhases","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeBasisPoints","type":"uint96"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"toggleBurning","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"}],"internalType":"struct BaseSettings","name":"_baseSettings","type":"tuple"}],"name":"updateBaseSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"phaseIndex","type":"uint256"},{"components":[{"internalType":"uint64","name":"maxSupply","type":"uint64"},{"internalType":"uint64","name":"amountMinted","type":"uint64"},{"internalType":"uint64","name":"maxPerWallet","type":"uint64"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"internalType":"struct PhaseSettings","name":"phase","type":"tuple"}],"name":"updatePhaseSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"withdrawAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080604052610104805460ff19166001179055348015601c575f80fd5b5060236027565b60e2565b5f54610100900460ff161560915760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff908116101560e0575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615882806100ef5f395ff3fe6080604052600436106103a0575f3560e01c80638b83209b116101de578063ba09f3d711610108578063d79779b21161009d578063eba5267e1161006d578063eba5267e14610b4a578063f06c6ff814610c37578063f2fde38b14610c56578063ff489fe114610c75575f80fd5b8063d79779b214610ad0578063db980f4f14610b04578063e33b7de314610b17578063e985e9c514610b2b575f80fd5b8063c87b56dd116100d8578063c87b56dd14610a53578063ce7c2ac214610a72578063cfc86f7b14610aa6578063d5abeb0114610aba575f80fd5b8063ba09f3d7146109ca578063c0d7f147146109e9578063c23dc68f14610a08578063c45ac05014610a34575f80fd5b80639e3b431f1161017e578063a3f8eace1161014e578063a3f8eace14610965578063a55baf7f14610984578063ab5161a114610998578063b88d4fde146109b7575f80fd5b80639e3b431f146108fa5780639ff7075514610919578063a22cb4651461092c578063a3330d251461094b575f80fd5b806395d89b41116101b957806395d89b411461088057806397474f13146108945780639852595c146108a757806399a2557a146108db575f80fd5b80638b83209b146108255780638da5cb5b1461084457806393a69f8914610861575f80fd5b80633ccfd60b116102ca5780635bbb21771161025f57806370a082311161022f57806370a08231146107b457806370dced05146107d3578063715018a6146107f25780638462151c14610806575f80fd5b80635bbb21771461071e578063603f4d521461074a5780636352211e146107695780636f0a90d714610788575f80fd5b806344bb82791161029a57806344bb8279146106a257806348b75044146106c1578063528307c8146106e057806355f804b3146106ff575f80fd5b80633ccfd60b14610618578063406072a91461062c57806342842e0e1461067057806342966c6814610683575f80fd5b806319165587116103405780632a55205a116103105780632a55205a146105475780632c0e69b31461058557806333d3c80e146105e55780633a98ef3914610604575f80fd5b806319165587146104e25780631f06b55a1461050157806322dcb0a71461052057806323b872dd14610534575f80fd5b8063081812fc1161037b578063081812fc14610463578063095ea7b31461049a5780630d1d7ae5146104ad57806318160ddd146104c0575f80fd5b806301ffc9a7146103ed57806302fa7c471461042157806306fdde0314610442575f80fd5b366103e9577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b5f80fd5b3480156103f8575f80fd5b5061040c61040736600461470b565b610ced565b60405190151581526020015b60405180910390f35b34801561042c575f80fd5b5061044061043b36600461475b565b610d0c565b005b34801561044d575f80fd5b50610456610d6d565b60405161041891906147bc565b34801561046e575f80fd5b5061048261047d3660046147ce565b610e06565b6040516001600160a01b039091168152602001610418565b6104406104a83660046147e5565b610e51565b6104406104bb36600461482e565b610e5f565b3480156104cb575f80fd5b506104d4610ef0565b604051908152602001610418565b3480156104ed575f80fd5b506104406104fc366004614849565b610f0f565b34801561050c575f80fd5b506104d461051b366004614849565b610ff3565b34801561052b575f80fd5b50610440610ffd565b610440610542366004614864565b611068565b348015610552575f80fd5b506105666105613660046148a2565b611078565b604080516001600160a01b039093168352602083019190915201610418565b348015610590575f80fd5b506105cd61059f3660046148c2565b6001600160a01b03165f9081526101036020908152604080832093835292905220546001600160401b031690565b6040516001600160401b039091168152602001610418565b3480156105f0575f80fd5b506104406105ff366004614930565b611124565b34801561060f575f80fd5b5060c9546104d4565b348015610623575f80fd5b506104406111aa565b348015610637575f80fd5b506104d461064636600461496e565b6001600160a01b039182165f90815260cf6020908152604080832093909416825291909152205490565b61044061067e366004614864565b61120b565b34801561068e575f80fd5b5061044061069d3660046147ce565b611216565b3480156106ad575f80fd5b506104826106bc3660046147ce565b611282565b3480156106cc575f80fd5b506104406106db36600461496e565b6112ab565b3480156106eb575f80fd5b506104406106fa3660046149b2565b6113b8565b34801561070a575f80fd5b50610440610719366004614aab565b6114b7565b348015610729575f80fd5b5061073d610738366004614930565b611506565b6040516104189190614b18565b348015610755575f80fd5b5060fc546105cd906001600160401b031681565b348015610774575f80fd5b506104826107833660046147ce565b6115cd565b348015610793575f80fd5b506107a76107a2366004614849565b6115d7565b6040516104189190614b65565b3480156107bf575f80fd5b506104d46107ce366004614849565b6116ea565b3480156107de575f80fd5b506104406107ed366004614b9c565b61174f565b3480156107fd575f80fd5b5061044061182f565b348015610811575f80fd5b506107a7610820366004614849565b611842565b348015610830575f80fd5b5061048261083f3660046147ce565b611946565b34801561084f575f80fd5b506033546001600160a01b0316610482565b34801561086c575f80fd5b5061044061087b366004614bd3565b611974565b34801561088b575f80fd5b50610456611b36565b6104406108a2366004614c4a565b611b4e565b3480156108b2575f80fd5b506104d46108c1366004614849565b6001600160a01b03165f90815260cc602052604090205490565b3480156108e6575f80fd5b506107a76108f5366004614ca1565b611c2e565b348015610905575f80fd5b50610440610914366004614ce3565b611dad565b610440610927366004614cfd565b611e53565b348015610937575f80fd5b50610440610946366004614dac565b6120b5565b348015610956575f80fd5b506101045461040c9060ff1681565b348015610970575f80fd5b506104d461097f366004614849565b6120bf565b34801561098f575f80fd5b506104d46120fe565b3480156109a3575f80fd5b506104406109b23660046147ce565b612192565b6104406109c5366004614dd8565b61226f565b3480156109d5575f80fd5b506104406109e4366004614e52565b61227b565b3480156109f4575f80fd5b50610440610a033660046149b2565b61240f565b348015610a13575f80fd5b50610a27610a223660046147ce565b6124d3565b6040516104189190614ea4565b348015610a3f575f80fd5b506104d4610a4e36600461496e565b61255e565b348015610a5e575f80fd5b50610456610a6d3660046147ce565b612625565b348015610a7d575f80fd5b506104d4610a8c366004614849565b6001600160a01b03165f90815260cb602052604090205490565b348015610ab1575f80fd5b506104566126a5565b348015610ac5575f80fd5b506104d46101015481565b348015610adb575f80fd5b506104d4610aea366004614849565b6001600160a01b03165f90815260ce602052604090205490565b610440610b12366004614eb2565b612731565b348015610b22575f80fd5b5060ca546104d4565b348015610b36575f80fd5b5061040c610b4536600461496e565b61280e565b348015610b55575f80fd5b50610c2a610b643660046147ce565b60408051610100810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810191909152505f90815260fd602090815260409182902082516101008101845281546001600160401b038082168352600160401b8204811694830194909452600160801b90049092169282019290925260018201546060820152600282015460ff1615156080820152600382015460a0820152600482015460c082015260059091015460e082015290565b6040516104189190614ed5565b348015610c42575f80fd5b50610440610c51366004614fa2565b612849565b348015610c61575f80fd5b50610440610c70366004614849565b612cad565b348015610c80575f80fd5b5060fe5460ff5461010054610cb4926001600160401b0380821693600160401b8304821693600160801b9093049091169185565b604080516001600160401b039687168152948616602086015292909416918301919091526060820152608081019190915260a001610418565b5f610cf782612d26565b80610d065750610d0682612d73565b92915050565b610d14612da7565b610d1e8282612e01565b604080516001600160a01b03841681526001600160601b03831660208201527f8039bd6e4e7dba001c8840eb2e118d9d131246faa7d0d04335f7305127ec0b1091015b60405180910390a15050565b6060610d77612efe565b6002018054610d85906150d6565b80601f0160208091040260200160405190810160405280929190818152602001828054610db1906150d6565b8015610dfc5780601f10610dd357610100808354040283529160200191610dfc565b820191905f5260205f20905b815481529060010190602001808311610ddf57829003601f168201915b5050505050905090565b5f610e1082612f22565b610e2d576040516333d1c03960e21b815260040160405180910390fd5b610e35612efe565b5f9283526006016020525060409020546001600160a01b031690565b610e5b8282612f69565b5050565b5f610e73826001600160401b031634612f75565b9050610e8833836001600160401b031661304e565b60fe80546001600160401b03808416600160801b0267ffffffffffffffff60801b1990921691909117909155610ec190339084166130b1565b6040516001600160401b038316815233905f805160206157ed8339815191529060200160405180910390a25050565b5f6001610efb612efe565b60010154610f07612efe565b540303919050565b6001600160a01b0381165f90815260cb6020526040902054610f4c5760405162461bcd60e51b8152600401610f4390615108565b60405180910390fd5b5f610f56826120bf565b9050805f03610f775760405162461bcd60e51b8152600401610f439061514e565b8060ca5f828254610f8891906151ad565b90915550506001600160a01b0382165f90815260cc60205260409020805482019055610fb482826131bf565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0569101610d61565b5f610d06826132d4565b611005612da7565b610104805460ff610100808304821615810261ff001990931692909217928390556040517f1509137b40df48e8ef9596f9db16b632b15353d0e0688d9f23221953eb0328dd9361105e9390049091161515815260200190565b60405180910390a1565b611073838383613316565b505050565b5f8281526098602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916110ec5750604080518082019091526097546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f906127109061110a906001600160601b0316876151c0565b61111491906151d7565b91519350909150505b9250929050565b61112c612da7565b60fc5481906001600160401b031681111561115a5760405163268dbf6760e21b815260040160405180910390fd5b5f5b818110156111a45761119c848483818110611179576111796151f6565b905060200201602081019061118e919061482e565b6001600160401b0316612192565b60010161115c565b50505050565b6111b2612da7565b610102545f5b81811015610e5b575f61010282815481106111d5576111d56151f6565b5f9182526020822001546001600160a01b031691506111f3826120bf565b11156112025761120281610f0f565b506001016111b8565b6110738383836134f0565b61010454610100900460ff1661123f5760405163fa32799b60e01b815260040160405180910390fd5b61124a81600161350a565b60405181815233907f1af5163f80e79b5e554f61e1d052084d3a3fe1166e42a265798c4e2ddce8ffa29060200160405180910390a250565b6101028181548110611292575f80fd5b5f918252602090912001546001600160a01b0316905081565b6001600160a01b0381165f90815260cb60205260409020546112df5760405162461bcd60e51b8152600401610f4390615108565b5f6112ea838361255e565b9050805f0361130b5760405162461bcd60e51b8152600401610f439061514e565b6001600160a01b0383165f90815260ce6020526040812080548392906113329084906151ad565b90915550506001600160a01b038084165f90815260cf6020908152604080832093861683529290522080548201905561136c838383613670565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a91015b60405180910390a2505050565b6113c0612da7565b815f5b81811015611460575f8585838181106113de576113de6151f6565b60fc54602090910292909201359250506001600160401b031681106114165760405163268dbf6760e21b815260040160405180910390fd5b600160fd5f88888681811061142d5761142d6151f6565b602090810292909201358352508101919091526040015f20600201805460ff1916911515919091179055506001016113c3565b50811561147657610104805460ff191660011790555b7f906568ccdea6378b9108aec731550e3e47f4541a63781939312428b90a4b4c6d8484846040516114a99392919061520a565b60405180910390a150505050565b6114bf612da7565b60fb6114cb8282615291565b507f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad816040516114fb91906147bc565b60405180910390a150565b6060815f816001600160401b0381111561152257611522614a04565b60405190808252806020026020018201604052801561157257816020015b604080516080810182525f8082526020808301829052928201819052606082015282525f199092019101816115405790505b5090505f5b8281146115c45761159f868683818110611593576115936151f6565b905060200201356124d3565b8282815181106115b1576115b16151f6565b6020908102919091010152600101611577565b50949350505050565b5f610d06826136c2565b60fc546060905f906115f3906001600160401b0316600161534b565b6001600160401b03166001600160401b0381111561161357611613614a04565b60405190808252806020026020018201604052801561163c578160200160208202803683370190505b5090505f5b60fc546001600160401b0390811690821610156116b0576001600160a01b0384165f908152610103602090815260408083206001600160401b038086168086529190935292205484519116918491811061169d5761169d6151f6565b6020908102919091010152600101611641565b506116ba836132d4565b60fc54825183916001600160401b03169081106116d9576116d96151f6565b602090810291909101015292915050565b5f6001600160a01b038216611712576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03611722612efe565b6005015f846001600160a01b03166001600160a01b031681526020019081526020015f2054169050919050565b611757612da7565b5f82815260fd60205260409020805460028201546001600160401b03600160401b830481169392169160ff9091169084906117928282615395565b50505f85815260fd60205260409081902080546fffffffffffffffffffffffffffffffff1916600160401b6001600160401b038781169190910267ffffffffffffffff191691909117908516178155600201805460ff1916831515179055517f3347073c97b3665f7163537cd3391b114b33ad6a2271ebe914872354e551dc8f90611820908790879061545d565b60405180910390a15050505050565b611837612da7565b6118405f61376a565b565b60605f805f611850856116ea565b90505f816001600160401b0381111561186b5761186b614a04565b604051908082528060200260200182016040528015611894578160200160208202803683370190505b5090506118c0604080516080810182525f80825260208201819052918101829052606081019190915290565b60015b83861461193a576118d3816137bb565b915081604001516119325781516001600160a01b0316156118f357815194505b876001600160a01b0316856001600160a01b0316036119325780838780600101985081518110611925576119256151f6565b6020026020010181815250505b6001016118c3565b50909695505050505050565b5f60cd828154811061195a5761195a6151f6565b5f918252602090912001546001600160a01b031692915050565b61197c612da7565b805f84821461199e5760405163e6dcad7760e01b815260040160405180910390fd5b5f87815260fd60205260408120905b83811015611af2575f8888838181106119c8576119c86151f6565b90506020020160208101906119dd919061482e565b83546119f99190600160401b90046001600160401b031661534b565b83549091506001600160401b039081169082161115611a2b576040516352df9fe560e01b815260040160405180910390fd5b825467ffffffffffffffff60401b1916600160401b6001600160401b03831602178355888883818110611a6057611a606151f6565b9050602002016020810190611a75919061482e565b611a88906001600160401b0316856151ad565b9350611ae9878784818110611a9f57611a9f6151f6565b9050602002016020810190611ab49190614849565b8a8a85818110611ac657611ac66151f6565b9050602002016020810190611adb919061482e565b6001600160401b03166130b1565b506001016119ad565b5060408051848152602081018490527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba95464910160405180910390a15050505050505050565b6060611b40612efe565b6003018054610d85906150d6565b5f611b5d338585858934613800565b9050611b7233856001600160401b031661304e565b5f85815260fd602052604090208054859190600890611ba2908490600160401b90046001600160401b031661534b565b82546101009290920a6001600160401b03818102199093169183160217909155335f818152610103602090815260408083208b84529091529020805467ffffffffffffffff1916858416179055611bfc92509086166130b1565b6040516001600160401b038516815233905f805160206157ed8339815191529060200160405180910390a25050505050565b6060818310611c5057604051631960ccad60e11b815260040160405180910390fd5b5f80611c5a613a24565b90506001851015611c6a57600194505b80841115611c76578093505b5f611c80876116ea565b905084861015611c9f5785850381811015611c99578091505b50611ca2565b505f5b5f816001600160401b03811115611cbb57611cbb614a04565b604051908082528060200260200182016040528015611ce4578160200160208202803683370190505b509050815f03611cf9579350611da692505050565b5f611d03886124d3565b90505f8160400151611d13575080515b885b888114158015611d255750848714155b15611d9a57611d33816137bb565b92508260400151611d925782516001600160a01b031615611d5357825191505b8a6001600160a01b0316826001600160a01b031603611d925780848880600101995081518110611d8557611d856151f6565b6020026020010181815250505b600101611d15565b50505092835250909150505b9392505050565b611db5612da7565b60fe80546001600160401b0380821692600160801b90920416908390611ddb8282615506565b505060fe80546001600160401b03838116600160801b0277ffffffffffffffff0000000000000000ffffffffffffffff19909216908516171790556040517f6a3867950fdbff0891235663af780bffb7eb3b89550902e5aaf142f49fc101db90611e46908590615591565b60405180910390a1505050565b60fc5482906001600160401b0316811180611e6e5750808714155b80611e795750808514155b15611e975760405163268dbf6760e21b815260040160405180910390fd5b345f805b83811015612017575f80888884818110611eb757611eb76151f6565b9050602002013590505f8d8d85818110611ed357611ed36151f6565b9050602002016020810190611ee8919061482e565b9050365f8d8d87818110611efe57611efe6151f6565b9050602002810190611f1091906155fe565b5f86815260fd6020526040812060038101549395509193509091611f3e906001600160401b038716906151c0565b9050808a1015611f605760405162bfc92160e01b815260040160405180910390fd5b6001820154611f8557611f7e33866001600160401b03168884613a33565b9650611f96565b611f93338686868a86613800565b96505b5f86815260fd60209081526040808320805467ffffffffffffffff60401b198116600160401b918290046001600160401b039081168c018116909202179091553384526101038352818420998452989091529020805467ffffffffffffffff1916978716979097179096555050509190940393169190910190600101611e9b565b50806001600160401b038516156120725761203b856001600160401b031684612f75565b5060fe80546001600160401b03600160801b8083048216890182160267ffffffffffffffff60801b19909216919091179091558516015b61207c338261304e565b61208633826130b1565b60405181815233905f805160206157ed8339815191529060200160405180910390a25050505050505050505050565b610e5b8282613bf2565b5f806120ca60ca5490565b6120d490476151ad565b9050611da683826120f9866001600160a01b03165f90815260cc602052604090205490565b613c6e565b60fe545f906001600160401b0316815b60fc546001600160401b031681101561218c575f81815260fd60205260409020600581015442108015906121455750600581015415155b156121835780545f9061216a906001600160401b03600160401b820481169116615643565b6001600160401b0316905061217f81856151ad565b9350505b5060010161210e565b50919050565b61219a612da7565b5f81815260fd60205260408120805490916001600160401b0390911690036121d55760405163268dbf6760e21b815260040160405180910390fd5b80546121f3906001600160401b03600160401b820481169116615643565b60fe80545f9061220d9084906001600160401b031661534b565b82546001600160401b039182166101009390930a928302919092021990911617905550805467ffffffffffffffff191681556040518281527fc2067c23a9ebd515eec7748db8a487f8e13247aebbd537dcd7da1a54f636071590602001610d61565b6111a484848484613cab565b612283612da7565b805f8482146122a55760405163e6dcad7760e01b815260040160405180910390fd5b5f5b828110156123cd575f8787838181106122c2576122c26151f6565b90506020020160208101906122d7919061482e565b60fe546122f49190600160801b90046001600160401b031661534b565b60fe549091506001600160401b039081169082161115612327576040516352df9fe560e01b815260040160405180910390fd5b60fe805467ffffffffffffffff60801b1916600160801b6001600160401b0384160217905587878381811061235e5761235e6151f6565b9050602002016020810190612373919061482e565b612386906001600160401b0316846151ad565b92506123c486868481811061239d5761239d6151f6565b90506020020160208101906123b29190614849565b898985818110611ac657611ac66151f6565b506001016122a7565b5060408051838152602081018390527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba95464910160405180910390a1505050505050565b612417612da7565b815f5b8181101561248d575f858583818110612435576124356151f6565b60fc54602090910292909201359250506001600160401b0316811061246d5760405163268dbf6760e21b815260040160405180910390fd5b5f90815260fd60205260409020600201805460ff1916905560010161241a565b5081156124a057610104805460ff191690555b7f4f1e98f5c7093632a49c02ecd1c1283bf1689573db8338b3814dfd7d9cf013c88484846040516114a99392919061520a565b604080516080810182525f808252602082018190529181018290526060810191909152604080516080810182525f808252602082018190529181018290526060810191909152600183108061252f575061252b613a24565b8310155b1561253a5792915050565b612543836137bb565b90508060400151156125555792915050565b611da683613cef565b6001600160a01b0382165f90815260ce602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156125ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125de9190615662565b6125e891906151ad565b6001600160a01b038086165f90815260cf602090815260408083209388168352929052205490915061261d9084908390613c6e565b949350505050565b606061263082612f22565b61264d57604051630a14c4b560e41b815260040160405180910390fd5b5f612656613d23565b905080515f036126745760405180602001604052805f815250611da6565b8061267e84613d32565b60405160200161268f929190615690565b6040516020818303038152906040529392505050565b60fb80546126b2906150d6565b80601f01602080910402602001604051908101604052809291908181526020018280546126de906150d6565b80156127295780601f1061270057610100808354040283529160200191612729565b820191905f5260205f20905b81548152906001019060200180831161270c57829003601f168201915b505050505081565b5f61274733836001600160401b03168534613a33565b905061275c33836001600160401b031661304e565b5f83815260fd60205260409020805483919060089061278c908490600160401b90046001600160401b031661534b565b82546101009290920a6001600160401b03818102199093169183160217909155335f818152610103602090815260408083208984529091529020805467ffffffffffffffff19168584161790556127e692509084166130b1565b6040516001600160401b038316815233905f805160206157ed833981519152906020016113ab565b5f612817612efe565b6001600160a01b039384165f908152600791909101602090815260408083209490951682529290925250205460ff1690565b5f8051602061582d83398151915254610100900460ff1661287c575f8051602061582d8339815191525460ff1615612880565b303b155b6128f25760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a65640000000000000000006064820152608401610f43565b5f8051602061582d83398151915254610100900460ff1615801561292c575f8051602061582d833981519152805461ffff19166101011790555b5f54610100900460ff161580801561294a57505f54600160ff909116105b806129635750303b15801561296357505f5460ff166001145b6129c65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610f43565b5f805460ff1916600117905580156129e7575f805461ff0019166101001790555b6129f18d8d613d75565b6129f9613db2565b612a7a612a0687806155fe565b808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250612a449250505060208901896155fe565b808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250613de092505050565b875f612a8960208a018a61482e565b6001600160401b031690505f5b826001600160401b0316811015612b26578b8b82818110612ab957612ab96151f6565b5f84815260fd6020526040902061010090910292909201919050612add8282615395565b9050508b8b82818110612af257612af26151f6565b612b0992602061010090920201908101915061482e565b612b1c906001600160401b0316836151ad565b9150600101612a96565b50868114612b905760405162461bcd60e51b815260206004820152603160248201527f537570706c79206f6620616c6c20706861736573206d75737420657175616c206044820152706d6178496e74656e646564537570706c7960781b6064820152608401610f43565b60fb612b9c8e82615291565b50612ba788806155fe565b612bb49161010291614681565b5060fc805467ffffffffffffffff19166001600160401b0384161790558860fe612bde8282615506565b5050610104805461ff00191661010088151502179055610101879055612c22612c0a60208e018e614849565b8d6020016020810190612c1d91906156a4565b612e01565b612c2b85612cad565b5050610104805460ff191660011790558015612c80575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b508015612c9f575f8051602061582d833981519152805461ff00191690555b505050505050505050505050565b612cb5612da7565b6001600160a01b038116612d1a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f43565b612d238161376a565b50565b5f6301ffc9a760e01b6001600160e01b031983161480612d5657506380ac58cd60e01b6001600160e01b03198316145b80610d065750506001600160e01b031916635b5e139f60e01b1490565b5f6001600160e01b0319821663152a902d60e11b1480610d0657506301ffc9a760e01b6001600160e01b0319831614610d06565b6033546001600160a01b031633146118405760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f43565b6127106001600160601b0382161115612e6f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610f43565b6001600160a01b038216612ec55760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610f43565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217609755565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b5f81600111158015612f3b5750612f37612efe565b5482105b8015610d065750600160e01b612f4f612efe565b5f8481526004919091016020526040902054161592915050565b610e5b82826001613e10565b610104545f9060ff16612f9b576040516321094a9b60e01b815260040160405180910390fd5b6101005415801590612faf57506101005442105b15612fcd5760405163037c7a4160e61b815260040160405180910390fd5b60fe545f90612fed908590600160801b90046001600160401b03166151ad565b90505f612ff86120fe565b90508082111561301b576040516352df9fe560e01b815260040160405180910390fd5b60ff5461302890866151c0565b84146130465760405162bfc92160e01b815260040160405180910390fd5b509392505050565b60fe54600160401b90046001600160401b031615801590613093575060fe54600160401b90046001600160401b031681613087846132d4565b61309191906151ad565b115b15610e5b57604051636c80554560e11b815260040160405180910390fd5b5f6130ba612efe565b5490505f8290036130de5760405163b562e8dd60e01b815260040160405180910390fd5b6801000000000000000182026130f2612efe565b6001600160a01b0385165f81815260059290920160205260409091208054929092019091554260a01b6001841460e11b171761312c612efe565b5f83815260049190910160205260408120919091556001600160a01b0384169083830190839083905f8051602061580d8339815191528180a4600183015b81811461318d5780835f5f8051602061580d8339815191525f80a460010161316a565b50815f036131ad57604051622e076360e81b815260040160405180910390fd5b806131b6612efe565b55506110739050565b8047101561320f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610f43565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114613258576040519150601f19603f3d011682016040523d82523d5f602084013e61325d565b606091505b50509050806110735760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610f43565b5f6001600160401b0360406132e7612efe565b6005015f856001600160a01b03166001600160a01b031681526020019081526020015f2054901c169050919050565b5f613320826136c2565b9050836001600160a01b0316816001600160a01b0316146133535760405162a1148160e81b815260040160405180910390fd5b5f8061335e84613ec3565b91509150613383818761336e3390565b6001600160a01b039081169116811491141790565b6133ae57613391863361280e565b6133ae57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166133d557604051633a954ecd60e21b815260040160405180910390fd5b80156133df575f82555b6133e7612efe565b6001600160a01b0387165f9081526005919091016020526040902080545f19019055613411612efe565b6001600160a01b0386165f8181526005929092016020526040909120805460010190554260a01b17600160e11b17613447612efe565b5f8681526004919091016020526040812091909155600160e11b841690036134ba5760018401613475612efe565b5f828152600491909101602052604081205490036134b857613495612efe565b5481146134b857836134a5612efe565b5f83815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b03165f8051602061580d83398151915260405160405180910390a4505050505050565b61107383838360405180602001604052805f81525061226f565b5f613514836136c2565b9050805f8061352286613ec3565b9150915084156135625761353781843361336e565b61356257613545833361280e565b61356257604051632ce44b5f60e11b815260040160405180910390fd5b801561356c575f82555b6fffffffffffffffffffffffffffffffff613585612efe565b6001600160a01b0385165f81815260059290920160205260409091208054929092019091554260a01b17600360e01b176135bd612efe565b5f8881526004919091016020526040812091909155600160e11b8516900361363057600186016135eb612efe565b5f8281526004919091016020526040812054900361362e5761360b612efe565b54811461362e578461361b612efe565b5f83815260049190910160205260409020555b505b60405186905f906001600160a01b038616905f8051602061580d833981519152908390a461365c612efe565b600190810180549091019055505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611073908490613ee8565b5f81600111613751576136d3612efe565b5f83815260049190910160205260408120549150600160e01b8216900361375157805f0361374c57613703612efe565b54821061372357604051636f96cda160e11b815260040160405180910390fd5b61372b612efe565b5f199092015f81815260049390930160205260409092205490508015613723575b919050565b604051636f96cda160e11b815260040160405180910390fd5b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b604080516080810182525f808252602082018190529181018290526060810191909152610d066137e9612efe565b5f8481526004919091016020526040902054613fb9565b5f82815260fd60205260408120600281015460ff16613832576040516321094a9b60e01b815260040160405180910390fd5b80600401544210156138575760405163037c7a4160e61b815260040160405180910390fd5b600181015461387957604051634d0ee1f560e11b815260040160405180910390fd5b80546001600160401b038082169161389a918a91600160401b90041661534b565b6001600160401b031611156138c2576040516352df9fe560e01b815260040160405180910390fd5b60038101546138da906001600160401b0389166151c0565b83146138f85760405162bfc92160e01b815260040160405180910390fd5b61396c8686808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050505060018301546040516bffffffffffffffffffffffff1960608d901b16602082015260340160405160208183030381529060405280519060200120614000565b613989576040516309bde33960e01b815260040160405180910390fd5b6001600160a01b0388165f908152610103602090815260408083208784529091528120546001600160401b0390811691906139c6908a16836151ad565b8354909150600160801b90046001600160401b0316158015906139f957508254600160801b90046001600160401b031681115b15613a1757604051636c80554560e11b815260040160405180910390fd5b9998505050505050505050565b5f613a2d612efe565b54919050565b5f82815260fd60205260408120600281015460ff16613a65576040516321094a9b60e01b815260040160405180910390fd5b600481015415801590613a7b5750806004015442105b15613a995760405163037c7a4160e61b815260040160405180910390fd5b80600501544210158015613ab05750600581015415155b15613ace5760405163691c8a2160e01b815260040160405180910390fd5b600181015415613af157604051634d0ee1f560e11b815260040160405180910390fd5b80546001600160401b0380821691613b12918891600160401b9004166151ad565b1115613b31576040516352df9fe560e01b815260040160405180910390fd5b6003810154613b4090866151c0565b8314613b5e5760405162bfc92160e01b815260040160405180910390fd5b6001600160a01b0386165f908152610103602090815260408083208784529091528120546001600160401b031690613b9687836151ad565b8354909150600160801b90046001600160401b031615801590613bc957508254600160801b90046001600160401b031681115b15613be757604051636c80554560e11b815260040160405180910390fd5b979650505050505050565b80613bfb612efe565b335f818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60c9546001600160a01b0384165f90815260cb602052604081205490918391613c9790866151c0565b613ca191906151d7565b61261d91906156bd565b613cb6848484611068565b6001600160a01b0383163b156111a457613cd284848484614015565b6111a4576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182525f808252602082018190529181018290526060810191909152610d06613d1e836136c2565b613fb9565b606060fb8054610d85906150d6565b606060a06040510180604052602081039150505f815280825b600183039250600a81066030018353600a900480613d4b5750819003601f19909101908152919050565b5f8051602061582d83398151915254610100900460ff16613da85760405162461bcd60e51b8152600401610f43906156d0565b610e5b82826140f9565b5f54610100900460ff16613dd85760405162461bcd60e51b8152600401610f4390615724565b61184061416b565b5f54610100900460ff16613e065760405162461bcd60e51b8152600401610f4390615724565b610e5b828261419a565b5f613e1a836115cd565b90508115613e5957336001600160a01b03821614613e5957613e3c813361280e565b613e59576040516367d9dca160e11b815260040160405180910390fd5b83613e62612efe565b5f858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b5f805f613ece612efe565b5f9485526006016020525050604090912080549092909150565b5f613f3c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166142cb9092919063ffffffff16565b8051909150156110735780806020019051810190613f5a919061576f565b6110735760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f43565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b5f8261400c85846142d9565b14949350505050565b604051630a85bd0160e11b81525f906001600160a01b0385169063150b7a029061404990339089908890889060040161578a565b6020604051808303815f875af1925050508015614083575060408051601f3d908101601f19168201909252614080918101906157c6565b60015b6140df573d8080156140b0576040519150601f19603f3d011682016040523d82523d5f602084013e6140b5565b606091505b5080515f036140d7576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061261d565b5f8051602061582d83398151915254610100900460ff1661412c5760405162461bcd60e51b8152600401610f43906156d0565b81614135612efe565b600201906141439082615291565b508061414d612efe565b6003019061415b9082615291565b506001614166612efe565b555050565b5f54610100900460ff166141915760405162461bcd60e51b8152600401610f4390615724565b6118403361376a565b5f54610100900460ff166141c05760405162461bcd60e51b8152600401610f4390615724565b805182511461422c5760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b6064820152608401610f43565b5f82511161427c5760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f207061796565730000000000006044820152606401610f43565b5f5b8251811015611073576142c383828151811061429c5761429c6151f6565b60200260200101518383815181106142b6576142b66151f6565b6020026020010151614313565b60010161427e565b606061261d84845f856144ef565b5f81815b845181101561304657614309828683815181106142fc576142fc6151f6565b60200260200101516145bb565b91506001016142dd565b6001600160a01b03821661437e5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b6064820152608401610f43565b5f81116143cd5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a207368617265732061726520300000006044820152606401610f43565b6001600160a01b0382165f90815260cb6020526040902054156144465760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b6064820152608401610f43565b60cd8054600181019091557f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0180546001600160a01b0319166001600160a01b0384169081179091555f90815260cb6020526040902081905560c9546144ad9082906151ad565b60c955604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac9101610d61565b6060824710156145505760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f43565b5f80866001600160a01b0316858760405161456b91906157e1565b5f6040518083038185875af1925050503d805f81146145a5576040519150601f19603f3d011682016040523d82523d5f602084013e6145aa565b606091505b5091509150613be7878383876145e4565b5f8183106145d5575f828152602084905260409020611da6565b505f9182526020526040902090565b606083156146525782515f0361464b576001600160a01b0385163b61464b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f43565b508161261d565b61261d83838151156146675781518083602001fd5b8060405162461bcd60e51b8152600401610f4391906147bc565b828054828255905f5260205f209081019282156146d2579160200282015b828111156146d25781546001600160a01b0319166001600160a01b0384351617825560209092019160019091019061469f565b506146de9291506146e2565b5090565b5b808211156146de575f81556001016146e3565b6001600160e01b031981168114612d23575f80fd5b5f6020828403121561471b575f80fd5b8135611da6816146f6565b6001600160a01b0381168114612d23575f80fd5b803561374c81614726565b80356001600160601b038116811461374c575f80fd5b5f806040838503121561476c575f80fd5b823561477781614726565b915061478560208401614745565b90509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f611da6602083018461478e565b5f602082840312156147de575f80fd5b5035919050565b5f80604083850312156147f6575f80fd5b823561480181614726565b946020939093013593505050565b6001600160401b0381168114612d23575f80fd5b803561374c8161480f565b5f6020828403121561483e575f80fd5b8135611da68161480f565b5f60208284031215614859575f80fd5b8135611da681614726565b5f805f60608486031215614876575f80fd5b833561488181614726565b9250602084013561489181614726565b929592945050506040919091013590565b5f80604083850312156148b3575f80fd5b50508035926020909101359150565b5f80604083850312156148d3575f80fd5b8235915060208301356148e581614726565b809150509250929050565b5f8083601f840112614900575f80fd5b5081356001600160401b03811115614916575f80fd5b6020830191508360208260051b850101111561111d575f80fd5b5f8060208385031215614941575f80fd5b82356001600160401b03811115614956575f80fd5b614962858286016148f0565b90969095509350505050565b5f806040838503121561497f575f80fd5b823561498a81614726565b915060208301356148e581614726565b8015158114612d23575f80fd5b803561374c8161499a565b5f805f604084860312156149c4575f80fd5b83356001600160401b038111156149d9575f80fd5b6149e5868287016148f0565b90945092505060208401356149f98161499a565b809150509250925092565b634e487b7160e01b5f52604160045260245ffd5b5f806001600160401b03841115614a3157614a31614a04565b50604051601f19601f85018116603f011681018181106001600160401b0382111715614a5f57614a5f614a04565b604052838152905080828401851015614a76575f80fd5b838360208301375f60208583010152509392505050565b5f82601f830112614a9c575f80fd5b611da683833560208501614a18565b5f60208284031215614abb575f80fd5b81356001600160401b03811115614ad0575f80fd5b61261d84828501614a8d565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b602080825282518282018190525f918401906040840190835b81811015614b5a57614b44838551614adc565b6020939093019260809290920191600101614b31565b509095945050505050565b602080825282518282018190525f918401906040840190835b81811015614b5a578351835260209384019390920191600101614b7e565b5f80828403610120811215614baf575f80fd5b83359250610100601f1982011215614bc5575f80fd5b506020830190509250929050565b5f805f805f60608688031215614be7575f80fd5b8535945060208601356001600160401b03811115614c03575f80fd5b614c0f888289016148f0565b90955093505060408601356001600160401b03811115614c2d575f80fd5b614c39888289016148f0565b969995985093965092949392505050565b5f805f8060608587031215614c5d575f80fd5b843593506020850135614c6f8161480f565b925060408501356001600160401b03811115614c89575f80fd5b614c95878288016148f0565b95989497509550505050565b5f805f60608486031215614cb3575f80fd5b8335614cbe81614726565b95602085013595506040909401359392505050565b5f60a0828403121561218c575f80fd5b5f60a08284031215614cf3575f80fd5b611da68383614cd3565b5f805f805f805f6080888a031215614d13575f80fd5b87356001600160401b03811115614d28575f80fd5b614d348a828b016148f0565b90985096505060208801356001600160401b03811115614d52575f80fd5b614d5e8a828b016148f0565b90965094505060408801356001600160401b03811115614d7c575f80fd5b614d888a828b016148f0565b9094509250506060880135614d9c8161480f565b8091505092959891949750929550565b5f8060408385031215614dbd575f80fd5b8235614dc881614726565b915060208301356148e58161499a565b5f805f8060808587031215614deb575f80fd5b8435614df681614726565b93506020850135614e0681614726565b92506040850135915060608501356001600160401b03811115614e27575f80fd5b8501601f81018713614e37575f80fd5b614e4687823560208401614a18565b91505092959194509250565b5f805f8060408587031215614e65575f80fd5b84356001600160401b03811115614e7a575f80fd5b614e86878288016148f0565b90955093505060208501356001600160401b03811115614c89575f80fd5b60808101610d068284614adc565b5f8060408385031215614ec3575f80fd5b8235915060208301356148e58161480f565b5f610100820190506001600160401b0383511682526001600160401b0360208401511660208301526001600160401b036040840151166040830152606083015160608301526080830151614f2d608084018215159052565b5060a083015160a083015260c083015160c083015260e083015160e083015292915050565b5f6040828403121561218c575f80fd5b5f8083601f840112614f72575f80fd5b5081356001600160401b03811115614f88575f80fd5b6020830191508360208260081b850101111561111d575f80fd5b5f805f805f805f805f805f6101e08c8e031215614fbd575f80fd5b8b356001600160401b03811115614fd2575f80fd5b614fde8e828f01614a8d565b9b505060208c01356001600160401b03811115614ff9575f80fd5b6150058e828f01614a8d565b9a505060408c01356001600160401b03811115615020575f80fd5b61502c8e828f01614a8d565b99505061503c8d60608e01614f52565b975060a08c01356001600160401b03811115615056575f80fd5b6150628e828f01614f62565b909850965061507690508d60c08e01614cd3565b94506101608c01356001600160401b03811115615091575f80fd5b61509d8e828f01614f52565b9450506101808c013592506150b56101a08d016149a7565b91506150c46101c08d0161473a565b90509295989b509295989b9093969950565b600181811c908216806150ea57607f821691505b60208210810361218c57634e487b7160e01b5f52602260045260245ffd5b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d0657610d06615199565b8082028115828204841417610d0657610d06615199565b5f826151f157634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b604080825281018390525f6001600160fb1b03841115615228575f80fd5b8360051b808660608501379215156020830152500160600192915050565b601f82111561107357805f5260205f20601f840160051c8101602085101561526b5750805b601f840160051c820191505b8181101561528a575f8155600101615277565b5050505050565b81516001600160401b038111156152aa576152aa614a04565b6152be816152b884546150d6565b84615246565b6020601f8211600181146152f0575f83156152d95750848201515b5f19600385901b1c1916600184901b17845561528a565b5f84815260208120601f198516915b8281101561531f57878501518255602094850194600190920191016152ff565b508482101561533c57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160401b038181168382160190811115610d0657610d06615199565b805467ffffffffffffffff60801b191660809290921b67ffffffffffffffff60801b16919091179055565b81356153a08161480f565b815467ffffffffffffffff19166001600160401b0382161782555060208201356153c98161480f565b815467ffffffffffffffff60401b1916604082901b67ffffffffffffffff60401b161782555060408201356153fd8161480f565b615407818361536a565b50606082013560018201555f60808301356154218161499a565b60028301805491151560ff1660ff19929092169190911790555060a0820135600382015560c0820135600482015560e090910135600590910155565b828152610120810182356154708161480f565b6001600160401b038116602084015250602083013561548e8161480f565b6001600160401b0381166040840152506154aa60408401614823565b6001600160401b03811660608401525060608301356080838101919091526154d39084016149a7565b80151560a08401525060a083013560c08381019190915283013560e0808401919091529092013561010090910152919050565b81356155118161480f565b815467ffffffffffffffff19166001600160401b03821617825550602082013561553a8161480f565b815467ffffffffffffffff60401b1916604082901b67ffffffffffffffff60401b1617825550604082013561556e8161480f565b615578818361536a565b5060608201356001820155608090910135600290910155565b60a0810182356155a08161480f565b6001600160401b0316825260208301356155b98161480f565b6001600160401b0316602083015260408301356155d58161480f565b6001600160401b0316604083015260608381013590830152608092830135929091019190915290565b5f808335601e19843603018112615613575f80fd5b8301803591506001600160401b0382111561562c575f80fd5b6020019150600581901b360382131561111d575f80fd5b6001600160401b038281168282160390811115610d0657610d06615199565b5f60208284031215615672575f80fd5b5051919050565b5f81518060208401855e5f93019283525090919050565b5f61261d61569e8386615679565b84615679565b5f602082840312156156b4575f80fd5b611da682614745565b81810381811115610d0657610d06615199565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b5f6020828403121561577f575f80fd5b8151611da68161499a565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906157bc9083018461478e565b9695505050505050565b5f602082840312156157d6575f80fd5b8151611da6816146f6565b5f611da6828461567956fe3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a4273ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212202b29f63e57f5361d10dafd819608f9e6406623334eec682296a76430407cb9de64736f6c634300081a0033
Deployed Bytecode
0x6080604052600436106103a0575f3560e01c80638b83209b116101de578063ba09f3d711610108578063d79779b21161009d578063eba5267e1161006d578063eba5267e14610b4a578063f06c6ff814610c37578063f2fde38b14610c56578063ff489fe114610c75575f80fd5b8063d79779b214610ad0578063db980f4f14610b04578063e33b7de314610b17578063e985e9c514610b2b575f80fd5b8063c87b56dd116100d8578063c87b56dd14610a53578063ce7c2ac214610a72578063cfc86f7b14610aa6578063d5abeb0114610aba575f80fd5b8063ba09f3d7146109ca578063c0d7f147146109e9578063c23dc68f14610a08578063c45ac05014610a34575f80fd5b80639e3b431f1161017e578063a3f8eace1161014e578063a3f8eace14610965578063a55baf7f14610984578063ab5161a114610998578063b88d4fde146109b7575f80fd5b80639e3b431f146108fa5780639ff7075514610919578063a22cb4651461092c578063a3330d251461094b575f80fd5b806395d89b41116101b957806395d89b411461088057806397474f13146108945780639852595c146108a757806399a2557a146108db575f80fd5b80638b83209b146108255780638da5cb5b1461084457806393a69f8914610861575f80fd5b80633ccfd60b116102ca5780635bbb21771161025f57806370a082311161022f57806370a08231146107b457806370dced05146107d3578063715018a6146107f25780638462151c14610806575f80fd5b80635bbb21771461071e578063603f4d521461074a5780636352211e146107695780636f0a90d714610788575f80fd5b806344bb82791161029a57806344bb8279146106a257806348b75044146106c1578063528307c8146106e057806355f804b3146106ff575f80fd5b80633ccfd60b14610618578063406072a91461062c57806342842e0e1461067057806342966c6814610683575f80fd5b806319165587116103405780632a55205a116103105780632a55205a146105475780632c0e69b31461058557806333d3c80e146105e55780633a98ef3914610604575f80fd5b806319165587146104e25780631f06b55a1461050157806322dcb0a71461052057806323b872dd14610534575f80fd5b8063081812fc1161037b578063081812fc14610463578063095ea7b31461049a5780630d1d7ae5146104ad57806318160ddd146104c0575f80fd5b806301ffc9a7146103ed57806302fa7c471461042157806306fdde0314610442575f80fd5b366103e9577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b5f80fd5b3480156103f8575f80fd5b5061040c61040736600461470b565b610ced565b60405190151581526020015b60405180910390f35b34801561042c575f80fd5b5061044061043b36600461475b565b610d0c565b005b34801561044d575f80fd5b50610456610d6d565b60405161041891906147bc565b34801561046e575f80fd5b5061048261047d3660046147ce565b610e06565b6040516001600160a01b039091168152602001610418565b6104406104a83660046147e5565b610e51565b6104406104bb36600461482e565b610e5f565b3480156104cb575f80fd5b506104d4610ef0565b604051908152602001610418565b3480156104ed575f80fd5b506104406104fc366004614849565b610f0f565b34801561050c575f80fd5b506104d461051b366004614849565b610ff3565b34801561052b575f80fd5b50610440610ffd565b610440610542366004614864565b611068565b348015610552575f80fd5b506105666105613660046148a2565b611078565b604080516001600160a01b039093168352602083019190915201610418565b348015610590575f80fd5b506105cd61059f3660046148c2565b6001600160a01b03165f9081526101036020908152604080832093835292905220546001600160401b031690565b6040516001600160401b039091168152602001610418565b3480156105f0575f80fd5b506104406105ff366004614930565b611124565b34801561060f575f80fd5b5060c9546104d4565b348015610623575f80fd5b506104406111aa565b348015610637575f80fd5b506104d461064636600461496e565b6001600160a01b039182165f90815260cf6020908152604080832093909416825291909152205490565b61044061067e366004614864565b61120b565b34801561068e575f80fd5b5061044061069d3660046147ce565b611216565b3480156106ad575f80fd5b506104826106bc3660046147ce565b611282565b3480156106cc575f80fd5b506104406106db36600461496e565b6112ab565b3480156106eb575f80fd5b506104406106fa3660046149b2565b6113b8565b34801561070a575f80fd5b50610440610719366004614aab565b6114b7565b348015610729575f80fd5b5061073d610738366004614930565b611506565b6040516104189190614b18565b348015610755575f80fd5b5060fc546105cd906001600160401b031681565b348015610774575f80fd5b506104826107833660046147ce565b6115cd565b348015610793575f80fd5b506107a76107a2366004614849565b6115d7565b6040516104189190614b65565b3480156107bf575f80fd5b506104d46107ce366004614849565b6116ea565b3480156107de575f80fd5b506104406107ed366004614b9c565b61174f565b3480156107fd575f80fd5b5061044061182f565b348015610811575f80fd5b506107a7610820366004614849565b611842565b348015610830575f80fd5b5061048261083f3660046147ce565b611946565b34801561084f575f80fd5b506033546001600160a01b0316610482565b34801561086c575f80fd5b5061044061087b366004614bd3565b611974565b34801561088b575f80fd5b50610456611b36565b6104406108a2366004614c4a565b611b4e565b3480156108b2575f80fd5b506104d46108c1366004614849565b6001600160a01b03165f90815260cc602052604090205490565b3480156108e6575f80fd5b506107a76108f5366004614ca1565b611c2e565b348015610905575f80fd5b50610440610914366004614ce3565b611dad565b610440610927366004614cfd565b611e53565b348015610937575f80fd5b50610440610946366004614dac565b6120b5565b348015610956575f80fd5b506101045461040c9060ff1681565b348015610970575f80fd5b506104d461097f366004614849565b6120bf565b34801561098f575f80fd5b506104d46120fe565b3480156109a3575f80fd5b506104406109b23660046147ce565b612192565b6104406109c5366004614dd8565b61226f565b3480156109d5575f80fd5b506104406109e4366004614e52565b61227b565b3480156109f4575f80fd5b50610440610a033660046149b2565b61240f565b348015610a13575f80fd5b50610a27610a223660046147ce565b6124d3565b6040516104189190614ea4565b348015610a3f575f80fd5b506104d4610a4e36600461496e565b61255e565b348015610a5e575f80fd5b50610456610a6d3660046147ce565b612625565b348015610a7d575f80fd5b506104d4610a8c366004614849565b6001600160a01b03165f90815260cb602052604090205490565b348015610ab1575f80fd5b506104566126a5565b348015610ac5575f80fd5b506104d46101015481565b348015610adb575f80fd5b506104d4610aea366004614849565b6001600160a01b03165f90815260ce602052604090205490565b610440610b12366004614eb2565b612731565b348015610b22575f80fd5b5060ca546104d4565b348015610b36575f80fd5b5061040c610b4536600461496e565b61280e565b348015610b55575f80fd5b50610c2a610b643660046147ce565b60408051610100810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810191909152505f90815260fd602090815260409182902082516101008101845281546001600160401b038082168352600160401b8204811694830194909452600160801b90049092169282019290925260018201546060820152600282015460ff1615156080820152600382015460a0820152600482015460c082015260059091015460e082015290565b6040516104189190614ed5565b348015610c42575f80fd5b50610440610c51366004614fa2565b612849565b348015610c61575f80fd5b50610440610c70366004614849565b612cad565b348015610c80575f80fd5b5060fe5460ff5461010054610cb4926001600160401b0380821693600160401b8304821693600160801b9093049091169185565b604080516001600160401b039687168152948616602086015292909416918301919091526060820152608081019190915260a001610418565b5f610cf782612d26565b80610d065750610d0682612d73565b92915050565b610d14612da7565b610d1e8282612e01565b604080516001600160a01b03841681526001600160601b03831660208201527f8039bd6e4e7dba001c8840eb2e118d9d131246faa7d0d04335f7305127ec0b1091015b60405180910390a15050565b6060610d77612efe565b6002018054610d85906150d6565b80601f0160208091040260200160405190810160405280929190818152602001828054610db1906150d6565b8015610dfc5780601f10610dd357610100808354040283529160200191610dfc565b820191905f5260205f20905b815481529060010190602001808311610ddf57829003601f168201915b5050505050905090565b5f610e1082612f22565b610e2d576040516333d1c03960e21b815260040160405180910390fd5b610e35612efe565b5f9283526006016020525060409020546001600160a01b031690565b610e5b8282612f69565b5050565b5f610e73826001600160401b031634612f75565b9050610e8833836001600160401b031661304e565b60fe80546001600160401b03808416600160801b0267ffffffffffffffff60801b1990921691909117909155610ec190339084166130b1565b6040516001600160401b038316815233905f805160206157ed8339815191529060200160405180910390a25050565b5f6001610efb612efe565b60010154610f07612efe565b540303919050565b6001600160a01b0381165f90815260cb6020526040902054610f4c5760405162461bcd60e51b8152600401610f4390615108565b60405180910390fd5b5f610f56826120bf565b9050805f03610f775760405162461bcd60e51b8152600401610f439061514e565b8060ca5f828254610f8891906151ad565b90915550506001600160a01b0382165f90815260cc60205260409020805482019055610fb482826131bf565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0569101610d61565b5f610d06826132d4565b611005612da7565b610104805460ff610100808304821615810261ff001990931692909217928390556040517f1509137b40df48e8ef9596f9db16b632b15353d0e0688d9f23221953eb0328dd9361105e9390049091161515815260200190565b60405180910390a1565b611073838383613316565b505050565b5f8281526098602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916110ec5750604080518082019091526097546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101515f906127109061110a906001600160601b0316876151c0565b61111491906151d7565b91519350909150505b9250929050565b61112c612da7565b60fc5481906001600160401b031681111561115a5760405163268dbf6760e21b815260040160405180910390fd5b5f5b818110156111a45761119c848483818110611179576111796151f6565b905060200201602081019061118e919061482e565b6001600160401b0316612192565b60010161115c565b50505050565b6111b2612da7565b610102545f5b81811015610e5b575f61010282815481106111d5576111d56151f6565b5f9182526020822001546001600160a01b031691506111f3826120bf565b11156112025761120281610f0f565b506001016111b8565b6110738383836134f0565b61010454610100900460ff1661123f5760405163fa32799b60e01b815260040160405180910390fd5b61124a81600161350a565b60405181815233907f1af5163f80e79b5e554f61e1d052084d3a3fe1166e42a265798c4e2ddce8ffa29060200160405180910390a250565b6101028181548110611292575f80fd5b5f918252602090912001546001600160a01b0316905081565b6001600160a01b0381165f90815260cb60205260409020546112df5760405162461bcd60e51b8152600401610f4390615108565b5f6112ea838361255e565b9050805f0361130b5760405162461bcd60e51b8152600401610f439061514e565b6001600160a01b0383165f90815260ce6020526040812080548392906113329084906151ad565b90915550506001600160a01b038084165f90815260cf6020908152604080832093861683529290522080548201905561136c838383613670565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a91015b60405180910390a2505050565b6113c0612da7565b815f5b81811015611460575f8585838181106113de576113de6151f6565b60fc54602090910292909201359250506001600160401b031681106114165760405163268dbf6760e21b815260040160405180910390fd5b600160fd5f88888681811061142d5761142d6151f6565b602090810292909201358352508101919091526040015f20600201805460ff1916911515919091179055506001016113c3565b50811561147657610104805460ff191660011790555b7f906568ccdea6378b9108aec731550e3e47f4541a63781939312428b90a4b4c6d8484846040516114a99392919061520a565b60405180910390a150505050565b6114bf612da7565b60fb6114cb8282615291565b507f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad816040516114fb91906147bc565b60405180910390a150565b6060815f816001600160401b0381111561152257611522614a04565b60405190808252806020026020018201604052801561157257816020015b604080516080810182525f8082526020808301829052928201819052606082015282525f199092019101816115405790505b5090505f5b8281146115c45761159f868683818110611593576115936151f6565b905060200201356124d3565b8282815181106115b1576115b16151f6565b6020908102919091010152600101611577565b50949350505050565b5f610d06826136c2565b60fc546060905f906115f3906001600160401b0316600161534b565b6001600160401b03166001600160401b0381111561161357611613614a04565b60405190808252806020026020018201604052801561163c578160200160208202803683370190505b5090505f5b60fc546001600160401b0390811690821610156116b0576001600160a01b0384165f908152610103602090815260408083206001600160401b038086168086529190935292205484519116918491811061169d5761169d6151f6565b6020908102919091010152600101611641565b506116ba836132d4565b60fc54825183916001600160401b03169081106116d9576116d96151f6565b602090810291909101015292915050565b5f6001600160a01b038216611712576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03611722612efe565b6005015f846001600160a01b03166001600160a01b031681526020019081526020015f2054169050919050565b611757612da7565b5f82815260fd60205260409020805460028201546001600160401b03600160401b830481169392169160ff9091169084906117928282615395565b50505f85815260fd60205260409081902080546fffffffffffffffffffffffffffffffff1916600160401b6001600160401b038781169190910267ffffffffffffffff191691909117908516178155600201805460ff1916831515179055517f3347073c97b3665f7163537cd3391b114b33ad6a2271ebe914872354e551dc8f90611820908790879061545d565b60405180910390a15050505050565b611837612da7565b6118405f61376a565b565b60605f805f611850856116ea565b90505f816001600160401b0381111561186b5761186b614a04565b604051908082528060200260200182016040528015611894578160200160208202803683370190505b5090506118c0604080516080810182525f80825260208201819052918101829052606081019190915290565b60015b83861461193a576118d3816137bb565b915081604001516119325781516001600160a01b0316156118f357815194505b876001600160a01b0316856001600160a01b0316036119325780838780600101985081518110611925576119256151f6565b6020026020010181815250505b6001016118c3565b50909695505050505050565b5f60cd828154811061195a5761195a6151f6565b5f918252602090912001546001600160a01b031692915050565b61197c612da7565b805f84821461199e5760405163e6dcad7760e01b815260040160405180910390fd5b5f87815260fd60205260408120905b83811015611af2575f8888838181106119c8576119c86151f6565b90506020020160208101906119dd919061482e565b83546119f99190600160401b90046001600160401b031661534b565b83549091506001600160401b039081169082161115611a2b576040516352df9fe560e01b815260040160405180910390fd5b825467ffffffffffffffff60401b1916600160401b6001600160401b03831602178355888883818110611a6057611a606151f6565b9050602002016020810190611a75919061482e565b611a88906001600160401b0316856151ad565b9350611ae9878784818110611a9f57611a9f6151f6565b9050602002016020810190611ab49190614849565b8a8a85818110611ac657611ac66151f6565b9050602002016020810190611adb919061482e565b6001600160401b03166130b1565b506001016119ad565b5060408051848152602081018490527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba95464910160405180910390a15050505050505050565b6060611b40612efe565b6003018054610d85906150d6565b5f611b5d338585858934613800565b9050611b7233856001600160401b031661304e565b5f85815260fd602052604090208054859190600890611ba2908490600160401b90046001600160401b031661534b565b82546101009290920a6001600160401b03818102199093169183160217909155335f818152610103602090815260408083208b84529091529020805467ffffffffffffffff1916858416179055611bfc92509086166130b1565b6040516001600160401b038516815233905f805160206157ed8339815191529060200160405180910390a25050505050565b6060818310611c5057604051631960ccad60e11b815260040160405180910390fd5b5f80611c5a613a24565b90506001851015611c6a57600194505b80841115611c76578093505b5f611c80876116ea565b905084861015611c9f5785850381811015611c99578091505b50611ca2565b505f5b5f816001600160401b03811115611cbb57611cbb614a04565b604051908082528060200260200182016040528015611ce4578160200160208202803683370190505b509050815f03611cf9579350611da692505050565b5f611d03886124d3565b90505f8160400151611d13575080515b885b888114158015611d255750848714155b15611d9a57611d33816137bb565b92508260400151611d925782516001600160a01b031615611d5357825191505b8a6001600160a01b0316826001600160a01b031603611d925780848880600101995081518110611d8557611d856151f6565b6020026020010181815250505b600101611d15565b50505092835250909150505b9392505050565b611db5612da7565b60fe80546001600160401b0380821692600160801b90920416908390611ddb8282615506565b505060fe80546001600160401b03838116600160801b0277ffffffffffffffff0000000000000000ffffffffffffffff19909216908516171790556040517f6a3867950fdbff0891235663af780bffb7eb3b89550902e5aaf142f49fc101db90611e46908590615591565b60405180910390a1505050565b60fc5482906001600160401b0316811180611e6e5750808714155b80611e795750808514155b15611e975760405163268dbf6760e21b815260040160405180910390fd5b345f805b83811015612017575f80888884818110611eb757611eb76151f6565b9050602002013590505f8d8d85818110611ed357611ed36151f6565b9050602002016020810190611ee8919061482e565b9050365f8d8d87818110611efe57611efe6151f6565b9050602002810190611f1091906155fe565b5f86815260fd6020526040812060038101549395509193509091611f3e906001600160401b038716906151c0565b9050808a1015611f605760405162bfc92160e01b815260040160405180910390fd5b6001820154611f8557611f7e33866001600160401b03168884613a33565b9650611f96565b611f93338686868a86613800565b96505b5f86815260fd60209081526040808320805467ffffffffffffffff60401b198116600160401b918290046001600160401b039081168c018116909202179091553384526101038352818420998452989091529020805467ffffffffffffffff1916978716979097179096555050509190940393169190910190600101611e9b565b50806001600160401b038516156120725761203b856001600160401b031684612f75565b5060fe80546001600160401b03600160801b8083048216890182160267ffffffffffffffff60801b19909216919091179091558516015b61207c338261304e565b61208633826130b1565b60405181815233905f805160206157ed8339815191529060200160405180910390a25050505050505050505050565b610e5b8282613bf2565b5f806120ca60ca5490565b6120d490476151ad565b9050611da683826120f9866001600160a01b03165f90815260cc602052604090205490565b613c6e565b60fe545f906001600160401b0316815b60fc546001600160401b031681101561218c575f81815260fd60205260409020600581015442108015906121455750600581015415155b156121835780545f9061216a906001600160401b03600160401b820481169116615643565b6001600160401b0316905061217f81856151ad565b9350505b5060010161210e565b50919050565b61219a612da7565b5f81815260fd60205260408120805490916001600160401b0390911690036121d55760405163268dbf6760e21b815260040160405180910390fd5b80546121f3906001600160401b03600160401b820481169116615643565b60fe80545f9061220d9084906001600160401b031661534b565b82546001600160401b039182166101009390930a928302919092021990911617905550805467ffffffffffffffff191681556040518281527fc2067c23a9ebd515eec7748db8a487f8e13247aebbd537dcd7da1a54f636071590602001610d61565b6111a484848484613cab565b612283612da7565b805f8482146122a55760405163e6dcad7760e01b815260040160405180910390fd5b5f5b828110156123cd575f8787838181106122c2576122c26151f6565b90506020020160208101906122d7919061482e565b60fe546122f49190600160801b90046001600160401b031661534b565b60fe549091506001600160401b039081169082161115612327576040516352df9fe560e01b815260040160405180910390fd5b60fe805467ffffffffffffffff60801b1916600160801b6001600160401b0384160217905587878381811061235e5761235e6151f6565b9050602002016020810190612373919061482e565b612386906001600160401b0316846151ad565b92506123c486868481811061239d5761239d6151f6565b90506020020160208101906123b29190614849565b898985818110611ac657611ac66151f6565b506001016122a7565b5060408051838152602081018390527f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba95464910160405180910390a1505050505050565b612417612da7565b815f5b8181101561248d575f858583818110612435576124356151f6565b60fc54602090910292909201359250506001600160401b0316811061246d5760405163268dbf6760e21b815260040160405180910390fd5b5f90815260fd60205260409020600201805460ff1916905560010161241a565b5081156124a057610104805460ff191690555b7f4f1e98f5c7093632a49c02ecd1c1283bf1689573db8338b3814dfd7d9cf013c88484846040516114a99392919061520a565b604080516080810182525f808252602082018190529181018290526060810191909152604080516080810182525f808252602082018190529181018290526060810191909152600183108061252f575061252b613a24565b8310155b1561253a5792915050565b612543836137bb565b90508060400151156125555792915050565b611da683613cef565b6001600160a01b0382165f90815260ce602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156125ba573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125de9190615662565b6125e891906151ad565b6001600160a01b038086165f90815260cf602090815260408083209388168352929052205490915061261d9084908390613c6e565b949350505050565b606061263082612f22565b61264d57604051630a14c4b560e41b815260040160405180910390fd5b5f612656613d23565b905080515f036126745760405180602001604052805f815250611da6565b8061267e84613d32565b60405160200161268f929190615690565b6040516020818303038152906040529392505050565b60fb80546126b2906150d6565b80601f01602080910402602001604051908101604052809291908181526020018280546126de906150d6565b80156127295780601f1061270057610100808354040283529160200191612729565b820191905f5260205f20905b81548152906001019060200180831161270c57829003601f168201915b505050505081565b5f61274733836001600160401b03168534613a33565b905061275c33836001600160401b031661304e565b5f83815260fd60205260409020805483919060089061278c908490600160401b90046001600160401b031661534b565b82546101009290920a6001600160401b03818102199093169183160217909155335f818152610103602090815260408083208984529091529020805467ffffffffffffffff19168584161790556127e692509084166130b1565b6040516001600160401b038316815233905f805160206157ed833981519152906020016113ab565b5f612817612efe565b6001600160a01b039384165f908152600791909101602090815260408083209490951682529290925250205460ff1690565b5f8051602061582d83398151915254610100900460ff1661287c575f8051602061582d8339815191525460ff1615612880565b303b155b6128f25760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a65640000000000000000006064820152608401610f43565b5f8051602061582d83398151915254610100900460ff1615801561292c575f8051602061582d833981519152805461ffff19166101011790555b5f54610100900460ff161580801561294a57505f54600160ff909116105b806129635750303b15801561296357505f5460ff166001145b6129c65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610f43565b5f805460ff1916600117905580156129e7575f805461ff0019166101001790555b6129f18d8d613d75565b6129f9613db2565b612a7a612a0687806155fe565b808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250612a449250505060208901896155fe565b808060200260200160405190810160405280939291908181526020018383602002808284375f92019190915250613de092505050565b875f612a8960208a018a61482e565b6001600160401b031690505f5b826001600160401b0316811015612b26578b8b82818110612ab957612ab96151f6565b5f84815260fd6020526040902061010090910292909201919050612add8282615395565b9050508b8b82818110612af257612af26151f6565b612b0992602061010090920201908101915061482e565b612b1c906001600160401b0316836151ad565b9150600101612a96565b50868114612b905760405162461bcd60e51b815260206004820152603160248201527f537570706c79206f6620616c6c20706861736573206d75737420657175616c206044820152706d6178496e74656e646564537570706c7960781b6064820152608401610f43565b60fb612b9c8e82615291565b50612ba788806155fe565b612bb49161010291614681565b5060fc805467ffffffffffffffff19166001600160401b0384161790558860fe612bde8282615506565b5050610104805461ff00191661010088151502179055610101879055612c22612c0a60208e018e614849565b8d6020016020810190612c1d91906156a4565b612e01565b612c2b85612cad565b5050610104805460ff191660011790558015612c80575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b508015612c9f575f8051602061582d833981519152805461ff00191690555b505050505050505050505050565b612cb5612da7565b6001600160a01b038116612d1a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f43565b612d238161376a565b50565b5f6301ffc9a760e01b6001600160e01b031983161480612d5657506380ac58cd60e01b6001600160e01b03198316145b80610d065750506001600160e01b031916635b5e139f60e01b1490565b5f6001600160e01b0319821663152a902d60e11b1480610d0657506301ffc9a760e01b6001600160e01b0319831614610d06565b6033546001600160a01b031633146118405760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610f43565b6127106001600160601b0382161115612e6f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610f43565b6001600160a01b038216612ec55760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610f43565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217609755565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b5f81600111158015612f3b5750612f37612efe565b5482105b8015610d065750600160e01b612f4f612efe565b5f8481526004919091016020526040902054161592915050565b610e5b82826001613e10565b610104545f9060ff16612f9b576040516321094a9b60e01b815260040160405180910390fd5b6101005415801590612faf57506101005442105b15612fcd5760405163037c7a4160e61b815260040160405180910390fd5b60fe545f90612fed908590600160801b90046001600160401b03166151ad565b90505f612ff86120fe565b90508082111561301b576040516352df9fe560e01b815260040160405180910390fd5b60ff5461302890866151c0565b84146130465760405162bfc92160e01b815260040160405180910390fd5b509392505050565b60fe54600160401b90046001600160401b031615801590613093575060fe54600160401b90046001600160401b031681613087846132d4565b61309191906151ad565b115b15610e5b57604051636c80554560e11b815260040160405180910390fd5b5f6130ba612efe565b5490505f8290036130de5760405163b562e8dd60e01b815260040160405180910390fd5b6801000000000000000182026130f2612efe565b6001600160a01b0385165f81815260059290920160205260409091208054929092019091554260a01b6001841460e11b171761312c612efe565b5f83815260049190910160205260408120919091556001600160a01b0384169083830190839083905f8051602061580d8339815191528180a4600183015b81811461318d5780835f5f8051602061580d8339815191525f80a460010161316a565b50815f036131ad57604051622e076360e81b815260040160405180910390fd5b806131b6612efe565b55506110739050565b8047101561320f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610f43565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114613258576040519150601f19603f3d011682016040523d82523d5f602084013e61325d565b606091505b50509050806110735760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610f43565b5f6001600160401b0360406132e7612efe565b6005015f856001600160a01b03166001600160a01b031681526020019081526020015f2054901c169050919050565b5f613320826136c2565b9050836001600160a01b0316816001600160a01b0316146133535760405162a1148160e81b815260040160405180910390fd5b5f8061335e84613ec3565b91509150613383818761336e3390565b6001600160a01b039081169116811491141790565b6133ae57613391863361280e565b6133ae57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166133d557604051633a954ecd60e21b815260040160405180910390fd5b80156133df575f82555b6133e7612efe565b6001600160a01b0387165f9081526005919091016020526040902080545f19019055613411612efe565b6001600160a01b0386165f8181526005929092016020526040909120805460010190554260a01b17600160e11b17613447612efe565b5f8681526004919091016020526040812091909155600160e11b841690036134ba5760018401613475612efe565b5f828152600491909101602052604081205490036134b857613495612efe565b5481146134b857836134a5612efe565b5f83815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b03165f8051602061580d83398151915260405160405180910390a4505050505050565b61107383838360405180602001604052805f81525061226f565b5f613514836136c2565b9050805f8061352286613ec3565b9150915084156135625761353781843361336e565b61356257613545833361280e565b61356257604051632ce44b5f60e11b815260040160405180910390fd5b801561356c575f82555b6fffffffffffffffffffffffffffffffff613585612efe565b6001600160a01b0385165f81815260059290920160205260409091208054929092019091554260a01b17600360e01b176135bd612efe565b5f8881526004919091016020526040812091909155600160e11b8516900361363057600186016135eb612efe565b5f8281526004919091016020526040812054900361362e5761360b612efe565b54811461362e578461361b612efe565b5f83815260049190910160205260409020555b505b60405186905f906001600160a01b038616905f8051602061580d833981519152908390a461365c612efe565b600190810180549091019055505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611073908490613ee8565b5f81600111613751576136d3612efe565b5f83815260049190910160205260408120549150600160e01b8216900361375157805f0361374c57613703612efe565b54821061372357604051636f96cda160e11b815260040160405180910390fd5b61372b612efe565b5f199092015f81815260049390930160205260409092205490508015613723575b919050565b604051636f96cda160e11b815260040160405180910390fd5b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b604080516080810182525f808252602082018190529181018290526060810191909152610d066137e9612efe565b5f8481526004919091016020526040902054613fb9565b5f82815260fd60205260408120600281015460ff16613832576040516321094a9b60e01b815260040160405180910390fd5b80600401544210156138575760405163037c7a4160e61b815260040160405180910390fd5b600181015461387957604051634d0ee1f560e11b815260040160405180910390fd5b80546001600160401b038082169161389a918a91600160401b90041661534b565b6001600160401b031611156138c2576040516352df9fe560e01b815260040160405180910390fd5b60038101546138da906001600160401b0389166151c0565b83146138f85760405162bfc92160e01b815260040160405180910390fd5b61396c8686808060200260200160405190810160405280939291908181526020018383602002808284375f9201919091525050505060018301546040516bffffffffffffffffffffffff1960608d901b16602082015260340160405160208183030381529060405280519060200120614000565b613989576040516309bde33960e01b815260040160405180910390fd5b6001600160a01b0388165f908152610103602090815260408083208784529091528120546001600160401b0390811691906139c6908a16836151ad565b8354909150600160801b90046001600160401b0316158015906139f957508254600160801b90046001600160401b031681115b15613a1757604051636c80554560e11b815260040160405180910390fd5b9998505050505050505050565b5f613a2d612efe565b54919050565b5f82815260fd60205260408120600281015460ff16613a65576040516321094a9b60e01b815260040160405180910390fd5b600481015415801590613a7b5750806004015442105b15613a995760405163037c7a4160e61b815260040160405180910390fd5b80600501544210158015613ab05750600581015415155b15613ace5760405163691c8a2160e01b815260040160405180910390fd5b600181015415613af157604051634d0ee1f560e11b815260040160405180910390fd5b80546001600160401b0380821691613b12918891600160401b9004166151ad565b1115613b31576040516352df9fe560e01b815260040160405180910390fd5b6003810154613b4090866151c0565b8314613b5e5760405162bfc92160e01b815260040160405180910390fd5b6001600160a01b0386165f908152610103602090815260408083208784529091528120546001600160401b031690613b9687836151ad565b8354909150600160801b90046001600160401b031615801590613bc957508254600160801b90046001600160401b031681115b15613be757604051636c80554560e11b815260040160405180910390fd5b979650505050505050565b80613bfb612efe565b335f818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60c9546001600160a01b0384165f90815260cb602052604081205490918391613c9790866151c0565b613ca191906151d7565b61261d91906156bd565b613cb6848484611068565b6001600160a01b0383163b156111a457613cd284848484614015565b6111a4576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182525f808252602082018190529181018290526060810191909152610d06613d1e836136c2565b613fb9565b606060fb8054610d85906150d6565b606060a06040510180604052602081039150505f815280825b600183039250600a81066030018353600a900480613d4b5750819003601f19909101908152919050565b5f8051602061582d83398151915254610100900460ff16613da85760405162461bcd60e51b8152600401610f43906156d0565b610e5b82826140f9565b5f54610100900460ff16613dd85760405162461bcd60e51b8152600401610f4390615724565b61184061416b565b5f54610100900460ff16613e065760405162461bcd60e51b8152600401610f4390615724565b610e5b828261419a565b5f613e1a836115cd565b90508115613e5957336001600160a01b03821614613e5957613e3c813361280e565b613e59576040516367d9dca160e11b815260040160405180910390fd5b83613e62612efe565b5f858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b5f805f613ece612efe565b5f9485526006016020525050604090912080549092909150565b5f613f3c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166142cb9092919063ffffffff16565b8051909150156110735780806020019051810190613f5a919061576f565b6110735760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610f43565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b5f8261400c85846142d9565b14949350505050565b604051630a85bd0160e11b81525f906001600160a01b0385169063150b7a029061404990339089908890889060040161578a565b6020604051808303815f875af1925050508015614083575060408051601f3d908101601f19168201909252614080918101906157c6565b60015b6140df573d8080156140b0576040519150601f19603f3d011682016040523d82523d5f602084013e6140b5565b606091505b5080515f036140d7576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061261d565b5f8051602061582d83398151915254610100900460ff1661412c5760405162461bcd60e51b8152600401610f43906156d0565b81614135612efe565b600201906141439082615291565b508061414d612efe565b6003019061415b9082615291565b506001614166612efe565b555050565b5f54610100900460ff166141915760405162461bcd60e51b8152600401610f4390615724565b6118403361376a565b5f54610100900460ff166141c05760405162461bcd60e51b8152600401610f4390615724565b805182511461422c5760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b6064820152608401610f43565b5f82511161427c5760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f207061796565730000000000006044820152606401610f43565b5f5b8251811015611073576142c383828151811061429c5761429c6151f6565b60200260200101518383815181106142b6576142b66151f6565b6020026020010151614313565b60010161427e565b606061261d84845f856144ef565b5f81815b845181101561304657614309828683815181106142fc576142fc6151f6565b60200260200101516145bb565b91506001016142dd565b6001600160a01b03821661437e5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b6064820152608401610f43565b5f81116143cd5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a207368617265732061726520300000006044820152606401610f43565b6001600160a01b0382165f90815260cb6020526040902054156144465760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b6064820152608401610f43565b60cd8054600181019091557f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0180546001600160a01b0319166001600160a01b0384169081179091555f90815260cb6020526040902081905560c9546144ad9082906151ad565b60c955604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac9101610d61565b6060824710156145505760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610f43565b5f80866001600160a01b0316858760405161456b91906157e1565b5f6040518083038185875af1925050503d805f81146145a5576040519150601f19603f3d011682016040523d82523d5f602084013e6145aa565b606091505b5091509150613be7878383876145e4565b5f8183106145d5575f828152602084905260409020611da6565b505f9182526020526040902090565b606083156146525782515f0361464b576001600160a01b0385163b61464b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610f43565b508161261d565b61261d83838151156146675781518083602001fd5b8060405162461bcd60e51b8152600401610f4391906147bc565b828054828255905f5260205f209081019282156146d2579160200282015b828111156146d25781546001600160a01b0319166001600160a01b0384351617825560209092019160019091019061469f565b506146de9291506146e2565b5090565b5b808211156146de575f81556001016146e3565b6001600160e01b031981168114612d23575f80fd5b5f6020828403121561471b575f80fd5b8135611da6816146f6565b6001600160a01b0381168114612d23575f80fd5b803561374c81614726565b80356001600160601b038116811461374c575f80fd5b5f806040838503121561476c575f80fd5b823561477781614726565b915061478560208401614745565b90509250929050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f611da6602083018461478e565b5f602082840312156147de575f80fd5b5035919050565b5f80604083850312156147f6575f80fd5b823561480181614726565b946020939093013593505050565b6001600160401b0381168114612d23575f80fd5b803561374c8161480f565b5f6020828403121561483e575f80fd5b8135611da68161480f565b5f60208284031215614859575f80fd5b8135611da681614726565b5f805f60608486031215614876575f80fd5b833561488181614726565b9250602084013561489181614726565b929592945050506040919091013590565b5f80604083850312156148b3575f80fd5b50508035926020909101359150565b5f80604083850312156148d3575f80fd5b8235915060208301356148e581614726565b809150509250929050565b5f8083601f840112614900575f80fd5b5081356001600160401b03811115614916575f80fd5b6020830191508360208260051b850101111561111d575f80fd5b5f8060208385031215614941575f80fd5b82356001600160401b03811115614956575f80fd5b614962858286016148f0565b90969095509350505050565b5f806040838503121561497f575f80fd5b823561498a81614726565b915060208301356148e581614726565b8015158114612d23575f80fd5b803561374c8161499a565b5f805f604084860312156149c4575f80fd5b83356001600160401b038111156149d9575f80fd5b6149e5868287016148f0565b90945092505060208401356149f98161499a565b809150509250925092565b634e487b7160e01b5f52604160045260245ffd5b5f806001600160401b03841115614a3157614a31614a04565b50604051601f19601f85018116603f011681018181106001600160401b0382111715614a5f57614a5f614a04565b604052838152905080828401851015614a76575f80fd5b838360208301375f60208583010152509392505050565b5f82601f830112614a9c575f80fd5b611da683833560208501614a18565b5f60208284031215614abb575f80fd5b81356001600160401b03811115614ad0575f80fd5b61261d84828501614a8d565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b602080825282518282018190525f918401906040840190835b81811015614b5a57614b44838551614adc565b6020939093019260809290920191600101614b31565b509095945050505050565b602080825282518282018190525f918401906040840190835b81811015614b5a578351835260209384019390920191600101614b7e565b5f80828403610120811215614baf575f80fd5b83359250610100601f1982011215614bc5575f80fd5b506020830190509250929050565b5f805f805f60608688031215614be7575f80fd5b8535945060208601356001600160401b03811115614c03575f80fd5b614c0f888289016148f0565b90955093505060408601356001600160401b03811115614c2d575f80fd5b614c39888289016148f0565b969995985093965092949392505050565b5f805f8060608587031215614c5d575f80fd5b843593506020850135614c6f8161480f565b925060408501356001600160401b03811115614c89575f80fd5b614c95878288016148f0565b95989497509550505050565b5f805f60608486031215614cb3575f80fd5b8335614cbe81614726565b95602085013595506040909401359392505050565b5f60a0828403121561218c575f80fd5b5f60a08284031215614cf3575f80fd5b611da68383614cd3565b5f805f805f805f6080888a031215614d13575f80fd5b87356001600160401b03811115614d28575f80fd5b614d348a828b016148f0565b90985096505060208801356001600160401b03811115614d52575f80fd5b614d5e8a828b016148f0565b90965094505060408801356001600160401b03811115614d7c575f80fd5b614d888a828b016148f0565b9094509250506060880135614d9c8161480f565b8091505092959891949750929550565b5f8060408385031215614dbd575f80fd5b8235614dc881614726565b915060208301356148e58161499a565b5f805f8060808587031215614deb575f80fd5b8435614df681614726565b93506020850135614e0681614726565b92506040850135915060608501356001600160401b03811115614e27575f80fd5b8501601f81018713614e37575f80fd5b614e4687823560208401614a18565b91505092959194509250565b5f805f8060408587031215614e65575f80fd5b84356001600160401b03811115614e7a575f80fd5b614e86878288016148f0565b90955093505060208501356001600160401b03811115614c89575f80fd5b60808101610d068284614adc565b5f8060408385031215614ec3575f80fd5b8235915060208301356148e58161480f565b5f610100820190506001600160401b0383511682526001600160401b0360208401511660208301526001600160401b036040840151166040830152606083015160608301526080830151614f2d608084018215159052565b5060a083015160a083015260c083015160c083015260e083015160e083015292915050565b5f6040828403121561218c575f80fd5b5f8083601f840112614f72575f80fd5b5081356001600160401b03811115614f88575f80fd5b6020830191508360208260081b850101111561111d575f80fd5b5f805f805f805f805f805f6101e08c8e031215614fbd575f80fd5b8b356001600160401b03811115614fd2575f80fd5b614fde8e828f01614a8d565b9b505060208c01356001600160401b03811115614ff9575f80fd5b6150058e828f01614a8d565b9a505060408c01356001600160401b03811115615020575f80fd5b61502c8e828f01614a8d565b99505061503c8d60608e01614f52565b975060a08c01356001600160401b03811115615056575f80fd5b6150628e828f01614f62565b909850965061507690508d60c08e01614cd3565b94506101608c01356001600160401b03811115615091575f80fd5b61509d8e828f01614f52565b9450506101808c013592506150b56101a08d016149a7565b91506150c46101c08d0161473a565b90509295989b509295989b9093969950565b600181811c908216806150ea57607f821691505b60208210810361218c57634e487b7160e01b5f52602260045260245ffd5b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610d0657610d06615199565b8082028115828204841417610d0657610d06615199565b5f826151f157634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52603260045260245ffd5b604080825281018390525f6001600160fb1b03841115615228575f80fd5b8360051b808660608501379215156020830152500160600192915050565b601f82111561107357805f5260205f20601f840160051c8101602085101561526b5750805b601f840160051c820191505b8181101561528a575f8155600101615277565b5050505050565b81516001600160401b038111156152aa576152aa614a04565b6152be816152b884546150d6565b84615246565b6020601f8211600181146152f0575f83156152d95750848201515b5f19600385901b1c1916600184901b17845561528a565b5f84815260208120601f198516915b8281101561531f57878501518255602094850194600190920191016152ff565b508482101561533c57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b6001600160401b038181168382160190811115610d0657610d06615199565b805467ffffffffffffffff60801b191660809290921b67ffffffffffffffff60801b16919091179055565b81356153a08161480f565b815467ffffffffffffffff19166001600160401b0382161782555060208201356153c98161480f565b815467ffffffffffffffff60401b1916604082901b67ffffffffffffffff60401b161782555060408201356153fd8161480f565b615407818361536a565b50606082013560018201555f60808301356154218161499a565b60028301805491151560ff1660ff19929092169190911790555060a0820135600382015560c0820135600482015560e090910135600590910155565b828152610120810182356154708161480f565b6001600160401b038116602084015250602083013561548e8161480f565b6001600160401b0381166040840152506154aa60408401614823565b6001600160401b03811660608401525060608301356080838101919091526154d39084016149a7565b80151560a08401525060a083013560c08381019190915283013560e0808401919091529092013561010090910152919050565b81356155118161480f565b815467ffffffffffffffff19166001600160401b03821617825550602082013561553a8161480f565b815467ffffffffffffffff60401b1916604082901b67ffffffffffffffff60401b1617825550604082013561556e8161480f565b615578818361536a565b5060608201356001820155608090910135600290910155565b60a0810182356155a08161480f565b6001600160401b0316825260208301356155b98161480f565b6001600160401b0316602083015260408301356155d58161480f565b6001600160401b0316604083015260608381013590830152608092830135929091019190915290565b5f808335601e19843603018112615613575f80fd5b8301803591506001600160401b0382111561562c575f80fd5b6020019150600581901b360382131561111d575f80fd5b6001600160401b038281168282160390811115610d0657610d06615199565b5f60208284031215615672575f80fd5b5051919050565b5f81518060208401855e5f93019283525090919050565b5f61261d61569e8386615679565b84615679565b5f602082840312156156b4575f80fd5b611da682614745565b81810381811115610d0657610d06615199565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b5f6020828403121561577f575f80fd5b8151611da68161499a565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906157bc9083018461478e565b9695505050505050565b5f602082840312156157d6575f80fd5b8151611da6816146f6565b5f611da6828461567956fe3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a4273ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212202b29f63e57f5361d10dafd819608f9e6406623334eec682296a76430407cb9de64736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
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.