Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
SalesManager
Compiler Version
v0.8.24+commit.e11b9ed9
ZkSolc Version
v1.5.7
Optimization Enabled:
Yes with Mode 3
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol"; import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {PrimarySale} from "./PrimarySale.sol"; import {Totem} from "./Totem.sol"; import {ISalesManager} from "./interface/ISalesManager.sol"; import {ParamValidators} from "./lib/ParamValidators.sol"; import {OPERATOR_ROLE} from "./SalesManagerConstants.sol"; import {SalesManagerStorage} from "./SalesManagerStorage.sol"; contract SalesManager is UUPSUpgradeable, AccessControlEnumerableUpgradeable, PrimarySale, SalesManagerStorage, ISalesManager { /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( address defaultAdmin, address operator, address primarySaleRecipient, address totemTokenAddress ) public initializer { ParamValidators.checkIsNonZeroAddress(defaultAdmin); ParamValidators.checkIsNonZeroAddress(operator); ParamValidators.checkIsNonZeroAddress(totemTokenAddress); __UUPSUpgradeable_init(); __AccessControlEnumerable_init(); _grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin); _grantRole(OPERATOR_ROLE, operator); // Set role admins _setRoleAdmin(OPERATOR_ROLE, DEFAULT_ADMIN_ROLE); // Zero address check is done within _setupPrimarySaleRecipient _setupPrimarySaleRecipient(primarySaleRecipient); totemToken = Totem(totemTokenAddress); } /** * @notice Starts a new season. * @param maxSupply The maximum supply of the season. * @param mintPrice The mint price of the season. * @param merkleRoot The Merkle root of the season. * @param whitelistSaleStartTime The start time of the whitelist sale. * @param publicSaleStartTime The start time of the public sale. * @param saleEndTime The end time of the sale. * @param whitelistSaleClaimAmountLimit The claim amount limit for the whitelist sale. * @param publicSaleClaimAmountLimit The claim amount limit for the public sale. */ function startNewSeason( uint128 maxSupply, uint256 mintPrice, bytes32 merkleRoot, uint32 whitelistSaleStartTime, uint32 publicSaleStartTime, uint32 saleEndTime, uint8 whitelistSaleClaimAmountLimit, uint8 publicSaleClaimAmountLimit ) external onlyRole(OPERATOR_ROLE) { ParamValidators.checkIsValidSaleTime( whitelistSaleStartTime, publicSaleStartTime, saleEndTime, block.timestamp ); ParamValidators.checkIsValidMintPrice(mintPrice); ParamValidators.checkLatestSeasonEnded( seasons, _currentSeasonIndex, block.timestamp ); // If _currentSeasonIndex is at 0, starts from 1. uint256 seasonToInitialize = ++_currentSeasonIndex; Season memory newSeason = Season({ maxSupply: maxSupply, mintedSupply: 0, saleCondition: SaleCondition({ whitelistSaleStartTime: whitelistSaleStartTime, whitelistSaleClaimAmountLimit: whitelistSaleClaimAmountLimit, mintPrice: mintPrice, publicSaleStartTime: publicSaleStartTime, publicSaleClaimAmountLimit: publicSaleClaimAmountLimit, saleEndTime: saleEndTime, merkleRoot: merkleRoot }), isSaleDisabled: false }); seasons[seasonToInitialize] = newSeason; emit SeasonCreated(seasonToInitialize); } /** * @notice Mints a new Totem token. * @param amount The amount of tokens to mint. * @param merkleProof The Merkle proof supplied if there is a whitelist sale. */ function mintTokens( uint128 amount, bytes32[] calldata merkleProof, address recipient ) external payable { uint256 currentSeasonIndex = _currentSeasonIndex; Season memory currentSeason = seasons[currentSeasonIndex]; if (currentSeason.isSaleDisabled) revert SaleDisabled(); if (block.timestamp > currentSeason.saleCondition.saleEndTime) revert SaleEnded(); if ( block.timestamp < currentSeason.saleCondition.whitelistSaleStartTime ) revert SaleNotActive(); if (currentSeason.mintedSupply + amount > currentSeason.maxSupply) revert MaxSupplyReached(); if (msg.value != currentSeason.saleCondition.mintPrice * amount) revert InvalidPayment( currentSeason.saleCondition.mintPrice * amount, msg.value ); ClaimState memory userClaims = userClaimState[currentSeasonIndex][ msg.sender ]; // If during whitelist sale, check if the user is whitelisted. bool isWhitelistSaleActive = block.timestamp >= currentSeason.saleCondition.whitelistSaleStartTime && block.timestamp < currentSeason.saleCondition.publicSaleStartTime; if (isWhitelistSaleActive) { if ( // If Merkle root does not exist currentSeason.saleCondition.merkleRoot == bytes32(0) ) { revert MerkleRootDoesNotExist(); } bytes32 leaf = keccak256( bytes.concat( keccak256(abi.encode(msg.sender, currentSeasonIndex)) ) ); if ( !MerkleProof.verify( merkleProof, currentSeason.saleCondition.merkleRoot, leaf ) ) revert NotWhitelisted(); } // If during whitelist sale and the user has reached the whitelist mint amount limit. if ( isWhitelistSaleActive && (userClaims.whitelistClaimed + amount > currentSeason.saleCondition.whitelistSaleClaimAmountLimit) ) revert ClaimAmountLimitReached( isWhitelistSaleActive, userClaims.whitelistClaimed ); // If during public sale, check if the user has reached the public mint amount limit. if ( !isWhitelistSaleActive && (userClaims.publicClaimed + amount > currentSeason.saleCondition.publicSaleClaimAmountLimit) ) revert ClaimAmountLimitReached( isWhitelistSaleActive, userClaims.publicClaimed ); isWhitelistSaleActive ? userClaimState[currentSeasonIndex][msg.sender] .whitelistClaimed += uint8(amount) : userClaimState[currentSeasonIndex][msg.sender] .publicClaimed += uint8(amount); // Emit mint events for the tokens to be minted uint256 tokenId = totemToken.nextTokenId(); for (uint256 i; i < amount; ++i) { tokenSeasonAffiliation[tokenId + i] = currentSeasonIndex; emit TokenMinted(recipient, tokenId + i, currentSeasonIndex); } seasons[currentSeasonIndex].mintedSupply += amount; totemToken.mintTo(recipient, amount); } // Setters /** * @notice Sets the sale status of a season. * @param season The season number. * @param isSaleDisabled Whether the sale is disabled. */ function setSeasonSaleStatus( uint256 season, bool isSaleDisabled ) external onlyRole(OPERATOR_ROLE) { ParamValidators.checkIsValidSeason(season, _currentSeasonIndex); seasons[season].isSaleDisabled = isSaleDisabled; emit SeasonSaleDisabled(season); } /** * @notice Updates the Merkle root for a season. * @dev This is in case the whitelisted users must be updated. * @param season The season number. * @param merkleRoot The new Merkle root. */ function setUpdateMerkleRoot( uint256 season, bytes32 merkleRoot ) external onlyRole(OPERATOR_ROLE) { ParamValidators.checkIsValidSeason(season, _currentSeasonIndex); seasons[season].saleCondition.merkleRoot = merkleRoot; emit MerkleRootUpdated(season, merkleRoot); } /** * @notice Updates the sale time for a season. This should be used sparingly, * as it will affect the sale conditions for all users. * @param season The season number. * @param whitelistSaleStartTime The start time of the whitelist sale. * @param publicSaleStartTime The start time of the public sale. * @param saleEndTime The end time of the sale. */ function setSeasonSaleTime( uint256 season, uint32 whitelistSaleStartTime, uint32 publicSaleStartTime, uint32 saleEndTime ) external onlyRole(OPERATOR_ROLE) { ParamValidators.checkIsValidSeason(season, _currentSeasonIndex); ParamValidators.checkIsValidSaleTime( whitelistSaleStartTime, publicSaleStartTime, saleEndTime, block.timestamp ); seasons[season] .saleCondition .whitelistSaleStartTime = whitelistSaleStartTime; seasons[season].saleCondition.publicSaleStartTime = publicSaleStartTime; seasons[season].saleCondition.saleEndTime = saleEndTime; emit SeasonSaleTimeUpdated( season, whitelistSaleStartTime, publicSaleStartTime, saleEndTime ); } function setSeasonSaleUserLimit( uint256 season, uint8 whitelistSaleClaimAmountLimit, uint8 publicSaleClaimAmountLimit ) external onlyRole(OPERATOR_ROLE) { ParamValidators.checkIsValidSeason(season, _currentSeasonIndex); seasons[season] .saleCondition .whitelistSaleClaimAmountLimit = whitelistSaleClaimAmountLimit; seasons[season] .saleCondition .publicSaleClaimAmountLimit = publicSaleClaimAmountLimit; emit SeasonSaleUserLimitUpdated( season, whitelistSaleClaimAmountLimit, publicSaleClaimAmountLimit ); } // View functions /** * @notice Returns the current season number. */ function currentActiveSeason() external view returns (uint256) { return _currentSeasonIndex; } /*////////////////////////////////////////////////////////////// Access Control Internal Functions //////////////////////////////////////////////////////////////*/ /// @dev Checks whether primary sale recipient can be set in the given execution context. function _canSetPrimarySaleRecipient() internal view override returns (bool) { return hasRole(OPERATOR_ROLE, msg.sender); } /// @dev Checks whether the sender can withdraw ETH gained from primary sales. function _canWithdrawSale() internal view override returns (bool) { return hasRole(OPERATOR_ROLE, msg.sender); } function _authorizeUpgrade( address newImplementation ) internal override onlyRole(DEFAULT_ADMIN_ROLE) {} // receive function receive() external payable {} }
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import "./interface/IPrimarySale.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; abstract contract PrimarySale is IPrimarySale { /// @dev The sender is not authorized to perform the action error PrimarySaleUnauthorized(); /// @dev The recipient is invalid error PrimarySaleInvalidRecipient(address recipient); /// @dev The sender is not authorized to withdraw ETH gained from primary sales error SaleWithdrawUnauthorized(); /// @dev The address that receives all primary sales value. address private recipient; /// @dev Returns primary sale recipient address. function primarySaleRecipient() public view override returns (address) { return recipient; } /** * @notice Updates primary sale recipient. * @dev Caller should be authorized to set primary sales info. * See {_canSetPrimarySaleRecipient}. * Emits {PrimarySaleRecipientUpdated Event}; See {_setupPrimarySaleRecipient}. * * @param _saleRecipient Address to be set as new recipient of primary sales. */ function setPrimarySaleRecipient(address _saleRecipient) external override { if (!_canSetPrimarySaleRecipient()) { revert PrimarySaleUnauthorized(); } _setupPrimarySaleRecipient(_saleRecipient); } /// @dev Lets a contract admin set the recipient for all primary sales. function _setupPrimarySaleRecipient( address _saleRecipient ) internal virtual { if (_saleRecipient == address(0)) { revert PrimarySaleInvalidRecipient(_saleRecipient); } recipient = _saleRecipient; emit PrimarySaleRecipientUpdated(_saleRecipient); } /// @dev Returns whether primary sale recipient can be set in the given execution context. function _canSetPrimarySaleRecipient() internal view virtual returns (bool); /** * @notice Withdraws ETH or ERC20 tokens from the contract. * @dev Caller should be authorized to withdraw ETH or ERC20 tokens. * See {_canWithdrawSale}. * Emits {SaleWithdrawn Event}; See {_withdrawSale}. * * @param _tokenAddress Address of the token to withdraw. Zero address for Native ETH. */ function withdrawSale(address _tokenAddress) external { if (!_canWithdrawSale()) { revert SaleWithdrawUnauthorized(); } if (_tokenAddress == address(0)) { uint256 balance = address(this).balance; (bool success, ) = payable(recipient).call{value: balance}(""); require(success, "ETH transfer failed"); } else { uint256 balance = IERC20(_tokenAddress).balanceOf(address(this)); bool success = IERC20(_tokenAddress).transfer(recipient, balance); require(success, "Token transfer failed"); } emit SaleWithdrawn(recipient, _tokenAddress); } function _canWithdrawSale() internal view virtual returns (bool); // 64 slots reserved for future upgrades uint256[64] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import {MintableERC721AC} from "./vendor/MintableERC721AC.sol"; contract Totem is MintableERC721AC { constructor( string memory _name, string memory _symbol, string memory _baseTokenURI, string memory _contractURI, address _initialOwner, address _royaltyReceiver, uint96 _feeNumerator ) MintableERC721AC( _name, _symbol, _baseTokenURI, _contractURI, _initialOwner, _royaltyReceiver, _feeNumerator ) {} function nextTokenId() external view returns (uint256) { return _nextTokenId(); } function setRoyaltyInfo( address _receiver, uint96 _feeNumerator ) external onlyOwner { _setDefaultRoyalty(_receiver, _feeNumerator); } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; // 0x97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929 bytes32 constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import {ISalesManager} from "./interface/ISalesManager.sol"; import {Totem} from "./Totem.sol"; abstract contract SalesManagerStorage { uint256 internal _currentSeasonIndex; // Season number => Season config mapping(uint256 => ISalesManager.Season) public seasons; // Season number => user => ClaimState mapping(uint256 => mapping(address => ISalesManager.ClaimState)) public userClaimState; // tokenId => season number mapping(uint256 => uint256) public tokenSeasonAffiliation; Totem public totemToken; // 64 reserved slots for upgrades uint256[64] internal __gap; }
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; import {ISalesManagerEvents} from "./ISalesManagerEvents.sol"; interface ISalesManager is ISalesManagerEvents { struct SaleCondition { // First slot (32 bytes) uint32 whitelistSaleStartTime; // 4 bytes uint32 publicSaleStartTime; // 4 bytes uint32 saleEndTime; // 4 bytes uint8 whitelistSaleClaimAmountLimit; // 1 byte uint8 publicSaleClaimAmountLimit; // 1 byte // 18 bytes remaining in first slot // Second slot (32 bytes) uint256 mintPrice; // 32 bytes // Third slot (32 bytes) bytes32 merkleRoot; // 32 bytes } struct Season { uint128 maxSupply; uint128 mintedSupply; SaleCondition saleCondition; bool isSaleDisabled; } struct ClaimState { uint8 whitelistClaimed; uint8 publicClaimed; } /** * @notice Starts a new season. * @param maxSupply The maximum supply of the season. * @param mintPrice The mint price of the season. * @param merkleRoot The Merkle root of the season. * @param whitelistSaleStartTime The start time of the whitelist sale. * @param publicSaleStartTime The start time of the public sale. * @param saleEndTime The end time of the sale. * @param whitelistSaleClaimAmountLimit The claim amount limit for the whitelist sale. * @param publicSaleClaimAmountLimit The claim amount limit for the public sale. */ function startNewSeason( uint128 maxSupply, uint256 mintPrice, bytes32 merkleRoot, uint32 whitelistSaleStartTime, uint32 publicSaleStartTime, uint32 saleEndTime, uint8 whitelistSaleClaimAmountLimit, uint8 publicSaleClaimAmountLimit ) external; /** * @notice Mints a new Totem token. * @param amount The amount of tokens to mint. * @param merkleProof The Merkle proof supplied if there is a whitelist sale. */ function mintTokens( uint128 amount, bytes32[] calldata merkleProof, address recipient ) external payable; /** * @notice Sets the sale status of a season. * @param season The season number. * @param isSaleDisabled Whether the sale is disabled. */ function setSeasonSaleStatus(uint256 season, bool isSaleDisabled) external; /** * @notice Updates the Merkle root for a season. * @dev This is in case the whitelisted users must be updated. * @param season The season number. * @param merkleRoot The new Merkle root. */ function setUpdateMerkleRoot(uint256 season, bytes32 merkleRoot) external; /** * @notice Updates the sale time for a season. This should be used sparingly, * as it will affect the sale conditions for all users. * @param season The season number. * @param whitelistSaleStartTime The start time of the whitelist sale. * @param publicSaleStartTime The start time of the public sale. * @param saleEndTime The end time of the sale. */ function setSeasonSaleTime( uint256 season, uint32 whitelistSaleStartTime, uint32 publicSaleStartTime, uint32 saleEndTime ) external; /** * @notice Returns the current season number. */ function currentActiveSeason() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {ISalesManagerEvents} from "../interface/ISalesManagerEvents.sol"; import {ISalesManager} from "../interface/ISalesManager.sol"; library ParamValidators { /** * @notice Validates the sale time. * @param whitelistSaleStartTime The start time of the whitelist sale. * @param publicSaleStartTime The start time of the public sale. * @param saleEndTime The end time of the sale. * @param currentTime The current time. */ function checkIsValidSaleTime( uint128 whitelistSaleStartTime, uint128 publicSaleStartTime, uint128 saleEndTime, uint256 currentTime ) internal pure { if (whitelistSaleStartTime >= publicSaleStartTime) revert ISalesManagerEvents.InvalidWhitelistTime(); if (publicSaleStartTime >= saleEndTime) revert ISalesManagerEvents.InvalidPublicTime(); if (saleEndTime <= currentTime) revert ISalesManagerEvents.InvalidSaleEndTime(); } /// @dev Checks whether the mint price is valid. Valid if the mint price is greater than 0. function checkIsValidMintPrice(uint256 mintPrice) internal pure { if (mintPrice == 0) revert ISalesManagerEvents.InvalidMintPrice(); } /** * @notice Ensure the input season is valid. A season is valid if it has been created. * @param season The season. * @param currentSeason The current season. */ function checkIsValidSeason( uint256 season, uint256 currentSeason ) internal pure { if (season == 0 || season > currentSeason) revert ISalesManagerEvents.InvalidSeason(); } /** * @notice Checks if the address is not zero address. * @param addressToCheck The address to check. */ function checkIsNonZeroAddress(address addressToCheck) internal pure { if (addressToCheck == address(0)) revert ISalesManagerEvents.ZeroAddress(); } /** * @notice Checks if the latest season has ended. Check is skipped when creating the first season. * @param seasons Storage of all seasons. * @param currentSeason The current season. * @param currentTimestamp The current timestamp. */ function checkLatestSeasonEnded( mapping(uint256 => ISalesManager.Season) storage seasons, uint256 currentSeason, uint256 currentTimestamp ) internal view { if (currentSeason == 0) return; if (currentTimestamp < seasons[currentSeason].saleCondition.saleEndTime) revert ISalesManagerEvents.PreviousSeasonNotEnded(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * Thirdweb's `Primary` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about * primary sales, if desired. */ interface IPrimarySale { /// @dev The adress that receives all primary sales value. function primarySaleRecipient() external view returns (address); /// @dev Lets a module admin set the default recipient of all primary sales. function setPrimarySaleRecipient(address _saleRecipient) external; /// @dev Emitted when a new sale recipient is set. event PrimarySaleRecipientUpdated(address indexed recipient); /// @dev Emitted when a sale is withdrawn. event SaleWithdrawn(address recipient, address tokenAddress); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.22; import {ERC721A} from "erc721a/contracts/ERC721A.sol"; import {ERC721AC} from "@limitbreak/creator-token-standards/src/erc721c/ERC721AC.sol"; import {BasicRoyalties} from "@limitbreak/creator-token-standards/src/programmable-royalties/BasicRoyalties.sol"; import {OwnableBasic} from "@limitbreak/creator-token-standards/src/access/OwnableBasic.sol"; import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol"; import {AccessControlEnumerable, IAccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; /** * @title Mintable ERC721AC * @notice This contract is a base contract for ERC721AC tokens that allows for minting tokens to multiple addresses and enforces royalties */ abstract contract MintableERC721AC is OwnableBasic, AccessControlEnumerable, ERC721AC, BasicRoyalties { using Strings for uint256; /// @dev Role to be granted to addresses that can mint tokens to accounts bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); /// @dev Role to be granted to admin addresses bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); /// @dev Base token URI for the NFT Metadata string internal _baseTokenURI; /// @dev Contract URI string internal _contractURI; /// @dev Error thrown when the number of addresses amounts in a batch mint do not match error BatchAmountMismatch(); /// @dev Error thrown when the token being queried does not exist error TokenDoesNotExist(); /// @dev Error thrown when the caller is not the owner of the token error NotTokenOwner(); /// @dev Error thrown when the query range is invalid error InvalidQueryRange(); /// @dev Event emitted when a token is minted event Mint(address indexed to, uint256 indexed tokenId); /// @dev Event emitted when a token is burned event Burn(address indexed to, uint256 indexed tokenId); /** * @param name_ The name of the token * @param symbol_ The symbol of the token * @param baseTokenURI_ The base token URI for the token metadata * @param contractURI_ The contract URI * @param initialOwner_ The initial owner of the contract * @param royaltyReceiver_ The receiver of the royalty fees * @param feeNumerator_ The default royalty fee numerator */ constructor( string memory name_, string memory symbol_, string memory baseTokenURI_, string memory contractURI_, address initialOwner_, address royaltyReceiver_, uint96 feeNumerator_ ) ERC721AC(name_, symbol_) BasicRoyalties(royaltyReceiver_, feeNumerator_) Ownable(initialOwner_) { _setRoleAdmin(MINTER_ROLE, DEFAULT_ADMIN_ROLE); _setRoleAdmin(ADMIN_ROLE, DEFAULT_ADMIN_ROLE); _grantRole(DEFAULT_ADMIN_ROLE, initialOwner_); _baseTokenURI = baseTokenURI_; _contractURI = contractURI_; } /** * @dev Mint tokens to an address as an account with the MINTER_ROLE * @param to The address to mint tokens to * @param amount The amount of tokens to mint */ function mintTo(address to, uint256 amount) external onlyRole(MINTER_ROLE) { _safeMint(to, amount); emit Mint(to, amount); } /** * @dev Mint tokens to multiple addresses as an account with the MINTER_ROLE * @param tos The addresses to mint tokens to * @param amounts The amounts of tokens to mint to each address */ function batchMintTo( address[] calldata tos, uint256[] calldata amounts ) external onlyRole(MINTER_ROLE) { if (tos.length != amounts.length) { revert BatchAmountMismatch(); } for (uint256 i = 0; i < tos.length; i++) { _safeMint(tos[i], amounts[i]); emit Mint(tos[i], amounts[i]); } } /** * @dev Burn a token as the owner of the token * @param tokenId The ID of the token to burn */ function burn(uint256 tokenId) external { if (ownerOf(tokenId) != msg.sender) revert NotTokenOwner(); _burn(tokenId); emit Burn(msg.sender, tokenId); } /** * @dev Batch burn tokens as the owner of the tokens * @param tokenIds The IDs of the tokens to burn */ function batchBurn(uint256[] calldata tokenIds) external { uint256 i = 0; uint256 length = tokenIds.length; for (i; i < length; ++i) { if (ownerOf(tokenIds[i]) != msg.sender) revert NotTokenOwner(); _burn(tokenIds[i]); emit Burn(msg.sender, tokenIds[i]); } } /** * @dev Overrides the base URI for the token metadata * @return The base URI for the token metadata */ function _baseURI() internal view override returns (string memory) { return _baseTokenURI; } /** * @dev Sets the base URI for the token metadata * @param baseURI The base URI for the token metadata */ function setBaseURI(string memory baseURI) external onlyRole(ADMIN_ROLE) { _baseTokenURI = baseURI; } /** * @dev Returns the base URI for the token metadata * @return The base URI for the token metadata */ function baseTokenURI() external view returns (string memory) { return _baseTokenURI; } /** * @dev Returns the token URI for a given token ID * @param tokenId The ID of the token * @return The token URI for the token */ function tokenURI( uint256 tokenId ) public view override returns (string memory) { if (!_exists(tokenId)) revert TokenDoesNotExist(); return string(abi.encodePacked(_baseURI(), tokenId.toString())); } /** * @dev Sets the contract URI * @param contractURI_ The contract URI */ function setContractURI( string memory contractURI_ ) external onlyRole(ADMIN_ROLE) { _contractURI = contractURI_; } /** * @dev Returns the contract URI * @return The contract URI */ function contractURI() external view returns (string memory) { return _contractURI; } /** * @dev Sets the default royalty for the contract * @param receiver The address of the receiver of the royalty fees * @param feeNumerator The default royalty fee numerator */ function setDefaultRoyalty( address receiver, uint96 feeNumerator ) external onlyRole(ADMIN_ROLE) { _setDefaultRoyalty(receiver, feeNumerator); } /** * @dev Sets the royalty for a token * @param tokenId The ID of the token * @param receiver The address of the receiver of the royalty fees * @param feeNumerator The royalty fee numerator */ function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) external onlyRole(ADMIN_ROLE) { _setTokenRoyalty(tokenId, receiver, feeNumerator); } /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf( uint256 tokenId ) public view virtual returns (TokenOwnership memory ownership) { unchecked { if (tokenId >= _startTokenId()) { if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId); if (tokenId < _nextTokenId()) { // If the `tokenId` is within bounds, // scan backwards for the initialized ownership slot. while (!_ownershipIsInitialized(tokenId)) --tokenId; return _ownershipAt(tokenId); } } } } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf( uint256[] calldata tokenIds ) external view virtual returns (TokenOwnership[] memory) { TokenOwnership[] memory ownerships; uint256 i = tokenIds.length; assembly { // Grab the free memory pointer. ownerships := mload(0x40) // Store the length. mstore(ownerships, i) // Allocate one word for the length, // `tokenIds.length` words for the pointers. i := shl(5, i) // Multiply `i` by 32. mstore(0x40, add(add(ownerships, 0x20), i)) } while (i != 0) { uint256 tokenId; assembly { i := sub(i, 0x20) tokenId := calldataload(add(tokenIds.offset, i)) } TokenOwnership memory ownership = explicitOwnershipOf(tokenId); assembly { // Store the pointer of `ownership` in the `ownerships` array. mstore(add(add(ownerships, 0x20), i), ownership) } } return ownerships; } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual returns (uint256[] memory) { return _tokensOfOwnerIn(owner, start, stop); } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner( address owner ) external view virtual returns (uint256[] memory) { // If spot mints are enabled, full-range scan is disabled. if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector); uint256 start = _startTokenId(); uint256 stop = _nextTokenId(); uint256[] memory tokenIds; if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop); return tokenIds; } /** * @dev Helper function for returning an array of token IDs owned by `owner`. * * Note that this function is optimized for smaller bytecode size over runtime gas, * since it is meant to be called off-chain. */ function _tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) private view returns (uint256[] memory tokenIds) { unchecked { if (start >= stop) _revert(InvalidQueryRange.selector); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) start = _startTokenId(); uint256 nextTokenId = _nextTokenId(); // If spot mints are enabled, scan all the way until the specified `stop`. uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId; // Set `stop = min(stop, stopLimit)`. if (stop >= stopLimit) stop = stopLimit; // Number of tokens to scan. uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength` to zero if the range contains no tokens. if (start >= stop) tokenIdsMaxLength = 0; // If there are one or more tokens to scan. if (tokenIdsMaxLength != 0) { // Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`. if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start; uint256 m; // Start of available memory. assembly { // Grab the free memory pointer. tokenIds := mload(0x40) // Allocate one word for the length, and `tokenIdsMaxLength` words // for the data. `shl(5, x)` is equivalent to `mul(32, x)`. m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1))) mstore(0x40, m) } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), // initialize `currOwnershipAddr`. // `ownership.address` will not be zero, // as `start` is clamped to the valid token ID range. if (!ownership.burned) currOwnershipAddr = ownership.addr; uint256 tokenIdsIdx; // Use a do-while, which is slightly more efficient for this case, // as the array will at least contain one element. do { if (_sequentialUpTo() != type(uint256).max) { // Skip the remaining unused sequential slots. if (start == nextTokenId) start = _sequentialUpTo() + 1; // Reset `currOwnershipAddr`, as each spot-minted token is a batch of one. if (start > _sequentialUpTo()) currOwnershipAddr = address(0); } ownership = _ownershipAt(start); // This implicitly allocates memory. assembly { switch mload(add(ownership, 0x40)) // if `ownership.burned == false`. case 0 { // if `ownership.addr != address(0)`. // The `addr` already has it's upper 96 bits clearned, // since it is written to memory with regular Solidity. if mload(ownership) { currOwnershipAddr := mload(ownership) } // if `currOwnershipAddr == owner`. // The `shl(96, x)` is to make the comparison agnostic to any // dirty upper 96 bits in `owner`. if iszero(shl(96, xor(currOwnershipAddr, owner))) { tokenIdsIdx := add(tokenIdsIdx, 1) mstore( add(tokenIds, shl(5, tokenIdsIdx)), start ) } } // Otherwise, reset `currOwnershipAddr`. // This handles the case of batch burned tokens // (burned bit of first slot set, remaining slots left uninitialized). default { currOwnershipAddr := 0 } start := add(start, 1) // Free temporary memory implicitly allocated for ownership // to avoid quadratic memory expansion costs. mstore(0x40, m) } } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength)); // Store the length of the array. assembly { mstore(tokenIds, tokenIdsIdx) } } } } /** * @dev Overrides start token ID to start from 1 * @return The start token ID */ function _startTokenId() internal view virtual override returns (uint256) { return 1; } /** * @dev Overrides supportsInterface to support IAccessControlEnumerable & ERC721AC * @param interfaceId The interface ID * @return bool True if the interface is supported, false otherwise */ function supportsInterface( bytes4 interfaceId ) public view virtual override(AccessControlEnumerable, ERC721AC, ERC2981) returns (bool) { return ERC721AC.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId) || AccessControlEnumerable.supportsInterface(interfaceId) || ERC721A.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.20; import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. */ abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable __self = address(this); /** * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)` * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called, * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string. * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function * during an upgrade. */ string public constant UPGRADE_INTERFACE_VERSION = "5.0.0"; /** * @dev The call is from an unauthorized context. */ error UUPSUnauthorizedCallContext(); /** * @dev The storage `slot` is unsupported as a UUID. */ error UUPSUnsupportedProxiableUUID(bytes32 slot); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { _checkProxy(); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { _checkNotDelegated(); _; } function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual notDelegated returns (bytes32) { return ERC1967Utils.IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data); } /** * @dev Reverts if the execution is not performed via delegatecall or the execution * context is not of a proxy with an ERC1967-compliant implementation pointing to self. * See {_onlyProxy}. */ function _checkProxy() internal view virtual { if ( address(this) == __self || // Must be called through delegatecall ERC1967Utils.getImplementation() != __self // Must be called through an active proxy ) { revert UUPSUnauthorizedCallContext(); } } /** * @dev Reverts if the execution is performed via delegatecall. * See {notDelegated}. */ function _checkNotDelegated() internal view virtual { if (address(this) != __self) { // Must not be called through delegatecall revert UUPSUnauthorizedCallContext(); } } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call. * * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value * is expected to be the implementation slot in ERC1967. * * Emits an {IERC1967-Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) { revert UUPSUnsupportedProxiableUUID(slot); } ERC1967Utils.upgradeToAndCall(newImplementation, data); } catch { // The implementation is not UUPS revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation); } } }
// SPDX-License-Identifier: MIT pragma solidity =0.8.24; interface ISalesManagerEvents { error InvalidWhitelistTime(); error InvalidPublicTime(); error InvalidSaleEndTime(); error InvalidMintPrice(); error SaleDisabled(); error SaleEnded(); error SaleNotActive(); error MaxSupplyReached(); error NotWhitelisted(); error InvalidPayment(uint256 expected, uint256 received); error TokenDoesNotExist(); error InvalidSeason(); error InvalidMerkleRoot(); error RoyaltyFeeExceedsMax(); error ZeroAddress(); error NoPreviousSeason(); error PreviousSeasonNotEnded(); error MerkleRootDoesNotExist(); error ClaimAmountLimitReached(bool isWhitelistSale, uint256 claimedAmount); event SeasonCreated(uint256 season); event SeasonSaleDisabled(uint256 season); event SeasonSaleUserLimitUpdated( uint256 season, uint8 whitelistSaleClaimAmountLimit, uint8 publicSaleClaimAmountLimit ); event TokenMinted( address indexed recipient, uint256 indexed tokenId, uint256 season ); event MerkleRootUpdated(uint256 season, bytes32 merkleRoot); event SeasonSaleTimeUpdated( uint256 season, uint128 whitelistSaleStartTime, uint128 publicSaleStartTime, uint128 saleEndTime ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol"; import {AccessControlUpgradeable} from "../AccessControlUpgradeable.sol"; import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerable, AccessControlUpgradeable { using EnumerableSet for EnumerableSet.AddressSet; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControlEnumerable struct AccessControlEnumerableStorage { mapping(bytes32 role => EnumerableSet.AddressSet) _roleMembers; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControlEnumerable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlEnumerableStorageLocation = 0xc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000; function _getAccessControlEnumerableStorage() private pure returns (AccessControlEnumerableStorage storage $) { assembly { $.slot := AccessControlEnumerableStorageLocation } } function __AccessControlEnumerable_init() internal onlyInitializing { } function __AccessControlEnumerable_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) { AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage(); return $._roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) { AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage(); return $._roleMembers[role].length(); } /** * @dev Overload {AccessControl-_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage(); bool granted = super._grantRole(role, account); if (granted) { $._roleMembers[role].add(account); } return granted; } /** * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage(); bool revoked = super._revokeRole(role, account); if (revoked) { $._roleMembers[role].remove(account); } return revoked; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * The `_sequentialUpTo()` function can be overriden to enable spot mints * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // The amount of tokens minted above `_sequentialUpTo()`. // We call these spot mints (i.e. non-sequential mints). uint256 private _spotMinted; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID for sequential mints. * * Override this function to change the starting token ID for sequential mints. * * Note: The value returned must never change after any tokens have been minted. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the maximum token ID (inclusive) for sequential mints. * * Override this function to return a value less than 2**256 - 1, * but greater than `_startTokenId()`, to enable spot (non-sequential) mints. * * Note: The value returned must never change after any tokens have been minted. */ function _sequentialUpTo() internal view virtual returns (uint256) { return type(uint256).max; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256 result) { // Counter underflow is impossible as `_burnCounter` cannot be incremented // more than `_currentIndex + _spotMinted - _startTokenId()` times. unchecked { // With spot minting, the intermediate `result` can be temporarily negative, // and the computation must be unchecked. result = _currentIndex - _burnCounter - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256 result) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { result = _currentIndex - _startTokenId(); if (_sequentialUpTo() != type(uint256).max) result += _spotMinted; } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } /** * @dev Returns the total number of tokens that are spot-minted. */ function _totalSpotMinted() internal view virtual returns (uint256) { return _spotMinted; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Returns whether the ownership slot at `index` is initialized. * An uninitialized slot does not necessarily mean that the slot has no owner. */ function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) { return _packedOwnerships[index] != 0; } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * @dev Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = _packedOwnerships[tokenId]; if (tokenId > _sequentialUpTo()) { if (_packedOwnershipExists(packed)) return packed; _revert(OwnerQueryForNonexistentToken.selector); } // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= _currentIndex) _revert(OwnerQueryForNonexistentToken.selector); // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = _packedOwnerships[--tokenId]; } if (packed == 0) continue; if (packed & _BITMASK_BURNED == 0) return packed; // Otherwise, the token is burned, and we must revert. // This handles the case of batch burned tokens, where only the burned bit // of the starting slot is set, and remaining slots are left uninitialized. _revert(OwnerQueryForNonexistentToken.selector); } } // Otherwise, the data exists and we can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. // If the token is not burned, return `packed`. Otherwise, revert. if (packed & _BITMASK_BURNED == 0) return packed; } _revert(OwnerQueryForNonexistentToken.selector); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) _revert(ApprovalQueryForNonexistentToken.selector); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool result) { if (_startTokenId() <= tokenId) { if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]); if (tokenId < _currentIndex) { uint256 packed; while ((packed = _packedOwnerships[tokenId]) == 0) --tokenId; result = packed & _BITMASK_BURNED == 0; } } } /** * @dev Returns whether `packed` represents a token that exists. */ function _packedOwnershipExists(uint256 packed) private pure returns (bool result) { assembly { // The following is equivalent to `owner != address(0) && burned == false`. // Symbolically tested. result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED)) } } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS)); if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. from, // `from`. toMasked, // `to`. tokenId // `tokenId`. ) } if (toMasked == 0) _revert(TransferToZeroAddress.selector); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC721ReceiverImplementer.selector); } assembly { revert(add(32, reason), mload(reason)) } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) _revert(MintZeroQuantity.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); uint256 end = startTokenId + quantity; uint256 tokenId = startTokenId; if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); do { assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } // The `!=` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. } while (++tokenId != end); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) _revert(MintToZeroAddress.selector); if (quantity == 0) _revert(MintZeroQuantity.selector); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } while (index < end); // This prevents reentrancy to `_safeMint`. // It does not prevent reentrancy to `_safeMintSpot`. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } /** * @dev Mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * Emits a {Transfer} event for each mint. */ function _mintSpot(address to, uint256 tokenId) internal virtual { if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector); uint256 prevOwnershipPacked = _packedOwnerships[tokenId]; if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector); _beforeTokenTransfers(address(0), to, tokenId, 1); // Overflows are incredibly unrealistic. // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1. // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1. unchecked { // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `true` (as `quantity == 1`). _packedOwnerships[tokenId] = _packOwnershipData( to, _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked) ); // Updates: // - `balance += 1`. // - `numberMinted += 1`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1; // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); assembly { // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. tokenId // `tokenId`. ) } ++_spotMinted; } _afterTokenTransfers(address(0), to, tokenId, 1); } /** * @dev Safely mints a single token at `tokenId`. * * Note: A spot-minted `tokenId` that has been burned can be re-minted again. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}. * - `tokenId` must be greater than `_sequentialUpTo()`. * - `tokenId` must not exist. * * See {_mintSpot}. * * Emits a {Transfer} event. */ function _safeMintSpot( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mintSpot(to, tokenId); unchecked { if (to.code.length != 0) { uint256 currentSpotMinted = _spotMinted; if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } // This prevents reentrancy to `_safeMintSpot`. // It does not prevent reentrancy to `_safeMint`. if (_spotMinted != currentSpotMinted) revert(); } } } /** * @dev Equivalent to `_safeMintSpot(to, tokenId, '')`. */ function _safeMintSpot(address to, uint256 tokenId) internal virtual { _safeMintSpot(to, tokenId, ''); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck && _msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { _revert(ApprovalCallerNotOwnerNorApproved.selector); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) _revert(TransferCallerNotOwnerNorApproved.selector); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.20; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../utils/AutomaticValidatorTransferApproval.sol"; import "../utils/CreatorTokenBase.sol"; import "erc721a/contracts/ERC721A.sol"; import {TOKEN_TYPE_ERC721} from "@limitbreak/permit-c/src/Constants.sol"; /** * @title ERC721AC * @author Limit Break, Inc. * @notice Extends Azuki's ERC721-A implementation with Creator Token functionality, which * allows the contract owner to update the transfer validation logic by managing a security policy in * an external transfer validation security policy registry. See {CreatorTokenTransferValidator}. */ abstract contract ERC721AC is ERC721A, CreatorTokenBase, AutomaticValidatorTransferApproval { constructor(string memory name_, string memory symbol_) CreatorTokenBase() ERC721A(name_, symbol_) {} /** * @notice Overrides behavior of isApprovedFor all such that if an operator is not explicitly approved * for all, the contract owner can optionally auto-approve the 721-C transfer validator for transfers. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool isApproved) { isApproved = super.isApprovedForAll(owner, operator); if (!isApproved) { if (autoApproveTransfersFromValidator) { isApproved = operator == address(getTransferValidator()); } } } /** * @notice Indicates whether the contract implements the specified interface. * @dev Overrides supportsInterface in ERC165. * @param interfaceId The interface id * @return true if the contract implements the specified interface, false otherwise */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(ICreatorToken).interfaceId || interfaceId == type(ICreatorTokenLegacy).interfaceId || super.supportsInterface(interfaceId); } /** * @notice Returns the function selector for the transfer validator's validation function to be called * @notice for transaction simulation. */ function getTransferValidationFunction() external pure returns (bytes4 functionSignature, bool isViewFunction) { functionSignature = bytes4(keccak256("validateTransfer(address,address,address,uint256)")); isViewFunction = true; } /// @dev Ties the erc721a _beforeTokenTransfers hook to more granular transfer validation logic function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override { for (uint256 i = 0; i < quantity;) { _validateBeforeTransfer(from, to, startTokenId + i); unchecked { ++i; } } } /// @dev Ties the erc721a _afterTokenTransfer hook to more granular transfer validation logic function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override { for (uint256 i = 0; i < quantity;) { _validateAfterTransfer(from, to, startTokenId + i); unchecked { ++i; } } } function _msgSenderERC721A() internal view virtual override returns (address) { return _msgSender(); } function _tokenType() internal pure override returns(uint16) { return uint16(TOKEN_TYPE_ERC721); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol) pragma solidity ^0.8.20; import {IERC2981} from "../../interfaces/IERC2981.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator); /** * @dev The default royalty receiver is invalid. */ error ERC2981InvalidDefaultRoyaltyReceiver(address receiver); /** * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1). */ error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator); /** * @dev The royalty receiver for `tokenId` is invalid. */ error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver); /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidDefaultRoyaltyReceiver(address(0)); } _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 denominator = _feeDenominator(); if (feeNumerator > denominator) { // Royalty fee will exceed the sale price revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator); } if (receiver == address(0)) { revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0)); } _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/common/ERC2981.sol"; /** * @title BasicRoyaltiesBase * @author Limit Break, Inc. * @dev Base functionality of an NFT mix-in contract implementing the most basic form of programmable royalties. */ abstract contract BasicRoyaltiesBase is ERC2981 { event DefaultRoyaltySet(address indexed receiver, uint96 feeNumerator); event TokenRoyaltySet(uint256 indexed tokenId, address indexed receiver, uint96 feeNumerator); function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual override { super._setDefaultRoyalty(receiver, feeNumerator); emit DefaultRoyaltySet(receiver, feeNumerator); } function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual override { super._setTokenRoyalty(tokenId, receiver, feeNumerator); emit TokenRoyaltySet(tokenId, receiver, feeNumerator); } } /** * @title BasicRoyalties * @author Limit Break, Inc. * @notice Constructable BasicRoyalties Contract implementation. */ abstract contract BasicRoyalties is BasicRoyaltiesBase { constructor(address receiver, uint96 feeNumerator) { _setDefaultRoyalty(receiver, feeNumerator); } } /** * @title BasicRoyaltiesInitializable * @author Limit Break, Inc. * @notice Initializable BasicRoyalties Contract implementation to allow for EIP-1167 clones. */ abstract contract BasicRoyaltiesInitializable is BasicRoyaltiesBase {}
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./OwnablePermissions.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract OwnableBasic is OwnablePermissions, Ownable { function _requireCallerIsContractOwner() internal view virtual override { _checkOwner(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControlEnumerable} from "./IAccessControlEnumerable.sol"; import {AccessControl} from "../AccessControl.sol"; import {EnumerableSet} from "../../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 role => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {AccessControl-_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override returns (bool) { bool granted = super._grantRole(role, account); if (granted) { _roleMembers[role].add(account); } return granted; } /** * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) { bool revoked = super._revokeRole(role, account); if (revoked) { _roleMembers[role].remove(account); } return revoked; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol) pragma solidity ^0.8.20; import {IBeacon} from "../beacon/IBeacon.sol"; import {Address} from "../../utils/Address.sol"; import {StorageSlot} from "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. */ library ERC1967Utils { // We re-declare ERC-1967 events here because they can't be used directly from IERC1967. // This will be fixed in Solidity 0.8.21. At that point we should remove these events. /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev The `implementation` of the proxy is invalid. */ error ERC1967InvalidImplementation(address implementation); /** * @dev The `admin` of the proxy is invalid. */ error ERC1967InvalidAdmin(address admin); /** * @dev The `beacon` of the proxy is invalid. */ error ERC1967InvalidBeacon(address beacon); /** * @dev An upgrade function sees `msg.value > 0` that may be lost. */ error ERC1967NonPayable(); /** * @dev Returns the current implementation address. */ function getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert ERC1967InvalidImplementation(newImplementation); } StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Performs implementation upgrade with additional setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { Address.functionDelegateCall(newImplementation, data); } else { _checkNonPayable(); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { if (newAdmin == address(0)) { revert ERC1967InvalidAdmin(address(0)); } StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {IERC1967-AdminChanged} event. */ function changeAdmin(address newAdmin) internal { emit AdminChanged(getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1. */ // solhint-disable-next-line private-vars-leading-underscore bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { if (newBeacon.code.length == 0) { revert ERC1967InvalidBeacon(newBeacon); } StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon; address beaconImplementation = IBeacon(newBeacon).implementation(); if (beaconImplementation.code.length == 0) { revert ERC1967InvalidImplementation(beaconImplementation); } } /** * @dev Change the beacon and trigger a setup call if data is nonempty. * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected * to avoid stuck value in the contract. * * Emits an {IERC1967-BeaconUpgraded} event. * * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for * efficiency. */ function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } else { _checkNonPayable(); } } /** * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract * if an upgrade doesn't perform an initialization call. */ function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967NonPayable(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol) pragma solidity ^0.8.20; import {IAccessControl} from "../IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); /** * `_sequentialUpTo()` must be greater than `_startTokenId()`. */ error SequentialUpToTooSmall(); /** * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`. */ error SequentialMintExceedsLimit(); /** * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`. */ error SpotMintTokenIdTooSmall(); /** * Cannot mint over a token that already exists. */ error TokenAlreadyExists(); /** * The feature is not compatible with spot mints. */ error NotCompatibleWithSpotMints(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @dev Constant bytes32 value of 0x000...000 bytes32 constant ZERO_BYTES32 = bytes32(0); /// @dev Constant value of 0 uint256 constant ZERO = 0; /// @dev Constant value of 1 uint256 constant ONE = 1; /// @dev Constant value representing an open order in storage uint8 constant ORDER_STATE_OPEN = 0; /// @dev Constant value representing a filled order in storage uint8 constant ORDER_STATE_FILLED = 1; /// @dev Constant value representing a cancelled order in storage uint8 constant ORDER_STATE_CANCELLED = 2; /// @dev Constant value representing the ERC721 token type for signatures and transfer hooks uint256 constant TOKEN_TYPE_ERC721 = 721; /// @dev Constant value representing the ERC1155 token type for signatures and transfer hooks uint256 constant TOKEN_TYPE_ERC1155 = 1155; /// @dev Constant value representing the ERC20 token type for signatures and transfer hooks uint256 constant TOKEN_TYPE_ERC20 = 20; /// @dev Constant value to mask the upper bits of a signature that uses a packed `vs` value to extract `s` bytes32 constant UPPER_BIT_MASK = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @dev EIP-712 typehash used for validating signature based stored approvals bytes32 constant UPDATE_APPROVAL_TYPEHASH = keccak256("UpdateApprovalBySignature(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 approvalExpiration,uint256 sigDeadline,uint256 masterNonce)"); /// @dev EIP-712 typehash used for validating a single use permit without additional data bytes32 constant SINGLE_USE_PERMIT_TYPEHASH = keccak256("PermitTransferFrom(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 expiration,uint256 masterNonce)"); /// @dev EIP-712 typehash used for validating a single use permit with additional data string constant SINGLE_USE_PERMIT_TRANSFER_ADVANCED_TYPEHASH_STUB = "PermitTransferFromWithAdditionalData(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 nonce,address operator,uint256 expiration,uint256 masterNonce,"; /// @dev EIP-712 typehash used for validating an order permit that updates storage as it fills string constant PERMIT_ORDER_ADVANCED_TYPEHASH_STUB = "PermitOrderWithAdditionalData(uint256 tokenType,address token,uint256 id,uint256 amount,uint256 salt,address operator,uint256 expiration,uint256 masterNonce,"; /// @dev Pausable flag for stored approval transfers of ERC721 assets uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC721 = 1 << 0; /// @dev Pausable flag for stored approval transfers of ERC1155 assets uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC1155 = 1 << 1; /// @dev Pausable flag for stored approval transfers of ERC20 assets uint256 constant PAUSABLE_APPROVAL_TRANSFER_FROM_ERC20 = 1 << 2; /// @dev Pausable flag for single use permit transfers of ERC721 assets uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC721 = 1 << 3; /// @dev Pausable flag for single use permit transfers of ERC1155 assets uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC1155 = 1 << 4; /// @dev Pausable flag for single use permit transfers of ERC20 assets uint256 constant PAUSABLE_PERMITTED_TRANSFER_FROM_ERC20 = 1 << 5; /// @dev Pausable flag for order fill transfers of ERC1155 assets uint256 constant PAUSABLE_ORDER_TRANSFER_FROM_ERC1155 = 1 << 6; /// @dev Pausable flag for order fill transfers of ERC20 assets uint256 constant PAUSABLE_ORDER_TRANSFER_FROM_ERC20 = 1 << 7;
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../access/OwnablePermissions.sol"; import "../interfaces/ICreatorToken.sol"; import "../interfaces/ICreatorTokenLegacy.sol"; import "../interfaces/ITransferValidator.sol"; import "./TransferValidation.sol"; import "../interfaces/ITransferValidatorSetTokenType.sol"; /** * @title CreatorTokenBase * @author Limit Break, Inc. * @notice CreatorTokenBaseV3 is an abstract contract that provides basic functionality for managing token * transfer policies through an implementation of ICreatorTokenTransferValidator/ICreatorTokenTransferValidatorV2/ICreatorTokenTransferValidatorV3. * This contract is intended to be used as a base for creator-specific token contracts, enabling customizable transfer * restrictions and security policies. * * <h4>Features:</h4> * <ul>Ownable: This contract can have an owner who can set and update the transfer validator.</ul> * <ul>TransferValidation: Implements the basic token transfer validation interface.</ul> * * <h4>Benefits:</h4> * <ul>Provides a flexible and modular way to implement custom token transfer restrictions and security policies.</ul> * <ul>Allows creators to enforce policies such as account and codehash blacklists, whitelists, and graylists.</ul> * <ul>Can be easily integrated into other token contracts as a base contract.</ul> * * <h4>Intended Usage:</h4> * <ul>Use as a base contract for creator token implementations that require advanced transfer restrictions and * security policies.</ul> * <ul>Set and update the ICreatorTokenTransferValidator implementation contract to enforce desired policies for the * creator token.</ul> * * <h4>Compatibility:</h4> * <ul>Backward and Forward Compatible - V1/V2/V3 Creator Token Base will work with V1/V2/V3 Transfer Validators.</ul> */ abstract contract CreatorTokenBase is OwnablePermissions, TransferValidation, ICreatorToken { /// @dev Thrown when setting a transfer validator address that has no deployed code. error CreatorTokenBase__InvalidTransferValidatorContract(); /// @dev The default transfer validator that will be used if no transfer validator has been set by the creator. address public constant DEFAULT_TRANSFER_VALIDATOR = address(0x721C002B0059009a671D00aD1700c9748146cd1B); /// @dev Used to determine if the default transfer validator is applied. /// @dev Set to true when the creator sets a transfer validator address. bool private isValidatorInitialized; /// @dev Address of the transfer validator to apply to transactions. address private transferValidator; constructor() { _emitDefaultTransferValidator(); _registerTokenType(DEFAULT_TRANSFER_VALIDATOR); } /** * @notice Sets the transfer validator for the token contract. * * @dev Throws when provided validator contract is not the zero address and does not have code. * @dev Throws when the caller is not the contract owner. * * @dev <h4>Postconditions:</h4> * 1. The transferValidator address is updated. * 2. The `TransferValidatorUpdated` event is emitted. * * @param transferValidator_ The address of the transfer validator contract. */ function setTransferValidator(address transferValidator_) public { _requireCallerIsContractOwner(); bool isValidTransferValidator = transferValidator_.code.length > 0; if(transferValidator_ != address(0) && !isValidTransferValidator) { revert CreatorTokenBase__InvalidTransferValidatorContract(); } emit TransferValidatorUpdated(address(getTransferValidator()), transferValidator_); isValidatorInitialized = true; transferValidator = transferValidator_; _registerTokenType(transferValidator_); } /** * @notice Returns the transfer validator contract address for this token contract. */ function getTransferValidator() public view override returns (address validator) { validator = transferValidator; if (validator == address(0)) { if (!isValidatorInitialized) { validator = DEFAULT_TRANSFER_VALIDATOR; } } } /** * @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy. * Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent * and calling _validateBeforeTransfer so that checks can be properly applied during token transfers. * * @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the * transfer validator is expected to pre-validate the transfer. * * @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is * set to a non-zero address. * * @param caller The address of the caller. * @param from The address of the sender. * @param to The address of the receiver. * @param tokenId The token id being transferred. */ function _preValidateTransfer( address caller, address from, address to, uint256 tokenId, uint256 /*value*/) internal virtual override { address validator = getTransferValidator(); if (validator != address(0)) { if (msg.sender == validator) { return; } ITransferValidator(validator).validateTransfer(caller, from, to, tokenId); } } /** * @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy. * Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent * and calling _validateBeforeTransfer so that checks can be properly applied during token transfers. * * @dev Be aware that if the msg.sender is the transfer validator, the transfer is automatically permitted, as the * transfer validator is expected to pre-validate the transfer. * * @dev Used for ERC20 and ERC1155 token transfers which have an amount value to validate in the transfer validator. * @dev The `tokenId` for ERC20 tokens should be set to `0`. * * @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is * set to a non-zero address. * * @param caller The address of the caller. * @param from The address of the sender. * @param to The address of the receiver. * @param tokenId The token id being transferred. * @param amount The amount of token being transferred. */ function _preValidateTransfer( address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 /*value*/) internal virtual override { address validator = getTransferValidator(); if (validator != address(0)) { if (msg.sender == validator) { return; } ITransferValidator(validator).validateTransfer(caller, from, to, tokenId, amount); } } function _tokenType() internal virtual pure returns(uint16); function _registerTokenType(address validator) internal { if (validator != address(0)) { uint256 validatorCodeSize; assembly { validatorCodeSize := extcodesize(validator) } if(validatorCodeSize > 0) { try ITransferValidatorSetTokenType(validator).setTokenTypeOfCollection(address(this), _tokenType()) { } catch { } } } } /** * @dev Used during contract deployment for constructable and cloneable creator tokens * @dev to emit the `TransferValidatorUpdated` event signaling the validator for the contract * @dev is the default transfer validator. */ function _emitDefaultTransferValidator() internal { emit TransferValidatorUpdated(address(0), DEFAULT_TRANSFER_VALIDATOR); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./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); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../access/OwnablePermissions.sol"; /** * @title AutomaticValidatorTransferApproval * @author Limit Break, Inc. * @notice Base contract mix-in that provides boilerplate code giving the contract owner the * option to automatically approve a 721-C transfer validator implementation for transfers. */ abstract contract AutomaticValidatorTransferApproval is OwnablePermissions { /// @dev Emitted when the automatic approval flag is modified by the creator. event AutomaticApprovalOfTransferValidatorSet(bool autoApproved); /// @dev If true, the collection's transfer validator is automatically approved to transfer holder's tokens. bool public autoApproveTransfersFromValidator; /** * @notice Sets if the transfer validator is automatically approved as an operator for all token owners. * * @dev Throws when the caller is not the contract owner. * * @param autoApprove If true, the collection's transfer validator will be automatically approved to * transfer holder's tokens. */ function setAutomaticApprovalOfTransfersFromValidator(bool autoApprove) external { _requireCallerIsContractOwner(); autoApproveTransfersFromValidator = autoApprove; emit AutomaticApprovalOfTransferValidatorSet(autoApprove); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/Context.sol"; abstract contract OwnablePermissions is Context { function _requireCallerIsContractOwner() internal view virtual; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement 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); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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 pragma solidity ^0.8.4; interface ITransferValidator { function applyCollectionTransferPolicy(address caller, address from, address to) external view; function validateTransfer(address caller, address from, address to) external view; function validateTransfer(address caller, address from, address to, uint256 tokenId) external view; function validateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount) external; function beforeAuthorizedTransfer(address operator, address token, uint256 tokenId) external; function afterAuthorizedTransfer(address token, uint256 tokenId) external; function beforeAuthorizedTransfer(address operator, address token) external; function afterAuthorizedTransfer(address token) external; function beforeAuthorizedTransfer(address token, uint256 tokenId) external; function beforeAuthorizedTransferWithAmount(address token, uint256 tokenId, uint256 amount) external; function afterAuthorizedTransferWithAmount(address token, uint256 tokenId) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface ICreatorTokenLegacy { event TransferValidatorUpdated(address oldValidator, address newValidator); function getTransferValidator() external view returns (address validator); function setTransferValidator(address validator) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface ICreatorToken { event TransferValidatorUpdated(address oldValidator, address newValidator); function getTransferValidator() external view returns (address validator); function setTransferValidator(address validator) external; function getTransferValidationFunction() external view returns (bytes4 functionSignature, bool isViewFunction); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface ITransferValidatorSetTokenType { function setTokenTypeOfCollection(address collection, uint16 tokenType) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/Context.sol"; /** * @title TransferValidation * @author Limit Break, Inc. * @notice A mix-in that can be combined with ERC-721 contracts to provide more granular hooks. * Openzeppelin's ERC721 contract only provides hooks for before and after transfer. This allows * developers to validate or customize transfers within the context of a mint, a burn, or a transfer. */ abstract contract TransferValidation is Context { /// @dev Thrown when the from and to address are both the zero address. error ShouldNotMintToBurnAddress(); /*************************************************************************/ /* Transfers Without Amounts */ /*************************************************************************/ /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks. function _validateBeforeTransfer(address from, address to, uint256 tokenId) internal virtual { bool fromZeroAddress = from == address(0); bool toZeroAddress = to == address(0); if(fromZeroAddress && toZeroAddress) { revert ShouldNotMintToBurnAddress(); } else if(fromZeroAddress) { _preValidateMint(_msgSender(), to, tokenId, msg.value); } else if(toZeroAddress) { _preValidateBurn(_msgSender(), from, tokenId, msg.value); } else { _preValidateTransfer(_msgSender(), from, to, tokenId, msg.value); } } /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks. function _validateAfterTransfer(address from, address to, uint256 tokenId) internal virtual { bool fromZeroAddress = from == address(0); bool toZeroAddress = to == address(0); if(fromZeroAddress && toZeroAddress) { revert ShouldNotMintToBurnAddress(); } else if(fromZeroAddress) { _postValidateMint(_msgSender(), to, tokenId, msg.value); } else if(toZeroAddress) { _postValidateBurn(_msgSender(), from, tokenId, msg.value); } else { _postValidateTransfer(_msgSender(), from, to, tokenId, msg.value); } } /// @dev Optional validation hook that fires before a mint function _preValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {} /// @dev Optional validation hook that fires after a mint function _postValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {} /// @dev Optional validation hook that fires before a burn function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {} /// @dev Optional validation hook that fires after a burn function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {} /// @dev Optional validation hook that fires before a transfer function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {} /// @dev Optional validation hook that fires after a transfer function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {} /*************************************************************************/ /* Transfers With Amounts */ /*************************************************************************/ /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks. function _validateBeforeTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual { bool fromZeroAddress = from == address(0); bool toZeroAddress = to == address(0); if(fromZeroAddress && toZeroAddress) { revert ShouldNotMintToBurnAddress(); } else if(fromZeroAddress) { _preValidateMint(_msgSender(), to, tokenId, amount, msg.value); } else if(toZeroAddress) { _preValidateBurn(_msgSender(), from, tokenId, amount, msg.value); } else { _preValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value); } } /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks. function _validateAfterTransfer(address from, address to, uint256 tokenId, uint256 amount) internal virtual { bool fromZeroAddress = from == address(0); bool toZeroAddress = to == address(0); if(fromZeroAddress && toZeroAddress) { revert ShouldNotMintToBurnAddress(); } else if(fromZeroAddress) { _postValidateMint(_msgSender(), to, tokenId, amount, msg.value); } else if(toZeroAddress) { _postValidateBurn(_msgSender(), from, tokenId, amount, msg.value); } else { _postValidateTransfer(_msgSender(), from, to, tokenId, amount, msg.value); } } /// @dev Optional validation hook that fires before a mint function _preValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {} /// @dev Optional validation hook that fires after a mint function _postValidateMint(address caller, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {} /// @dev Optional validation hook that fires before a burn function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {} /// @dev Optional validation hook that fires after a burn function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 amount, uint256 value) internal virtual {} /// @dev Optional validation hook that fires before a transfer function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {} /// @dev Optional validation hook that fires after a transfer function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 amount, uint256 value) internal virtual {} }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "mode": "3" }, "outputSelection": { "*": { "*": [ "abi", "metadata" ], "": [ "ast" ] } }, "detectMissingLibraries": false, "forceEVMLA": false, "enableEraVMExtensions": true, "libraries": {} }
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"bool","name":"isWhitelistSale","type":"bool"},{"internalType":"uint256","name":"claimedAmount","type":"uint256"}],"name":"ClaimAmountLimitReached","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidMerkleRoot","type":"error"},{"inputs":[],"name":"InvalidMintPrice","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"received","type":"uint256"}],"name":"InvalidPayment","type":"error"},{"inputs":[],"name":"InvalidPublicTime","type":"error"},{"inputs":[],"name":"InvalidSaleEndTime","type":"error"},{"inputs":[],"name":"InvalidSeason","type":"error"},{"inputs":[],"name":"InvalidWhitelistTime","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MerkleRootDoesNotExist","type":"error"},{"inputs":[],"name":"NoPreviousSeason","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"PreviousSeasonNotEnded","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"PrimarySaleInvalidRecipient","type":"error"},{"inputs":[],"name":"PrimarySaleUnauthorized","type":"error"},{"inputs":[],"name":"RoyaltyFeeExceedsMax","type":"error"},{"inputs":[],"name":"SaleDisabled","type":"error"},{"inputs":[],"name":"SaleEnded","type":"error"},{"inputs":[],"name":"SaleNotActive","type":"error"},{"inputs":[],"name":"SaleWithdrawUnauthorized","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"season","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"MerkleRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"PrimarySaleRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"tokenAddress","type":"address"}],"name":"SaleWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"season","type":"uint256"}],"name":"SeasonCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"season","type":"uint256"}],"name":"SeasonSaleDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"season","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"whitelistSaleStartTime","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"publicSaleStartTime","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"saleEndTime","type":"uint128"}],"name":"SeasonSaleTimeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"season","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"whitelistSaleClaimAmountLimit","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"publicSaleClaimAmountLimit","type":"uint8"}],"name":"SeasonSaleUserLimitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"season","type":"uint256"}],"name":"TokenMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentActiveSeason","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"defaultAdmin","type":"address"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"primarySaleRecipient","type":"address"},{"internalType":"address","name":"totemTokenAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"address","name":"recipient","type":"address"}],"name":"mintTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"primarySaleRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"seasons","outputs":[{"internalType":"uint128","name":"maxSupply","type":"uint128"},{"internalType":"uint128","name":"mintedSupply","type":"uint128"},{"components":[{"internalType":"uint32","name":"whitelistSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"publicSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"saleEndTime","type":"uint32"},{"internalType":"uint8","name":"whitelistSaleClaimAmountLimit","type":"uint8"},{"internalType":"uint8","name":"publicSaleClaimAmountLimit","type":"uint8"},{"internalType":"uint256","name":"mintPrice","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct ISalesManager.SaleCondition","name":"saleCondition","type":"tuple"},{"internalType":"bool","name":"isSaleDisabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_saleRecipient","type":"address"}],"name":"setPrimarySaleRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"bool","name":"isSaleDisabled","type":"bool"}],"name":"setSeasonSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint32","name":"whitelistSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"publicSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"saleEndTime","type":"uint32"}],"name":"setSeasonSaleTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"uint8","name":"whitelistSaleClaimAmountLimit","type":"uint8"},{"internalType":"uint8","name":"publicSaleClaimAmountLimit","type":"uint8"}],"name":"setSeasonSaleUserLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"season","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"setUpdateMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"maxSupply","type":"uint128"},{"internalType":"uint256","name":"mintPrice","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint32","name":"whitelistSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"publicSaleStartTime","type":"uint32"},{"internalType":"uint32","name":"saleEndTime","type":"uint32"},{"internalType":"uint8","name":"whitelistSaleClaimAmountLimit","type":"uint8"},{"internalType":"uint8","name":"publicSaleClaimAmountLimit","type":"uint8"}],"name":"startNewSeason","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenSeasonAffiliation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totemToken","outputs":[{"internalType":"contract Totem","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userClaimState","outputs":[{"internalType":"uint8","name":"whitelistClaimed","type":"uint8"},{"internalType":"uint8","name":"publicClaimed","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"withdrawSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
9c4d535b00000000000000000000000000000000000000000000000000000000000000000100042dace8f04f28a6ce46eb80e31e06910cb74fd1eff69eb62d1ff8bf919100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x0003000000000002000b000000000002000000600310027000000393033001970002000000310355000100000001035500000001002001900000002a0000c13d0000008004000039000000400040043f000000040030008c000000510000413d000000000201043b000000e0022002700000039c0020009c000000590000a13d0000039d0020009c000000810000213d000003a70020009c0000018c0000a13d000003a80020009c000002550000213d000003ab0020009c000003290000613d000003ac0020009c0000064c0000c13d0000000001000416000000000001004b0000064c0000c13d000000c001000039000000400010043f0000000501000039000000800010043f000003f602000041000000a00020043f0000002003000039000000c00030043f000000e00010043f000001000020043f000001050000043f000003f70100004100000e490001042e000000a001000039000000400010043f0000000001000416000000000001004b0000064c0000c13d0000000001000410000000800010043f0000039402000041000000000202041a0000039500200198000000550000c13d0000039803200197000003980030009c000000490000613d00000398012001c70000039402000041000000000012041b0000039801000041000000a00010043f0000000001000414000003930010009c0000039301008041000000c00110021000000399011001c70000800d0200003900000001030000390000039a040000410e480e390000040f00000001002001900000064c0000613d000000800100043d0000000102000039000001400000044300000160001004430000002001000039000001000010044300000120002004430000039b0100004100000e490001042e000000000003004b0000064c0000c13d000000000100001900000e490001042e0000039601000041000000a00010043f000003970100004100000e4a00010430000003b00020009c000000f10000a13d000003b10020009c000001680000a13d000003b20020009c000002320000213d000003b50020009c000002fd0000613d000003b60020009c0000064c0000c13d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b000900000001001d000003c10010009c0000064c0000213d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004fc0000c13d000000400100043d0000040402000041000005750000013d0000039e0020009c000001b20000a13d0000039f0020009c000002630000213d000003a20020009c0000032f0000613d000003a30020009c0000064c0000c13d000000640030008c0000064c0000413d0000000402100370000000000202043b000900000002001d000003d90020009c0000064c0000213d0000002402100370000000000202043b000003980020009c0000064c0000213d0000002304200039000000000034004b0000064c0000813d0000000404200039000000000441034f000000000404043b000003980040009c0000064c0000213d000000050440021000000000024200190000002402200039000000000032004b0000064c0000213d0000004401100370000000000101043b000800000001001d000003c10010009c0000064c0000213d0000004101000039000000000101041a000700000001001d000000000010043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000400600043d000003db0060009c000003e00000213d0000008002600039000000400020043f000000000201041a000003d90320019700000000033604360000008002200270000600000003001d0000000000230435000000400200043d000003dc0020009c000003e00000213d000000e003200039000000400030043f0000000103100039000000000303041a0000006804300270000000ff0440018f000000800520003900000000004504350000006004300270000000ff0440018f0000006005200039000000000045043500000020043002700000039304400197000000200520003900000000004504350000039304300197000000000042043500000040033002700000039304300197000000400320003900000000004304350000000204100039000000000404041a000000a00520003900000000004504350000000304100039000000000404041a000000c00520003900000000004504350000004004600039000500000004001d0000000000240435000400000006001d00000060026000390000000401100039000000000101041a000000ff001001900000000001000039000000010100c03900000000001204350000086a0000613d000000400100043d000003ed02000041000005750000013d000003ba0020009c000001510000213d000003be0020009c000002e10000613d000003bf0020009c0000029d0000613d000003c00020009c0000064c0000c13d000000640030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000900000002001d0000002402100370000000000202043b000800000002001d000000ff0020008c0000064c0000213d0000004401100370000000000101043b000700000001001d000000ff0010008c0000064c0000213d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004020000613d0000000903000029000000010130008a0000004102000039000000000202041a000000000021004b000004e00000813d000000000030043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d0000000804000029000000ff0240018f0000000705000029000000ff0350018f0000006004400210000004170440019700000068055002100000041805500197000000000445019f000000000101043b0000000101100039000000000501041a0000041f05500197000000000454019f000000000041041b000000400100043d000000400410003900000000003404350000002003100039000000000023043500000009020000290000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f00000420011001c70000800d0200003900000001030000390000042104000041000004dc0000013d000003bb0020009c000002ee0000613d000003bc0020009c000002a20000613d000003bd0020009c0000064c0000c13d000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000002402100370000000000202043b000003c10020009c0000064c0000213d0000000003000411000000000032004b000004a80000c13d0000000401100370000000000101043b0e480d060000040f000000000100001900000e490001042e000003b70020009c0000042b0000613d000003b80020009c000003c70000613d000003b90020009c0000064c0000c13d0000000001000416000000000001004b0000064c0000c13d000004050100004100000000001004430000000001000412000000040010044300000024000004430000000001000414000003930010009c0000039301008041000000c00110021000000406011001c700008005020000390e480e3e0000040f000000010020019000000c5f0000613d000000000101043b000003c1011001970000000002000410000000000012004b000005730000c13d000000400100043d00000407020000410000000000210435000003930010009c00000393010080410000004001100210000003fa011001c700000e490001042e000003ad0020009c000004810000613d000003ae0020009c000003e60000613d000003af0020009c0000064c0000c13d000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000002402100370000000000202043b000900000002001d000003c10020009c0000064c0000213d0000000401100370000000000101043b000000000010043f0000004301000039000000200010043f000000400200003900000000010000190e480e240000040f0000000902000029000000000020043f000000200010043f000000000100001900000040020000390e480e240000040f000000000101041a000000ff0210018f000000800020043f0000000801100270000000ff0110018f000000a00010043f000003f80100004100000e490001042e000003a40020009c000004a00000613d000003a50020009c000004100000613d000003a60020009c0000064c0000c13d000000840030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000900000002001d0000002402100370000000000202043b000800000002001d000003930020009c0000064c0000213d0000004402100370000000000202043b000700000002001d000003930020009c0000064c0000213d0000006401100370000000000101043b000600000001001d000003930010009c0000064c0000213d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004020000613d0000000901000029000000010110008a0000004102000039000000000202041a000000000021004b000004e00000813d000003dd0100004100000000001004430000000001000414000003930010009c0000039301008041000000c001100210000003de011001c70000800b020000390e480e3e0000040f000000010020019000000c5f0000613d0000000802000029000003930320019700000007020000290000039302200197000000000101043b000500000003001d000800000002001d000000000023004b0000073d0000813d0000000803000029000000060030006c000008670000813d000000060010006b000008800000a13d0000000901000029000000000010043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d00000006040000290000004002400210000003ef0220019700000007030000290000002003300210000003f003300197000000000223019f000000000101043b0000000101100039000000000301041a000003f103300197000000000232019f0000000503000029000000000232019f000000000021041b000000400100043d000000600210003900000000004204350000004002100039000000080400002900000000004204350000002002100039000000000032043500000009020000290000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003f2011001c70000800d020000390000000103000039000003f304000041000004dc0000013d000003b30020009c0000030b0000613d000003b40020009c0000064c0000c13d000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000000000020043f000003cb02000041000000200020043f0000002401100370000000000101043b000900000001001d000000400200003900000000010000190e480e240000040f00000009020000290e480e080000040f0000000302200210000000000101041a000000000121022f000003c101100197000000ff0020008c0000000001002019000000400200043d0000000000120435000003930020009c00000393020080410000004001200210000003fa011001c700000e490001042e000003a90020009c000003380000613d000003aa0020009c0000064c0000c13d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b000000000010043f000003cb01000041000003060000013d000003a00020009c000003810000613d000003a10020009c0000064c0000c13d000000840030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000900000002001d000003c10020009c0000064c0000213d0000002402100370000000000202043b000800000002001d000003c10020009c0000064c0000213d0000004402100370000000000202043b000700000002001d000003c10020009c0000064c0000213d0000006401100370000000000101043b000600000001001d000003c10010009c0000064c0000213d0000039401000041000000000501041a000003950350019700000398015001980000064e0000613d000000010010008c000006650000c13d000400000005001d000500000003001d000003c2010000410000000000100443000000000100041000000004001004430000000001000414000003930010009c0000039301008041000000c001100210000003c3011001c700008002020000390e480e3e0000040f000000010020019000000c5f0000613d000000000101043b000000000001004b00000005030000290000000405000029000006500000613d000000400400043d000006650000013d0000000001000416000000000001004b0000064c0000c13d000000000100041a000003340000013d000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000900000002001d0000002401100370000000000101043b000800000001001d000003c10010009c0000064c0000213d0000000901000029000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000101100039000000000101041a000700000001001d000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000002000411000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff001001900000057b0000c13d000000400100043d00000024021000390000000703000029000004050000013d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b00000422001001980000064c0000c13d000004230010009c000004ac0000c13d0000000102000039000004b10000013d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b000000000010043f000003cf01000041000000200010043f000000400200003900000000010000190e480e240000040f0000000101100039000004a40000013d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b000000000010043f0000004401000039000000200010043f000000400200003900000000010000190e480e240000040f000004a40000013d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b000900000001001d000003c10010009c0000064c0000213d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004e30000c13d000000400100043d0000040302000041000005750000013d0000000001000416000000000001004b0000064c0000c13d000000800000043f000003ee0100004100000e490001042e0000000001000416000000000001004b0000064c0000c13d0000004501000039000000000101041a000003c101100197000000800010043f000003ee0100004100000e490001042e000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000900000002001d0000002401100370000000000201043b000000000002004b0000000001000039000000010100c039000800000002001d000000000012004b0000064c0000c13d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004020000613d0000000903000029000000010130008a0000004102000039000000000202041a000000000021004b000004e00000813d000000000030043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000401100039000000000201041a000004260220019700000008022001af000000000021041b000000400100043d00000009020000290000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003cc011001c70000800d020000390000000103000039000003f504000041000004dc0000013d000000240030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000401100370000000000101043b000000000010043f0000004201000039000000200010043f000000400200003900000000010000190e480e240000040f0000000002010019000800000001001d000000000101041a000900000001001d00000001012000390e480ca00000040f00000008020000290000000402200039000000000302041a00000009060000290000008004600270000000400200043d00000020052000390000000000450435000003d9046001970000000000420435000000005401043400000393044001970000004006200039000000000046043500000000040504330000039304400197000000600520003900000000004504350000004004100039000000000404043300000393044001970000008005200039000000000045043500000060041000390000000004040433000000ff0440018f000000a005200039000000000045043500000080041000390000000004040433000000ff0440018f000000c0052000390000000000450435000000a0041000390000000004040433000000e0052000390000000000450435000000c001100039000000000101043300000100042000390000000000140435000000ff003001900000000001000039000000010100c03900000120032000390000000000130435000003930020009c00000393020080410000004001200210000003da011001c700000e490001042e000000440030008c0000064c0000413d0000000402100370000000000202043b000900000002001d000003c10020009c0000064c0000213d0000002402100370000000000402043b000003980040009c0000064c0000213d0000002302400039000000000032004b0000064c0000813d0000000405400039000000000251034f000000000202043b000003980020009c000003e00000213d0000001f0620003900000427066001970000003f066000390000042706600197000003db0060009c0000050d0000a13d0000041401000041000000000010043f0000004101000039000000040010043f000003d50100004100000e4a00010430000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000002402100370000000000202043b000800000002001d0000000401100370000000000101043b000900000001001d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004b50000c13d000000400100043d0000002402100039000003ce030000410000000000320435000003f4020000410000000000210435000000040210003900000000030004110000000000320435000003930010009c00000393010080410000004001100210000003e0011001c700000e4a00010430000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000002402100370000000000202043b000900000002001d000003c10020009c0000064c0000213d0000000401100370000000000101043b000800000001001d000000000010043f000003cf01000041000000200010043f000000400200003900000000010000190e480e240000040f0000000101100039000000000101041a0e480cd60000040f000000080100002900000009020000290e480d060000040f000000000100001900000e490001042e000001040030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000000402100370000000000202043b000900000002001d000003d90020009c0000064c0000213d0000002402100370000000000202043b000700000002001d0000006402100370000000000202043b000800000002001d000003930020009c0000064c0000213d0000008402100370000000000202043b000600000002001d000003930020009c0000064c0000213d000000a402100370000000000202043b000500000002001d000003930020009c0000064c0000213d000000c402100370000000000202043b000400000002001d000000ff0020008c0000064c0000213d000000e401100370000000000101043b000300000001001d000000ff0010008c0000064c0000213d0000000001000411000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000004020000613d000003dd0100004100000000001004430000000001000414000003930010009c0000039301008041000000c001100210000003de011001c70000800b020000390e480e3e0000040f000000010020019000000c5f0000613d00000006020000290000039302200197000000000101043b000200000001001d000600000002001d000000080020006b0000073d0000813d00000005010000290000039302100197000500000002001d000000060020006b000008670000813d0000000202000029000000050020006b000008800000a13d000000070000006b000009030000c13d000000400100043d0000041a02000041000005750000013d000000440030008c0000064c0000413d0000000002000416000000000002004b0000064c0000c13d0000002402100370000000000202043b000900000002001d000003c10020009c0000064c0000213d0000000401100370000000000101043b000000000010043f000003cf01000041000000200010043f000000400200003900000000010000190e480e240000040f0000000902000029000000000020043f000000200010043f000000000100001900000040020000390e480e240000040f000000000101041a000000ff001001900000000001000039000000010100c039000000800010043f000003ee0100004100000e490001042e0000000001000416000000000001004b0000064c0000c13d0000004101000039000000000101041a000000800010043f000003ee0100004100000e490001042e0000041b01000041000000800010043f0000041c0100004100000e4a00010430000004240010009c00000000020000390000000102006039000004250010009c00000001022061bf000000010120018f000000800010043f000003ee0100004100000e490001042e0000000903000029000000010130008a0000004102000039000000000202041a000000000021004b000004e00000813d000000000030043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b00000003011000390000000803000029000000000031041b000000400100043d0000002002100039000000000032043500000009020000290000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003c8011001c70000800d020000390000000103000039000003f9040000410e480e390000040f0000000100200190000000530000c13d0000064c0000013d000000400100043d0000041e02000041000005750000013d00000000010004100000000902000029000000000002004b000005000000c13d0000040002000041000000000020044300000004001004430000000001000414000003930010009c0000039301008041000000c001100210000003c3011001c70000800a020000390e480e3e0000040f000000010020019000000c5f0000613d000000000301043b000000000200041a0000000001000414000003c104200197000000040040008c0000066c0000c13d00000001020000390000000001000031000006ec0000013d00000009010000290e480dea0000040f000000000100001900000e490001042e000000400b00043d000003fb0300004100000000003b04350000000403b0003900000000001304350000000001000414000000040020008c000006120000c13d0000000003000031000000200030008c000000200400003900000000040340190000063e0000013d0000008006600039000000400060043f000000800020043f00000000042400190000002404400039000000000034004b0000064c0000213d0000002003500039000000000331034f00000427042001980000001f0520018f000000a001400039000005200000613d000000a006000039000000000703034f000000007807043c0000000006860436000000000016004b0000051c0000c13d000000000005004b0000052d0000613d000000000343034f0000000304500210000000000501043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f0000000000310435000000a0012000390000000000010435000004050100004100000000001004430000000001000412000000040010044300000024000004430000000001000414000003930010009c0000039301008041000000c00110021000000406011001c700008005020000390e480e3e0000040f000000010020019000000c5f0000613d000000000101043b000003c1011001970000000002000410000000000012004b000005730000613d0000040702000041000000000202041a000003c102200197000000000012004b000005730000c13d000000000000043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000002000411000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000400200043d000800000002001d000000000101043b000000000101041a000000ff00100190000008830000c13d000003f4010000410000000802000029000000000012043500000004012000390000000003000411000000000031043500000024012000390000000000010435000003930020009c00000393020080410000004001200210000003e0011001c700000e4a00010430000000400100043d00000410020000410000000000210435000003930010009c00000393010080410000004001100210000003d7011001c700000e4a000104300000000901000029000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000802000029000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000000530000c13d0000000901000029000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000802000029000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000201041a000004260220019700000001022001bf000000000021041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d020000390000000403000039000003ca040000410000000905000029000000080600002900000000070004110e480e390000040f00000001002001900000064c0000613d0000000901000029000000000010043f000003cb01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000201043b0000000801000029000000000010043f000900000002001d0000000101200039000700000001001d000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000000001004b000000530000c13d0000000901000029000000000101041a000600000001001d0000041d0010009c000003e00000813d000000060100002900000001011000390000000902000029000000000012041b000000000020043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b00000006011000290000000802000029000000000021041b0000000901000029000000000101041a000900000001001d000000000020043f0000000701000029000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000902000029000000000021041b000000000100001900000e490001042e0000039300b0009c000003930300004100000000030b40190000004003300210000003930010009c0000039301008041000000c001100210000000000131019f000003d5011001c700080000000b001d0e480e3e0000040f000000080b00002900000060031002700000039303300197000000200030008c000000200400003900000000040340190000001f0640018f000000200740019000000000057b00190000062d0000613d000000000801034f00000000090b0019000000008a08043c0000000009a90436000000000059004b000006290000c13d000000000006004b0000063a0000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000000003001f00020000000103550000000100200190000006730000613d0000001f01400039000000600110018f0000000004b10019000000000014004b00000000020000390000000102004039000003980040009c000003e00000213d0000000100200190000003e00000c13d000800000004001d000000400040043f000000200030008c000006910000813d000000000100001900000e4a00010430000000000003004b000006650000c13d000003c40150019700000001021001bf000003c501500197000003c6011001c7000500000003001d000000000003004b000000000102c0190000039402000041000000000012041b000000090000006b000006e10000613d000000080000006b000006e10000613d0000000602000029000603c10020019c000006e10000613d0000039500100198000007400000c13d000000400100043d000003d602000041000005750000013d00000396010000410000000000140435000003930040009c00000393040080410000004001400210000003d7011001c700000e4a00010430000003930010009c0000039301008041000000c001100210000000000003004b000006e40000c13d0000000002040019000006e70000013d0000001f0530018f000003e706300198000000400200043d00000000046200190000067e0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b0000067a0000c13d000000000005004b0000068b0000613d000000000161034f0000000305500210000000000604043300000000065601cf000000000656022f000000000101043b0000010005500089000000000151022f00000000015101cf000000000161019f00000000001404350000006001300210000003930020009c00000393020080410000004002200210000000000112019f00000e4a0001043000000000020b043300000008060000290000002404600039000000000500041a0000000000240435000003fc020000410000000000260435000003c1025001970000000404600039000000000024043500000000020004140000000904000029000000040040008c000006cc0000613d0000000801000029000003930010009c00000393010080410000004001100210000003930020009c0000039302008041000000c002200210000000000112019f000003e0011001c700000009020000290e480e390000040f00000060031002700000039303300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000000805700029000006b90000613d000000000801034f0000000809000029000000008a08043c0000000009a90436000000000059004b000006b50000c13d000000000006004b000006c60000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000000003001f000200000001035500000001002001900000085b0000613d0000001f01400039000000600110018f0000000801100029000003980010009c000003e00000213d000000400010043f000000200030008c0000064c0000413d00000008020000290000000002020433000000000002004b0000000003000039000000010300c039000000000032004b0000064c0000c13d000000000002004b000006f10000c13d0000004402100039000003fd03000041000000000032043500000024021000390000001503000039000007320000013d000000400100043d000003d802000041000005750000013d000003c9011001c7000080090200003900000000050000190e480e390000040f00020000000103550000006001100270000003930010019d0000039301100197000000000001004b000007040000c13d000000400100043d00000001002001900000072d0000613d0000002002100039000000000300041a00000009040000290000000000420435000003c1023001970000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003c8011001c70000800d0200003900000001030000390000040204000041000004dc0000013d000003980010009c000003e00000213d0000001f0410003900000427044001970000003f044000390000042705400197000000400400043d0000000005540019000000000045004b00000000060000390000000106004039000003980050009c000003e00000213d0000000100600190000003e00000c13d000000400050043f000000000614043600000427031001980000001f0410018f000000000136001900000002050003670000071f0000613d000000000705034f000000007807043c0000000006860436000000000016004b0000071b0000c13d000000000004004b000006ee0000613d000000000335034f0000000304400210000000000501043300000000054501cf000000000545022f000000000303043b0000010004400089000000000343022f00000000034301cf000000000353019f0000000000310435000006ee0000013d000000440210003900000401030000410000000000320435000000240210003900000013030000390000000000320435000003fe020000410000000000210435000000040210003900000020030000390000000000320435000003930010009c00000393010080410000004001100210000003ff011001c700000e4a00010430000000400100043d0000041102000041000005750000013d0000000901000029000000000010043f000003c701000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000007ba0000c13d0000000901000029000000000010043f000003c701000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000201041a000004260220019700000001022001bf000000000021041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d0200003900000004030000390000000007000411000003ca04000041000000000500001900000009060000290e480e390000040f00000001002001900000064c0000613d000000000000043f000003cb01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000201043b0000000901000029000000000010043f000400000002001d0000000101200039000300000001001d000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000000001004b000007ba0000c13d0000000401000029000000000101041a000200000001001d000003980010009c000003e00000213d000000020100002900000001011000390000000402000029000000000012041b000000000020043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b00000002011000290000000902000029000000000021041b0000000401000029000000000101041a000400000001001d000000000020043f0000000301000029000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000402000029000000000021041b0000000801000029000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000ff00100190000008350000c13d0000000801000029000000000010043f000003cd01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000201041a000004260220019700000001022001bf000000000021041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d0200003900000004030000390000000007000411000003ca04000041000003ce0500004100000008060000290e480e390000040f00000001002001900000064c0000613d000003ce01000041000000000010043f000003cb01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000201043b0000000801000029000000000010043f000900000002001d0000000101200039000400000001001d000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000101041a000000000001004b000008350000c13d0000000901000029000000000101041a000300000001001d000003980010009c000003e00000213d000000030100002900000001011000390000000902000029000000000012041b000000000020043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b00000003011000290000000802000029000000000021041b0000000901000029000000000101041a000900000001001d000000000020043f0000000401000029000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000902000029000000000021041b000003ce01000041000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000101100039000000000601041a000000000001041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d020000390000000403000039000003d004000041000003ce0500004100000000070000190e480e390000040f00000001002001900000064c0000613d000000070000006b000009f90000c13d000000400100043d000003d402000041000000000021043500000004021000390000000000020435000008f20000013d0000001f0530018f000003e706300198000000400200043d00000000046200190000067e0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b000008620000c13d0000067e0000013d000000400100043d0000041202000041000005750000013d0000000001030433000300000001001d000003dd0100004100000000001004430000000001000414000003930010009c0000039301008041000000c001100210000003de011001c70000800b020000390e480e3e0000040f000000010020019000000c5f0000613d000000000201043b00000003010000290000039301100197000300000002001d000000000012004b000008920000a13d000000400100043d000003ec02000041000005750000013d000000400100043d0000041302000041000005750000013d00000408010000410000000802000029000000000012043500000000010004140000000902000029000000040020008c0000089b0000c13d00000000010004150000000b0110008a00000005011002100000000003000031000000200030008c00000020040000390000000004034019000008c90000013d0000000501000029000000000101043300000000020104330000039302200197000000030020006b000008f70000813d000000400100043d000003eb02000041000005750000013d0000000802000029000003930020009c00000393020080410000004002200210000003930010009c0000039301008041000000c001100210000000000121019f000003d7011001c700000009020000290e480e3e0000040f00000060031002700000039303300197000000200030008c000000200400003900000000040340190000001f0640018f00000020074001900000000805700029000008b50000613d000000000801034f0000000809000029000000008a08043c0000000009a90436000000000059004b000008b10000c13d000000000006004b000008c20000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000000003001f000200000001035500000000010004150000000a0110008a00000005011002100000000100200190000008ec0000613d0000001f02400039000000600420018f0000000802400029000000000042004b00000000040000390000000104004039000003980020009c000003e00000213d0000000100400190000003e00000c13d000000400020043f000000200030008c0000064c0000413d000000080300002900000000030304330000000501100270000000000103001f000004070030009c000009f00000c13d000003c2010000410000000000100443000000090100002900000004001004430000000001000414000003930010009c0000039301008041000000c001100210000003c3011001c700008002020000390e480e3e0000040f000000010020019000000c5f0000613d000000000101043b000000000001004b00000a360000c13d000000400100043d0000040f020000410000000000210435000000040210003900000009030000290000000000320435000003930010009c00000393010080410000004001100210000003d5011001c700000e4a0001043000000006020000290000000002020433000003d9022001970000000902200029000003d90020009c0000098d0000a13d0000041401000041000000000010043f0000001101000039000000040010043f000003d50100004100000e4a000104300000004101000039000000000101041a000100000001001d000000000001004b000009950000c13d00000001010000290000000101100039000200000001001d0000004102000039000000000012041b000000400100043d000003dc0010009c000003e00000213d0000000402000029000000ff0220018f0000000303000029000000ff0330018f000000e004100039000000400040043f000000a0041000390000000705000029000000000054043500000080041000390000000000340435000000600310003900000000002304350000004002100039000000050300002900000000003204350000002002100039000000060300002900000000003204350000000802000029000000000021043500000044020000390000000102200367000000000202043b000000c0031000390000000000230435000000400200043d000800000002001d000003db0020009c000003e00000213d00000008030000290000008002300039000000400020043f0000004002300039000700000002001d0000000000120435000000090100002900000000021304360000006001300039000900000001001d0000000000010435000600000002001d00000000000204350000000201000029000000000010043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d00000008020000290000000002020433000003d902200197000000060300002900000000030304330000008003300210000000000223019f000000000101043b000000000021041b0000000102100039000000000302041a00000416033001970000000704000029000000000404043300000000650404340000039305500197000000000353019f00000000050604330000002005500210000003f005500197000000000353019f000000400540003900000000050504330000004005500210000003ef05500197000000000353019f0000006005400039000000000505043300000060055002100000041705500197000000000353019f0000008005400039000000000505043300000068055002100000041805500197000000000353019f000000000032041b000000a00240003900000000020204330000000203100039000000000023041b000000c00240003900000000020204330000000303100039000000000023041b0000000401100039000000000301041a000004260230019700000009030000290000000003030433000000000003004b000000010220c1bf000000000021041b000000400100043d00000002020000290000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003cc011001c70000800d0200003900000001030000390000041904000041000004dc0000013d00000004030000290000000003030433000003d903300197000000000032004b000009ac0000a13d000000400100043d000003ea02000041000005750000013d0000000101000029000000000010043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000101100039000000000101041a00000040011002700000039301100197000000020010006c00000a320000a13d000000400100043d0000041502000041000005750000013d000000a001100039000000000101043300000009021000b9000000000001004b000009b40000613d00000000031200d9000000090030006c000008fd0000c13d0000000003000416000000000023004b00000a230000c13d0000000701000029000000000010043f0000004301000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000002000411000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000400200043d000200000002001d000003e10020009c000003e00000213d000000000101043b00000002030000290000004002300039000000400020043f000000000101041a000000ff0210018f00000000022304360000000801100270000000ff0110018f00000000001204350000000502000029000000000202043300000000340204340000039304400197000000030040006b00000a5e0000413d00000000030304330000039303300197000000030030006b00000a5e0000813d000000400100043d000000c0022000390000000002020433000000000002004b00000b060000c13d000003e502000041000005750000013d0000040901000041000000000012043500000004012000390000000000310435000003930020009c00000393020080410000004001200210000003d5011001c700000e4a00010430000000000100041a000003d1011001970000000705000029000000000151019f000000000010041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d020000390000000203000039000003d2040000410e480e390000040f00000001002001900000064c0000613d0000004501000039000000000201041a000003d10220019700000006022001af000000000021041b000000050000006b000000530000c13d0000039401000041000000000201041a000003d302200197000000000021041b0000000103000039000000400100043d0000000000310435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003cc011001c70000800d020000390000039a04000041000004dc0000013d00000009020000290e480cc80000040f000003df02000041000000400300043d000000000023043500000004023000390000000000120435000000240130003900000000020004160000000000210435000003930030009c00000393030080410000004001300210000003e0011001c700000e4a00010430000000010100008a000000010010006b000008fd0000613d000009080000013d0000040701000041000000000201041a000003d1022001970000000905000029000000000252019f000000000021041b000000400100043d000800000001001d0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d0200003900000002030000390000040a040000410e480e390000040f00000001002001900000064c0000613d000000800100043d000000000001004b00000a570000c13d0000000001000416000000000001004b000000530000613d0000040e0100004100000008020000290000000000120435000003930020009c00000393020080410000004001200210000003d7011001c700000e4a0001043000000000020004140000000903000029000000040030008c00000a6d0000c13d0000000102000039000000000400003100000a7c0000013d0000000903100029000003d90030009c000008fd0000213d00000080022000390000000002020433000000ff0220018f000000000023004b00000ac70000a13d000000400200043d00000024032000390000000000130435000003e401000041000000000012043500000004012000390000056d0000013d000003930010009c00000393010080410000006001100210000003930020009c0000039302008041000000c002200210000000000112019f0000040b011001c700000009020000290e480e430000040f000000010220018f00020000000103550000006001100270000003930010019d0000039304100197000000000004004b00000a880000c13d000000600100003900000080030000390000000001010433000000000002004b00000ab20000c13d000000000001004b00000afe0000c13d000000400100043d0000040d02000041000005750000013d000003980040009c000003e00000213d0000001f0140003900000427011001970000003f011000390000042703100197000000400100043d0000000003310019000000000013004b00000000050000390000000105004039000003980030009c000003e00000213d0000000100500190000003e00000c13d000000400030043f000000000341043600000427054001980000001f0640018f0000000004530019000000020700036700000aa40000613d000000000807034f0000000009030019000000008a08043c0000000009a90436000000000049004b00000aa00000c13d000000000006004b00000a800000613d000000000557034f0000000306600210000000000704043300000000076701cf000000000767022f000000000505043b0000010006600089000000000565022f00000000056501cf000000000575019f000000000054043500000a800000013d000000000001004b000000530000c13d000003c2010000410000000000100443000000090100002900000004001004430000000001000414000003930010009c0000039301008041000000c001100210000003c3011001c700008002020000390e480e3e0000040f000000010020019000000c5f0000613d000000000101043b000000000001004b000000530000c13d000000400100043d0000040c02000041000008ee0000013d0000000701000029000000000010043f0000004301000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000002000411000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d0000000902000029000000ff0320018f000000000101043b000000000201041a0000000804200270000000ff0440018f0000000003340019000000ff0030008c000008fd0000213d000004280220019700000008033002100000ff000330018f000000000223019f000000000021041b0000004501000039000000000201041a000000400300043d000003e601000041000600000003001d00000000001304350000000001000414000003c102200197000000040020008c00000ba30000c13d0000000003000031000000200030008c0000002004000039000000000403401900000bcd0000013d000003930030009c00000393030080410000004002300210000003930010009c00000393010080410000006001100210000000000121019f00000e4a00010430000000400210003900000007030000290000000000320435000000400200003900000000022104360000000003000411000003c1033001970000000000320435000003e20010009c000003e00000213d0000006003100039000000400030043f000003930020009c000003930200804100000040022002100000000001010433000003930010009c00000393010080410000006001100210000000000121019f0000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003c9011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000301043b000000400100043d000000200200003900000000022104360000000000320435000003e10010009c000003e00000213d0000004003100039000000400030043f000003930020009c000003930200804100000040022002100000000001010433000003930010009c00000393010080410000006001100210000000000121019f0000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003c9011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d00000001020003670000002403200370000000000403043b0000000403400039000000000332034f000000000303043b00000005053002100000003f075000390000042707700197000000000101043b000000400600043d000400000006001d0000000006670019000000000076004b00000000070000390000000107004039000003980060009c000003e00000213d0000000100700190000003e00000c13d00000005070000290000000007070433000000c0077000390000000007070433000100000007001d000000400060043f00000004060000290000000006360436000300000006001d00000024044000390000000005450019000000000054004b00000b6a0000813d0000000403000029000000000642034f000000000606043b000000200330003900000000006304350000002004400039000000000054004b00000b610000413d00000004020000290000000003020433000000000003004b00000b890000613d000600000000001d0000000602000029000000050220021000000003022000290000000002020433000000000021004b00000b770000813d000000000010043f000000200020043f000000000100041400000b7a0000013d000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000603000029000600010030003d00000004020000290000000002020433000000060020006b00000b6d0000413d000000010010006c00000c6c0000c13d0000000901000029000003d90210019700000002010000290000000001010433000000ff0110018f0000000002210019000003d90020009c000008fd0000213d0000000503000029000000000303043300000060033000390000000003030433000000ff0330018f000000000032004b00000c6f0000a13d000000400200043d00000024032000390000000000130435000003e40100004100000000001204350000000401200039000000010300003900000000003104350000056e0000013d0000000603000029000003930030009c00000393030080410000004003300210000003930010009c0000039301008041000000c001100210000000000131019f000003d7011001c70e480e3e0000040f00000060031002700000039303300197000000200030008c000000200400003900000000040340190000001f0640018f0000002007400190000000060570002900000bbc0000613d000000000801034f0000000609000029000000008a08043c0000000009a90436000000000059004b00000bb80000c13d000000000006004b00000bc90000613d000000000771034f0000000306600210000000000805043300000000086801cf000000000868022f000000000707043b0000010006600089000000000767022f00000000066701cf000000000686019f0000000000650435000000000003001f0002000000010355000000010020019000000c600000613d0000001f01400039000000600210018f0000000601200029000000000021004b00000000020000390000000102004039000003980010009c000003e00000213d0000000100200190000003e00000c13d000000400010043f000000200030008c0000064c0000413d0000000801000029000403c10010019b0000000901000029000503d90010019c00000c100000613d00000006010000290000000001010433000800000001001d000900000000001d0000000902000029000000080020002a000008fd0000413d00000009020000290000000801200029000600000001001d000000000010043f0000004401000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000702000029000000000021041b000000400100043d0000000000210435000003930010009c000003930100804100000040011002100000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003cc011001c70000800d020000390000000303000039000003e804000041000000040500002900000006060000290e480e390000040f00000001002001900000064c0000613d00000009020000290000000102200039000900000002001d000000050020006c00000be30000413d0000000701000029000000000010043f0000004201000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b000000000201041a00000080032002700000000503300029000003d90030009c000008fd0000213d000003d9022001970000008003300210000000000223019f000000000021041b0000004501000039000000000101041a000003c2020000410000000000200443000003c101100197000900000001001d00000004001004430000000001000414000003930010009c0000039301008041000000c001100210000003c3011001c700008002020000390e480e3e0000040f000000010020019000000c5f0000613d000000000101043b000000000001004b0000064c0000613d000000400300043d000000240130003900000005020000290000000000210435000003e9010000410000000000130435000800000003001d00000004013000390000000402000029000000000021043500000000010004140000000902000029000000040020008c00000c580000613d0000000802000029000003930020009c00000393020080410000004002200210000003930010009c0000039301008041000000c001100210000000000121019f000003e0011001c700000009020000290e480e390000040f0000006003100270000003930030019d0002000000010355000000010020019000000c930000613d0000000801000029000003980010009c000003e00000213d0000000801000029000000400010043f000000000100001900000e490001042e000000000001042f0000001f0530018f000003e706300198000000400200043d00000000046200190000067e0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000c670000c13d0000067e0000013d000000400100043d000003e302000041000005750000013d0000000701000029000000000010043f0000004301000039000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d000000000101043b0000000002000411000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f00000001002001900000064c0000613d0000000902000029000000ff0320018f000000000101043b000000000201041a000000ff0420018f0000000003340019000000ff0030008c000008fd0000213d000004260220019700000aed0000013d00000393033001970000001f0530018f000003e706300198000000400200043d00000000046200190000067e0000613d000000000701034f0000000008020019000000007907043c0000000008980436000000000048004b00000c9b0000c13d0000067e0000013d0000000002010019000000400100043d000004290010009c00000cc20000813d000000e003100039000000400030043f000000000302041a0000006804300270000000ff0440018f000000800510003900000000004504350000006004300270000000ff0440018f0000006005100039000000000045043500000040043002700000039304400197000000400510003900000000004504350000002004300270000003930440019700000020051000390000000000450435000003930330019700000000003104350000000103200039000000000303041a000000a00410003900000000003404350000000202200039000000000202041a000000c0031000390000000000230435000000000001042d0000041401000041000000000010043f0000004101000039000000040010043f000003d50100004100000e4a00010430000000000301001900000000011200a9000000000003004b00000ccf0000613d00000000033100d9000000000023004b00000cd00000c13d000000000001042d0000041401000041000000000010043f0000001101000039000000040010043f000003d50100004100000e4a000104300001000000000002000100000001001d000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000cf60000613d000000000101043b0000000002000411000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000cf60000613d000000000101043b000000000101041a000000ff0010019000000cf80000613d000000000001042d000000000100001900000e4a00010430000000400100043d000000240210003900000001030000290000000000320435000003f4020000410000000000210435000000040210003900000000030004110000000000320435000003930010009c00000393010080410000004001100210000003e0011001c700000e4a000104300006000000000002000600000002001d000500000001001d000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b0000000602000029000003c102200197000600000002001d000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b000000000101041a000000ff0010019000000dd50000613d0000000501000029000000000010043f000003cf01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b0000000602000029000000000020043f000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b000000000201041a0000042602200197000000000021041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d02000039000000040300003900000000070004110000042a04000041000000050500002900000006060000290e480e390000040f000000010020019000000dd60000613d0000000501000029000000000010043f000003cb01000041000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000201043b0000000601000029000000000010043f000500000002001d0000000101200039000300000001001d000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d0000000503000029000000000101043b000000000101041a000000000001004b00000dd50000613d000000000203041a000000000002004b00000dd80000613d000000000021004b000400000001001d00000db50000613d000200000002001d000000000030043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d00000004020000290001000100200092000000000101043b0000000504000029000000000204041a000000010020006c00000dde0000a13d0000000202000029000000010220008a0000000001120019000000000101041a000200000001001d000000000040043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b00000001011000290000000202000029000000000021041b000000000020043f0000000301000029000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b0000000402000029000000000021041b0000000503000029000000000103041a000400000001001d000000000001004b00000de40000613d000000000030043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d0000000402000029000000010220008a000000000101043b0000000001210019000000000001041b0000000501000029000000000021041b0000000601000029000000000010043f0000000301000029000000200010043f0000000001000414000003930010009c0000039301008041000000c001100210000003c8011001c700008010020000390e480e3e0000040f000000010020019000000dd60000613d000000000101043b000000000001041b000000000001042d000000000100001900000e4a000104300000041401000041000000000010043f0000001101000039000000040010043f000003d50100004100000e4a000104300000041401000041000000000010043f0000003201000039000000040010043f000003d50100004100000e4a000104300000041401000041000000000010043f0000003101000039000000040010043f000003d50100004100000e4a00010430000003c10510019800000dfc0000613d000000000100041a000003d101100197000000000151019f000000000010041b0000000001000414000003930010009c0000039301008041000000c001100210000003c9011001c70000800d020000390000000203000039000003d2040000410e480e390000040f000000010020019000000e060000613d000000000001042d000000400100043d000003d402000041000000000021043500000004021000390000000000020435000003930010009c00000393010080410000004001100210000003d5011001c700000e4a00010430000000000100001900000e4a000104300001000000000002000000000301041a000100000002001d000000000023004b00000e1b0000a13d000000000010043f0000000001000414000003930010009c0000039301008041000000c001100210000003cc011001c700008010020000390e480e3e0000040f000000010020019000000e210000613d000000000101043b00000001011000290000000002000019000000000001042d0000041401000041000000000010043f0000003201000039000000040010043f000003d50100004100000e4a00010430000000000100001900000e4a00010430000000000001042f000003930010009c00000393010080410000004001100210000003930020009c00000393020080410000006002200210000000000112019f0000000002000414000003930020009c0000039302008041000000c002200210000000000112019f000003c9011001c700008010020000390e480e3e0000040f000000010020019000000e370000613d000000000101043b000000000001042d000000000100001900000e4a0001043000000e3c002104210000000102000039000000000001042d0000000002000019000000000001042d00000e41002104230000000102000039000000000001042d0000000002000019000000000001042d00000e46002104250000000102000039000000000001042d0000000002000019000000000001042d00000e480000043200000e490001042e00000e4a00010430000000000000000000000000000000000000000000000000000000000000000000000000fffffffff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a000000000000000000000000000000000000000000000000ff0000000000000000f92ee8a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000a00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff0200000000000000000000000000000000000020000000a00000000000000000c7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d200000002000000000000000000000000000000800000010000000000000000000000000000000000000000000000000000000000000000000000000091d1485300000000000000000000000000000000000000000000000000000000cb5bf84100000000000000000000000000000000000000000000000000000000e8153c9200000000000000000000000000000000000000000000000000000000f5d709a000000000000000000000000000000000000000000000000000000000f5d709a100000000000000000000000000000000000000000000000000000000f8c8765e00000000000000000000000000000000000000000000000000000000e8153c9300000000000000000000000000000000000000000000000000000000f41ed22700000000000000000000000000000000000000000000000000000000cb5bf84200000000000000000000000000000000000000000000000000000000d547741f00000000000000000000000000000000000000000000000000000000e730498d00000000000000000000000000000000000000000000000000000000a217fdde00000000000000000000000000000000000000000000000000000000c0a8453f00000000000000000000000000000000000000000000000000000000c0a8454000000000000000000000000000000000000000000000000000000000ca15c87300000000000000000000000000000000000000000000000000000000a217fddf00000000000000000000000000000000000000000000000000000000ad3cb1cc0000000000000000000000000000000000000000000000000000000091d148540000000000000000000000000000000000000000000000000000000093c87e2d00000000000000000000000000000000000000000000000000000000a1719c670000000000000000000000000000000000000000000000000000000045f73fa40000000000000000000000000000000000000000000000000000000056c28ddc000000000000000000000000000000000000000000000000000000008c5ab02d000000000000000000000000000000000000000000000000000000008c5ab02e000000000000000000000000000000000000000000000000000000009010d07c0000000000000000000000000000000000000000000000000000000056c28ddd000000000000000000000000000000000000000000000000000000006f4f28370000000000000000000000000000000000000000000000000000000045f73fa5000000000000000000000000000000000000000000000000000000004f1ef2860000000000000000000000000000000000000000000000000000000052d1902d00000000000000000000000000000000000000000000000000000000248a9ca200000000000000000000000000000000000000000000000000000000248a9ca3000000000000000000000000000000000000000000000000000000002f2ff15d0000000000000000000000000000000000000000000000000000000036568abe0000000000000000000000000000000000000000000000000000000001ffc9a700000000000000000000000000000000000000000000000000000000079fe40e000000000000000000000000000000000000000000000000000000000bd29a00000000000000000000000000ffffffffffffffffffffffffffffffffffffffff1806aa1896bbf26568e884a7374b41e002500962caba6a15023a8d90e8508b830200000200000000000000000000000000000024000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000010000000000000001b7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d020000000000000000000000000000000000004000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0dc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e823717059320000200000000000000000000000000000000000020000000000000000000000000448256db8f8fb95ee3eaaf89c1051414494e85cebb6057fcf996cc3d0ccfb45697667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92902dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800bd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ffffffffffffffffffffffffff0000000000000000000000000000000000000000299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b333ffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff3df2b0dc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000d7e6bcf8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000d92e233d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffff7f000000000000000000000000000000000000000000000000ffffffffffffff1f796b89b91644bc98cd93958e4c9038275d622183e25ac5af08cc6b5d9553913202000002000000000000000000000000000000040000000000000000000000007f7d5b96000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffbf000000000000000000000000000000000000000000000000ffffffffffffff9f584a793800000000000000000000000000000000000000000000000000000000c6a62f5900000000000000000000000000000000000000000000000000000000a1f0f5c20000000000000000000000000000000000000000000000000000000075794a3c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffe096234cb3d6c373a1aaa06497a540bc166d4b0359243a088eaf95e21d7253d0be449a52f800000000000000000000000000000000000000000000000000000000d05cb60900000000000000000000000000000000000000000000000000000000b7b24097000000000000000000000000000000000000000000000000000000000bd8a3eb00000000000000000000000000000000000000000000000000000000c3c8de450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000008000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000000000000000000000000000000000000000000000000000ffffffff00000000ffffffffffffffffffffffffffffffffffffffff00000000000000000000000002000000000000000000000000000000000000800000000000000000000000003aff627bfb4ac26b32c4585ff12b119505735c86fcf769cccde6453df3077f07e2517d3f00000000000000000000000000000000000000000000000000000000691671f2f3382bfda82a83fdec521a8e2b0b2a78c662c24646891349d4e3b041352e302e300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000c0000000000000000000000000000000000000000000000000000000400000008000000000000000009ff79792a92b66fee090acb66e07837a2edb31ee6b9780fa551fd04b79dffcd2000000000000000000000000000000000000002000000000000000000000000070a0823100000000000000000000000000000000000000000000000000000000a9059cbb00000000000000000000000000000000000000000000000000000000546f6b656e207472616e73666572206661696c6564000000000000000000000008c379a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000640000000000000000000000009cc7f708afc65944829bd487b90b72536b1951864fbfc14e125fc972a6507f39455448207472616e73666572206661696c6564000000000000000000000000004c149319e64cabe138649963f62a9eacd536b3a5383407ad30f5b0cc767dd99284484544000000000000000000000000000000000000000000000000000000007260843c00000000000000000000000000000000000000000000000000000000310ab089e4439a4c15d089f94afb7896ff553aecb10793d0ab882de59d99a32e0200000200000000000000000000000000000044000000000000000000000000360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc52d1902d00000000000000000000000000000000000000000000000000000000aa1d49a400000000000000000000000000000000000000000000000000000000bc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b0000000000000000000000000000000000000000000000a000000000000000009996b315000000000000000000000000000000000000000000000000000000001425ea4200000000000000000000000000000000000000000000000000000000b398979f000000000000000000000000000000000000000000000000000000004c9c8ce300000000000000000000000000000000000000000000000000000000e07c8dba00000000000000000000000000000000000000000000000000000000e731bf9400000000000000000000000000000000000000000000000000000000b21d4bb200000000000000000000000000000000000000000000000000000000cab68cd2000000000000000000000000000000000000000000000000000000004e487b7100000000000000000000000000000000000000000000000000000000b4d27b3700000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000ff000000000000000000000000003ba7b182ae433e35d2467e60c38be1e86a1f70c81a864326dd3af818a7f96b140416bc16000000000000000000000000000000000000000000000000000000006697b2320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000008000000000000000000000000000000000000000000000000000000000000000010000000000000000d40820c300000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff02000000000000000000000000000000000000600000000000000000000000006a38f414c89181246d15ef2e264e8af7f313da2aea7c06dfab474ef4e473eeb000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff5a05180f0000000000000000000000000000000000000000000000000000000001ffc9a7000000000000000000000000000000000000000000000000000000007965db0b00000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff000000000000000000000000000000000000000000000000ffffffffffffff20f6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b000000000000000000000000000000000000000000000000000000000000000004a24621ce1d948283aceff95d2ace5d4b4482d39ea4f0fc67bc683cfbf0db9e
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.