ERC-20
Overview
Max Total Supply
1,463,170 HYPEB
Holders
607
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 0 Decimals)
Balance
174 HYPEBValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Hypeb
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "./IHypebItems.sol"; import "./HypeBears.sol"; contract Hypeb { address public operator; uint256 public totalSupply; bool public paused; IERC721 public hypebearsWalking; IERC721 public hypebears; IHypebItems public itemsContract; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; mapping(address => Hypebear[]) internal stakers; mapping(address => Hypebear[]) internal stakersWalking; uint256[] public bonusLevels; // levels => percent bonus mapping(uint256 => uint256) public levelPercent; uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; uint256 public rewardAmount = 1; uint256 public rewardPeriod = 1 days; struct Hypebear { uint256 stakedTimestamp; uint256 tokenId; } struct Item { uint256 totalSupply; uint256 maxSupply; uint256 price; } uint256 public totalItemIdAmount; // id => amounts mapping(uint256 => Item) public items; mapping(address => uint256) public lastClaim; mapping(address => bool) public blackList; function name() external pure returns (string memory) { return "HYPEB"; } function symbol() external pure returns (string memory) { return "HYPEB"; } function decimals() external pure returns (uint8) { return 0; } constructor(address _hypebears, address _hypebearsWalking) { operator = msg.sender; hypebears = IERC721(_hypebears); hypebearsWalking = IERC721(_hypebearsWalking); _status = _NOT_ENTERED; bonusLevels.push(3); bonusLevels.push(5); bonusLevels.push(10); levelPercent[1] = 5; levelPercent[2] = 10; levelPercent[3] = 22; } function approve(address spender, uint256 value) external returns (bool) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function transfer(address to, uint256 value) external whenNotPaused returns (bool) { require(!blackList[msg.sender], "Address Blocked"); _transfer(msg.sender, to, value); return true; } function transferFrom( address from, address to, uint256 value ) external whenNotPaused returns (bool) { require(!blackList[msg.sender], "Address Blocked"); if (allowance[from][msg.sender] != type(uint256).max) { allowance[from][msg.sender] -= value; } _transfer(from, to, value); return true; } // // Staking // function totalStakedBy(address _staker) public view returns(uint256) { return (stakers[_staker].length + stakersWalking[_staker].length); } function hypebearsOfStaker(address _staker, bool _walking) public view returns (uint256[] memory) { Hypebear[] memory st = _walking ? stakersWalking[_staker] : stakers[_staker]; uint256[] memory tokenIds = new uint256[](st.length); for (uint256 i = 0; i < st.length; i++) { tokenIds[i] = st[i].tokenId; } return tokenIds; } function stake(uint256[] memory _hypebears, bool _walking) public nonReentrant whenNotPaused { if (totalStakedBy(msg.sender) > 0) { withdrawTo(msg.sender); } IERC721 hb = _walking ? IERC721(hypebearsWalking) : IERC721(hypebears); Hypebear[] storage st = _walking ? stakersWalking[msg.sender] : stakers[msg.sender]; for (uint256 i = 0; i < _hypebears.length; i++) { require(hb.ownerOf(_hypebears[i]) == msg.sender, "Not owner"); hb.transferFrom(msg.sender, address(this), _hypebears[i]); st.push(Hypebear(block.timestamp, _hypebears[i])); } } function removeIdsFromStaker(Hypebear[] storage st, uint256[] memory _tokenIds) internal { for (uint256 i = 0; i < _tokenIds.length; i++) { for (uint256 j = 0; j < st.length; j++) { if (_tokenIds[i] == st[j].tokenId) { st[j] = st[st.length - 1]; st.pop(); } } } } function unstake(uint256[] calldata _tokenIds, bool _walking) external nonReentrant whenNotPaused { require(!blackList[msg.sender], "Address Blocked"); IERC721 hb = _walking ? IERC721(hypebearsWalking) : IERC721(hypebears); Hypebear[] storage st = _walking ? stakersWalking[msg.sender] : stakers[msg.sender]; for (uint256 i = 0; i < _tokenIds.length; i++) { bool owned; for (uint256 j = 0; j < st.length; j++) { if (st[j].tokenId == _tokenIds[i]) { owned = true; } } require(owned, "NOT OWNED"); hb.transferFrom(address(this), msg.sender, _tokenIds[i]); } withdrawTo(msg.sender); removeIdsFromStaker(st, _tokenIds); } function emergencyWithdrawNFT() external nonReentrant whenNotPaused { require(!blackList[msg.sender], "Address Blocked"); IERC721 hbw = IERC721(hypebearsWalking); Hypebear[] storage stw = stakersWalking[msg.sender]; for (uint256 j = 0; j < stw.length; j++) { hbw.transferFrom(address(this), msg.sender, stw[j].tokenId); } delete stakersWalking[msg.sender]; IERC721 hb = IERC721(hypebears); Hypebear[] storage st = stakers[msg.sender]; for (uint256 j = 0; j < st.length; j++) { hb.transferFrom(address(this), msg.sender, st[j].tokenId); } delete stakers[msg.sender]; } function claim() external nonReentrant whenNotPaused { require(!blackList[msg.sender], "Address Blocked"); withdrawTo(msg.sender); } function withdrawTo(address to) internal { uint256 reward = calculateRewards(to); if (reward > 0) { lastClaim[msg.sender] = block.timestamp; _mint(to, reward); } } function calculateRewards(address _staker) public view returns(uint256) { uint256 HypebAmount; HypebAmount += _calculateRewards(stakers[_staker], lastClaim[_staker]); HypebAmount += _calculateRewards(stakersWalking[_staker], lastClaim[_staker]); HypebAmount += HypebAmount * calculateBalanceBonus(totalStakedBy(_staker)) / 100; return HypebAmount; } function _calculateRewards(Hypebear[] memory st, uint256 _lastClaim) internal view returns(uint256) { uint256 result; uint256 stakerBalance = st.length; for (uint256 i = 0; i < stakerBalance; i++) { result += calculateHypeb( _lastClaim, st[i].stakedTimestamp, block.timestamp ); } return result; } function calculateBalanceBonus(uint256 balance) public view returns(uint256) { for (uint256 i = 0; i < bonusLevels.length; i++) { if (balance < bonusLevels[i]) return levelPercent[i]; } return levelPercent[bonusLevels.length]; } function getAllBonusesByTokenAmount() external view returns(uint256[] memory) { uint256[] memory percents = new uint256[](bonusLevels[bonusLevels.length - 1]); for (uint256 i = 0; i < percents.length; i++) { percents[i] = calculateBalanceBonus(i+1); } return percents; } function calculateHypeb( uint256 _lastClaimedTimestamp, uint256 _stakedTimestamp, uint256 _currentTimestamp ) internal view returns (uint256 hypeb) { _lastClaimedTimestamp = _lastClaimedTimestamp < _stakedTimestamp ? _stakedTimestamp : _lastClaimedTimestamp; uint256 unclaimedTime = _currentTimestamp - _lastClaimedTimestamp; hypeb = unclaimedTime * rewardAmount/ rewardPeriod; } // // Items // function createItem(uint256 maxSupply, string calldata uri, uint256 _price) external onlyOperator { uint256 id = itemsContract.create(maxSupply, uri); items[id].maxSupply = maxSupply; items[id].price = _price; totalItemIdAmount = id; } function updateItem(uint256 id, uint256 maxSupply, uint256 _price, string calldata uri) external onlyOperator { items[id].maxSupply = maxSupply; items[id].price = _price; if (bytes(uri).length > 0) { itemsContract.setURI(uri, id); } } function mintItem(uint256 id, uint256 amount) external { require(balanceOf[msg.sender] >= items[id].price * amount, "Insufficient balance"); _burn(msg.sender, items[id].price * amount); itemsContract.mintItem(id, msg.sender, amount); items[id].totalSupply += amount; } function allItemsAmounts() external view returns (Item[] memory) { Item[] memory itemsList = new Item[](totalItemIdAmount); for (uint256 i = 0; i < itemsList.length; i++) { itemsList[i] = items[i + 1]; } return itemsList; } function staker(address staker_) public view returns (Hypebear[] memory) { return stakers[staker_]; } function stakerWalking(address staker_) public view returns (Hypebear[] memory) { return stakersWalking[staker_]; } function updateItemsContract(address newAddress) external onlyOperator { itemsContract = IHypebItems(newAddress); } function updateBonusLevels(uint256[] memory levels, uint256[] memory percents) external onlyOperator { require(levels.length == percents.length,"Different lengths"); delete bonusLevels; for (uint256 i = 0; i < levels.length; i++) { bonusLevels.push(levels[i]); levelPercent[i + 1] = percents[i]; } } function updateRewardPeriod(uint256 newPeriod) external onlyOperator { rewardPeriod = newPeriod; } function updateRewardAmount(uint256 newAmount) external onlyOperator { rewardAmount = newAmount; } function setOperator(address _newOperator) external onlyOperator { operator = _newOperator; } function setPaused(bool _paused) external onlyOperator { paused = _paused; } function setHypebearsAddress(address _newAddress) external onlyOperator { hypebears = IERC721(_newAddress); } function setHypebearsWalkingAddress(address _newAddress) external onlyOperator { hypebearsWalking = IERC721(_newAddress); } function multipleBlacklist(address[] calldata addresses_, bool[] calldata statuses_) external onlyOperator { for (uint256 i = 0; i < addresses_.length; i++) { blackList[addresses_[i]] = statuses_[i]; } } function _transfer( address from, address to, uint256 value ) internal { require(balanceOf[from] >= value, "ERC20: transfer amount exceeds balance"); balanceOf[from] -= value; balanceOf[to] += value; emit Transfer(from, to, value); } function _mint(address to, uint256 value) internal { totalSupply += value; balanceOf[to] += value; emit Transfer(address(0), to, value); } function _burn(address from, uint256 value) internal { balanceOf[from] -= value; totalSupply -= value; emit Transfer(from, address(0), value); } event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); modifier onlyOperator() { require(msg.sender == operator, "NOT ALLOWED"); _; } modifier whenNotPaused() { require(!paused, "Pausable: paused"); _; } 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 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 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 pragma solidity ^0.8.4; interface IHypebItems { function create(uint256, string calldata) external returns(uint256); function mintItem(uint256, address, uint256) external; function setURI(string calldata, uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.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"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; contract HypeBears is ERC721("HypeBears", "HB"), ERC721Enumerable, Ownable { using ECDSA for bytes32; using SafeMath for uint256; using Strings for uint256; address public proxyRegistryAddress = 0xa5409ec958C83C3f309868babACA7c86DCB077c1; string private baseURI = 'ipfs://bafybeidkik23lcp7my72udcgdbt5h6ytpnyph3a2lw3f7tnuo6zxzbehom/'; //todo test string private blindURI; uint256 public mintLimit = 1; uint256 private constant TOTAL_NFT = 10000; uint256 public mintPrice = 0.4 ether; bool public reveal; bool public mintActive; mapping (address => bool) public whitelist; mapping (address => bool) public addressMinted; address whitelistSigner; uint256 public partnerMintAmount = 100; mapping(address => uint256) public partnerMintAvailableBy; constructor() { // whitelistSigner = _whitelistSigner; partnerMintAvailableBy[0xBC3C2C6e7BaAeB7C7EA2ad4B2Fa8681a91d47Ccd] = 50;//todo test partnerMintAvailableBy[0xBC3C2C6e7BaAeB7C7EA2ad4B2Fa8681a91d47Ccd] = 49; partnerMintAvailableBy[0x6C63244f8efFE378abD24240EEea27c732f8fc6D] = 1; } function revealNow() external onlyOwner { reveal = true; } function setMintActive(bool _isActive) external onlyOwner { mintActive = _isActive; } function setURIs(string memory _blindURI, string memory _URI) external onlyOwner { blindURI = _blindURI; baseURI = _URI; } function setWhitelistSigner(address _address) external onlyOwner { whitelistSigner = _address; } function addToWhitelist(address _newAddress) external onlyOwner { whitelist[_newAddress] = true; } function removeFromWhitelist(address _address) external onlyOwner { whitelist[_address] = false; } function addMultipleToWhitelist(address[] calldata _addresses) external onlyOwner { require(_addresses.length <= 10000, "Provide less addresses in one function call"); for (uint256 i = 0; i < _addresses.length; i++) { whitelist[_addresses[i]] = true; } } function removeMultipleFromWhitelist(address[] calldata _addresses) external onlyOwner { require(_addresses.length <= 10000, "Provide less addresses in one function call"); for (uint256 i = 0; i < _addresses.length; i++) { whitelist[_addresses[i]] = false; } } function canMint(address _address, bytes memory _signature) public view returns (bool, string memory) { if (!whitelist[_address]) { bytes32 hash = keccak256(abi.encodePacked(whitelistSigner, _address)); bytes32 messageHash = hash.toEthSignedMessageHash(); address signer = messageHash.recover(_signature); if (signer != whitelistSigner) { return (false, "Invalid signature"); } } if (addressMinted[_address]) { return (false, "Already withdrawn"); } return (true, ""); } function withdraw() public onlyOwner { uint256 balance = address(this).balance; uint256 amount1 = balance * 70 / 100; uint256 amount2 = balance - amount1; payable(0xe0F7204f04b060715f858Ba8Ae357f57E5494d18).transfer(amount1); payable(0x029c2D9EDC080A5A077f30F3bf6122e100F2aDc6).transfer(amount2); } function updateMintLimit(uint256 _newLimit) public onlyOwner { mintLimit = _newLimit; } function updateMintPrice(uint256 _newPrice) public onlyOwner { mintPrice = _newPrice; } function addPartnerMint(address account, uint256 amount) public onlyOwner { partnerMintAmount += amount; require(totalSupply().add(partnerMintAmount) <= TOTAL_NFT, "Can't add partner more than available"); partnerMintAvailableBy[account] += amount; } function mintNFT(uint256 _numOfTokens, bytes memory _signature) public payable { require(mintActive, 'Not active'); require(_numOfTokens <= mintLimit, "Can't mint more than limit per tx"); require(mintPrice.mul(_numOfTokens) <= msg.value, "Insufficient payable value"); require(totalSupply().add(_numOfTokens).add(partnerMintAmount) <= TOTAL_NFT, "Can't mint more than 10000"); (bool success, string memory reason) = canMint(msg.sender, _signature); require(success, reason); for(uint i = 0; i < _numOfTokens; i++) { _safeMint(msg.sender, totalSupply() + 1); } addressMinted[msg.sender] = true; } function partnersMintMultiple(address[] memory _to) public { uint256 amount = _to.length; require(partnerMintAmount >= amount, "Can't mint more than total available for partners"); require(partnerMintAvailableBy[msg.sender] >= amount, "Can't mint more than available for msg.sender"); for(uint256 i = 0; i < amount; i++){ _safeMint(_to[i],totalSupply() + 1); } partnerMintAmount -= amount; partnerMintAvailableBy[msg.sender] -= amount; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token"); if (!reveal) { return string(abi.encodePacked(blindURI)); } else { return string(abi.encodePacked(baseURI, _tokenId.toString())); } } function supportsInterface(bytes4 _interfaceId) public view override (ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(_interfaceId); } function _beforeTokenTransfer(address _from, address _to, uint256 _tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(_from, _to, _tokenId); } function isApprovedForAll(address owner, address operator) override public view returns(bool) { // Whitelist OpenSea proxy contract for easy trading. if (proxyRegistryAddress == operator) { return true; } return super.isApprovedForAll(owner, operator); } function updateProxy(address _proxy) external onlyOwner { proxyRegistryAddress = _proxy; } }
// SPDX-License-Identifier: MIT 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 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 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 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 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 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 pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _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 { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT 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. * * 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() { _setOwner(_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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 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)); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_hypebears","type":"address"},{"internalType":"address","name":"_hypebearsWalking","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"allItemsAmounts","outputs":[{"components":[{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct Hypeb.Item[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"blackList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bonusLevels","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"calculateBalanceBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"calculateRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"createItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"emergencyWithdrawNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllBonusesByTokenAmount","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hypebears","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"},{"internalType":"bool","name":"_walking","type":"bool"}],"name":"hypebearsOfStaker","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hypebearsWalking","outputs":[{"internalType":"contract IERC721","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"items","outputs":[{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"itemsContract","outputs":[{"internalType":"contract IHypebItems","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"levelPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses_","type":"address[]"},{"internalType":"bool[]","name":"statuses_","type":"bool[]"}],"name":"multipleBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newAddress","type":"address"}],"name":"setHypebearsAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAddress","type":"address"}],"name":"setHypebearsWalkingAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOperator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_hypebears","type":"uint256[]"},{"internalType":"bool","name":"_walking","type":"bool"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker_","type":"address"}],"name":"staker","outputs":[{"components":[{"internalType":"uint256","name":"stakedTimestamp","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct Hypeb.Hypebear[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker_","type":"address"}],"name":"stakerWalking","outputs":[{"components":[{"internalType":"uint256","name":"stakedTimestamp","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct Hypeb.Hypebear[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalItemIdAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staker","type":"address"}],"name":"totalStakedBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"bool","name":"_walking","type":"bool"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"levels","type":"uint256[]"},{"internalType":"uint256[]","name":"percents","type":"uint256[]"}],"name":"updateBonusLevels","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"updateItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddress","type":"address"}],"name":"updateItemsContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"updateRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPeriod","type":"uint256"}],"name":"updateRewardPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526001600c5562015180600d553480156200001d57600080fd5b5060405162002c9038038062002c90833981016040819052620000409162000170565b60008054336001600160a01b0319918216178255600380549091166001600160a01b0394851617815560028054610100600160a81b0319166101009490951693909302939093179091556001600b8190556009805480830182557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af9081018590558154808401835560059082018190558254938401909255600a920182905560208290527fbbc70db1b6c7afd11e79c0fb0051300458f1a3acb8ee9789d9b6b26c61ad9bc7557fbff4442b8ed600beeb8e26b1279a0f0d14c6edfaec26d968ee13c86f7d4c2ba8555260167fa856840544dc26124927add067d799967eac11be13e14d82cc281ea46fa3975955620001a7565b80516001600160a01b03811681146200016b57600080fd5b919050565b6000806040838503121562000183578182fd5b6200018e8362000153565b91506200019e6020840162000153565b90509250929050565b612ad980620001b76000396000f3fe608060405234801561001057600080fd5b506004361061028a5760003560e01c806364ab86751161015c578063a971e842116100ce578063c9e8434611610087578063c9e8434614610614578063dd62ed3e14610627578063e46b33ea14610652578063e88dc5b71461066a578063ed6467e914610673578063f7b2a7be1461068657600080fd5b8063a971e84214610576578063b3ab15fb14610589578063b3bb22981461059c578063bdcfa1a7146105af578063bfb231d2146105b7578063c402044a1461060157600080fd5b806380b311f41161012057806380b311f41461050a57806382e4eda41461051d578063878c6dad1461053d5780638cc16f961461055057806395d89b411461028f578063a9059cbb1461056357600080fd5b806364ab86751461049c5780636cc313d8146104af5780636ddb9b6c146104cf57806370a08231146104e25780637fd52c1c1461050257600080fd5b80632ee73d41116102005780634e71d92d116101b95780634e71d92d146104205780634fd100b214610428578063570ca735146104315780635c16e15e1461045c5780635c975abb1461047c5780635df12a561461048957600080fd5b80632ee73d411461039557806330660246146103a8578063313ce567146103c85780633228337a146103d7578063449de779146103ea5780634838d165146103fd57600080fd5b80631bfb8f0c116102525780631bfb8f0c1461032157806320f3a9681461033657806323b872dd146103495780632468a72c1461035c57806327d1eef21461036f57806328441b091461038257600080fd5b806306fdde031461028f578063095ea7b3146102bf57806315c2ba14146102e257806316c38b3c146102f757806318160ddd1461030a575b600080fd5b6040805180820182526005815264242ca822a160d91b602082015290516102b691906128bd565b60405180910390f35b6102d26102cd3660046124c8565b61068f565b60405190151581526020016102b6565b6102f56102f036600461266c565b6106fb565b005b6102f5610305366004612652565b610733565b61031360015481565b6040519081526020016102b6565b610329610770565b6040516102b69190612809565b6102f561034436600461269c565b61088b565b6102d2610357366004612454565b610964565b6102f561036a36600461266c565b610a34565b6102f561037d3660046123e4565b610a63565b6102f56103903660046123e4565b610ab5565b6102f56103a336600461260f565b610b01565b6103bb6103b6366004612494565b610dc7565b6040516102b69190612855565b604051600081526020016102b6565b6102f56103e536600461255c565b610f46565b6102f56103f83660046126ed565b6111c5565b6102d261040b3660046123e4565b60116020526000908152604090205460ff1681565b6102f56112f1565b610313600e5481565b600054610444906001600160a01b031681565b6040516001600160a01b0390911681526020016102b6565b61031361046a3660046123e4565b60106020526000908152604090205481565b6002546102d29060ff1681565b61031361049736600461266c565b61137c565b6103136104aa3660046123e4565b6113fd565b6103136104bd36600461266c565b600a6020526000908152604090205481565b6102f56104dd3660046125ae565b611565565b6103136104f03660046123e4565b60056020526000908152604090205481565b6103bb611690565b6102f561051836600461270e565b611778565b61053061052b3660046123e4565b611830565b6040516102b691906127ba565b61031361054b3660046123e4565b6118b9565b600354610444906001600160a01b031681565b6102d26105713660046124c8565b6118ed565b600454610444906001600160a01b031681565b6102f56105973660046123e4565b611957565b6102f56105aa3660046123e4565b6119a3565b6102f56119ef565b6105e66105c536600461266c565b600f6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016102b6565b61053061060f3660046123e4565b611c49565b61031361062236600461266c565b611cc4565b61031361063536600461241c565b600660209081526000928352604080842090915290825290205481565b6002546104449061010090046001600160a01b031681565b610313600d5481565b6102f56106813660046124f3565b611ce5565b610313600c5481565b3360008181526006602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906106ea9086815260200190565b60405180910390a350600192915050565b6000546001600160a01b0316331461072e5760405162461bcd60e51b815260040161072590612963565b60405180910390fd5b600c55565b6000546001600160a01b0316331461075d5760405162461bcd60e51b815260040161072590612963565b6002805460ff1916911515919091179055565b60606000600e5467ffffffffffffffff81111561079d57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156107f257816020015b6107df60405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816107bb5790505b50905060005b815181101561088557600f60006108108360016129d9565b8152602001908152602001600020604051806060016040529081600082015481526020016001820154815260200160028201548152505082828151811061086757634e487b7160e01b600052603260045260246000fd5b6020026020010181905250808061087d90612a47565b9150506107f8565b50919050565b6000546001600160a01b031633146108b55760405162461bcd60e51b815260040161072590612963565b60048054604051630118fa4960e01b81526000926001600160a01b0390921691630118fa49916108eb91899189918991016129bf565b602060405180830381600087803b15801561090557600080fd5b505af1158015610919573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093d9190612684565b6000818152600f602052604090206001810196909655600290950191909155505050600e55565b60025460009060ff161561098a5760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff16156109ba5760405162461bcd60e51b81526004016107259061293a565b6001600160a01b038416600090815260066020908152604080832033845290915290205460001914610a1f576001600160a01b038416600090815260066020908152604080832033845290915281208054849290610a19908490612a30565b90915550505b610a2a848484611dc2565b5060019392505050565b6000546001600160a01b03163314610a5e5760405162461bcd60e51b815260040161072590612963565b600d55565b6000546001600160a01b03163314610a8d5760405162461bcd60e51b815260040161072590612963565b600280546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000546001600160a01b03163314610adf5760405162461bcd60e51b815260040161072590612963565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6002600b541415610b245760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff1615610b4c5760405162461bcd60e51b815260040161072590612910565b6000610b57336118b9565b1115610b6657610b6633611ee7565b600081610b7e576003546001600160a01b0316610b90565b60025461010090046001600160a01b03165b9050600082610bad57336000908152600760205260409020610bbd565b3360009081526008602052604090205b905060005b8451811015610dbb57336001600160a01b0316836001600160a01b0316636352211e878481518110610c0457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610c2a91815260200190565b60206040518083038186803b158015610c4257600080fd5b505afa158015610c56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7a9190612400565b6001600160a01b031614610cbc5760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610725565b826001600160a01b03166323b872dd3330888581518110610ced57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518463ffffffff1660e01b8152600401610d1393929190612796565b600060405180830381600087803b158015610d2d57600080fd5b505af1158015610d41573d6000803e3d6000fd5b50505050816040518060400160405280428152602001878481518110610d7757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151909152825460018181018555600094855293829020835160029092020190815591015191015580610db381612a47565b915050610bc2565b50506001600b55505050565b6060600082610ded576001600160a01b0384166000908152600760205260409020610e06565b6001600160a01b03841660009081526008602052604090205b805480602002602001604051908101604052809291908181526020016000905b82821015610e6c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610e26565b5050505090506000815167ffffffffffffffff811115610e9c57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ec5578160200160208202803683370190505b50905060005b8251811015610f3d57828181518110610ef457634e487b7160e01b600052603260045260246000fd5b602002602001015160200151828281518110610f2057634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610f3581612a47565b915050610ecb565b50949350505050565b6002600b541415610f695760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff1615610f915760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff1615610fc15760405162461bcd60e51b81526004016107259061293a565b600081610fd9576003546001600160a01b0316610feb565b60025461010090046001600160a01b03165b905060008261100857336000908152600760205260409020611018565b3360009081526008602052604090205b905060005b8481101561117e576000805b83548110156110a85787878481811061105257634e487b7160e01b600052603260045260246000fd5b9050602002013584828154811061107957634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160010154141561109657600191505b806110a081612a47565b915050611029565b50806110e25760405162461bcd60e51b81526020600482015260096024820152681393d50813d5d3915160ba1b6044820152606401610725565b836001600160a01b03166323b872dd30338a8a8781811061111357634e487b7160e01b600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b815260040161113893929190612796565b600060405180830381600087803b15801561115257600080fd5b505af1158015611166573d6000803e3d6000fd5b5050505050808061117690612a47565b91505061101d565b5061118833611ee7565b610dbb81868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611f1a92505050565b6000828152600f60205260409020600201546111e2908290612a11565b3360009081526005602052604090205410156112375760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610725565b6000828152600f602052604090206002015461125f90339061125a908490612a11565b61206f565b60048054604051631dd69ba160e01b8152918201849052336024830152604482018390526001600160a01b031690631dd69ba190606401600060405180830381600087803b1580156112b057600080fd5b505af11580156112c4573d6000803e3d6000fd5b5050506000838152600f6020526040812080548493509091906112e89084906129d9565b90915550505050565b6002600b5414156113145760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff161561133c5760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff161561136c5760405162461bcd60e51b81526004016107259061293a565b61137533611ee7565b6001600b55565b6000805b6009548110156113e457600981815481106113ab57634e487b7160e01b600052603260045260246000fd5b90600052602060002001548310156113d2576000908152600a602052604090205492915050565b806113dc81612a47565b915050611380565b50506009546000908152600a6020526040902054919050565b6001600160a01b03811660009081526007602090815260408083208054825181850281018501909352808352849361149f93929190859084015b8282101561147d57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611437565b505050506001600160a01b0385166000908152601060205260409020546120fb565b6114a990826129d9565b6001600160a01b0384166000908152600860209081526040808320805482518185028101850190935280835294955061152694919390928401821561147d57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611437565b61153090826129d9565b90506064611540610497856118b9565b61154a9083612a11565b61155491906129f1565b61155e90826129d9565b9392505050565b6000546001600160a01b0316331461158f5760405162461bcd60e51b815260040161072590612963565b80518251146115d45760405162461bcd60e51b8152602060048201526011602482015270446966666572656e74206c656e6774687360781b6044820152606401610725565b6115e060096000612231565b60005b825181101561168b57600983828151811061160e57634e487b7160e01b600052603260045260246000fd5b60209081029190910181015182546001810184556000938452919092200155815182908290811061164f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600a600083600161166891906129d9565b81526020810191909152604001600020558061168381612a47565b9150506115e3565b505050565b600980546060916000916116a690600190612a30565b815481106116c457634e487b7160e01b600052603260045260246000fd5b906000526020600020015467ffffffffffffffff8111156116f557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561171e578160200160208202803683370190505b50905060005b81518110156108855761173b6104978260016129d9565b82828151811061175b57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061177081612a47565b915050611724565b6000546001600160a01b031633146117a25760405162461bcd60e51b815260040161072590612963565b6000858152600f6020526040902060018101859055600201839055801561182957600480546040516367db3b8f60e01b81526001600160a01b03909116916367db3b8f916117f691869186918b9101612899565b600060405180830381600087803b15801561181057600080fd5b505af1158015611824573d6000803e3d6000fd5b505050505b5050505050565b6001600160a01b0381166000908152600760209081526040808320805482518185028101850190935280835260609492939192909184015b828210156118ae57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611868565b505050509050919050565b6001600160a01b03811660009081526008602090815260408083205460079092528220546118e791906129d9565b92915050565b60025460009060ff16156119135760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff16156119435760405162461bcd60e51b81526004016107259061293a565b61194e338484611dc2565b50600192915050565b6000546001600160a01b031633146119815760405162461bcd60e51b815260040161072590612963565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146119cd5760405162461bcd60e51b815260040161072590612963565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6002600b541415611a125760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff1615611a3a5760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff1615611a6a5760405162461bcd60e51b81526004016107259061293a565b6002543360009081526008602052604081206101009092046001600160a01b031691905b8154811015611b3d57826001600160a01b03166323b872dd3033858581548110611ac857634e487b7160e01b600052603260045260246000fd5b9060005260206000209060020201600101546040518463ffffffff1660e01b8152600401611af893929190612796565b600060405180830381600087803b158015611b1257600080fd5b505af1158015611b26573d6000803e3d6000fd5b505050508080611b3590612a47565b915050611a8e565b50336000908152600860205260408120611b5691612252565b6003543360009081526007602052604081206001600160a01b0390921691905b8154811015611c2557826001600160a01b03166323b872dd3033858581548110611bb057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060020201600101546040518463ffffffff1660e01b8152600401611be093929190612796565b600060405180830381600087803b158015611bfa57600080fd5b505af1158015611c0e573d6000803e3d6000fd5b505050508080611c1d90612a47565b915050611b76565b50336000908152600760205260408120611c3e91612252565b50506001600b555050565b6001600160a01b03811660009081526008602090815260408083208054825181850281018501909352808352606094929391929091840182156118ae57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611868565b60098181548110611cd457600080fd5b600091825260209091200154905081565b6000546001600160a01b03163314611d0f5760405162461bcd60e51b815260040161072590612963565b60005b8381101561182957828282818110611d3a57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611d4f9190612652565b60116000878785818110611d7357634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611d8891906123e4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611dba81612a47565b915050611d12565b6001600160a01b038316600090815260056020526040902054811115611e395760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610725565b6001600160a01b03831660009081526005602052604081208054839290611e61908490612a30565b90915550506001600160a01b03821660009081526005602052604081208054839290611e8e9084906129d9565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611eda91815260200190565b60405180910390a3505050565b6000611ef2826113fd565b90508015611f1657336000908152601060205260409020429055611f16828261216a565b5050565b60005b815181101561168b5760005b835481101561205c57838181548110611f5257634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160010154838381518110611f8457634e487b7160e01b600052603260045260246000fd5b6020026020010151141561204a5783548490611fa290600190612a30565b81548110611fc057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060020201848281548110611fee57634e487b7160e01b600052603260045260246000fd5b600091825260209091208254600290920201908155600191820154910155835484908061202b57634e487b7160e01b600052603160045260246000fd5b6000828152602081206002600019909301928302018181556001015590555b8061205481612a47565b915050611f29565b508061206781612a47565b915050611f1d565b6001600160a01b03821660009081526005602052604081208054839290612097908490612a30565b9250508190555080600160008282546120b09190612a30565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b81516000908190815b81811015612160576121428587838151811061213057634e487b7160e01b600052603260045260246000fd5b602002602001015160000151426121ec565b61214c90846129d9565b92508061215881612a47565b915050612104565b5090949350505050565b806001600082825461217c91906129d9565b90915550506001600160a01b038216600090815260056020526040812080548392906121a99084906129d9565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016120ef565b60008284106121fb57836121fd565b825b9350600061220b8584612a30565b9050600d54600c548261221e9190612a11565b61222891906129f1565b95945050505050565b508054600082559060005260206000209081019061224f9190612273565b50565b508054600082556002029060005260206000209081019061224f919061228c565b5b808211156122885760008155600101612274565b5090565b5b80821115612288576000808255600182015560020161228d565b60008083601f8401126122b8578081fd5b50813567ffffffffffffffff8111156122cf578182fd5b6020830191508360208260051b85010111156122ea57600080fd5b9250929050565b600082601f830112612301578081fd5b8135602067ffffffffffffffff8083111561231e5761231e612a78565b8260051b604051601f19603f8301168101818110848211171561234357612343612a78565b60405284815283810192508684018288018501891015612361578687fd5b8692505b85831015612383578035845292840192600192909201918401612365565b50979650505050505050565b8035801515811461239f57600080fd5b919050565b60008083601f8401126123b5578182fd5b50813567ffffffffffffffff8111156123cc578182fd5b6020830191508360208285010111156122ea57600080fd5b6000602082840312156123f5578081fd5b813561155e81612a8e565b600060208284031215612411578081fd5b815161155e81612a8e565b6000806040838503121561242e578081fd5b823561243981612a8e565b9150602083013561244981612a8e565b809150509250929050565b600080600060608486031215612468578081fd5b833561247381612a8e565b9250602084013561248381612a8e565b929592945050506040919091013590565b600080604083850312156124a6578182fd5b82356124b181612a8e565b91506124bf6020840161238f565b90509250929050565b600080604083850312156124da578182fd5b82356124e581612a8e565b946020939093013593505050565b60008060008060408587031215612508578081fd5b843567ffffffffffffffff8082111561251f578283fd5b61252b888389016122a7565b90965094506020870135915080821115612543578283fd5b50612550878288016122a7565b95989497509550505050565b600080600060408486031215612570578283fd5b833567ffffffffffffffff811115612586578384fd5b612592868287016122a7565b90945092506125a590506020850161238f565b90509250925092565b600080604083850312156125c0578182fd5b823567ffffffffffffffff808211156125d7578384fd5b6125e3868387016122f1565b935060208501359150808211156125f8578283fd5b50612605858286016122f1565b9150509250929050565b60008060408385031215612621578182fd5b823567ffffffffffffffff811115612637578283fd5b612643858286016122f1565b9250506124bf6020840161238f565b600060208284031215612663578081fd5b61155e8261238f565b60006020828403121561267d578081fd5b5035919050565b600060208284031215612695578081fd5b5051919050565b600080600080606085870312156126b1578182fd5b84359350602085013567ffffffffffffffff8111156126ce578283fd5b6126da878288016123a4565b9598909750949560400135949350505050565b600080604083850312156126ff578182fd5b50508035926020909101359150565b600080600080600060808688031215612725578283fd5b853594506020860135935060408601359250606086013567ffffffffffffffff811115612750578182fd5b61275c888289016123a4565b969995985093965092949392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825282518282018190526000919060409081850190868401855b828110156127fc578151805185528601518685015292840192908501906001016127d7565b5091979650505050505050565b602080825282518282018190526000919060409081850190868401855b828110156127fc5781518051855286810151878601528501518585015260609093019290850190600101612826565b6020808252825182820181905260009190848201906040850190845b8181101561288d57835183529284019291840191600101612871565b50909695505050505050565b6040815260006128ad60408301858761276d565b9050826020830152949350505050565b6000602080835283518082850152825b818110156128e9578581018301518582016040015282016128cd565b818111156128fa5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600f908201526e1059191c995cdcc8109b1bd8dad959608a1b604082015260600190565b6020808252600b908201526a1393d50810531313d5d15160aa1b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b83815260406020820152600061222860408301848661276d565b600082198211156129ec576129ec612a62565b500190565b600082612a0c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612a2b57612a2b612a62565b500290565b600082821015612a4257612a42612a62565b500390565b6000600019821415612a5b57612a5b612a62565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461224f57600080fdfea2646970667358221220de76c3293111cad12b1a8084fc3d97affcd9ed86d989fb413018f91cd41702a664736f6c6343000804003300000000000000000000000014e0a1f310e2b7e321c91f58847e98b8c802f6ef00000000000000000000000086946a4a5d1a2a89bf5dee6038382b58ab694f49
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061028a5760003560e01c806364ab86751161015c578063a971e842116100ce578063c9e8434611610087578063c9e8434614610614578063dd62ed3e14610627578063e46b33ea14610652578063e88dc5b71461066a578063ed6467e914610673578063f7b2a7be1461068657600080fd5b8063a971e84214610576578063b3ab15fb14610589578063b3bb22981461059c578063bdcfa1a7146105af578063bfb231d2146105b7578063c402044a1461060157600080fd5b806380b311f41161012057806380b311f41461050a57806382e4eda41461051d578063878c6dad1461053d5780638cc16f961461055057806395d89b411461028f578063a9059cbb1461056357600080fd5b806364ab86751461049c5780636cc313d8146104af5780636ddb9b6c146104cf57806370a08231146104e25780637fd52c1c1461050257600080fd5b80632ee73d41116102005780634e71d92d116101b95780634e71d92d146104205780634fd100b214610428578063570ca735146104315780635c16e15e1461045c5780635c975abb1461047c5780635df12a561461048957600080fd5b80632ee73d411461039557806330660246146103a8578063313ce567146103c85780633228337a146103d7578063449de779146103ea5780634838d165146103fd57600080fd5b80631bfb8f0c116102525780631bfb8f0c1461032157806320f3a9681461033657806323b872dd146103495780632468a72c1461035c57806327d1eef21461036f57806328441b091461038257600080fd5b806306fdde031461028f578063095ea7b3146102bf57806315c2ba14146102e257806316c38b3c146102f757806318160ddd1461030a575b600080fd5b6040805180820182526005815264242ca822a160d91b602082015290516102b691906128bd565b60405180910390f35b6102d26102cd3660046124c8565b61068f565b60405190151581526020016102b6565b6102f56102f036600461266c565b6106fb565b005b6102f5610305366004612652565b610733565b61031360015481565b6040519081526020016102b6565b610329610770565b6040516102b69190612809565b6102f561034436600461269c565b61088b565b6102d2610357366004612454565b610964565b6102f561036a36600461266c565b610a34565b6102f561037d3660046123e4565b610a63565b6102f56103903660046123e4565b610ab5565b6102f56103a336600461260f565b610b01565b6103bb6103b6366004612494565b610dc7565b6040516102b69190612855565b604051600081526020016102b6565b6102f56103e536600461255c565b610f46565b6102f56103f83660046126ed565b6111c5565b6102d261040b3660046123e4565b60116020526000908152604090205460ff1681565b6102f56112f1565b610313600e5481565b600054610444906001600160a01b031681565b6040516001600160a01b0390911681526020016102b6565b61031361046a3660046123e4565b60106020526000908152604090205481565b6002546102d29060ff1681565b61031361049736600461266c565b61137c565b6103136104aa3660046123e4565b6113fd565b6103136104bd36600461266c565b600a6020526000908152604090205481565b6102f56104dd3660046125ae565b611565565b6103136104f03660046123e4565b60056020526000908152604090205481565b6103bb611690565b6102f561051836600461270e565b611778565b61053061052b3660046123e4565b611830565b6040516102b691906127ba565b61031361054b3660046123e4565b6118b9565b600354610444906001600160a01b031681565b6102d26105713660046124c8565b6118ed565b600454610444906001600160a01b031681565b6102f56105973660046123e4565b611957565b6102f56105aa3660046123e4565b6119a3565b6102f56119ef565b6105e66105c536600461266c565b600f6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060016102b6565b61053061060f3660046123e4565b611c49565b61031361062236600461266c565b611cc4565b61031361063536600461241c565b600660209081526000928352604080842090915290825290205481565b6002546104449061010090046001600160a01b031681565b610313600d5481565b6102f56106813660046124f3565b611ce5565b610313600c5481565b3360008181526006602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906106ea9086815260200190565b60405180910390a350600192915050565b6000546001600160a01b0316331461072e5760405162461bcd60e51b815260040161072590612963565b60405180910390fd5b600c55565b6000546001600160a01b0316331461075d5760405162461bcd60e51b815260040161072590612963565b6002805460ff1916911515919091179055565b60606000600e5467ffffffffffffffff81111561079d57634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156107f257816020015b6107df60405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816107bb5790505b50905060005b815181101561088557600f60006108108360016129d9565b8152602001908152602001600020604051806060016040529081600082015481526020016001820154815260200160028201548152505082828151811061086757634e487b7160e01b600052603260045260246000fd5b6020026020010181905250808061087d90612a47565b9150506107f8565b50919050565b6000546001600160a01b031633146108b55760405162461bcd60e51b815260040161072590612963565b60048054604051630118fa4960e01b81526000926001600160a01b0390921691630118fa49916108eb91899189918991016129bf565b602060405180830381600087803b15801561090557600080fd5b505af1158015610919573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093d9190612684565b6000818152600f602052604090206001810196909655600290950191909155505050600e55565b60025460009060ff161561098a5760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff16156109ba5760405162461bcd60e51b81526004016107259061293a565b6001600160a01b038416600090815260066020908152604080832033845290915290205460001914610a1f576001600160a01b038416600090815260066020908152604080832033845290915281208054849290610a19908490612a30565b90915550505b610a2a848484611dc2565b5060019392505050565b6000546001600160a01b03163314610a5e5760405162461bcd60e51b815260040161072590612963565b600d55565b6000546001600160a01b03163314610a8d5760405162461bcd60e51b815260040161072590612963565b600280546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000546001600160a01b03163314610adf5760405162461bcd60e51b815260040161072590612963565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6002600b541415610b245760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff1615610b4c5760405162461bcd60e51b815260040161072590612910565b6000610b57336118b9565b1115610b6657610b6633611ee7565b600081610b7e576003546001600160a01b0316610b90565b60025461010090046001600160a01b03165b9050600082610bad57336000908152600760205260409020610bbd565b3360009081526008602052604090205b905060005b8451811015610dbb57336001600160a01b0316836001600160a01b0316636352211e878481518110610c0457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610c2a91815260200190565b60206040518083038186803b158015610c4257600080fd5b505afa158015610c56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7a9190612400565b6001600160a01b031614610cbc5760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610725565b826001600160a01b03166323b872dd3330888581518110610ced57634e487b7160e01b600052603260045260246000fd5b60200260200101516040518463ffffffff1660e01b8152600401610d1393929190612796565b600060405180830381600087803b158015610d2d57600080fd5b505af1158015610d41573d6000803e3d6000fd5b50505050816040518060400160405280428152602001878481518110610d7757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151909152825460018181018555600094855293829020835160029092020190815591015191015580610db381612a47565b915050610bc2565b50506001600b55505050565b6060600082610ded576001600160a01b0384166000908152600760205260409020610e06565b6001600160a01b03841660009081526008602052604090205b805480602002602001604051908101604052809291908181526020016000905b82821015610e6c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610e26565b5050505090506000815167ffffffffffffffff811115610e9c57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610ec5578160200160208202803683370190505b50905060005b8251811015610f3d57828181518110610ef457634e487b7160e01b600052603260045260246000fd5b602002602001015160200151828281518110610f2057634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610f3581612a47565b915050610ecb565b50949350505050565b6002600b541415610f695760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff1615610f915760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff1615610fc15760405162461bcd60e51b81526004016107259061293a565b600081610fd9576003546001600160a01b0316610feb565b60025461010090046001600160a01b03165b905060008261100857336000908152600760205260409020611018565b3360009081526008602052604090205b905060005b8481101561117e576000805b83548110156110a85787878481811061105257634e487b7160e01b600052603260045260246000fd5b9050602002013584828154811061107957634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160010154141561109657600191505b806110a081612a47565b915050611029565b50806110e25760405162461bcd60e51b81526020600482015260096024820152681393d50813d5d3915160ba1b6044820152606401610725565b836001600160a01b03166323b872dd30338a8a8781811061111357634e487b7160e01b600052603260045260246000fd5b905060200201356040518463ffffffff1660e01b815260040161113893929190612796565b600060405180830381600087803b15801561115257600080fd5b505af1158015611166573d6000803e3d6000fd5b5050505050808061117690612a47565b91505061101d565b5061118833611ee7565b610dbb81868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611f1a92505050565b6000828152600f60205260409020600201546111e2908290612a11565b3360009081526005602052604090205410156112375760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610725565b6000828152600f602052604090206002015461125f90339061125a908490612a11565b61206f565b60048054604051631dd69ba160e01b8152918201849052336024830152604482018390526001600160a01b031690631dd69ba190606401600060405180830381600087803b1580156112b057600080fd5b505af11580156112c4573d6000803e3d6000fd5b5050506000838152600f6020526040812080548493509091906112e89084906129d9565b90915550505050565b6002600b5414156113145760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff161561133c5760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff161561136c5760405162461bcd60e51b81526004016107259061293a565b61137533611ee7565b6001600b55565b6000805b6009548110156113e457600981815481106113ab57634e487b7160e01b600052603260045260246000fd5b90600052602060002001548310156113d2576000908152600a602052604090205492915050565b806113dc81612a47565b915050611380565b50506009546000908152600a6020526040902054919050565b6001600160a01b03811660009081526007602090815260408083208054825181850281018501909352808352849361149f93929190859084015b8282101561147d57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611437565b505050506001600160a01b0385166000908152601060205260409020546120fb565b6114a990826129d9565b6001600160a01b0384166000908152600860209081526040808320805482518185028101850190935280835294955061152694919390928401821561147d57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611437565b61153090826129d9565b90506064611540610497856118b9565b61154a9083612a11565b61155491906129f1565b61155e90826129d9565b9392505050565b6000546001600160a01b0316331461158f5760405162461bcd60e51b815260040161072590612963565b80518251146115d45760405162461bcd60e51b8152602060048201526011602482015270446966666572656e74206c656e6774687360781b6044820152606401610725565b6115e060096000612231565b60005b825181101561168b57600983828151811061160e57634e487b7160e01b600052603260045260246000fd5b60209081029190910181015182546001810184556000938452919092200155815182908290811061164f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600a600083600161166891906129d9565b81526020810191909152604001600020558061168381612a47565b9150506115e3565b505050565b600980546060916000916116a690600190612a30565b815481106116c457634e487b7160e01b600052603260045260246000fd5b906000526020600020015467ffffffffffffffff8111156116f557634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561171e578160200160208202803683370190505b50905060005b81518110156108855761173b6104978260016129d9565b82828151811061175b57634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061177081612a47565b915050611724565b6000546001600160a01b031633146117a25760405162461bcd60e51b815260040161072590612963565b6000858152600f6020526040902060018101859055600201839055801561182957600480546040516367db3b8f60e01b81526001600160a01b03909116916367db3b8f916117f691869186918b9101612899565b600060405180830381600087803b15801561181057600080fd5b505af1158015611824573d6000803e3d6000fd5b505050505b5050505050565b6001600160a01b0381166000908152600760209081526040808320805482518185028101850190935280835260609492939192909184015b828210156118ae57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611868565b505050509050919050565b6001600160a01b03811660009081526008602090815260408083205460079092528220546118e791906129d9565b92915050565b60025460009060ff16156119135760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff16156119435760405162461bcd60e51b81526004016107259061293a565b61194e338484611dc2565b50600192915050565b6000546001600160a01b031633146119815760405162461bcd60e51b815260040161072590612963565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146119cd5760405162461bcd60e51b815260040161072590612963565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6002600b541415611a125760405162461bcd60e51b815260040161072590612988565b6002600b8190555460ff1615611a3a5760405162461bcd60e51b815260040161072590612910565b3360009081526011602052604090205460ff1615611a6a5760405162461bcd60e51b81526004016107259061293a565b6002543360009081526008602052604081206101009092046001600160a01b031691905b8154811015611b3d57826001600160a01b03166323b872dd3033858581548110611ac857634e487b7160e01b600052603260045260246000fd5b9060005260206000209060020201600101546040518463ffffffff1660e01b8152600401611af893929190612796565b600060405180830381600087803b158015611b1257600080fd5b505af1158015611b26573d6000803e3d6000fd5b505050508080611b3590612a47565b915050611a8e565b50336000908152600860205260408120611b5691612252565b6003543360009081526007602052604081206001600160a01b0390921691905b8154811015611c2557826001600160a01b03166323b872dd3033858581548110611bb057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060020201600101546040518463ffffffff1660e01b8152600401611be093929190612796565b600060405180830381600087803b158015611bfa57600080fd5b505af1158015611c0e573d6000803e3d6000fd5b505050508080611c1d90612a47565b915050611b76565b50336000908152600760205260408120611c3e91612252565b50506001600b555050565b6001600160a01b03811660009081526008602090815260408083208054825181850281018501909352808352606094929391929091840182156118ae57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611868565b60098181548110611cd457600080fd5b600091825260209091200154905081565b6000546001600160a01b03163314611d0f5760405162461bcd60e51b815260040161072590612963565b60005b8381101561182957828282818110611d3a57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611d4f9190612652565b60116000878785818110611d7357634e487b7160e01b600052603260045260246000fd5b9050602002016020810190611d8891906123e4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611dba81612a47565b915050611d12565b6001600160a01b038316600090815260056020526040902054811115611e395760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610725565b6001600160a01b03831660009081526005602052604081208054839290611e61908490612a30565b90915550506001600160a01b03821660009081526005602052604081208054839290611e8e9084906129d9565b92505081905550816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611eda91815260200190565b60405180910390a3505050565b6000611ef2826113fd565b90508015611f1657336000908152601060205260409020429055611f16828261216a565b5050565b60005b815181101561168b5760005b835481101561205c57838181548110611f5257634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160010154838381518110611f8457634e487b7160e01b600052603260045260246000fd5b6020026020010151141561204a5783548490611fa290600190612a30565b81548110611fc057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060020201848281548110611fee57634e487b7160e01b600052603260045260246000fd5b600091825260209091208254600290920201908155600191820154910155835484908061202b57634e487b7160e01b600052603160045260246000fd5b6000828152602081206002600019909301928302018181556001015590555b8061205481612a47565b915050611f29565b508061206781612a47565b915050611f1d565b6001600160a01b03821660009081526005602052604081208054839290612097908490612a30565b9250508190555080600160008282546120b09190612a30565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b81516000908190815b81811015612160576121428587838151811061213057634e487b7160e01b600052603260045260246000fd5b602002602001015160000151426121ec565b61214c90846129d9565b92508061215881612a47565b915050612104565b5090949350505050565b806001600082825461217c91906129d9565b90915550506001600160a01b038216600090815260056020526040812080548392906121a99084906129d9565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016120ef565b60008284106121fb57836121fd565b825b9350600061220b8584612a30565b9050600d54600c548261221e9190612a11565b61222891906129f1565b95945050505050565b508054600082559060005260206000209081019061224f9190612273565b50565b508054600082556002029060005260206000209081019061224f919061228c565b5b808211156122885760008155600101612274565b5090565b5b80821115612288576000808255600182015560020161228d565b60008083601f8401126122b8578081fd5b50813567ffffffffffffffff8111156122cf578182fd5b6020830191508360208260051b85010111156122ea57600080fd5b9250929050565b600082601f830112612301578081fd5b8135602067ffffffffffffffff8083111561231e5761231e612a78565b8260051b604051601f19603f8301168101818110848211171561234357612343612a78565b60405284815283810192508684018288018501891015612361578687fd5b8692505b85831015612383578035845292840192600192909201918401612365565b50979650505050505050565b8035801515811461239f57600080fd5b919050565b60008083601f8401126123b5578182fd5b50813567ffffffffffffffff8111156123cc578182fd5b6020830191508360208285010111156122ea57600080fd5b6000602082840312156123f5578081fd5b813561155e81612a8e565b600060208284031215612411578081fd5b815161155e81612a8e565b6000806040838503121561242e578081fd5b823561243981612a8e565b9150602083013561244981612a8e565b809150509250929050565b600080600060608486031215612468578081fd5b833561247381612a8e565b9250602084013561248381612a8e565b929592945050506040919091013590565b600080604083850312156124a6578182fd5b82356124b181612a8e565b91506124bf6020840161238f565b90509250929050565b600080604083850312156124da578182fd5b82356124e581612a8e565b946020939093013593505050565b60008060008060408587031215612508578081fd5b843567ffffffffffffffff8082111561251f578283fd5b61252b888389016122a7565b90965094506020870135915080821115612543578283fd5b50612550878288016122a7565b95989497509550505050565b600080600060408486031215612570578283fd5b833567ffffffffffffffff811115612586578384fd5b612592868287016122a7565b90945092506125a590506020850161238f565b90509250925092565b600080604083850312156125c0578182fd5b823567ffffffffffffffff808211156125d7578384fd5b6125e3868387016122f1565b935060208501359150808211156125f8578283fd5b50612605858286016122f1565b9150509250929050565b60008060408385031215612621578182fd5b823567ffffffffffffffff811115612637578283fd5b612643858286016122f1565b9250506124bf6020840161238f565b600060208284031215612663578081fd5b61155e8261238f565b60006020828403121561267d578081fd5b5035919050565b600060208284031215612695578081fd5b5051919050565b600080600080606085870312156126b1578182fd5b84359350602085013567ffffffffffffffff8111156126ce578283fd5b6126da878288016123a4565b9598909750949560400135949350505050565b600080604083850312156126ff578182fd5b50508035926020909101359150565b600080600080600060808688031215612725578283fd5b853594506020860135935060408601359250606086013567ffffffffffffffff811115612750578182fd5b61275c888289016123a4565b969995985093965092949392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b602080825282518282018190526000919060409081850190868401855b828110156127fc578151805185528601518685015292840192908501906001016127d7565b5091979650505050505050565b602080825282518282018190526000919060409081850190868401855b828110156127fc5781518051855286810151878601528501518585015260609093019290850190600101612826565b6020808252825182820181905260009190848201906040850190845b8181101561288d57835183529284019291840191600101612871565b50909695505050505050565b6040815260006128ad60408301858761276d565b9050826020830152949350505050565b6000602080835283518082850152825b818110156128e9578581018301518582016040015282016128cd565b818111156128fa5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252600f908201526e1059191c995cdcc8109b1bd8dad959608a1b604082015260600190565b6020808252600b908201526a1393d50810531313d5d15160aa1b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b83815260406020820152600061222860408301848661276d565b600082198211156129ec576129ec612a62565b500190565b600082612a0c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612a2b57612a2b612a62565b500290565b600082821015612a4257612a42612a62565b500390565b6000600019821415612a5b57612a5b612a62565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461224f57600080fdfea2646970667358221220de76c3293111cad12b1a8084fc3d97affcd9ed86d989fb413018f91cd41702a664736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000014e0a1f310e2b7e321c91f58847e98b8c802f6ef00000000000000000000000086946a4a5d1a2a89bf5dee6038382b58ab694f49
-----Decoded View---------------
Arg [0] : _hypebears (address): 0x14e0a1F310E2B7E321c91f58847e98b8C802f6eF
Arg [1] : _hypebearsWalking (address): 0x86946A4a5d1a2A89Bf5deE6038382B58Ab694f49
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000014e0a1f310e2b7e321c91f58847e98b8c802f6ef
Arg [1] : 00000000000000000000000086946a4a5d1a2a89bf5dee6038382b58ab694f49
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.