ERC-721
Overview
Max Total Supply
5,555 COCKPUNCH
Holders
2,090
Market
Volume (24H)
0.3059 ETH
Min Price (24H)
$144.84 @ 0.038000 ETH
Max Price (24H)
$149.41 @ 0.039200 ETH
Other Info
Token Contract
Balance
15 COCKPUNCHLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Cockpunch
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 9999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.16 <0.9.0; import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import {ERC721A, ERC721ACommon} from "ethier/contracts/erc721/ERC721ACommon.sol"; import {BaseTokenURI} from "ethier/contracts/erc721/BaseTokenURI.sol"; import {PremintReady} from "premint-connect/PremintReady.sol"; import {DefaultOperatorFilterer} from "operator-filter-registry/DefaultOperatorFilterer.sol"; contract Cockpunch is ERC721ACommon, BaseTokenURI, PremintReady, DefaultOperatorFilterer { using Address for address payable; // ========================================================================= // Errors // ========================================================================= error DisallowedByCurrentStage(Stage got, Stage want); error TooManyMintsRequested(); error BurnDisabled(); error IncorrectPayment(uint256 got, uint256 want); error IllegalOperator(); error StageLocked(); error CannotCommitAgain(); error InvalidCommitment(); // ========================================================================= // Types // ========================================================================= /** * @notice The different stages of the contract. * @dev Some methods are only accessible for some stages. See also the * `Steering` section for more information. */ enum Stage { Closed, Premint } /** * @notice Specifies the receiver of owner mints. */ struct OwnerMintReceiver { address to; uint16 num; } // ========================================================================= // Constants // ========================================================================= /** * @notice Maximum total supply. */ uint256 public constant NUM_MAX = 5555; /** * @notice Maximum owner mints (treasury + collaborators) */ uint16 internal constant _MAX_OWNER_MINTS = 555 + 160; /** * @notice The maximum number of mints per address. * @dev Will be enforced by the premint contrac. */ uint16 internal constant _MAX_MINTS_PER_ADDRESS = 1; // ========================================================================= // Storage // ========================================================================= /** * @notice The signer approving the premint allowance signer. */ address internal _premintSigner; /** * @notice The current stage of the contract. * @dev Some methods are only accessible for some stages. See also the * `Steering` section for more information. */ Stage public stage; /** * @notice Flag the locks the current minting stage of the contract. */ bool public stageLocked; /** * @notice Flag to enable token burning. */ bool public burnEnabled; /** * @notice Number of tokens that can still be minted free-of-charge by the * contract owner. * @dev See also `ownerMint` */ uint16 public ownerMintsRemaining; /** * @notice The receiver of minting revenues. */ address payable public primaryReceiver; /** * @notice The block number used to derive the shuffling entropy. */ uint256 private _entropyBlock; /** * @notice The commitment to a random salt used to derive the shuffling * entropy. */ bytes32 private _saltHashCommitment; /** * @notice The entropy used for shuffling the tokens upon reveal. */ bytes32 public entropy; // ========================================================================= // Constructor // ========================================================================= constructor( address payable primaryReceiver_, address payable royaltiesReceiver, string memory baseTokenURI_ ) ERC721ACommon( "COCKPUNCH by Tim Ferriss", "COCKPUNCH", royaltiesReceiver, 690 ) BaseTokenURI(baseTokenURI_) { _premintSigner = owner(); primaryReceiver = primaryReceiver_; ownerMintsRemaining = _MAX_OWNER_MINTS; } // ========================================================================= // Premint // ========================================================================= /** * @notice Handles mints via the premint interface. * @dev This can only be called if the premint verification has been * successful and we can mint `amount` tokens to `to`. */ function _premint(address to, uint256 amount) internal override onlyDuring(Stage.Premint) { _processMint(to, amount); } /** * @notice Returns the address that is allowed to configure premint. */ function premintSigner() public view virtual override returns (address) { return _premintSigner; } /** * @notice Returns max number of tokens that can be minted through premint. */ function premintMax() public view virtual override returns (uint256) { return _MAX_MINTS_PER_ADDRESS; } // ========================================================================= // Minting // ========================================================================= /** * @notice Free-of-charge minting interface for the contract owner. */ function ownerMint(OwnerMintReceiver[] calldata receivers) external onlyOwner { uint16 ownerMintsRemaining_ = ownerMintsRemaining; for (uint256 idx; idx < receivers.length; ++idx) { if (receivers[idx].num > ownerMintsRemaining_) { revert TooManyMintsRequested(); } ownerMintsRemaining_ -= receivers[idx].num; } ownerMintsRemaining = ownerMintsRemaining_; for (uint256 idx; idx < receivers.length; ++idx) { _processMint(receivers[idx].to, receivers[idx].num); } } /** * @notice Does the actual minting and routes the generated revenues. */ function _processMint(address to, uint256 amount) internal { if (_totalMinted() + amount > NUM_MAX) { revert TooManyMintsRequested(); } _mint(to, amount); if (msg.value > 0) { primaryReceiver.sendValue(msg.value); } } // ========================================================================= // Burning // ========================================================================= /** * @notice Burns an existing token. * @dev Can only be called by the token owner or approved addresses. */ function burn(uint256 tokenId) external { if (!burnEnabled) { revert BurnDisabled(); } _burn(tokenId, true); } // ========================================================================= // Shuffling Entropy // ========================================================================= /** * @notice Commits to an IPFS URL and some random salt to derive ungameable * entropy for shuffling. * @param attributesURL the IPFS URL to a JSON file containing all * attributes of the unshuffled tokens. * @param saltHash the hash of a 256bit random salt * @dev Commitments are blocked for 256 blocks after a commitment, and * indefinitely after revealing the entropy. */ // solhint-disable-next-line no-unused-vars function commit(string calldata attributesURL, bytes32 saltHash) public onlyOwner { if (block.number - _entropyBlock < 256 || uint256(entropy) != 0) { revert CannotCommitAgain(); } _entropyBlock = block.number; _saltHashCommitment = saltHash; } /** * @notice Reveals the entropy that will be used to shuffle token content * for the token reveal. * @param salt The random salt used for the commitment. * @dev The commitment must have been made within the last 256 blocks. * @dev This form of entropy derivation can only be gamed in two ways: 1) if * we as the drivers would directly collude with many validators to only * include our commit transaction in blocks with favourable hashes (which * is very difficult in practice and outweighs any potential gain); or 2) * if we repeatedly fail to reveal the entropy and recommit, waiting for a * favourable blockhash to appear. The second approach can, however, be * easily detected from on-chain data, and we only keep the possibility for * recommitting as a last resort should we miss the reveal window for any * unforeseen reasons. */ function revealEntropy(bytes32 salt) public onlyOwner { bytes32 bhash = blockhash(_entropyBlock); bytes32 saltHash = keccak256(abi.encodePacked(salt)); if (uint256(bhash) == 0 || saltHash != _saltHashCommitment) { revert InvalidCommitment(); } entropy = keccak256(abi.encodePacked(bhash, saltHash)); delete _entropyBlock; delete _saltHashCommitment; } // ========================================================================= // Steering // ========================================================================= /** * @notice Changes the address allowed to do the premint configuration. * @dev Changing this address invalidates all existing allowances, if * the premint validator has not been signed yet. * @dev Can only be called by the contract owner. */ function setPremintSigner(address signer) public onlyOwner { _premintSigner = signer; } /** * @notice Advances the stage of the contract. * @dev Can only be advanced after the treasury reserve has been minted to * ensure the genesis tokens are minted. */ function setStage(Stage stage_) external onlyOwner { if (stageLocked) { revert StageLocked(); } stage = stage_; } /** * @notice Locks the minting stage of the contract. */ function lockStage() external onlyOwner { stageLocked = true; } /** * @notice Ensures that the contract is in a given stage. */ modifier onlyDuring(Stage stage_) { if (stage_ != stage) { revert DisallowedByCurrentStage(stage, stage_); } _; } /** * @notice Sets the receiver of the minting proceeds. */ function setPrimaryReciever(address payable primaryReceiver_) external onlyOwner { primaryReceiver = primaryReceiver_; } /** * @notice Reduces the number of tokens that can be minted free-of-charge * by the contract owner. */ function reduceOwnerMintAllocation(uint16 amount) external onlyOwner { ownerMintsRemaining -= amount; } /** * @notice Toggles if tokens can be burned by users. */ function toggleBurn(bool enabled) external onlyOwner { burnEnabled = enabled; } // ========================================================================= // Internals // ========================================================================= /** * @dev Inheritance resolution. */ function _baseURI() internal view virtual override(ERC721A, BaseTokenURI) returns (string memory) { return BaseTokenURI._baseURI(); } // ========================================================================= // Operator filtering // ========================================================================= function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public payable override onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom( address from, address to, uint256 tokenId ) public payable override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // 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; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @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(); // ============================================================= // 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 // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; /** @notice ERC721 extension that overrides the OpenZeppelin _baseURI() function to return a prefix that can be set by the contract owner. */ contract BaseTokenURI is Ownable { /// @notice Base token URI used as a prefix by tokenURI(). string public baseTokenURI; constructor(string memory _baseTokenURI) { setBaseTokenURI(_baseTokenURI); } /// @notice Sets the base token URI prefix. function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner { baseTokenURI = _baseTokenURI; } /** @notice Concatenates and returns the base token URI and the token ID without any additional characters (e.g. a slash). @dev This requires that an inheriting contract that also inherits from OZ's ERC721 will have to override both contracts; although we could simply require that users implement their own _baseURI() as here, this can easily be forgotten and the current approach guides them with compiler errors. This favours the latter half of "APIs should be easy to use and hard to misuse" from https://www.infoq.com/articles/API-Design-Joshua-Bloch/. */ function _baseURI() internal view virtual returns (string memory) { return baseTokenURI; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "erc721a/contracts/ERC721A.sol"; import "../utils/OwnerPausable.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; /** @notice An ERC721A contract with common functionality: - Pausable with toggling functions exposed to Owner only - ERC2981 royalties */ contract ERC721ACommon is ERC721A, OwnerPausable, ERC2981 { constructor( string memory name, string memory symbol, address payable royaltyReciever, uint96 royaltyBasisPoints ) ERC721A(name, symbol) { _setDefaultRoyalty(royaltyReciever, royaltyBasisPoints); } /// @notice Requires that the token exists. modifier tokenExists(uint256 tokenId) { require(ERC721A._exists(tokenId), "ERC721ACommon: Token doesn't exist"); _; } /// @notice Requires that msg.sender owns or is approved for the token. modifier onlyApprovedOrOwner(uint256 tokenId) { require( _ownershipOf(tokenId).addr == _msgSender() || getApproved(tokenId) == _msgSender(), "ERC721ACommon: Not approved nor owner" ); _; } function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override { require(!paused(), "ERC721ACommon: paused"); super._beforeTokenTransfers(from, to, startTokenId, quantity); } /// @notice Overrides supportsInterface as required by inheritance. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, ERC2981) returns (bool) { return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } /// @notice Sets the royalty receiver and percentage (in units of basis /// points = 0.01%). function setDefaultRoyalty(address receiver, uint96 basisPoints) public virtual onlyOwner { _setDefaultRoyalty(receiver, basisPoints); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; /// @notice A Pausable contract that can only be toggled by the Owner. contract OwnerPausable is Ownable, Pausable { /// @notice Pauses the contract. function pause() public onlyOwner { Pausable._pause(); } /// @notice Unpauses the contract. function unpause() public onlyOwner { Pausable._unpause(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../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. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // EIP-712 is Final as of 2022-08-11. This file is deprecated. import "./EIP712.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator(address registrant, address operator, bool filtered) external; function updateOperators(address registrant, address[] calldata operators, bool filtered) external; function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. */ abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.12; /// @title IPremintReady.sol /// @author Premint.xyz (https://premint.xyz) /// @author dievardump ([email protected], https://twitter.com/dievardump) /// @notice Interface followed by PremintReady contracts interface IPremintReady { struct PremintConfig { AccountAllowance allowance; bytes allowanceSignature; // address validator; // the address of the expected validator for this allowance bytes validatorAuthorizationSignature; // a signature by owner() recognizing `validator` as a valid signer on this contract } struct AccountAllowance { bytes32 listId; // the list uniq id (this way we can have 2 lists minting at the same time, same price, etc...) // @TODO: maybe not necessary, can be auto checked / added when verifying eip712 allowance address account; // the account for this allowance // @TODO: maybe not necessary, can be auto checked / added when verifying eip712 allowance address target; // the contract target (has to be address(this)) uint256 startsAt; // the timestamp (IN SECONDS, not ms) from when this allowance can be used uint256 endsAt; // the timestamp (IN SECONDS, not ms) until when this allowance can be used uint256 unitPrice; // the unitPrice for this allowance uint256 amount; // the max amount for this allowance } /// @notice Returns the maximal amount of tokens a wallet can mint through premint.xyz (all list included) /// @dev 0 means no limit. You should override this function in your contract if you wish for a max per wallet /// @return the maximal amount of tokens per wallet to mint through premint.xyz function premintMax() external view returns (uint256); /// @notice return the address of the person allowed to configure things on Premint /// @return an address function premintSigner() external view returns (address); /// @notice called by Premint.xyz front-end when an account tries to use their allowance /// @param config the premint config /// @param amount the amount to mint function premint(PremintConfig calldata config, uint256 amount) external payable; }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {PremintSigUtils} from "./PremintSigUtils.sol"; import {IPremintReady} from "./IPremintReady.sol"; /// @title PremintReady.sol /// @author Premint.xyz (https://premint.xyz) /// @author dievardump ([email protected], https://twitter.com/dievardump) /// @notice This contract allows https://premint.xyz to mint using the configuration set by owner() /// in the Premint interface /// /// It is very easy to implement and straightforward: /// 1) Extends this contract on your NFT contract (or your Minter contract) /// /// 2) Implement in your contract the function _premint(address to, uint256 amount) so when it is called it mints `amount` /// tokens to the address `to` /// /// 3) Implement in your contract the function premintSigner() view returns address so it returns the address of /// the wallet that will configure the lists on premint.xyz /// /// 4) Connect to https://premint.xyz with the account returned by premintSigner() and set up all the configuration your need. /// /// 5) Premint will then know how to communicate with your contract and offer safe minting through the Premint interface /// to the users in your lists abstract contract PremintReady is IPremintReady, EIP712 { error InvalidAmountZero(); error InvalidAmount(); error WrongTarget(); error InvalidPayment(); error NotAuthorized(); error TooManyRequested(); error PremintMaxPerWalletReached(); error ListNotStarted(); error ListHasEnded(); error PleaseImplementMe(); error InvalidValidatorAuthorizationSignature(); error InvalidAllowanceSignature(); string public constant PREMINT_READY_VERSION = "1"; /// @notice the allowance used, per list, for an account mapping(address => mapping(bytes32 => uint256)) public premintAllowanceUsed; /// @notice how many mint a wallet did through premint (if there is a max per wallet) mapping(address => uint256) public premintWalletMinted; constructor() EIP712("Premint.xyz", PREMINT_READY_VERSION) {} ///////////////////////////////////////////////////////// // Getters // ///////////////////////////////////////////////////////// /// @notice Returns the maximal amount of tokens a wallet can mint through premint.xyz (all list included) /// @dev 0 means no max. You should override this function in your contract if you wish for a max per wallet /// @return the maximal amount of tokens per wallet to mint through premint.xyz function premintMax() public view virtual returns (uint256) { return 0; } /// @notice returns the domain separator for this contract /// @dev here because it is useful for testing /// @return the domain separator function domainSeparator() public view returns (bytes32) { return _domainSeparatorV4(); } ///////////////////////////////////////////////////////// // Interactions // ///////////////////////////////////////////////////////// /// @notice called by Premint.xyz front-end when an account tries to use their allowance /// @param config the premint config /// @param amount the amount to mint function premint(PremintConfig calldata config, uint256 amount) public payable virtual { // amount != 0 if (amount == 0) { revert InvalidAmountZero(); } // Time check: mint for this list must have started if (config.allowance.startsAt > block.timestamp) { revert ListNotStarted(); } else if (config.allowance.endsAt <= block.timestamp) { // Time check: mint for this list must not have ended revert ListHasEnded(); } // Target check: allowance must be for current contract if (address(this) != config.allowance.target) { revert WrongTarget(); } // Account check: allowance must be for current msg.sender or address(0) which is public mint if (address(0) != config.allowance.account && msg.sender != config.allowance.account) { revert NotAuthorized(); } // Payment check: payment must be of the exact expected value (unitPrice * amount minted) if (msg.value != amount * config.allowance.unitPrice) { revert InvalidPayment(); } // Validator check: The owner of the contract recognizes config.validator as an authorized signer _validateValidator(config.validator, config.validatorAuthorizationSignature); // Allowance check: ensures that config.allowance was signed by config.validator _validateAllowance(config.validator, config.allowance, config.allowanceSignature); // Max Per Wallet check and update uint256 max = premintMax(); // we only keep track of how many were minted if there is a max per wallet if (max != 0) { uint256 walletMinted = premintWalletMinted[msg.sender] + amount; if (walletMinted > max) { revert PremintMaxPerWalletReached(); } premintWalletMinted[msg.sender] = walletMinted; } // Current List Allowance check and update // we only keep track of how many the user minted for this list, if this user has a max for this list if (config.allowance.amount != 0) { uint256 allowanceUsed = premintAllowanceUsed[msg.sender][config.allowance.listId] + amount; if (allowanceUsed > config.allowance.amount) { revert TooManyRequested(); } premintAllowanceUsed[msg.sender][config.allowance.listId] = allowanceUsed; } _premint(msg.sender, amount); } ///////////////////////////////////////////////////////// // Internals // ///////////////////////////////////////////////////////// /// @dev verifies that validator has been authorized by premintSigner() /// @param validator the validator address /// @param signature premintSigner()'s signature function _validateValidator(address validator, bytes calldata signature) internal view { bytes32 digest = PremintSigUtils.validatorDigest(_domainSeparatorV4(), address(this), validator); if (premintSigner() != ECDSA.recover(digest, signature)) { revert InvalidValidatorAuthorizationSignature(); } } /// @dev verifies that `validator` signed `allowance` /// @param validator the validator address /// @param allowance the allowance data /// @param signature validator's signature function _validateAllowance( address validator, AccountAllowance calldata allowance, bytes memory signature ) internal view { bytes32 digest = PremintSigUtils.allowanceDigest(_domainSeparatorV4(), allowance); if (validator != ECDSA.recover(digest, signature)) { revert InvalidAllowanceSignature(); } } ///////////////////////////////////////////////////////// // abstracts // ///////////////////////////////////////////////////////// /// @notice return the address of the person allowed to configure things on Premint /// @dev this function needs to be implemented in your contract to make it PremintReady /// @return an address function premintSigner() public view virtual returns (address); /// @notice function called internally in order to mint `amount` to `to` when the allowance has been verified /// @dev this function needs to be implemented in your contract to make it PremintReady /// @param to the recipient of the mint /// @param amount the amount of items to mint function _premint(address to, uint256 amount) internal virtual; }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {IPremintReady} from "./IPremintReady.sol"; /// @title PremintSigUtils.sol /// @author Premint.xyz (https://premint.xyz) /// @author dievardump ([email protected], https://twitter.com/dievardump) /// @notice This library has been created to allow other contracts to easily generate the same digest as /// PremintReady, for example when doing tests in solidity library PremintSigUtils { bytes32 public constant AUTHORIZE_VALIDATOR_HASH = keccak256(bytes("PremintAuthorizeValidator(address target,address validator)")); bytes32 public constant ALLOWANCE_HASH = keccak256( bytes( "PremintAllowance(bytes32 listId,address account,address target,uint256 startsAt,uint256 endsAt,uint256 unitPrice,uint256 amount)" ) ); ///////////////////////////////////////////////////////// // Getters // ///////////////////////////////////////////////////////// function validatorDigest( bytes32 domainSeparator, address target, address validator ) internal pure returns (bytes32) { return ECDSA.toTypedDataHash(domainSeparator, keccak256(abi.encode(AUTHORIZE_VALIDATOR_HASH, target, validator))); } function allowanceDigest(bytes32 domainSeparator, IPremintReady.AccountAllowance memory allowance) internal pure returns (bytes32) { return ECDSA.toTypedDataHash( domainSeparator, keccak256( abi.encode( ALLOWANCE_HASH, allowance.listId, allowance.account, allowance.target, allowance.startsAt, allowance.endsAt, allowance.unitPrice, allowance.amount ) ) ); } }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ERC721A/=lib/ERC721A/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc721a/=lib/ERC721A/", "ethier/=lib/ethier/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "operator-filter-registry/=lib/operator-filter-registry/src/", "premint-connect/=lib/premint-connect/services/contracts/src/" ], "optimizer": { "enabled": true, "runs": 9999 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address payable","name":"primaryReceiver_","type":"address"},{"internalType":"address payable","name":"royaltiesReceiver","type":"address"},{"internalType":"string","name":"baseTokenURI_","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BurnDisabled","type":"error"},{"inputs":[],"name":"CannotCommitAgain","type":"error"},{"inputs":[{"internalType":"enum Cockpunch.Stage","name":"got","type":"uint8"},{"internalType":"enum Cockpunch.Stage","name":"want","type":"uint8"}],"name":"DisallowedByCurrentStage","type":"error"},{"inputs":[],"name":"IllegalOperator","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"IncorrectPayment","type":"error"},{"inputs":[],"name":"InvalidAllowanceSignature","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidAmountZero","type":"error"},{"inputs":[],"name":"InvalidCommitment","type":"error"},{"inputs":[],"name":"InvalidPayment","type":"error"},{"inputs":[],"name":"InvalidValidatorAuthorizationSignature","type":"error"},{"inputs":[],"name":"ListHasEnded","type":"error"},{"inputs":[],"name":"ListNotStarted","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PleaseImplementMe","type":"error"},{"inputs":[],"name":"PremintMaxPerWalletReached","type":"error"},{"inputs":[],"name":"StageLocked","type":"error"},{"inputs":[],"name":"TooManyMintsRequested","type":"error"},{"inputs":[],"name":"TooManyRequested","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"WrongTarget","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"NUM_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PREMINT_READY_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"attributesURL","type":"string"},{"internalType":"bytes32","name":"saltHash","type":"bytes32"}],"name":"commit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entropy","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"num","type":"uint16"}],"internalType":"struct Cockpunch.OwnerMintReceiver[]","name":"receivers","type":"tuple[]"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ownerMintsRemaining","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"bytes32","name":"listId","type":"bytes32"},{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"startsAt","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"uint256","name":"unitPrice","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IPremintReady.AccountAllowance","name":"allowance","type":"tuple"},{"internalType":"bytes","name":"allowanceSignature","type":"bytes"},{"internalType":"address","name":"validator","type":"address"},{"internalType":"bytes","name":"validatorAuthorizationSignature","type":"bytes"}],"internalType":"struct IPremintReady.PremintConfig","name":"config","type":"tuple"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"premint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"premintAllowanceUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"premintMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"premintSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"premintWalletMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"primaryReceiver","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"reduceOwnerMintAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"salt","type":"bytes32"}],"name":"revealEntropy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseTokenURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"basisPoints","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"setPremintSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"primaryReceiver_","type":"address"}],"name":"setPrimaryReciever","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum Cockpunch.Stage","name":"stage_","type":"uint8"}],"name":"setStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stage","outputs":[{"internalType":"enum Cockpunch.Stage","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stageLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"toggleBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101406040523480156200001257600080fd5b506040516200433738038062004337833981016040819052620000359162000578565b733cc6cdda760b79bafa08df41ecfa224f810dceb660016040518060400160405280600b81526020016a283932b6b4b73a173c3cbd60a91b815250604051806040016040528060018152602001603160f81b815250846040518060400160405280601881526020017f434f434b50554e43482062792054696d20466572726973730000000000000000815250604051806040016040528060098152602001680869e8696a0aa9c86960bb1b815250886102b283838160029081620000fa919062000701565b50600362000109828262000701565b505060008055506200011b3362000374565b6008805460ff60a01b19169055620001348282620003c6565b505050506200014981620004cb60201b60201c565b50815160209283012081519183019190912060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818801819052818301969096526060810194909452608080850193909352308483018190528151808603909301835260c094850190915281519190950120905291909152610120526daaeb6d7670e522a718067333cd4e3b156200031e5780156200026c57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200024d57600080fd5b505af115801562000262573d6000803e3d6000fd5b505050506200031e565b6001600160a01b03821615620002bd5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af29039060440162000232565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b1580156200030457600080fd5b505af115801562000319573d6000803e3d6000fd5b505050505b50506008546001600160a01b0316600e8054600f80546001600160a01b0319166001600160a01b0397881617905591909416600164ffff00000160a01b0319909116176102cb60b81b1790925550620007cd9050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b03821611156200043a5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620004925760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000431565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b620004d5620004e7565b600b620004e3828262000701565b5050565b6008546001600160a01b03163314620005435760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000431565b565b80516001600160a01b03811681146200055d57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156200058e57600080fd5b620005998462000545565b92506020620005aa81860162000545565b60408601519093506001600160401b0380821115620005c857600080fd5b818701915087601f830112620005dd57600080fd5b815181811115620005f257620005f262000562565b604051601f8201601f19908116603f011681019083821181831017156200061d576200061d62000562565b816040528281528a868487010111156200063657600080fd5b600093505b828410156200065a57848401860151818501870152928501926200063b565b60008684830101528096505050505050509250925092565b600181811c908216806200068757607f821691505b602082108103620006a857634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620006fc57600081815260208120601f850160051c81016020861015620006d75750805b601f850160051c820191505b81811015620006f857828155600101620006e3565b5050505b505050565b81516001600160401b038111156200071d576200071d62000562565b62000735816200072e845462000672565b84620006ae565b602080601f8311600181146200076d5760008415620007545750858301515b600019600386901b1c1916600185901b178555620006f8565b600085815260208120601f198616915b828110156200079e578886015182559484019460019091019084016200077d565b5085821015620007bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516101005161012051613b1a6200081d60003960006126d601526000612725015260006127000152600061265901526000612683015260006126ad0152613b1a6000f3fe60806040526004361061031d5760003560e01c80636352211e116101a5578063c040e6b8116100ec578063e0681b4911610095578063f2fde38b1161006f578063f2fde38b14610959578063f698da2514610979578063f711efa41461098e578063f93d4db1146109bb57600080fd5b8063e0681b49146108dd578063e6a0bd65146108fb578063e985e9c51461091057600080fd5b8063ce3cd997116100c6578063ce3cd99714610870578063d102452114610890578063d547cfb7146108c857600080fd5b8063c040e6b8146107fe578063c87b56dd1461083d578063cb66ee151461085d57600080fd5b80638cbf95191161014e578063a22cb46511610128578063a22cb46514610798578063acf74033146107b8578063b88d4fde146107eb57600080fd5b80638cbf9519146107455780638da5cb5b1461076557806395d89b411461078357600080fd5b8063715018a61161017f578063715018a6146106fb5780638456cb5914610710578063899308a81461072557600080fd5b80636352211e146106a55780636f3a7f46146106c557806370a08231146106db57600080fd5b806330176e131161026957806342966c681161021257806358541c2a116101ec57806358541c2a1461062d5780635c975abb146106415780635dc96d161461067157600080fd5b806342966c68146105ae57806347ce07cc146105ce5780635743bdff146105e457600080fd5b80633f4ba83a116102435780633f4ba83a1461056457806341f434341461057957806342842e0e1461059b57600080fd5b806330176e13146105045780633868e217146105245780633ef51ada1461054457600080fd5b806314713956116102cb57806323b872dd116102a557806323b872dd14610469578063257d70bc1461047c5780632a55205a146104c557600080fd5b80631471395614610406578063159842681461042657806318160ddd1461044657600080fd5b806306fdde03116102fc57806306fdde0314610399578063081812fc146103bb578063095ea7b3146103f357600080fd5b80621fedb31461032257806301ffc9a71461034457806304634d8d14610379575b600080fd5b34801561032e57600080fd5b5061034261033d36600461304d565b6109db565b005b34801561035057600080fd5b5061036461035f36600461309f565b610a1f565b60405190151581526020015b60405180910390f35b34801561038557600080fd5b506103426103943660046130d1565b610a3f565b3480156103a557600080fd5b506103ae610a55565b604051610370919061316b565b3480156103c757600080fd5b506103db6103d636600461317e565b610ae7565b6040516001600160a01b039091168152602001610370565b610342610401366004613197565b610b44565b34801561041257600080fd5b506103426104213660046131c3565b610b5d565b34801561043257600080fd5b506103426104413660046131e0565b610b9f565b34801561045257600080fd5b50600154600054035b604051908152602001610370565b610342610477366004613255565b610d4d565b34801561048857600080fd5b506103ae6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b3480156104d157600080fd5b506104e56104e0366004613296565b610d72565b604080516001600160a01b039093168352602083019190915201610370565b34801561051057600080fd5b5061034261051f36600461335d565b610e51565b34801561053057600080fd5b5061034261053f3660046131c3565b610e65565b34801561055057600080fd5b5061034261055f36600461317e565b610ea7565b34801561057057600080fd5b50610342610f54565b34801561058557600080fd5b506103db6daaeb6d7670e522a718067333cd4e81565b6103426105a9366004613255565b610f66565b3480156105ba57600080fd5b506103426105c936600461317e565b610f8b565b3480156105da57600080fd5b5061045b60125481565b3480156105f057600080fd5b50600e5461061a9077010000000000000000000000000000000000000000000000900461ffff1681565b60405161ffff9091168152602001610370565b34801561063957600080fd5b50600161045b565b34801561064d57600080fd5b5060085474010000000000000000000000000000000000000000900460ff16610364565b34801561067d57600080fd5b50600e5461036490760100000000000000000000000000000000000000000000900460ff1681565b3480156106b157600080fd5b506103db6106c036600461317e565b610fef565b3480156106d157600080fd5b5061045b6115b381565b3480156106e757600080fd5b5061045b6106f63660046131c3565b610ffa565b34801561070757600080fd5b50610342611062565b34801561071c57600080fd5b50610342611074565b34801561073157600080fd5b50600f546103db906001600160a01b031681565b34801561075157600080fd5b506103426107603660046133b4565b611084565b34801561077157600080fd5b506008546001600160a01b03166103db565b34801561078f57600080fd5b506103ae6110d8565b3480156107a457600080fd5b506103426107b33660046133d1565b6110e7565b3480156107c457600080fd5b50600e54610364907501000000000000000000000000000000000000000000900460ff1681565b6103426107f93660046133ff565b6110fb565b34801561080a57600080fd5b50600e546108309074010000000000000000000000000000000000000000900460ff1681565b60405161037091906134e9565b34801561084957600080fd5b506103ae61085836600461317e565b611128565b61034261086b3660046134f7565b6111c5565b34801561087c57600080fd5b5061034261088b366004613534565b61151f565b34801561089c57600080fd5b5061045b6108ab366004613197565b600c60209081526000928352604080842090915290825290205481565b3480156108d457600080fd5b506103ae6115d6565b3480156108e957600080fd5b50600e546001600160a01b03166103db565b34801561090757600080fd5b50610342611664565b34801561091c57600080fd5b5061036461092b366004613555565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561096557600080fd5b506103426109743660046131c3565b6116ae565b34801561098557600080fd5b5061045b611740565b34801561099a57600080fd5b5061045b6109a93660046131c3565b600d6020526000908152604090205481565b3480156109c757600080fd5b506103426109d6366004613583565b61174f565b6109e36117b7565b80600e60178282829054906101000a900461ffff16610a02919061362a565b92506101000a81548161ffff021916908361ffff16021790555050565b6000610a2a82611811565b80610a395750610a39826118f2565b92915050565b610a476117b7565b610a518282611989565b5050565b606060028054610a649061364c565b80601f0160208091040260200160405190810160405280929190818152602001828054610a909061364c565b8015610add5780601f10610ab257610100808354040283529160200191610add565b820191906000526020600020905b815481529060010190602001808311610ac057829003601f168201915b5050505050905090565b6000610af282611ab4565b610b28576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610b4e81611af4565b610b588383611bdf565b505050565b610b656117b7565b600e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610ba76117b7565b600e5477010000000000000000000000000000000000000000000000900461ffff1660005b82811015610c85578161ffff16848483818110610beb57610beb61369f565b9050604002016020016020810190610c03919061304d565b61ffff161115610c3f576040517fd0b9d51c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b838382818110610c5157610c5161369f565b9050604002016020016020810190610c69919061304d565b610c73908361362a565b9150610c7e816136ce565b9050610bcc565b50600e80547fffffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffff167701000000000000000000000000000000000000000000000061ffff84160217905560005b82811015610d4757610d37848483818110610cee57610cee61369f565b610d0492602060409092020190810191506131c3565b858584818110610d1657610d1661369f565b9050604002016020016020810190610d2e919061304d565b61ffff16611ccd565b610d40816136ce565b9050610cd1565b50505050565b826001600160a01b0381163314610d6757610d6733611af4565b610d47848484611d42565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff16928201929092528291610e135750604080518082019091526009546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b602081015160009061271090610e37906bffffffffffffffffffffffff16876136e8565b610e419190613707565b91519350909150505b9250929050565b610e596117b7565b600b610a518282613788565b610e6d6117b7565b600f80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610eaf6117b7565b6010546040805160208082018590528251808303820181529183019092528051910120904090811580610ee457506011548114155b15610f1b576040517fc06789fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051602080820194909452808201929092528051808303820181526060909201905280519101206012555060006010819055601155565b610f5c6117b7565b610f64611f8d565b565b826001600160a01b0381163314610f8057610f8033611af4565b610d47848484611ffd565b600e54760100000000000000000000000000000000000000000000900460ff16610fe1576040517fbe20705f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fec816001612018565b50565b6000610a39826121d8565b60006001600160a01b03821661103c576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b61106a6117b7565b610f646000612271565b61107c6117b7565b610f646122db565b61108c6117b7565b600e8054911515760100000000000000000000000000000000000000000000027fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b606060038054610a649061364c565b816110f181611af4565b610b58838361234a565b836001600160a01b03811633146111155761111533611af4565b611121858585856123d4565b5050505050565b606061113382611ab4565b611169576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611173612431565b9050805160000361119357604051806020016040528060008152506111be565b8061119d8461243b565b6040516020016111ae929190613848565b6040516020818303038152906040525b9392505050565b806000036111ff576040517f674a518700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b426060830135111561123d576040517fa4542a3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b4260808301351161127a576040517f6774806b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61128a60608301604084016131c3565b6001600160a01b0316306001600160a01b0316146112d4576040517fa653e9d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112e460408301602084016131c3565b6001600160a01b03161580159061131c575061130660408301602084016131c3565b6001600160a01b0316336001600160a01b031614155b15611353576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61136160a0830135826136e8565b3414611399576040517f3c6b4b2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113c16113ae610120840161010085016131c3565b6113bc610120850185613877565b61247f565b61141e6113d6610120840161010085016131c3565b836113e460e0820182613877565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061253092505050565b6001336000908152600d602052604081205461143b9084906138dc565b905081811115611477576040517faac7bbb300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600d602052604090205560c08301351561151557336000908152600c60209081526040808320863584529091528120546114b89084906138dc565b905060c08401358111156114f8576040517f8d83cdd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600c60209081526040808320873584529091529020555b610b5833836125a7565b6115276117b7565b600e547501000000000000000000000000000000000000000000900460ff161561157d576040517f84b8298400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e80548291907fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000008360018111156115ce576115ce61347f565b021790555050565b600b80546115e39061364c565b80601f016020809104026020016040519081016040528092919081815260200182805461160f9061364c565b801561165c5780601f106116315761010080835404028352916020019161165c565b820191906000526020600020905b81548152906001019060200180831161163f57829003601f168201915b505050505081565b61166c6117b7565b600e80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b6116b66117b7565b6001600160a01b0381166117375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610fec81612271565b600061174a61264c565b905090565b6117576117b7565b6101006010544361176891906138ef565b1080611775575060125415155b156117ac576040517ff6ac6fa300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b436010556011555050565b6008546001600160a01b03163314610f645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161172e565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806118a457507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b80610a395750507fffffffff00000000000000000000000000000000000000000000000000000000167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a000000000000000000000000000000000000000000000000000000001480610a3957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a39565b6127106bffffffffffffffffffffffff82161115611a0f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c65507269636500000000000000000000000000000000000000000000606482015260840161172e565b6001600160a01b038216611a655760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161172e565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600955565b6000805482108015610a395750506000908152600460205260409020547c0100000000000000000000000000000000000000000000000000000000161590565b6daaeb6d7670e522a718067333cd4e3b15610fec576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611b7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9e9190613902565b610fec576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161172e565b6000611bea82610fef565b9050336001600160a01b03821614611c59576001600160a01b038116600090815260076020908152604080832033845290915290205460ff16611c59576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6115b381611cda60005490565b611ce491906138dc565b1115611d1c576040517fd0b9d51c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d268282612773565b3415610a5157600f54610a51906001600160a01b0316346128b1565b6000611d4d826121d8565b9050836001600160a01b0316816001600160a01b031614611d9a576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054611dc68187335b6001600160a01b039081169116811491141790565b611e27576001600160a01b038616600090815260076020908152604080832033845290915290205460ff16611e27576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516611e67576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e7486868660016129ca565b8015611e7f57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b177c0200000000000000000000000000000000000000000000000000000000176000858152600460205260408120919091557c020000000000000000000000000000000000000000000000000000000084169003611f4357600184016000818152600460205260408120549003611f41576000548114611f415760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b611f95612a3a565b600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610b58838383604051806020016040528060008152506110fb565b6000612023836121d8565b90508060008061204186600090815260066020526040902080549091565b9150915084156120b757612056818433611db1565b6120b7576001600160a01b038316600090815260076020908152604080832033845290915290205460ff166120b7576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120c58360008860016129ca565b80156120d057600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b177c0300000000000000000000000000000000000000000000000000000000176000878152600460205260408120919091557c0200000000000000000000000000000000000000000000000000000000851690036121905760018601600081815260046020526040812054900361218e57600054811461218e5760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b60008160005481101561223f57600081815260046020526040812054907c01000000000000000000000000000000000000000000000000000000008216900361223d575b806000036111be57506000190160008181526004602052604090205461221c565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600880546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6122e3612aa4565b600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611fe03390565b3360008181526007602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6123df848484610d4d565b6001600160a01b0383163b15610d47576123fb84848484612b0f565b610d47576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606061174a612c5e565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806124555750819003601f19909101908152919050565b600061249361248c61264c565b3086612c6d565b90506124d58184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612d2692505050565b6001600160a01b03166124f0600e546001600160a01b031690565b6001600160a01b031614610d47576040517fd51f522300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061255161253d61264c565b61254c3686900386018661391f565b612d4a565b905061255d8183612d26565b6001600160a01b0316846001600160a01b031614610d47576040517fa015e61c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e5460019074010000000000000000000000000000000000000000900460ff16818111156125d8576125d861347f565b8160018111156125ea576125ea61347f565b1461264257600e546040517f443ea74400000000000000000000000000000000000000000000000000000000815261172e9174010000000000000000000000000000000000000000900460ff169083906004016139b5565b610b588383611ccd565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156126a557507f000000000000000000000000000000000000000000000000000000000000000046145b156126cf57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008054908290036127b1576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127be60008483856129ca565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461286d57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101612835565b50816000036128a8576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b804710156129015760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161172e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461294e576040519150601f19603f3d011682016040523d82523d6000602084013e612953565b606091505b5050905080610b585760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161172e565b60085474010000000000000000000000000000000000000000900460ff1615612a355760405162461bcd60e51b815260206004820152601560248201527f45524337323141436f6d6d6f6e3a207061757365640000000000000000000000604482015260640161172e565b610d47565b60085474010000000000000000000000000000000000000000900460ff16610f645760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161172e565b60085474010000000000000000000000000000000000000000900460ff1615610f645760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161172e565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063150b7a0290612b5d9033908990889088906004016139d0565b6020604051808303816000875af1925050508015612b98575060408051601f3d908101601f19168201909252612b9591810190613a0c565b60015b612c0f573d808015612bc6576040519150601f19603f3d011682016040523d82523d6000602084013e612bcb565b606091505b508051600003612c07576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490505b949350505050565b6060600b8054610a649061364c565b6000612c56846040518060600160405280603b8152602001613a2a603b91398051602091820120604051612cbf9288918891019283526001600160a01b03918216602084015216604082015260600190565b60408051601f1981840301815282825280516020918201207f19010000000000000000000000000000000000000000000000000000000000008483015260228401949094526042808401949094528151808403909401845260629092019052815191012090565b6000806000612d358585612de2565b91509150612d4281612e24565b509392505050565b60006111be836040518060a0016040528060808152602001613a6560809139805160209182012085518683015160408089015160608a015160808b015160a08c015160c08d01519451612cbf9994959394929391920197885260208801969096526001600160a01b039485166040880152929093166060860152608085015260a084019190915260c083015260e08201526101000190565b6000808251604103612e185760208301516040840151606085015160001a612e0c87828585612f89565b94509450505050610e4a565b50600090506002610e4a565b6000816004811115612e3857612e3861347f565b03612e405750565b6001816004811115612e5457612e5461347f565b03612ea15760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161172e565b6002816004811115612eb557612eb561347f565b03612f025760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161172e565b6003816004811115612f1657612f1661347f565b03610fec5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161172e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612fc05750600090506003613044565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613014573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661303d57600060019250925050613044565b9150600090505b94509492505050565b60006020828403121561305f57600080fd5b813561ffff811681146111be57600080fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610fec57600080fd5b6000602082840312156130b157600080fd5b81356111be81613071565b6001600160a01b0381168114610fec57600080fd5b600080604083850312156130e457600080fd5b82356130ef816130bc565b915060208301356bffffffffffffffffffffffff8116811461311057600080fd5b809150509250929050565b60005b8381101561313657818101518382015260200161311e565b50506000910152565b6000815180845261315781602086016020860161311b565b601f01601f19169290920160200192915050565b6020815260006111be602083018461313f565b60006020828403121561319057600080fd5b5035919050565b600080604083850312156131aa57600080fd5b82356131b5816130bc565b946020939093013593505050565b6000602082840312156131d557600080fd5b81356111be816130bc565b600080602083850312156131f357600080fd5b823567ffffffffffffffff8082111561320b57600080fd5b818501915085601f83011261321f57600080fd5b81358181111561322e57600080fd5b8660208260061b850101111561324357600080fd5b60209290920196919550909350505050565b60008060006060848603121561326a57600080fd5b8335613275816130bc565b92506020840135613285816130bc565b929592945050506040919091013590565b600080604083850312156132a957600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115613302576133026132b8565b604051601f8501601f19908116603f0116810190828211818310171561332a5761332a6132b8565b8160405280935085815286868601111561334357600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561336f57600080fd5b813567ffffffffffffffff81111561338657600080fd5b8201601f8101841361339757600080fd5b612c56848235602084016132e7565b8015158114610fec57600080fd5b6000602082840312156133c657600080fd5b81356111be816133a6565b600080604083850312156133e457600080fd5b82356133ef816130bc565b91506020830135613110816133a6565b6000806000806080858703121561341557600080fd5b8435613420816130bc565b93506020850135613430816130bc565b925060408501359150606085013567ffffffffffffffff81111561345357600080fd5b8501601f8101871361346457600080fd5b613473878235602084016132e7565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600281106134e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610a3982846134ae565b6000806040838503121561350a57600080fd5b823567ffffffffffffffff81111561352157600080fd5b830161014081860312156131b557600080fd5b60006020828403121561354657600080fd5b8135600281106111be57600080fd5b6000806040838503121561356857600080fd5b8235613573816130bc565b91506020830135613110816130bc565b60008060006040848603121561359857600080fd5b833567ffffffffffffffff808211156135b057600080fd5b818601915086601f8301126135c457600080fd5b8135818111156135d357600080fd5b8760208285010111156135e557600080fd5b6020928301989097509590910135949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61ffff828116828216039080821115613645576136456135fb565b5092915050565b600181811c9082168061366057607f821691505b602082108103613699577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060001982036136e1576136e16135fb565b5060010190565b6000816000190483118215151615613702576137026135fb565b500290565b60008261373d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b601f821115610b5857600081815260208120601f850160051c810160208610156137695750805b601f850160051c820191505b81811015611f8557828155600101613775565b815167ffffffffffffffff8111156137a2576137a26132b8565b6137b6816137b0845461364c565b84613742565b602080601f8311600181146137eb57600084156137d35750858301515b600019600386901b1c1916600185901b178555611f85565b600085815260208120601f198616915b8281101561381a578886015182559484019460019091019084016137fb565b50858210156138385787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835161385a81846020880161311b565b83519083019061386e81836020880161311b565b01949350505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126138ac57600080fd5b83018035915067ffffffffffffffff8211156138c757600080fd5b602001915036819003821315610e4a57600080fd5b80820180821115610a3957610a396135fb565b81810381811115610a3957610a396135fb565b60006020828403121561391457600080fd5b81516111be816133a6565b600060e0828403121561393157600080fd5b60405160e0810181811067ffffffffffffffff82111715613954576139546132b8565b604052823581526020830135613969816130bc565b6020820152604083013561397c816130bc565b80604083015250606083013560608201526080830135608082015260a083013560a082015260c083013560c08201528091505092915050565b604081016139c382856134ae565b6111be60208301846134ae565b60006001600160a01b03808716835280861660208401525083604083015260806060830152613a02608083018461313f565b9695505050505050565b600060208284031215613a1e57600080fd5b81516111be8161307156fe5072656d696e74417574686f72697a6556616c696461746f722861646472657373207461726765742c616464726573732076616c696461746f72295072656d696e74416c6c6f77616e63652862797465733332206c69737449642c61646472657373206163636f756e742c61646472657373207461726765742c75696e743235362073746172747341742c75696e7432353620656e647341742c75696e7432353620756e697450726963652c75696e7432353620616d6f756e7429a2646970667358221220a14e36e94468e905900d27b4f89966856824f71018aba7f60dfd4b5a9776f83364736f6c634300081000330000000000000000000000005f475f6eb019913b0ef6ffdf78e3639324bced640000000000000000000000000004d4e53c574446613406b44df8110d9ae5c53d0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003e68747470733a2f2f74696d2d666572726973732d6d657461646174612d666337647a74617166612d75772e612e72756e2e6170702f6d657461646174612f0000
Deployed Bytecode
0x60806040526004361061031d5760003560e01c80636352211e116101a5578063c040e6b8116100ec578063e0681b4911610095578063f2fde38b1161006f578063f2fde38b14610959578063f698da2514610979578063f711efa41461098e578063f93d4db1146109bb57600080fd5b8063e0681b49146108dd578063e6a0bd65146108fb578063e985e9c51461091057600080fd5b8063ce3cd997116100c6578063ce3cd99714610870578063d102452114610890578063d547cfb7146108c857600080fd5b8063c040e6b8146107fe578063c87b56dd1461083d578063cb66ee151461085d57600080fd5b80638cbf95191161014e578063a22cb46511610128578063a22cb46514610798578063acf74033146107b8578063b88d4fde146107eb57600080fd5b80638cbf9519146107455780638da5cb5b1461076557806395d89b411461078357600080fd5b8063715018a61161017f578063715018a6146106fb5780638456cb5914610710578063899308a81461072557600080fd5b80636352211e146106a55780636f3a7f46146106c557806370a08231146106db57600080fd5b806330176e131161026957806342966c681161021257806358541c2a116101ec57806358541c2a1461062d5780635c975abb146106415780635dc96d161461067157600080fd5b806342966c68146105ae57806347ce07cc146105ce5780635743bdff146105e457600080fd5b80633f4ba83a116102435780633f4ba83a1461056457806341f434341461057957806342842e0e1461059b57600080fd5b806330176e13146105045780633868e217146105245780633ef51ada1461054457600080fd5b806314713956116102cb57806323b872dd116102a557806323b872dd14610469578063257d70bc1461047c5780632a55205a146104c557600080fd5b80631471395614610406578063159842681461042657806318160ddd1461044657600080fd5b806306fdde03116102fc57806306fdde0314610399578063081812fc146103bb578063095ea7b3146103f357600080fd5b80621fedb31461032257806301ffc9a71461034457806304634d8d14610379575b600080fd5b34801561032e57600080fd5b5061034261033d36600461304d565b6109db565b005b34801561035057600080fd5b5061036461035f36600461309f565b610a1f565b60405190151581526020015b60405180910390f35b34801561038557600080fd5b506103426103943660046130d1565b610a3f565b3480156103a557600080fd5b506103ae610a55565b604051610370919061316b565b3480156103c757600080fd5b506103db6103d636600461317e565b610ae7565b6040516001600160a01b039091168152602001610370565b610342610401366004613197565b610b44565b34801561041257600080fd5b506103426104213660046131c3565b610b5d565b34801561043257600080fd5b506103426104413660046131e0565b610b9f565b34801561045257600080fd5b50600154600054035b604051908152602001610370565b610342610477366004613255565b610d4d565b34801561048857600080fd5b506103ae6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b3480156104d157600080fd5b506104e56104e0366004613296565b610d72565b604080516001600160a01b039093168352602083019190915201610370565b34801561051057600080fd5b5061034261051f36600461335d565b610e51565b34801561053057600080fd5b5061034261053f3660046131c3565b610e65565b34801561055057600080fd5b5061034261055f36600461317e565b610ea7565b34801561057057600080fd5b50610342610f54565b34801561058557600080fd5b506103db6daaeb6d7670e522a718067333cd4e81565b6103426105a9366004613255565b610f66565b3480156105ba57600080fd5b506103426105c936600461317e565b610f8b565b3480156105da57600080fd5b5061045b60125481565b3480156105f057600080fd5b50600e5461061a9077010000000000000000000000000000000000000000000000900461ffff1681565b60405161ffff9091168152602001610370565b34801561063957600080fd5b50600161045b565b34801561064d57600080fd5b5060085474010000000000000000000000000000000000000000900460ff16610364565b34801561067d57600080fd5b50600e5461036490760100000000000000000000000000000000000000000000900460ff1681565b3480156106b157600080fd5b506103db6106c036600461317e565b610fef565b3480156106d157600080fd5b5061045b6115b381565b3480156106e757600080fd5b5061045b6106f63660046131c3565b610ffa565b34801561070757600080fd5b50610342611062565b34801561071c57600080fd5b50610342611074565b34801561073157600080fd5b50600f546103db906001600160a01b031681565b34801561075157600080fd5b506103426107603660046133b4565b611084565b34801561077157600080fd5b506008546001600160a01b03166103db565b34801561078f57600080fd5b506103ae6110d8565b3480156107a457600080fd5b506103426107b33660046133d1565b6110e7565b3480156107c457600080fd5b50600e54610364907501000000000000000000000000000000000000000000900460ff1681565b6103426107f93660046133ff565b6110fb565b34801561080a57600080fd5b50600e546108309074010000000000000000000000000000000000000000900460ff1681565b60405161037091906134e9565b34801561084957600080fd5b506103ae61085836600461317e565b611128565b61034261086b3660046134f7565b6111c5565b34801561087c57600080fd5b5061034261088b366004613534565b61151f565b34801561089c57600080fd5b5061045b6108ab366004613197565b600c60209081526000928352604080842090915290825290205481565b3480156108d457600080fd5b506103ae6115d6565b3480156108e957600080fd5b50600e546001600160a01b03166103db565b34801561090757600080fd5b50610342611664565b34801561091c57600080fd5b5061036461092b366004613555565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561096557600080fd5b506103426109743660046131c3565b6116ae565b34801561098557600080fd5b5061045b611740565b34801561099a57600080fd5b5061045b6109a93660046131c3565b600d6020526000908152604090205481565b3480156109c757600080fd5b506103426109d6366004613583565b61174f565b6109e36117b7565b80600e60178282829054906101000a900461ffff16610a02919061362a565b92506101000a81548161ffff021916908361ffff16021790555050565b6000610a2a82611811565b80610a395750610a39826118f2565b92915050565b610a476117b7565b610a518282611989565b5050565b606060028054610a649061364c565b80601f0160208091040260200160405190810160405280929190818152602001828054610a909061364c565b8015610add5780601f10610ab257610100808354040283529160200191610add565b820191906000526020600020905b815481529060010190602001808311610ac057829003601f168201915b5050505050905090565b6000610af282611ab4565b610b28576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610b4e81611af4565b610b588383611bdf565b505050565b610b656117b7565b600e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610ba76117b7565b600e5477010000000000000000000000000000000000000000000000900461ffff1660005b82811015610c85578161ffff16848483818110610beb57610beb61369f565b9050604002016020016020810190610c03919061304d565b61ffff161115610c3f576040517fd0b9d51c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b838382818110610c5157610c5161369f565b9050604002016020016020810190610c69919061304d565b610c73908361362a565b9150610c7e816136ce565b9050610bcc565b50600e80547fffffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffff167701000000000000000000000000000000000000000000000061ffff84160217905560005b82811015610d4757610d37848483818110610cee57610cee61369f565b610d0492602060409092020190810191506131c3565b858584818110610d1657610d1661369f565b9050604002016020016020810190610d2e919061304d565b61ffff16611ccd565b610d40816136ce565b9050610cd1565b50505050565b826001600160a01b0381163314610d6757610d6733611af4565b610d47848484611d42565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff16928201929092528291610e135750604080518082019091526009546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b602081015160009061271090610e37906bffffffffffffffffffffffff16876136e8565b610e419190613707565b91519350909150505b9250929050565b610e596117b7565b600b610a518282613788565b610e6d6117b7565b600f80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610eaf6117b7565b6010546040805160208082018590528251808303820181529183019092528051910120904090811580610ee457506011548114155b15610f1b576040517fc06789fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051602080820194909452808201929092528051808303820181526060909201905280519101206012555060006010819055601155565b610f5c6117b7565b610f64611f8d565b565b826001600160a01b0381163314610f8057610f8033611af4565b610d47848484611ffd565b600e54760100000000000000000000000000000000000000000000900460ff16610fe1576040517fbe20705f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610fec816001612018565b50565b6000610a39826121d8565b60006001600160a01b03821661103c576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b61106a6117b7565b610f646000612271565b61107c6117b7565b610f646122db565b61108c6117b7565b600e8054911515760100000000000000000000000000000000000000000000027fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b606060038054610a649061364c565b816110f181611af4565b610b58838361234a565b836001600160a01b03811633146111155761111533611af4565b611121858585856123d4565b5050505050565b606061113382611ab4565b611169576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611173612431565b9050805160000361119357604051806020016040528060008152506111be565b8061119d8461243b565b6040516020016111ae929190613848565b6040516020818303038152906040525b9392505050565b806000036111ff576040517f674a518700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b426060830135111561123d576040517fa4542a3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b4260808301351161127a576040517f6774806b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61128a60608301604084016131c3565b6001600160a01b0316306001600160a01b0316146112d4576040517fa653e9d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112e460408301602084016131c3565b6001600160a01b03161580159061131c575061130660408301602084016131c3565b6001600160a01b0316336001600160a01b031614155b15611353576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61136160a0830135826136e8565b3414611399576040517f3c6b4b2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113c16113ae610120840161010085016131c3565b6113bc610120850185613877565b61247f565b61141e6113d6610120840161010085016131c3565b836113e460e0820182613877565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061253092505050565b6001336000908152600d602052604081205461143b9084906138dc565b905081811115611477576040517faac7bbb300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600d602052604090205560c08301351561151557336000908152600c60209081526040808320863584529091528120546114b89084906138dc565b905060c08401358111156114f8576040517f8d83cdd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600c60209081526040808320873584529091529020555b610b5833836125a7565b6115276117b7565b600e547501000000000000000000000000000000000000000000900460ff161561157d576040517f84b8298400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e80548291907fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000008360018111156115ce576115ce61347f565b021790555050565b600b80546115e39061364c565b80601f016020809104026020016040519081016040528092919081815260200182805461160f9061364c565b801561165c5780601f106116315761010080835404028352916020019161165c565b820191906000526020600020905b81548152906001019060200180831161163f57829003601f168201915b505050505081565b61166c6117b7565b600e80547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b6116b66117b7565b6001600160a01b0381166117375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610fec81612271565b600061174a61264c565b905090565b6117576117b7565b6101006010544361176891906138ef565b1080611775575060125415155b156117ac576040517ff6ac6fa300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b436010556011555050565b6008546001600160a01b03163314610f645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161172e565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614806118a457507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b80610a395750507fffffffff00000000000000000000000000000000000000000000000000000000167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a000000000000000000000000000000000000000000000000000000001480610a3957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a39565b6127106bffffffffffffffffffffffff82161115611a0f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c65507269636500000000000000000000000000000000000000000000606482015260840161172e565b6001600160a01b038216611a655760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161172e565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600955565b6000805482108015610a395750506000908152600460205260409020547c0100000000000000000000000000000000000000000000000000000000161590565b6daaeb6d7670e522a718067333cd4e3b15610fec576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611b7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9e9190613902565b610fec576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b038216600482015260240161172e565b6000611bea82610fef565b9050336001600160a01b03821614611c59576001600160a01b038116600090815260076020908152604080832033845290915290205460ff16611c59576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6115b381611cda60005490565b611ce491906138dc565b1115611d1c576040517fd0b9d51c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611d268282612773565b3415610a5157600f54610a51906001600160a01b0316346128b1565b6000611d4d826121d8565b9050836001600160a01b0316816001600160a01b031614611d9a576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054611dc68187335b6001600160a01b039081169116811491141790565b611e27576001600160a01b038616600090815260076020908152604080832033845290915290205460ff16611e27576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516611e67576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e7486868660016129ca565b8015611e7f57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b177c0200000000000000000000000000000000000000000000000000000000176000858152600460205260408120919091557c020000000000000000000000000000000000000000000000000000000084169003611f4357600184016000818152600460205260408120549003611f41576000548114611f415760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b611f95612a3a565b600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b610b58838383604051806020016040528060008152506110fb565b6000612023836121d8565b90508060008061204186600090815260066020526040902080549091565b9150915084156120b757612056818433611db1565b6120b7576001600160a01b038316600090815260076020908152604080832033845290915290205460ff166120b7576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6120c58360008860016129ca565b80156120d057600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b177c0300000000000000000000000000000000000000000000000000000000176000878152600460205260408120919091557c0200000000000000000000000000000000000000000000000000000000851690036121905760018601600081815260046020526040812054900361218e57600054811461218e5760008181526004602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050600180548101905550505050565b60008160005481101561223f57600081815260046020526040812054907c01000000000000000000000000000000000000000000000000000000008216900361223d575b806000036111be57506000190160008181526004602052604090205461221c565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600880546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6122e3612aa4565b600880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611fe03390565b3360008181526007602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6123df848484610d4d565b6001600160a01b0383163b15610d47576123fb84848484612b0f565b610d47576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606061174a612c5e565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806124555750819003601f19909101908152919050565b600061249361248c61264c565b3086612c6d565b90506124d58184848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612d2692505050565b6001600160a01b03166124f0600e546001600160a01b031690565b6001600160a01b031614610d47576040517fd51f522300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061255161253d61264c565b61254c3686900386018661391f565b612d4a565b905061255d8183612d26565b6001600160a01b0316846001600160a01b031614610d47576040517fa015e61c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e5460019074010000000000000000000000000000000000000000900460ff16818111156125d8576125d861347f565b8160018111156125ea576125ea61347f565b1461264257600e546040517f443ea74400000000000000000000000000000000000000000000000000000000815261172e9174010000000000000000000000000000000000000000900460ff169083906004016139b5565b610b588383611ccd565b6000306001600160a01b037f000000000000000000000000c178994cb9b66307cd62db8b411759dd36d9c2ee161480156126a557507f000000000000000000000000000000000000000000000000000000000000000146145b156126cf57507fa7d4b7a49c4f3e8542506e2af9e7bb5c09a471ecd82beee871e734a3aee9ce0690565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f66bcda8f1e4db0bf5c6a0d809cd65e020b309aa5b25eacf6d55a1f25501a4811828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008054908290036127b1576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6127be60008483856129ca565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461286d57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101612835565b50816000036128a8576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b804710156129015760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161172e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461294e576040519150601f19603f3d011682016040523d82523d6000602084013e612953565b606091505b5050905080610b585760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161172e565b60085474010000000000000000000000000000000000000000900460ff1615612a355760405162461bcd60e51b815260206004820152601560248201527f45524337323141436f6d6d6f6e3a207061757365640000000000000000000000604482015260640161172e565b610d47565b60085474010000000000000000000000000000000000000000900460ff16610f645760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161172e565b60085474010000000000000000000000000000000000000000900460ff1615610f645760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161172e565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063150b7a0290612b5d9033908990889088906004016139d0565b6020604051808303816000875af1925050508015612b98575060408051601f3d908101601f19168201909252612b9591810190613a0c565b60015b612c0f573d808015612bc6576040519150601f19603f3d011682016040523d82523d6000602084013e612bcb565b606091505b508051600003612c07576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490505b949350505050565b6060600b8054610a649061364c565b6000612c56846040518060600160405280603b8152602001613a2a603b91398051602091820120604051612cbf9288918891019283526001600160a01b03918216602084015216604082015260600190565b60408051601f1981840301815282825280516020918201207f19010000000000000000000000000000000000000000000000000000000000008483015260228401949094526042808401949094528151808403909401845260629092019052815191012090565b6000806000612d358585612de2565b91509150612d4281612e24565b509392505050565b60006111be836040518060a0016040528060808152602001613a6560809139805160209182012085518683015160408089015160608a015160808b015160a08c015160c08d01519451612cbf9994959394929391920197885260208801969096526001600160a01b039485166040880152929093166060860152608085015260a084019190915260c083015260e08201526101000190565b6000808251604103612e185760208301516040840151606085015160001a612e0c87828585612f89565b94509450505050610e4a565b50600090506002610e4a565b6000816004811115612e3857612e3861347f565b03612e405750565b6001816004811115612e5457612e5461347f565b03612ea15760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161172e565b6002816004811115612eb557612eb561347f565b03612f025760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161172e565b6003816004811115612f1657612f1661347f565b03610fec5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161172e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612fc05750600090506003613044565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613014573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661303d57600060019250925050613044565b9150600090505b94509492505050565b60006020828403121561305f57600080fd5b813561ffff811681146111be57600080fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610fec57600080fd5b6000602082840312156130b157600080fd5b81356111be81613071565b6001600160a01b0381168114610fec57600080fd5b600080604083850312156130e457600080fd5b82356130ef816130bc565b915060208301356bffffffffffffffffffffffff8116811461311057600080fd5b809150509250929050565b60005b8381101561313657818101518382015260200161311e565b50506000910152565b6000815180845261315781602086016020860161311b565b601f01601f19169290920160200192915050565b6020815260006111be602083018461313f565b60006020828403121561319057600080fd5b5035919050565b600080604083850312156131aa57600080fd5b82356131b5816130bc565b946020939093013593505050565b6000602082840312156131d557600080fd5b81356111be816130bc565b600080602083850312156131f357600080fd5b823567ffffffffffffffff8082111561320b57600080fd5b818501915085601f83011261321f57600080fd5b81358181111561322e57600080fd5b8660208260061b850101111561324357600080fd5b60209290920196919550909350505050565b60008060006060848603121561326a57600080fd5b8335613275816130bc565b92506020840135613285816130bc565b929592945050506040919091013590565b600080604083850312156132a957600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115613302576133026132b8565b604051601f8501601f19908116603f0116810190828211818310171561332a5761332a6132b8565b8160405280935085815286868601111561334357600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561336f57600080fd5b813567ffffffffffffffff81111561338657600080fd5b8201601f8101841361339757600080fd5b612c56848235602084016132e7565b8015158114610fec57600080fd5b6000602082840312156133c657600080fd5b81356111be816133a6565b600080604083850312156133e457600080fd5b82356133ef816130bc565b91506020830135613110816133a6565b6000806000806080858703121561341557600080fd5b8435613420816130bc565b93506020850135613430816130bc565b925060408501359150606085013567ffffffffffffffff81111561345357600080fd5b8501601f8101871361346457600080fd5b613473878235602084016132e7565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600281106134e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60208101610a3982846134ae565b6000806040838503121561350a57600080fd5b823567ffffffffffffffff81111561352157600080fd5b830161014081860312156131b557600080fd5b60006020828403121561354657600080fd5b8135600281106111be57600080fd5b6000806040838503121561356857600080fd5b8235613573816130bc565b91506020830135613110816130bc565b60008060006040848603121561359857600080fd5b833567ffffffffffffffff808211156135b057600080fd5b818601915086601f8301126135c457600080fd5b8135818111156135d357600080fd5b8760208285010111156135e557600080fd5b6020928301989097509590910135949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b61ffff828116828216039080821115613645576136456135fb565b5092915050565b600181811c9082168061366057607f821691505b602082108103613699577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060001982036136e1576136e16135fb565b5060010190565b6000816000190483118215151615613702576137026135fb565b500290565b60008261373d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b601f821115610b5857600081815260208120601f850160051c810160208610156137695750805b601f850160051c820191505b81811015611f8557828155600101613775565b815167ffffffffffffffff8111156137a2576137a26132b8565b6137b6816137b0845461364c565b84613742565b602080601f8311600181146137eb57600084156137d35750858301515b600019600386901b1c1916600185901b178555611f85565b600085815260208120601f198616915b8281101561381a578886015182559484019460019091019084016137fb565b50858210156138385787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835161385a81846020880161311b565b83519083019061386e81836020880161311b565b01949350505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126138ac57600080fd5b83018035915067ffffffffffffffff8211156138c757600080fd5b602001915036819003821315610e4a57600080fd5b80820180821115610a3957610a396135fb565b81810381811115610a3957610a396135fb565b60006020828403121561391457600080fd5b81516111be816133a6565b600060e0828403121561393157600080fd5b60405160e0810181811067ffffffffffffffff82111715613954576139546132b8565b604052823581526020830135613969816130bc565b6020820152604083013561397c816130bc565b80604083015250606083013560608201526080830135608082015260a083013560a082015260c083013560c08201528091505092915050565b604081016139c382856134ae565b6111be60208301846134ae565b60006001600160a01b03808716835280861660208401525083604083015260806060830152613a02608083018461313f565b9695505050505050565b600060208284031215613a1e57600080fd5b81516111be8161307156fe5072656d696e74417574686f72697a6556616c696461746f722861646472657373207461726765742c616464726573732076616c696461746f72295072656d696e74416c6c6f77616e63652862797465733332206c69737449642c61646472657373206163636f756e742c61646472657373207461726765742c75696e743235362073746172747341742c75696e7432353620656e647341742c75696e7432353620756e697450726963652c75696e7432353620616d6f756e7429a2646970667358221220a14e36e94468e905900d27b4f89966856824f71018aba7f60dfd4b5a9776f83364736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005f475f6eb019913b0ef6ffdf78e3639324bced640000000000000000000000000004d4e53c574446613406b44df8110d9ae5c53d0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000003e68747470733a2f2f74696d2d666572726973732d6d657461646174612d666337647a74617166612d75772e612e72756e2e6170702f6d657461646174612f0000
-----Decoded View---------------
Arg [0] : primaryReceiver_ (address): 0x5F475f6eB019913b0eF6FFDF78e3639324BCeD64
Arg [1] : royaltiesReceiver (address): 0x0004d4E53c574446613406b44DF8110D9aE5c53d
Arg [2] : baseTokenURI_ (string): https://tim-ferriss-metadata-fc7dztaqfa-uw.a.run.app/metadata/
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f475f6eb019913b0ef6ffdf78e3639324bced64
Arg [1] : 0000000000000000000000000004d4e53c574446613406b44df8110d9ae5c53d
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 000000000000000000000000000000000000000000000000000000000000003e
Arg [4] : 68747470733a2f2f74696d2d666572726973732d6d657461646174612d666337
Arg [5] : 647a74617166612d75772e612e72756e2e6170702f6d657461646174612f0000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.