ERC-721
Overview
Max Total Supply
4,998 BBS
Holders
1,369
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
2 BBSLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xd9964a04...c29922CBa The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
HyperMintERC721A_2_2_0
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/interfaces/IERC2981.sol'; import '@openzeppelin/contracts/interfaces/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './Ownable_1_0_0.sol'; import 'erc721a/contracts/extensions/ERC721ABurnable.sol'; import './opensea-operator-filter/OperatorFilterer.sol'; contract HyperMintERC721A_2_2_0 is ERC721ABurnable, Ownable, OperatorFilterer { using SafeERC20 for IERC20; /* ================= CUSTOM ERRORS ================= */ error NewSupplyTooLow(); error MaxSupplyExceeded(); error SignatureExpired(); error NotAuthorised(); error BuyDisabled(); error InsufficientPaymentValue(); error PublicSaleClosed(); error SaleClosed(); error MaxPerAddressExceeded(); error MaxPerTransactionExceeded(); error NonExistentToken(); error ContractCallBlocked(); error ImmutableRecoveryAddress(); error TransfersDisabled(); /* ================= STATE VARIABLES ================= */ // ============== Structs ============== struct GeneralConfig { string name; string symbol; string contractMetadataUrl; string tokenMetadataUrl; bool allowBuy; bool allowPublicTransfer; bool enableOpenSeaOperatorFilterRegistry; uint256 publicSaleDate; uint256 saleCloseDate; uint256 primaryRoyaltyFee; uint256 secondaryRoyaltyFee; } struct Addresses { address recoveryAddress; address collectionOwnerAddress; address authorisationAddress; address purchaseTokenAddress; address managerPrimaryRoyaltyAddress; address customerPrimaryRoyaltyAddress; address secondaryRoyaltyAddress; } struct TokenConfig { uint256 price; uint256 maxSupply; uint256 maxPerTransaction; } // ========= Immutable Storage ========= uint256 internal constant BASIS_POINTS = 10000; // ========== Mutable Storage ========== string public constant version = '2.2.0'; GeneralConfig public generalConfig; TokenConfig public tokenConfig; Addresses public addresses; /* =================== CONSTRUCTOR =================== */ /// @param _generalConfig settings for the contract /// @param _tokenConfig settings for tokens minted by the contract /// @param _addresses a collection of addresses constructor( GeneralConfig memory _generalConfig, TokenConfig memory _tokenConfig, Addresses memory _addresses ) ERC721A('', '') OperatorFilterer( address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6), // default filter by OS true // subscribe to the filter list ) { _transferOwnership(_addresses.collectionOwnerAddress); generalConfig = _generalConfig; tokenConfig = _tokenConfig; addresses = _addresses; } /* ====================== Views ====================== */ function name() public view override returns (string memory collectionName) { collectionName = generalConfig.name; } function symbol() public view override returns (string memory collectionSymbol) { collectionSymbol = generalConfig.symbol; } function supply() public view returns (uint256 _supply) { _supply = _totalMinted(); } function totalMinted(address addr) public view returns (uint256 numMinted) { numMinted = _numberMinted(addr); } function contractURI() public view virtual returns (string memory uri) { uri = generalConfig.contractMetadataUrl; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory uri) { if (!_exists(_tokenId)) revert NonExistentToken(); uri = string( abi.encodePacked( generalConfig.tokenMetadataUrl, _toString(_tokenId) ) ); } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address royaltyAddress, uint256 royaltyAmount) { /// @dev secondary royalty to be paid out by the marketplace /// to the splitter contract royaltyAddress = addresses.secondaryRoyaltyAddress; royaltyAmount = (_salePrice * generalConfig.secondaryRoyaltyFee) / BASIS_POINTS; } function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC721A) returns (bool result) { result = (_interfaceId == type(IERC2981).interfaceId || super.supportsInterface(_interfaceId)); } /* ================ MUTATIVE FUNCTIONS ================ */ // ============ Restricted ============= function setNameAndSymbol( string calldata _newName, string calldata _newSymbol ) external onlyContractManager { generalConfig.name = _newName; generalConfig.symbol = _newSymbol; } function setMetadataURIs( string calldata _contractURI, string calldata _tokenURI ) external onlyContractManager { generalConfig.contractMetadataUrl = _contractURI; generalConfig.tokenMetadataUrl = _tokenURI; } function setDates(uint256 _publicSale, uint256 _saleClosed) external onlyContractManager { generalConfig.publicSaleDate = _publicSale; generalConfig.saleCloseDate = _saleClosed; } function setTokenConfig( uint256 _price, uint256 _maxSupply, uint256 _maxPerTransaction ) external onlyContractManager { if (totalSupply() > _maxSupply) revert NewSupplyTooLow(); tokenConfig.price = _price; tokenConfig.maxSupply = _maxSupply; tokenConfig.maxPerTransaction = _maxPerTransaction; } function setAddresses(Addresses calldata _addresses) external onlyContractManager { if (_addresses.recoveryAddress != addresses.recoveryAddress) revert ImmutableRecoveryAddress(); if ( addresses.collectionOwnerAddress != _addresses.collectionOwnerAddress ) { _transferOwnership(_addresses.collectionOwnerAddress); } addresses = _addresses; } function setAllowBuy(bool _allowBuy) external onlyContractManager { generalConfig.allowBuy = _allowBuy; } function setAllowPublicTransfer(bool _allowPublicTransfer) external onlyContractManager { generalConfig.allowPublicTransfer = _allowPublicTransfer; } function setEnableOpenSeaOperatorFilterRegistry(bool _enable) external onlyContractManager { generalConfig.enableOpenSeaOperatorFilterRegistry = _enable; } function setRoyalty(uint256 _primaryFee, uint256 _secondaryFee) external onlyContractManager { generalConfig.primaryRoyaltyFee = _primaryFee; generalConfig.secondaryRoyaltyFee = _secondaryFee; } // ============== Minting ============== function mintBatch( address[] calldata _accounts, uint256[] calldata _amounts ) external onlyContractManager nonContract { uint256 length = _accounts.length; for (uint256 i = 0; i < length; ) { address account = _accounts[i]; uint256 amount = _amounts[i]; if (supply() + amount > tokenConfig.maxSupply) revert MaxSupplyExceeded(); _mint(account, amount); unchecked { i += 1; } } } // ================ Buy ================ function buyAuthorised( uint256 _amount, uint256 _totalPrice, uint256 _maxPerAddress, uint256 _expires, bytes calldata _signature ) external payable buyAllowed nonContract { if (block.timestamp >= _expires) revert SignatureExpired(); bytes32 hash = keccak256( abi.encodePacked( address(this), msg.sender, _amount, _totalPrice, _maxPerAddress, _expires ) ); bytes32 message = ECDSA.toEthSignedMessageHash(hash); if ( ECDSA.recover(message, _signature) != addresses.authorisationAddress ) revert NotAuthorised(); if (_maxPerAddress != 0) { if (_numberMinted(msg.sender) + _amount > _maxPerAddress) revert MaxPerAddressExceeded(); } _buy(_amount, _totalPrice); } function buy(uint256 _amount) external payable buyAllowed nonContract { if ( generalConfig.publicSaleDate == 0 || block.timestamp < generalConfig.publicSaleDate ) revert PublicSaleClosed(); uint256 totalPrice = tokenConfig.price * _amount; _buy(_amount, totalPrice); } function _buy(uint256 _amount, uint256 _totalPrice) internal { if (generalConfig.saleCloseDate != 0) { if (block.timestamp >= generalConfig.saleCloseDate) revert SaleClosed(); } if (_totalMinted() + _amount > tokenConfig.maxSupply) revert MaxSupplyExceeded(); if (tokenConfig.maxPerTransaction != 0) { if (_amount > tokenConfig.maxPerTransaction) revert MaxPerTransactionExceeded(); } uint256 royaltyAmount = (_totalPrice * generalConfig.primaryRoyaltyFee) / BASIS_POINTS; if (addresses.purchaseTokenAddress != address(0)) { IERC20 token = IERC20(addresses.purchaseTokenAddress); /// @dev primary royalty cut for HyperMint token.safeTransferFrom( msg.sender, addresses.managerPrimaryRoyaltyAddress, royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) token.safeTransferFrom( msg.sender, addresses.customerPrimaryRoyaltyAddress, _totalPrice - royaltyAmount ); } else { if (msg.value < _totalPrice) revert InsufficientPaymentValue(); /// @dev primary royalty cut for HyperMint payable(addresses.managerPrimaryRoyaltyAddress).transfer( royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) payable(addresses.customerPrimaryRoyaltyAddress).transfer( _totalPrice - royaltyAmount ); } /// @dev mint tokens _mint(msg.sender, _amount); } // ================ Transfers ================ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal override transferAllowed(from, to) onlyAllowedOperator(from, generalConfig.enableOpenSeaOperatorFilterRegistry) { super._beforeTokenTransfers(from, to, startTokenId, quantity); } function transferAuthorised( address _from, address _to, uint256 _tokenId, uint256 _expires, bytes calldata _signature ) external nonContract { if (block.timestamp >= _expires) revert SignatureExpired(); bytes32 hash = keccak256( abi.encodePacked( address(this), msg.sender, _from, _to, _tokenId, _expires ) ); bytes32 message = ECDSA.toEthSignedMessageHash(hash); if ( ECDSA.recover(message, _signature) != addresses.authorisationAddress ) revert NotAuthorised(); super.safeTransferFrom(_from, _to, _tokenId); } // ============= Ownership ============= function recoverContract() external { if (msg.sender != addresses.recoveryAddress) revert NotAuthorised(); _transferContractManager(addresses.recoveryAddress); } function _startTokenId() internal pure override returns (uint256 tokenId) { tokenId = 1; } /* ==================== MODIFIERS ===================== */ modifier buyAllowed() { if (!generalConfig.allowBuy) revert BuyDisabled(); _; } /// @dev this eliminates the possibility of being called /// from a contract modifier nonContract() { if (tx.origin != msg.sender) revert ContractCallBlocked(); _; } modifier transferAllowed(address from, address to) { bool isMinting = from == address(0); bool isBurning = to == address(0); bool isContractManager = from == this.contractManager(); bool isTransferAuthorised = msg.sig == this.transferAuthorised.selector; if ( !isMinting && !isContractManager && !isBurning && !isTransferAuthorised ) { if (!generalConfig.allowPublicTransfer) revert TransfersDisabled(); } _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import '@openzeppelin/contracts/interfaces/IERC2981.sol'; import '@openzeppelin/contracts/interfaces/IERC20.sol'; import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './Ownable_1_0_0.sol'; contract HyperMintERC1155_2_0_0 is ERC1155Burnable, Ownable { using SafeERC20 for IERC20; /* ================= CUSTOM ERRORS ================= */ error NewSupplyTooLow(); error ArrayLengthMismatch(); error MaxSupplyExceeded(); error SignatureExpired(); error NotAuthorised(); error BuyDisabled(); error InsufficientPaymentValue(); error PublicSaleClosed(); error SaleClosed(); error MaxPerTransactionsExceeded(); error ContractCallBlocked(); error ImmutableRecoveryAddress(); /* ================= STATE VARIABLES ================= */ // ============== Structs ============== struct Addresses { address recoveryAddress; address collectionOwnerAddress; address authorisationAddress; address purchaseTokenAddress; address managerPrimaryRoyaltyAddress; address customerPrimaryRoyaltyAddress; address secondaryRoyaltyAddress; } struct TokenInfo { uint256[] prices; uint256[] supplies; uint256[] totalSupplies; uint256[] maxPerTransactions; } // ========= Immutable Storage ========= uint256 internal constant BASIS_POINTS = 10000; // ========== Mutable Storage ========== string public constant version = '2.0.0'; /// @dev token info string public name; string public symbol; uint256[] public prices; uint256[] public supplies; uint256[] public totalSupplies; uint256[] public maxPerTransactions; /// @dev metadata info string public contractURI; /// @dev toggle for api mints bool public allowBuy; /// @dev sale dates uint256 public publicSaleDate; uint256 public saleCloseDate; /// @dev royalty fees uint256 public primaryRoyaltyFee; uint256 public secondaryRoyaltyFee; Addresses public addresses; /* =================== CONSTRUCTOR =================== */ /// @notice Creates a new NFT contract /// @param _name token name /// @param _symbol token symbol /// @param _contractMetadataURI contract metadata uri /// @param _allowBuy toggle to enable/disable buying /// @param _addresses a collection of addresses constructor( string memory _name, string memory _symbol, string memory _contractMetadataURI, string memory _tokenMetadataURI, bool _allowBuy, Addresses memory _addresses ) ERC1155('') { _transferOwnership(_addresses.collectionOwnerAddress); name = _name; symbol = _symbol; allowBuy = _allowBuy; _setURI(_tokenMetadataURI); contractURI = _contractMetadataURI; addresses = _addresses; } /* ====================== Views ====================== */ function getTokenInfo() external view returns (TokenInfo memory tokenInfo) { tokenInfo = TokenInfo( prices, supplies, totalSupplies, maxPerTransactions ); } function totalSupply(uint256 _tokenId) public view returns (uint256 _totalSupply) { _totalSupply = totalSupplies[_tokenId]; } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address royaltyAddress, uint256 royaltyAmount) { /// @dev secondary royalty to be paid out by the marketplace /// to the splitter contract royaltyAddress = addresses.secondaryRoyaltyAddress; royaltyAmount = (_salePrice * secondaryRoyaltyFee) / BASIS_POINTS; } function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC1155) returns (bool result) { result = (_interfaceId == type(IERC2981).interfaceId || super.supportsInterface(_interfaceId)); } /* ================ MUTATIVE FUNCTIONS ================ */ // ============ Restricted ============= function setNameAndSymbol( string calldata _newName, string calldata _newSymbol ) external onlyContractManager { name = _newName; symbol = _newSymbol; } function setMetadataURIs( string calldata _contractURI, string calldata _tokenURI ) external onlyContractManager { contractURI = _contractURI; _setURI(_tokenURI); } function setDates(uint256 _publicSale, uint256 _saleClosed) external onlyContractManager { publicSaleDate = _publicSale; saleCloseDate = _saleClosed; } function setTokenData( uint256 _id, uint256 _price, uint256 _supply, uint256 _maxPerAddress ) external onlyContractManager { if (supplies[_id] > _supply) revert NewSupplyTooLow(); prices[_id] = _price; totalSupplies[_id] = _supply; maxPerTransactions[_id] = _maxPerAddress; } function setAddresses(Addresses calldata _addresses) external onlyContractManager { if (_addresses.recoveryAddress != addresses.recoveryAddress) revert ImmutableRecoveryAddress(); if ( addresses.collectionOwnerAddress != _addresses.collectionOwnerAddress ) { _transferOwnership(_addresses.collectionOwnerAddress); } addresses = _addresses; } function setAllowBuy(bool _allowBuy) external onlyContractManager { allowBuy = _allowBuy; } function addTokens( uint256[] calldata _newSupplies, uint256[] calldata _newPrices, uint256[] calldata _maxPerTransactions ) external onlyContractManager arrayLengthMatch(_newSupplies, _newPrices) { uint256 suppliesLength = _newSupplies.length; if (suppliesLength != _newPrices.length) revert ArrayLengthMismatch(); for (uint256 i = 0; i < suppliesLength; ) { totalSupplies.push(_newSupplies[i]); supplies.push(0); prices.push(_newPrices[i]); maxPerTransactions.push(_maxPerTransactions[i]); unchecked { ++i; } } } function setRoyalty(uint256 _primaryFee, uint256 _secondaryFee) external onlyContractManager { primaryRoyaltyFee = _primaryFee; secondaryRoyaltyFee = _secondaryFee; } // ============== Minting ============== function mintBatch( address[] calldata _to, uint256[][] calldata _ids, uint256[][] calldata _amounts ) external onlyContractManager nonContract { uint256 toLength = _to.length; for (uint256 i = 0; i < toLength; ) { uint256 idsLength = _ids[i].length; for (uint256 j = 0; j < idsLength; ) { uint256 _supply = supplies[_ids[i][j]]; if (_supply + _amounts[i][j] > totalSupplies[_ids[i][j]]) revert MaxSupplyExceeded(); /// @dev remove overflow protection enabled by default /// as supplies is already capped by totalSupplies unchecked { _supply += _amounts[i][j]; } /// @dev write back to storage supplies[_ids[i][j]] = _supply; unchecked { ++j; } } _mintBatch(_to[i], _ids[i], _amounts[i], '0x'); unchecked { ++i; } } } // ================ Buy ================ function buyAuthorised( uint256 _id, uint256 _amount, uint256 _totalPrice, uint256 _maxPerAddress, uint256 _expires, bytes calldata _signature ) external payable buyAllowed nonContract { if (block.timestamp >= _expires) revert SignatureExpired(); bytes32 hash = keccak256( abi.encodePacked( address(this), msg.sender, _amount, _totalPrice, _maxPerAddress, _expires, _id ) ); bytes32 message = ECDSA.toEthSignedMessageHash(hash); if ( ECDSA.recover(message, _signature) != addresses.authorisationAddress ) revert NotAuthorised(); _buy(_id, _amount, _totalPrice); } function buy(uint256 _id, uint256 _amount) external payable buyAllowed nonContract { if (publicSaleDate == 0 || block.timestamp < publicSaleDate) revert PublicSaleClosed(); uint256 totalPrice = prices[_id] * _amount; _buy(_id, _amount, totalPrice); } function _buy( uint256 _id, uint256 _amount, uint256 _totalPrice ) internal { uint256 _supply = supplies[_id]; if (saleCloseDate != 0) { if (block.timestamp >= saleCloseDate) revert SaleClosed(); } if (_supply + _amount > totalSupplies[_id]) revert MaxSupplyExceeded(); if (maxPerTransactions[_id] != 0) { if (_amount > maxPerTransactions[_id]) revert MaxPerTransactionsExceeded(); } uint256 royaltyAmount = (_totalPrice * primaryRoyaltyFee) / BASIS_POINTS; if (addresses.purchaseTokenAddress != address(0)) { IERC20 token = IERC20(addresses.purchaseTokenAddress); /// @dev primary royalty cut for Hypermint token.safeTransferFrom( msg.sender, addresses.managerPrimaryRoyaltyAddress, royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) token.safeTransferFrom( msg.sender, addresses.customerPrimaryRoyaltyAddress, _totalPrice - royaltyAmount ); } else { if (msg.value < _totalPrice) revert InsufficientPaymentValue(); /// @dev primary royalty cut for Hypermint payable(addresses.managerPrimaryRoyaltyAddress).transfer( royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) payable(addresses.customerPrimaryRoyaltyAddress).transfer( _totalPrice - royaltyAmount ); } /// @dev remove overflow protection enabled by default /// as supply is already capped by totalSupply unchecked { _supply += _amount; } /// @dev write back to storage supplies[_id] = _supply; _mint(msg.sender, _id, _amount, '0x'); } // ============= Ownership============= function recoverContract() external { if (msg.sender != addresses.recoveryAddress) revert NotAuthorised(); _transferContractManager(addresses.recoveryAddress); } /* ==================== MODIFIERS ===================== */ modifier buyAllowed() { if (!allowBuy) revert BuyDisabled(); _; } modifier arrayLengthMatch( uint256[] calldata arr1, uint256[] calldata arr2 ) { if (arr1.length != arr2.length) revert ArrayLengthMismatch(); _; } /// @dev this eliminates the possibility of being called /// from a contract modifier nonContract() { if (tx.origin != msg.sender) revert ContractCallBlocked(); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. * * _Available since v3.1._ */ abstract contract ERC1155Burnable is ERC1155 { function burn( address account, uint256 id, uint256 value ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burn(account, id, value); } function burnBatch( address account, uint256[] memory ids, uint256[] memory values ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burnBatch(account, ids, values); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.4; import '@openzeppelin/contracts/utils/Context.sol'; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; address private _contractManager; event ContractManagerTransferred( address indexed previousContractManager, address indexed newContractManager ); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferContractManager(msg.sender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), 'Ownable: caller is not the owner'); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require( newOwner != address(0), 'Ownable: new owner is the zero address' ); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev Returns the manager of the contract */ function contractManager() public view virtual returns (address) { return _contractManager; } /** * @dev Throws if called by any account other than the Contract Manager. */ modifier onlyContractManager() { require( _msgSender() == _contractManager, 'Ownable: caller is not the contract manager' ); _; } /** * @dev Transfers manager of the contract to a new account (`newContractManager`). * Can only be called by the current _contractManager. */ function transferContractManager(address newContractManager) public virtual onlyContractManager { require( newContractManager != address(0), 'Ownable: new contract owner is the zero address' ); _transferContractManager(newContractManager); } /** * @dev Transfers management of the contract to a new account (`newContractManager`). * Internal function without access restriction. */ function _transferContractManager(address newContractManager) internal virtual { address oldContractManager = _contractManager; _contractManager = newContractManager; emit ContractManagerTransferred(oldContractManager, newContractManager); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721ABurnable.sol'; import '../ERC721A.sol'; /** * @title ERC721ABurnable. * * @dev ERC721A token that can be irreversibly burned (destroyed). */ abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual override { _burn(tokenId, true); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {IOperatorFilterRegistry} from './IOperatorFilterRegistry.sol'; abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(operatorFilterRegistry).code.length > 0) { if (subscribe) { operatorFilterRegistry.registerAndSubscribe( address(this), subscriptionOrRegistrantToCopy ); } else { if (subscriptionOrRegistrantToCopy != address(0)) { operatorFilterRegistry.registerAndCopyEntries( address(this), subscriptionOrRegistrantToCopy ); } else { operatorFilterRegistry.register(address(this)); } } } } modifier onlyAllowedOperator(address from, bool switchedOn) virtual { // return back out if toggle is off if (!switchedOn) { _; return; } // Check registry code length to facilitate testing in environments without a deployed registry. if (address(operatorFilterRegistry).code.length > 0) { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from == msg.sender) { _; return; } if ( !(operatorFilterRegistry.isOperatorAllowed( address(this), msg.sender ) && operatorFilterRegistry.isOperatorAllowed( address(this), from )) ) { revert OperatorNotAllowed(msg.sender); } } _; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721ABurnable. */ interface IERC721ABurnable is IERC721A { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) external; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.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()`. * * 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 { // Reference type for token approval. 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; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _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(); 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 Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // 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, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * 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) public virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _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 { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); _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) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`. 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 virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_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; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public 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 virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__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(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _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) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _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(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _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) ); 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(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _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 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(); 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 ptr) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128. ptr := add(mload(0x40), 128) // Update the free memory pointer to allocate. mstore(0x40, ptr) // Cache the end of the memory to calculate the length later. let end := ptr // We write the string from the rightmost digit to the leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // Costs a bit more than early returning for the zero case, // but cheaper in terms of deployment and overall runtime costs. for { // Initialize and perform the first pass without check. let temp := value // Move the pointer 1 byte leftwards to point to an empty character slot. ptr := sub(ptr, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(ptr, add(48, mod(temp, 10))) temp := div(temp, 10) } temp { // Keep dividing `temp` until zero. temp := div(temp, 10) } { // Body of the for loop. ptr := sub(ptr, 1) mstore8(ptr, add(48, mod(temp, 10))) } let length := sub(end, ptr) // Move the pointer 32 bytes leftwards to make room for the length. ptr := sub(ptr, 32) // Store the length. mstore(ptr, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.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(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @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; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the 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; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries( address registrant, address registrantToCopy ) external; function updateOperator( address registrant, address operator, bool filtered ) external; function updateOperators( address registrant, address[] calldata operators, bool filtered ) external; function updateCodeHash( address registrant, bytes32 codehash, bool filtered ) external; function updateCodeHashes( address registrant, bytes32[] calldata codeHashes, bool filtered ) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/interfaces/IERC2981.sol'; import '@openzeppelin/contracts/interfaces/IERC20.sol'; import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './opensea-operator-filter/OperatorFilterer.sol'; import './Ownable_1_0_0.sol'; contract HyperMintERC1155_2_2_0 is ERC1155Burnable, Ownable, OperatorFilterer { using SafeERC20 for IERC20; /* ================= CUSTOM ERRORS ================= */ error NewSupplyTooLow(); error ArrayLengthMismatch(); error MaxSupplyExceeded(); error SignatureExpired(); error NotAuthorised(); error BuyDisabled(); error InsufficientPaymentValue(); error PublicSaleClosed(); error SaleClosed(); error MaxPerTransactionsExceeded(); error ContractCallBlocked(); error ImmutableRecoveryAddress(); error TransfersDisabled(); /* ================= STATE VARIABLES ================= */ // ============== Structs ============== struct GeneralConfig { string name; string symbol; string contractMetadataUrl; string tokenMetadataUrl; bool allowBuy; bool allowPublicTransfer; bool enableOpenSeaOperatorFilterRegistry; uint256 publicSaleDate; uint256 saleCloseDate; uint256 primaryRoyaltyFee; uint256 secondaryRoyaltyFee; } struct Addresses { address recoveryAddress; address collectionOwnerAddress; address authorisationAddress; address purchaseTokenAddress; address managerPrimaryRoyaltyAddress; address customerPrimaryRoyaltyAddress; address secondaryRoyaltyAddress; } struct TokenConfig { uint256 price; uint256 maxSupply; uint256 maxPerTransaction; } // ========= Immutable Storage ========= uint256 internal constant BASIS_POINTS = 10000; // ========== Mutable Storage ========== string public constant version = '2.2.0'; GeneralConfig public generalConfig; TokenConfig[] public tokenConfigs; Addresses public addresses; uint256[] public supplies; /* =================== CONSTRUCTOR =================== */ /// @param _generalConfig settings for the contract /// @param _addresses a collection of addresses constructor( GeneralConfig memory _generalConfig, Addresses memory _addresses ) ERC1155('') OperatorFilterer( address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6), // default filter by OS true // subscribe to the filter list ) { _transferOwnership(_addresses.collectionOwnerAddress); generalConfig = _generalConfig; addresses = _addresses; _setURI(generalConfig.tokenMetadataUrl); } /* ====================== Views ====================== */ function name() public view returns (string memory collectionName) { collectionName = generalConfig.name; } function symbol() public view returns (string memory collectionSymbol) { collectionSymbol = generalConfig.symbol; } function contractURI() public view virtual returns (string memory uri) { uri = generalConfig.contractMetadataUrl; } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address royaltyAddress, uint256 royaltyAmount) { /// @dev secondary royalty to be paid out by the marketplace /// to the splitter contract royaltyAddress = addresses.secondaryRoyaltyAddress; royaltyAmount = (_salePrice * generalConfig.secondaryRoyaltyFee) / BASIS_POINTS; } function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC1155) returns (bool result) { result = (_interfaceId == type(IERC2981).interfaceId || super.supportsInterface(_interfaceId)); } /* ================ MUTATIVE FUNCTIONS ================ */ // ============ Restricted ============= function setNameAndSymbol( string calldata _newName, string calldata _newSymbol ) external onlyContractManager { generalConfig.name = _newName; generalConfig.symbol = _newSymbol; } function setMetadataURIs( string calldata _contractURI, string calldata _tokenURI ) external onlyContractManager { generalConfig.contractMetadataUrl = _contractURI; generalConfig.tokenMetadataUrl = _tokenURI; _setURI(_tokenURI); } function setDates(uint256 _publicSale, uint256 _saleClosed) external onlyContractManager { generalConfig.publicSaleDate = _publicSale; generalConfig.saleCloseDate = _saleClosed; } function setTokenConfig( uint256 _id, uint256 _price, uint256 _maxSupply, uint256 _maxPerTransaction ) external onlyContractManager { if (supplies[_id] > _maxSupply) revert NewSupplyTooLow(); tokenConfigs[_id].price = _price; tokenConfigs[_id].maxSupply = _maxSupply; tokenConfigs[_id].maxPerTransaction = _maxPerTransaction; } function setAddresses(Addresses calldata _addresses) external onlyContractManager { if (_addresses.recoveryAddress != addresses.recoveryAddress) revert ImmutableRecoveryAddress(); if ( addresses.collectionOwnerAddress != _addresses.collectionOwnerAddress ) { _transferOwnership(_addresses.collectionOwnerAddress); } addresses = _addresses; } function setAllowBuy(bool _allowBuy) external onlyContractManager { generalConfig.allowBuy = _allowBuy; } function setAllowPublicTransfer(bool _allowPublicTransfer) external onlyContractManager { generalConfig.allowPublicTransfer = _allowPublicTransfer; } function setEnableOpenSeaOperatorFilterRegistry(bool _enable) external onlyContractManager { generalConfig.enableOpenSeaOperatorFilterRegistry = _enable; } function setRoyalty(uint256 _primaryFee, uint256 _secondaryFee) external onlyContractManager { generalConfig.primaryRoyaltyFee = _primaryFee; generalConfig.secondaryRoyaltyFee = _secondaryFee; } function addTokens(TokenConfig[] calldata _tokens) external onlyContractManager { for (uint256 i = 0; i < _tokens.length; ) { supplies.push(0); tokenConfigs.push(_tokens[i]); unchecked { ++i; } } } // ============== Minting ============== function mintBatch( address[] calldata _to, uint256[][] calldata _ids, uint256[][] calldata _amounts ) external onlyContractManager nonContract { uint256 toLength = _to.length; for (uint256 i = 0; i < toLength; ) { uint256 idsLength = _ids[i].length; for (uint256 j = 0; j < idsLength; ) { uint256 _supply = supplies[_ids[i][j]]; if ( _supply + _amounts[i][j] > tokenConfigs[_ids[i][j]].maxSupply ) revert MaxSupplyExceeded(); /// @dev remove overflow protection enabled by default /// as supplies is already capped by totalSupplies unchecked { _supply += _amounts[i][j]; } /// @dev write back to storage supplies[_ids[i][j]] = _supply; unchecked { ++j; } } _mintBatch(_to[i], _ids[i], _amounts[i], '0x'); unchecked { ++i; } } } // ================ Buy ================ function buyAuthorised( uint256 _id, uint256 _amount, uint256 _totalPrice, uint256 _maxPerAddress, uint256 _expires, bytes calldata _signature ) external payable buyAllowed nonContract { if (block.timestamp >= _expires) revert SignatureExpired(); bytes32 hash = keccak256( abi.encodePacked( address(this), msg.sender, _amount, _totalPrice, _maxPerAddress, _expires, _id ) ); bytes32 message = ECDSA.toEthSignedMessageHash(hash); if ( ECDSA.recover(message, _signature) != addresses.authorisationAddress ) revert NotAuthorised(); _buy(_id, _amount, _totalPrice); } function buy(uint256 _id, uint256 _amount) external payable buyAllowed nonContract { if ( generalConfig.publicSaleDate == 0 || block.timestamp < generalConfig.publicSaleDate ) revert PublicSaleClosed(); uint256 totalPrice = tokenConfigs[_id].price * _amount; _buy(_id, _amount, totalPrice); } function _buy( uint256 _id, uint256 _amount, uint256 _totalPrice ) internal { if (generalConfig.saleCloseDate != 0) { if (block.timestamp >= generalConfig.saleCloseDate) revert SaleClosed(); } uint256 _supply = supplies[_id]; uint256 _maxSupply = tokenConfigs[_id].maxSupply; if (_supply + _amount > _maxSupply) revert MaxSupplyExceeded(); uint256 _maxPerTransaction = tokenConfigs[_id].maxPerTransaction; if (_maxPerTransaction != 0) { if (_amount > _maxPerTransaction) revert MaxPerTransactionsExceeded(); } uint256 royaltyAmount = (_totalPrice * generalConfig.primaryRoyaltyFee) / BASIS_POINTS; if (addresses.purchaseTokenAddress != address(0)) { IERC20 token = IERC20(addresses.purchaseTokenAddress); /// @dev primary royalty cut for Hypermint token.safeTransferFrom( msg.sender, addresses.managerPrimaryRoyaltyAddress, royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) token.safeTransferFrom( msg.sender, addresses.customerPrimaryRoyaltyAddress, _totalPrice - royaltyAmount ); } else { if (msg.value < _totalPrice) revert InsufficientPaymentValue(); /// @dev primary royalty cut for Hypermint payable(addresses.managerPrimaryRoyaltyAddress).transfer( royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) payable(addresses.customerPrimaryRoyaltyAddress).transfer( _totalPrice - royaltyAmount ); } /// @dev remove overflow protection enabled by default /// as supply is already capped by totalSupply unchecked { _supply += _amount; } /// @dev write back to storage supplies[_id] = _supply; _mint(msg.sender, _id, _amount, '0x'); } // ================ Transfers ================ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal override(ERC1155) transferAllowed(from, to) onlyAllowedOperator(from, generalConfig.enableOpenSeaOperatorFilterRegistry) { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); } function transferAuthorised( address _from, address _to, uint256 _tokenId, uint256 _amount, uint256 _expires, bytes calldata _signature ) external nonContract { if (block.timestamp >= _expires) revert SignatureExpired(); bytes32 hash = keccak256( abi.encodePacked( address(this), msg.sender, _from, _to, _tokenId, _amount, _expires ) ); bytes32 message = ECDSA.toEthSignedMessageHash(hash); if ( ECDSA.recover(message, _signature) != addresses.authorisationAddress ) revert NotAuthorised(); super.safeTransferFrom(_from, _to, _tokenId, _amount, '0x'); } // ============= Ownership============= function recoverContract() external { if (msg.sender != addresses.recoveryAddress) revert NotAuthorised(); _transferContractManager(addresses.recoveryAddress); } /* ==================== MODIFIERS ===================== */ modifier buyAllowed() { if (!generalConfig.allowBuy) revert BuyDisabled(); _; } /// @dev this eliminates the possibility of being called /// from a contract modifier nonContract() { if (tx.origin != msg.sender) revert ContractCallBlocked(); _; } modifier transferAllowed(address from, address to) { bool isMinting = from == address(0); bool isBurning = to == address(0); bool isContractManager = from == this.contractManager(); bool isTransferAuthorised = msg.sig == this.transferAuthorised.selector; if ( !isMinting && !isContractManager && !isBurning && !isTransferAuthorised ) { if (!generalConfig.allowPublicTransfer) revert TransfersDisabled(); } _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import '@openzeppelin/contracts/interfaces/IERC2981.sol'; import '@openzeppelin/contracts/interfaces/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './Ownable_1_0_0.sol'; import 'erc721a/contracts/extensions/ERC721ABurnable.sol'; contract HyperMintERC721A_2_0_0 is ERC721ABurnable, Ownable { using SafeERC20 for IERC20; /* ================= CUSTOM ERRORS ================= */ error NewSupplyTooLow(); error MaxSupplyExceeded(); error SignatureExpired(); error NotAuthorised(); error BuyDisabled(); error InsufficientPaymentValue(); error PublicSaleClosed(); error SaleClosed(); error MaxPerAddressExceeded(); error MaxPerTransactionExceeded(); error NonExistentToken(); error ContractCallBlocked(); error ImmutableRecoveryAddress(); /* ================= STATE VARIABLES ================= */ // ============== Structs ============== struct Addresses { address recoveryAddress; address collectionOwnerAddress; address authorisationAddress; address purchaseTokenAddress; address managerPrimaryRoyaltyAddress; address customerPrimaryRoyaltyAddress; address secondaryRoyaltyAddress; } struct TokenInfo { uint256 price; uint256 supply; uint256 maxSupply; uint256 maxPerTransaction; } // ========= Immutable Storage ========= uint256 internal constant BASIS_POINTS = 10000; // ========== Mutable Storage ========== string public constant version = '2.0.0'; /// @dev token info string _name; string _symbol; uint256 public price; uint256 public maxSupply; /// @dev only apply to public sale uint256 public maxPerTransaction; /// @dev metadata info string public contractURI; string public tokenMetadataURI; /// @dev toggle for api mints bool public allowBuy; /// @dev sale dates uint256 public publicSaleDate; uint256 public saleCloseDate; /// @dev royalty fees uint256 public primaryRoyaltyFee; uint256 public secondaryRoyaltyFee; Addresses public addresses; /* =================== CONSTRUCTOR =================== */ /// @notice Creates a new NFT contract /// @param __name token name /// @param __symbol token symbol /// @param _price token price /// @param _maxSupply token max supply /// @param _allowBuy toggle to enable/disable buying /// @param _maxPerTransaction max amount an address can buy /// @param _addresses a collection of addresses constructor( string memory __name, string memory __symbol, uint256 _price, uint256 _maxSupply, string memory _contractMetadataURI, string memory _tokenMetadataURI, bool _allowBuy, uint256 _maxPerTransaction, Addresses memory _addresses ) ERC721A('', '') { _transferOwnership(_addresses.collectionOwnerAddress); _name = __name; _symbol = __symbol; price = _price; maxSupply = _maxSupply; allowBuy = _allowBuy; tokenMetadataURI = _tokenMetadataURI; contractURI = _contractMetadataURI; maxPerTransaction = _maxPerTransaction; addresses = _addresses; } /* ====================== Views ====================== */ function name() public view override returns (string memory tokenName) { tokenName = _name; } function totalMinted(address addr) public view returns (uint256 numMinted) { numMinted = _numberMinted(addr); } function symbol() public view override returns (string memory tokenSymbol) { tokenSymbol = _symbol; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory uri) { if (!_exists(_tokenId)) revert NonExistentToken(); uri = string(abi.encodePacked(tokenMetadataURI, _toString(_tokenId))); } function getTokenInfo() external view returns (TokenInfo memory tokenInfo) { tokenInfo = TokenInfo( price, totalSupply(), maxSupply, maxPerTransaction ); } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address royaltyAddress, uint256 royaltyAmount) { /// @dev secondary royalty to be paid out by the marketplace /// to the splitter contract royaltyAddress = addresses.secondaryRoyaltyAddress; royaltyAmount = (_salePrice * secondaryRoyaltyFee) / BASIS_POINTS; } function supportsInterface(bytes4 _interfaceId) public view virtual override(ERC721A) returns (bool result) { result = (_interfaceId == type(IERC2981).interfaceId || super.supportsInterface(_interfaceId)); } /* ================ MUTATIVE FUNCTIONS ================ */ // ============ Restricted ============= function setNameAndSymbol( string calldata _newName, string calldata _newSymbol ) external onlyContractManager { _name = _newName; _symbol = _newSymbol; } function setMetadataURIs( string calldata _contractURI, string calldata _tokenURI ) external onlyContractManager { contractURI = _contractURI; tokenMetadataURI = _tokenURI; } function setDates(uint256 _publicSale, uint256 _saleClosed) external onlyContractManager { publicSaleDate = _publicSale; saleCloseDate = _saleClosed; } function setTokenData( uint256 _price, uint256 _maxSupply, uint256 _maxPerTransaction ) external onlyContractManager { if (totalSupply() > _maxSupply) revert NewSupplyTooLow(); price = _price; maxSupply = _maxSupply; maxPerTransaction = _maxPerTransaction; } function setAddresses(Addresses calldata _addresses) external onlyContractManager { if (_addresses.recoveryAddress != addresses.recoveryAddress) revert ImmutableRecoveryAddress(); if ( addresses.collectionOwnerAddress != _addresses.collectionOwnerAddress ) { _transferOwnership(_addresses.collectionOwnerAddress); } addresses = _addresses; } function setAllowBuy(bool _allowBuy) external onlyContractManager { allowBuy = _allowBuy; } function setRoyalty(uint256 _primaryFee, uint256 _secondaryFee) external onlyContractManager { primaryRoyaltyFee = _primaryFee; secondaryRoyaltyFee = _secondaryFee; } // ============== Minting ============== function mintBatch( address[] calldata _accounts, uint256[] calldata _amounts ) external onlyContractManager nonContract { uint256 length = _accounts.length; for (uint256 i = 0; i < length; ) { address account = _accounts[i]; uint256 amount = _amounts[i]; if (_totalMinted() + amount > maxSupply) revert MaxSupplyExceeded(); _mint(account, amount); unchecked { i += 1; } } } // ================ Buy ================ function buyAuthorised( uint256 _amount, uint256 _totalPrice, uint256 _maxPerAddress, uint256 _expires, bytes calldata _signature ) external payable buyAllowed nonContract { if (block.timestamp >= _expires) revert SignatureExpired(); bytes32 hash = keccak256( abi.encodePacked( address(this), msg.sender, _amount, _totalPrice, _maxPerAddress, _expires ) ); bytes32 message = ECDSA.toEthSignedMessageHash(hash); if ( ECDSA.recover(message, _signature) != addresses.authorisationAddress ) revert NotAuthorised(); if (_maxPerAddress != 0) { if (_numberMinted(msg.sender) + _amount > _maxPerAddress) revert MaxPerAddressExceeded(); } _buy(_amount, _totalPrice); } function buy(uint256 _amount) external payable buyAllowed nonContract { if (publicSaleDate == 0 || block.timestamp < publicSaleDate) revert PublicSaleClosed(); uint256 totalPrice = price * _amount; _buy(_amount, totalPrice); } function _buy(uint256 _amount, uint256 _totalPrice) internal { if (saleCloseDate != 0) { if (block.timestamp >= saleCloseDate) revert SaleClosed(); } if (_totalMinted() + _amount > maxSupply) revert MaxSupplyExceeded(); if (maxPerTransaction != 0) { if (_amount > maxPerTransaction) revert MaxPerTransactionExceeded(); } uint256 royaltyAmount = (_totalPrice * primaryRoyaltyFee) / BASIS_POINTS; if (addresses.purchaseTokenAddress != address(0)) { IERC20 token = IERC20(addresses.purchaseTokenAddress); /// @dev primary royalty cut for HyperMint token.safeTransferFrom( msg.sender, addresses.managerPrimaryRoyaltyAddress, royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) token.safeTransferFrom( msg.sender, addresses.customerPrimaryRoyaltyAddress, _totalPrice - royaltyAmount ); } else { if (msg.value < _totalPrice) revert InsufficientPaymentValue(); /// @dev primary royalty cut for HyperMint payable(addresses.managerPrimaryRoyaltyAddress).transfer( royaltyAmount ); /// @dev primary sale (i.e. minting revenue) for customer (or its payees) payable(addresses.customerPrimaryRoyaltyAddress).transfer( _totalPrice - royaltyAmount ); } /// @dev mint tokens _mint(msg.sender, _amount); } // ============= Ownership ============= function recoverContract() external { if (msg.sender != addresses.recoveryAddress) revert NotAuthorised(); _transferContractManager(addresses.recoveryAddress); } function _startTokenId() internal pure override returns (uint256 tokenId) { tokenId = 1; } /* ==================== MODIFIERS ===================== */ modifier buyAllowed() { if (!allowBuy) revert BuyDisabled(); _; } /// @dev this eliminates the possibility of being called /// from a contract modifier nonContract() { if (tx.origin != msg.sender) revert ContractCallBlocked(); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (finance/PaymentSplitter.sol) pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Context.sol'; /** * @title PaymentSplitter * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware * that the Ether will be split in this way, since it is handled transparently by the contract. * * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the * time of contract deployment and can't be updated thereafter. * * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release} * function. * * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you * to run tests before sending real value to this contract. */ contract PaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event ERC20PaymentReleased( IERC20 indexed token, address to, uint256 amount ); event PaymentReceived(address from, uint256 amount); uint256 internal _totalShares; uint256 internal _totalReleased; mapping(address => uint256) internal _shares; mapping(address => uint256) internal _released; address[] internal _payees; mapping(IERC20 => uint256) private _erc20TotalReleased; mapping(IERC20 => mapping(address => uint256)) private _erc20Released; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require( payees.length == shares_.length, 'PaymentSplitter: payees and shares length mismatch' ); require(payees.length > 0, 'PaymentSplitter: no payees'); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20 * contract. */ function totalReleased(IERC20 token) public view returns (uint256) { return _erc20TotalReleased[token]; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } function releasedAll() public view returns (address[] memory, uint256[] memory) { address[] memory addresses = new address[](_payees.length); uint256[] memory releasedAmounts = new uint256[](_payees.length); for (uint256 i = 0; i < _payees.length; i++) { addresses[i] = _payees[i]; releasedAmounts[i] = _released[_payees[i]]; } return (addresses, releasedAmounts); } /** * @dev Getter for the amount of payee's releasable Ether. */ function releasable(address account) public view returns (uint256) { uint256 totalReceived = address(this).balance + totalReleased(); return _pendingPayment(account, totalReceived, released(account)); } /** * @dev Getter for the amounts of all payees' releasable Ether. */ function releasableAll() public view returns (address[] memory, uint256[] memory) { address[] memory addresses = new address[](_payees.length); uint256[] memory releasableAmounts = new uint256[](_payees.length); for (uint256 i = 0; i < _payees.length; i++) { addresses[i] = _payees[i]; releasableAmounts[i] = releasable(_payees[i]); } return (addresses, releasableAmounts); } /** * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an * IERC20 contract. */ function released(IERC20 token, address account) public view returns (uint256) { return _erc20Released[token][account]; } /// @dev added here because _erc20Released is private function releasedAll(IERC20 token) public view returns (address[] memory, uint256[] memory) { address[] memory addresses = new address[](_payees.length); uint256[] memory releasedAmounts = new uint256[](_payees.length); for (uint256 i = 0; i < _payees.length; i++) { addresses[i] = _payees[i]; releasedAmounts[i] = _erc20Released[token][_payees[i]]; } return (addresses, releasedAmounts); } /** * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an * IERC20 contract. */ function releasable(IERC20 token, address account) public view returns (uint256) { uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token); return _pendingPayment(account, totalReceived, released(token, account)); } /** * @dev Getter for the amounts of all payees' releasable `token` tokens. `token` should be the address of an * IERC20 contract. */ function releasableAll(IERC20 token) public view returns (address[] memory, uint256[] memory) { address[] memory addresses = new address[](_payees.length); uint256[] memory releasableAmounts = new uint256[](_payees.length); for (uint256 i = 0; i < _payees.length; i++) { addresses[i] = _payees[i]; releasableAmounts[i] = releasable(token, _payees[i]); } return (addresses, releasableAmounts); } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 payment = releasable(account); require(payment != 0, 'PaymentSplitter: account is not due payment'); // _totalReleased is the sum of all values in _released. // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow. _totalReleased += payment; unchecked { _released[account] += payment; } Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20 * contract. */ function release(IERC20 token, address account) public virtual { require(_shares[account] > 0, 'PaymentSplitter: account has no shares'); uint256 payment = releasable(token, account); require(payment != 0, 'PaymentSplitter: account is not due payment'); // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token]. // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment" // cannot overflow. _erc20TotalReleased[token] += payment; unchecked { _erc20Released[token][account] += payment; } SafeERC20.safeTransfer(token, account, payment); emit ERC20PaymentReleased(token, account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) internal { require( account != address(0), 'PaymentSplitter: account is the zero address' ); require(shares_ > 0, 'PaymentSplitter: shares are 0'); require( _shares[account] == 0, 'PaymentSplitter: account already has shares' ); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import './PaymentSplitter.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; contract Splitter is Ownable, PaymentSplitter { constructor(address[] memory _payees, uint256[] memory _shares) PaymentSplitter(_payees, _shares) {} function totalPayees() public view returns (uint256) { return _payees.length; } function isPayee(address account) public view returns (bool) { return _shares[account] > 0; } function addPayee(address account, uint256 shares_) public onlyOwner { _addPayee(account, shares_); } function addPayees(address[] memory payees, uint256[] memory shares_) public onlyOwner { for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /********************** ETH **********************/ function releaseAll() public onlyOwner { for (uint256 i = 0; i < _payees.length; i++) { release(payable(_payees[i])); } } /********************* ERC20 *********************/ function releaseAll(IERC20 token) public onlyOwner { for (uint256 i = 0; i < _payees.length; i++) { release(token, _payees[i]); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs" }, "optimizer": { "enabled": true, "runs": 1000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"contractMetadataUrl","type":"string"},{"internalType":"string","name":"tokenMetadataUrl","type":"string"},{"internalType":"bool","name":"allowBuy","type":"bool"},{"internalType":"bool","name":"allowPublicTransfer","type":"bool"},{"internalType":"bool","name":"enableOpenSeaOperatorFilterRegistry","type":"bool"},{"internalType":"uint256","name":"publicSaleDate","type":"uint256"},{"internalType":"uint256","name":"saleCloseDate","type":"uint256"},{"internalType":"uint256","name":"primaryRoyaltyFee","type":"uint256"},{"internalType":"uint256","name":"secondaryRoyaltyFee","type":"uint256"}],"internalType":"struct HyperMintERC721A_2_2_0.GeneralConfig","name":"_generalConfig","type":"tuple"},{"components":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"maxPerTransaction","type":"uint256"}],"internalType":"struct HyperMintERC721A_2_2_0.TokenConfig","name":"_tokenConfig","type":"tuple"},{"components":[{"internalType":"address","name":"recoveryAddress","type":"address"},{"internalType":"address","name":"collectionOwnerAddress","type":"address"},{"internalType":"address","name":"authorisationAddress","type":"address"},{"internalType":"address","name":"purchaseTokenAddress","type":"address"},{"internalType":"address","name":"managerPrimaryRoyaltyAddress","type":"address"},{"internalType":"address","name":"customerPrimaryRoyaltyAddress","type":"address"},{"internalType":"address","name":"secondaryRoyaltyAddress","type":"address"}],"internalType":"struct HyperMintERC721A_2_2_0.Addresses","name":"_addresses","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BuyDisabled","type":"error"},{"inputs":[],"name":"ContractCallBlocked","type":"error"},{"inputs":[],"name":"ImmutableRecoveryAddress","type":"error"},{"inputs":[],"name":"InsufficientPaymentValue","type":"error"},{"inputs":[],"name":"MaxPerAddressExceeded","type":"error"},{"inputs":[],"name":"MaxPerTransactionExceeded","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewSupplyTooLow","type":"error"},{"inputs":[],"name":"NonExistentToken","type":"error"},{"inputs":[],"name":"NotAuthorised","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PublicSaleClosed","type":"error"},{"inputs":[],"name":"SaleClosed","type":"error"},{"inputs":[],"name":"SignatureExpired","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"TransfersDisabled","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousContractManager","type":"address"},{"indexed":true,"internalType":"address","name":"newContractManager","type":"address"}],"name":"ContractManagerTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"addresses","outputs":[{"internalType":"address","name":"recoveryAddress","type":"address"},{"internalType":"address","name":"collectionOwnerAddress","type":"address"},{"internalType":"address","name":"authorisationAddress","type":"address"},{"internalType":"address","name":"purchaseTokenAddress","type":"address"},{"internalType":"address","name":"managerPrimaryRoyaltyAddress","type":"address"},{"internalType":"address","name":"customerPrimaryRoyaltyAddress","type":"address"},{"internalType":"address","name":"secondaryRoyaltyAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_totalPrice","type":"uint256"},{"internalType":"uint256","name":"_maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"_expires","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"buyAuthorised","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"generalConfig","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"contractMetadataUrl","type":"string"},{"internalType":"string","name":"tokenMetadataUrl","type":"string"},{"internalType":"bool","name":"allowBuy","type":"bool"},{"internalType":"bool","name":"allowPublicTransfer","type":"bool"},{"internalType":"bool","name":"enableOpenSeaOperatorFilterRegistry","type":"bool"},{"internalType":"uint256","name":"publicSaleDate","type":"uint256"},{"internalType":"uint256","name":"saleCloseDate","type":"uint256"},{"internalType":"uint256","name":"primaryRoyaltyFee","type":"uint256"},{"internalType":"uint256","name":"secondaryRoyaltyFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"collectionName","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoverContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"royaltyAddress","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"recoveryAddress","type":"address"},{"internalType":"address","name":"collectionOwnerAddress","type":"address"},{"internalType":"address","name":"authorisationAddress","type":"address"},{"internalType":"address","name":"purchaseTokenAddress","type":"address"},{"internalType":"address","name":"managerPrimaryRoyaltyAddress","type":"address"},{"internalType":"address","name":"customerPrimaryRoyaltyAddress","type":"address"},{"internalType":"address","name":"secondaryRoyaltyAddress","type":"address"}],"internalType":"struct HyperMintERC721A_2_2_0.Addresses","name":"_addresses","type":"tuple"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_allowBuy","type":"bool"}],"name":"setAllowBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_allowPublicTransfer","type":"bool"}],"name":"setAllowPublicTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicSale","type":"uint256"},{"internalType":"uint256","name":"_saleClosed","type":"uint256"}],"name":"setDates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enable","type":"bool"}],"name":"setEnableOpenSeaOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setMetadataURIs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newName","type":"string"},{"internalType":"string","name":"_newSymbol","type":"string"}],"name":"setNameAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_primaryFee","type":"uint256"},{"internalType":"uint256","name":"_secondaryFee","type":"uint256"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_maxPerTransaction","type":"uint256"}],"name":"setTokenConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supply","outputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"collectionSymbol","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenConfig","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"maxPerTransaction","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"numMinted","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_expires","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"transferAuthorised","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newContractManager","type":"address"}],"name":"transferContractManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162004376380380620043768339810160408190526200003491620006c5565b604080516020808201808452600080845284519283019094529281528151733cc6cdda760b79bafa08df41ecfa224f810dceb69360019392916200007b916002916200043f565b508051620000919060039060208401906200043f565b5050600160005550620000a4336200039b565b6daaeb6d7670e522a718067333cd4e3b15620001e95780156200013757604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200011857600080fd5b505af11580156200012d573d6000803e3d6000fd5b50505050620001e9565b6001600160a01b03821615620001885760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620000fd565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001cf57600080fd5b505af1158015620001e4573d6000803e3d6000fd5b505050505b50506020810151620001fb90620003ed565b825180518491600a91620002179183916020909101906200043f565b5060208281015180516200023292600185019201906200043f565b5060408201518051620002509160028401916020909101906200043f565b50606082015180516200026e9160038401916020909101906200043f565b5060808281015160048301805460a08087015160c08089015161ffff1990941695151561ff0019169590951761010091151582021762ff0000191662010000931515939093029290921790925560e08601516005860155850151600685015561012085015160078501556101409094015160089093019290925584516013556020808601516014556040958601516015558451601680546001600160a01b03199081166001600160a01b03938416179091559186015160178054841691831691909117905595850151601880548316918816919091179055606085015160198054831691881691909117905590840151601a8054831691871691909117905591830151601b805484169186169190911790559190910151601c8054909216921691909117905550620008e7565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5fb4f5c581870540f90f9705018e944972197c5be2aa889f6bb847b6cd2236e190600090a35050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200044d9062000894565b90600052602060002090601f016020900481019282620004715760008555620004bc565b82601f106200048c57805160ff1916838001178555620004bc565b82800160010185558215620004bc579182015b82811115620004bc5782518255916020019190600101906200049f565b50620004ca929150620004ce565b5090565b5b80821115620004ca5760008155600101620004cf565b80516001600160a01b0381168114620004fd57600080fd5b919050565b80518015158114620004fd57600080fd5b600082601f83011262000524578081fd5b81516001600160401b03811115620005405762000540620008d1565b602062000556601f8301601f1916820162000861565b82815285828487010111156200056a578384fd5b835b83811015620005895785810183015182820184015282016200056c565b838111156200059a57848385840101525b5095945050505050565b600060e08284031215620005b6578081fd5b60405160e081016001600160401b0381118282101715620005db57620005db620008d1565b604052905080620005ec83620004e5565b8152620005fc60208401620004e5565b60208201526200060f60408401620004e5565b60408201526200062260608401620004e5565b60608201526200063560808401620004e5565b60808201526200064860a08401620004e5565b60a08201526200065b60c08401620004e5565b60c08201525092915050565b60006060828403121562000679578081fd5b604051606081016001600160401b03811182821017156200069e576200069e620008d1565b80604052508091508251815260208301516020820152604083015160408201525092915050565b6000806000610160808587031215620006dc578384fd5b84516001600160401b0380821115620006f3578586fd5b818701915082828903121562000707578586fd5b6200071162000835565b925081518181111562000722578687fd5b620007308982850162000513565b84525060208201518181111562000745578687fd5b620007538982850162000513565b6020850152506040820151818111156200076b578687fd5b620007798982850162000513565b60408501525060608201518181111562000791578687fd5b6200079f8982850162000513565b60608501525050620007b46080820162000502565b6080830152620007c760a0820162000502565b60a0830152620007da60c0820162000502565b60c083015260e0818101519083015261010080820151908301526101208082015190830152610140908101519082015292506200081b856020860162000667565b91506200082c8560808601620005a4565b90509250925092565b60405161016081016001600160401b03811182821017156200085b576200085b620008d1565b60405290565b604051601f8201601f191681016001600160401b03811182821017156200088c576200088c620008d1565b604052919050565b600181811c90821680620008a957607f821691505b60208210811415620008cb57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b613a7f80620008f76000396000f3fe6080604052600436106102d05760003560e01c806382875f7911610179578063b39e12cf116100d6578063d96a094a1161008a578063e8a3d48511610064578063e8a3d48514610887578063e985e9c51461089c578063f2fde38b146108e557600080fd5b8063d96a094a146107c6578063da0321cd146107d9578063dedf141e1461086757600080fd5b8063ba9341c0116100bb578063ba9341c01461074c578063c87b56dd14610786578063d6046836146107a657600080fd5b8063b39e12cf1461070e578063b88d4fde1461072c57600080fd5b806395d89b411161012d578063ae0aa35b11610112578063ae0aa35b146106ae578063aeb2de35146106ce578063b375d492146106ee57600080fd5b806395d89b4114610679578063a22cb4651461068e57600080fd5b80638da5cb5b1161015e5780638da5cb5b1461060f578063927a97a11461062d578063933a6f0d1461065957600080fd5b806382875f79146105e75780638bc3bdec146105fc57600080fd5b80632843e3441161023257806358939061116101e657806370a08231116101c057806370a0823114610592578063715018a6146105b25780637c88e3d9146105c757600080fd5b806358939061146105325780635a446215146105525780636352211e1461057257600080fd5b806342842e0e1161021757806342842e0e146104a957806342966c68146104c957806354fd4d50146104e957600080fd5b80632843e3441461044a5780632a55205a1461046a57600080fd5b8063095ea7b31161028957806318160ddd1161026e57806318160ddd146103ed57806323b872dd1461040a5780632541b0911461042a57600080fd5b8063095ea7b3146103ab578063166d44ea146103cd57600080fd5b8063047fc9aa116102ba578063047fc9aa1461033857806306fdde0314610351578063081812fc1461037357600080fd5b80623d4790146102d557806301ffc9a714610308575b600080fd5b3480156102e157600080fd5b506102f56102f0366004613188565b610905565b6040519081526020015b60405180910390f35b34801561031457600080fd5b50610328610323366004613484565b610932565b60405190151581526020016102ff565b34801561034457600080fd5b50600054600019016102f5565b34801561035d57600080fd5b50610366610970565b6040516102ff9190613724565b34801561037f57600080fd5b5061039361038e366004613530565b610a05565b6040516001600160a01b0390911681526020016102ff565b3480156103b757600080fd5b506103cb6103c63660046133b8565b610a62565b005b3480156103d957600080fd5b506103cb6103e836600461344c565b610b1b565b3480156103f957600080fd5b5060015460005403600019016102f5565b34801561041657600080fd5b506103cb6104253660046131f8565b610b9f565b34801561043657600080fd5b506103cb610445366004613311565b610d7b565b34801561045657600080fd5b506103cb610465366004613569565b610ef9565b34801561047657600080fd5b5061048a610485366004613548565b610fb2565b604080516001600160a01b0390931683526020830191909152016102ff565b3480156104b557600080fd5b506103cb6104c43660046131f8565b610fe8565b3480156104d557600080fd5b506103cb6104e4366004613530565b611008565b3480156104f557600080fd5b506103666040518060400160405280600581526020017f322e322e3000000000000000000000000000000000000000000000000000000081525081565b34801561053e57600080fd5b506103cb61054d36600461344c565b611016565b34801561055e57600080fd5b506103cb61056d3660046134bc565b611097565b34801561057e57600080fd5b5061039361058d366004613530565b61111c565b34801561059e57600080fd5b506102f56105ad366004613188565b611127565b3480156105be57600080fd5b506103cb61118f565b3480156105d357600080fd5b506103cb6105e23660046133e3565b6111f5565b3480156105f357600080fd5b506103cb61133b565b6103cb61060a366004613594565b61137b565b34801561061b57600080fd5b506008546001600160a01b0316610393565b34801561063957600080fd5b50610642611574565b6040516102ff9b9a99989796959493929190613737565b34801561066557600080fd5b506103cb610674366004613548565b6117e1565b34801561068557600080fd5b50610366611851565b34801561069a57600080fd5b506103cb6106a936600461338b565b611863565b3480156106ba57600080fd5b506103cb6106c9366004613188565b611912565b3480156106da57600080fd5b506103cb6106e93660046134bc565b6119fc565b3480156106fa57600080fd5b506103cb610709366004613519565b611a7a565b34801561071a57600080fd5b506009546001600160a01b0316610393565b34801561073857600080fd5b506103cb610747366004613238565b611b82565b34801561075857600080fd5b5060135460145460155461076b92919083565b604080519384526020840192909252908201526060016102ff565b34801561079257600080fd5b506103666107a1366004613530565b611bcc565b3480156107b257600080fd5b506103cb6107c136600461344c565b611c3f565b6103cb6107d4366004613530565b611cb7565b3480156107e557600080fd5b50601654601754601854601954601a54601b54601c5461081e966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016102ff565b34801561087357600080fd5b506103cb610882366004613548565b611d62565b34801561089357600080fd5b50610366611dd2565b3480156108a857600080fd5b506103286108b73660046131c0565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156108f157600080fd5b506103cb610900366004613188565b611de4565b6001600160a01b0381166000908152600560205260408082205467ffffffffffffffff911c165b92915050565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061092c575061092c82611ec3565b6060600a60000180546109829061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546109ae9061385e565b80156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b5050505050905090565b6000610a1082611f5c565b610a46576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a6d8261111c565b9050336001600160a01b03821614610abf57610a8981336108b7565b610abf576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6009546001600160a01b0316336001600160a01b031614610b855760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b60648201526084015b60405180910390fd5b600e80549115156101000261ff0019909216919091179055565b6000610baa82611f91565b9050836001600160a01b0316816001600160a01b031614610bf7576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054610c238187335b6001600160a01b039081169116811491141790565b610c4e57610c3186336108b7565b610c4e57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610c8e576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c9b868686600161201a565b8015610ca657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b8316610d315760018401600081815260046020526040902054610d2f576000548114610d2f5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b323314610d9b57604051633ebb273b60e21b815260040160405180910390fd5b824210610dbb57604051630819bdcd60e01b815260040160405180910390fd5b6040805130606090811b6bffffffffffffffffffffffff1990811660208085019190915233831b821660348501528a831b821660488501529189901b16605c8301526070820187905260908083018790528351808403909101815260b0830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060d084015260ec8084018290528451808503909101815261010c9093019093528151910120600090601854604080516020601f88018190048102820181019092528681529293506001600160a01b0390911691610ebd9184919088908890819084018382808284376000920191909152506122fe92505050565b6001600160a01b031614610ee457604051631648fd0160e01b815260040160405180910390fd5b610eef888888610fe8565b5050505050505050565b6009546001600160a01b0316336001600160a01b031614610f5e5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b60015460005483919003600019011115610fa4576040517f1d77a89900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601392909255601455601555565b601c546012546001600160a01b039091169060009061271090610fd590856137fc565b610fdf91906137dc565b90509250929050565b61100383838360405180602001604052806000815250611b82565b505050565b611013816001612322565b50565b6009546001600160a01b0316336001600160a01b03161461107b5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b600e8054911515620100000262ff000019909216919091179055565b6009546001600160a01b0316336001600160a01b0316146110fc5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b611108600a858561306c565b50611115600b838361306c565b5050505050565b600061092c82611f91565b60006001600160a01b038216611169576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6008546001600160a01b031633146111e95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b7c565b6111f3600061248c565b565b6009546001600160a01b0316336001600160a01b03161461125a5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b32331461127a57604051633ebb273b60e21b815260040160405180910390fd5b8260005b81811015610d735760008686838181106112a857634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112bd9190613188565b905060008585848181106112e157634e487b7160e01b600052603260045260246000fd5b905060200201359050601360010154816112fe6000546000190190565b61130891906137c4565b111561132757604051638a164f6360e01b815260040160405180910390fd5b61133182826124de565b505060010161127e565b6016546001600160a01b0316331461136657604051631648fd0160e01b815260040160405180910390fd5b6016546111f3906001600160a01b0316612615565b600e5460ff1661139e57604051639d7da54560e01b815260040160405180910390fd5b3233146113be57604051633ebb273b60e21b815260040160405180910390fd5b8242106113de57604051630819bdcd60e01b815260040160405180910390fd5b6040805130606090811b6bffffffffffffffffffffffff199081166020808501919091523390921b16603483015260488201899052606882018890526088820187905260a88083018790528351808403909101815260c8830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060e8840152610104808401829052845180850390910181526101249093019093528151910120600090601854604080516020601f88018190048102820181019092528681529293506001600160a01b03909116916114db9184919088908890819084018382808284376000920191909152506122fe92505050565b6001600160a01b03161461150257604051631648fd0160e01b815260040160405180910390fd5b851561156a573360009081526005602052604090819020548791611532918b911c67ffffffffffffffff166137c4565b111561156a576040517f550ffa9c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eef8888612667565b600a805481906115839061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546115af9061385e565b80156115fc5780601f106115d1576101008083540402835291602001916115fc565b820191906000526020600020905b8154815290600101906020018083116115df57829003601f168201915b5050505050908060010180546116119061385e565b80601f016020809104026020016040519081016040528092919081815260200182805461163d9061385e565b801561168a5780601f1061165f5761010080835404028352916020019161168a565b820191906000526020600020905b81548152906001019060200180831161166d57829003601f168201915b50505050509080600201805461169f9061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546116cb9061385e565b80156117185780601f106116ed57610100808354040283529160200191611718565b820191906000526020600020905b8154815290600101906020018083116116fb57829003601f168201915b50505050509080600301805461172d9061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546117599061385e565b80156117a65780601f1061177b576101008083540402835291602001916117a6565b820191906000526020600020905b81548152906001019060200180831161178957829003601f168201915b505050506004830154600584015460068501546007860154600890960154949560ff808516966101008604821696506201000090950416938b565b6009546001600160a01b0316336001600160a01b0316146118465760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b601191909155601255565b6060600a60010180546109829061385e565b6001600160a01b0382163314156118a6576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6009546001600160a01b0316336001600160a01b0316146119775760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b6001600160a01b0381166119f35760405162461bcd60e51b815260206004820152602f60248201527f4f776e61626c653a206e657720636f6e7472616374206f776e6572206973207460448201527f6865207a65726f206164647265737300000000000000000000000000000000006064820152608401610b7c565b61101381612615565b6009546001600160a01b0316336001600160a01b031614611a615760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b611a6d600c858561306c565b50611115600d838361306c565b6009546001600160a01b0316336001600160a01b031614611adf5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b6016546001600160a01b0316611af86020830183613188565b6001600160a01b031614611b38576040517f9598453c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b486040820160208301613188565b6017546001600160a01b03908116911614611b7557611b75611b706040830160208401613188565b61248c565b80601661100382826138bf565b611b8d848484610b9f565b6001600160a01b0383163b15611bc657611ba984848484612871565b611bc6576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060611bd782611f5c565b611c0d576040517f9430a17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d611c1883612968565b604051602001611c29929190613642565b6040516020818303038152906040529050919050565b6009546001600160a01b0316336001600160a01b031614611ca45760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b600e805460ff1916911515919091179055565b600e5460ff16611cda57604051639d7da54560e01b815260040160405180910390fd5b323314611cfa57604051633ebb273b60e21b815260040160405180910390fd5b600f541580611d0a5750600f5442105b15611d41576040517fdd4e010600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601354600090611d529083906137fc565b9050611d5e8282612667565b5050565b6009546001600160a01b0316336001600160a01b031614611dc75760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b600f91909155601055565b6060600a60020180546109829061385e565b6008546001600160a01b03163314611e3e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b7c565b6001600160a01b038116611eba5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b7c565b6110138161248c565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480611f2657507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061092c5750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b600081600111158015611f70575060005482105b801561092c575050600090815260046020526040902054600160e01b161590565b60008180600111611fe857600054811015611fe857600081815260046020526040902054600160e01b8116611fe6575b80611fdf575060001901600081815260046020526040902054611fc1565b9392505050565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080517fb39e12cf0000000000000000000000000000000000000000000000000000000081529051859185916001600160a01b0380851615929084161591600091309163b39e12cf91600480820192602092909190829003018186803b15801561208457600080fd5b505afa158015612098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bc91906131a4565b6001600160a01b0386811691161490506000356001600160e01b0319167f2541b091000000000000000000000000000000000000000000000000000000001483158015612107575081155b8015612111575082155b801561211b575080155b1561216157600e54610100900460ff16612161576040517f8574adcf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e548a9062010000900460ff1680612179576122f0565b6daaeb6d7670e522a718067333cd4e3b156122f0576001600160a01b0382163314156121a4576122f0565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b1580156121ee57600080fd5b505afa158015612202573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122269190613468565b80156122b85750604051633185c44d60e21b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b15801561228057600080fd5b505afa158015612294573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b89190613468565b6122f0576040517fede71dcc000000000000000000000000000000000000000000000000000000008152336004820152602401610b7c565b505050505050505050505050565b600080600061230d85856129b7565b9150915061231a81612a27565b509392505050565b600061232d83611f91565b90508060008061234b86600090815260066020526040902080549091565b91509150841561238b57612360818433610c0e565b61238b5761236e83336108b7565b61238b57604051632ce44b5f60e11b815260040160405180910390fd5b61239983600088600161201a565b80156123a457600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b177c030000000000000000000000000000000000000000000000000000000017600087815260046020526040902055600160e11b841661244457600186016000818152600460205260409020546124425760005481146124425760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005481612518576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612525600084838561201a565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146125d457808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161259c565b508161260c576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5fb4f5c581870540f90f9705018e944972197c5be2aa889f6bb847b6cd2236e190600090a35050565b601054156126aa5760105442106126aa576040517f4c013bd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601454826126bb6000546000190190565b6126c591906137c4565b11156126e457604051638a164f6360e01b815260040160405180910390fd5b6015541561272857601554821115612728576040517f9782cdff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6011546000906127109061273c90846137fc565b61274691906137dc565b6019549091506001600160a01b0316156127af57601954601a546001600160a01b039182169161277b91839133911685612c28565b601b546127a99033906001600160a01b0316612797858761381b565b6001600160a01b038516929190612c28565b50612867565b813410156127e9576040517f7e6fc84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601a546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015612823573d6000803e3d6000fd5b50601b546001600160a01b03166108fc61283d838561381b565b6040518115909202916000818181858888f19350505050158015612865573d6000803e3d6000fd5b505b61100333846124de565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906128a69033908990889088906004016136e8565b602060405180830381600087803b1580156128c057600080fd5b505af19250505080156128f0575060408051601f3d908101601f191682019092526128ed918101906134a0565b60015b61294b573d80801561291e576040519150601f19603f3d011682016040523d82523d6000602084013e612923565b606091505b508051612943576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b604080516080810191829052607f0190826030600a8206018353600a90045b80156129a557600183039250600a81066030018353600a9004612987565b50819003601f19909101908152919050565b6000808251604114156129ee5760208301516040840151606085015160001a6129e287828585612cb0565b94509450505050612a20565b825160401415612a185760208301516040840151612a0d868383612d9d565b935093505050612a20565b506000905060025b9250929050565b6000816004811115612a4957634e487b7160e01b600052602160045260246000fd5b1415612a525750565b6001816004811115612a7457634e487b7160e01b600052602160045260246000fd5b1415612ac25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b7c565b6002816004811115612ae457634e487b7160e01b600052602160045260246000fd5b1415612b325760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b7c565b6003816004811115612b5457634e487b7160e01b600052602160045260246000fd5b1415612bad5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610b7c565b6004816004811115612bcf57634e487b7160e01b600052602160045260246000fd5b14156110135760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610b7c565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611bc6908590612def565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612ce75750600090506003612d94565b8460ff16601b14158015612cff57508460ff16601c14155b15612d105750600090506004612d94565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612d64573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612d8d57600060019250925050612d94565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681612dd360ff86901c601b6137c4565b9050612de187828885612cb0565b935093505050935093915050565b6000612e44826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ed49092919063ffffffff16565b8051909150156110035780806020019051810190612e629190613468565b6110035760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610b7c565b6060612ee38484600085612eeb565b949350505050565b606082471015612f635760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610b7c565b6001600160a01b0385163b612fba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b7c565b600080866001600160a01b03168587604051612fd69190613626565b60006040518083038185875af1925050503d8060008114613013576040519150601f19603f3d011682016040523d82523d6000602084013e613018565b606091505b5091509150613028828286613033565b979650505050505050565b60608315613042575081611fdf565b8251156130525782518084602001fd5b8160405162461bcd60e51b8152600401610b7c9190613724565b8280546130789061385e565b90600052602060002090601f01602090048101928261309a57600085556130e0565b82601f106130b35782800160ff198235161785556130e0565b828001600101855582156130e0579182015b828111156130e05782358255916020019190600101906130c5565b506130ec9291506130f0565b5090565b5b808211156130ec57600081556001016130f1565b60008083601f840112613116578081fd5b50813567ffffffffffffffff81111561312d578182fd5b6020830191508360208260051b8501011115612a2057600080fd5b60008083601f840112613159578182fd5b50813567ffffffffffffffff811115613170578182fd5b602083019150836020828501011115612a2057600080fd5b600060208284031215613199578081fd5b8135611fdf816139f0565b6000602082840312156131b5578081fd5b8151611fdf816139f0565b600080604083850312156131d2578081fd5b82356131dd816139f0565b915060208301356131ed816139f0565b809150509250929050565b60008060006060848603121561320c578081fd5b8335613217816139f0565b92506020840135613227816139f0565b929592945050506040919091013590565b6000806000806080858703121561324d578081fd5b8435613258816139f0565b93506020850135613268816139f0565b925060408501359150606085013567ffffffffffffffff8082111561328b578283fd5b818701915087601f83011261329e578283fd5b8135818111156132b0576132b06138a9565b604051601f8201601f19908116603f011681019083821181831017156132d8576132d86138a9565b816040528281528a60208487010111156132f0578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060008060008060a08789031215613329578182fd5b8635613334816139f0565b95506020870135613344816139f0565b94506040870135935060608701359250608087013567ffffffffffffffff81111561336d578283fd5b61337989828a01613148565b979a9699509497509295939492505050565b6000806040838503121561339d578182fd5b82356133a8816139f0565b915060208301356131ed81613a05565b600080604083850312156133ca578182fd5b82356133d5816139f0565b946020939093013593505050565b600080600080604085870312156133f8578384fd5b843567ffffffffffffffff8082111561340f578586fd5b61341b88838901613105565b90965094506020870135915080821115613433578384fd5b5061344087828801613105565b95989497509550505050565b60006020828403121561345d578081fd5b8135611fdf81613a05565b600060208284031215613479578081fd5b8151611fdf81613a05565b600060208284031215613495578081fd5b8135611fdf81613a13565b6000602082840312156134b1578081fd5b8151611fdf81613a13565b600080600080604085870312156134d1578182fd5b843567ffffffffffffffff808211156134e8578384fd5b6134f488838901613148565b9096509450602087013591508082111561350c578384fd5b5061344087828801613148565b600060e0828403121561352a578081fd5b50919050565b600060208284031215613541578081fd5b5035919050565b6000806040838503121561355a578182fd5b50508035926020909101359150565b60008060006060848603121561357d578081fd5b505081359360208301359350604090920135919050565b60008060008060008060a087890312156135ac578384fd5b86359550602087013594506040870135935060608701359250608087013567ffffffffffffffff81111561336d578283fd5b600081518084526135f6816020860160208601613832565b601f01601f19169290920160200192915050565b6000815161361c818560208601613832565b9290920192915050565b60008251613638818460208701613832565b9190910192915050565b600080845482600182811c91508083168061365e57607f831692505b602080841082141561367e57634e487b7160e01b87526022600452602487fd5b81801561369257600181146136a3576136cf565b60ff198616895284890196506136cf565b60008b815260209020885b868110156136c75781548b8201529085019083016136ae565b505084890196505b5050505050506136df818561360a565b95945050505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261371a60808301846135de565b9695505050505050565b602081526000611fdf60208301846135de565b600061016080835261374b8184018f6135de565b9050828103602084015261375f818e6135de565b90508281036040840152613773818d6135de565b90508281036060840152613787818c6135de565b9915156080840152505095151560a087015293151560c086015260e085019290925261010084015261012083015261014090910152949350505050565b600082198211156137d7576137d7613893565b500190565b6000826137f757634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561381657613816613893565b500290565b60008282101561382d5761382d613893565b500390565b60005b8381101561384d578181015183820152602001613835565b83811115611bc65750506000910152565b600181811c9082168061387257607f821691505b6020821081141561352a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b81356138ca816139f0565b81546001600160a01b0319166001600160a01b0382161782555060208201356138f2816139f0565b6001820180546001600160a01b0319166001600160a01b03831617905550604082013561391e816139f0565b6002820180546001600160a01b0319166001600160a01b03831617905550606082013561394a816139f0565b6003820180546001600160a01b0319166001600160a01b038316179055506080820135613976816139f0565b6004820180546001600160a01b0319166001600160a01b0383161790555060a08201356139a2816139f0565b6005820180546001600160a01b0319166001600160a01b0383161790555060c08201356139ce816139f0565b6006820180546001600160a01b0319166001600160a01b038316179055505050565b6001600160a01b038116811461101357600080fd5b801515811461101357600080fd5b6001600160e01b03198116811461101357600080fdfe4f776e61626c653a2063616c6c6572206973206e6f742074686520636f6e7472a26469706673582212203ec994ceb993ddac6340518a88965cfb667e87c7e35ffbbe10f6143bdac84b1664736f6c6343000804003300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000004b9067a9aff927c4e3502f815a79d892174604b2000000000000000000000000a7ada1475240eeeb74462567d5c99ff431e33b6c000000000000000000000000028bf8299b56ec8bdba9ea0705b3cfc874b78c28000000000000000000000000000000000000000000000000000000000000000000000000000000000000000062d516276381042016b38b65c89c05ea59ccb13b000000000000000000000000a7ada1475240eeeb74462567d5c99ff431e33b6c000000000000000000000000a7ada1475240eeeb74462567d5c99ff431e33b6c000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000134a756d7053746172742044657369676e6572730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a554d5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004768747470733a2f2f6170692e68797065726d696e742e636f6d2f6d657461646174612f63313434356532652d636566312d343732352d383632612d65656231323639336463313800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004868747470733a2f2f6170692e68797065726d696e742e636f6d2f6d657461646174612f63313434356532652d636566312d343732352d383632612d6565623132363933646331382f000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102d05760003560e01c806382875f7911610179578063b39e12cf116100d6578063d96a094a1161008a578063e8a3d48511610064578063e8a3d48514610887578063e985e9c51461089c578063f2fde38b146108e557600080fd5b8063d96a094a146107c6578063da0321cd146107d9578063dedf141e1461086757600080fd5b8063ba9341c0116100bb578063ba9341c01461074c578063c87b56dd14610786578063d6046836146107a657600080fd5b8063b39e12cf1461070e578063b88d4fde1461072c57600080fd5b806395d89b411161012d578063ae0aa35b11610112578063ae0aa35b146106ae578063aeb2de35146106ce578063b375d492146106ee57600080fd5b806395d89b4114610679578063a22cb4651461068e57600080fd5b80638da5cb5b1161015e5780638da5cb5b1461060f578063927a97a11461062d578063933a6f0d1461065957600080fd5b806382875f79146105e75780638bc3bdec146105fc57600080fd5b80632843e3441161023257806358939061116101e657806370a08231116101c057806370a0823114610592578063715018a6146105b25780637c88e3d9146105c757600080fd5b806358939061146105325780635a446215146105525780636352211e1461057257600080fd5b806342842e0e1161021757806342842e0e146104a957806342966c68146104c957806354fd4d50146104e957600080fd5b80632843e3441461044a5780632a55205a1461046a57600080fd5b8063095ea7b31161028957806318160ddd1161026e57806318160ddd146103ed57806323b872dd1461040a5780632541b0911461042a57600080fd5b8063095ea7b3146103ab578063166d44ea146103cd57600080fd5b8063047fc9aa116102ba578063047fc9aa1461033857806306fdde0314610351578063081812fc1461037357600080fd5b80623d4790146102d557806301ffc9a714610308575b600080fd5b3480156102e157600080fd5b506102f56102f0366004613188565b610905565b6040519081526020015b60405180910390f35b34801561031457600080fd5b50610328610323366004613484565b610932565b60405190151581526020016102ff565b34801561034457600080fd5b50600054600019016102f5565b34801561035d57600080fd5b50610366610970565b6040516102ff9190613724565b34801561037f57600080fd5b5061039361038e366004613530565b610a05565b6040516001600160a01b0390911681526020016102ff565b3480156103b757600080fd5b506103cb6103c63660046133b8565b610a62565b005b3480156103d957600080fd5b506103cb6103e836600461344c565b610b1b565b3480156103f957600080fd5b5060015460005403600019016102f5565b34801561041657600080fd5b506103cb6104253660046131f8565b610b9f565b34801561043657600080fd5b506103cb610445366004613311565b610d7b565b34801561045657600080fd5b506103cb610465366004613569565b610ef9565b34801561047657600080fd5b5061048a610485366004613548565b610fb2565b604080516001600160a01b0390931683526020830191909152016102ff565b3480156104b557600080fd5b506103cb6104c43660046131f8565b610fe8565b3480156104d557600080fd5b506103cb6104e4366004613530565b611008565b3480156104f557600080fd5b506103666040518060400160405280600581526020017f322e322e3000000000000000000000000000000000000000000000000000000081525081565b34801561053e57600080fd5b506103cb61054d36600461344c565b611016565b34801561055e57600080fd5b506103cb61056d3660046134bc565b611097565b34801561057e57600080fd5b5061039361058d366004613530565b61111c565b34801561059e57600080fd5b506102f56105ad366004613188565b611127565b3480156105be57600080fd5b506103cb61118f565b3480156105d357600080fd5b506103cb6105e23660046133e3565b6111f5565b3480156105f357600080fd5b506103cb61133b565b6103cb61060a366004613594565b61137b565b34801561061b57600080fd5b506008546001600160a01b0316610393565b34801561063957600080fd5b50610642611574565b6040516102ff9b9a99989796959493929190613737565b34801561066557600080fd5b506103cb610674366004613548565b6117e1565b34801561068557600080fd5b50610366611851565b34801561069a57600080fd5b506103cb6106a936600461338b565b611863565b3480156106ba57600080fd5b506103cb6106c9366004613188565b611912565b3480156106da57600080fd5b506103cb6106e93660046134bc565b6119fc565b3480156106fa57600080fd5b506103cb610709366004613519565b611a7a565b34801561071a57600080fd5b506009546001600160a01b0316610393565b34801561073857600080fd5b506103cb610747366004613238565b611b82565b34801561075857600080fd5b5060135460145460155461076b92919083565b604080519384526020840192909252908201526060016102ff565b34801561079257600080fd5b506103666107a1366004613530565b611bcc565b3480156107b257600080fd5b506103cb6107c136600461344c565b611c3f565b6103cb6107d4366004613530565b611cb7565b3480156107e557600080fd5b50601654601754601854601954601a54601b54601c5461081e966001600160a01b03908116968116958116948116938116928116911687565b604080516001600160a01b039889168152968816602088015294871694860194909452918516606085015284166080840152831660a083015290911660c082015260e0016102ff565b34801561087357600080fd5b506103cb610882366004613548565b611d62565b34801561089357600080fd5b50610366611dd2565b3480156108a857600080fd5b506103286108b73660046131c0565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156108f157600080fd5b506103cb610900366004613188565b611de4565b6001600160a01b0381166000908152600560205260408082205467ffffffffffffffff911c165b92915050565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061092c575061092c82611ec3565b6060600a60000180546109829061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546109ae9061385e565b80156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b5050505050905090565b6000610a1082611f5c565b610a46576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a6d8261111c565b9050336001600160a01b03821614610abf57610a8981336108b7565b610abf576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6009546001600160a01b0316336001600160a01b031614610b855760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b60648201526084015b60405180910390fd5b600e80549115156101000261ff0019909216919091179055565b6000610baa82611f91565b9050836001600160a01b0316816001600160a01b031614610bf7576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054610c238187335b6001600160a01b039081169116811491141790565b610c4e57610c3186336108b7565b610c4e57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610c8e576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610c9b868686600161201a565b8015610ca657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b8316610d315760018401600081815260046020526040902054610d2f576000548114610d2f5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b323314610d9b57604051633ebb273b60e21b815260040160405180910390fd5b824210610dbb57604051630819bdcd60e01b815260040160405180910390fd5b6040805130606090811b6bffffffffffffffffffffffff1990811660208085019190915233831b821660348501528a831b821660488501529189901b16605c8301526070820187905260908083018790528351808403909101815260b0830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060d084015260ec8084018290528451808503909101815261010c9093019093528151910120600090601854604080516020601f88018190048102820181019092528681529293506001600160a01b0390911691610ebd9184919088908890819084018382808284376000920191909152506122fe92505050565b6001600160a01b031614610ee457604051631648fd0160e01b815260040160405180910390fd5b610eef888888610fe8565b5050505050505050565b6009546001600160a01b0316336001600160a01b031614610f5e5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b60015460005483919003600019011115610fa4576040517f1d77a89900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601392909255601455601555565b601c546012546001600160a01b039091169060009061271090610fd590856137fc565b610fdf91906137dc565b90509250929050565b61100383838360405180602001604052806000815250611b82565b505050565b611013816001612322565b50565b6009546001600160a01b0316336001600160a01b03161461107b5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b600e8054911515620100000262ff000019909216919091179055565b6009546001600160a01b0316336001600160a01b0316146110fc5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b611108600a858561306c565b50611115600b838361306c565b5050505050565b600061092c82611f91565b60006001600160a01b038216611169576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6008546001600160a01b031633146111e95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b7c565b6111f3600061248c565b565b6009546001600160a01b0316336001600160a01b03161461125a5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b32331461127a57604051633ebb273b60e21b815260040160405180910390fd5b8260005b81811015610d735760008686838181106112a857634e487b7160e01b600052603260045260246000fd5b90506020020160208101906112bd9190613188565b905060008585848181106112e157634e487b7160e01b600052603260045260246000fd5b905060200201359050601360010154816112fe6000546000190190565b61130891906137c4565b111561132757604051638a164f6360e01b815260040160405180910390fd5b61133182826124de565b505060010161127e565b6016546001600160a01b0316331461136657604051631648fd0160e01b815260040160405180910390fd5b6016546111f3906001600160a01b0316612615565b600e5460ff1661139e57604051639d7da54560e01b815260040160405180910390fd5b3233146113be57604051633ebb273b60e21b815260040160405180910390fd5b8242106113de57604051630819bdcd60e01b815260040160405180910390fd5b6040805130606090811b6bffffffffffffffffffffffff199081166020808501919091523390921b16603483015260488201899052606882018890526088820187905260a88083018790528351808403909101815260c8830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060e8840152610104808401829052845180850390910181526101249093019093528151910120600090601854604080516020601f88018190048102820181019092528681529293506001600160a01b03909116916114db9184919088908890819084018382808284376000920191909152506122fe92505050565b6001600160a01b03161461150257604051631648fd0160e01b815260040160405180910390fd5b851561156a573360009081526005602052604090819020548791611532918b911c67ffffffffffffffff166137c4565b111561156a576040517f550ffa9c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610eef8888612667565b600a805481906115839061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546115af9061385e565b80156115fc5780601f106115d1576101008083540402835291602001916115fc565b820191906000526020600020905b8154815290600101906020018083116115df57829003601f168201915b5050505050908060010180546116119061385e565b80601f016020809104026020016040519081016040528092919081815260200182805461163d9061385e565b801561168a5780601f1061165f5761010080835404028352916020019161168a565b820191906000526020600020905b81548152906001019060200180831161166d57829003601f168201915b50505050509080600201805461169f9061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546116cb9061385e565b80156117185780601f106116ed57610100808354040283529160200191611718565b820191906000526020600020905b8154815290600101906020018083116116fb57829003601f168201915b50505050509080600301805461172d9061385e565b80601f01602080910402602001604051908101604052809291908181526020018280546117599061385e565b80156117a65780601f1061177b576101008083540402835291602001916117a6565b820191906000526020600020905b81548152906001019060200180831161178957829003601f168201915b505050506004830154600584015460068501546007860154600890960154949560ff808516966101008604821696506201000090950416938b565b6009546001600160a01b0316336001600160a01b0316146118465760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b601191909155601255565b6060600a60010180546109829061385e565b6001600160a01b0382163314156118a6576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6009546001600160a01b0316336001600160a01b0316146119775760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b6001600160a01b0381166119f35760405162461bcd60e51b815260206004820152602f60248201527f4f776e61626c653a206e657720636f6e7472616374206f776e6572206973207460448201527f6865207a65726f206164647265737300000000000000000000000000000000006064820152608401610b7c565b61101381612615565b6009546001600160a01b0316336001600160a01b031614611a615760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b611a6d600c858561306c565b50611115600d838361306c565b6009546001600160a01b0316336001600160a01b031614611adf5760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b6016546001600160a01b0316611af86020830183613188565b6001600160a01b031614611b38576040517f9598453c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b486040820160208301613188565b6017546001600160a01b03908116911614611b7557611b75611b706040830160208401613188565b61248c565b80601661100382826138bf565b611b8d848484610b9f565b6001600160a01b0383163b15611bc657611ba984848484612871565b611bc6576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060611bd782611f5c565b611c0d576040517f9430a17e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d611c1883612968565b604051602001611c29929190613642565b6040516020818303038152906040529050919050565b6009546001600160a01b0316336001600160a01b031614611ca45760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b600e805460ff1916911515919091179055565b600e5460ff16611cda57604051639d7da54560e01b815260040160405180910390fd5b323314611cfa57604051633ebb273b60e21b815260040160405180910390fd5b600f541580611d0a5750600f5442105b15611d41576040517fdd4e010600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601354600090611d529083906137fc565b9050611d5e8282612667565b5050565b6009546001600160a01b0316336001600160a01b031614611dc75760405162461bcd60e51b815260206004820152602b6024820152600080516020613a2a83398151915260448201526a30b1ba1036b0b730b3b2b960a91b6064820152608401610b7c565b600f91909155601055565b6060600a60020180546109829061385e565b6008546001600160a01b03163314611e3e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b7c565b6001600160a01b038116611eba5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b7c565b6110138161248c565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480611f2657507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061092c5750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b600081600111158015611f70575060005482105b801561092c575050600090815260046020526040902054600160e01b161590565b60008180600111611fe857600054811015611fe857600081815260046020526040902054600160e01b8116611fe6575b80611fdf575060001901600081815260046020526040902054611fc1565b9392505050565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080517fb39e12cf0000000000000000000000000000000000000000000000000000000081529051859185916001600160a01b0380851615929084161591600091309163b39e12cf91600480820192602092909190829003018186803b15801561208457600080fd5b505afa158015612098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bc91906131a4565b6001600160a01b0386811691161490506000356001600160e01b0319167f2541b091000000000000000000000000000000000000000000000000000000001483158015612107575081155b8015612111575082155b801561211b575080155b1561216157600e54610100900460ff16612161576040517f8574adcf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e548a9062010000900460ff1680612179576122f0565b6daaeb6d7670e522a718067333cd4e3b156122f0576001600160a01b0382163314156121a4576122f0565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b1580156121ee57600080fd5b505afa158015612202573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122269190613468565b80156122b85750604051633185c44d60e21b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063c61711349060440160206040518083038186803b15801561228057600080fd5b505afa158015612294573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b89190613468565b6122f0576040517fede71dcc000000000000000000000000000000000000000000000000000000008152336004820152602401610b7c565b505050505050505050505050565b600080600061230d85856129b7565b9150915061231a81612a27565b509392505050565b600061232d83611f91565b90508060008061234b86600090815260066020526040902080549091565b91509150841561238b57612360818433610c0e565b61238b5761236e83336108b7565b61238b57604051632ce44b5f60e11b815260040160405180910390fd5b61239983600088600161201a565b80156123a457600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b177c030000000000000000000000000000000000000000000000000000000017600087815260046020526040902055600160e11b841661244457600186016000818152600460205260409020546124425760005481146124425760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60005481612518576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612525600084838561201a565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146125d457808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161259c565b508161260c576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f5fb4f5c581870540f90f9705018e944972197c5be2aa889f6bb847b6cd2236e190600090a35050565b601054156126aa5760105442106126aa576040517f4c013bd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601454826126bb6000546000190190565b6126c591906137c4565b11156126e457604051638a164f6360e01b815260040160405180910390fd5b6015541561272857601554821115612728576040517f9782cdff00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6011546000906127109061273c90846137fc565b61274691906137dc565b6019549091506001600160a01b0316156127af57601954601a546001600160a01b039182169161277b91839133911685612c28565b601b546127a99033906001600160a01b0316612797858761381b565b6001600160a01b038516929190612c28565b50612867565b813410156127e9576040517f7e6fc84600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601a546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015612823573d6000803e3d6000fd5b50601b546001600160a01b03166108fc61283d838561381b565b6040518115909202916000818181858888f19350505050158015612865573d6000803e3d6000fd5b505b61100333846124de565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906128a69033908990889088906004016136e8565b602060405180830381600087803b1580156128c057600080fd5b505af19250505080156128f0575060408051601f3d908101601f191682019092526128ed918101906134a0565b60015b61294b573d80801561291e576040519150601f19603f3d011682016040523d82523d6000602084013e612923565b606091505b508051612943576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b604080516080810191829052607f0190826030600a8206018353600a90045b80156129a557600183039250600a81066030018353600a9004612987565b50819003601f19909101908152919050565b6000808251604114156129ee5760208301516040840151606085015160001a6129e287828585612cb0565b94509450505050612a20565b825160401415612a185760208301516040840151612a0d868383612d9d565b935093505050612a20565b506000905060025b9250929050565b6000816004811115612a4957634e487b7160e01b600052602160045260246000fd5b1415612a525750565b6001816004811115612a7457634e487b7160e01b600052602160045260246000fd5b1415612ac25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b7c565b6002816004811115612ae457634e487b7160e01b600052602160045260246000fd5b1415612b325760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b7c565b6003816004811115612b5457634e487b7160e01b600052602160045260246000fd5b1415612bad5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610b7c565b6004816004811115612bcf57634e487b7160e01b600052602160045260246000fd5b14156110135760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610b7c565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611bc6908590612def565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612ce75750600090506003612d94565b8460ff16601b14158015612cff57508460ff16601c14155b15612d105750600090506004612d94565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612d64573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612d8d57600060019250925050612d94565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681612dd360ff86901c601b6137c4565b9050612de187828885612cb0565b935093505050935093915050565b6000612e44826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ed49092919063ffffffff16565b8051909150156110035780806020019051810190612e629190613468565b6110035760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610b7c565b6060612ee38484600085612eeb565b949350505050565b606082471015612f635760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610b7c565b6001600160a01b0385163b612fba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b7c565b600080866001600160a01b03168587604051612fd69190613626565b60006040518083038185875af1925050503d8060008114613013576040519150601f19603f3d011682016040523d82523d6000602084013e613018565b606091505b5091509150613028828286613033565b979650505050505050565b60608315613042575081611fdf565b8251156130525782518084602001fd5b8160405162461bcd60e51b8152600401610b7c9190613724565b8280546130789061385e565b90600052602060002090601f01602090048101928261309a57600085556130e0565b82601f106130b35782800160ff198235161785556130e0565b828001600101855582156130e0579182015b828111156130e05782358255916020019190600101906130c5565b506130ec9291506130f0565b5090565b5b808211156130ec57600081556001016130f1565b60008083601f840112613116578081fd5b50813567ffffffffffffffff81111561312d578182fd5b6020830191508360208260051b8501011115612a2057600080fd5b60008083601f840112613159578182fd5b50813567ffffffffffffffff811115613170578182fd5b602083019150836020828501011115612a2057600080fd5b600060208284031215613199578081fd5b8135611fdf816139f0565b6000602082840312156131b5578081fd5b8151611fdf816139f0565b600080604083850312156131d2578081fd5b82356131dd816139f0565b915060208301356131ed816139f0565b809150509250929050565b60008060006060848603121561320c578081fd5b8335613217816139f0565b92506020840135613227816139f0565b929592945050506040919091013590565b6000806000806080858703121561324d578081fd5b8435613258816139f0565b93506020850135613268816139f0565b925060408501359150606085013567ffffffffffffffff8082111561328b578283fd5b818701915087601f83011261329e578283fd5b8135818111156132b0576132b06138a9565b604051601f8201601f19908116603f011681019083821181831017156132d8576132d86138a9565b816040528281528a60208487010111156132f0578586fd5b82602086016020830137918201602001949094529598949750929550505050565b60008060008060008060a08789031215613329578182fd5b8635613334816139f0565b95506020870135613344816139f0565b94506040870135935060608701359250608087013567ffffffffffffffff81111561336d578283fd5b61337989828a01613148565b979a9699509497509295939492505050565b6000806040838503121561339d578182fd5b82356133a8816139f0565b915060208301356131ed81613a05565b600080604083850312156133ca578182fd5b82356133d5816139f0565b946020939093013593505050565b600080600080604085870312156133f8578384fd5b843567ffffffffffffffff8082111561340f578586fd5b61341b88838901613105565b90965094506020870135915080821115613433578384fd5b5061344087828801613105565b95989497509550505050565b60006020828403121561345d578081fd5b8135611fdf81613a05565b600060208284031215613479578081fd5b8151611fdf81613a05565b600060208284031215613495578081fd5b8135611fdf81613a13565b6000602082840312156134b1578081fd5b8151611fdf81613a13565b600080600080604085870312156134d1578182fd5b843567ffffffffffffffff808211156134e8578384fd5b6134f488838901613148565b9096509450602087013591508082111561350c578384fd5b5061344087828801613148565b600060e0828403121561352a578081fd5b50919050565b600060208284031215613541578081fd5b5035919050565b6000806040838503121561355a578182fd5b50508035926020909101359150565b60008060006060848603121561357d578081fd5b505081359360208301359350604090920135919050565b60008060008060008060a087890312156135ac578384fd5b86359550602087013594506040870135935060608701359250608087013567ffffffffffffffff81111561336d578283fd5b600081518084526135f6816020860160208601613832565b601f01601f19169290920160200192915050565b6000815161361c818560208601613832565b9290920192915050565b60008251613638818460208701613832565b9190910192915050565b600080845482600182811c91508083168061365e57607f831692505b602080841082141561367e57634e487b7160e01b87526022600452602487fd5b81801561369257600181146136a3576136cf565b60ff198616895284890196506136cf565b60008b815260209020885b868110156136c75781548b8201529085019083016136ae565b505084890196505b5050505050506136df818561360a565b95945050505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261371a60808301846135de565b9695505050505050565b602081526000611fdf60208301846135de565b600061016080835261374b8184018f6135de565b9050828103602084015261375f818e6135de565b90508281036040840152613773818d6135de565b90508281036060840152613787818c6135de565b9915156080840152505095151560a087015293151560c086015260e085019290925261010084015261012083015261014090910152949350505050565b600082198211156137d7576137d7613893565b500190565b6000826137f757634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561381657613816613893565b500290565b60008282101561382d5761382d613893565b500390565b60005b8381101561384d578181015183820152602001613835565b83811115611bc65750506000910152565b600181811c9082168061387257607f821691505b6020821081141561352a57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b81356138ca816139f0565b81546001600160a01b0319166001600160a01b0382161782555060208201356138f2816139f0565b6001820180546001600160a01b0319166001600160a01b03831617905550604082013561391e816139f0565b6002820180546001600160a01b0319166001600160a01b03831617905550606082013561394a816139f0565b6003820180546001600160a01b0319166001600160a01b038316179055506080820135613976816139f0565b6004820180546001600160a01b0319166001600160a01b0383161790555060a08201356139a2816139f0565b6005820180546001600160a01b0319166001600160a01b0383161790555060c08201356139ce816139f0565b6006820180546001600160a01b0319166001600160a01b038316179055505050565b6001600160a01b038116811461101357600080fd5b801515811461101357600080fd5b6001600160e01b03198116811461101357600080fdfe4f776e61626c653a2063616c6c6572206973206e6f742074686520636f6e7472a26469706673582212203ec994ceb993ddac6340518a88965cfb667e87c7e35ffbbe10f6143bdac84b1664736f6c63430008040033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.