Overview
POL Balance
0 POL
POL Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
TheGenerates
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { TGenContract, SafeTransferLib } from "./extensions/TGenContract.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /* $$$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$\ $$ __$$\ $$ | $$ | $$ __$$\ $$ | $$ |\__| $$ | $$ | $$$$$$\ $$ | $$\ $$$$$$\ $$ / \__|$$$$$$\ $$\ $$\ $$$$$$$ |$$\ $$$$$$\ $$$$$$$\ $$$$$$$ |$$ __$$\ $$ | $$ |\_$$ _| \$$$$$$\ \_$$ _| $$ | $$ |$$ __$$ |$$ |$$ __$$\ $$ _____| $$ __$$< $$$$$$$$ |$$$$$$ / $$ | \____$$\ $$ | $$ | $$ |$$ / $$ |$$ |$$ / $$ |\$$$$$$\ $$ | $$ |$$ ____|$$ _$$< $$ |$$\ $$\ $$ | $$ |$$\ $$ | $$ |$$ | $$ |$$ |$$ | $$ | \____$$\ $$ | $$ |\$$$$$$$\ $$ | \$$\ \$$$$ | \$$$$$$ | \$$$$ |\$$$$$$ |\$$$$$$$ |$$ |\$$$$$$ |$$$$$$$ | \__| \__| \_______|\__| \__| \____/ \______/ \____/ \______/ \_______|\__| \______/ \_______/ */ /** * @title TheGenerates * @author decapitator (0xdecapitator.eth) * @notice An ERC721 token contract based on ERC721A that can mint NFTs. * Implements Limit Break's Creator Token Standards transfer * validation for royalty enforcement. */ contract TheGenerates is TGenContract { /** * @notice Deploy the token contract. * * @param allowedConfigurer The address of the contract allowed to * implementation code. Also contains * TheGenerates implementation code. * @param ownerToSet The owner address to set. */ constructor( address allowedConfigurer, address ownerToSet ) payable TGenContract(allowedConfigurer) { if (ownerToSet == address(0)) revert NewOwnerIsZeroAddress(); // Set the owner. _initializeOwner(ownerToSet); } /** * @notice Withdraws contract balance to the contract owner. * Provided as a safety measure to rescue stuck funds since ERC721A * makes all methods payable for gas efficiency reasons. * * Only the owner can use this function. */ function withdraw() external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Put the balance on the stack. uint256 balance = address(this).balance; // Revert if the contract has no balance. if (balance == 0) { revert NoBalanceToWithdraw(); } // Send contract balance to the owner. (bool success, bytes memory data) = payable(owner()).call{ value: balance }(""); // Require that the call was successful. if (!success) { // Bubble up the revert reason. assembly { revert(add(32, data), mload(data)) } } } /** * @notice Withdraws contract erc20 tokens balance to the contract owner. * Provided as a safety measure to rescue stuck funds. * * Only the owner can use this function. */ function withdrawERC20(address token) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); uint256 balance = IERC20(token).balanceOf(address(this)); if (balance == 0) { revert NoBalanceToWithdraw(); } SafeTransferLib.safeTransfer(token, owner(), balance); } /** * @notice Burns `tokenId`. The caller must own `tokenId` or be an * approved operator. * * @param tokenId The token id to burn. */ function burn(uint256 tokenId) external virtual { // Passing `true` to `_burn()` checks that the caller owns the token // or is an approved operator. _burn(tokenId, true); } } /* $$\ $$\ $$ | $$ | $$ | $$ |$$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$\ $$ | $$ |$$ __$$\ $$ _____|$$ __$$\ $$ __$$\ $$ __$$\ $$ | $$ |$$ | $$ |\$$$$$$\ $$$$$$$$ |$$$$$$$$ |$$ | $$ | $$ | $$ |$$ | $$ | \____$$\ $$ ____|$$ ____|$$ | $$ | \$$$$$$ |$$ | $$ |$$$$$$$ |\$$$$$$$\ \$$$$$$$\ $$ | $$ | \______/ \__| \__|\_______/ \_______| \_______|\__| \__| */
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { IERC4907A } from "../interfaces/IERC4907A.sol"; import { ERC721A, IERC721A } from "erc721a/contracts/ERC721A.sol"; /** * @title ERC4907A * * @dev [ERC4907](https://eips.ethereum.org/EIPS/eip-4907) compliant * extension of ERC721A, which allows owners and authorized addresses * to add a time-limited role with restricted permissions to ERC721 tokens. */ abstract contract ERC4907A is ERC721A, IERC4907A { // The bit position of `expires` in packed user info. uint256 private constant _BITPOS_EXPIRES = 160; // Mapping from token ID to user info. // // Bits Layout: // - [0..159] `user` // - [160..223] `expires` mapping(uint256 => uint256) private _packedUserInfo; ///@notice Struct for rentable info struct RentableTokenInfo { bool rentable; uint128 ratePerMinute; } /// @notice Mapping from token ID to rentable info. mapping(uint256 => RentableTokenInfo) public rentablesInfo; modifier isAuthorized(uint256 tokenId) { // Require the caller to be either the token owner or an approved operator. address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) { if (!isApprovedForAll(owner, _msgSenderERC721A())) { if (getApproved(tokenId) != _msgSenderERC721A()) { _revert(SetUserCallerNotOwnerNorApproved.selector); } } } _; } /** * @notice Internal function for setting user and expiration details for a token * * @param tokenId The token to set user and expiration details * @param user The address of the user * @param expires The time in minutes until the token expires */ function _setUserAndExpiration( uint256 tokenId, address user, uint64 expires ) private { if (userOf(tokenId) != address(0)) { revert TokenIsRented(); } if (expires == 0) { revert NoExpiryAssigned(); } _packedUserInfo[tokenId] = (uint256(block.timestamp + expires * 60) << _BITPOS_EXPIRES) | uint256(uint160(user)); emit UpdateUser(tokenId, user, expires); } /** * @notice Internal function for renting a token * * @param tokenId The token to rent * @param expires The time in minutes to rent the token * @return dueAmount The amount of UNCN to be paid */ function _rent( uint256 tokenId, uint64 expires ) internal virtual returns (uint256 dueAmount) { if (!rentablesInfo[tokenId].rentable) { revert RentingDisabled(); } dueAmount = rentablesInfo[tokenId].ratePerMinute * expires; _setUserAndExpiration(tokenId, _msgSenderERC721A(), expires); } /** * @notice Internal function for releasing a rented token * * @param tokenId The token to rent * * only callable by userOf tokenId. */ function _releaseToken(uint256 tokenId) internal virtual { if (userOf(tokenId) != msg.sender) { revert NotAllowed(); } // Reset the _packedUserInfo for the tokenId _packedUserInfo[tokenId] = 0; emit TokenReleased(tokenId); } /** * @dev Sets the `user` and `expires` for `tokenId`. * The zero address indicates there is no user. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function setUser( uint256 tokenId, address user, uint64 expires ) public virtual override isAuthorized(tokenId) { _setUserAndExpiration(tokenId, user, expires); } /** * @notice Function to set the rentable status and/or fee of a token * * @param tokenId The token to set the rentable status and/or fee * @param rentable The rentable status of the token * @param ratePerMinute The rent fee in UNCN per minute * @dev The rent fee is set in UNCN per minute */ function setRentablesInfo( uint256 tokenId, bool rentable, uint128 ratePerMinute ) public virtual isAuthorized(tokenId) { bool statusChanged = false; bool feeChanged = false; if (rentablesInfo[tokenId].rentable != rentable) { rentablesInfo[tokenId].rentable = rentable; statusChanged = true; } if (rentablesInfo[tokenId].ratePerMinute != ratePerMinute) { rentablesInfo[tokenId].ratePerMinute = ratePerMinute; feeChanged = true; } if (!statusChanged && !feeChanged) { revert NoChange(); } emit RentableInfo(tokenId, rentable, ratePerMinute); } /** * @notice Function to get the rentable status and fee of a token * * @param tokenId The token to get the rentable status and fee * @return ratePerMinute The rent fee in UNCN per minute * @return rentable The rentable status of the token * @dev The rent fee is set in UNCN per minute */ function getTokenRentInfo( uint256 tokenId ) external view returns (uint256, bool) { return ( rentablesInfo[tokenId].ratePerMinute, rentablesInfo[tokenId].rentable ); } /** * @dev Returns the user address for `tokenId`. * * The zero address indicates that there is no user or if the user is expired. */ function userOf( uint256 tokenId ) public view virtual override returns (address) { uint256 packed = _packedUserInfo[tokenId]; assembly { // Branchless `packed *= (block.timestamp <= expires ? 1 : 0)`. // If the `block.timestamp == expires`, the `lt` clause will be true // if there is a non-zero user address in the lower 160 bits of `packed`. packed := mul( packed, // `block.timestamp <= expires ? 1 : 0`. lt(shl(_BITPOS_EXPIRES, timestamp()), packed) ) } return address(uint160(packed)); } /** * @dev Returns the user's expires of `tokenId`. */ function userExpires( uint256 tokenId ) public view virtual override returns (uint256) { return _packedUserInfo[tokenId] >> _BITPOS_EXPIRES; } /** * @dev Override of {IERC165-supportsInterface}. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC721A, IERC721A) returns (bool) { // The interface ID for ERC4907 is `0xad092b5c`, // as defined in [ERC4907](https://eips.ethereum.org/EIPS/eip-4907). return super.supportsInterface(interfaceId) || interfaceId == 0xad092b5c; } /** * @dev Returns the user address for `tokenId`, ignoring the expiry status. */ function explicitUserOf( uint256 tokenId ) external view virtual returns (address) { return address(uint160(_packedUserInfo[tokenId])); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { IERC721A } from "erc721a/contracts/IERC721A.sol"; /** * @dev Interface of ERC4907A. */ interface IERC4907A is IERC721A { /** * The caller must own the token or be an approved operator. */ error SetUserCallerNotOwnerNorApproved(); /** * The token is already rented out. */ error TokenIsRented(); /** * Trying to rent a token with 0 expiry. */ error NoExpiryAssigned(); /** * The token id is not rentable. */ error RentingDisabled(); /** * The caller is not allowed. */ error NotAllowed(); /** * The token id rentable status is already set. */ error AlreadySet(); /** * The token id rentable fee is already set. */ error FeeAlreadySet(); /** * Error indicating no changes were made. */ error NoChange(); /** * @dev Emitted when the `user` of an NFT or the `expires` of the `user` is changed. * The zero address for user indicates that there is no user address. */ event UpdateUser( uint256 indexed tokenId, address indexed user, uint64 expires ); /** * @dev Emitted when the `rentee` of an NFT release the token before it expires. */ event TokenReleased(uint256 indexed tokenId); /** * @dev Emitted when an authorized user set token's rentable infos. */ event RentableInfo( uint256 indexed tokenId, bool rentable, uint256 ratePerMinute ); /** * @dev Sets the `user` and `expires` for `tokenId`. * The zero address indicates there is no user. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function setUser(uint256 tokenId, address user, uint64 expires) external; /** * @dev Returns the user address for `tokenId`. * The zero address indicates that there is no user or if the user is expired. */ function userOf(uint256 tokenId) external view returns (address); /** * @dev Returns the user's expires of `tokenId`. */ function userExpires(uint256 tokenId) external view returns (uint256); /** * @dev Rent a token id for _expires time. */ function rent(uint256 tokenId, uint64 _expires) external; /** * @dev Release a token id before rent expires. */ function releaseToken(uint256 tokenId) external; /** * @notice Set the rentable status and rent fee of a specific token. * @param tokenId The tokenId of the token to update. * @param rentable The rentable status to set for the token. * @param ratePerMinute The rent fee in UNCN per minute. */ function setRentablesInfo( uint256 tokenId, bool rentable, uint128 ratePerMinute ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { ERC4907A, ERC721A, IERC721A } from "../../extensions/ERC4907A.sol"; import { ERC721AQueryable } from "erc721a/contracts/extensions/ERC721AQueryable.sol"; contract AuthenticatedProxy {} contract ProxyRegistry { mapping(address => AuthenticatedProxy) public proxies; } /** * @title MarketsPreapproved * @notice ERC721A with: * - Unseen Market Registry proxies preapproved. */ abstract contract MarketsPreapproved is ERC4907A, ERC721AQueryable { address public unseenMarketRegistry; /** * @notice Deploy the token contract. */ constructor() payable ERC721A("The Generates", "TGen") {} function _isProxyForUser( address _user, address _address ) internal view virtual returns (bool) { if (unseenMarketRegistry.code.length == 0) { return false; } return address(ProxyRegistry(unseenMarketRegistry).proxies(_user)) == _address; } /** * @dev Returns if the `operator` is allowed to manage all of the * assets of `owner`. Always returns true for unseen market user's proxy. */ function isApprovedForAll( address owner, address operator ) public view virtual override(ERC721A, IERC721A) returns (bool) { if (_isProxyForUser(owner, operator)) { return true; } return ERC721A.isApprovedForAll(owner, operator); } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC4907A, ERC721A, IERC721A) returns (bool) { return ERC4907A.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { ICreatorToken } from "../interfaces/ICreatorToken.sol"; import { ErrorsAndEvents } from "../lib/ErrorsAndEvents.sol"; /** * @title TokenTransferValidator * @notice Functionality to use a transfer validator. */ abstract contract TokenTransferValidator is ICreatorToken, ErrorsAndEvents { /// @dev Store the transfer validator. The null address means no transfer validator is set. address internal _transferValidator; /// @notice Returns the currently active transfer validator. /// The null address means no transfer validator is set. function getTransferValidator() external view returns (address) { return _transferValidator; } /// @notice Set the transfer validator. /// The external method that uses this must include access control. function _setTransferValidator(address newValidator) internal { address oldValidator = _transferValidator; if (oldValidator == newValidator) { revert SameTransferValidator(); } _transferValidator = newValidator; emit TransferValidatorUpdated(oldValidator, newValidator); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { IContractMetadata } from "../interfaces/IContractMetadata.sol"; import { MarketsPreapproved, ERC721A, IERC721A } from "../abstract/MarketsPreapproved.sol"; import { ICreatorToken } from "../interfaces/ICreatorToken.sol"; import { ITransferValidator } from "../interfaces/ITransferValidator.sol"; import { TokenTransferValidator } from "../abstract/TokenTransferValidator.sol"; import { Ownable } from "solady/src/auth/Ownable.sol"; import { ERC2981 } from "solady/src/tokens/ERC2981.sol"; /** * @title ContractMetadata * @author decapitator (0xdecapitator.eth) * @notice A token contract that extends ERC-721 * with additional metadata and ownership capabilities. */ contract ContractMetadata is MarketsPreapproved, TokenTransferValidator, ERC2981, Ownable, IContractMetadata { /// @notice The max supply. uint256 internal _maxSupply; /// @notice The base URI for token metadata. string internal _tokenBaseURI; /// @notice The contract URI for contract metadata. string internal _contractURI; /// @notice The provenance hash for guaranteeing metadata order /// for random reveals. bytes32 internal _provenanceHash; /// @notice The allowed contract that can configure TheGenerates parameters. address internal immutable _CONFIGURER; /** * @dev Reverts if the sender is not the owner or the allowed * configurer contract. * * This is used as a function instead of a modifier * to save contract space when used multiple times. */ function _onlyOwnerOrConfigurer() internal view { if (msg.sender != _CONFIGURER && msg.sender != owner()) { revert Unauthorized(); } } /** * @notice Deploy the token contract. * * @param allowedConfigurer The address of the contract allowed to * configure parameters. Also contains * TheGenerates implementation code. */ constructor(address allowedConfigurer) payable MarketsPreapproved() { if (allowedConfigurer == address(0)) { revert ConfigurerCannotBeZeroAddress(); } // Set the allowed configurer contract to interact with this contract. _CONFIGURER = allowedConfigurer; } /** * @notice Lets a user rent a specific NFT. * @param tokenId The tokenId of the NFT to rent. * @param expires The number of minutes the NFT will be rented for. */ function rent(uint256 tokenId, uint64 expires) external virtual override { super._rent(tokenId, expires); } /** * @notice Lets a user release his token to its owner before rent expires. * @param tokenId The tokenId of the NFT to rent. */ function releaseToken(uint256 tokenId) external override { _releaseToken(tokenId); } /** * @notice Sets the base URI for the token metadata and emits an event. * * @param newBaseURI The new base URI to set. */ function setBaseURI(string calldata newBaseURI) external override { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Set the new base URI. _tokenBaseURI = newBaseURI; // Emit an event with the update. if (totalSupply() != 0) { emit BatchMetadataUpdate(_startTokenId(), _nextTokenId() - 1); } } /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external override { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Set the new contract URI. _contractURI = newContractURI; // Emit an event with the update. emit ContractURIUpdated(newContractURI); } /** * @notice Emit an event notifying metadata updates for * a range of token ids, according to EIP-4906. * * @param fromTokenId The start token id. * @param toTokenId The end token id. */ function emitBatchMetadataUpdate( uint256 fromTokenId, uint256 toTokenId ) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Emit an event with the update. emit BatchMetadataUpdate(fromTokenId, toTokenId); } /** * @notice Sets the max token supply and emits an event. * * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 newMaxSupply) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Ensure the max supply does not exceed the maximum value of uint64, // a limit due to the storage of bit-packed variables in ERC721A. if (newMaxSupply > 2 ** 64 - 1) { revert CannotExceedMaxSupplyOfUint64(newMaxSupply); } // Ensure the max supply is greater then total minted. if (newMaxSupply < _totalMinted()) { revert NewMaxSupplyCannotBeLessThenTotalMinted( newMaxSupply, _totalMinted() ); } // Set the new max supply. _maxSupply = newMaxSupply; // Emit an event with the update. emit MaxSupplyUpdated(newMaxSupply); } /** * @notice Sets the provenance hash and emits an event. * * The provenance hash is used for reveals, which * is a hash of the ordered metadata to show it has not been * modified after mint started. * * This function will revert after the first item has been minted. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); // Keep track of the old provenance hash for emitting with the event. bytes32 oldProvenanceHash = _provenanceHash; // Set the new provenance hash. _provenanceHash = newProvenanceHash; // Emit an event with the update. // Users can track events onchain in case provenance hashes are // updated due to seasonal drop (_maxSupply update). // Its will also be verifiable off-chain for additional transparency. emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash); } /** * @notice Sets the default royalty information. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points. */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external { // Ensure the sender is only the owner or configurer contract. _onlyOwnerOrConfigurer(); if (feeNumerator > 1_000) revert InvalidBasisPoints(feeNumerator); // Set the default royalty. // ERC2981 implementation ensures feeNumerator <= feeDenominator // and receiver != address(0). _setDefaultRoyalty(receiver, feeNumerator); // Emit an event with the updated params. emit RoyaltyInfoUpdated(receiver, feeNumerator); } /** * @notice Set the transfer validator. Only callable by the token owner. */ function setTransferValidator(address newValidator) external onlyOwner { // Set the new transfer validator. _setTransferValidator(newValidator); } /** * @notice Set unseen market registry. Only callable by the token owner. */ function setUnseenMarketRegistry( address _unseenMarketRegistry ) external onlyOwner { if (_unseenMarketRegistry == unseenMarketRegistry) revert SameUnseenMarketRegistry(); // Set the new unseen market registry. unseenMarketRegistry = _unseenMarketRegistry; emit UnseenMarketRegistryUpdated(_unseenMarketRegistry); } /** * @notice Returns the base URI for token metadata. */ function baseURI() external view override returns (string memory) { return _baseURI(); } /** * @notice Returns the base URI for the contract, which ERC721A uses * to return tokenURI. */ function _baseURI() internal view virtual override returns (string memory) { return _tokenBaseURI; } /** * @notice Returns the contract URI for contract metadata. */ function contractURI() external view override returns (string memory) { return _contractURI; } /** * @notice Returns the max token supply. */ function maxSupply() public view returns (uint256) { return _maxSupply; } /** * @notice Returns the provenance hash. * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it is unmodified * after mint has started. */ function provenanceHash() external view override returns (bytes32) { return _provenanceHash; } /** * @notice Returns the token URI for token metadata. * * @param tokenId The token id to get the token URI for. */ function tokenURI( uint256 tokenId ) public view virtual override(ERC721A, IERC721A) returns (string memory) { // Revert if the tokenId doesn't exist. if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); // Put the baseURI on the stack. string memory theBaseURI = _baseURI(); // Return empty if baseURI is empty. if (bytes(theBaseURI).length == 0) { return ""; } // If the last character of the baseURI is not a slash, then return // the baseURI to signal the same metadata for all tokens, such as // for a prereveal state. if (bytes(theBaseURI)[bytes(theBaseURI).length - 1] != bytes("/")[0]) { return theBaseURI; } // Append the tokenId to the baseURI and return. return string.concat(theBaseURI, _toString(tokenId)); } /** * @notice Returns the transfer validation function used. */ function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) { functionSignature = ITransferValidator.validateTransfer.selector; isViewFunction = false; } /** * @dev Hook that is called before any token transfer. * This includes minting and burning. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 /* quantity */ ) internal virtual override { if (from != address(0) && to != address(0)) { // Restrict transfer if token is rented. if (userOf(startTokenId) != address(0)) { revert TokenIsRented(); } // Call the transfer validator if one is set. address transferValidator = _transferValidator; if (transferValidator != address(0)) { ITransferValidator(transferValidator).validateTransfer( msg.sender, from, to, startTokenId ); } } } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(MarketsPreapproved, ERC2981) returns (bool) { return interfaceId == type(IContractMetadata).interfaceId || interfaceId == type(ICreatorToken).interfaceId || interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate) ERC2981.supportsInterface(interfaceId) || // MarketsPreapproved returns supportsInterface true for // ERC165, ERC721, ERC721Metadata MarketsPreapproved.supportsInterface(interfaceId); } /** * @dev Overrides the `_startTokenId` function from ERC721A to start at * token id `1`. * * This is to avoid issues since `0` is typically used to signal * values that have not been set or have been removed. */ function _startTokenId() internal view virtual override returns (uint256) { return 1; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { ITheGenerates } from "../interfaces/ITheGenerates.sol"; import { ContractMetadata } from "./ContractMetadata.sol"; import { TheGeneratesStorage } from "../lib/TheGeneratesStorage.sol"; import { ITheGeneratesConfigurer } from "../interfaces/ITheGeneratesConfigurer.sol"; import { SafeTransferLib } from "solady/src/utils/SafeTransferLib.sol"; /** * @title TGenContract * @author decapitator (0xdecapitator.eth) * @notice An ERC721 token contract based on ERC721A that can mint NFTs. */ contract TGenContract is ContractMetadata { using TheGeneratesStorage for TheGeneratesStorage.Layout; /** * @notice Deploy the token contract. * * @param allowedConfigurer The address of the contract allowed to * configure parameters. Also contains * TheGenerates implementation code. */ constructor( address allowedConfigurer ) payable ContractMetadata(allowedConfigurer) { // Emit an event noting the contract deployment. emit TheGeneratesDeployed(); } /** * @notice The fallback function is used as a dispatcher for TheGenerates * methods. */ fallback(bytes calldata) external returns (bytes memory output) { // Get the function selector. bytes4 selector = msg.sig; // Get the rest of the msg data after the selector. bytes calldata data = msg.data[4:]; // Determine if we should forward the call to the implementation // contract with TheGenerates logic. bool callTheGeneratesImplementation = selector == ITheGenerates.updateAllowList.selector || selector == ITheGenerates.updateUnseenPayout.selector || selector == ITheGenerates.updateSigner.selector || selector == ITheGenerates.updatePublicDrop.selector || selector == ITheGenerates.updatePaymentToken.selector || selector == ITheGeneratesConfigurer.mint.selector || selector == ITheGenerates.getPublicDrop.selector || selector == ITheGenerates.getUnseenPayout.selector || selector == ITheGenerates.getPaymentToken.selector || selector == ITheGenerates.getAllowListMerkleRoot.selector || selector == ITheGenerates.getSigner.selector || selector == ITheGenerates.getDigestIsUsed.selector; // Determine if we should require only the owner or configurer calling. bool requireOnlyOwnerOrConfigurer = selector == ITheGenerates.updateAllowList.selector || selector == ITheGenerates.updateSigner.selector || selector == ITheGenerates.updateUnseenPayout.selector || selector == ITheGenerates.updatePaymentToken.selector || selector == ITheGenerates.updatePublicDrop.selector; if (callTheGeneratesImplementation) { // For update calls, ensure the sender is only the owner // or configurer contract. if (requireOnlyOwnerOrConfigurer) { _onlyOwnerOrConfigurer(); } // Forward the call to the implementation contract. (bool success, bytes memory returnedData) = _CONFIGURER .delegatecall(msg.data); // Require that the call was successful. if (!success) { // Bubble up the revert reason. assembly { revert(add(32, returnedData), mload(returnedData)) } } // If the call was to mint the tokens. if (selector == ITheGeneratesConfigurer.mint.selector) { _mintOrder(returnedData); } // Return the data from the delegate call. return returnedData; } else if (selector == ITheGenerates.getMintStats.selector) { // Get the mint stats. (uint256 totalMinted, uint256 maxSupply) = _getMintStats(); // Encode the return data. return abi.encode(totalMinted, maxSupply); } else if (selector == ITheGenerates.configurer.selector) { // Return the configurer contract. return abi.encode(_CONFIGURER); } else if (selector == ITheGenerates.multiConfigureMint.selector) { // Ensure only the owner or configurer can call this function. _onlyOwnerOrConfigurer(); // Mint the tokens. _multiConfigureMint(data); } else { // Revert if the function selector is not supported. revert UnsupportedFunctionSelector(selector); } } /** * @notice Returns a set of mint stats. * This assists in enforcing maxSupply * and maxTokenSupplyForStage checks. * * @dev NOTE: Implementing contracts should always update these numbers * before transferring any tokens with _safeMint() to mitigate * consequences of malicious onERC721Received() hooks. * */ function _getMintStats() internal view returns (uint256 totalMinted, uint256 maxSupply) { totalMinted = _totalMinted(); maxSupply = _maxSupply; } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface( bytes4 interfaceId ) public view virtual override(ContractMetadata) returns (bool) { return interfaceId == type(ITheGenerates).interfaceId || interfaceId == type(ITheGeneratesConfigurer).interfaceId || // ContractMetadata returns supportsInterface true for // IERC721ContractMetadata, ERC-4906, ERC-2981 // ERC721A returns supportsInterface true for // ERC165, ERC721, ERC721Metadata ContractMetadata.supportsInterface(interfaceId); } /** * @dev Internal function to mint tokens. * * @param returnedData The data returned from configurer. */ function _mintOrder(bytes memory returnedData) internal { // Decode minter from returnedData. (address minter, uint256 quantity) = abi.decode( returnedData, (address, uint256) ); // Mint the tokens. _mint(minter, quantity); } /** * @dev Internal function to mint tokens during a multiConfigureMint call * from the configurer contract. * * @param data The original transaction calldata, without the selector. */ function _multiConfigureMint(bytes calldata data) internal { // Decode the calldata. (address recipient, uint256 quantity) = abi.decode( data, (address, uint256) ); _mint(recipient, quantity); } /** * @notice Lets a user rent a specific NFT. * @param tokenId The tokenId of the NFT to rent. * @param expires The number of minutes the NFT will be rented for. */ function rent(uint256 tokenId, uint64 expires) external override { uint256 amount = super._rent(tokenId, expires); if (amount == 0) { return; } TheGeneratesStorage.Layout storage layout = TheGeneratesStorage .layout(); address payout = layout._unseenPayout.payoutAddress; uint16 basisPoints = layout._unseenPayout.basisPoints; address uncn = layout._uncn; if (basisPoints > 0) { uint256 fee = (amount * basisPoints) / 10000; SafeTransferLib.safeTransferFrom(uncn, msg.sender, payout, fee); amount -= fee; } SafeTransferLib.safeTransferFrom( uncn, msg.sender, ownerOf(tokenId), amount ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; interface IContractMetadata { /** * @notice Returns the base URI for token metadata. */ function baseURI() external view returns (string memory); /** * @notice Returns the contract URI. */ function contractURI() external view returns (string memory); /** * @notice Returns the provenance hash. * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it is unmodified * after mint has started. */ function provenanceHash() external view returns (bytes32); /** * @notice Sets the max supply and emits an event. * * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 newMaxSupply) external; /** * @notice Returns the max token supply. */ function maxSupply() external view returns (uint256); /** * @notice Sets the base URI for the token metadata and emits an event. * * @param tokenURI The new base URI to set. */ function setBaseURI(string calldata tokenURI) external; /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external; /** * @notice Sets the provenance hash and emits an event. * * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it has not been * modified after mint started. * * This function will revert after the first item has been minted. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external; /** * @notice Sets the default royalty information. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator of * 10_000 basis points. */ function setDefaultRoyalty(address receiver, uint96 feeNumerator) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; interface ICreatorToken { function getTransferValidator() external view returns (address validator); function getTransferValidationFunction() external view returns (bytes4 functionSignature, bool isViewFunction); function setTransferValidator(address validator) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { ConfigStructs } from "../types/DataTypes.sol"; /** * @dev A helper interface to get and set parameters for TheGenerates. * The token does not expose these methods as part of its external * interface to optimize contract size, but does implement them. */ interface ITheGenerates { /** * @notice Update TheGenerates public drop parameters. * * @param publicDrop The new public drop parameters. */ function updatePublicDrop( ConfigStructs.PublicDrop calldata publicDrop ) external; /** * @notice Returns the public drop stage parameters. */ function getPublicDrop() external view returns (ConfigStructs.PublicDrop memory); /** * @notice Returns a set of mint stats. * This assists the generates in enforcing maxSupply, * and maxTokenSupplyForStage checks. * * @dev NOTE: Implementing contracts should always update these numbers * before transferring any tokens with _safeMint() to mitigate * consequences of malicious onERC721Received() hooks. * */ function getMintStats() external view returns (uint256 totalMinted, uint256 maxSupply); /** * @notice This function is only allowed to be called by the configurer * contract as a way to batch mints and configuration in one tx. * * @param recipient The address to receive the mints. * @param quantity The quantity of tokens to mint. */ function multiConfigureMint(address recipient, uint256 quantity) external; /** * @notice Update TheGenerates payout address. * The basis points must be max 1_000. * Only the owner can use this function. * * @param unseenPayout The unseen payout. */ function updateUnseenPayout( ConfigStructs.UnseenPayout calldata unseenPayout ) external; /** * @notice Update TheGenerates payment token. * Only the owner can use this function. * * @param paymentToken The paymen token to update. */ function updatePaymentToken(address paymentToken) external; /** * @notice Update the generates allow list data. * Only the owner can use this function. * * @param merkleRoot The new allow list merkle root. */ function updateAllowList(bytes32 merkleRoot) external; /** * @notice Update the TGen allowed signer. * Only the owner can use this function. * * @param signer The signer to update. */ function updateSigner(address signer) external; /** * @notice Returns TheGenerates creator payouts. */ function getUnseenPayout() external view returns (ConfigStructs.UnseenPayout memory); /** * @notice Returns The payment token. */ function getPaymentToken() external view returns (address); /** * @notice Returns TheGenerates allow list merkle root. */ function getAllowListMerkleRoot() external view returns (bytes32); /** * @notice Returns TheGenerates allowed signer. */ function getSigner() external view returns (address); /** * @notice Returns if the signed digest has been used. * * @param digest The digest hash. */ function getDigestIsUsed(bytes32 digest) external view returns (bool); /** * @notice Returns the configurer contract. */ function configurer() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; /** * @title ITheGeneratesConfigurer * @notice Contains the minimum interfaces needed to interact with TheGenerates Configurer. */ interface ITheGeneratesConfigurer { /** * @dev Mint an order with the specified context. * * @param context Additional context of the order. * * @return minter The address of the minter. * @return quantity The quantity to mint. */ function mint( bytes calldata context ) external returns (address minter, uint256 quantity); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; interface ITransferValidator { /// @notice Ensure that a transfer has been authorized for a specific tokenId function validateTransfer( address caller, address from, address to, uint256 tokenId ) external view; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { ConfigStructs } from "../types/DataTypes.sol"; interface ErrorsAndEvents { /** * @notice An event to signify that TheGenerates contract was deployed. */ event TheGeneratesDeployed(); /** * @notice Revert with an error if the function selector is not supported. */ error UnsupportedFunctionSelector(bytes4 selector); /** * @dev Revert with an error if the drop stage is not active. */ error NotActive( uint256 currentTimestamp, uint256 startTimestamp, uint256 endTimestamp ); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply. */ error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply for the stage. * Note: The `maxTokenSupplyForStage` for public mint is * always `type(uint).max`. */ error MintQuantityExceedsMaxTokenSupplyForStage( uint256 total, uint256 maxTokenSupplyForStage ); /** * @dev Revert if the fee basis points is greater than 1_000. */ error InvalidFeeBps(uint256 feeBps); /** * @dev Revert if unseen payout address is the zero address. */ error UnseenPayoutAddressCannotBeZeroAddress(); /** * @dev Revert if unseen payout is not set. */ error UnseenPayoutNotSet(); /** * @dev Revert if basis points exceed 1_000. */ error InvalidBasisPoints(uint256 totalReceivedBasisPoints); /** * @dev Revert with an error if the quantity is set to zero. */ error QuantityNotSet(); /** * @dev Revert with an error if the allow list proof is invalid. */ error InvalidProof(); /** * @dev Revert if a supplied signer address is the zero address. */ error SignerCannotBeZeroAddress(); /** * @dev Revert with an error if a signer is already included in mapping * when adding. */ error DuplicateSigner(); /** * @dev Revert if a supplied payment token address is the zero address. */ error PaymentTokenCannotBeZeroAddress(); /** * @dev Revert if the payment token is not set. */ error PaymentTokenNotSet(); /** * @dev Revert with an error if a payment token is already the same when adding. */ error DuplicatePaymentToken(); /** * @dev An event with the updated payment token. */ event PaymentTokenUpdated(address indexed paymentToken); /** * @dev Revert if the start time is greater than the end time. */ error InvalidStartAndEndTime(uint256 startTime, uint256 endTime); /** * @dev Revert with an error if a signature for a signed mint has already * been used. */ error SignatureAlreadyUsed(); /** * @dev Revert with an error if the contract has no balance to withdraw. */ error NoBalanceToWithdraw(); /** * @dev Revert with an error if the extra data encoding is not supported. */ error InvalidExtraDataEncoding(); /** * @dev Revert with an error if the provided substandard is not supported. */ error InvalidSubstandard(uint8 substandard); /** * @dev Revert with an error if the implementation contract is called without * delegatecall. */ error OnlyDelegateCalled(); /** * @dev Revert with an error if the transfer validator is being set to the same address. */ error SameTransferValidator(); /** * @dev Revert with an error if unseen market registry is being set to the same address. */ error SameUnseenMarketRegistry(); /** * @dev An event with the updated unseen market registry. */ event UnseenMarketRegistryUpdated(address registry); /** * @dev An event with details of a mint, for analytical purposes. * * @param payer The address who payed for the tx. * @param dropStageIndex The drop stage index. Items minted through * public mint have dropStageIndex of 0 */ event TheGeneratesMint(address payer, uint256 dropStageIndex); /** * @dev An event with updated allow list data. * * @param previousMerkleRoot The previous allow list merkle root. * @param newMerkleRoot The new allow list merkle root. */ event AllowListUpdated( bytes32 indexed previousMerkleRoot, bytes32 indexed newMerkleRoot ); /** * @dev An event with the updated unseen payout address. */ event UnseenPayoutUpdated(ConfigStructs.UnseenPayout unseenPayout); /** * @dev An event with the updated signer. */ event SignerUpdated(address indexed signer); /** * @dev An event with updated public drop data. */ event PublicDropUpdated(ConfigStructs.PublicDrop publicDrop); /** * @dev An event with new transfer validator address. */ event TransferValidatorUpdated(address oldValidator, address newValidator); /** * @dev Emit an event for token metadata reveals/updates, * according to EIP-4906. * * @param _fromTokenId The start token id. * @param _toTokenId The end token id. */ event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); /** * @notice Throw if the configurer is set to address 0. */ error ConfigurerCannotBeZeroAddress(); /** * @notice Throw if the max supply exceeds uint64, a limit * due to the storage of bit-packed variables. */ error CannotExceedMaxSupplyOfUint64(uint256 got); /** * @notice Throw if the max supply exceeds the total minted. */ error NewMaxSupplyCannotBeLessThenTotalMinted( uint256 got, uint256 totalMinted ); /** * @dev Revert with an error when attempting to set the provenance * hash after the mint has started. */ error ProvenanceHashCannotBeSetAfterMintStarted(); /** * @dev Revert with an error when attempting to set the provenance * hash after it has already been set. */ error ProvenanceHashCannotBeSetAfterAlreadyBeingSet(); /** * @dev Emit an event when the URI for the collection-level metadata * is updated. */ event ContractURIUpdated(string newContractURI); /** * @dev Emit an event with the previous and new provenance hash after * being updated. */ event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash); /** * @dev Emit an event when the EIP-2981 royalty info is updated. */ event RoyaltyInfoUpdated(address receiver, uint256 basisPoints); /** * @dev Emit an event when the max token supply is updated. */ event MaxSupplyUpdated(uint256 newMaxSupply); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import { ConfigStructs } from "../types/DataTypes.sol"; library TheGeneratesStorage { struct Layout { /// @notice The public drop data. ConfigStructs.PublicDrop _publicDrop; /// @notice Unseen payout address and fee basis points. ConfigStructs.UnseenPayout _unseenPayout; /// @notice The allow list merkle root. bytes32 _allowListMerkleRoot; /// @notice The allowed server-side signer. address _allowedSigner; /// @notice The payment token address. address _uncn; /// @notice The used signature digests. mapping(bytes32 => bool) _usedDigests; } bytes32 internal constant STORAGE_SLOT = bytes32(uint256(keccak256("contracts.storage.TGenContract")) - 1); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; library ConfigStructs { /** * @notice A struct defining unseen payout * address and fee basis points. * * @param payoutAddress The payout address. * @param basisPoints The basis points to pay out to the unseen treasury. */ struct UnseenPayout { address payoutAddress; uint16 basisPoints; } /** * @notice A struct defining public drop data. * Designed to fit efficiently in one storage slot. * * @param startPrice The start price per token. * @param endPrice The end price per token. If this differs * from startPrice, the current price will * be calculated based on the current time. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. */ struct PublicDrop { uint80 startPrice; // 80/256 bits uint80 endPrice; // 160/256 bits uint40 startTime; // 200/256 bits uint40 endTime; // 240/256 bits } /** * @notice A struct defining mint params for an allow list. * An allow list leaf will be composed of `msg.sender` and * the following params. * * * @param startPrice The start price per token. * @param endPrice The end price per token. If this differs * from startPrice, the current price will * be calculated based on the current time. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param maxTokenSupplyForStage The limit of token supply this stage can * mint within. * @param dropStageIndex The drop stage index to emit with the event * for analytical purposes. This should be * non-zero since the public mint emits with * index zero. */ struct MintParams { uint256 startPrice; uint256 endPrice; uint256 startTime; uint256 endTime; uint256 maxTokenSupplyForStage; uint256 dropStageIndex; } /** * @notice A struct to configure multiple contract options in one transaction. */ struct MultiConfigureStruct { uint256 maxSupply; string baseURI; string contractURI; PublicDrop publicDrop; bytes32 merkleRoot; UnseenPayout unseenPayout; bytes32 provenanceHash; address paymentToken; // Server-signed address allowedSigner; // ERC-2981 address royaltyReceiver; uint96 royaltyBps; // Mint address mintRecipient; uint256 mintQuantity; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * The `_sequentialUpTo()` function can be overriden to enable spot mints * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // 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; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _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) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // The amount of tokens minted above `_sequentialUpTo()`. // We call these spot mints (i.e. non-sequential mints). uint256 private _spotMinted; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID for sequential mints. * * Override this function to change the starting token ID for sequential mints. * * Note: The value returned must never change after any tokens have been minted. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the maximum token ID (inclusive) for sequential mints. * * Override this function to return a value less than 2**256 - 1, * but greater than `_startTokenId()`, to enable spot (non-sequential) mints. * * Note: The value returned must never change after any tokens have been minted. */ function _sequentialUpTo() internal view virtual returns (uint256) { return type(uint256).max; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256 result) { // Counter underflow is impossible as `_burnCounter` cannot be incremented // more than `_currentIndex + _spotMinted - _startTokenId()` times. unchecked { // With spot minting, the intermediate `result` can be temporarily negative, // and the computation must be unchecked. result = _currentIndex - _burnCounter - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256 result) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { result = _currentIndex - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } /** * @dev Returns the total number of tokens that are spot-minted. */ function _totalSpotMinted() internal view virtual returns (uint256) { return _spotMinted; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_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 (_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(_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 = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _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 _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Returns whether the ownership slot at `index` is initialized. * An uninitialized slot does not necessarily mean that the slot has no owner. */ function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) { return _packedOwnerships[index] != 0; } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * @dev Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = _packedOwnerships[tokenId]; if (tokenId > _sequentialUpTo()) { if (_packedOwnershipExists(packed)) return packed; _revert(OwnerQueryForNonexistentToken.selector); } // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = _packedOwnerships[--tokenId]; } if (packed == 0) continue; if (packed & _BITMASK_BURNED == 0) return packed; // Otherwise, the token is burned, and we must revert. // This handles the case of batch burned tokens, where only the burned bit // of the starting slot is set, and remaining slots are left uninitialized. _revert(OwnerQueryForNonexistentToken.selector); } } // Otherwise, the data exists and we can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. // If the token is not burned, return `packed`. Otherwise, revert. if (packed & _BITMASK_BURNED == 0) return packed; } _revert(OwnerQueryForNonexistentToken.selector); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector); return _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 { _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 _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool result) { if (_startTokenId() <= tokenId) { if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]); if (tokenId < _currentIndex) { uint256 packed; while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId; result = packed & _BITMASK_BURNED == 0; } } } /** * @dev Returns whether `packed` represents a token that exists. */ function _packedOwnershipExists(uint256 packed) private pure returns (bool result) { assembly { // The following is equivalent to `owner != address(0) && burned == false`. // Symbolically tested. result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED)) } } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS)); if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _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 (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. from, // `from`. toMasked, // `to`. tokenId // `tokenId`. ) } if (toMasked == 0) _revert(TransferToZeroAddress.selector); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC721ReceiverImplementer.selector); } assembly { revert(add(32, reason), mload(reason)) } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) _revert(MintZeroQuantity.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); uint256 end = startTokenId + quantity; uint256 tokenId = startTokenId; if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); do { assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } // The `!=` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. } while (++tokenId != end); _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 = _currentIndex; if (to == address(0)) _revert(MintToZeroAddress.selector); if (quantity == 0) _revert(MintZeroQuantity.selector); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _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`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _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 = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } while (index < end); // This prevents reentrancy to `_safeMint`. // It does not prevent reentrancy to `_safeMintSpot`. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } /** * @dev Mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * Emits a {Transfer} event for each mint. */ function _mintSpot(address to, uint256 tokenId) internal virtual { if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector); uint256 prevOwnershipPacked = _packedOwnerships[tokenId]; if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector); _beforeTokenTransfers(address(0), to, tokenId, 1); // Overflows are incredibly unrealistic. // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1. // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `true` (as `quantity == 1`). _packedOwnerships[tokenId] = _packOwnershipData( to, _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked) ); // Updates: // - `balance += 1`. // - `numberMinted += 1`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1; // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } ++_spotMinted; } _afterTokenTransfers(address(0), to, tokenId, 1); } /** * @dev Safely mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * See {_mintSpot}. * * Emits a {Transfer} event. */ function _safeMintSpot( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mintSpot(to, tokenId); unchecked { if (to.code.length != 0) { uint256 currentSpotMinted = _spotMinted; if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } // This prevents reentrancy to `_safeMintSpot`. // It does not prevent reentrancy to `_safeMint`. if (_spotMinted != currentSpotMinted) revert(); } } } /** * @dev Equivalent to `_safeMintSpot(to, tokenId, '')`. */ function _safeMintSpot(address to, uint256 tokenId) internal virtual { _safeMintSpot(to, tokenId, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck && _msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { _revert(ApprovalCallerNotOwnerNorApproved.selector); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _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`. _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 (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times. unchecked { _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 = _packedOwnerships[index]; if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory ownership) { unchecked { if (tokenId >= _startTokenId()) { if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId); if (tokenId < _nextTokenId()) { // If the `tokenId` is within bounds, // scan backwards for the initialized ownership slot. while (!_ownershipIsInitialized(tokenId)) --tokenId; return _ownershipAt(tokenId); } } } } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { TokenOwnership[] memory ownerships; uint256 i = tokenIds.length; assembly { // Grab the free memory pointer. ownerships := mload(0x40) // Store the length. mstore(ownerships, i) // Allocate one word for the length, // `tokenIds.length` words for the pointers. i := shl(5, i) // Multiply `i` by 32. mstore(0x40, add(add(ownerships, 0x20), i)) } while (i != 0) { uint256 tokenId; assembly { i := sub(i, 0x20) tokenId := calldataload(add(tokenIds.offset, i)) } TokenOwnership memory ownership = explicitOwnershipOf(tokenId); assembly { // Store the pointer of `ownership` in the `ownerships` array. mstore(add(add(ownerships, 0x20), i), ownership) } } return ownerships; } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { return _tokensOfOwnerIn(owner, start, stop); } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { // If spot mints are enabled, full-range scan is disabled. if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector); uint256 start = _startTokenId(); uint256 stop = _nextTokenId(); uint256[] memory tokenIds; if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop); return tokenIds; } /** * @dev Helper function for returning an array of token IDs owned by `owner`. * * Note that this function is optimized for smaller bytecode size over runtime gas, * since it is meant to be called off-chain. */ function _tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) private view returns (uint256[] memory tokenIds) { unchecked { if (start >= stop) _revert(InvalidQueryRange.selector); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) start = _startTokenId(); uint256 nextTokenId = _nextTokenId(); // If spot mints are enabled, scan all the way until the specified `stop`. uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId; // Set `stop = min(stop, stopLimit)`. if (stop >= stopLimit) stop = stopLimit; // Number of tokens to scan. uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength` to zero if the range contains no tokens. if (start >= stop) tokenIdsMaxLength = 0; // If there are one or more tokens to scan. if (tokenIdsMaxLength != 0) { // Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`. if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start; uint256 m; // Start of available memory. assembly { // Grab the free memory pointer. tokenIds := mload(0x40) // Allocate one word for the length, and `tokenIdsMaxLength` words // for the data. `shl(5, x)` is equivalent to `mul(32, x)`. m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1))) mstore(0x40, m) } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), // initialize `currOwnershipAddr`. // `ownership.address` will not be zero, // as `start` is clamped to the valid token ID range. if (!ownership.burned) currOwnershipAddr = ownership.addr; uint256 tokenIdsIdx; // Use a do-while, which is slightly more efficient for this case, // as the array will at least contain one element. do { if (_sequentialUpTo() != type(uint256).max) { // Skip the remaining unused sequential slots. if (start == nextTokenId) start = _sequentialUpTo() + 1; // Reset `currOwnershipAddr`, as each spot-minted token is a batch of one. if (start > _sequentialUpTo()) currOwnershipAddr = address(0); } ownership = _ownershipAt(start); // This implicitly allocates memory. assembly { switch mload(add(ownership, 0x40)) // if `ownership.burned == false`. case 0 { // if `ownership.addr != address(0)`. // The `addr` already has it's upper 96 bits clearned, // since it is written to memory with regular Solidity. if mload(ownership) { currOwnershipAddr := mload(ownership) } // if `currOwnershipAddr == owner`. // The `shl(96, x)` is to make the comparison agnostic to any // dirty upper 96 bits in `owner`. if iszero(shl(96, xor(currOwnershipAddr, owner))) { tokenIdsIdx := add(tokenIdsIdx, 1) mstore(add(tokenIds, shl(5, tokenIdsIdx)), start) } } // Otherwise, reset `currOwnershipAddr`. // This handles the case of batch burned tokens // (burned bit of first slot set, remaining slots left uninitialized). default { currOwnershipAddr := 0 } start := add(start, 1) // Free temporary memory implicitly allocated for ownership // to avoid quadratic memory expansion costs. mstore(0x40, m) } } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength)); // Store the length of the array. assembly { mstore(tokenIds, tokenIdsIdx) } } } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * 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 // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); /** * `_sequentialUpTo()` must be greater than `_startTokenId()`. */ error SequentialUpToTooSmall(); /** * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`. */ error SequentialMintExceedsLimit(); /** * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`. */ error SpotMintTokenIdTooSmall(); /** * Cannot mint over a token that already exists. */ error TokenAlreadyExists(); /** * The feature is not compatible with spot mints. */ error NotCompatibleWithSpotMints(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /// @dev Cannot double-initialize. error AlreadyInitialized(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. bytes32 internal constant _OWNER_SLOT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Override to return true to make `_initializeOwner` prevent double-initialization. function _guardInitializeOwner() internal pure virtual returns (bool guard) {} /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT if sload(ownerSlot) { mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`. revert(0x1c, 0x04) } // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } else { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(_OWNER_SLOT, newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { if (_guardInitializeOwner()) { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner)))) } } else { /// @solidity memory-safe-assembly assembly { let ownerSlot := _OWNER_SLOT // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(_OWNER_SLOT))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(_OWNER_SLOT) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC2981 NFT Royalty Standard implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol) abstract contract ERC2981 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The royalty fee numerator exceeds the fee denominator. error RoyaltyOverflow(); /// @dev The royalty receiver cannot be the zero address. error RoyaltyReceiverIsZeroAddress(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The default royalty info is given by: /// ``` /// let packed := sload(_ERC2981_MASTER_SLOT_SEED) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` /// /// The per token royalty info is given by. /// ``` /// mstore(0x00, tokenId) /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED) /// let packed := sload(keccak256(0x00, 0x40)) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC2981 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Checks that `_feeDenominator` is non-zero. constructor() { require(_feeDenominator() != 0, "Fee denominator cannot be zero."); } /// @dev Returns the denominator for the royalty amount. /// Defaults to 10000, which represents fees in basis points. /// Override this function to return a custom amount if needed. function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a. result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a)) } } /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`. function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address receiver, uint256 royaltyAmount) { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) let packed := sload(keccak256(0x00, 0x40)) receiver := shr(96, packed) if iszero(receiver) { packed := sload(mload(0x20)) receiver := shr(96, packed) } let x := salePrice let y := xor(packed, shl(96, receiver)) // `feeNumerator`. // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`. // Out-of-gas revert. Should not be triggered in practice, but included for safety. returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y)))) royaltyAmount := div(mul(x, y), feeDenominator) } } /// @dev Sets the default royalty `receiver` and `feeNumerator`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator)) } } /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero. function _deleteDefaultRoyalty() internal virtual { /// @solidity memory-safe-assembly assembly { sstore(_ERC2981_MASTER_SLOT_SEED, 0) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), or(packed, feeNumerator)) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero. function _resetTokenRoyalty(uint256 tokenId) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), 0) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"allowedConfigurer","type":"address"},{"internalType":"address","name":"ownerToSet","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AlreadySet","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"}],"name":"CannotExceedMaxSupplyOfUint64","type":"error"},{"inputs":[],"name":"ConfigurerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"DuplicatePaymentToken","type":"error"},{"inputs":[],"name":"DuplicateSigner","type":"error"},{"inputs":[],"name":"FeeAlreadySet","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalReceivedBasisPoints","type":"uint256"}],"name":"InvalidBasisPoints","type":"error"},{"inputs":[],"name":"InvalidExtraDataEncoding","type":"error"},{"inputs":[{"internalType":"uint256","name":"feeBps","type":"uint256"}],"name":"InvalidFeeBps","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"InvalidStartAndEndTime","type":"error"},{"inputs":[{"internalType":"uint8","name":"substandard","type":"uint8"}],"name":"InvalidSubstandard","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxTokenSupplyForStage","type":"uint256"}],"name":"MintQuantityExceedsMaxTokenSupplyForStage","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"totalMinted","type":"uint256"}],"name":"NewMaxSupplyCannotBeLessThenTotalMinted","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoBalanceToWithdraw","type":"error"},{"inputs":[],"name":"NoChange","type":"error"},{"inputs":[],"name":"NoExpiryAssigned","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"NotActive","type":"error"},{"inputs":[],"name":"NotAllowed","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"OnlyDelegateCalled","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PaymentTokenCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"PaymentTokenNotSet","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterAlreadyBeingSet","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterMintStarted","type":"error"},{"inputs":[],"name":"QuantityNotSet","type":"error"},{"inputs":[],"name":"RentingDisabled","type":"error"},{"inputs":[],"name":"RoyaltyOverflow","type":"error"},{"inputs":[],"name":"RoyaltyReceiverIsZeroAddress","type":"error"},{"inputs":[],"name":"SameTransferValidator","type":"error"},{"inputs":[],"name":"SameUnseenMarketRegistry","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SetUserCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"SignerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenIsRented","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"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnseenPayoutAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"UnseenPayoutNotSet","type":"error"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"UnsupportedFunctionSelector","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"previousMerkleRoot","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"AllowListUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newContractURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"MaxSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"paymentToken","type":"address"}],"name":"PaymentTokenUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"previousHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newHash","type":"bytes32"}],"name":"ProvenanceHashUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"}],"indexed":false,"internalType":"struct ConfigStructs.PublicDrop","name":"publicDrop","type":"tuple"}],"name":"PublicDropUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"rentable","type":"bool"},{"indexed":false,"internalType":"uint256","name":"ratePerMinute","type":"uint256"}],"name":"RentableInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"basisPoints","type":"uint256"}],"name":"RoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"TheGeneratesDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"dropStageIndex","type":"uint256"}],"name":"TheGeneratesMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldValidator","type":"address"},{"indexed":false,"internalType":"address","name":"newValidator","type":"address"}],"name":"TransferValidatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"registry","type":"address"}],"name":"UnseenMarketRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"indexed":false,"internalType":"struct ConfigStructs.UnseenPayout","name":"unseenPayout","type":"tuple"}],"name":"UnseenPayoutUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint64","name":"expires","type":"uint64"}],"name":"UpdateUser","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"address","name":"to","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":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"emitBatchMetadataUpdate","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 IERC721A.TokenOwnership","name":"ownership","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitUserOf","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"tokenId","type":"uint256"}],"name":"getTokenRentInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransferValidationFunction","outputs":[{"internalType":"bytes4","name":"functionSignature","type":"bytes4"},{"internalType":"bool","name":"isViewFunction","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransferValidator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"releaseToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint64","name":"expires","type":"uint64"}],"name":"rent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rentablesInfo","outputs":[{"internalType":"bool","name":"rentable","type":"bool"},{"internalType":"uint128","name":"ratePerMinute","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newContractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newProvenanceHash","type":"bytes32"}],"name":"setProvenanceHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"rentable","type":"bool"},{"internalType":"uint128","name":"ratePerMinute","type":"uint128"}],"name":"setRentablesInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValidator","type":"address"}],"name":"setTransferValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_unseenMarketRegistry","type":"address"}],"name":"setUnseenMarketRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint64","name":"expires","type":"uint64"}],"name":"setUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"unseenMarketRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"userExpires","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"userOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526138e2604081380391826100178161022f565b93849283398101031261021457610039602061003283610254565b9201610254565b6100416102b4565b916c5468652047656e65726174657360981b60208401526100606102c5565b632a23b2b760e11b602082015283516001600160401b03811161020f576100918161008c6002546102d6565b610310565b6020601f82116001146101855790806100c7926100cf95969760009261017a575b50508160011b916000199060031b1c19161790565b6002556103b5565b6100d96001600055565b6100e36001610268565b6001600160a01b03811615610169576080527f0f489a46f38483980121f9b1acc1fa10fcc9c72b831cb3a3f0ee75fcd004eeec600080a16001600160a01b038116156101585761013290610493565b60405161341490816104ce8239608051818181612901015281816129cf0152612b460152f35b633a247dd760e11b60005260046000fd5b63f55e96e360e01b60005260046000fd5b0151905038806100b2565b6002600052601f198216957f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace9660005b8181106101f75750916100cf959697918460019594106101de575b505050811b016002556103b5565b015160001960f88460031b161c191690553880806101d0565b838301518955600190980197602093840193016101b5565b610219565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b0381118382101761020f57604052565b51906001600160a01b038216820361021457565b1561026f57565b60405162461bcd60e51b815260206004820152601f60248201527f4665652064656e6f6d696e61746f722063616e6e6f74206265207a65726f2e006044820152606490fd5b6102be604061022f565b90600d8252565b6102cf604061022f565b9060048252565b90600182811c92168015610306575b60208310146102f057565b634e487b7160e01b600052602260045260246000fd5b91607f16916102e5565b601f811161031c575050565b60026000526020600020906020601f840160051c83019310610359575b601f0160051c01905b81811061034d575050565b60008155600101610342565b9091508190610339565b601f821161037057505050565b6000526020600020906020601f840160051c830193106103ab575b601f0160051c01905b81811061039f575050565b60008155600101610394565b909150819061038b565b80519091906001600160401b03811161020f576103de816103d76003546102d6565b6003610363565b602092601f82116001146104145761040f9293829160009261017a5750508160011b916000199060031b1c19161790565b600355565b6003600052601f198216937fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9160005b86811061047b5750836001959610610462575b505050811b01600355565b015160001960f88460031b161c19169055388080610457565b91926020600181928685015181550194019201610444565b6001600160a01b0316638b78c6d81981905560007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a356fe60806040526004361015610028575b346100235761001b61284f565b602081519101f35b600080fd5b60003560e01c806301ffc9a71461037857806304634d8d1461037357806306fdde031461036e578063081812fc14610369578063095ea7b314610364578063098144d41461035f578063099b6bfa1461035a5780630d705df61461035557806318160ddd1461035057806323b872dd1461034b57806325692962146103465780632a55205a146103415780632ed2d4291461033c5780633ccfd60b1461033757806342842e0e1461033257806342966c681461032d578063431e814a146103285780634eaaee421461032357806354d1f13d1461031e57806355f804b3146103195780635bbb2177146103145780636352211e1461030f5780636c0360eb1461030a5780636f8b44b01461030557806370a0823114610300578063715018a6146102fb5780638462151c146102f65780638da5cb5b146102f15780638fc88c48146102ec578063938e3d7b146102e757806395d89b41146102e257806399a2557a146102dd578063a22cb465146102d8578063a4830114146102d3578063a9fc664e146102ce578063b54d6238146102c9578063b88d4fde146102c4578063c23dc68f146102bf578063c2f1f14a146102ba578063c6ab67a3146102b5578063c87b56dd146102b0578063d5abeb01146102ab578063d73ee58e146102a6578063e030565e146102a1578063e4737f5b1461029c578063e8a3d48514610297578063e985e9c514610292578063ed1959681461028d578063f04e283e14610288578063f2fde38b14610283578063f4f3b2001461027e578063fee81cf4146102795763ffdd1cc80361000e57611f8d565b611f56565b611eb2565b611e72565b611e1e565b611dea565b611dac565b611d04565b611cdb565b611c43565b611bb9565b611b9b565b611b7c565b611b5e565b611b23565b611ac0565b611a35565b611957565b6118c6565b61186d565b6117de565b611657565b6115af565b611467565b611438565b61140b565b611270565b6111ea565b6111c3565b611128565b6110f8565b6110c9565b61105d565b610e8d565b610df6565b610c2a565b610bda565b610a79565b610a54565b6109f0565b6109c0565b610930565b6108e4565b6108d0565b61087c565b610854565b610800565b6107d7565b61072d565b6106fd565b610624565b6104d9565b61038f565b6001600160e01b031981160361002357565b34610023576020366003190112610023576103e86004356103af8161037d565b6001600160e01b03198116633434bf6960e01b8114919082156104b7575b82156103ec575b505060405190151581529081906020820190565b0390f35b6333a563c360e01b811492509082156104a6575b8215610495575b8215610479575b50811561041e575b5038806103d4565b6301ffc9a760e01b811491508115610468575b8115610457575b8115610446575b5038610416565b632b424ad760e21b1490503861043f565b635b5e139f60e01b81149150610438565b6380ac58cd60e01b81149150610431565b90915060e01c6301ffc9a7632a55205a8214911417903861040e565b632483248360e11b82149250610407565b632b435fdb60e21b82149250610400565b637ba0e2e760e01b811492506103cd565b6001600160a01b0381160361002357565b34610023576040366003190112610023576004356104f6816104c8565b6024356001600160601b0381169182820361002357610513612b43565b6103e883116105a857612710831161059a578060601b92831561058c5790921768aa4ec00224afccfdb755604080516001600160a01b0390931683526001600160601b0390911660208301527ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d9190819081015b0390a1005b63b4457eaa6000526004601cfd5b63350a88b36000526004601cfd5b82630cbf8cb160e11b60005260045260246000fd5b600091031261002357565b60005b8381106105db5750506000910152565b81810151838201526020016105cb565b90602091610604815180928185528580860191016105c8565b601f01601f1916010190565b9060206106219281815201906105eb565b90565b3461002357600036600319011261002357604051600060025461064681611fdc565b80845290600181169081156106d9575060011461067a575b6103e88361066e818503826119f9565b60405191829182610610565b600260009081527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace939250905b8082106106bf5750909150810160200161066e61065e565b9192600181602092548385880101520191019092916106a7565b60ff191660208086019190915291151560051b8401909101915061066e905061065e565b3461002357602036600319011261002357602061071b6004356120cf565b6040516001600160a01b039091168152f35b604036600319011261002357600435610745816104c8565b602435906001600160a01b0361075a83612c59565b16908133036107b8575b600083815260066020526040812080546001600160a01b0319166001600160a01b039390931692831790559091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259080a4005b6107c233836127c7565b610764576367d9dca160e11b60005260046000fd5b3461002357600036600319011261002357600c546040516001600160a01b039091168152602090f35b34610023576020366003190112610023577f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c604060043561083f612b43565b601054908060105582519182526020820152a1005b34610023576000366003190112610023576040805163657711f560e11b815260006020820152f35b346100235760003660031901126100235760005460015460209103600019015b604051908152f35b6060906003190112610023576004356108bc816104c8565b906024356108c9816104c8565b9060443590565b6108e26108dc366108a4565b91612109565b005b60003660031901126100235763389a75e1600c52336000526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a2005b3461002357604036600319011261002357600435604060243591600090815268aa4ec00224afccfdb76020522054908160601c9182156109a8575b6103e8908360601b18928360001904831184023d3d3e6127106040519485940204908360209093929193604081019460018060a01b031681520152565b5068aa4ec00224afccfdb754606081901c925061096b565b34610023576040366003190112610023576004356024356001600160401b0381168103610023576108e2916122d6565b3461002357600036600319011261002357610a09612b43565b478015610a4357638b78c6d819546000918291829182916001600160a01b03165af1610a3361243d565b9015610a3b57005b805190602001fd5b63177b02e160e31b60005260046000fd5b6108e2610a60366108a4565b9060405192610a706020856119f9565b600084526125b7565b3461002357602036600319011261002357600435610a9681612c59565b60008281526006602052604090208054916001600160a01b03811691338085149084141715610ac4565b1590565b610bc3575b600093610ad68685612cc9565b610bba575b506001600160a01b038216600090815260056020526040902080546001600160801b030190556001600160a01b0382164260a01b17600360e01b17610b2a856000526004602052604060002090565b55600160e11b811615610b71575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a46108e2610b6c60015460010190565b600155565b60018401610b89816000526004602052604060002090565b5415610b96575b50610b38565b83548114610b9057610bb2906000526004602052604060002090565b553880610b90565b83905538610adb565b610bd0610ac033856127c7565b15610ac957612bf5565b3461002357602036600319011261002357600435600052600a602052604080600020546001600160801b0382519160ff81161515835260081c166020820152f35b60243590811515820361002357565b3461002357606036600319011261002357600435610c46610c1b565b6044356001600160801b038116808203610023576001600160a01b03610c6b85612c59565b16803303610db6575b5060008091610c97610c9087600052600a602052604060002090565b5460ff1690565b85151590151503610d83575b6001600160801b03610cd2610cc288600052600a602052604060002090565b5460081c6001600160801b031690565b1603610d3f575b159081610d36575b50610d25576040805192151583526001600160801b039190911660208301527f56f96edb8f2e1a8e7bdbee0aeb690b892f620dbd461f1979596dcfd74904eb9a91a2005b63a88ee57760e01b60005260046000fd5b90501538610ce1565b9050610d7b82610d5986600052600a602052604060002090565b90610100600160881b0382549160081b1690610100600160881b031916179055565b600190610cd9565b9050610dae84610d9d87600052600a602052604060002090565b9060ff801983541691151516179055565b600190610ca3565b610dc19033906127c7565b15610dcd575b38610c74565b336001600160a01b03610ddf866120cf565b1614610dc7576309e3bb1d60e31b60005260046000fd5b60003660031901126100235763389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2005b906020600319830112610023576004356001600160401b0381116100235782602382011215610023578060040135926001600160401b0384116100235760248483010111610023576024019190565b3461002357610e9b36610e3e565b610ea3612b43565b6001600160401b038111610fde57610ec581610ec0600e54611fdc565b61246d565b6000601f8211600114610f5d578190610ef593600092610f52575b50508160011b916000199060031b1c19161790565b600e555b600054600154900360001901610f0b57005b7f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c610587610f3a6000546122ba565b60405191829182919060206040840193600181520152565b013590503880610ee0565b600e600052601f198216927fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd91805b858110610fc657508360019510610fac575b505050811b01600e55610ef9565b0135600019600384901b60f8161c19169055388080610f9e565b90926020600181928686013581550194019101610f8c565b6119e3565b602060408183019282815284518094520192019060005b8181106110075750505090565b9091926020608082611052600194885162ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565b019401929101610ffa565b34610023576020366003190112610023576004356001600160401b0381116100235736602382011215610023578060040135906001600160401b038211610023573660248360051b83010111610023576103e89160246110bd9201612513565b60405191829182610fe3565b346100235760203660031901126100235760206001600160a01b036110ef600435612c59565b16604051908152f35b34610023576000366003190112610023576103e8611114612016565b6040519182916020835260208301906105eb565b3461002357602036600319011261002357600435611144612b43565b6001600160401b0381116111af57600054600019018110611190576020817f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c92600d55604051908152a1005b6000546000190190638c19f1f960e01b60005260045260245260446000fd5b63b43e913760e01b60005260045260246000fd5b3461002357602036600319011261002357602061089c6004356111e5816104c8565b612555565b6000366003190112610023576111fe612ed6565b6000638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a36000638b78c6d81955005b602060408183019282815284518094520192019060005b81811061125a5750505090565b825184526020938401939092019160010161124d565b346100235760203660031901126100235760043561128d816104c8565b600054606091816001036112aa575b604051806103e88582611236565b81926001906060938083101561140657600054809110156113fe575b506112d083612555565b90858310156113f5575b816112f0575b505050506103e89150903861129c565b92935090916000198501828111156113ed575b506040519083830160051b8201948560405261131e8561262f565b93600094611332610ac06040830151151590565b6113db575b50600095949597855b156113ac575b6000966113528761301e565b604081015115611371575050600187965b019688604052969596611340565b96909651806113a4575b50838718851b1561138f575b600190611363565b6001909901600581901b86018a905298611387565b96503861137b565b80861480156113d2575b156113465750505050925050506103e8918152388080806112e0565b508189146113b6565b516001600160a01b0316945038611337565b915038611303565b600091506112da565b9450386112c6565b612c38565b3461002357600036600319011261002357638b78c6d819546040516001600160a01b039091168152602090f35b34610023576020366003190112610023576004356000526009602052602060406000205460a01c604051908152f35b346100235761147536610e3e565b61147d612b43565b6001600160401b038111610fde5761149f8161149a600f54611fdc565b6124c0565b600091601f821160011461150e576114f082807f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac3737895600091611503575b508160011b916000199060031b1c19161790565b600f555b6105876040519283928361258f565b9050830135386114dc565b600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802601f198316845b818110611597575093837f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac37378951061157d575b5050600182811b01600f556114f4565b820135600019600385901b60f8161c19169055388061156d565b8386013583556020958601956001909301920161153b565b346100235760003660031901126100235760405160006003546115d181611fdc565b80845290600181169081156106d957506001146115f8576103e88361066e818503826119f9565b600360009081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b939250905b80821061163d5750909150810160200161066e61065e565b919260018160209254838588010152019101909291611625565b3461002357606036600319011261002357600435611674816104c8565b60443590606090602435838181811015611406576001116117d5575b600054809110156117cd575b506116a682612555565b848210156117c5575b806116c3575b604051806103e88682611236565b90809293508403818111156117bd575b506040516001820160051b810193846040526116ee8461262f565b92600093611702610ac06040830151151590565b6117ab575b5060009493949660015b1561177e575b6000956117238661301e565b604081015115611742575050600186955b019587604052959495611711565b9590955180611776575b5083861860601b15611761575b600190611734565b6001909801600581901b850189905297611759565b95503861174c565b80851480156117a2575b1561171757505050925050506103e89181523880806116b5565b50818814611788565b516001600160a01b0316935038611707565b9050386116d3565b5060006116af565b93503861169c565b60019150611690565b34610023576040366003190112610023576004356117fb816104c8565b611803610c1b565b9033600052600760205261183182610d9d8360406000209060018060a01b0316600052602052604060002090565b60405191151582526001600160a01b03169033907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b34610023576040366003190112610023577f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6024356004356118ad612b43565b6040805191825260208201929092529081908101610587565b34610023576020366003190112610023576004356118e3816104c8565b6118eb612ed6565b600c546001600160a01b0391821691811682811461194657827fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac936040936001600160601b0360a01b1617600c5582519182526020820152a1005b63251dd8cf60e11b60005260046000fd5b34610023576020366003190112610023576004356000818152600960205260409020544260a01b8111026001600160a01b0316336001600160a01b03909116036119d257806000526009602052600060408120557f059ea9d6426bbae6ac9c53283977ee93577f8e299e1f7d7314b3d23eecfb2b08600080a2005b631eb49d6d60e11b60005260046000fd5b634e487b7160e01b600052604160045260246000fd5b90601f801991011681019081106001600160401b03821117610fde57604052565b6001600160401b038111610fde57601f01601f191660200190565b608036600319011261002357600435611a4d816104c8565b60243590611a5a826104c8565b604435606435926001600160401b038411610023573660238501121561002357836004013592611a8984611a1a565b93611a9760405195866119f9565b80855236602482880101116100235760208160009260246108e2990183890137860101526125b7565b34610023576020366003190112610023576080611ade60043561262f565b611b21604051809262ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565bf35b34610023576020366003190112610023576004356000908152600960209081526040909120544260a01b8111026001600160a01b031661071b565b34610023576000366003190112610023576020601054604051908152f35b34610023576020366003190112610023576103e8611114600435612701565b34610023576000366003190112610023576020600d54604051908152f35b3461002357602036600319011261002357600435611bd6816104c8565b611bde612ed6565b600b546001600160a01b039182169181168214611c32576001600160a01b0319168117600b556040519081527fbca4bcdee8e819ac8634856a2bdc5bcd861ed9a864697faee95b1a54d83644f490602090a1005b631ea5355560e01b60005260046000fd5b3461002357606036600319011261002357600435602435611c63816104c8565b604435906001600160401b0382168203610023576001600160a01b03611c8884612c59565b16803303611c9b575b506108e2926130cc565b611ca69033906127c7565b15611cb2575b38611c91565b336001600160a01b03611cc4856120cf565b1614611cac576309e3bb1d60e31b60005260046000fd5b3461002357600036600319011261002357600b546040516001600160a01b039091168152602090f35b34610023576000366003190112610023576040516000600f54611d2681611fdc565b80845290600181169081156106d95750600114611d4d576103e88361066e818503826119f9565b600f60009081527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802939250905b808210611d925750909150810160200161066e61065e565b919260018160209254838588010152019101909291611d7a565b34610023576040366003190112610023576020611de0600435611dce816104c8565b60243590611ddb826104c8565b6127c7565b6040519015158152f35b34610023576020366003190112610023576004356000526009602052602060018060a01b0360406000205416604051908152f35b602036600319011261002357600435611e36816104c8565b611e3e612ed6565b63389a75e1600c52806000526020600c209081544211611e645760006108e29255612ef3565b636f5e88186000526004601cfd5b602036600319011261002357600435611e8a816104c8565b611e92612ed6565b8060601b15611ea4576108e290612ef3565b637448fbae6000526004601cfd5b3461002357602036600319011261002357600435611ecf816104c8565b611ed7612b43565b6040516370a0823160e01b81523060048201526020816024816001600160a01b0386165afa908115611f5157600091611f22575b508015610a4357638b78c6d819546108e292613272565b611f44915060203d602011611f4a575b611f3c81836119f9565b81019061280b565b38611f0b565b503d611f32565b61281a565b3461002357602036600319011261002357600435611f73816104c8565b63389a75e1600c52600052602080600c2054604051908152f35b3461002357602036600319011261002357604060043580600052600a6020526001600160801b03826000205460081c1690600052600a60205260ff826000205416825191825215156020820152f35b90600182811c9216801561200c575b6020831014611ff657565b634e487b7160e01b600052602260045260246000fd5b91607f1691611feb565b60405190600082600e549161202a83611fdc565b80835292600181169081156120b05750600114612050575b61204e925003836119f9565b565b50600e600090815290917fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd5b81831061209457505090602061204e92820101612042565b602091935080600191548385890101520191019091849261207c565b6020925061204e94915060ff191682840152151560051b820101612042565b6120d881612ba5565b156120f8576000908152600660205260409020546001600160a01b031690565b6333d1c03960e21b60005260046000fd5b919061211482612c59565b6001600160a01b0393841693811684900361228757600083815260066020526040902080546121526001600160a01b03871633908114908314171590565b612270575b612162858588612da8565b612266575b506001600160a01b038416600090815260056020526040902080546000190190556001600160a01b0382166000908152600560205260409020805460010190556001600160a01b0382164260a01b17600160e11b176121d0846000526004602052604060002090565b55600160e11b81161561221c575b506001600160a01b03169182907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a41561221757565b612c16565b60018301612234816000526004602052604060002090565b5415612241575b506121de565b600054811461223b5761225e906000526004602052604060002090565b55388061223b565b6000905538612167565b61227d610ac033886127c7565b1561215757612bf5565b612c06565b634e487b7160e01b600052601160045260246000fd5b818102929181159184041417156122b557565b61228c565b6000198101919082116122b557565b919082039182116122b557565b9081600052600a60205260ff604060002054161561242c5781600052600a6020526001600160801b0360406000205460081c166001600160401b038216026001600160801b0381169081036122b55761233a906001600160801b03169133846130cc565b808015612427577fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e55895461204e937fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e55889290919061ffff6123bb60046123ac6001600160a01b0386169560a01c61ffff1690565b9601546001600160a01b031690565b9416806123e9575b5050506123d56123d56123e192612c59565b6001600160a01b031690565b903390612e86565b6123e19395506123d5928261241b61241261240a612420956123d5976122a2565b612710900490565b8093338a612e86565b6122c9565b94926123c3565b505050565b6305bc99b160e31b60005260046000fd5b3d15612468573d9061244e82611a1a565b9161245c60405193846119f9565b82523d6000602084013e565b606090565b601f8111612479575050565b600e6000526020600020906020601f840160051c830193106124b6575b601f0160051c01905b8181106124aa575050565b6000815560010161249f565b9091508190612496565b601f81116124cc575050565b600f6000526020600020906020601f840160051c83019310612509575b601f0160051c01905b8181106124fd575050565b600081556001016124f2565b90915081906124e9565b6040519180835260051b906020828401016040525b8182801561254e57601f199081019361254591908401013561262f565b90840152612528565b5050505090565b6001600160a01b0316801561257e5760005260056020526001600160401b036040600020541690565b6323d3ad8160e21b60005260046000fd5b90918060409360208452816020850152848401376000828201840152601f01601f1916010190565b9291906125c5828286612109565b803b6125d2575b50505050565b6125db93612f77565b156125e957388080806125cc565b6368d2bf6b60e11b60005260046000fd5b60405190608082018281106001600160401b03821117610fde5760405260006060838281528260208201528260408201520152565b906126386125fa565b9160018110156126455750565b60005481106126515750565b9091505b8060005260046020526040600020546126715760001901612655565b6106219061301e565b8051156126875760200190565b634e487b7160e01b600052603260045260246000fd5b604051906126ac6040836119f9565b60018252602f60f81b6020830152565b61204e90929192602060405194826126dd87945180928580880191016105c8565b83016126f1825180938580850191016105c8565b010103601f1981018452836119f9565b61270a81612ba5565b156127b657612717612016565b9081511561279f57815160001981019081116122b5578251811015612687578201602001516001600160f81b03191661277761276a61275c61275761269d565b61267a565b516001600160f81b03191690565b6001600160f81b03191690565b6001600160f81b03199091160361279b579061279561062192613078565b906126bc565b5090565b50506040516127af6020826119f9565b6000815290565b630a14c4b560e41b60005260046000fd5b6127d182826131b8565b612804576001600160a01b039081166000908152600760209081526040808320939094168252919091522060ff90541690565b5050600190565b90816020910312610023575190565b6040513d6000823e3d90fd5b91909182600411610023578211610023576004916003190190565b908160008237016000815290565b6000356001600160e01b03191660606128683680612826565b6320351c0160e01b841480159392908085612b32575b8115612b21575b8115612b10575b8115612aff575b8115612aee575b8115612add575b8115612acc575b8115612abb575b8115612aaa575b8115612a99575b8115612a88575b94612a77575b8415612a66575b8415612a55575b8415612a44575b1561296057505050612953575b600080604051806128fd8136612841565b03907f00000000000000000000000000000000000000000000000000000000000000005af49061292b61243d565b911561294a57637ba0e2e760e01b146129415790565b610621816132e4565b50805190602001fd5b61295b612b43565b6128ec565b91949390925063224201db60e01b81036129b157505050905061062161298d6000196000540190600d5490565b6040805160208101939093528201529081606081015b03601f1981018352826119f9565b6335c77e6f60e01b8103612a05575050604080516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660208201529293506106219150829081016129a3565b63859edc5560e01b8103612a2657509061204e91612a21612b43565b6132b4565b6367fe1ffb60e01b6000526001600160e01b03191660045260246000fd5b6323e5db0b60e01b861494506128df565b631333c6cd60e21b861494506128d8565b6326f8cd4f60e01b861494506128d1565b6353f669bf60e11b861494506128ca565b633f79b95560e21b871491506128c4565b637ac3c02f60e01b871491506128bd565b6382daf2a160e01b871491506128b6565b63d41c3a6560e01b871491506128af565b6339dc165f60e11b871491506128a8565b63653f8fc360e11b871491506128a1565b637ba0e2e760e01b8714915061289a565b631333c6cd60e21b87149150612893565b6323e5db0b60e01b8714915061288c565b6353f669bf60e11b87149150612885565b6326f8cd4f60e01b8714915061287e565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316141580612b8c575b612b7c57565b6282b42960e81b60005260046000fd5b50638b78c6d819546001600160a01b0316331415612b76565b906000918060011115612bb55750565b6000548110612bc15750565b9091505b80600052600460205260406000205480612be9575080156122b55760001901612bc5565b600160e01b1615919050565b632ce44b5f60e11b60005260046000fd5b62a1148160e81b60005260046000fd5b633a954ecd60e21b60005260046000fd5b636f96cda160e11b60005260046000fd5b631960ccad60e11b60005260046000fd5b622e076360e81b60005260046000fd5b80600111612c2757612c75816000526004602052604060002090565b54908115612c8c5750600160e01b8116612c275790565b9050600054811015612c27575b60001901600081815260046020526040902054908115612cc25750600160e01b8116612c275790565b9050612c99565b6001600160a01b038116151580612da0575b612ce3575050565b600082815260096020526040902054612d0b904260a01b8111026001600160a01b03166123d5565b612d8f57600c546001600160a01b03169182612d2657505050565b823b156100235760405163657711f560e11b81523360048201526001600160a01b0392909216602483015260006044830181905260648301919091529091829060849082905afa8015611f5157612d7a5750565b80612d89600061204e936119f9565b806105bd565b63ab49c91760e01b60005260046000fd5b506000612cdb565b90916001600160a01b038216151580612e74575b612dc557505050565b600081815260096020526040902054612ded904260a01b8111026001600160a01b03166123d5565b612d8f57600c546001600160a01b031680612e085750505050565b803b156100235760405163657711f560e11b81523360048201526001600160a01b0393841660248201529390921660448401526064830152600090829060849082905afa8015611f5157612e5f575b8080806125cc565b80612d896000612e6e936119f9565b38612e57565b506001600160a01b0383161515612dbc565b601c600060649281946020966040519860605260405260601b602c526323b872dd60601b600c525af13d15600160005114171615612ec8576000606052604052565b637939f4246000526004601cfd5b638b78c6d819543303612ee557565b6382b429006000526004601cfd5b60018060a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3638b78c6d81955565b9081602091031261002357516106218161037d565b6001600160a01b039182168152911660208201526040810191909152608060608201819052610621929101906105eb565b906020926000612fa0959360405196879586948593630a85bd0160e11b85523360048601612f46565b03926001600160a01b03165af160009181612fed575b50612fd757612fc361243d565b805115612fd257805190602001fd5b6125e9565b6001600160e01b031916630a85bd0160e11b1490565b61301091925060203d602011613017575b61300881836119f9565b810190612f31565b9038612fb6565b503d612ffe565b6130266125fa565b50600052600460205260406000205461303d6125fa565b6001600160a01b038216815260a082901c6001600160401b03166020820152600160e01b82161515604082015260e89190911c606082015290565b9060405160a08101604052600a608082019360008552935b60001901936030828206018553049283156130ad57600a90613090565b809350608091030191601f1901918252565b919082018092116122b557565b600081815260096020526040902054919290914260a01b8111026001600160a01b0316612d8f576001600160401b038116801561319257603c026001600160401b0381169081036122b5577f4e06b4e7000e659094299b3533b47b6aa8ad048e95e872d23d1f4ee55af89cfe9161314f6001600160401b0361318d9316426130bf565b60a01b9460018060a01b0316809517613172856000526009602052604060002090565b556040516001600160401b0390911681529081906020820190565b0390a3565b633008337760e21b60005260046000fd5b908160209103126100235751610621816104c8565b600b549091906001600160a01b0381163b1561326a57613214926020916131e7906001600160a01b03166123d5565b60405163c455279160e01b81526001600160a01b0390921660048301529093849190829081906024820190565b03915afa918215611f5157600092613239575b506001600160a01b0391821691161490565b61325c91925060203d602011613263575b61325481836119f9565b8101906131a3565b9038613227565b503d61324a565b505050600090565b60106000604492602095829560145260345263a9059cbb60601b82525af13d156001600051141716156132a6576000603452565b6390b8ec186000526004601cfd5b9081604091810103126100235780602061204e9235916132d3836104c8565b0135906001600160a01b0316613313565b60408180518101031261002357806040602061204e93015191613306836104c8565b0151906001600160a01b03165b6000549082156133cd576001600160a01b0381164260a01b6001851460e11b1717613348836000526004602052604060002090565b556001600160a01b0316600081815260056020526040902080546801000000000000000185020190559182156133c8578101909260015b156133b3575b60008484827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a461337f565b92600101928184036133855792509050600055565b612c49565b63b562e8dd60e01b60005260046000fdfea264697066735822122061134606274d28dcdc1aeb418dcbbf94d6c5f29d8866f1684b263636e3c0e24464736f6c634300081a0033000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e430000000000000000000000008870cd5aed8a586929a11468ddb38d8a1370d509
Deployed Bytecode
0x60806040526004361015610028575b346100235761001b61284f565b602081519101f35b600080fd5b60003560e01c806301ffc9a71461037857806304634d8d1461037357806306fdde031461036e578063081812fc14610369578063095ea7b314610364578063098144d41461035f578063099b6bfa1461035a5780630d705df61461035557806318160ddd1461035057806323b872dd1461034b57806325692962146103465780632a55205a146103415780632ed2d4291461033c5780633ccfd60b1461033757806342842e0e1461033257806342966c681461032d578063431e814a146103285780634eaaee421461032357806354d1f13d1461031e57806355f804b3146103195780635bbb2177146103145780636352211e1461030f5780636c0360eb1461030a5780636f8b44b01461030557806370a0823114610300578063715018a6146102fb5780638462151c146102f65780638da5cb5b146102f15780638fc88c48146102ec578063938e3d7b146102e757806395d89b41146102e257806399a2557a146102dd578063a22cb465146102d8578063a4830114146102d3578063a9fc664e146102ce578063b54d6238146102c9578063b88d4fde146102c4578063c23dc68f146102bf578063c2f1f14a146102ba578063c6ab67a3146102b5578063c87b56dd146102b0578063d5abeb01146102ab578063d73ee58e146102a6578063e030565e146102a1578063e4737f5b1461029c578063e8a3d48514610297578063e985e9c514610292578063ed1959681461028d578063f04e283e14610288578063f2fde38b14610283578063f4f3b2001461027e578063fee81cf4146102795763ffdd1cc80361000e57611f8d565b611f56565b611eb2565b611e72565b611e1e565b611dea565b611dac565b611d04565b611cdb565b611c43565b611bb9565b611b9b565b611b7c565b611b5e565b611b23565b611ac0565b611a35565b611957565b6118c6565b61186d565b6117de565b611657565b6115af565b611467565b611438565b61140b565b611270565b6111ea565b6111c3565b611128565b6110f8565b6110c9565b61105d565b610e8d565b610df6565b610c2a565b610bda565b610a79565b610a54565b6109f0565b6109c0565b610930565b6108e4565b6108d0565b61087c565b610854565b610800565b6107d7565b61072d565b6106fd565b610624565b6104d9565b61038f565b6001600160e01b031981160361002357565b34610023576020366003190112610023576103e86004356103af8161037d565b6001600160e01b03198116633434bf6960e01b8114919082156104b7575b82156103ec575b505060405190151581529081906020820190565b0390f35b6333a563c360e01b811492509082156104a6575b8215610495575b8215610479575b50811561041e575b5038806103d4565b6301ffc9a760e01b811491508115610468575b8115610457575b8115610446575b5038610416565b632b424ad760e21b1490503861043f565b635b5e139f60e01b81149150610438565b6380ac58cd60e01b81149150610431565b90915060e01c6301ffc9a7632a55205a8214911417903861040e565b632483248360e11b82149250610407565b632b435fdb60e21b82149250610400565b637ba0e2e760e01b811492506103cd565b6001600160a01b0381160361002357565b34610023576040366003190112610023576004356104f6816104c8565b6024356001600160601b0381169182820361002357610513612b43565b6103e883116105a857612710831161059a578060601b92831561058c5790921768aa4ec00224afccfdb755604080516001600160a01b0390931683526001600160601b0390911660208301527ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d9190819081015b0390a1005b63b4457eaa6000526004601cfd5b63350a88b36000526004601cfd5b82630cbf8cb160e11b60005260045260246000fd5b600091031261002357565b60005b8381106105db5750506000910152565b81810151838201526020016105cb565b90602091610604815180928185528580860191016105c8565b601f01601f1916010190565b9060206106219281815201906105eb565b90565b3461002357600036600319011261002357604051600060025461064681611fdc565b80845290600181169081156106d9575060011461067a575b6103e88361066e818503826119f9565b60405191829182610610565b600260009081527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace939250905b8082106106bf5750909150810160200161066e61065e565b9192600181602092548385880101520191019092916106a7565b60ff191660208086019190915291151560051b8401909101915061066e905061065e565b3461002357602036600319011261002357602061071b6004356120cf565b6040516001600160a01b039091168152f35b604036600319011261002357600435610745816104c8565b602435906001600160a01b0361075a83612c59565b16908133036107b8575b600083815260066020526040812080546001600160a01b0319166001600160a01b039390931692831790559091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259080a4005b6107c233836127c7565b610764576367d9dca160e11b60005260046000fd5b3461002357600036600319011261002357600c546040516001600160a01b039091168152602090f35b34610023576020366003190112610023577f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c604060043561083f612b43565b601054908060105582519182526020820152a1005b34610023576000366003190112610023576040805163657711f560e11b815260006020820152f35b346100235760003660031901126100235760005460015460209103600019015b604051908152f35b6060906003190112610023576004356108bc816104c8565b906024356108c9816104c8565b9060443590565b6108e26108dc366108a4565b91612109565b005b60003660031901126100235763389a75e1600c52336000526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a2005b3461002357604036600319011261002357600435604060243591600090815268aa4ec00224afccfdb76020522054908160601c9182156109a8575b6103e8908360601b18928360001904831184023d3d3e6127106040519485940204908360209093929193604081019460018060a01b031681520152565b5068aa4ec00224afccfdb754606081901c925061096b565b34610023576040366003190112610023576004356024356001600160401b0381168103610023576108e2916122d6565b3461002357600036600319011261002357610a09612b43565b478015610a4357638b78c6d819546000918291829182916001600160a01b03165af1610a3361243d565b9015610a3b57005b805190602001fd5b63177b02e160e31b60005260046000fd5b6108e2610a60366108a4565b9060405192610a706020856119f9565b600084526125b7565b3461002357602036600319011261002357600435610a9681612c59565b60008281526006602052604090208054916001600160a01b03811691338085149084141715610ac4565b1590565b610bc3575b600093610ad68685612cc9565b610bba575b506001600160a01b038216600090815260056020526040902080546001600160801b030190556001600160a01b0382164260a01b17600360e01b17610b2a856000526004602052604060002090565b55600160e11b811615610b71575b507fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a46108e2610b6c60015460010190565b600155565b60018401610b89816000526004602052604060002090565b5415610b96575b50610b38565b83548114610b9057610bb2906000526004602052604060002090565b553880610b90565b83905538610adb565b610bd0610ac033856127c7565b15610ac957612bf5565b3461002357602036600319011261002357600435600052600a602052604080600020546001600160801b0382519160ff81161515835260081c166020820152f35b60243590811515820361002357565b3461002357606036600319011261002357600435610c46610c1b565b6044356001600160801b038116808203610023576001600160a01b03610c6b85612c59565b16803303610db6575b5060008091610c97610c9087600052600a602052604060002090565b5460ff1690565b85151590151503610d83575b6001600160801b03610cd2610cc288600052600a602052604060002090565b5460081c6001600160801b031690565b1603610d3f575b159081610d36575b50610d25576040805192151583526001600160801b039190911660208301527f56f96edb8f2e1a8e7bdbee0aeb690b892f620dbd461f1979596dcfd74904eb9a91a2005b63a88ee57760e01b60005260046000fd5b90501538610ce1565b9050610d7b82610d5986600052600a602052604060002090565b90610100600160881b0382549160081b1690610100600160881b031916179055565b600190610cd9565b9050610dae84610d9d87600052600a602052604060002090565b9060ff801983541691151516179055565b600190610ca3565b610dc19033906127c7565b15610dcd575b38610c74565b336001600160a01b03610ddf866120cf565b1614610dc7576309e3bb1d60e31b60005260046000fd5b60003660031901126100235763389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2005b906020600319830112610023576004356001600160401b0381116100235782602382011215610023578060040135926001600160401b0384116100235760248483010111610023576024019190565b3461002357610e9b36610e3e565b610ea3612b43565b6001600160401b038111610fde57610ec581610ec0600e54611fdc565b61246d565b6000601f8211600114610f5d578190610ef593600092610f52575b50508160011b916000199060031b1c19161790565b600e555b600054600154900360001901610f0b57005b7f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c610587610f3a6000546122ba565b60405191829182919060206040840193600181520152565b013590503880610ee0565b600e600052601f198216927fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd91805b858110610fc657508360019510610fac575b505050811b01600e55610ef9565b0135600019600384901b60f8161c19169055388080610f9e565b90926020600181928686013581550194019101610f8c565b6119e3565b602060408183019282815284518094520192019060005b8181106110075750505090565b9091926020608082611052600194885162ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565b019401929101610ffa565b34610023576020366003190112610023576004356001600160401b0381116100235736602382011215610023578060040135906001600160401b038211610023573660248360051b83010111610023576103e89160246110bd9201612513565b60405191829182610fe3565b346100235760203660031901126100235760206001600160a01b036110ef600435612c59565b16604051908152f35b34610023576000366003190112610023576103e8611114612016565b6040519182916020835260208301906105eb565b3461002357602036600319011261002357600435611144612b43565b6001600160401b0381116111af57600054600019018110611190576020817f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c92600d55604051908152a1005b6000546000190190638c19f1f960e01b60005260045260245260446000fd5b63b43e913760e01b60005260045260246000fd5b3461002357602036600319011261002357602061089c6004356111e5816104c8565b612555565b6000366003190112610023576111fe612ed6565b6000638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a36000638b78c6d81955005b602060408183019282815284518094520192019060005b81811061125a5750505090565b825184526020938401939092019160010161124d565b346100235760203660031901126100235760043561128d816104c8565b600054606091816001036112aa575b604051806103e88582611236565b81926001906060938083101561140657600054809110156113fe575b506112d083612555565b90858310156113f5575b816112f0575b505050506103e89150903861129c565b92935090916000198501828111156113ed575b506040519083830160051b8201948560405261131e8561262f565b93600094611332610ac06040830151151590565b6113db575b50600095949597855b156113ac575b6000966113528761301e565b604081015115611371575050600187965b019688604052969596611340565b96909651806113a4575b50838718851b1561138f575b600190611363565b6001909901600581901b86018a905298611387565b96503861137b565b80861480156113d2575b156113465750505050925050506103e8918152388080806112e0565b508189146113b6565b516001600160a01b0316945038611337565b915038611303565b600091506112da565b9450386112c6565b612c38565b3461002357600036600319011261002357638b78c6d819546040516001600160a01b039091168152602090f35b34610023576020366003190112610023576004356000526009602052602060406000205460a01c604051908152f35b346100235761147536610e3e565b61147d612b43565b6001600160401b038111610fde5761149f8161149a600f54611fdc565b6124c0565b600091601f821160011461150e576114f082807f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac3737895600091611503575b508160011b916000199060031b1c19161790565b600f555b6105876040519283928361258f565b9050830135386114dc565b600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802601f198316845b818110611597575093837f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac37378951061157d575b5050600182811b01600f556114f4565b820135600019600385901b60f8161c19169055388061156d565b8386013583556020958601956001909301920161153b565b346100235760003660031901126100235760405160006003546115d181611fdc565b80845290600181169081156106d957506001146115f8576103e88361066e818503826119f9565b600360009081527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b939250905b80821061163d5750909150810160200161066e61065e565b919260018160209254838588010152019101909291611625565b3461002357606036600319011261002357600435611674816104c8565b60443590606090602435838181811015611406576001116117d5575b600054809110156117cd575b506116a682612555565b848210156117c5575b806116c3575b604051806103e88682611236565b90809293508403818111156117bd575b506040516001820160051b810193846040526116ee8461262f565b92600093611702610ac06040830151151590565b6117ab575b5060009493949660015b1561177e575b6000956117238661301e565b604081015115611742575050600186955b019587604052959495611711565b9590955180611776575b5083861860601b15611761575b600190611734565b6001909801600581901b850189905297611759565b95503861174c565b80851480156117a2575b1561171757505050925050506103e89181523880806116b5565b50818814611788565b516001600160a01b0316935038611707565b9050386116d3565b5060006116af565b93503861169c565b60019150611690565b34610023576040366003190112610023576004356117fb816104c8565b611803610c1b565b9033600052600760205261183182610d9d8360406000209060018060a01b0316600052602052604060002090565b60405191151582526001600160a01b03169033907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b34610023576040366003190112610023577f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6024356004356118ad612b43565b6040805191825260208201929092529081908101610587565b34610023576020366003190112610023576004356118e3816104c8565b6118eb612ed6565b600c546001600160a01b0391821691811682811461194657827fcc5dc080ff977b3c3a211fa63ab74f90f658f5ba9d3236e92c8f59570f442aac936040936001600160601b0360a01b1617600c5582519182526020820152a1005b63251dd8cf60e11b60005260046000fd5b34610023576020366003190112610023576004356000818152600960205260409020544260a01b8111026001600160a01b0316336001600160a01b03909116036119d257806000526009602052600060408120557f059ea9d6426bbae6ac9c53283977ee93577f8e299e1f7d7314b3d23eecfb2b08600080a2005b631eb49d6d60e11b60005260046000fd5b634e487b7160e01b600052604160045260246000fd5b90601f801991011681019081106001600160401b03821117610fde57604052565b6001600160401b038111610fde57601f01601f191660200190565b608036600319011261002357600435611a4d816104c8565b60243590611a5a826104c8565b604435606435926001600160401b038411610023573660238501121561002357836004013592611a8984611a1a565b93611a9760405195866119f9565b80855236602482880101116100235760208160009260246108e2990183890137860101526125b7565b34610023576020366003190112610023576080611ade60043561262f565b611b21604051809262ffffff6060809260018060a01b0381511685526001600160401b036020820151166020860152604081015115156040860152015116910152565bf35b34610023576020366003190112610023576004356000908152600960209081526040909120544260a01b8111026001600160a01b031661071b565b34610023576000366003190112610023576020601054604051908152f35b34610023576020366003190112610023576103e8611114600435612701565b34610023576000366003190112610023576020600d54604051908152f35b3461002357602036600319011261002357600435611bd6816104c8565b611bde612ed6565b600b546001600160a01b039182169181168214611c32576001600160a01b0319168117600b556040519081527fbca4bcdee8e819ac8634856a2bdc5bcd861ed9a864697faee95b1a54d83644f490602090a1005b631ea5355560e01b60005260046000fd5b3461002357606036600319011261002357600435602435611c63816104c8565b604435906001600160401b0382168203610023576001600160a01b03611c8884612c59565b16803303611c9b575b506108e2926130cc565b611ca69033906127c7565b15611cb2575b38611c91565b336001600160a01b03611cc4856120cf565b1614611cac576309e3bb1d60e31b60005260046000fd5b3461002357600036600319011261002357600b546040516001600160a01b039091168152602090f35b34610023576000366003190112610023576040516000600f54611d2681611fdc565b80845290600181169081156106d95750600114611d4d576103e88361066e818503826119f9565b600f60009081527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802939250905b808210611d925750909150810160200161066e61065e565b919260018160209254838588010152019101909291611d7a565b34610023576040366003190112610023576020611de0600435611dce816104c8565b60243590611ddb826104c8565b6127c7565b6040519015158152f35b34610023576020366003190112610023576004356000526009602052602060018060a01b0360406000205416604051908152f35b602036600319011261002357600435611e36816104c8565b611e3e612ed6565b63389a75e1600c52806000526020600c209081544211611e645760006108e29255612ef3565b636f5e88186000526004601cfd5b602036600319011261002357600435611e8a816104c8565b611e92612ed6565b8060601b15611ea4576108e290612ef3565b637448fbae6000526004601cfd5b3461002357602036600319011261002357600435611ecf816104c8565b611ed7612b43565b6040516370a0823160e01b81523060048201526020816024816001600160a01b0386165afa908115611f5157600091611f22575b508015610a4357638b78c6d819546108e292613272565b611f44915060203d602011611f4a575b611f3c81836119f9565b81019061280b565b38611f0b565b503d611f32565b61281a565b3461002357602036600319011261002357600435611f73816104c8565b63389a75e1600c52600052602080600c2054604051908152f35b3461002357602036600319011261002357604060043580600052600a6020526001600160801b03826000205460081c1690600052600a60205260ff826000205416825191825215156020820152f35b90600182811c9216801561200c575b6020831014611ff657565b634e487b7160e01b600052602260045260246000fd5b91607f1691611feb565b60405190600082600e549161202a83611fdc565b80835292600181169081156120b05750600114612050575b61204e925003836119f9565b565b50600e600090815290917fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd5b81831061209457505090602061204e92820101612042565b602091935080600191548385890101520191019091849261207c565b6020925061204e94915060ff191682840152151560051b820101612042565b6120d881612ba5565b156120f8576000908152600660205260409020546001600160a01b031690565b6333d1c03960e21b60005260046000fd5b919061211482612c59565b6001600160a01b0393841693811684900361228757600083815260066020526040902080546121526001600160a01b03871633908114908314171590565b612270575b612162858588612da8565b612266575b506001600160a01b038416600090815260056020526040902080546000190190556001600160a01b0382166000908152600560205260409020805460010190556001600160a01b0382164260a01b17600160e11b176121d0846000526004602052604060002090565b55600160e11b81161561221c575b506001600160a01b03169182907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a41561221757565b612c16565b60018301612234816000526004602052604060002090565b5415612241575b506121de565b600054811461223b5761225e906000526004602052604060002090565b55388061223b565b6000905538612167565b61227d610ac033886127c7565b1561215757612bf5565b612c06565b634e487b7160e01b600052601160045260246000fd5b818102929181159184041417156122b557565b61228c565b6000198101919082116122b557565b919082039182116122b557565b9081600052600a60205260ff604060002054161561242c5781600052600a6020526001600160801b0360406000205460081c166001600160401b038216026001600160801b0381169081036122b55761233a906001600160801b03169133846130cc565b808015612427577fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e55895461204e937fde34533cbed214298b6cefa8df9aaed61e4838af880d2ac23c91b23d872e55889290919061ffff6123bb60046123ac6001600160a01b0386169560a01c61ffff1690565b9601546001600160a01b031690565b9416806123e9575b5050506123d56123d56123e192612c59565b6001600160a01b031690565b903390612e86565b6123e19395506123d5928261241b61241261240a612420956123d5976122a2565b612710900490565b8093338a612e86565b6122c9565b94926123c3565b505050565b6305bc99b160e31b60005260046000fd5b3d15612468573d9061244e82611a1a565b9161245c60405193846119f9565b82523d6000602084013e565b606090565b601f8111612479575050565b600e6000526020600020906020601f840160051c830193106124b6575b601f0160051c01905b8181106124aa575050565b6000815560010161249f565b9091508190612496565b601f81116124cc575050565b600f6000526020600020906020601f840160051c83019310612509575b601f0160051c01905b8181106124fd575050565b600081556001016124f2565b90915081906124e9565b6040519180835260051b906020828401016040525b8182801561254e57601f199081019361254591908401013561262f565b90840152612528565b5050505090565b6001600160a01b0316801561257e5760005260056020526001600160401b036040600020541690565b6323d3ad8160e21b60005260046000fd5b90918060409360208452816020850152848401376000828201840152601f01601f1916010190565b9291906125c5828286612109565b803b6125d2575b50505050565b6125db93612f77565b156125e957388080806125cc565b6368d2bf6b60e11b60005260046000fd5b60405190608082018281106001600160401b03821117610fde5760405260006060838281528260208201528260408201520152565b906126386125fa565b9160018110156126455750565b60005481106126515750565b9091505b8060005260046020526040600020546126715760001901612655565b6106219061301e565b8051156126875760200190565b634e487b7160e01b600052603260045260246000fd5b604051906126ac6040836119f9565b60018252602f60f81b6020830152565b61204e90929192602060405194826126dd87945180928580880191016105c8565b83016126f1825180938580850191016105c8565b010103601f1981018452836119f9565b61270a81612ba5565b156127b657612717612016565b9081511561279f57815160001981019081116122b5578251811015612687578201602001516001600160f81b03191661277761276a61275c61275761269d565b61267a565b516001600160f81b03191690565b6001600160f81b03191690565b6001600160f81b03199091160361279b579061279561062192613078565b906126bc565b5090565b50506040516127af6020826119f9565b6000815290565b630a14c4b560e41b60005260046000fd5b6127d182826131b8565b612804576001600160a01b039081166000908152600760209081526040808320939094168252919091522060ff90541690565b5050600190565b90816020910312610023575190565b6040513d6000823e3d90fd5b91909182600411610023578211610023576004916003190190565b908160008237016000815290565b6000356001600160e01b03191660606128683680612826565b6320351c0160e01b841480159392908085612b32575b8115612b21575b8115612b10575b8115612aff575b8115612aee575b8115612add575b8115612acc575b8115612abb575b8115612aaa575b8115612a99575b8115612a88575b94612a77575b8415612a66575b8415612a55575b8415612a44575b1561296057505050612953575b600080604051806128fd8136612841565b03907f000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e435af49061292b61243d565b911561294a57637ba0e2e760e01b146129415790565b610621816132e4565b50805190602001fd5b61295b612b43565b6128ec565b91949390925063224201db60e01b81036129b157505050905061062161298d6000196000540190600d5490565b6040805160208101939093528201529081606081015b03601f1981018352826119f9565b6335c77e6f60e01b8103612a05575050604080516001600160a01b037f000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e431660208201529293506106219150829081016129a3565b63859edc5560e01b8103612a2657509061204e91612a21612b43565b6132b4565b6367fe1ffb60e01b6000526001600160e01b03191660045260246000fd5b6323e5db0b60e01b861494506128df565b631333c6cd60e21b861494506128d8565b6326f8cd4f60e01b861494506128d1565b6353f669bf60e11b861494506128ca565b633f79b95560e21b871491506128c4565b637ac3c02f60e01b871491506128bd565b6382daf2a160e01b871491506128b6565b63d41c3a6560e01b871491506128af565b6339dc165f60e11b871491506128a8565b63653f8fc360e11b871491506128a1565b637ba0e2e760e01b8714915061289a565b631333c6cd60e21b87149150612893565b6323e5db0b60e01b8714915061288c565b6353f669bf60e11b87149150612885565b6326f8cd4f60e01b8714915061287e565b337f000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e436001600160a01b0316141580612b8c575b612b7c57565b6282b42960e81b60005260046000fd5b50638b78c6d819546001600160a01b0316331415612b76565b906000918060011115612bb55750565b6000548110612bc15750565b9091505b80600052600460205260406000205480612be9575080156122b55760001901612bc5565b600160e01b1615919050565b632ce44b5f60e11b60005260046000fd5b62a1148160e81b60005260046000fd5b633a954ecd60e21b60005260046000fd5b636f96cda160e11b60005260046000fd5b631960ccad60e11b60005260046000fd5b622e076360e81b60005260046000fd5b80600111612c2757612c75816000526004602052604060002090565b54908115612c8c5750600160e01b8116612c275790565b9050600054811015612c27575b60001901600081815260046020526040902054908115612cc25750600160e01b8116612c275790565b9050612c99565b6001600160a01b038116151580612da0575b612ce3575050565b600082815260096020526040902054612d0b904260a01b8111026001600160a01b03166123d5565b612d8f57600c546001600160a01b03169182612d2657505050565b823b156100235760405163657711f560e11b81523360048201526001600160a01b0392909216602483015260006044830181905260648301919091529091829060849082905afa8015611f5157612d7a5750565b80612d89600061204e936119f9565b806105bd565b63ab49c91760e01b60005260046000fd5b506000612cdb565b90916001600160a01b038216151580612e74575b612dc557505050565b600081815260096020526040902054612ded904260a01b8111026001600160a01b03166123d5565b612d8f57600c546001600160a01b031680612e085750505050565b803b156100235760405163657711f560e11b81523360048201526001600160a01b0393841660248201529390921660448401526064830152600090829060849082905afa8015611f5157612e5f575b8080806125cc565b80612d896000612e6e936119f9565b38612e57565b506001600160a01b0383161515612dbc565b601c600060649281946020966040519860605260405260601b602c526323b872dd60601b600c525af13d15600160005114171615612ec8576000606052604052565b637939f4246000526004601cfd5b638b78c6d819543303612ee557565b6382b429006000526004601cfd5b60018060a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3638b78c6d81955565b9081602091031261002357516106218161037d565b6001600160a01b039182168152911660208201526040810191909152608060608201819052610621929101906105eb565b906020926000612fa0959360405196879586948593630a85bd0160e11b85523360048601612f46565b03926001600160a01b03165af160009181612fed575b50612fd757612fc361243d565b805115612fd257805190602001fd5b6125e9565b6001600160e01b031916630a85bd0160e11b1490565b61301091925060203d602011613017575b61300881836119f9565b810190612f31565b9038612fb6565b503d612ffe565b6130266125fa565b50600052600460205260406000205461303d6125fa565b6001600160a01b038216815260a082901c6001600160401b03166020820152600160e01b82161515604082015260e89190911c606082015290565b9060405160a08101604052600a608082019360008552935b60001901936030828206018553049283156130ad57600a90613090565b809350608091030191601f1901918252565b919082018092116122b557565b600081815260096020526040902054919290914260a01b8111026001600160a01b0316612d8f576001600160401b038116801561319257603c026001600160401b0381169081036122b5577f4e06b4e7000e659094299b3533b47b6aa8ad048e95e872d23d1f4ee55af89cfe9161314f6001600160401b0361318d9316426130bf565b60a01b9460018060a01b0316809517613172856000526009602052604060002090565b556040516001600160401b0390911681529081906020820190565b0390a3565b633008337760e21b60005260046000fd5b908160209103126100235751610621816104c8565b600b549091906001600160a01b0381163b1561326a57613214926020916131e7906001600160a01b03166123d5565b60405163c455279160e01b81526001600160a01b0390921660048301529093849190829081906024820190565b03915afa918215611f5157600092613239575b506001600160a01b0391821691161490565b61325c91925060203d602011613263575b61325481836119f9565b8101906131a3565b9038613227565b503d61324a565b505050600090565b60106000604492602095829560145260345263a9059cbb60601b82525af13d156001600051141716156132a6576000603452565b6390b8ec186000526004601cfd5b9081604091810103126100235780602061204e9235916132d3836104c8565b0135906001600160a01b0316613313565b60408180518101031261002357806040602061204e93015191613306836104c8565b0151906001600160a01b03165b6000549082156133cd576001600160a01b0381164260a01b6001851460e11b1717613348836000526004602052604060002090565b556001600160a01b0316600081815260056020526040902080546801000000000000000185020190559182156133c8578101909260015b156133b3575b60008484827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a461337f565b92600101928184036133855792509050600055565b612c49565b63b562e8dd60e01b60005260046000fdfea264697066735822122061134606274d28dcdc1aeb418dcbbf94d6c5f29d8866f1684b263636e3c0e24464736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e430000000000000000000000008870cd5aed8a586929a11468ddb38d8a1370d509
-----Decoded View---------------
Arg [0] : allowedConfigurer (address): 0xD61Fe617935AE0437854D3794e38E8dEd0D64e43
Arg [1] : ownerToSet (address): 0x8870cD5AED8A586929a11468DdB38d8A1370D509
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d61fe617935ae0437854d3794e38e8ded0d64e43
Arg [1] : 0000000000000000000000008870cd5aed8a586929a11468ddb38d8a1370d509
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.