Polygon Sponsored slots available. Book your slot here!
Contract Overview
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
DEFYGenesisMask
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 50 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol"; import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol"; import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol"; import "./InviteTypes.sol"; import "./IDEFYGenesisInvite.sol"; // ______ _____________ __ // | _ \ ___| ___\ \ / / // | | | | |__ | |_ \ V / // | | | | __|| _| \ / // | |/ /| |___| | | | // |___/ \____/\_| \_/ // // WELCOME TO THE REVOLUTION // Reading our smart contract hey? There's a hidden message somewhere on this contract, see if you can find it... ;) contract DEFYGenesisMask is ERC721, ERC721Enumerable, Pausable, AccessControl, Ownable, InviteTypes, ReentrancyGuard, VRFConsumerBaseV2 { using Counters for Counters.Counter; // Roles bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant TOKEN_UNLOCKER_ROLE = keccak256("TOKEN_UNLOCKER_ROLE"); bytes32 public constant BALANCE_WITHDRAWER_ROLE = keccak256("BALANCE_WITHDRAWER_ROLE"); // Counters for number of public tokens minted and DEFY admin tokens minted Counters.Counter private _tokenIdCounter; Counters.Counter private _defyTokenIdCounter; // Maximum masks to be minted on this contract uint256 private constant MAX_MASKS = 8888; // Number of masks reserved for DEFY to distribute as prizes uint256 private constant DEFY_RESERVED_MASKS = 200; // Invite series ids uint256 private constant PHASE_ONE_INVITE_SERIES_ID = 0; uint256 private constant PHASE_TWO_INVITE_SERIES_ID = 2; uint256 private constant PRIZE_MASK_VALUE = 100000; uint256 private constant ELITE_MASK_MID_VALUE = 1000; uint256 private constant MID_MASK_MID_VALUE = 100; uint256 private constant LOW_MASK_MID_VALUE = 10; // ChainlinkVRF config values. Default values set for Polygon mainnet VRFCoordinatorV2Interface VRFCOORDINATOR; LinkTokenInterface LINKTOKEN; uint64 public vrfSubscriptionId; bytes32 public vrfKeyHash = 0xd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a8; uint32 public vrfCallbackGasLimit = 100000; // Types of masks for the purpose of rewards // PRIZE_MASK gets 100,000 tokens ($10k worth) // ELITE_MASK gets 800-1,200 ($80 - $120 worth) // MID_MASK gets 80-120 tokens ($8 - $12 worth) // LOW_MASK gets 8-12 tokens ($0.80 - $1.20 worth) enum MaskType { PRIZE_MASK, ELITE_MASK, MID_MASK, LOW_MASK } mapping(uint256 => string) private _kha0sMsgs; // On-chain metadata, storing the number of bonded tokens and remaining bonded tokens struct DEFYGenesisMaskMetadata { uint256 totalBondedTokens; uint256 remainingBondedTokens; } // Reference to the genesis invite contract, for validating and spending invites during phase one and two IDEFYGenesisInvite public defyGenesisInvite; // Base URI for mask token uris string private _maskBaseURI; // Contract URI. This needs to be set at some point string private _contractURI; // Price (in MATIC) required to mint a mask uint256 public mintPrice; // Commission divisor uint256 public commissionDivisor; // Mapping to keep track of the number of remaining mask types mapping(MaskType => uint256) public _remainingMaskTypeAllocation; // Tracker of how many tokens have been bonded overall uint256 private _totalBondedTokens; // Mapping of mask id to on-chain bonded token metadata mapping(uint256 => DEFYGenesisMaskMetadata) private _defyGenesisMaskMetadata; mapping(uint256 => uint256) private _vrfRequestIdToTokenId; // State variables that are used to enable and disable the various minting phases via the below modifiers bool public phaseOneActive; bool public phaseTwoActive; bool public publicMintActive; bool public chainlinkVrfActive; event MaskTokensAssigned(uint256 tokenId, uint256 amount); event MaskTokensUnlocked(uint256 tokenId, uint256 amount); modifier whenPhaseOneActive() { require(phaseOneActive, 'DGM: Phase 1 not active'); _; } modifier whenPhaseTwoActive() { require(phaseTwoActive, 'DGM: Phase 2 not active'); _; } modifier whenPublicMintActive() { require(publicMintActive, 'DGM: Public mint not active'); _; } constructor(address vrfCoordinator, address vrfLinkToken) ERC721("DEFYGenesisMask", "DGM") VRFConsumerBaseV2(vrfCoordinator) { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); VRFCOORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator); LINKTOKEN = LinkTokenInterface(vrfLinkToken); // Set up the various mask type allocations _remainingMaskTypeAllocation[MaskType.PRIZE_MASK] = 1; _remainingMaskTypeAllocation[MaskType.ELITE_MASK] = 1000; _remainingMaskTypeAllocation[MaskType.MID_MASK] = 5500; _remainingMaskTypeAllocation[MaskType.LOW_MASK] = 2387; // Initialise the mint price mintPrice = 160 ether; // Start the contract with all phases disabled phaseOneActive = false; phaseTwoActive = false; publicMintActive = false; // Start contract without ChainlinkVRF chainlinkVrfActive = false; // Set the default commission divisor to 10 (10%) commissionDivisor = 10; // Initialise totalBondedTokens _totalBondedTokens = 0; // Skip mask zero _tokenIdCounter.increment(); } /// @notice Allow updating of the ChainlinkVRF parameters function updateChainlinkParameters(uint64 newVrfSubscriptionId, bytes32 newVrfKeyHash, uint32 newVrfCallbackGasLimit) public onlyRole(DEFAULT_ADMIN_ROLE) { vrfSubscriptionId = newVrfSubscriptionId; vrfKeyHash = newVrfKeyHash; vrfCallbackGasLimit = newVrfCallbackGasLimit; } /// @notice View the contract URI. This is needed to allow automatic importing of collection metadata on OpenSea function contractURI() public view returns (string memory) { return _contractURI; } /// @notice Sets the contract URI. function setContractURI(string memory uri) public onlyRole(DEFAULT_ADMIN_ROLE) { _contractURI = uri; } /// @notice Sets the base URI used for the tokens. This will be updated when new masks are uploaded to IPFS function setBaseURI(string memory uri) public onlyRole(DEFAULT_ADMIN_ROLE) { _maskBaseURI = uri; } /// @notice Get the TokenURI for the supplied token, in the form {baseURI}{tokenId}.json function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "DGM: URI query for nonexistent token"); return string(abi.encodePacked(_maskBaseURI, Strings.toString(tokenId), '.json')); } /// @notice Pause the contract, preventing public minting and transfers function pause() public onlyRole(PAUSER_ROLE) { _pause(); } /// @notice Unpause the contract, allowing public minting and transfers function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } /// @notice Admin function to allow updating of phase one status function updatePhaseOneStatus(bool active) public onlyRole(DEFAULT_ADMIN_ROLE) { phaseOneActive = active; } /// @notice Admin function to allow updating of phase two status function updatePhaseTwoStatus(bool active) public onlyRole(DEFAULT_ADMIN_ROLE) { phaseTwoActive = active; } /// @notice Admin function to allow updating of public mint status function updatePublicMintStatus(bool active) public onlyRole(DEFAULT_ADMIN_ROLE) { publicMintActive = active; } /// @notice Admin function to determine whether ChainlinkVRF is used for randomness of token assignment function updateChainlinkVrfActive(bool active) public onlyRole(DEFAULT_ADMIN_ROLE) { chainlinkVrfActive = active; } /// @notice Admin function to allow updating of the mint price function updateMintPrice(uint256 newMintPrice) public onlyRole(DEFAULT_ADMIN_ROLE) { mintPrice = newMintPrice; } function updateMsg(string memory message, uint256 index) public onlyRole(DEFAULT_ADMIN_ROLE) { _kha0sMsgs[index] = message; } /// @notice Admin function to update the phase 2 commission divisor function updatePhaseTwoCommissionDivisor(uint256 newCommissionDivisor) public onlyRole(DEFAULT_ADMIN_ROLE) { require(newCommissionDivisor != 0, 'DGM: Cannot set commission divisor to 0'); commissionDivisor = newCommissionDivisor; } /// @notice Admin function to allow updating of the connected invite contract address function updateInviteContractAddress(address inviteContractAddress) public onlyRole(DEFAULT_ADMIN_ROLE) { defyGenesisInvite = IDEFYGenesisInvite(inviteContractAddress); } /// @notice Public phase one mint function, allowing holders of a phase 1 invite to mint a mask function phaseOneInviteMint(uint256 inviteId) public payable whenNotPaused whenPhaseOneActive nonReentrant { require(msg.value == mintPrice, 'DGM: incorrect token amount sent to mint'); // Get invite metadata from invite contract DEFYGenesisInviteMetadata memory inviteMetadata = defyGenesisInvite.getInviteMetadata(inviteId); require(inviteMetadata.seriesId == PHASE_ONE_INVITE_SERIES_ID, 'DGM: cannot use invite fron another series for phase 1'); // Spend the invite. This function will revert the transaction if the invite has already been sent or does not belong to the msg sender defyGenesisInvite.spendInvite(inviteId, msg.sender); // Mint mask _mintMask(msg.sender); } /// @notice Public phase two mint function, allowing holders of a phase 2 invite to mint a mask. This function also pays a 10% commission to the original holder of the phase 2 invite function phaseTwoInviteMint(uint256 inviteId) public payable whenNotPaused whenPhaseTwoActive nonReentrant { require(msg.value == mintPrice, 'DGM: incorrect token amount sent to mint'); // Get invite metadata from invite contract DEFYGenesisInviteMetadata memory inviteMetadata = defyGenesisInvite.getInviteMetadata(inviteId); require(inviteMetadata.seriesId == PHASE_TWO_INVITE_SERIES_ID, 'DGM: cannot use invite fron another series for phase two'); // Spend the invite. This function will revert the transaction if the invite has already been sent or does not belong to the msg sender defyGenesisInvite.spendInvite(inviteId, msg.sender); // Mint mask _mintMask(msg.sender); // Pay 10% commission to original owner of invite (bool success,) = inviteMetadata.originalOwner.call{value : msg.value / commissionDivisor}(''); require(success, "DEFYGenesisMask: commission payment failed"); } /// @notice Public mint function, does not require the user to hold an invite to mint function publicMint() public payable whenNotPaused whenPublicMintActive { require(msg.value == mintPrice, 'DGM: incorrect token amount sent to mint'); _mintMask(msg.sender); } function validateCallerLoyalty(uint256 code) public view returns (string memory) { return _kha0sMsgs[code]; } /// @notice Underlying mint function that checks if there is any allocation remaining and triggers the ChainlinkVRF async function function _mintMask(address to) internal { uint256 tokenId = _tokenIdCounter.current(); require(tokenId < (MAX_MASKS - DEFY_RESERVED_MASKS), 'DGM: all public masks minted'); _tokenIdCounter.increment(); _safeMint(to, tokenId); if (chainlinkVrfActive) { submitRequestForRandomness(tokenId); } else { // Get random numbers uint256[] memory randomNumbers = new uint256[](2); randomNumbers[0] = random(tokenId); randomNumbers[1] = random(tokenId*15231); assignRandomTokenAmountToMask(tokenId, randomNumbers); } } /// @notice Admin mask minting function, allowing admins to airdrop masks for free, up to the reserved amount function adminMintMask(address to) public onlyRole(MINTER_ROLE) { uint256 tokenId = _defyTokenIdCounter.current() + (MAX_MASKS - DEFY_RESERVED_MASKS) ; require(tokenId >= MAX_MASKS - DEFY_RESERVED_MASKS, 'DGM: all public masks minted'); _defyTokenIdCounter.increment(); _safeMint(to, tokenId); if (chainlinkVrfActive) { submitRequestForRandomness(tokenId); } else { // Get random numbers uint256[] memory randomNumbers = new uint256[](2); randomNumbers[0] = random(tokenId); randomNumbers[1] = random(tokenId*15231); assignRandomTokenAmountToMask(tokenId, randomNumbers); } } // @notice Admin function to mint the zero mask function adminMintZeroMask(address to) public onlyRole(DEFAULT_ADMIN_ROLE) { require(!_exists(0), 'DGM: zero already minted'); _safeMint(to, 0); } // Send request for randomness and store the request id against the token id being minted function submitRequestForRandomness(uint256 tokenId) internal { uint16 minimumRequestConfirmations = 3; uint32 numWords = 2; // Kick off randomness request to VRF uint256 vrfRequestId = VRFCOORDINATOR.requestRandomWords( vrfKeyHash, vrfSubscriptionId, minimumRequestConfirmations, vrfCallbackGasLimit, numWords ); _vrfRequestIdToTokenId[vrfRequestId] = tokenId; } function random(uint256 seed) private view returns (uint256) { return uint256(keccak256(abi.encodePacked(block.difficulty, block.timestamp, seed))); } /// @notice callback function from ChainlinkVRF that receives the onchain randomness function fulfillRandomWords( uint256 requestId, uint256[] memory randomWords ) internal override(VRFConsumerBaseV2) { assignRandomTokenAmountToMask(_vrfRequestIdToTokenId[requestId], randomWords); } /// @notice assign tokens to the mask using the ChainlinkVRF random words as seeds function assignRandomTokenAmountToMask(uint256 tokenId, uint256[] memory randomWords) internal { // Check if prize mask still available, and ignore if this is an admin minted mask if (_remainingMaskTypeAllocation[MaskType.PRIZE_MASK] > 0 && tokenId < MAX_MASKS - DEFY_RESERVED_MASKS) { // Prize is still available, check if it was won // Check is done by performing randomValue mod total remaining masks, if value is 0, prize was won // This gives you a 1/{remaining masks} chance of winning bool won = (randomWords[0] % (MAX_MASKS - DEFY_RESERVED_MASKS - tokenId)) == 0; if (won) { _defyGenesisMaskMetadata[tokenId].totalBondedTokens = PRIZE_MASK_VALUE; _defyGenesisMaskMetadata[tokenId].remainingBondedTokens = PRIZE_MASK_VALUE; _remainingMaskTypeAllocation[MaskType.PRIZE_MASK] = 0; _totalBondedTokens += PRIZE_MASK_VALUE; emit MaskTokensAssigned(tokenId, PRIZE_MASK_VALUE); return; } } // No prize mask was won, continuing with award MaskType maskType; // First 1000 tokens have 50% chance of an elite mask if (tokenId < 1000) { bool isElite = (randomWords[0] % 2) == 0; if (isElite) { maskType = MaskType.ELITE_MASK; } else { maskType = MaskType.MID_MASK; } } else { uint256 totalRemainingMasks = _remainingMaskTypeAllocation[MaskType.ELITE_MASK] + _remainingMaskTypeAllocation[MaskType.MID_MASK] + _remainingMaskTypeAllocation[MaskType.LOW_MASK]; // Pick random number between 0 and total remaining masks uint256 selectedMaskType = randomWords[0] % totalRemainingMasks; // Divide remaining masks up across the values, going 0 - remainingElite-1, remainingElite - remainingMid-1, remainingMid - totalRemaining // Pick mask type based on the random number selected above maskType = selectedMaskType < _remainingMaskTypeAllocation[MaskType.ELITE_MASK] ? MaskType.ELITE_MASK : (selectedMaskType > totalRemainingMasks - _remainingMaskTypeAllocation[MaskType.LOW_MASK] ? MaskType.LOW_MASK : MaskType.MID_MASK); } uint256 rewardAmount; // Perform random swing of token value (get total swing range and subtract half to do negative amounts) if (maskType == MaskType.ELITE_MASK) { uint256 swingValue = (randomWords[1] % 401); rewardAmount = ELITE_MASK_MID_VALUE + swingValue - 200; } else if (maskType == MaskType.MID_MASK) { uint256 swingValue = (randomWords[1] % 41); rewardAmount = MID_MASK_MID_VALUE + swingValue - 20; } else { uint256 swingValue = (randomWords[1] % 5); rewardAmount = LOW_MASK_MID_VALUE + swingValue - 2; } _defyGenesisMaskMetadata[tokenId].totalBondedTokens = rewardAmount; _defyGenesisMaskMetadata[tokenId].remainingBondedTokens = rewardAmount; _totalBondedTokens += rewardAmount; _remainingMaskTypeAllocation[maskType] -= 1; emit MaskTokensAssigned(tokenId, rewardAmount); } /// @notice Get the total assigned tokens for a mask with the provided token id function getTotalBondedTokensForMask(uint256 tokenId) public view returns (uint256) { require(_exists(tokenId), 'DGM: token does not exist'); return _defyGenesisMaskMetadata[tokenId].totalBondedTokens; } /// @notice Get the total remaining bonded tokens for a mask with the provided token id function getRemainingBondedTokensForMask(uint256 tokenId) public view returns (uint256) { require(_exists(tokenId), 'DGM: token does not exist'); return _defyGenesisMaskMetadata[tokenId].remainingBondedTokens; } /// @notice Get the total amount of tokens that have been bonded across all masks on the contract function getTotalBondedTokens() public view returns (uint256) { return _totalBondedTokens; } /// @notice Function to be called by backend API when bonded token emission events happen in the app function unlockBondedTokensFromMask(uint256 tokenId, uint256 tokenAmount) public onlyRole(TOKEN_UNLOCKER_ROLE) { require(_exists(tokenId), "DGM: unlocking tokens from nonexistant mask"); require(tokenAmount < _defyGenesisMaskMetadata[tokenId].remainingBondedTokens, 'DGM: cannot unlock more tokens than remaining on mask'); _defyGenesisMaskMetadata[tokenId].remainingBondedTokens -= tokenAmount; } // Prevent token transferring when contract is paused function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal whenNotPaused override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } // Allow contract to receive MATIC directly receive() external payable {} // Allow withdrawal of the contract's current balance to the caller's address function withdrawBalance() public onlyRole(BALANCE_WITHDRAWER_ROLE) { (bool success,) = msg.sender.call{value : address(this).balance}(''); require(success, "DGM: Withdrawal failed"); } // Allow withdrawal of the contract's current balance to the caller's address function withdrawBalanceExceptFor(uint256 tokens) public onlyRole(BALANCE_WITHDRAWER_ROLE) { (bool success,) = msg.sender.call{value : address(this).balance - tokens}(''); require(success, "DGM: Withdrawal failed"); } // The following functions are overrides required by Solidity. function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @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, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @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. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @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 (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * 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, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * 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, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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 v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(address spender, uint256 value) external returns (bool success); function balanceOf(address owner) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); function decreaseApproval(address spender, uint256 addedValue) external returns (bool success); function increaseApproval(address spender, uint256 subtractedValue) external; function name() external view returns (string memory tokenName); function symbol() external view returns (string memory tokenSymbol); function totalSupply() external view returns (uint256 totalTokensIssued); function transfer(address to, uint256 value) external returns (bool success); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns (bool success); function transferFrom( address from, address to, uint256 value ) external returns (bool success); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface VRFCoordinatorV2Interface { /** * @notice Get configuration relevant for making requests * @return minimumRequestConfirmations global min for request confirmations * @return maxGasLimit global max for request gas limit * @return s_provingKeyHashes list of registered key hashes */ function getRequestConfig() external view returns ( uint16, uint32, bytes32[] memory ); /** * @notice Request a set of random words. * @param keyHash - Corresponds to a particular oracle job which uses * that key for generating the VRF proof. Different keyHash's have different gas price * ceilings, so you can select a specific one to bound your maximum per request cost. * @param subId - The ID of the VRF subscription. Must be funded * with the minimum subscription balance required for the selected keyHash. * @param minimumRequestConfirmations - How many blocks you'd like the * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS * for why you may want to request more. The acceptable range is * [minimumRequestBlockConfirmations, 200]. * @param callbackGasLimit - How much gas you'd like to receive in your * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords * may be slightly less than this amount because of gas used calling the function * (argument decoding etc.), so you may need to request slightly more than you expect * to have inside fulfillRandomWords. The acceptable range is * [0, maxGasLimit] * @param numWords - The number of uint256 random values you'd like to receive * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ function requestRandomWords( bytes32 keyHash, uint64 subId, uint16 minimumRequestConfirmations, uint32 callbackGasLimit, uint32 numWords ) external returns (uint256 requestId); /** * @notice Create a VRF subscription. * @return subId - A unique subscription id. * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer. * @dev Note to fund the subscription, use transferAndCall. For example * @dev LINKTOKEN.transferAndCall( * @dev address(COORDINATOR), * @dev amount, * @dev abi.encode(subId)); */ function createSubscription() external returns (uint64 subId); /** * @notice Get a VRF subscription. * @param subId - ID of the subscription * @return balance - LINK balance of the subscription in juels. * @return reqCount - number of requests for this subscription, determines fee tier. * @return owner - owner of the subscription. * @return consumers - list of consumer address which are able to use this subscription. */ function getSubscription(uint64 subId) external view returns ( uint96 balance, uint64 reqCount, address owner, address[] memory consumers ); /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @param newOwner - proposed new owner of the subscription */ function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external; /** * @notice Request subscription owner transfer. * @param subId - ID of the subscription * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ function acceptSubscriptionOwnerTransfer(uint64 subId) external; /** * @notice Add a consumer to a VRF subscription. * @param subId - ID of the subscription * @param consumer - New consumer which can use the subscription */ function addConsumer(uint64 subId, address consumer) external; /** * @notice Remove a consumer from a VRF subscription. * @param subId - ID of the subscription * @param consumer - Consumer to remove from the subscription */ function removeConsumer(uint64 subId, address consumer) external; /** * @notice Cancel a subscription * @param subId - ID of the subscription * @param to - Where to send the remaining LINK to */ function cancelSubscription(uint64 subId, address to) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. It ensures 2 things: * @dev 1. The fulfillment came from the VRFCoordinator * @dev 2. The consumer contract implements fulfillRandomWords. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash). Create subscription, fund it * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface * @dev subscription management functions). * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations, * @dev callbackGasLimit, numWords), * @dev see (VRFCoordinatorInterface for a description of the arguments). * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomWords method. * * @dev The randomness argument to fulfillRandomWords is a set of random words * @dev generated from your requestId and the blockHash of the request. * * @dev If your contract could have concurrent requests open, you can use the * @dev requestId returned from requestRandomWords to track which response is associated * @dev with which randomness request. * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously. * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. It is for this reason that * @dev that you can signal to an oracle you'd like them to wait longer before * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ constructor(address _vrfCoordinator) { vrfCoordinator = _vrfCoordinator; } /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomWords the VRF output expanded to the requested number of words */ function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual; // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external { if (msg.sender != vrfCoordinator) { revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator); } fulfillRandomWords(requestId, randomWords); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface InviteTypes { // Invite state. Once an invite is spent, it is no longer able to be transferred and cannot be made active again enum InviteState { ACTIVE, SPENT } // Onchain metadata for the invite struct DEFYGenesisInviteMetadata { address originalOwner; // Store the original owner to track who to send commission to InviteState inviteState; // Current state of this token uint8 seriesId; // Series of this invite } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./InviteTypes.sol"; interface IDEFYGenesisInvite is InviteTypes { function spendInvite (uint256 tokenId, address spender) external; function getInviteMetadata (uint256 tokenId) external view returns (DEFYGenesisInviteMetadata memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @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 ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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 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); /** * @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 calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // 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.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
{ "optimizer": { "enabled": true, "runs": 50 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"vrfCoordinator","type":"address"},{"internalType":"address","name":"vrfLinkToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","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":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MaskTokensAssigned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MaskTokensUnlocked","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":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":"BALANCE_WITHDRAWER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_UNLOCKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum DEFYGenesisMask.MaskType","name":"","type":"uint8"}],"name":"_remainingMaskTypeAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"adminMintMask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"adminMintZeroMask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkVrfActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commissionDivisor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defyGenesisInvite","outputs":[{"internalType":"contract IDEFYGenesisInvite","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRemainingBondedTokensForMask","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalBondedTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTotalBondedTokensForMask","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phaseOneActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inviteId","type":"uint256"}],"name":"phaseOneInviteMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"phaseTwoActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"inviteId","type":"uint256"}],"name":"phaseTwoInviteMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"unlockBondedTokensFromMask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newVrfSubscriptionId","type":"uint64"},{"internalType":"bytes32","name":"newVrfKeyHash","type":"bytes32"},{"internalType":"uint32","name":"newVrfCallbackGasLimit","type":"uint32"}],"name":"updateChainlinkParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"updateChainlinkVrfActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"inviteContractAddress","type":"address"}],"name":"updateInviteContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMintPrice","type":"uint256"}],"name":"updateMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"message","type":"string"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"updateMsg","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"updatePhaseOneStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCommissionDivisor","type":"uint256"}],"name":"updatePhaseTwoCommissionDivisor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"updatePhaseTwoStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"updatePublicMintStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"code","type":"uint256"}],"name":"validateCallerLoyalty","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfCallbackGasLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfKeyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfSubscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"withdrawBalanceExceptFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040527fd729dc84e21ae57ffb6be0053bf2b0668aa2aaf300a2a7b2ddf7dc0bb6e875a86012556013805463ffffffff1916620186a01790553480156200004757600080fd5b5060405162004838380380620048388339810160408190526200006a916200043a565b604080518082018252600f81526e4445465947656e657369734d61736b60881b60208083019182528351808501909452600384526244474d60e81b908401528151859391620000bd916000919062000377565b508051620000d390600190602084019062000377565b5050600a805460ff1916905550620000eb3362000277565b6001600d5560601b6001600160601b0319166080526200010d600033620002c9565b620001397f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620002c9565b620001657f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620002c9565b601080546001600160a01b038481166001600160a01b0319928316179092556011805492841692909116919091179055601a602090815260017fb75ecc04ed35f89790e98640e901bda41eceff0cb896cf2765fb697680253750556103e87ff88cd8d612926ebb404e40725c01084b6e9b3ce0344cde068570342cbd448c615561157c7f4c287b3e2c2cb129ae3ba596d613d760b15affdac7242e12903c37a886ea1c4f55600360009081526109537f4ac83fca211703e3ddb90093cd219714e5e3715bf0b4fd15b0441390534a24e2556808ac7230489e800000601855601e805463ffffffff19169055600a601955601b556200026f90600e906200213b6200036e821b17901c565b5050620004ae565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff166200036a576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003293390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80546001019055565b828054620003859062000471565b90600052602060002090601f016020900481019282620003a95760008555620003f4565b82601f10620003c457805160ff1916838001178555620003f4565b82800160010185558215620003f4579182015b82811115620003f4578251825591602001919060010190620003d7565b506200040292915062000406565b5090565b5b8082111562000402576000815560010162000407565b80516001600160a01b03811681146200043557600080fd5b919050565b600080604083850312156200044d578182fd5b62000458836200041d565b915062000468602084016200041d565b90509250929050565b600181811c908216806200048657607f821691505b60208210811415620004a857634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c614364620004d460003960008181611033015261107501526143646000f3fe6080604052600436106103725760003560e01c80635fd8c710116101c8578063b67c25a3116100f8578063d53913931161009b578063d539139314610a96578063d547741f14610aca578063e63ab1e914610aea578063e693237114610b0c578063e8a3d48514610b2c578063e985e9c514610b41578063ed647d2114610b61578063f2fde38b14610ba0578063fc7c981f14610bc057600080fd5b8063b67c25a3146109a4578063b88d4fde146109c4578063bd84078e146109e4578063bdf08d7114610a04578063c87b56dd14610a23578063d19115c414610a43578063d374398014610a63578063d435003714610a7657600080fd5b80638bc5d9371161016b5780638bc5d937146108965780638da5cb5b146108b6578063900f52e8146108cb57806391d14854146108f8578063938e3d7b1461091857806395d89b4114610938578063a08539c71461094d578063a217fddf1461096f578063a22cb4651461098457600080fd5b80635fd8c710146107c15780636352211e146107d65780636817c76c146107f65780636f8f6c4a1461080c57806370a082311461082c578063715018a61461084c578063832ac7f3146108615780638456cb591461088157600080fd5b80632559454b116102a3578063416c89b011610246578063416c89b0146106aa57806342842e0e146106bf57806343100e98146106df5780634931ea35146107135780634e4307f7146107335780634ed8b3b3146107535780634f6ccce71461076957806355f804b3146107895780635c975abb146107a957600080fd5b80632559454b146105bb57806326092b83146105db5780632f2ff15d146105e35780632f745c591461060357806336568abe14610623578063376b2157146106435780633b7ed734146106635780633f4ba83a1461069557600080fd5b806318160ddd1161031657806318160ddd146104a85780631d522a0e146104bd5780631df96c0b146104dd5780631f07a2ca146104f75780631f7003e0146105185780631fe543e31461053857806321ffc3051461055857806323b872dd1461056b578063248a9ca31461058b57600080fd5b8062728e461461037e57806301fdef53146103a057806301ffc9a7146103c0578063027a9a04146103f5578063041d443e1461041557806306fdde0314610439578063081812fc1461045b578063095ea7b31461048857600080fd5b3661037957005b600080fd5b34801561038a57600080fd5b5061039e610399366004613a7c565b610be0565b005b3480156103ac57600080fd5b5061039e6103bb366004613a62565b610bf2565b3480156103cc57600080fd5b506103e06103db366004613ab8565b610c12565b60405190151581526020015b60405180910390f35b34801561040157600080fd5b5061039e610410366004613a62565b610c23565b34801561042157600080fd5b5061042b60125481565b6040519081526020016103ec565b34801561044557600080fd5b5061044e610c4c565b6040516103ec9190613efd565b34801561046757600080fd5b5061047b610476366004613a7c565b610cde565b6040516103ec9190613eac565b34801561049457600080fd5b5061039e6104a3366004613a37565b610d6b565b3480156104b457600080fd5b5060085461042b565b3480156104c957600080fd5b5061039e6104d8366004613a7c565b610e7c565b3480156104e957600080fd5b50601e546103e09060ff1681565b34801561050357600080fd5b50601e546103e0906301000000900460ff1681565b34801561052457600080fd5b5061039e610533366004613cc6565b610eeb565b34801561054457600080fd5b5061039e610553366004613c13565b611028565b61039e610566366004613a7c565b6110b0565b34801561057757600080fd5b5061039e610586366004613947565b6112d3565b34801561059757600080fd5b5061042b6105a6366004613a7c565b6000908152600b602052604090206001015490565b3480156105c757600080fd5b5061039e6105d6366004613a62565b611304565b61039e61132b565b3480156105ef57600080fd5b5061039e6105fe366004613a94565b6113d0565b34801561060f57600080fd5b5061042b61061e366004613a37565b6113f6565b34801561062f57600080fd5b5061039e61063e366004613a94565b61148c565b34801561064f57600080fd5b5061039e61065e3660046138f3565b611506565b34801561066f57600080fd5b506013546106809063ffffffff1681565b60405163ffffffff90911681526020016103ec565b3480156106a157600080fd5b5061039e611655565b3480156106b657600080fd5b50601b5461042b565b3480156106cb57600080fd5b5061039e6106da366004613947565b611679565b3480156106eb57600080fd5b5061042b7f1362c86c8f1e6c8042100f6952f3877b35b36de0a39f8056dff06815a647623681565b34801561071f57600080fd5b5061039e61072e366004613a7c565b611694565b34801561073f57600080fd5b5060155461047b906001600160a01b031681565b34801561075f57600080fd5b5061042b60195481565b34801561077557600080fd5b5061042b610784366004613a7c565b61171c565b34801561079557600080fd5b5061039e6107a4366004613b0f565b6117bd565b3480156107b557600080fd5b50600a5460ff166103e0565b3480156107cd57600080fd5b5061039e6117dc565b3480156107e257600080fd5b5061047b6107f1366004613a7c565b61185d565b34801561080257600080fd5b5061042b60185481565b34801561081857600080fd5b5061044e610827366004613a7c565b6118d4565b34801561083857600080fd5b5061042b6108473660046138f3565b611976565b34801561085857600080fd5b5061039e6119fd565b34801561086d57600080fd5b5061039e61087c3660046138f3565b611a36565b34801561088d57600080fd5b5061039e611a9f565b3480156108a257600080fd5b5061039e6108b1366004613a62565b611ac0565b3480156108c257600080fd5b5061047b611aeb565b3480156108d757600080fd5b5061042b6108e6366004613af0565b601a6020526000908152604090205481565b34801561090457600080fd5b506103e0610913366004613a94565b611afa565b34801561092457600080fd5b5061039e610933366004613b0f565b611b25565b34801561094457600080fd5b5061044e611b44565b34801561095957600080fd5b5061042b6000805160206142ef83398151915281565b34801561097b57600080fd5b5061042b600081565b34801561099057600080fd5b5061039e61099f366004613a03565b611b53565b3480156109b057600080fd5b50601e546103e09062010000900460ff1681565b3480156109d057600080fd5b5061039e6109df366004613987565b611b5e565b3480156109f057600080fd5b5061042b6109ff366004613a7c565b611b90565b348015610a1057600080fd5b50601e546103e090610100900460ff1681565b348015610a2f57600080fd5b5061044e610a3e366004613a7c565b611bca565b348015610a4f57600080fd5b5061039e610a5e366004613ce7565b611c5f565b61039e610a71366004613a7c565b611cb8565b348015610a8257600080fd5b5061042b610a91366004613a7c565b611fa4565b348015610aa257600080fd5b5061042b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b348015610ad657600080fd5b5061039e610ae5366004613a94565b611fe1565b348015610af657600080fd5b5061042b60008051602061430f83398151915281565b348015610b1857600080fd5b5061039e610b27366004613b41565b612007565b348015610b3857600080fd5b5061044e612032565b348015610b4d57600080fd5b506103e0610b5c36600461390f565b612041565b348015610b6d57600080fd5b50601154610b8890600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016103ec565b348015610bac57600080fd5b5061039e610bbb3660046138f3565b61206f565b348015610bcc57600080fd5b5061039e610bdb3660046138f3565b61210c565b6000610bec8133612144565b50601855565b6000610bfe8133612144565b50601e805460ff1916911515919091179055565b6000610c1d826121a8565b92915050565b6000610c2f8133612144565b50601e8054911515620100000262ff000019909216919091179055565b606060008054610c5b90614217565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8790614217565b8015610cd45780601f10610ca957610100808354040283529160200191610cd4565b820191906000526020600020905b815481529060010190602001808311610cb757829003601f168201915b5050505050905090565b6000610ce9826121cd565b610d4f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610d768261185d565b9050806001600160a01b0316836001600160a01b03161415610de45760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610d46565b336001600160a01b0382161480610e005750610e008133612041565b610e6d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610d46565b610e7783836121ea565b505050565b6000610e888133612144565b81610ee55760405162461bcd60e51b815260206004820152602760248201527f44474d3a2043616e6e6f742073657420636f6d6d697373696f6e20646976697360448201526606f7220746f20360cc1b6064820152608401610d46565b50601955565b7f1362c86c8f1e6c8042100f6952f3877b35b36de0a39f8056dff06815a6476236610f168133612144565b610f1f836121cd565b610f7f5760405162461bcd60e51b815260206004820152602b60248201527f44474d3a20756e6c6f636b696e6720746f6b656e732066726f6d206e6f6e657860448201526a697374616e74206d61736b60a81b6064820152608401610d46565b6000838152601c60205260409020600101548210610ffd5760405162461bcd60e51b815260206004820152603560248201527f44474d3a2063616e6e6f7420756e6c6f636b206d6f726520746f6b656e73207460448201527468616e2072656d61696e696e67206f6e206d61736b60581b6064820152608401610d46565b6000838152601c60205260408120600101805484929061101e9084906141bd565b9091555050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146110a25760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610d46565b6110ac8282612258565b5050565b600a5460ff16156110d35760405162461bcd60e51b8152600401610d4690613fe1565b601e5460ff1661111f5760405162461bcd60e51b815260206004820152601760248201527644474d3a2050686173652031206e6f742061637469766560481b6044820152606401610d46565b6002600d5414156111425760405162461bcd60e51b8152600401610d46906140f4565b6002600d5560185434146111685760405162461bcd60e51b8152600401610d4690613f10565b60155460405163b6e76def60e01b8152600481018390526000916001600160a01b03169063b6e76def9060240160606040518083038186803b1580156111ad57600080fd5b505afa1580156111c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e59190613b83565b90506000816040015160ff161461125d5760405162461bcd60e51b815260206004820152603660248201527f44474d3a2063616e6e6f742075736520696e766974652066726f6e20616e6f746044820152756865722073657269657320666f72207068617365203160501b6064820152608401610d46565b601554604051631658b0cd60e21b81526001600160a01b0390911690635962c3349061128f908590339060040161412b565b600060405180830381600087803b1580156112a957600080fd5b505af11580156112bd573d6000803e3d6000fd5b505050506112ca33612271565b50506001600d55565b6112dd3382612378565b6112f95760405162461bcd60e51b8152600401610d46906140a3565b610e77838383612442565b60006113108133612144565b50601e80549115156101000261ff0019909216919091179055565b600a5460ff161561134e5760405162461bcd60e51b8152600401610d4690613fe1565b601e5462010000900460ff166113a45760405162461bcd60e51b815260206004820152601b60248201527a44474d3a205075626c6963206d696e74206e6f742061637469766560281b6044820152606401610d46565b60185434146113c55760405162461bcd60e51b8152600401610d4690613f10565b6113ce33612271565b565b6000828152600b60205260409020600101546113ec8133612144565b610e7783836125e9565b600061140183611976565b82106114635760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610d46565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b03811633146114fc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610d46565b6110ac828261266f565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66115318133612144565b600061154060c86122b86141bd565b600f5461154d9190614172565b905061155c60c86122b86141bd565b81101561157b5760405162461bcd60e51b8152600401610d4690613f58565b611589600f80546001019055565b61159383826126d6565b601e546301000000900460ff16156115ae57610e77816126f0565b6040805160028082526060820183526000926020830190803683370190505090506115d8826127c9565b816000815181106115f957634e487b7160e01b600052603260045260246000fd5b602090810291909101015261161861161383613b7f61419e565b6127c9565b8160018151811061163957634e487b7160e01b600052603260045260246000fd5b60200260200101818152505061164f82826127ff565b50505050565b60008051602061430f83398151915261166e8133612144565b611676612d05565b50565b610e7783838360405180602001604052806000815250611b5e565b6000805160206142ef8339815191526116ad8133612144565b6000336116ba84476141bd565b604051600081818185875af1925050503d80600081146116f6576040519150601f19603f3d011682016040523d82523d6000602084013e6116fb565b606091505b5050905080610e775760405162461bcd60e51b8152600401610d4690614040565b600061172760085490565b821061178a5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610d46565b600882815481106117ab57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b60006117c98133612144565b8151610e779060169060208501906137cf565b6000805160206142ef8339815191526117f58133612144565b604051600090339047908381818185875af1925050503d8060008114611837576040519150601f19603f3d011682016040523d82523d6000602084013e61183c565b606091505b50509050806110ac5760405162461bcd60e51b8152600401610d4690614040565b6000818152600260205260408120546001600160a01b031680610c1d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610d46565b60008181526014602052604090208054606091906118f190614217565b80601f016020809104026020016040519081016040528092919081815260200182805461191d90614217565b801561196a5780601f1061193f5761010080835404028352916020019161196a565b820191906000526020600020905b81548152906001019060200180831161194d57829003601f168201915b50505050509050919050565b60006001600160a01b0382166119e15760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610d46565b506001600160a01b031660009081526003602052604090205490565b33611a06611aeb565b6001600160a01b031614611a2c5760405162461bcd60e51b8152600401610d469061400b565b6113ce6000612d92565b6000611a428133612144565b611a4c60006121cd565b15611a945760405162461bcd60e51b81526020600482015260186024820152771111d34e881e995c9bc8185b1c9958591e481b5a5b9d195960421b6044820152606401610d46565b6110ac8260006126d6565b60008051602061430f833981519152611ab88133612144565b611676612de4565b6000611acc8133612144565b50601e805491151563010000000263ff00000019909216919091179055565b600c546001600160a01b031690565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611b318133612144565b8151610e779060179060208501906137cf565b606060018054610c5b90614217565b6110ac338383612e3c565b611b683383612378565b611b845760405162461bcd60e51b8152600401610d46906140a3565b61164f84848484612f07565b6000611b9b826121cd565b611bb75760405162461bcd60e51b8152600401610d4690614070565b506000908152601c602052604090205490565b6060611bd5826121cd565b611c2d5760405162461bcd60e51b8152602060048201526024808201527f44474d3a2055524920717565727920666f72206e6f6e6578697374656e74207460448201526337b5b2b760e11b6064820152608401610d46565b6016611c3883612f3a565b604051602001611c49929190613d83565b6040516020818303038152906040529050919050565b6000611c6b8133612144565b50601180546001600160401b03909416600160a01b0267ffffffffffffffff60a01b19909416939093179092556012556013805463ffffffff90921663ffffffff19909216919091179055565b600a5460ff1615611cdb5760405162461bcd60e51b8152600401610d4690613fe1565b601e54610100900460ff16611d2c5760405162461bcd60e51b815260206004820152601760248201527644474d3a2050686173652032206e6f742061637469766560481b6044820152606401610d46565b6002600d541415611d4f5760405162461bcd60e51b8152600401610d46906140f4565b6002600d556018543414611d755760405162461bcd60e51b8152600401610d4690613f10565b60155460405163b6e76def60e01b8152600481018390526000916001600160a01b03169063b6e76def9060240160606040518083038186803b158015611dba57600080fd5b505afa158015611dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df29190613b83565b90506002816040015160ff1614611e6c5760405162461bcd60e51b815260206004820152603860248201527f44474d3a2063616e6e6f742075736520696e766974652066726f6e20616e6f746044820152776865722073657269657320666f722070686173652074776f60401b6064820152608401610d46565b601554604051631658b0cd60e21b81526001600160a01b0390911690635962c33490611e9e908590339060040161412b565b600060405180830381600087803b158015611eb857600080fd5b505af1158015611ecc573d6000803e3d6000fd5b50505050611ed933612271565b80516019546000916001600160a01b031690611ef5903461418a565b604051600081818185875af1925050503d8060008114611f31576040519150601f19603f3d011682016040523d82523d6000602084013e611f36565b606091505b5050905080611f9a5760405162461bcd60e51b815260206004820152602a60248201527f4445465947656e657369734d61736b3a20636f6d6d697373696f6e207061796d604482015269195b9d0819985a5b195960b21b6064820152608401610d46565b50506001600d5550565b6000611faf826121cd565b611fcb5760405162461bcd60e51b8152600401610d4690614070565b506000908152601c602052604090206001015490565b6000828152600b6020526040902060010154611ffd8133612144565b610e77838361266f565b60006120138133612144565b6000828152601460209081526040909120845161164f928601906137cf565b606060178054610c5b90614217565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b33612078611aeb565b6001600160a01b03161461209e5760405162461bcd60e51b8152600401610d469061400b565b6001600160a01b0381166121035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d46565b61167681612d92565b60006121188133612144565b50601580546001600160a01b0319166001600160a01b0392909216919091179055565b80546001019055565b61214e8282611afa565b6110ac57612166816001600160a01b03166014613053565b612171836020613053565b604051602001612182929190613e3d565b60408051601f198184030181529082905262461bcd60e51b8252610d4691600401613efd565b60006001600160e01b03198216637965db0b60e01b1480610c1d5750610c1d8261323b565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061221f8261185d565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000828152601d60205260409020546110ac90826127ff565b600061227c600e5490565b905061228b60c86122b86141bd565b81106122a95760405162461bcd60e51b8152600401610d4690613f58565b6122b7600e80546001019055565b6122c182826126d6565b601e546301000000900460ff16156122dc576110ac816126f0565b604080516002808252606082018352600092602083019080368337019050509050612306826127c9565b8160008151811061232757634e487b7160e01b600052603260045260246000fd5b602090810291909101015261234161161383613b7f61419e565b8160018151811061236257634e487b7160e01b600052603260045260246000fd5b602002602001018181525050610e7782826127ff565b6000612383826121cd565b6123e45760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610d46565b60006123ef8361185d565b9050806001600160a01b0316846001600160a01b0316148061242a5750836001600160a01b031661241f84610cde565b6001600160a01b0316145b8061243a575061243a8185612041565b949350505050565b826001600160a01b03166124558261185d565b6001600160a01b0316146124b95760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610d46565b6001600160a01b03821661251b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610d46565b612526838383613260565b6125316000826121ea565b6001600160a01b038316600090815260036020526040812080546001929061255a9084906141bd565b90915550506001600160a01b0382166000908152600360205260408120805460019290612588908490614172565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6125f38282611afa565b6110ac576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561262b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6126798282611afa565b156110ac576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6110ac82826040518060200160405280600081525061328e565b6010546012546011546013546040516305d3b1d360e41b81526004810193909352600160a01b9091046001600160401b0316602483015260036044830181905263ffffffff9091166064830152600260848301819052909290916000916001600160a01b031690635d3b1d309060a401602060405180830381600087803b15801561277a57600080fd5b505af115801561278e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b29190613bfb565b6000908152601d6020526040902093909355505050565b60408051446020808301919091524282840152606080830194909452825180830390940184526080909101909152815191012090565b60008052601a6020527fb75ecc04ed35f89790e98640e901bda41eceff0cb896cf2765fb6976802537505415801590612843575061284060c86122b86141bd565b82105b156129435760008261285860c86122b86141bd565b61286291906141bd565b8260008151811061288357634e487b7160e01b600052603260045260246000fd5b6020026020010151612895919061426d565b1590508015612941576000838152601c602090815260408220620186a08082556001909101819055828052601a9091527fb75ecc04ed35f89790e98640e901bda41eceff0cb896cf2765fb697680253750829055601b8054919290916128fc908490614172565b909155505060408051848152620186a060208201527f0b017f50766424850119e7bfc72de8fe44a641dc0a242af611184c0b4d39b03d910160405180910390a1505050565b505b60006103e88310156129a357600060028360008151811061297457634e487b7160e01b600052603260045260246000fd5b6020026020010151612986919061426d565b1590508015612998576001915061299d565b600291505b50612aea565b601a6020527f4ac83fca211703e3ddb90093cd219714e5e3715bf0b4fd15b0441390534a24e2547f4c287b3e2c2cb129ae3ba596d613d760b15affdac7242e12903c37a886ea1c4f54600160009081527ff88cd8d612926ebb404e40725c01084b6e9b3ce0344cde068570342cbd448c6154909291612a2191614172565b612a2b9190614172565b905060008184600081518110612a5157634e487b7160e01b600052603260045260246000fd5b6020026020010151612a63919061426d565b6001600052601a6020527ff88cd8d612926ebb404e40725c01084b6e9b3ce0344cde068570342cbd448c61549091508110612ae2576003600052601a6020527f4ac83fca211703e3ddb90093cd219714e5e3715bf0b4fd15b0441390534a24e254612ace90836141bd565b8111612adb576002612ae5565b6003612ae5565b60015b925050505b60006001826003811115612b0e57634e487b7160e01b600052602160045260246000fd5b1415612b6e57600061019184600181518110612b3a57634e487b7160e01b600052603260045260246000fd5b6020026020010151612b4c919061426d565b905060c8612b5c826103e8614172565b612b6691906141bd565b915050612c30565b6002826003811115612b9057634e487b7160e01b600052602160045260246000fd5b1415612bdc576000602984600181518110612bbb57634e487b7160e01b600052603260045260246000fd5b6020026020010151612bcd919061426d565b90506014612b5c826064614172565b6000600584600181518110612c0157634e487b7160e01b600052603260045260246000fd5b6020026020010151612c13919061426d565b90506002612c2282600a614172565b612c2c91906141bd565b9150505b6000848152601c60205260408120828155600101829055601b8054839290612c59908490614172565b9091555060019050601a6000846003811115612c8557634e487b7160e01b600052602160045260246000fd5b6003811115612ca457634e487b7160e01b600052602160045260246000fd5b81526020019081526020016000206000828254612cc191906141bd565b909155505060408051858152602081018390527f0b017f50766424850119e7bfc72de8fe44a641dc0a242af611184c0b4d39b03d910160405180910390a150505050565b600a5460ff16612d4e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610d46565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051612d889190613eac565b60405180910390a1565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600a5460ff1615612e075760405162461bcd60e51b8152600401610d4690613fe1565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612d7b3390565b816001600160a01b0316836001600160a01b03161415612e9a5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610d46565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612f12848484612442565b612f1e848484846132c1565b61164f5760405162461bcd60e51b8152600401610d4690613f8f565b606081612f5e5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612f885780612f7281614252565b9150612f819050600a8361418a565b9150612f62565b6000816001600160401b03811115612fb057634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612fda576020820181803683370190505b5090505b841561243a57612fef6001836141bd565b9150612ffc600a8661426d565b613007906030614172565b60f81b81838151811061302a57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061304c600a8661418a565b9450612fde565b6060600061306283600261419e565b61306d906002614172565b6001600160401b0381111561309257634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156130bc576020820181803683370190505b509050600360fc1b816000815181106130e557634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061312257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600061314684600261419e565b613151906001614172565b90505b60018111156131e5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061319357634e487b7160e01b600052603260045260246000fd5b1a60f81b8282815181106131b757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c936131de81614200565b9050613154565b5083156132345760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d46565b9392505050565b60006001600160e01b0319821663780e9d6360e01b1480610c1d5750610c1d826133ce565b600a5460ff16156132835760405162461bcd60e51b8152600401610d4690613fe1565b610e7783838361341e565b61329883836134d6565b6132a560008484846132c1565b610e775760405162461bcd60e51b8152600401610d4690613f8f565b60006001600160a01b0384163b156133c357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613305903390899088908890600401613ec0565b602060405180830381600087803b15801561331f57600080fd5b505af192505050801561334f575060408051601f3d908101601f1916820190925261334c91810190613ad4565b60015b6133a9573d80801561337d576040519150601f19603f3d011682016040523d82523d6000602084013e613382565b606091505b5080516133a15760405162461bcd60e51b8152600401610d4690613f8f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061243a565b506001949350505050565b60006001600160e01b031982166380ac58cd60e01b14806133ff57506001600160e01b03198216635b5e139f60e01b145b80610c1d57506301ffc9a760e01b6001600160e01b0319831614610c1d565b6001600160a01b0383166134795761347481600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61349c565b816001600160a01b0316836001600160a01b03161461349c5761349c8382613615565b6001600160a01b0382166134b357610e77816136b2565b826001600160a01b0316826001600160a01b031614610e7757610e77828261378b565b6001600160a01b03821661352c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d46565b613535816121cd565b156135825760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d46565b61358e60008383613260565b6001600160a01b03821660009081526003602052604081208054600192906135b7908490614172565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000600161362284611976565b61362c91906141bd565b60008381526007602052604090205490915080821461367f576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906136c4906001906141bd565b600083815260096020526040812054600880549394509092849081106136fa57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050806008838154811061372957634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061376f57634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061379683611976565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b8280546137db90614217565b90600052602060002090601f0160209004810192826137fd5760008555613843565b82601f1061381657805160ff1916838001178555613843565b82800160010185558215613843579182015b82811115613843578251825591602001919060010190613828565b5061384f929150613853565b5090565b5b8082111561384f5760008155600101613854565b60006001600160401b03831115613881576138816142ad565b613894601f8401601f1916602001614142565b90508281528383830111156138a857600080fd5b828260208301376000602084830101529392505050565b803580151581146138cf57600080fd5b919050565b600082601f8301126138e4578081fd5b61323483833560208501613868565b600060208284031215613904578081fd5b8135613234816142c3565b60008060408385031215613921578081fd5b823561392c816142c3565b9150602083013561393c816142c3565b809150509250929050565b60008060006060848603121561395b578081fd5b8335613966816142c3565b92506020840135613976816142c3565b929592945050506040919091013590565b6000806000806080858703121561399c578081fd5b84356139a7816142c3565b935060208501356139b7816142c3565b92506040850135915060608501356001600160401b038111156139d8578182fd5b8501601f810187136139e8578182fd5b6139f787823560208401613868565b91505092959194509250565b60008060408385031215613a15578182fd5b8235613a20816142c3565b9150613a2e602084016138bf565b90509250929050565b60008060408385031215613a49578182fd5b8235613a54816142c3565b946020939093013593505050565b600060208284031215613a73578081fd5b613234826138bf565b600060208284031215613a8d578081fd5b5035919050565b60008060408385031215613aa6578182fd5b82359150602083013561393c816142c3565b600060208284031215613ac9578081fd5b8135613234816142d8565b600060208284031215613ae5578081fd5b8151613234816142d8565b600060208284031215613b01578081fd5b813560048110613234578182fd5b600060208284031215613b20578081fd5b81356001600160401b03811115613b35578182fd5b61243a848285016138d4565b60008060408385031215613b53578182fd5b82356001600160401b03811115613b68578283fd5b613b74858286016138d4565b95602094909401359450505050565b600060608284031215613b94578081fd5b604051606081018181106001600160401b0382111715613bb657613bb66142ad565b6040528251613bc4816142c3565b8152602083015160028110613bd7578283fd5b6020820152604083015160ff81168114613bef578283fd5b60408201529392505050565b600060208284031215613c0c578081fd5b5051919050565b60008060408385031215613c25578182fd5b823591506020808401356001600160401b0380821115613c43578384fd5b818601915086601f830112613c56578384fd5b813581811115613c6857613c686142ad565b8060051b9150613c79848301614142565b8181528481019084860184860187018b1015613c93578788fd5b8795505b83861015613cb5578035835260019590950194918601918601613c97565b508096505050505050509250929050565b60008060408385031215613cd8578182fd5b50508035926020909101359150565b600080600060608486031215613cfb578081fd5b83356001600160401b0381168114613d11578182fd5b925060208401359150604084013563ffffffff81168114613d30578182fd5b809150509250925092565b60008151808452613d538160208601602086016141d4565b601f01601f19169290920160200192915050565b60008151613d798185602086016141d4565b9290920192915050565b600080845482600182811c915080831680613d9f57607f831692505b6020808410821415613dbf57634e487b7160e01b87526022600452602487fd5b818015613dd35760018114613de457613e10565b60ff19861689528489019650613e10565b60008b815260209020885b86811015613e085781548b820152908501908301613def565b505084890196505b505050505050613e34613e238286613d67565b64173539b7b760d91b815260050190565b95945050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613e6f8160178501602088016141d4565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613ea08160288401602088016141d4565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613ef390830184613d3b565b9695505050505050565b6020815260006132346020830184613d3b565b60208082526028908201527f44474d3a20696e636f727265637420746f6b656e20616d6f756e742073656e74604082015267081d1bc81b5a5b9d60c21b606082015260800190565b6020808252601c908201527f44474d3a20616c6c207075626c6963206d61736b73206d696e74656400000000604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601690820152751111d34e8815da5d1a191c985dd85b0819985a5b195960521b604082015260600190565b6020808252601990820152781111d34e881d1bdad95b88191bd95cc81b9bdd08195e1a5cdd603a1b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b9182526001600160a01b0316602082015260400190565b604051601f8201601f191681016001600160401b038111828210171561416a5761416a6142ad565b604052919050565b6000821982111561418557614185614281565b500190565b60008261419957614199614297565b500490565b60008160001904831182151516156141b8576141b8614281565b500290565b6000828210156141cf576141cf614281565b500390565b60005b838110156141ef5781810151838201526020016141d7565b8381111561164f5750506000910152565b60008161420f5761420f614281565b506000190190565b600181811c9082168061422b57607f821691505b6020821081141561424c57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561426657614266614281565b5060010190565b60008261427c5761427c614297565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461167657600080fd5b6001600160e01b03198116811461167657600080fdfe2d194408ffac6345de6befe9a457719637bce3a9018432c8b10de717d5843d6265d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862aa264697066735822122092f97fcfff2c22b1b35d4b693f7b06020d6754cb732fc963043dbcc87a684d2964736f6c63430008040033000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1
-----Decoded View---------------
Arg [0] : vrfCoordinator (address): 0xae975071be8f8ee67addbc1a82488f1c24858067
Arg [1] : vrfLinkToken (address): 0xb0897686c545045afc77cf20ec7a532e3120e0f1
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ae975071be8f8ee67addbc1a82488f1c24858067
Arg [1] : 000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.