More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 22,352 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Unstake WZRDS | 21475006 | 119 days ago | IN | 0 ETH | 0.00492444 | ||||
Unstake WZRDS | 21467605 | 120 days ago | IN | 0 ETH | 0.00129176 | ||||
Unstake WZRDS | 21467599 | 120 days ago | IN | 0 ETH | 0.00173998 | ||||
Unstake WZRDS | 20886543 | 201 days ago | IN | 0 ETH | 0.00368971 | ||||
Unstake WZRDS | 20885441 | 201 days ago | IN | 0 ETH | 0.00072237 | ||||
Unstake WZRDS | 20884896 | 201 days ago | IN | 0 ETH | 0.00136732 | ||||
Unstake WZRDS | 20808569 | 212 days ago | IN | 0 ETH | 0.0022619 | ||||
Unstake WZRDS | 19119648 | 448 days ago | IN | 0 ETH | 0.0133856 | ||||
Unstake WZRDS | 19079448 | 454 days ago | IN | 0 ETH | 0.00103199 | ||||
Unstake WZRDS | 18293869 | 564 days ago | IN | 0 ETH | 0.00225847 | ||||
Unstake WZRDS | 17639788 | 655 days ago | IN | 0 ETH | 0.00510697 | ||||
Claim Shrooms | 17412550 | 687 days ago | IN | 0 ETH | 0.00167543 | ||||
Unstake WZRDS | 16616007 | 800 days ago | IN | 0 ETH | 0.00135253 | ||||
Unstake WZRDS | 16609604 | 801 days ago | IN | 0 ETH | 0.00878727 | ||||
Unstake WZRDS | 16562392 | 807 days ago | IN | 0 ETH | 0.02635285 | ||||
Claim Shrooms | 16550353 | 809 days ago | IN | 0 ETH | 0.00329284 | ||||
Unstake WZRDS | 16538912 | 810 days ago | IN | 0 ETH | 0.00152643 | ||||
Unstake WZRDS | 16537836 | 811 days ago | IN | 0 ETH | 0.00934264 | ||||
Claim Shrooms | 16537831 | 811 days ago | IN | 0 ETH | 0.00467178 | ||||
Claim Shrooms | 16530985 | 811 days ago | IN | 0 ETH | 0.00302162 | ||||
Unstake WZRDS | 16525686 | 812 days ago | IN | 0 ETH | 0.00131433 | ||||
Claim Shrooms | 16498140 | 816 days ago | IN | 0 ETH | 0.00154248 | ||||
Unstake WZRDS | 16493311 | 817 days ago | IN | 0 ETH | 0.00204543 | ||||
Unstake WZRDS | 16487613 | 818 days ago | IN | 0 ETH | 0.00327526 | ||||
Claim Shrooms | 16480509 | 819 days ago | IN | 0 ETH | 0.00776329 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
WizForest
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/security/Pausable.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import './WizNFT.sol'; import './WizNFTTraits.sol'; import './Shroom.sol'; contract WizForest is Ownable, Pausable, ReentrancyGuard { struct StakeWZRD { uint256 tokenId; address owner; uint256 start; bool locked; } struct StakeEvil { uint256 tokenId; address owner; uint256 start; uint256 index; } mapping(uint256 => StakeWZRD) private stakedWZRDs; mapping(uint256 => StakeEvil) private stakedEvils; WizNFT private tokenContract; WizNFTTraits private traitsContract; Shroom private rewardTokensContract; uint256 private totalWZRDStaked; uint256 private totalEvilStaked; mapping(address => uint256[]) private ownerMap; uint256[] private evilIndices; mapping(address => bool) private altarOfSacrifice; uint256 public constant rewardRate = 5*(10**18); // 5 per 3 minutes uint256 public constant rewardCap = 60*60*24*3; // 3 days constructor(address tokenAddress, address traitsContractAddress, address rewardTokenAddress) { _pause(); tokenContract = WizNFT(tokenAddress); traitsContract = WizNFTTraits(traitsContractAddress); rewardTokensContract = Shroom(rewardTokenAddress); } function getTotalWZRDStaked() external view returns (uint256) { return totalWZRDStaked; } function getTotalEvilStaked() external view returns (uint256) { return totalEvilStaked; } function stakeWZRDS(uint256[] calldata tokenIds) external nonReentrant whenNotPaused { for (uint i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; bool isEvil = traitsContract.isEvil(tokenId); if (!isEvil) { require(tokenContract.ownerOf(tokenId) == _msgSender(), 'Msg sender does not own token'); tokenContract.transferFrom(_msgSender(), address(this), tokenId); stakedWZRDs[tokenId] = StakeWZRD({ tokenId: tokenId, owner: _msgSender(), start: block.timestamp, locked: false }); addTokenToOwnerMap(_msgSender(), tokenId); totalWZRDStaked += 1; } else { require(tokenContract.ownerOf(tokenId) == _msgSender(), 'Msg sender does not own token'); tokenContract.transferFrom(_msgSender(), address(this), tokenId); addEvilIndex(tokenId); stakedEvils[tokenId] = StakeEvil({ tokenId: tokenId, owner: _msgSender(), start: block.timestamp, index: totalEvilStaked }); addTokenToOwnerMap(_msgSender(), tokenId); totalEvilStaked += 1; } } } function unstakeWZRDS(uint256[] calldata tokenIds) external nonReentrant whenNotPaused { for (uint i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; bool isEvil = traitsContract.isEvil(tokenId); if (!isEvil) { StakeWZRD memory stake = stakedWZRDs[tokenId]; require(stake.owner == _msgSender(), 'Only owner can unstake'); require(!stake.locked, 'Cannot unstake locked WZRD'); tokenContract.transferFrom(address(this), _msgSender(), tokenId); removeTokenFromOwnerMap(_msgSender(), tokenId); delete stakedWZRDs[tokenId]; totalWZRDStaked -= 1; } else { StakeEvil memory stake = stakedEvils[tokenId]; require(stake.owner == _msgSender(), 'Only owner can unstake'); tokenContract.transferFrom(address(this), _msgSender(), tokenId); delete stakedEvils[tokenId]; removeTokenFromOwnerMap(_msgSender(), tokenId); removeEvilIndex(stake.index); totalEvilStaked -= 1; } } } function addEvilIndex(uint256 tokenId) internal { evilIndices.push(tokenId); } function removeEvilIndex(uint256 currIndex) internal { uint256 changedToken = evilIndices[evilIndices.length - 1]; evilIndices[currIndex] = changedToken; stakedEvils[changedToken].index = currIndex; evilIndices.pop(); } function addTokenToOwnerMap(address owner, uint256 tokenId) internal { ownerMap[owner].push(tokenId); } function removeTokenFromOwnerMap(address owner, uint256 tokenId) internal { uint256[] storage tokensStaked = ownerMap[owner]; for (uint i = 0; i < tokensStaked.length; i++) { if (tokensStaked[i] == tokenId) { tokensStaked[i] = tokensStaked[tokensStaked.length - 1]; tokensStaked.pop(); ownerMap[owner] = tokensStaked; break; } } } function getWZRDStake(uint256 tokenId) public view returns (StakeWZRD memory) { return stakedWZRDs[tokenId]; } function getEvilStake(uint256 tokenId) public view returns (StakeEvil memory) { return stakedEvils[tokenId]; } function claimShrooms(uint256[] calldata tokenIds) external nonReentrant whenNotPaused { for (uint i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; claim(tokenId); } } function claim(uint256 tokenId) internal { StakeWZRD storage stakedWZRD = stakedWZRDs[tokenId]; require(stakedWZRD.owner == _msgSender(), 'Only owner can claim rewards'); require(!stakedWZRD.locked, 'Cannot claim rewards from locked WZRD'); uint256 rewardQuntity = calculateRewardQuantity(stakedWZRD); rewardTokensContract.mint(stakedWZRD.owner, rewardQuntity); stakedWZRD.start = block.timestamp; } function getClaimableShrooms(uint256 tokenId) public view returns (uint256) { StakeWZRD memory stakedWZRD = stakedWZRDs[tokenId]; return calculateRewardQuantity(stakedWZRD); } function calculateRewardQuantity(StakeWZRD memory stakedWZRD) internal view returns (uint256) { uint256 duration = block.timestamp - stakedWZRD.start; if (duration > rewardCap) { duration = rewardCap; } return (duration / 180) * rewardRate; } function getStakedTokenIdsOfUser(address user) public view returns (uint256[] memory) { return ownerMap[user]; } function lockWZRD(uint256 tokenId) external onlyAltars { StakeWZRD storage stakedWZRD = stakedWZRDs[tokenId]; stakedWZRD.locked = true; } function unlockWZRD(uint256 tokenId) external onlyAltars { StakeWZRD storage stakedWZRD = stakedWZRDs[tokenId]; stakedWZRD.locked = false; } function updateOwner(uint256 tokenId, address newOwner) public onlyAltars { address oldOwner; bool isEvil = traitsContract.isEvil(tokenId); if (!isEvil) { StakeWZRD storage stakedWZRD = stakedWZRDs[tokenId]; oldOwner = stakedWZRD.owner; stakedWZRD.owner = newOwner; } else { StakeEvil storage stakedEvil = stakedEvils[tokenId]; oldOwner = stakedEvil.owner; stakedEvil.owner = newOwner; } removeTokenFromOwnerMap(oldOwner, tokenId); addTokenToOwnerMap(newOwner, tokenId); } function pickEvilWinner(uint256 rand) external view onlyAltars returns (address) { uint256 index = rand % totalEvilStaked; StakeEvil memory evilWinner = stakedEvils[evilIndices[index]]; return evilWinner.owner; } function burnStaked(uint256[] calldata tokenIds) external onlyAltars { for (uint i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; bool isEvil = traitsContract.isEvil(tokenId); if (!isEvil) { StakeWZRD memory stakedWZRD = stakedWZRDs[tokenId]; require(stakedWZRD.owner != address(0x0), 'Token was not staked'); removeTokenFromOwnerMap(stakedWZRD.owner, tokenId); tokenContract.burnFromAltar(tokenId); delete stakedWZRDs[tokenId]; totalWZRDStaked -= 1; } else { StakeEvil memory stakedEvil = stakedEvils[tokenId]; require(stakedEvil.owner != address(0x0), 'Token was not staked'); tokenContract.burnFromAltar(tokenId); delete stakedEvils[tokenId]; removeTokenFromOwnerMap(stakedEvil.owner, tokenId); removeEvilIndex(stakedEvil.index); totalEvilStaked -= 1; } } } function addAltar(address a) public onlyOwner { altarOfSacrifice[a] = true; } function removeAltar(address a) public onlyOwner { altarOfSacrifice[a] = false; } modifier onlyAltars() { require(altarOfSacrifice[_msgSender()], 'Not an altar of sacrifice'); _; } function setTraitsAddress(address a) public onlyOwner { traitsContract = WizNFTTraits(a); } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; contract WizNFTTraits is Ownable { function isEvil(uint256 tokenId) public view returns (bool) { return tokenId >= 10000; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import 'erc721a/contracts/ERC721A.sol'; contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } contract WizNFT is Ownable, ERC721A { using ECDSA for bytes32; uint256 public constant maxTokenSupply = 10000; uint256 public constant tokenPrice = 0; uint public constant maxPerWallet = 1; bool public isPublicSale; string private baseMetadataUri; address private openSeaRegistryAddress; mapping(address => bool) private altarOfSacrifice; mapping(address => uint) private mintedPerAddress; constructor() ERC721A('WizNFT', 'WZNFT') {} function mint(bytes calldata proof) public payable { require(totalSupply() + 1 <= maxTokenSupply, "Cannot exceed total supply"); if (_msgSender() != owner()) { require(isValidProof(_msgSender(), proof), "User has no valid proof"); require(isPublicSale, "Sale has not started"); require(mintedPerAddress[_msgSender()] + 1 <= maxPerWallet, "Cannot exceed max mint per wallet"); require(tokenPrice <= msg.value, "Not enough eth for mint"); } mintedPerAddress[_msgSender()] += 1; _safeMint(_msgSender(), 1); } function mintWhitelist(bytes calldata proof) public payable { require(isValidProof(_msgSender(), proof), "User has no valid proof"); require(mintedPerAddress[_msgSender()] + 1 <= maxPerWallet, "Cannot exceed max mint per wallet"); require(totalSupply() + 1 <= maxTokenSupply, "Cannot exceed total supply"); mintedPerAddress[_msgSender()] += 1; _safeMint(_msgSender(), 1); } function mintFromAltar(address a, uint quantity) public onlyAltars { mintedPerAddress[a] += quantity; _safeMint(a, quantity); } function burnFromAltar(uint256 tokenId) public onlyAltars { require(_exists(tokenId), 'Token does not exist'); _burn(tokenId); } function setBaseMetadataUri(string memory a) public onlyOwner { baseMetadataUri = a; } function setOpenSeaRegistryAddress(address a) public onlyOwner { openSeaRegistryAddress = a; } function startPublicSale() public onlyOwner { isPublicSale = true; } function isApprovedForAll(address owner, address operator) public override view returns (bool) { ProxyRegistry openSeaRegistry = ProxyRegistry(openSeaRegistryAddress); if (address(openSeaRegistry.proxies(owner)) == operator) { return true; } if (altarOfSacrifice[operator]) { return true; } return super.isApprovedForAll(owner, operator); } function _baseURI() internal view override returns (string memory) { return baseMetadataUri; } function addAltar(address a) public onlyOwner { altarOfSacrifice[a] = true; } function removeAltar(address a) public onlyOwner { altarOfSacrifice[a] = false; } modifier onlyAltars() { require(altarOfSacrifice[_msgSender()], 'Not an altar of sacrifice'); _; } function isValidProof(address a, bytes memory proof) internal returns (bool) { bytes32 data = keccak256(abi.encodePacked(a)); return owner() == data.toEthSignedMessageHash().recover(proof); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; contract Shroom is Ownable, ERC20 { bool public transferable = false; uint256 public constant MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; mapping(address => bool) private _shroomBanks; constructor() ERC20('Shroom', 'SHRM') {} function mint(address to, uint256 quantity) public onlyShroomBank { _mint(to, quantity); } function allowance(address owner, address spender) public view override returns (uint256) { if (_shroomBanks[spender]) { return MAX_INT; } return super.allowance(owner, spender); } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); if (!_shroomBanks[_msgSender()]) { uint256 currentAllowance = allowance(sender, _msgSender()); require(currentAllowance >= amount, 'Transfer amount exceeds allowance'); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } } return true; } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { if (_msgSender() != owner() && !_shroomBanks[_msgSender()]) { require(transferable, 'Cannot transfer if false'); } super._beforeTokenTransfer(from, to, amount); } function addShroomBank(address shroomBank) public onlyOwner { _shroomBanks[shroomBank] = true; } function removeShroomBank(address shroomBank) public onlyOwner { _shroomBanks[shroomBank] = false; } function setTransferable(bool _transferable) public onlyOwner { transferable = _transferable; } modifier onlyShroomBank() { require(_shroomBanks[_msgSender()], 'Caller is not an approved shroom bank'); _; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; /** * @dev Interface of an ERC721A compliant contract. */ interface IERC721A is IERC721, IERC721Metadata { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * The caller cannot approve to the current owner. */ error ApprovalToCurrentOwner(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } /** * @dev Returns the total amount of tokens stored by the contract. * * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens. */ function totalSupply() external view returns (uint256); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v3.3.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is Context, ERC165, IERC721A { using Address for address; using Strings for uint256; // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // 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; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @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 override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @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) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); 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 override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_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 { _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 { _transfer(from, to, tokenId); if (to.isContract()) if(!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex < end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex < end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex < end); _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} }
// 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 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/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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/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/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 (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 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/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/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens 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 amount ) 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, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// 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 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 (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); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"traitsContractAddress","type":"address"},{"internalType":"address","name":"rewardTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"addAltar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"burnStaked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"claimShrooms","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getClaimableShrooms","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getEvilStake","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"internalType":"struct WizForest.StakeEvil","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getStakedTokenIdsOfUser","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalEvilStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalWZRDStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getWZRDStake","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"}],"internalType":"struct WizForest.StakeWZRD","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lockWZRD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","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":[{"internalType":"uint256","name":"rand","type":"uint256"}],"name":"pickEvilWinner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"removeAltar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"setTraitsAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"stakeWZRDS","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"}],"name":"unlockWZRD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unstakeWZRDS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"newOwner","type":"address"}],"name":"updateOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162002274380380620022748339810160408190526200003491620001bc565b6200003f336200009d565b6000805460ff60a01b19169055600180556200005a620000ed565b600480546001600160a01b039485166001600160a01b03199182161790915560058054938516938216939093179092556006805491909316911617905562000206565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b62000101600054600160a01b900460ff1690565b15620001465760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620001823390565b6040516001600160a01b03909116815260200160405180910390a1565b80516001600160a01b0381168114620001b757600080fd5b919050565b600080600060608486031215620001d257600080fd5b620001dd846200019f565b9250620001ed602085016200019f565b9150620001fd604085016200019f565b90509250925092565b61205e80620002166000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80637b0a47ee116100de5780639532e28711610097578063aa520d1111610071578063aa520d1114610301578063b9263e5d14610350578063e9090eef14610363578063f2fde38b1461042357600080fd5b80639532e287146102d157806396311468146102db578063a7222f74146102ee57600080fd5b80637b0a47ee1461027b578063804535431461028a5780638456cb591461029d57806384828f51146102a55780638affb485146102ad5780638da5cb5b146102c057600080fd5b8063574fea6311610130578063574fea63146101fd5780635c975abb14610210578063656fe8e51461022d5780636fbf74d114610240578063715018a6146102605780637192711f1461026857600080fd5b8063164a0c76146101785780632d5f76a91461018f578063310bbd6a146101ba5780633f4ba83a146101cf5780634867eb47146101d75780634e920d51146101ea575b600080fd5b6007545b6040519081526020015b60405180910390f35b6101a261019d366004611dac565b610436565b6040516001600160a01b039091168152602001610186565b6101cd6101c8366004611dac565b6104f6565b005b6101cd610540565b6101cd6101e5366004611cdb565b610574565b6101cd6101f8366004611cdb565b6105c2565b6101cd61020b366004611d15565b61060d565b600054600160a01b900460ff166040519015158152602001610186565b6101cd61023b366004611d15565b610b49565b61025361024e366004611cdb565b610ee1565b6040516101869190611e19565b6101cd610f4d565b6101cd610276366004611dc5565b610f81565b61017c674563918244f4000081565b6101cd610298366004611dac565b6110da565b6101cd611127565b60085461017c565b6101cd6102bb366004611cdb565b611159565b6000546001600160a01b03166101a2565b61017c6203f48081565b6101cd6102e9366004611d15565b6111a5565b6101cd6102fc366004611d15565b61123b565b61031461030f366004611dac565b611654565b6040516101869190815181526020808301516001600160a01b031690820152604080830151908201526060918201519181019190915260800190565b61017c61035e366004611dac565b6116d3565b6103e5610371366004611dac565b6040805160808101825260008082526020820181905291810182905260608101919091525060009081526002602081815260409283902083516080810185528154815260018201546001600160a01b03169281019290925291820154928101929092526003015460ff161515606082015290565b6040516101869190815181526020808301516001600160a01b0316908201526040808301519082015260609182015115159181019190915260800190565b6101cd610431366004611cdb565b61172d565b336000908152600b602052604081205460ff1661046e5760405162461bcd60e51b815260040161046590611ebc565b60405180910390fd5b60006008548361047e9190611fa7565b9050600060036000600a848154811061049957610499611ffd565b60009182526020808320909101548352828101939093526040918201902081516080810183528154815260018201546001600160a01b03169381018490526002820154928101929092526003015460609091015292505050919050565b336000908152600b602052604090205460ff166105255760405162461bcd60e51b815260040161046590611ebc565b6000908152600260205260409020600301805460ff19169055565b6000546001600160a01b0316331461056a5760405162461bcd60e51b815260040161046590611e87565b6105726117c8565b565b6000546001600160a01b0316331461059e5760405162461bcd60e51b815260040161046590611e87565b6001600160a01b03166000908152600b60205260409020805460ff19166001179055565b6000546001600160a01b031633146105ec5760405162461bcd60e51b815260040161046590611e87565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b600260015414156106305760405162461bcd60e51b815260040161046590611ef3565b6002600155600054600160a01b900460ff161561065f5760405162461bcd60e51b815260040161046590611e5d565b60005b81811015610b4057600083838381811061067e5761067e611ffd565b600554604051634513df9160e01b815260209290920293909301356004820181905293506000926001600160a01b03169150634513df919060240160206040518083038186803b1580156106d157600080fd5b505afa1580156106e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107099190611d8a565b90508061091f5733600480546040516331a9108f60e11b81529182018590526001600160a01b03928316921690636352211e9060240160206040518083038186803b15801561075757600080fd5b505afa15801561076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078f9190611cf8565b6001600160a01b0316146107e55760405162461bcd60e51b815260206004820152601d60248201527f4d73672073656e64657220646f6573206e6f74206f776e20746f6b656e0000006044820152606401610465565b6004546001600160a01b03166323b872dd3330856040518463ffffffff1660e01b815260040161081793929190611df5565b600060405180830381600087803b15801561083157600080fd5b505af1158015610845573d6000803e3d6000fd5b5050505060405180608001604052808381526020016108613390565b6001600160a01b039081168252426020808401919091526000604093840181905286815260028083529084902085518155918501516001830180546001600160a01b031916919094161790925591830151908201556060909101516003909101805460ff1916911515919091179055610901335b6001600160a01b0316600090815260096020908152604082208054600181018255908352912001839055565b6001600760008282546109149190611f2a565b90915550610b2b9050565b33600480546040516331a9108f60e11b81529182018590526001600160a01b03928316921690636352211e9060240160206040518083038186803b15801561096657600080fd5b505afa15801561097a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099e9190611cf8565b6001600160a01b0316146109f45760405162461bcd60e51b815260206004820152601d60248201527f4d73672073656e64657220646f6573206e6f74206f776e20746f6b656e0000006044820152606401610465565b6004546001600160a01b03166323b872dd3330856040518463ffffffff1660e01b8152600401610a2693929190611df5565b600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b50505050610a9182600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b6040518060800160405280838152602001610aa93390565b6001600160a01b03908116825242602080840191909152600854604093840152600086815260038083529084902085518155918501516001830180546001600160a01b0319169190941617909255918301516002830155606090920151910155610b12336108d5565b600160086000828254610b259190611f2a565b90915550505b50508080610b3890611f8c565b915050610662565b50506001805550565b336000908152600b602052604090205460ff16610b785760405162461bcd60e51b815260040161046590611ebc565b60005b81811015610edc576000838383818110610b9757610b97611ffd565b600554604051634513df9160e01b815260209290920293909301356004820181905293506000926001600160a01b03169150634513df919060240160206040518083038186803b158015610bea57600080fd5b505afa158015610bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c229190611d8a565b905080610d7a5760008281526002602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052928101549383019390935260039092015460ff161515606082015290610cba5760405162461bcd60e51b8152602060048201526014602482015273151bdad95b881dd85cc81b9bdd081cdd185ad95960621b6044820152606401610465565b610cc8816020015184611865565b60048054604051636aef506960e01b81529182018590526001600160a01b031690636aef506990602401600060405180830381600087803b158015610d0c57600080fd5b505af1158015610d20573d6000803e3d6000fd5b50505060008481526002602081905260408220828155600180820180546001600160a01b0319169055918101839055600301805460ff19169055600780549193509190610d6e908490611f75565b90915550610ec7915050565b60008281526003602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052600282015494810194909452909101546060830152610e045760405162461bcd60e51b8152602060048201526014602482015273151bdad95b881dd85cc81b9bdd081cdd185ad95960621b6044820152606401610465565b60048054604051636aef506960e01b81529182018590526001600160a01b031690636aef506990602401600060405180830381600087803b158015610e4857600080fd5b505af1158015610e5c573d6000803e3d6000fd5b505050600084815260036020818152604083208381556001810180546001600160a01b03191690556002810184905590910191909155820151610ea0915084611865565b610ead816060015161195c565b600160086000828254610ec09190611f75565b9091555050505b50508080610ed490611f8c565b915050610b7b565b505050565b6001600160a01b038116600090815260096020908152604091829020805483518184028101840190945280845260609392830182828015610f4157602002820191906000526020600020905b815481526020019060010190808311610f2d575b50505050509050919050565b6000546001600160a01b03163314610f775760405162461bcd60e51b815260040161046590611e87565b61057260006119ee565b336000908152600b602052604090205460ff16610fb05760405162461bcd60e51b815260040161046590611ebc565b600554604051634513df9160e01b81526004810184905260009182916001600160a01b0390911690634513df919060240160206040518083038186803b158015610ff957600080fd5b505afa15801561100d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110319190611d8a565b90508061106d57600084815260026020526040902060010180546001600160a01b038581166001600160a01b031983161790925516915061109e565b600084815260036020526040902060010180546001600160a01b038581166001600160a01b03198316179092551691505b6110a88285611865565b6001600160a01b0383166000908152600960209081526040822080546001810182559083529120018490555b50505050565b336000908152600b602052604090205460ff166111095760405162461bcd60e51b815260040161046590611ebc565b6000908152600260205260409020600301805460ff19166001179055565b6000546001600160a01b031633146111515760405162461bcd60e51b815260040161046590611e87565b610572611a3e565b6000546001600160a01b031633146111835760405162461bcd60e51b815260040161046590611e87565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b600260015414156111c85760405162461bcd60e51b815260040161046590611ef3565b6002600155600054600160a01b900460ff16156111f75760405162461bcd60e51b815260040161046590611e5d565b60005b81811015610b4057600083838381811061121657611216611ffd565b90506020020135905061122881611aa3565b508061123381611f8c565b9150506111fa565b6002600154141561125e5760405162461bcd60e51b815260040161046590611ef3565b6002600155600054600160a01b900460ff161561128d5760405162461bcd60e51b815260040161046590611e5d565b60005b81811015610b405760008383838181106112ac576112ac611ffd565b600554604051634513df9160e01b815260209290920293909301356004820181905293506000926001600160a01b03169150634513df919060240160206040518083038186803b1580156112ff57600080fd5b505afa158015611313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113379190611d8a565b9050806114ef5760008281526002602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052928101549383019390935260039092015460ff16151560608201529033146113d35760405162461bcd60e51b81526020600482015260166024820152754f6e6c79206f776e65722063616e20756e7374616b6560501b6044820152606401610465565b8060600151156114255760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420756e7374616b65206c6f636b656420575a52440000000000006044820152606401610465565b6004546001600160a01b03166323b872dd3033866040518463ffffffff1660e01b815260040161145793929190611df5565b600060405180830381600087803b15801561147157600080fd5b505af1158015611485573d6000803e3d6000fd5b505050506114996114933390565b84611865565b60008381526002602081905260408220828155600180820180546001600160a01b0319169055918101839055600301805460ff1916905560078054919290916114e3908490611f75565b9091555061163f915050565b60008281526003602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052600282015494810194909452909101546060830152331461157d5760405162461bcd60e51b81526020600482015260166024820152754f6e6c79206f776e65722063616e20756e7374616b6560501b6044820152606401610465565b6004546001600160a01b03166323b872dd3033866040518463ffffffff1660e01b81526004016115af93929190611df5565b600060405180830381600087803b1580156115c957600080fd5b505af11580156115dd573d6000803e3d6000fd5b505050600084815260036020819052604082208281556001810180546001600160a01b03191690556002810183905501555061161833611493565b611625816060015161195c565b6001600860008282546116389190611f75565b9091555050505b5050808061164c90611f8c565b915050611290565b61168860405180608001604052806000815260200160006001600160a01b0316815260200160008152602001600081525090565b5060009081526003602081815260409283902083516080810185528154815260018201546001600160a01b031692810192909252600281015493820193909352910154606082015290565b600081815260026020818152604080842081516080810183528154815260018201546001600160a01b031693810193909352928301549082015260039091015460ff161515606082015261172681611c32565b9392505050565b6000546001600160a01b031633146117575760405162461bcd60e51b815260040161046590611e87565b6001600160a01b0381166117bc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610465565b6117c5816119ee565b50565b600054600160a01b900460ff166118185760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610465565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166000908152600960205260408120905b81548110156110d4578282828154811061189b5761189b611ffd565b9060005260206000200154141561194a57815482906118bc90600190611f75565b815481106118cc576118cc611ffd565b90600052602060002001548282815481106118e9576118e9611ffd565b90600052602060002001819055508180548061190757611907611fe7565b6000828152602080822083016000199081018390559092019092556001600160a01b03861682526009905260409020825461194491908490611c76565b506110d4565b8061195481611f8c565b91505061187f565b600a80546000919061197090600190611f75565b8154811061198057611980611ffd565b9060005260206000200154905080600a83815481106119a1576119a1611ffd565b60009182526020808320909101929092558281526003918290526040902001829055600a8054806119d4576119d4611fe7565b600190038181906000526020600020016000905590555050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff1615611a685760405162461bcd60e51b815260040161046590611e5d565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118483390565b600081815260026020526040902060018101546001600160a01b03163314611b0d5760405162461bcd60e51b815260206004820152601c60248201527f4f6e6c79206f776e65722063616e20636c61696d2072657761726473000000006044820152606401610465565b600381015460ff1615611b705760405162461bcd60e51b815260206004820152602560248201527f43616e6e6f7420636c61696d20726577617264732066726f6d206c6f636b65646044820152640815d6949160da1b6064820152608401610465565b604080516080810182528254815260018301546001600160a01b03166020820152600283015491810191909152600382015460ff1615156060820152600090611bb890611c32565b60065460018401546040516340c10f1960e01b81526001600160a01b0391821660048201526024810184905292935016906340c10f1990604401600060405180830381600087803b158015611c0c57600080fd5b505af1158015611c20573d6000803e3d6000fd5b50505050428260020181905550505050565b600080826040015142611c459190611f75565b90506203f480811115611c5857506203f4805b674563918244f40000611c6c60b483611f42565b6117269190611f56565b828054828255906000526020600020908101928215611cb65760005260206000209182015b82811115611cb6578254825591600101919060010190611c9b565b50611cc2929150611cc6565b5090565b5b80821115611cc25760008155600101611cc7565b600060208284031215611ced57600080fd5b813561172681612013565b600060208284031215611d0a57600080fd5b815161172681612013565b60008060208385031215611d2857600080fd5b823567ffffffffffffffff80821115611d4057600080fd5b818501915085601f830112611d5457600080fd5b813581811115611d6357600080fd5b8660208260051b8501011115611d7857600080fd5b60209290920196919550909350505050565b600060208284031215611d9c57600080fd5b8151801515811461172657600080fd5b600060208284031215611dbe57600080fd5b5035919050565b60008060408385031215611dd857600080fd5b823591506020830135611dea81612013565b809150509250929050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015611e5157835183529284019291840191600101611e35565b50909695505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526019908201527f4e6f7420616e20616c746172206f662073616372696669636500000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115611f3d57611f3d611fbb565b500190565b600082611f5157611f51611fd1565b500490565b6000816000190483118215151615611f7057611f70611fbb565b500290565b600082821015611f8757611f87611fbb565b500390565b6000600019821415611fa057611fa0611fbb565b5060010190565b600082611fb657611fb6611fd1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146117c557600080fdfea2646970667358221220cb8021afdc07a21054976717414043164767539d1d90d16937d452eac589ad5164736f6c63430008070033000000000000000000000000e5e771bc685c5a89710131919c616c361ff001c600000000000000000000000006b8e3eeabc5646b88c14bbeef2c81a5460d1f400000000000000000000000007aa46b190eef75e1249690fa7a1d9e7e6786dd71
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80637b0a47ee116100de5780639532e28711610097578063aa520d1111610071578063aa520d1114610301578063b9263e5d14610350578063e9090eef14610363578063f2fde38b1461042357600080fd5b80639532e287146102d157806396311468146102db578063a7222f74146102ee57600080fd5b80637b0a47ee1461027b578063804535431461028a5780638456cb591461029d57806384828f51146102a55780638affb485146102ad5780638da5cb5b146102c057600080fd5b8063574fea6311610130578063574fea63146101fd5780635c975abb14610210578063656fe8e51461022d5780636fbf74d114610240578063715018a6146102605780637192711f1461026857600080fd5b8063164a0c76146101785780632d5f76a91461018f578063310bbd6a146101ba5780633f4ba83a146101cf5780634867eb47146101d75780634e920d51146101ea575b600080fd5b6007545b6040519081526020015b60405180910390f35b6101a261019d366004611dac565b610436565b6040516001600160a01b039091168152602001610186565b6101cd6101c8366004611dac565b6104f6565b005b6101cd610540565b6101cd6101e5366004611cdb565b610574565b6101cd6101f8366004611cdb565b6105c2565b6101cd61020b366004611d15565b61060d565b600054600160a01b900460ff166040519015158152602001610186565b6101cd61023b366004611d15565b610b49565b61025361024e366004611cdb565b610ee1565b6040516101869190611e19565b6101cd610f4d565b6101cd610276366004611dc5565b610f81565b61017c674563918244f4000081565b6101cd610298366004611dac565b6110da565b6101cd611127565b60085461017c565b6101cd6102bb366004611cdb565b611159565b6000546001600160a01b03166101a2565b61017c6203f48081565b6101cd6102e9366004611d15565b6111a5565b6101cd6102fc366004611d15565b61123b565b61031461030f366004611dac565b611654565b6040516101869190815181526020808301516001600160a01b031690820152604080830151908201526060918201519181019190915260800190565b61017c61035e366004611dac565b6116d3565b6103e5610371366004611dac565b6040805160808101825260008082526020820181905291810182905260608101919091525060009081526002602081815260409283902083516080810185528154815260018201546001600160a01b03169281019290925291820154928101929092526003015460ff161515606082015290565b6040516101869190815181526020808301516001600160a01b0316908201526040808301519082015260609182015115159181019190915260800190565b6101cd610431366004611cdb565b61172d565b336000908152600b602052604081205460ff1661046e5760405162461bcd60e51b815260040161046590611ebc565b60405180910390fd5b60006008548361047e9190611fa7565b9050600060036000600a848154811061049957610499611ffd565b60009182526020808320909101548352828101939093526040918201902081516080810183528154815260018201546001600160a01b03169381018490526002820154928101929092526003015460609091015292505050919050565b336000908152600b602052604090205460ff166105255760405162461bcd60e51b815260040161046590611ebc565b6000908152600260205260409020600301805460ff19169055565b6000546001600160a01b0316331461056a5760405162461bcd60e51b815260040161046590611e87565b6105726117c8565b565b6000546001600160a01b0316331461059e5760405162461bcd60e51b815260040161046590611e87565b6001600160a01b03166000908152600b60205260409020805460ff19166001179055565b6000546001600160a01b031633146105ec5760405162461bcd60e51b815260040161046590611e87565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b600260015414156106305760405162461bcd60e51b815260040161046590611ef3565b6002600155600054600160a01b900460ff161561065f5760405162461bcd60e51b815260040161046590611e5d565b60005b81811015610b4057600083838381811061067e5761067e611ffd565b600554604051634513df9160e01b815260209290920293909301356004820181905293506000926001600160a01b03169150634513df919060240160206040518083038186803b1580156106d157600080fd5b505afa1580156106e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107099190611d8a565b90508061091f5733600480546040516331a9108f60e11b81529182018590526001600160a01b03928316921690636352211e9060240160206040518083038186803b15801561075757600080fd5b505afa15801561076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078f9190611cf8565b6001600160a01b0316146107e55760405162461bcd60e51b815260206004820152601d60248201527f4d73672073656e64657220646f6573206e6f74206f776e20746f6b656e0000006044820152606401610465565b6004546001600160a01b03166323b872dd3330856040518463ffffffff1660e01b815260040161081793929190611df5565b600060405180830381600087803b15801561083157600080fd5b505af1158015610845573d6000803e3d6000fd5b5050505060405180608001604052808381526020016108613390565b6001600160a01b039081168252426020808401919091526000604093840181905286815260028083529084902085518155918501516001830180546001600160a01b031916919094161790925591830151908201556060909101516003909101805460ff1916911515919091179055610901335b6001600160a01b0316600090815260096020908152604082208054600181018255908352912001839055565b6001600760008282546109149190611f2a565b90915550610b2b9050565b33600480546040516331a9108f60e11b81529182018590526001600160a01b03928316921690636352211e9060240160206040518083038186803b15801561096657600080fd5b505afa15801561097a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099e9190611cf8565b6001600160a01b0316146109f45760405162461bcd60e51b815260206004820152601d60248201527f4d73672073656e64657220646f6573206e6f74206f776e20746f6b656e0000006044820152606401610465565b6004546001600160a01b03166323b872dd3330856040518463ffffffff1660e01b8152600401610a2693929190611df5565b600060405180830381600087803b158015610a4057600080fd5b505af1158015610a54573d6000803e3d6000fd5b50505050610a9182600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b6040518060800160405280838152602001610aa93390565b6001600160a01b03908116825242602080840191909152600854604093840152600086815260038083529084902085518155918501516001830180546001600160a01b0319169190941617909255918301516002830155606090920151910155610b12336108d5565b600160086000828254610b259190611f2a565b90915550505b50508080610b3890611f8c565b915050610662565b50506001805550565b336000908152600b602052604090205460ff16610b785760405162461bcd60e51b815260040161046590611ebc565b60005b81811015610edc576000838383818110610b9757610b97611ffd565b600554604051634513df9160e01b815260209290920293909301356004820181905293506000926001600160a01b03169150634513df919060240160206040518083038186803b158015610bea57600080fd5b505afa158015610bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c229190611d8a565b905080610d7a5760008281526002602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052928101549383019390935260039092015460ff161515606082015290610cba5760405162461bcd60e51b8152602060048201526014602482015273151bdad95b881dd85cc81b9bdd081cdd185ad95960621b6044820152606401610465565b610cc8816020015184611865565b60048054604051636aef506960e01b81529182018590526001600160a01b031690636aef506990602401600060405180830381600087803b158015610d0c57600080fd5b505af1158015610d20573d6000803e3d6000fd5b50505060008481526002602081905260408220828155600180820180546001600160a01b0319169055918101839055600301805460ff19169055600780549193509190610d6e908490611f75565b90915550610ec7915050565b60008281526003602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052600282015494810194909452909101546060830152610e045760405162461bcd60e51b8152602060048201526014602482015273151bdad95b881dd85cc81b9bdd081cdd185ad95960621b6044820152606401610465565b60048054604051636aef506960e01b81529182018590526001600160a01b031690636aef506990602401600060405180830381600087803b158015610e4857600080fd5b505af1158015610e5c573d6000803e3d6000fd5b505050600084815260036020818152604083208381556001810180546001600160a01b03191690556002810184905590910191909155820151610ea0915084611865565b610ead816060015161195c565b600160086000828254610ec09190611f75565b9091555050505b50508080610ed490611f8c565b915050610b7b565b505050565b6001600160a01b038116600090815260096020908152604091829020805483518184028101840190945280845260609392830182828015610f4157602002820191906000526020600020905b815481526020019060010190808311610f2d575b50505050509050919050565b6000546001600160a01b03163314610f775760405162461bcd60e51b815260040161046590611e87565b61057260006119ee565b336000908152600b602052604090205460ff16610fb05760405162461bcd60e51b815260040161046590611ebc565b600554604051634513df9160e01b81526004810184905260009182916001600160a01b0390911690634513df919060240160206040518083038186803b158015610ff957600080fd5b505afa15801561100d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110319190611d8a565b90508061106d57600084815260026020526040902060010180546001600160a01b038581166001600160a01b031983161790925516915061109e565b600084815260036020526040902060010180546001600160a01b038581166001600160a01b03198316179092551691505b6110a88285611865565b6001600160a01b0383166000908152600960209081526040822080546001810182559083529120018490555b50505050565b336000908152600b602052604090205460ff166111095760405162461bcd60e51b815260040161046590611ebc565b6000908152600260205260409020600301805460ff19166001179055565b6000546001600160a01b031633146111515760405162461bcd60e51b815260040161046590611e87565b610572611a3e565b6000546001600160a01b031633146111835760405162461bcd60e51b815260040161046590611e87565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b600260015414156111c85760405162461bcd60e51b815260040161046590611ef3565b6002600155600054600160a01b900460ff16156111f75760405162461bcd60e51b815260040161046590611e5d565b60005b81811015610b4057600083838381811061121657611216611ffd565b90506020020135905061122881611aa3565b508061123381611f8c565b9150506111fa565b6002600154141561125e5760405162461bcd60e51b815260040161046590611ef3565b6002600155600054600160a01b900460ff161561128d5760405162461bcd60e51b815260040161046590611e5d565b60005b81811015610b405760008383838181106112ac576112ac611ffd565b600554604051634513df9160e01b815260209290920293909301356004820181905293506000926001600160a01b03169150634513df919060240160206040518083038186803b1580156112ff57600080fd5b505afa158015611313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113379190611d8a565b9050806114ef5760008281526002602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052928101549383019390935260039092015460ff16151560608201529033146113d35760405162461bcd60e51b81526020600482015260166024820152754f6e6c79206f776e65722063616e20756e7374616b6560501b6044820152606401610465565b8060600151156114255760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f7420756e7374616b65206c6f636b656420575a52440000000000006044820152606401610465565b6004546001600160a01b03166323b872dd3033866040518463ffffffff1660e01b815260040161145793929190611df5565b600060405180830381600087803b15801561147157600080fd5b505af1158015611485573d6000803e3d6000fd5b505050506114996114933390565b84611865565b60008381526002602081905260408220828155600180820180546001600160a01b0319169055918101839055600301805460ff1916905560078054919290916114e3908490611f75565b9091555061163f915050565b60008281526003602081815260409283902083516080810185528154815260018201546001600160a01b0316928101839052600282015494810194909452909101546060830152331461157d5760405162461bcd60e51b81526020600482015260166024820152754f6e6c79206f776e65722063616e20756e7374616b6560501b6044820152606401610465565b6004546001600160a01b03166323b872dd3033866040518463ffffffff1660e01b81526004016115af93929190611df5565b600060405180830381600087803b1580156115c957600080fd5b505af11580156115dd573d6000803e3d6000fd5b505050600084815260036020819052604082208281556001810180546001600160a01b03191690556002810183905501555061161833611493565b611625816060015161195c565b6001600860008282546116389190611f75565b9091555050505b5050808061164c90611f8c565b915050611290565b61168860405180608001604052806000815260200160006001600160a01b0316815260200160008152602001600081525090565b5060009081526003602081815260409283902083516080810185528154815260018201546001600160a01b031692810192909252600281015493820193909352910154606082015290565b600081815260026020818152604080842081516080810183528154815260018201546001600160a01b031693810193909352928301549082015260039091015460ff161515606082015261172681611c32565b9392505050565b6000546001600160a01b031633146117575760405162461bcd60e51b815260040161046590611e87565b6001600160a01b0381166117bc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610465565b6117c5816119ee565b50565b600054600160a01b900460ff166118185760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610465565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b0382166000908152600960205260408120905b81548110156110d4578282828154811061189b5761189b611ffd565b9060005260206000200154141561194a57815482906118bc90600190611f75565b815481106118cc576118cc611ffd565b90600052602060002001548282815481106118e9576118e9611ffd565b90600052602060002001819055508180548061190757611907611fe7565b6000828152602080822083016000199081018390559092019092556001600160a01b03861682526009905260409020825461194491908490611c76565b506110d4565b8061195481611f8c565b91505061187f565b600a80546000919061197090600190611f75565b8154811061198057611980611ffd565b9060005260206000200154905080600a83815481106119a1576119a1611ffd565b60009182526020808320909101929092558281526003918290526040902001829055600a8054806119d4576119d4611fe7565b600190038181906000526020600020016000905590555050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff1615611a685760405162461bcd60e51b815260040161046590611e5d565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118483390565b600081815260026020526040902060018101546001600160a01b03163314611b0d5760405162461bcd60e51b815260206004820152601c60248201527f4f6e6c79206f776e65722063616e20636c61696d2072657761726473000000006044820152606401610465565b600381015460ff1615611b705760405162461bcd60e51b815260206004820152602560248201527f43616e6e6f7420636c61696d20726577617264732066726f6d206c6f636b65646044820152640815d6949160da1b6064820152608401610465565b604080516080810182528254815260018301546001600160a01b03166020820152600283015491810191909152600382015460ff1615156060820152600090611bb890611c32565b60065460018401546040516340c10f1960e01b81526001600160a01b0391821660048201526024810184905292935016906340c10f1990604401600060405180830381600087803b158015611c0c57600080fd5b505af1158015611c20573d6000803e3d6000fd5b50505050428260020181905550505050565b600080826040015142611c459190611f75565b90506203f480811115611c5857506203f4805b674563918244f40000611c6c60b483611f42565b6117269190611f56565b828054828255906000526020600020908101928215611cb65760005260206000209182015b82811115611cb6578254825591600101919060010190611c9b565b50611cc2929150611cc6565b5090565b5b80821115611cc25760008155600101611cc7565b600060208284031215611ced57600080fd5b813561172681612013565b600060208284031215611d0a57600080fd5b815161172681612013565b60008060208385031215611d2857600080fd5b823567ffffffffffffffff80821115611d4057600080fd5b818501915085601f830112611d5457600080fd5b813581811115611d6357600080fd5b8660208260051b8501011115611d7857600080fd5b60209290920196919550909350505050565b600060208284031215611d9c57600080fd5b8151801515811461172657600080fd5b600060208284031215611dbe57600080fd5b5035919050565b60008060408385031215611dd857600080fd5b823591506020830135611dea81612013565b809150509250929050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015611e5157835183529284019291840191600101611e35565b50909695505050505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526019908201527f4e6f7420616e20616c746172206f662073616372696669636500000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008219821115611f3d57611f3d611fbb565b500190565b600082611f5157611f51611fd1565b500490565b6000816000190483118215151615611f7057611f70611fbb565b500290565b600082821015611f8757611f87611fbb565b500390565b6000600019821415611fa057611fa0611fbb565b5060010190565b600082611fb657611fb6611fd1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146117c557600080fdfea2646970667358221220cb8021afdc07a21054976717414043164767539d1d90d16937d452eac589ad5164736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e5e771bc685c5a89710131919c616c361ff001c600000000000000000000000006b8e3eeabc5646b88c14bbeef2c81a5460d1f400000000000000000000000007aa46b190eef75e1249690fa7a1d9e7e6786dd71
-----Decoded View---------------
Arg [0] : tokenAddress (address): 0xe5E771bC685c5a89710131919C616c361ff001c6
Arg [1] : traitsContractAddress (address): 0x06B8E3eeABC5646b88C14BBEEf2C81A5460D1F40
Arg [2] : rewardTokenAddress (address): 0x7AA46b190EEf75E1249690fA7A1D9E7E6786dD71
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000e5e771bc685c5a89710131919c616c361ff001c6
Arg [1] : 00000000000000000000000006b8e3eeabc5646b88c14bbeef2c81a5460d1f40
Arg [2] : 0000000000000000000000007aa46b190eef75e1249690fa7a1d9e7e6786dd71
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.