Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19526046 | 186 days ago | IN | 0 ETH | 0.27765449 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
NFTBoxesBoxUpgradeableV2
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.2; import "IVendingMachine.sol"; import "SubscriptionService.sol"; import "BoxJsonParser.sol"; import "DefaultOperatorFiltererUpgradeable.sol"; import "ERC721Upgradeable.sol"; import "ERC2981Upgradeable.sol"; import "OwnableUpgradeable.sol"; contract NFTBoxesBoxUpgradeableV2 is ERC721Upgradeable, OwnableUpgradeable, ERC2981Upgradeable { struct BoxMould{ uint8 live; // bool uint8 shared; // bool uint128 maxEdition; uint128 maxBuyAmount; uint128 currentEditionCount; uint128 boughtCount; uint256 price; address payable[] artists; uint256[] shares; string name; string series; string theme; string ipfsHash; string arweaveHash; } struct Box { uint256 mouldId; uint256 edition; } uint256 totalSupply; IVendingMachine public vendingMachine; SubscriptionService public subService; uint256 public boxMouldCount; uint256 constant public TOTAL_SHARES = 1000; mapping(uint256 => BoxMould) public boxMoulds; mapping(uint256 => Box) public boxes; mapping(uint256 => bool) public lockedBoxes; mapping(uint256 => mapping(address => uint256)) boxBoughtMapping; mapping(uint256 => uint256) subDistroTracker; mapping(uint256 => uint256) public boughtMP; mapping(address => uint256) public teamShare; address payable[] public team; address public parser; mapping(address => bool) public authorisedCaller; event BoxMouldCreated(uint256 id); event BoxBought(uint256 indexed boxMould, uint256 boxEdition, uint256 tokenId); event BatchDeployed(uint256 indexed boxMould, uint256 batchSize); function initialize(address _service, address _parser) public initializer { __Ownable_init(); __ERC721_init("NFTBox", "[BOX]"); boxMouldCount = 4; team.push(payable(0x3428B1746Dfd26C7C725913D829BE2706AA89B2e)); team.push(payable(0x4125515f4e5A0db45316bf05a7C102c13e1e5Ba1)); team.push(payable(0x8C26a91205e531E8B35Cf3315f384727B9681D75)); teamShare[address(0x3428B1746Dfd26C7C725913D829BE2706AA89B2e)] = 590; teamShare[address(0x4125515f4e5A0db45316bf05a7C102c13e1e5Ba1)] = 90; teamShare[address(0x8C26a91205e531E8B35Cf3315f384727B9681D75)] = 30; vendingMachine = IVendingMachine(0x5b8D524b10b8Ea587da49F426a76396F80b7bC84); subService = SubscriptionService(_service); parser = _parser; } function supportsInterface(bytes4 interfaceId) public view override(ERC721Upgradeable, ERC2981Upgradeable) returns (bool) { return ERC2981Upgradeable.supportsInterface(interfaceId) || ERC721Upgradeable.supportsInterface(interfaceId); } function setDefaultRoyalty(address _receiver, uint96 _feeNumerator) external onlyOwner { _setDefaultRoyalty(_receiver, _feeNumerator); } modifier authorised() { require(authorisedCaller[msg.sender] || msg.sender == owner(), "Not authorised to execute."); _; } function setSubService(address _newSub) external onlyOwner { subService = SubscriptionService(_newSub); } function setCaller(address _caller, bool _value) external onlyOwner { authorisedCaller[_caller] = _value; } function addTeamMember(address payable _member) external onlyOwner { for (uint256 i = 0; i < team.length; i++) require( _member != team[i], "members exists already"); team.push(_member); } function removeTeamMember(address payable _member) external onlyOwner { for (uint256 i = 0; i < team.length; i++) if (team[i] == _member) { delete teamShare[_member]; team[i] = team[team.length - 1]; team.pop(); } } function setTeamShare(address _member, uint _share) external onlyOwner { require(_share <= TOTAL_SHARES, "share must be below 1000"); for (uint256 i = 0; i < team.length; i++) if (team[i] == _member) teamShare[_member] = _share; } function setLockOnBox(uint256 _id, bool _lock) external authorised { require(_id <= boxMouldCount && _id > 0, "ID !exist."); lockedBoxes[_id] = _lock; } function createBoxMould( uint128 _max, uint128 _maxBuyAmount, uint256 _price, address payable[] memory _artists, uint256[] memory _shares, string memory _name, string memory _series, string memory _theme, string memory _ipfsHash, string memory _arweaveHash) external onlyOwner { require(_artists.length == _shares.length, "arrays !same len"); boxMoulds[boxMouldCount + 1] = BoxMould({ live: uint8(0), shared: uint8(0), maxEdition: _max, maxBuyAmount: _maxBuyAmount, currentEditionCount: 0, boughtCount: 0, price: _price, artists: _artists, shares: _shares, name: _name, series: _series, theme: _theme, ipfsHash: _ipfsHash, arweaveHash: _arweaveHash }); boxMouldCount++; lockedBoxes[boxMouldCount] = true; emit BoxMouldCreated(boxMouldCount); } function removeArtist(uint256 _id, address payable _artist) external onlyOwner { BoxMould storage boxMould = boxMoulds[_id]; require(_id <= boxMouldCount && _id > 0, "ID !exist"); for (uint256 i = 0; i < boxMould.artists.length; i++) { if (boxMould.artists[i] == _artist) { boxMould.artists[i] = boxMould.artists[boxMould.artists.length - 1]; boxMould.artists.pop(); boxMould.shares[i] = boxMould.shares[boxMould.shares.length - 1]; boxMould.shares.pop(); } } } function addArtists(uint256 _id, address payable _artist, uint256 _share) external onlyOwner { BoxMould storage boxMould = boxMoulds[_id]; require(_id <= boxMouldCount && _id > 0, "ID !exist"); boxMould.artists.push(_artist); boxMould.shares.push(_share); } function distributeBoxToSubHolders(uint256 _id) external onlyOwner { require(_id <= boxMouldCount && _id > 0, "ID !exist"); uint256 trackerId = subDistroTracker[_id]++; require(trackerId < 10, "Distro done"); BoxMould storage boxMould = boxMoulds[_id]; uint128 currentEdition = boxMould.currentEditionCount; address[] memory subHolders = subService.fetchValidHolders(trackerId * 50, 50); uint256 mintTracker; uint256 _totalSupply = totalSupply; for (uint256 i = 0; i < 50; i++) { address holder = subHolders[i]; if (holder != address(0)) { _buy(currentEdition, _id, mintTracker, holder, _totalSupply + mintTracker + 1); mintTracker++; } } totalSupply += mintTracker; boxMould.currentEditionCount += uint128(mintTracker); if (currentEdition + mintTracker == boxMould.maxEdition) boxMould.live = uint8(1); if (trackerId == 9) subService.pushNewBox(); } function distroBoxMP(uint256 _id, address[] calldata _users) external authorised { BoxMould storage boxMould = boxMoulds[_id]; uint128 currentEdition = boxMould.currentEditionCount; uint128 max = boxMould.maxEdition; uint128 quantity = uint128(_users.length); require(_id <= boxMouldCount && _id > 0, "ID !exist"); require(boxMould.live == 0, "!live"); require(!lockedBoxes[_id], "locked"); require(currentEdition + _users.length <= max, "!many"); uint256 _totalSupply = totalSupply; for (uint128 i = 0; i < quantity; i++) _buy(currentEdition, _id, i, _users[i], _totalSupply + i + 1); totalSupply += quantity; boxMould.currentEditionCount += quantity; boughtMP[_id] += quantity; if (currentEdition + quantity == max) boxMould.live = uint8(1); } function buyManyBoxes(uint256 _id, uint128 _quantity) external payable { BoxMould storage boxMould = boxMoulds[_id]; uint128 currentEdition = boxMould.currentEditionCount; uint128 max = boxMould.maxEdition; require(_id <= boxMouldCount && _id > 0, "ID !exist"); require(boxMould.live == 0, "!live"); require(!lockedBoxes[_id], "locked"); require(boxMould.price * _quantity == msg.value, "!price"); require(currentEdition + _quantity <= max, "!many"); require(boxBoughtMapping[_id][msg.sender] + _quantity <= boxMould.maxBuyAmount, "!buy"); uint256 _totalSupply = totalSupply; for (uint128 i = 0; i < _quantity; i++) _buy(currentEdition, _id, i, msg.sender, _totalSupply + i + 1); totalSupply += _quantity; boxMould.currentEditionCount += _quantity; boxMould.boughtCount += _quantity; boxBoughtMapping[_id][msg.sender] = boxBoughtMapping[_id][msg.sender] + _quantity; if (currentEdition + _quantity == max) boxMould.live = uint8(1); } function _buy(uint128 _currentEdition, uint256 _id, uint256 _new, address _recipient, uint256 _tokenId) internal { boxes[_tokenId] = Box(_id, _currentEdition + _new + 1); emit BoxBought(_id, _currentEdition + _new + 1, _tokenId); _mint(_recipient, _tokenId); } // close a sale if not sold out function closeBox(uint256 _id) external authorised { BoxMould storage boxMould = boxMoulds[_id]; require(_id <= boxMouldCount && _id > 0, "ID !exist."); boxMould.live = uint8(1); } function setVendingMachine(address _machine) external onlyOwner { vendingMachine = IVendingMachine(_machine); } function distributeOffchain(uint256 _id, address[][] calldata _recipients, uint256[] calldata _ids) external authorised { BoxMould memory boxMould= boxMoulds[_id]; require(boxMould.live == 1, "live"); require (_recipients[0].length == _ids.length, "bad array"); // i is batch number for (uint256 i = 0; i < _recipients.length; i++) { // j is for the index of nft ID to send for (uint256 j = 0;j < _recipients[0].length; j++) vendingMachine.NFTMachineFor(_ids[j], _recipients[i][j]); } emit BatchDeployed(_id, _recipients.length); } function distributeShares(uint256 _id) external { BoxMould storage boxMould= boxMoulds[_id]; require(_id <= boxMouldCount && _id > 0, "ID !exist."); require(boxMould.live == 1 && boxMould.shared == 0, "!distribute"); require(is100(_id), "sum != 100%."); boxMould.shared = 1; uint256 rev = uint256(boxMould.boughtCount) * boxMould.price; uint256 share; for (uint256 i = 0; i < team.length; i++) { share = rev * teamShare[team[i]] / TOTAL_SHARES; team[i].transfer(share); } for (uint256 i = 0; i < boxMould.artists.length; i++) { share = rev * boxMould.shares[i] / TOTAL_SHARES; boxMould.artists[i].transfer(share); } } function is100(uint256 _id) internal view returns(bool) { BoxMould storage boxMould= boxMoulds[_id]; uint256 total; for (uint256 i = 0; i < team.length; i++) { total = total + teamShare[team[i]]; } for (uint256 i = 0; i < boxMould.shares.length; i++) { total = total + boxMould.shares[i]; } return total == TOTAL_SHARES; } function getArtist(uint256 _id) external view returns (address payable[] memory) { return boxMoulds[_id].artists; } function getArtistShares(uint256 _id) external view returns (uint256[] memory) { return boxMoulds[_id].shares; } function getBoxMetaData(uint256 _id) external view returns (uint256 boxId, uint256 boxEdition, uint128 boxMax, string memory boxName, string memory boxSeries, string memory boxTheme, string memory boxHashIPFS, string memory boxHashArweave) { Box memory box = boxes[_id]; BoxMould memory mould = boxMoulds[box.mouldId]; return (box.mouldId, box.edition, mould.maxEdition, mould.name, mould.series, mould.theme, mould.ipfsHash, mould.arweaveHash); } function _transfer(address from, address to, uint256 tokenId) internal override { Box memory box = boxes[tokenId]; require(!lockedBoxes[box.mouldId], "Box is locked"); super._transfer(from, to, tokenId); } function tokenURI(uint256 _tokenId) public view override returns(string memory) { Box memory box = boxes[_tokenId]; require(box.mouldId > 0); BoxMould memory mould = boxMoulds[box.mouldId]; return string( abi.encodePacked( BoxJsonParser(parser).generateTokenUriPart1(box.edition, mould.series, mould.name, mould.theme), BoxJsonParser(parser).generateTokenUriPart2(box.mouldId, box.edition, mould.maxEdition, mould.series, mould.ipfsHash, mould.theme) ) ); } }
pragma solidity ^0.8.2; import "IERC1155.sol"; interface IVendingMachine is IERC1155{ function NFTMachineFor(uint256 NFTId, address _recipient) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.2; import "ERC721Enumerable.sol"; import "Ownable.sol"; import "SubJsonParser.sol"; contract SubscriptionService is ERC721Enumerable, Ownable, SubJsonParser { struct SubData { uint32 tier; uint32 start; uint32 length; } uint256 public constant MAX = 500; uint256 public maxSupply = 300; bool public paused; uint32 public counter; uint256[3] public subPrice; uint256 buyCounter; mapping(uint256 => uint256) expiredStack; uint256 expiredCounter; mapping(uint256 => SubData) public subData; mapping(address => bool) public authorisedCaller; bool public initiated; bool public buySwitch; event SubBought(address indexed buyer, uint256 indexed tokenId, uint32 tier, uint256 value); constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} function init (string memory __name, string memory __symbol) external { require(!initiated); initiated = true; paused = false; subPrice[0] = 1_950_000_000_000_000_000; subPrice[1] = 3_705_000_000_000_000_000; subPrice[2] = 5_265_000_000_000_000_000; counter = 1; _name = __name; _symbol = __symbol; _owner = msg.sender; } modifier notPaused() { require(!paused, "Paused"); _; } modifier authorised() { require(authorisedCaller[msg.sender] || msg.sender == owner(), "Not authorised to execute."); _; } modifier nonBuyable() { require(!buySwitch, "Not authorised to buy."); _; } function setCaller(address _caller, bool _value) external onlyOwner { authorisedCaller[_caller] = _value; } function fetchEth() external onlyOwner { payable(owner()).transfer(address(this).balance); } function pause() external onlyOwner { paused = true; } function unpause() external onlyOwner { paused = false; } function switchIt() external onlyOwner { buySwitch = !buySwitch; } function pushNewBox() external authorised { counter++; } function setPrice(uint256 _index, uint256 _price) external onlyOwner { subPrice[_index] = _price; } function setMaxSupply(uint256 _max) external onlyOwner { require(_max <= MAX); maxSupply = _max; } function refundSub(uint256 _tokenId) external onlyOwner { require(!isExpired(_tokenId), "Expired"); SubData memory data = subData[_tokenId]; expiredStack[expiredCounter++] = _tokenId; delete subData[_tokenId]; _burn(_tokenId); } function expireSub(uint256 _tokenId) external { require(isExpired(_tokenId), "Not expired"); expiredStack[expiredCounter++] = _tokenId; delete subData[_tokenId]; _burn(_tokenId); } function buySub(uint8 _tier) external payable { buySub(_tier, msg.sender); } function buySubOwner(uint8 _tier, address _for) public authorised { // require(_tier == 0 || _tier == 1 || _tier == 2, "Sub: Wrong sub model"); require(_tier == 0, "Sub: Wrong sub model"); require(totalSupply() < maxSupply, "No more subs of that tier to buy"); if (buyCounter < MAX) { subData[++buyCounter] = SubData(_tier, counter, _getLength(_tier)); _mint(_for, buyCounter); emit SubBought(_for, buyCounter, _tier, 1); } else { require(expiredCounter > 0, "No subs available, try next month"); uint256 id = expiredStack[--expiredCounter]; subData[id] = SubData(_tier, counter, _getLength(_tier)); _mint(_for, id); emit SubBought(_for, id, _tier, 1); } } function buySub(uint8 _tier, address _for) public payable nonBuyable { // require(_tier == 0 || _tier == 1 || _tier == 2, "Sub: Wrong sub model"); require(_tier == 0, "Sub: Wrong sub model"); require(totalSupply() < maxSupply, "No more subs of that tier to buy"); require(msg.value == subPrice[_tier], "!price"); if (buyCounter < MAX) { subData[++buyCounter] = SubData(_tier, counter, _getLength(_tier)); _mint(_for, buyCounter); emit SubBought(_for, buyCounter, _tier, msg.value); } else { require(expiredCounter > 0, "No subs available, try next month"); uint256 id = expiredStack[--expiredCounter]; subData[id] = SubData(_tier, counter, _getLength(_tier)); _mint(_for, id); emit SubBought(_for, id, _tier, msg.value); } } function isExpired(uint256 _tokenId) public view returns(bool) { SubData memory data = subData[_tokenId]; return data.start + data.length <= counter; } function _getType(uint32 _length) internal pure returns(uint256) { if (_length == 3) return 0; else if (_length == 6) return 1; if (_length == 9) return 2; return 0; } function _getLength(uint8 _type) internal pure returns(uint32) { if (_type == uint8(0)) return uint32(3); else if (_type == uint8(1)) return uint32(6); if (_type == uint8(2)) return uint32(9); return 0; } function fetchValidHolders(uint256 _start, uint256 _len) external view returns(address[] memory holders) { holders = new address[](_len); for (uint256 i = _start; i < _start + _len; i++) { if (_exists(i)) { address owner = ownerOf(i); if (!isExpired(i)) holders[i - _start] = ownerOf(i); } } } function returnSubDataOfHolder(address _holder) external view returns(SubData[] memory data) { uint256 amount = balanceOf(_holder); data = new SubData[](amount); for (uint256 i = 0; i < amount; i++) { data[i] = subData[tokenOfOwnerByIndex(_holder, i)]; } } function hasUserSub(address _holder, uint256 _tierId) external view returns(bool) { uint256 amount = balanceOf(_holder); for (uint256 i = 0; i < amount; i++) { uint256 tokenId = tokenOfOwnerByIndex(_holder, i); SubData memory data = subData[tokenId]; if (data.tier == _tierId && !isExpired(tokenId)) return true; } return false; } function _transfer(address from, address to, uint256 tokenId) internal override notPaused { super._transfer(from, to, tokenId); } function tokenURI(uint256 _tokenId) public view override returns(string memory) { SubData memory data = subData[_tokenId]; require(_exists(_tokenId)); return string( abi.encodePacked( generateTokenUriPart1(_tokenId, uint256(data.tier)), generateTokenUriPart2(_getLength(uint8(data.tier)), counter, data.start, data.length) ) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "ERC721.sol"; import "IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "IERC721.sol"; import "IERC721Receiver.sol"; import "IERC721Metadata.sol"; import "Address.sol"; import "Context.sol"; import "Strings.sol"; import "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 internal _name; // Token symbol string internal _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 overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "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`. * * 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; /** * @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 Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address internal _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.2; contract SubJsonParser { function generateTokenUriPart1(uint256 _tokenId, uint256 _tier) public pure returns(string memory) { return string( abi.encodePacked( bytes('data:application/json;utf8,{"name":"'), _getName(_tokenId, _tier), bytes('","description":"'), "NFTBox subscription that guarantees the reception of a monthly box until it expires.", bytes('","external_url":"'), _getExternalUrl() ) ); } function generateTokenUriPart2(uint256 _tier, uint256 _counter, uint256 _start, uint256 _length) public pure returns(string memory) { return string( abi.encodePacked( bytes('","attributes":['), _tierSub(_tier), _expiry(_length <= (_counter - _start) ? 0 : (_length - (_counter - _start))), bytes(',"image":"'), _getImageCache(_tier), bytes('"}') ) ); } function _getImageCache(uint256 _tier) internal pure returns(string memory) { if (_tier == 3) return string(abi.encodePacked("https://ipfs.io/ipfs/QmV3GaTzqLvGSRTAuiLQGsBUDDx4Dr7G7gxqtR8eRhudLL")); if (_tier == 6) return string(abi.encodePacked("https://ipfs.io/ipfs/QmZBtFNpbrstaKwSDzsB3uFGMeN7b5VjT93Udab2EbB2tQ")); if (_tier == 9) return string(abi.encodePacked("https://ipfs.io/ipfs/QmPCv1DEWH6pTXXVVdR3nqcavT1bzNRY5QoyR6KEzVjUkb")); return string(abi.encodePacked("")); } function _getName(uint256 _tokenId, uint256 _tier) internal pure returns(string memory) { return string(abi.encodePacked("NFTBox ", _tierName(_tier), " Subscription")); } function _tierSub(uint256 _tier) internal pure returns(string memory) { return string(abi.encodePacked(bytes('{"trait_type": "Tier","value":"'), _tierName(_tier), bytes('"},'))); } function _tierName(uint256 _tier) internal pure returns(string memory) { if (_tier == 0) return string(abi.encodePacked("Bronze")); if (_tier == 1) return string(abi.encodePacked("Silver")); if (_tier == 2) return string(abi.encodePacked("Gold")); if (_tier == 3) return string(abi.encodePacked("Bronze")); if (_tier == 6) return string(abi.encodePacked("Silver")); if (_tier == 9) return string(abi.encodePacked("Gold")); } function _expiry(uint256 _expirationCount) internal pure returns(string memory) { return string(abi.encodePacked(bytes('{"trait_type": "Boxes left","value":"'), _uint2str(_expirationCount), bytes('"}]'))); } function _getImageCache(string memory _hash) internal pure returns(string memory) { return string(abi.encodePacked("https://ipfs.io/ipfs/", _hash)); } function _getExternalUrl() internal pure returns(string memory) { return string(abi.encodePacked("https://www.nftboxes.io/")); } function _uint2str(uint _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len; while (_i != 0) { k = k-1; uint8 temp = (48 + uint8(_i - _i / 10 * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; _i /= 10; } return string(bstr); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.2; contract BoxJsonParser { function generateTokenUriPart1(uint256 _tokenId, string memory _series, string memory _name, string memory _theme) public pure returns(string memory) { return string( abi.encodePacked( bytes('data:application/json;utf8,{"name":"'), _getName(_name, _tokenId), bytes('","description":"'), "NFTBoxes are a curated monthly box of NFTs on the newest gold standard of NFT technology." ) ); } function generateTokenUriPart2(uint256 _boxId, uint256 _tokenId, uint256 _max, string memory _series, string memory _hash, string memory _theme) public pure returns(string memory) { return string( abi.encodePacked( bytes('","attributes":['), _traitBoxId(_boxId), _traitBoxSeries(_series), _traitBoxTheme(_theme), _traitBoxEdition(_tokenId, _max), bytes(',"image":"'), _getImageCache(_hash),bytes('"}') ) ); } function _traitBoxId(uint256 _boxId) internal pure returns(string memory) { return string(abi.encodePacked(bytes('{"trait_type": "box id","value":"'), _uint2str(_boxId), bytes('"},'))); } function _traitBoxSeries(string memory _series) internal pure returns(string memory) { return string(abi.encodePacked(bytes('{"trait_type": "box series","value":"'), _series, bytes('"},'))); } function _traitBoxTheme(string memory _theme) internal pure returns(string memory) { return string(abi.encodePacked(bytes('{"trait_type": "box theme","value":"'), _theme, bytes('"},'))); } function _traitBoxEdition(uint256 _tokenId, uint256 _maxEdition) internal pure returns(string memory) { return string(abi.encodePacked(bytes('{"trait_type": "box edition","value":"'), _uint2str(_tokenId), bytes(' of '), _uint2str(_maxEdition), bytes('"}]'))); } function _getName(string memory _name, uint256 _tokenId) internal pure returns(string memory) { return string(abi.encodePacked(_name, " #", _uint2str(_tokenId))); } function _getImageCache(string memory _hash) internal pure returns(string memory) { return string(abi.encodePacked("https://ipfs.io/ipfs/", _hash)); } function _uint2str(uint _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len; while (_i != 0) { k = k-1; uint8 temp = (48 + uint8(_i - _i / 10 * 10)); bytes1 b1 = bytes1(temp); bstr[k] = b1; _i /= 10; } return string(bstr); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFiltererUpgradeable} from "OperatorFiltererUpgradeable.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "Constants.sol"; /** * @title DefaultOperatorFiltererUpgradeable * @notice Inherits from OperatorFiltererUpgradeable and automatically subscribes to the default OpenSea subscription * when the init function is called. */ abstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable { /// @dev The upgradeable initialize function that should be called when the contract is being deployed. function __DefaultOperatorFilterer_init() internal onlyInitializing { OperatorFiltererUpgradeable.__OperatorFilterer_init(CANONICAL_CORI_SUBSCRIPTION, true); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "IOperatorFilterRegistry.sol"; import {Initializable} from "Initializable.sol"; /** * @title OperatorFiltererUpgradeable * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry when the init function is called. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. */ abstract contract OperatorFiltererUpgradeable is Initializable { /// @notice Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); /// @dev The upgradeable initialize function that should be called when the contract is being upgraded. function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (!OPERATOR_FILTER_REGISTRY.isRegistered(address(this))) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } } /** * @dev A helper modifier to check if the operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper modifier to check if the operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if the operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting or // upgraded contracts may specify their own OperatorFilterRegistry implementations, which may behave // differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = _setInitializedVersion(1); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { bool isTopLevelCall = _setInitializedVersion(version); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(version); } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { _setInitializedVersion(type(uint8).max); } function _setInitializedVersion(uint8 version) private returns (bool) { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level // of initializers, because in other contexts the contract may have been reentered. if (_initializing) { require( version == 1 && !AddressUpgradeable.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else { require(_initialized < version, "Initializable: contract is already initialized"); _initialized = version; return true; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev 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.13; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "IERC721Upgradeable.sol"; import "IERC721ReceiverUpgradeable.sol"; import "IERC721MetadataUpgradeable.sol"; import "AddressUpgradeable.sol"; import "ContextUpgradeable.sol"; import "StringsUpgradeable.sol"; import "ERC165Upgradeable.sol"; import "Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable 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. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).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 overridden 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 = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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`. * * 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; /** * @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 Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @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 `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "IERC165Upgradeable.sol"; import "Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "IERC2981Upgradeable.sol"; import "ERC165Upgradeable.sol"; import "Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `tokenId` must be already minted. * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "ContextUpgradeable.sol"; import "Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "NFTBoxesV2Upgradeable.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"boxMould","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"batchSize","type":"uint256"}],"name":"BatchDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"boxMould","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boxEdition","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"BoxBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BoxMouldCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"TOTAL_SHARES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address payable","name":"_artist","type":"address"},{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"addArtists","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_member","type":"address"}],"name":"addTeamMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorisedCaller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boughtMP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boxMouldCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boxMoulds","outputs":[{"internalType":"uint8","name":"live","type":"uint8"},{"internalType":"uint8","name":"shared","type":"uint8"},{"internalType":"uint128","name":"maxEdition","type":"uint128"},{"internalType":"uint128","name":"maxBuyAmount","type":"uint128"},{"internalType":"uint128","name":"currentEditionCount","type":"uint128"},{"internalType":"uint128","name":"boughtCount","type":"uint128"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"series","type":"string"},{"internalType":"string","name":"theme","type":"string"},{"internalType":"string","name":"ipfsHash","type":"string"},{"internalType":"string","name":"arweaveHash","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boxes","outputs":[{"internalType":"uint256","name":"mouldId","type":"uint256"},{"internalType":"uint256","name":"edition","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint128","name":"_quantity","type":"uint128"}],"name":"buyManyBoxes","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"closeBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_max","type":"uint128"},{"internalType":"uint128","name":"_maxBuyAmount","type":"uint128"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"address payable[]","name":"_artists","type":"address[]"},{"internalType":"uint256[]","name":"_shares","type":"uint256[]"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_series","type":"string"},{"internalType":"string","name":"_theme","type":"string"},{"internalType":"string","name":"_ipfsHash","type":"string"},{"internalType":"string","name":"_arweaveHash","type":"string"}],"name":"createBoxMould","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"distributeBoxToSubHolders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address[][]","name":"_recipients","type":"address[][]"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"}],"name":"distributeOffchain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"distributeShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"distroBoxMP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getArtist","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getArtistShares","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getBoxMetaData","outputs":[{"internalType":"uint256","name":"boxId","type":"uint256"},{"internalType":"uint256","name":"boxEdition","type":"uint256"},{"internalType":"uint128","name":"boxMax","type":"uint128"},{"internalType":"string","name":"boxName","type":"string"},{"internalType":"string","name":"boxSeries","type":"string"},{"internalType":"string","name":"boxTheme","type":"string"},{"internalType":"string","name":"boxHashIPFS","type":"string"},{"internalType":"string","name":"boxHashArweave","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_service","type":"address"},{"internalType":"address","name":"_parser","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedBoxes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parser","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address payable","name":"_artist","type":"address"}],"name":"removeArtist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_member","type":"address"}],"name":"removeTeamMember","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_caller","type":"address"},{"internalType":"bool","name":"_value","type":"bool"}],"name":"setCaller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bool","name":"_lock","type":"bool"}],"name":"setLockOnBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newSub","type":"address"}],"name":"setSubService","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_member","type":"address"},{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"setTeamShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_machine","type":"address"}],"name":"setVendingMachine","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"subService","outputs":[{"internalType":"contract SubscriptionService","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"team","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"teamShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vendingMachine","outputs":[{"internalType":"contract IVendingMachine","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061595080620000216000396000f3fe6080604052600436106102c95760003560e01c8063715018a611610175578063aef078bc116100dc578063d9ab588211610095578063f2fde38b1161006f578063f2fde38b14610954578063f5f0cebd14610974578063f769046f14610994578063fb4a2558146109c257600080fd5b8063d9ab5882146108e6578063e985e9c514610914578063eba2389d1461093457600080fd5b8063aef078bc14610829578063b3ed1da41461083c578063b5a3f84f14610870578063b88d4fde14610886578063c87b56dd146108a6578063cb67558e146108c657600080fd5b806395d89b411161012e57806395d89b41146107635780639cae6eae146107785780639e41892614610798578063a22cb465146107b8578063a2e28ea3146107d8578063a74772c8146107f857600080fd5b8063715018a6146106ad578063783abc8e146106c2578063811dd0e2146106e2578063857190931461070f57806385e3f9971461072f5780638da5cb5b1461074557600080fd5b80632b28bc991161023457806346fd5522116101ed5780634ed3faf2116101c75780634ed3faf2146105f45780635aad6a351461063e5780636352211e1461065f57806370a082311461067f57600080fd5b806346fd552214610583578063485cc955146105a35780634ccc6b5f146105c357600080fd5b80632b28bc99146104ab57806333c1da70146104cb5780633eb2b5ad14610503578063424f4fef1461052357806342842e0e14610543578063451dc3e61461056357600080fd5b806314eba0261161028657806314eba026146103bf578063197ebd53146103df578063231710d7146103ff57806323b872dd1461041f578063263030561461043f5780632a55205a1461046c57600080fd5b806301ffc9a7146102ce57806304634d8d1461030357806306fdde0314610325578063081812fc14610347578063095ea7b31461037f5780630fceb9ab1461039f575b600080fd5b3480156102da57600080fd5b506102ee6102e936600461492f565b6109e2565b60405190151581526020015b60405180910390f35b34801561030f57600080fd5b5061032361031e366004614968565b610a02565b005b34801561033157600080fd5b5061033a610a43565b6040516102fa91906149fd565b34801561035357600080fd5b50610367610362366004614a10565b610ad5565b6040516001600160a01b0390911681526020016102fa565b34801561038b57600080fd5b5061032361039a366004614a29565b610b6a565b3480156103ab57600080fd5b506103236103ba366004614a10565b610c7f565b3480156103cb57600080fd5b506103236103da366004614a55565b610d0e565b3480156103eb57600080fd5b506103676103fa366004614a10565b610e5b565b34801561040b57600080fd5b5061032361041a366004614a55565b610e86565b34801561042b57600080fd5b5061032361043a366004614a72565b610ed2565b34801561044b57600080fd5b5061045f61045a366004614a10565b610f03565b6040516102fa9190614ab3565b34801561047857600080fd5b5061048c610487366004614af7565b610f68565b604080516001600160a01b0390931683526020830191909152016102fa565b3480156104b757600080fd5b506103236104c6366004614b19565b611016565b3480156104d757600080fd5b506104eb6104e6366004614a10565b6110cb565b6040516102fa9c9b9a99989796959493929190614b40565b34801561050f57600080fd5b5061032361051e366004614a55565b6113e7565b34801561052f57600080fd5b5060fc54610367906001600160a01b031681565b34801561054f57600080fd5b5061032361055e366004614a72565b6114f9565b34801561056f57600080fd5b5060fd54610367906001600160a01b031681565b34801561058f57600080fd5b5061032361059e366004614de0565b611514565b3480156105af57600080fd5b506103236105be366004614f28565b6117fb565b3480156105cf57600080fd5b506102ee6105de366004614a10565b6101016020526000908152604090205460ff1681565b34801561060057600080fd5b5061062961060f366004614a10565b610100602052600090815260409020805460019091015482565b604080519283526020830191909152016102fa565b34801561064a57600080fd5b5061010754610367906001600160a01b031681565b34801561066b57600080fd5b5061036761067a366004614a10565b611a1b565b34801561068b57600080fd5b5061069f61069a366004614a55565b611a92565b6040519081526020016102fa565b3480156106b957600080fd5b50610323611b19565b3480156106ce57600080fd5b506103236106dd366004614f56565b611b4f565b3480156106ee57600080fd5b506107026106fd366004614a10565b611d40565b6040516102fa9190614f7b565b34801561071b57600080fd5b5061032361072a366004615001565b611dae565b34801561073b57600080fd5b5061069f6103e881565b34801561075157600080fd5b506097546001600160a01b0316610367565b34801561076f57600080fd5b5061033a612088565b34801561078457600080fd5b5061032361079336600461505d565b612097565b3480156107a457600080fd5b506103236107b3366004615092565b6120ed565b3480156107c457600080fd5b506103236107d336600461505d565b612181565b3480156107e457600080fd5b506103236107f3366004614a10565b61218c565b34801561080457600080fd5b506102ee610813366004614a55565b6101086020526000908152604090205460ff1681565b6103236108373660046150b5565b612473565b34801561084857600080fd5b5061085c610857366004614a10565b6127e1565b6040516102fa9897969594939291906150d8565b34801561087c57600080fd5b5061069f60fe5481565b34801561089257600080fd5b506103236108a1366004615166565b612c6b565b3480156108b257600080fd5b5061033a6108c1366004614a10565b612c9d565b3480156108d257600080fd5b506103236108e1366004614a55565b613230565b3480156108f257600080fd5b5061069f610901366004614a10565b6101046020526000908152604090205481565b34801561092057600080fd5b506102ee61092f366004614f28565b61327c565b34801561094057600080fd5b5061032361094f366004614a29565b6132aa565b34801561096057600080fd5b5061032361096f366004614a55565b61339b565b34801561098057600080fd5b5061032361098f3660046151e6565b613436565b3480156109a057600080fd5b5061069f6109af366004614a55565b6101056020526000908152604090205481565b3480156109ce57600080fd5b506103236109dd366004614a10565b613a93565b60006109ed82613d1c565b806109fc57506109fc82613d3d565b92915050565b6097546001600160a01b03163314610a355760405162461bcd60e51b8152600401610a2c90615260565b60405180910390fd5b610a3f8282613d8d565b5050565b606060658054610a5290615295565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7e90615295565b8015610acb5780601f10610aa057610100808354040283529160200191610acb565b820191906000526020600020905b815481529060010190602001808311610aae57829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b0316610b4e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a2c565b506000908152606960205260409020546001600160a01b031690565b6000610b7582611a1b565b9050806001600160a01b0316836001600160a01b031603610be25760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a2c565b336001600160a01b0382161480610bfe5750610bfe813361327c565b610c705760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a2c565b610c7a8383613e8a565b505050565b336000908152610108602052604090205460ff1680610ca857506097546001600160a01b031633145b610cc45760405162461bcd60e51b8152600401610a2c906152cf565b600081815260ff6020526040902060fe548211801590610ce45750600082115b610d005760405162461bcd60e51b8152600401610a2c90615306565b805460ff1916600117905550565b6097546001600160a01b03163314610d385760405162461bcd60e51b8152600401610a2c90615260565b60005b61010654811015610a3f57816001600160a01b03166101068281548110610d6457610d6461532a565b6000918252602090912001546001600160a01b031603610e49576001600160a01b038216600090815261010560205260408120556101068054610da990600190615356565b81548110610db957610db961532a565b60009182526020909120015461010680546001600160a01b039092169183908110610de657610de661532a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550610106805480610e2657610e26615369565b600082815260209020810160001990810180546001600160a01b03191690550190555b80610e538161537f565b915050610d3b565b6101068181548110610e6c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6097546001600160a01b03163314610eb05760405162461bcd60e51b8152600401610a2c90615260565b60fd80546001600160a01b0319166001600160a01b0392909216919091179055565b610edc3382613ef8565b610ef85760405162461bcd60e51b8152600401610a2c90615398565b610c7a838383613fcf565b600081815260ff6020908152604091829020600501805483518184028101840190945280845260609392830182828015610f5c57602002820191906000526020600020905b815481526020019060010190808311610f48575b50505050509050919050565b600082815260ca602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610fdd57506040805180820190915260c9546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610ffc906001600160601b0316876153e9565b6110069190615400565b91519350909150505b9250929050565b6097546001600160a01b031633146110405760405162461bcd60e51b8152600401610a2c90615260565b600083815260ff6020526040902060fe5484118015906110605750600084115b61107c5760405162461bcd60e51b8152600401610a2c90615422565b600481018054600180820183556000928352602080842090920180546001600160a01b0319166001600160a01b0397909716969096179095556005909201805494850181558152209091015550565b60ff602081905260009182526040909120805460018201546002830154600384015460068501805485881697610100870416966001600160801b036201000090970487169686811696600160801b9004811695169392909161112c90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461115890615295565b80156111a55780601f1061117a576101008083540402835291602001916111a5565b820191906000526020600020905b81548152906001019060200180831161118857829003601f168201915b5050505050908060070180546111ba90615295565b80601f01602080910402602001604051908101604052809291908181526020018280546111e690615295565b80156112335780601f1061120857610100808354040283529160200191611233565b820191906000526020600020905b81548152906001019060200180831161121657829003601f168201915b50505050509080600801805461124890615295565b80601f016020809104026020016040519081016040528092919081815260200182805461127490615295565b80156112c15780601f10611296576101008083540402835291602001916112c1565b820191906000526020600020905b8154815290600101906020018083116112a457829003601f168201915b5050505050908060090180546112d690615295565b80601f016020809104026020016040519081016040528092919081815260200182805461130290615295565b801561134f5780601f106113245761010080835404028352916020019161134f565b820191906000526020600020905b81548152906001019060200180831161133257829003601f168201915b50505050509080600a01805461136490615295565b80601f016020809104026020016040519081016040528092919081815260200182805461139090615295565b80156113dd5780601f106113b2576101008083540402835291602001916113dd565b820191906000526020600020905b8154815290600101906020018083116113c057829003601f168201915b505050505090508c565b6097546001600160a01b031633146114115760405162461bcd60e51b8152600401610a2c90615260565b60005b610106548110156114a55761010681815481106114335761143361532a565b6000918252602090912001546001600160a01b03908116908316036114935760405162461bcd60e51b81526020600482015260166024820152756d656d626572732065786973747320616c726561647960501b6044820152606401610a2c565b8061149d8161537f565b915050611414565b5061010680546001810182556000919091527fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b0180546001600160a01b0319166001600160a01b0392909216919091179055565b610c7a83838360405180602001604052806000815250612c6b565b6097546001600160a01b0316331461153e5760405162461bcd60e51b8152600401610a2c90615260565b85518751146115825760405162461bcd60e51b815260206004820152601060248201526f30b93930bcb99010b9b0b6b2903632b760811b6044820152606401610a2c565b604051806101c00160405280600060ff168152602001600060ff1681526020018b6001600160801b031681526020018a6001600160801b0316815260200160006001600160801b0316815260200160006001600160801b031681526020018981526020018881526020018781526020018681526020018581526020018481526020018381526020018281525060ff600060fe5460016116219190615445565b8152602080820192909252604090810160002083518154858501519386015160ff92831661ffff199092169190911761010092909416919091029290921771ffffffffffffffffffffffffffffffff00001916620100006001600160801b039384160217815560608401516080850151908316600160801b9184169190910217600182015560a08401516002820180546fffffffffffffffffffffffffffffffff1916919093161790915560c0830151600382015560e0830151805191926116f192600485019290910190614864565b50610100820151805161170e9160058401916020909101906148c9565b506101208201516006820190611724908261549e565b50610140820151600782019061173a908261549e565b506101608201516008820190611750908261549e565b506101808201516009820190611766908261549e565b506101a0820151600a82019061177c908261549e565b505060fe80549150600061178f8361537f565b909155505060fe80546000908152610101602052604090819020805460ff19166001179055905490517f77628c9166aca2fc4ccb8b7681fa345c93f54fb929f857d05cfebbfb665bad02916117e79190815260200190565b60405180910390a150505050505050505050565b6000611807600161404f565b9050801561181f576000805461ff0019166101001790555b6118276140dc565b61186c6040518060400160405280600681526020016509c8ca884def60d31b815250604051806040016040528060058152602001645b424f585d60d81b81525061410b565b600460fe556101068054600181810183557fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b91820180546001600160a01b0319908116733428b1746dfd26c7c725913d829be2706aa89b2e1790915583548083018555830180548216734125515f4e5a0db45316bf05a7c102c13e1e5ba117905583549182019093550180548216738c26a91205e531e8b35cf3315f384727b9681d7590811790915561010560205261024e7f7d659e613b32bfa5b74f8681bc7664e295657e1af00cc68a6c03243d54df91c855605a7f8bbb4218caa1843ecad093a73851b628879ba083835a7c224812bcb64887aae455600052601e7fe50f39bcb017ac26a0cd53de034250f561065e063eb6cbca33dde0ad00357e8d5560fc80548216735b8d524b10b8ea587da49f426a76396f80b7bc8417905560fd80546001600160a01b03868116918416919091179091556101078054918516919092161790558015610c7a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6000818152606760205260408120546001600160a01b0316806109fc5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a2c565b60006001600160a01b038216611afd5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a2c565b506001600160a01b031660009081526068602052604090205490565b6097546001600160a01b03163314611b435760405162461bcd60e51b8152600401610a2c90615260565b611b4d600061413c565b565b6097546001600160a01b03163314611b795760405162461bcd60e51b8152600401610a2c90615260565b600082815260ff6020526040902060fe548311801590611b995750600083115b611bb55760405162461bcd60e51b8152600401610a2c90615422565b60005b6004820154811015611d3a57826001600160a01b0316826004018281548110611be357611be361532a565b6000918252602090912001546001600160a01b031603611d2857600482018054611c0f90600190615356565b81548110611c1f57611c1f61532a565b6000918252602090912001546004830180546001600160a01b039092169183908110611c4d57611c4d61532a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600401805480611c8e57611c8e615369565b600082815260209020810160001990810180546001600160a01b0319169055019055600582018054611cc290600190615356565b81548110611cd257611cd261532a565b9060005260206000200154826005018281548110611cf257611cf261532a565b60009182526020909120015560058201805480611d1157611d11615369565b600190038181906000526020600020016000905590555b80611d328161537f565b915050611bb8565b50505050565b600081815260ff6020908152604091829020600401805483518184028101840190945280845260609392830182828015610f5c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611d855750505050509050919050565b336000908152610108602052604090205460ff1680611dd757506097546001600160a01b031633145b611df35760405162461bcd60e51b8152600401610a2c906152cf565b600083815260ff602052604090206001810154815460fe54600160801b9092046001600160801b039081169262010000909204169084908711801590611e395750600087115b611e555760405162461bcd60e51b8152600401610a2c90615422565b835460ff1615611e8f5760405162461bcd60e51b8152602060048201526005602482015264216c69766560d81b6044820152606401610a2c565b6000878152610101602052604090205460ff1615611ed85760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b6044820152606401610a2c565b6001600160801b0380831690611ef19087908616615445565b1115611f275760405162461bcd60e51b8152602060048201526005602482015264216d616e7960d81b6044820152606401610a2c565b60fb5460005b826001600160801b0316816001600160801b03161015611fb257611fa0858a6001600160801b0384168b8b82818110611f6857611f6861532a565b9050602002016020810190611f7d9190614a55565b611f906001600160801b03871688615445565b611f9b906001615445565b61418e565b80611faa8161555e565b915050611f2d565b50816001600160801b031660fb6000828254611fce9190615445565b9091555050600185018054839190601090611ffa908490600160801b90046001600160801b0316615584565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550816001600160801b031661010460008a8152602001908152602001600020600082825461204b9190615445565b90915550506001600160801b0383166120648386615584565b6001600160801b03160361207e57845460ff191660011785555b5050505050505050565b606060668054610a5290615295565b6097546001600160a01b031633146120c15760405162461bcd60e51b8152600401610a2c90615260565b6001600160a01b0391909116600090815261010860205260409020805460ff1916911515919091179055565b336000908152610108602052604090205460ff168061211657506097546001600160a01b031633145b6121325760405162461bcd60e51b8152600401610a2c906152cf565b60fe5482111580156121445750600082115b6121605760405162461bcd60e51b8152600401610a2c90615306565b60009182526101016020526040909120805460ff1916911515919091179055565b610a3f338383614241565b6097546001600160a01b031633146121b65760405162461bcd60e51b8152600401610a2c90615260565b60fe5481111580156121c85750600081115b6121e45760405162461bcd60e51b8152600401610a2c90615422565b600081815261010360205260408120805490826122008361537f565b919050559050600a81106122445760405162461bcd60e51b815260206004820152600b60248201526a44697374726f20646f6e6560a81b6044820152606401610a2c565b600082815260ff60205260408120600181015460fd549192600160801b9091046001600160801b0316916001600160a01b031663aaae61eb6122878660326153e9565b6040516001600160e01b031960e084901b168152600481019190915260326024820152604401600060405180830381865afa1580156122ca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122f291908101906155ab565b60fb54909150600090815b603281101561237057600084828151811061231a5761231a61532a565b6020026020010151905060006001600160a01b0316816001600160a01b03161461235d5761234f868a8684611f908289615445565b836123598161537f565b9450505b50806123688161537f565b9150506122fd565b508160fb60008282546123839190615445565b90915550506001850180548391906010906123af908490600160801b90046001600160801b0316615584565b82546101009290920a6001600160801b038181021990931691831602179091558654620100009004811691506123e89084908716615445565b036123f957845460ff191660011785555b8560090361246a5760fd60009054906101000a90046001600160a01b03166001600160a01b031663b8dea0956040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561245157600080fd5b505af1158015612465573d6000803e3d6000fd5b505050505b50505050505050565b600082815260ff602052604090206001810154815460fe54600160801b9092046001600160801b039081169262010000909204169085118015906124b75750600085115b6124d35760405162461bcd60e51b8152600401610a2c90615422565b825460ff161561250d5760405162461bcd60e51b8152602060048201526005602482015264216c69766560d81b6044820152606401610a2c565b6000858152610101602052604090205460ff16156125565760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b6044820152606401610a2c565b34846001600160801b0316846003015461257091906153e9565b146125a65760405162461bcd60e51b815260206004820152600660248201526521707269636560d01b6044820152606401610a2c565b6001600160801b0381166125ba8584615584565b6001600160801b031611156125f95760405162461bcd60e51b8152602060048201526005602482015264216d616e7960d81b6044820152606401610a2c565b60018301546000868152610102602090815260408083203384529091529020546001600160801b03918216916126329190871690615445565b11156126695760405162461bcd60e51b8152600401610a2c906020808252600490820152632162757960e01b604082015260600190565b60fb5460005b856001600160801b0316816001600160801b031610156126b5576126a384886001600160801b03841633611f908288615445565b806126ad8161555e565b91505061266f565b50846001600160801b031660fb60008282546126d19190615445565b90915550506001840180548691906010906126fd908490600160801b90046001600160801b0316615584565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550848460020160008282829054906101000a90046001600160801b03166127479190615584565b82546101009290920a6001600160801b03818102199093169183160217909155600088815261010260209081526040808320338452909152902054612790925090871690615445565b6000878152610102602090815260408083203384529091529020556001600160801b0382166127bf8685615584565b6001600160801b0316036127d957835460ff191660011784555b505050505050565b60008181526101006020818152604080842081518083018352815480825260019283015482860152865260ff80855283872084516101c08101865281548084168252978804909216828701526001600160801b036201000090970487168286015292830154808716606083810191909152600160801b90910487166080830152600284015490961660a0820152600383015460c0820152600483018054855181880281018801909652808652889788979096879687968796879691958c95919460e086019390929091908301828280156128e457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116128c6575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561293c57602002820191906000526020600020905b815481526020019060010190808311612928575b5050505050815260200160068201805461295590615295565b80601f016020809104026020016040519081016040528092919081815260200182805461298190615295565b80156129ce5780601f106129a3576101008083540402835291602001916129ce565b820191906000526020600020905b8154815290600101906020018083116129b157829003601f168201915b505050505081526020016007820180546129e790615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612a1390615295565b8015612a605780601f10612a3557610100808354040283529160200191612a60565b820191906000526020600020905b815481529060010190602001808311612a4357829003601f168201915b50505050508152602001600882018054612a7990615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612aa590615295565b8015612af25780601f10612ac757610100808354040283529160200191612af2565b820191906000526020600020905b815481529060010190602001808311612ad557829003601f168201915b50505050508152602001600982018054612b0b90615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612b3790615295565b8015612b845780601f10612b5957610100808354040283529160200191612b84565b820191906000526020600020905b815481529060010190602001808311612b6757829003601f168201915b50505050508152602001600a82018054612b9d90615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612bc990615295565b8015612c165780601f10612beb57610100808354040283529160200191612c16565b820191906000526020600020905b815481529060010190602001808311612bf957829003601f168201915b5050505050815250509050816000015182602001518260400151836101200151846101400151856101600151866101800151876101a00151995099509950995099509950995099505050919395975091939597565b612c753383613ef8565b612c915760405162461bcd60e51b8152600401610a2c90615398565b611d3a8484848461430f565b60008181526101006020908152604091829020825180840190935280548084526001909101549183019190915260609190612cd757600080fd5b8051600090815260ff6020818152604080842081516101c08101835281548086168252610100810490951681850152620100009094046001600160801b039081168584015260018201548082166060870152600160801b90048116608086015260028201541660a0850152600381015460c0850152600481018054835181860281018601909452808452919360e08601939290830182828015612da357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612d85575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015612dfb57602002820191906000526020600020905b815481526020019060010190808311612de7575b50505050508152602001600682018054612e1490615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612e4090615295565b8015612e8d5780601f10612e6257610100808354040283529160200191612e8d565b820191906000526020600020905b815481529060010190602001808311612e7057829003601f168201915b50505050508152602001600782018054612ea690615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612ed290615295565b8015612f1f5780601f10612ef457610100808354040283529160200191612f1f565b820191906000526020600020905b815481529060010190602001808311612f0257829003601f168201915b50505050508152602001600882018054612f3890615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612f6490615295565b8015612fb15780601f10612f8657610100808354040283529160200191612fb1565b820191906000526020600020905b815481529060010190602001808311612f9457829003601f168201915b50505050508152602001600982018054612fca90615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612ff690615295565b80156130435780601f1061301857610100808354040283529160200191613043565b820191906000526020600020905b81548152906001019060200180831161302657829003601f168201915b50505050508152602001600a8201805461305c90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461308890615295565b80156130d55780601f106130aa576101008083540402835291602001916130d5565b820191906000526020600020905b8154815290600101906020018083116130b857829003601f168201915b50505091909252505061010754602085015161014084015161012085015161016086015160405163053e37e560e11b81529697506001600160a01b0390941695630a7c6fca95506131299490600401615645565b600060405180830381865afa158015613146573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261316e9190810190615684565b6101075483516020850151604080860151610140870151610180880151610160890151935163f9e1eb5f60e01b81526001600160a01b039097169663f9e1eb5f966131c296909590949392916004016156fb565b600060405180830381865afa1580156131df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526132079190810190615684565b60405160200161321892919061575c565b60405160208183030381529060405292505050919050565b6097546001600160a01b0316331461325a5760405162461bcd60e51b8152600401610a2c90615260565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6097546001600160a01b031633146132d45760405162461bcd60e51b8152600401610a2c90615260565b6103e88111156133265760405162461bcd60e51b815260206004820152601860248201527f7368617265206d7573742062652062656c6f77203130303000000000000000006044820152606401610a2c565b60005b61010654811015610c7a57826001600160a01b031661010682815481106133525761335261532a565b6000918252602090912001546001600160a01b031603613389576001600160a01b0383166000908152610105602052604090208290555b806133938161537f565b915050613329565b6097546001600160a01b031633146133c55760405162461bcd60e51b8152600401610a2c90615260565b6001600160a01b03811661342a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a2c565b6134338161413c565b50565b336000908152610108602052604090205460ff168061345f57506097546001600160a01b031633145b61347b5760405162461bcd60e51b8152600401610a2c906152cf565b600085815260ff6020818152604080842081516101c08101835281548086168252610100810490951681850152620100009094046001600160801b039081168584015260018201548082166060870152600160801b90048116608086015260028201541660a0850152600381015460c0850152600481018054835181860281018601909452808452919360e0860193929083018282801561354557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613527575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561359d57602002820191906000526020600020905b815481526020019060010190808311613589575b505050505081526020016006820180546135b690615295565b80601f01602080910402602001604051908101604052809291908181526020018280546135e290615295565b801561362f5780601f106136045761010080835404028352916020019161362f565b820191906000526020600020905b81548152906001019060200180831161361257829003601f168201915b5050505050815260200160078201805461364890615295565b80601f016020809104026020016040519081016040528092919081815260200182805461367490615295565b80156136c15780601f10613696576101008083540402835291602001916136c1565b820191906000526020600020905b8154815290600101906020018083116136a457829003601f168201915b505050505081526020016008820180546136da90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461370690615295565b80156137535780601f1061372857610100808354040283529160200191613753565b820191906000526020600020905b81548152906001019060200180831161373657829003601f168201915b5050505050815260200160098201805461376c90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461379890615295565b80156137e55780601f106137ba576101008083540402835291602001916137e5565b820191906000526020600020905b8154815290600101906020018083116137c857829003601f168201915b50505050508152602001600a820180546137fe90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461382a90615295565b80156138775780601f1061384c57610100808354040283529160200191613877565b820191906000526020600020905b81548152906001019060200180831161385a57829003601f168201915b5050505050815250509050806000015160ff166001146138c25760405162461bcd60e51b8152600401610a2c906020808252600490820152636c69766560e01b604082015260600190565b8185856000816138d4576138d461532a565b90506020028101906138e6919061578b565b9050146139215760405162461bcd60e51b815260206004820152600960248201526862616420617272617960b81b6044820152606401610a2c565b60005b84811015613a555760005b868660008181106139425761394261532a565b9050602002810190613954919061578b565b9050811015613a425760fc546001600160a01b031663e56e34798686848181106139805761398061532a565b905060200201358989868181106139995761399961532a565b90506020028101906139ab919061578b565b858181106139bb576139bb61532a565b90506020020160208101906139d09190614a55565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401600060405180830381600087803b158015613a1757600080fd5b505af1158015613a2b573d6000803e3d6000fd5b505050508080613a3a9061537f565b91505061392f565b5080613a4d8161537f565b915050613924565b5060405184815286907fb3e821bfa4e118cf1cac28128930a4e53e59dd51d9e30c95ee100e4d3b0d2ef29060200160405180910390a2505050505050565b600081815260ff6020526040902060fe548211801590613ab35750600082115b613acf5760405162461bcd60e51b8152600401610a2c90615306565b805460ff166001148015613aea57508054610100900460ff16155b613b245760405162461bcd60e51b815260206004820152600b60248201526a216469737472696275746560a81b6044820152606401610a2c565b613b2d82614342565b613b685760405162461bcd60e51b815260206004820152600c60248201526b39bab690109e90189818129760a11b6044820152606401610a2c565b805461ff00191661010017815560038101546002820154600091613b94916001600160801b03166153e9565b90506000805b61010654811015613c63576103e861010560006101068481548110613bc157613bc161532a565b60009182526020808320909101546001600160a01b03168352820192909252604001902054613bf090856153e9565b613bfa9190615400565b91506101068181548110613c1057613c1061532a565b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015613c50573d6000803e3d6000fd5b5080613c5b8161537f565b915050613b9a565b5060005b6004840154811015613d15576103e8846005018281548110613c8b57613c8b61532a565b906000526020600020015484613ca191906153e9565b613cab9190615400565b9150836004018181548110613cc257613cc261532a565b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015613d02573d6000803e3d6000fd5b5080613d0d8161537f565b915050613c67565b5050505050565b60006001600160e01b0319821663152a902d60e11b14806109fc57506109fc825b60006001600160e01b031982166380ac58cd60e01b1480613d6e57506001600160e01b03198216635b5e139f60e01b145b806109fc57506301ffc9a760e01b6001600160e01b03198316146109fc565b6127106001600160601b0382161115613dfb5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610a2c565b6001600160a01b038216613e515760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610a2c565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b9091021760c955565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613ebf82611a1b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b0316613f715760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a2c565b6000613f7c83611a1b565b9050806001600160a01b0316846001600160a01b03161480613fa35750613fa3818561327c565b80613fc75750836001600160a01b0316613fbc84610ad5565b6001600160a01b0316145b949350505050565b600081815261010060209081526040808320815180830183528154808252600190920154818501529084526101019092529091205460ff16156140445760405162461bcd60e51b815260206004820152600d60248201526c109bde081a5cc81b1bd8dad959609a1b6044820152606401610a2c565b611d3a848484614415565b60008054610100900460ff1615614096578160ff1660011480156140725750303b155b61408e5760405162461bcd60e51b8152600401610a2c906157d5565b506000919050565b60005460ff8084169116106140bd5760405162461bcd60e51b8152600401610a2c906157d5565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166141035760405162461bcd60e51b8152600401610a2c90615823565b611b4d6145b1565b600054610100900460ff166141325760405162461bcd60e51b8152600401610a2c90615823565b610a3f82826145e1565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051806040016040528085815260200184876001600160801b03166141b49190615445565b6141bf906001615445565b905260008281526101006020908152604090912082518155910151600190910155837f5420392aab8a9f3a70c0145321ff58bc86c3da3596336224396de59f430fc0f5614215856001600160801b038916615445565b614220906001615445565b60408051918252602082018590520160405180910390a2613d158282614621565b816001600160a01b0316836001600160a01b0316036142a25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a2c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61431a848484613fcf565b61432684848484614763565b611d3a5760405162461bcd60e51b8152600401610a2c9061586e565b600081815260ff6020526040812081805b610106548110156143ba57610105600061010683815481106143775761437761532a565b60009182526020808320909101546001600160a01b031683528201929092526040019020546143a69083615445565b9150806143b28161537f565b915050614353565b5060005b6005830154811015614409578260050181815481106143df576143df61532a565b9060005260206000200154826143f59190615445565b9150806144018161537f565b9150506143be565b506103e8149392505050565b826001600160a01b031661442882611a1b565b6001600160a01b03161461448c5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610a2c565b6001600160a01b0382166144ee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a2c565b6144f9600082613e8a565b6001600160a01b0383166000908152606860205260408120805460019290614522908490615356565b90915550506001600160a01b0382166000908152606860205260408120805460019290614550908490615445565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600054610100900460ff166145d85760405162461bcd60e51b8152600401610a2c90615823565b611b4d3361413c565b600054610100900460ff166146085760405162461bcd60e51b8152600401610a2c90615823565b6065614614838261549e565b506066610c7a828261549e565b6001600160a01b0382166146775760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a2c565b6000818152606760205260409020546001600160a01b0316156146dc5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a2c565b6001600160a01b0382166000908152606860205260408120805460019290614705908490615445565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561485957604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906147a79033908990889088906004016158c0565b6020604051808303816000875af19250505080156147e2575060408051601f3d908101601f191682019092526147df918101906158fd565b60015b61483f573d808015614810576040519150601f19603f3d011682016040523d82523d6000602084013e614815565b606091505b5080516000036148375760405162461bcd60e51b8152600401610a2c9061586e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613fc7565b506001949350505050565b8280548282559060005260206000209081019282156148b9579160200282015b828111156148b957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614884565b506148c5929150614904565b5090565b8280548282559060005260206000209081019282156148b9579160200282015b828111156148b95782518255916020019190600101906148e9565b5b808211156148c55760008155600101614905565b6001600160e01b03198116811461343357600080fd5b60006020828403121561494157600080fd5b813561494c81614919565b9392505050565b6001600160a01b038116811461343357600080fd5b6000806040838503121561497b57600080fd5b823561498681614953565b915060208301356001600160601b03811681146149a257600080fd5b809150509250929050565b60005b838110156149c85781810151838201526020016149b0565b50506000910152565b600081518084526149e98160208601602086016149ad565b601f01601f19169290920160200192915050565b60208152600061494c60208301846149d1565b600060208284031215614a2257600080fd5b5035919050565b60008060408385031215614a3c57600080fd5b8235614a4781614953565b946020939093013593505050565b600060208284031215614a6757600080fd5b813561494c81614953565b600080600060608486031215614a8757600080fd5b8335614a9281614953565b92506020840135614aa281614953565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b81811015614aeb57835183529284019291840191600101614acf565b50909695505050505050565b60008060408385031215614b0a57600080fd5b50508035926020909101359150565b600080600060608486031215614b2e57600080fd5b833592506020840135614aa281614953565b60ff8d811682528c16602082015260006101806001600160801b038d1660408401526001600160801b038c1660608401526001600160801b038b1660808401526001600160801b038a1660a08401528860c08401528060e0840152614ba7818401896149d1565b9050828103610100840152614bbc81886149d1565b9050828103610120840152614bd181876149d1565b9050828103610140840152614be681866149d1565b9050828103610160840152614bfb81856149d1565b9f9e505050505050505050505050505050565b80356001600160801b03811681146140d757600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614c6457614c64614c25565b604052919050565b600067ffffffffffffffff821115614c8657614c86614c25565b5060051b60200190565b600082601f830112614ca157600080fd5b81356020614cb6614cb183614c6c565b614c3b565b82815260059290921b84018101918181019086841115614cd557600080fd5b8286015b84811015614cf9578035614cec81614953565b8352918301918301614cd9565b509695505050505050565b600082601f830112614d1557600080fd5b81356020614d25614cb183614c6c565b82815260059290921b84018101918181019086841115614d4457600080fd5b8286015b84811015614cf95780358352918301918301614d48565b600067ffffffffffffffff821115614d7957614d79614c25565b50601f01601f191660200190565b6000614d95614cb184614d5f565b9050828152838383011115614da957600080fd5b828260208301376000602084830101529392505050565b600082601f830112614dd157600080fd5b61494c83833560208501614d87565b6000806000806000806000806000806101408b8d031215614e0057600080fd5b614e098b614c0e565b9950614e1760208c01614c0e565b985060408b0135975060608b013567ffffffffffffffff80821115614e3b57600080fd5b614e478e838f01614c90565b985060808d0135915080821115614e5d57600080fd5b614e698e838f01614d04565b975060a08d0135915080821115614e7f57600080fd5b614e8b8e838f01614dc0565b965060c08d0135915080821115614ea157600080fd5b614ead8e838f01614dc0565b955060e08d0135915080821115614ec357600080fd5b614ecf8e838f01614dc0565b94506101008d0135915080821115614ee657600080fd5b614ef28e838f01614dc0565b93506101208d0135915080821115614f0957600080fd5b50614f168d828e01614dc0565b9150509295989b9194979a5092959850565b60008060408385031215614f3b57600080fd5b8235614f4681614953565b915060208301356149a281614953565b60008060408385031215614f6957600080fd5b8235915060208301356149a281614953565b6020808252825182820181905260009190848201906040850190845b81811015614aeb5783516001600160a01b031683529284019291840191600101614f97565b60008083601f840112614fce57600080fd5b50813567ffffffffffffffff811115614fe657600080fd5b6020830191508360208260051b850101111561100f57600080fd5b60008060006040848603121561501657600080fd5b83359250602084013567ffffffffffffffff81111561503457600080fd5b61504086828701614fbc565b9497909650939450505050565b803580151581146140d757600080fd5b6000806040838503121561507057600080fd5b823561507b81614953565b91506150896020840161504d565b90509250929050565b600080604083850312156150a557600080fd5b823591506150896020840161504d565b600080604083850312156150c857600080fd5b8235915061508960208401614c0e565b60006101008a83528960208401526001600160801b0389166040840152806060840152615107818401896149d1565b9050828103608084015261511b81886149d1565b905082810360a084015261512f81876149d1565b905082810360c084015261514381866149d1565b905082810360e084015261515781856149d1565b9b9a5050505050505050505050565b6000806000806080858703121561517c57600080fd5b843561518781614953565b9350602085013561519781614953565b925060408501359150606085013567ffffffffffffffff8111156151ba57600080fd5b8501601f810187136151cb57600080fd5b6151da87823560208401614d87565b91505092959194509250565b6000806000806000606086880312156151fe57600080fd5b85359450602086013567ffffffffffffffff8082111561521d57600080fd5b61522989838a01614fbc565b9096509450604088013591508082111561524257600080fd5b5061524f88828901614fbc565b969995985093965092949392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806152a957607f821691505b6020821081036152c957634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601a908201527f4e6f7420617574686f726973656420746f20657865637574652e000000000000604082015260600190565b6020808252600a908201526924a21010b2bc34b9ba1760b11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156109fc576109fc615340565b634e487b7160e01b600052603160045260246000fd5b60006001820161539157615391615340565b5060010190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820281158282048414176109fc576109fc615340565b60008261541d57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526009908201526812510808595e1a5cdd60ba1b604082015260600190565b808201808211156109fc576109fc615340565b601f821115610c7a57600081815260208120601f850160051c8101602086101561547f5750805b601f850160051c820191505b818110156127d95782815560010161548b565b815167ffffffffffffffff8111156154b8576154b8614c25565b6154cc816154c68454615295565b84615458565b602080601f83116001811461550157600084156154e95750858301515b600019600386901b1c1916600185901b1785556127d9565b600085815260208120601f198616915b8281101561553057888601518255948401946001909101908401615511565b508582101561554e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160801b0380831681810361557a5761557a615340565b6001019392505050565b6001600160801b038181168382160190808211156155a4576155a4615340565b5092915050565b600060208083850312156155be57600080fd5b825167ffffffffffffffff8111156155d557600080fd5b8301601f810185136155e657600080fd5b80516155f4614cb182614c6c565b81815260059190911b8201830190838101908783111561561357600080fd5b928401925b8284101561563a57835161562b81614953565b82529284019290840190615618565b979650505050505050565b84815260806020820152600061565e60808301866149d1565b828103604084015261567081866149d1565b9050828103606084015261563a81856149d1565b60006020828403121561569657600080fd5b815167ffffffffffffffff8111156156ad57600080fd5b8201601f810184136156be57600080fd5b80516156cc614cb182614d5f565b8181528560208385010111156156e157600080fd5b6156f28260208301602086016149ad565b95945050505050565b8681528560208201526001600160801b038516604082015260c06060820152600061572960c08301866149d1565b828103608084015261573b81866149d1565b905082810360a084015261574f81856149d1565b9998505050505050505050565b6000835161576e8184602088016149ad565b8351908301906157828183602088016149ad565b01949350505050565b6000808335601e198436030181126157a257600080fd5b83018035915067ffffffffffffffff8211156157bd57600080fd5b6020019150600581901b360382131561100f57600080fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906158f3908301846149d1565b9695505050505050565b60006020828403121561590f57600080fd5b815161494c8161491956fea264697066735822122007f0e5581bb6c0ece97be9e59990885831e95eea0a1b45348c537903b5f8a9d064736f6c63430008110033
Deployed Bytecode
0x6080604052600436106102c95760003560e01c8063715018a611610175578063aef078bc116100dc578063d9ab588211610095578063f2fde38b1161006f578063f2fde38b14610954578063f5f0cebd14610974578063f769046f14610994578063fb4a2558146109c257600080fd5b8063d9ab5882146108e6578063e985e9c514610914578063eba2389d1461093457600080fd5b8063aef078bc14610829578063b3ed1da41461083c578063b5a3f84f14610870578063b88d4fde14610886578063c87b56dd146108a6578063cb67558e146108c657600080fd5b806395d89b411161012e57806395d89b41146107635780639cae6eae146107785780639e41892614610798578063a22cb465146107b8578063a2e28ea3146107d8578063a74772c8146107f857600080fd5b8063715018a6146106ad578063783abc8e146106c2578063811dd0e2146106e2578063857190931461070f57806385e3f9971461072f5780638da5cb5b1461074557600080fd5b80632b28bc991161023457806346fd5522116101ed5780634ed3faf2116101c75780634ed3faf2146105f45780635aad6a351461063e5780636352211e1461065f57806370a082311461067f57600080fd5b806346fd552214610583578063485cc955146105a35780634ccc6b5f146105c357600080fd5b80632b28bc99146104ab57806333c1da70146104cb5780633eb2b5ad14610503578063424f4fef1461052357806342842e0e14610543578063451dc3e61461056357600080fd5b806314eba0261161028657806314eba026146103bf578063197ebd53146103df578063231710d7146103ff57806323b872dd1461041f578063263030561461043f5780632a55205a1461046c57600080fd5b806301ffc9a7146102ce57806304634d8d1461030357806306fdde0314610325578063081812fc14610347578063095ea7b31461037f5780630fceb9ab1461039f575b600080fd5b3480156102da57600080fd5b506102ee6102e936600461492f565b6109e2565b60405190151581526020015b60405180910390f35b34801561030f57600080fd5b5061032361031e366004614968565b610a02565b005b34801561033157600080fd5b5061033a610a43565b6040516102fa91906149fd565b34801561035357600080fd5b50610367610362366004614a10565b610ad5565b6040516001600160a01b0390911681526020016102fa565b34801561038b57600080fd5b5061032361039a366004614a29565b610b6a565b3480156103ab57600080fd5b506103236103ba366004614a10565b610c7f565b3480156103cb57600080fd5b506103236103da366004614a55565b610d0e565b3480156103eb57600080fd5b506103676103fa366004614a10565b610e5b565b34801561040b57600080fd5b5061032361041a366004614a55565b610e86565b34801561042b57600080fd5b5061032361043a366004614a72565b610ed2565b34801561044b57600080fd5b5061045f61045a366004614a10565b610f03565b6040516102fa9190614ab3565b34801561047857600080fd5b5061048c610487366004614af7565b610f68565b604080516001600160a01b0390931683526020830191909152016102fa565b3480156104b757600080fd5b506103236104c6366004614b19565b611016565b3480156104d757600080fd5b506104eb6104e6366004614a10565b6110cb565b6040516102fa9c9b9a99989796959493929190614b40565b34801561050f57600080fd5b5061032361051e366004614a55565b6113e7565b34801561052f57600080fd5b5060fc54610367906001600160a01b031681565b34801561054f57600080fd5b5061032361055e366004614a72565b6114f9565b34801561056f57600080fd5b5060fd54610367906001600160a01b031681565b34801561058f57600080fd5b5061032361059e366004614de0565b611514565b3480156105af57600080fd5b506103236105be366004614f28565b6117fb565b3480156105cf57600080fd5b506102ee6105de366004614a10565b6101016020526000908152604090205460ff1681565b34801561060057600080fd5b5061062961060f366004614a10565b610100602052600090815260409020805460019091015482565b604080519283526020830191909152016102fa565b34801561064a57600080fd5b5061010754610367906001600160a01b031681565b34801561066b57600080fd5b5061036761067a366004614a10565b611a1b565b34801561068b57600080fd5b5061069f61069a366004614a55565b611a92565b6040519081526020016102fa565b3480156106b957600080fd5b50610323611b19565b3480156106ce57600080fd5b506103236106dd366004614f56565b611b4f565b3480156106ee57600080fd5b506107026106fd366004614a10565b611d40565b6040516102fa9190614f7b565b34801561071b57600080fd5b5061032361072a366004615001565b611dae565b34801561073b57600080fd5b5061069f6103e881565b34801561075157600080fd5b506097546001600160a01b0316610367565b34801561076f57600080fd5b5061033a612088565b34801561078457600080fd5b5061032361079336600461505d565b612097565b3480156107a457600080fd5b506103236107b3366004615092565b6120ed565b3480156107c457600080fd5b506103236107d336600461505d565b612181565b3480156107e457600080fd5b506103236107f3366004614a10565b61218c565b34801561080457600080fd5b506102ee610813366004614a55565b6101086020526000908152604090205460ff1681565b6103236108373660046150b5565b612473565b34801561084857600080fd5b5061085c610857366004614a10565b6127e1565b6040516102fa9897969594939291906150d8565b34801561087c57600080fd5b5061069f60fe5481565b34801561089257600080fd5b506103236108a1366004615166565b612c6b565b3480156108b257600080fd5b5061033a6108c1366004614a10565b612c9d565b3480156108d257600080fd5b506103236108e1366004614a55565b613230565b3480156108f257600080fd5b5061069f610901366004614a10565b6101046020526000908152604090205481565b34801561092057600080fd5b506102ee61092f366004614f28565b61327c565b34801561094057600080fd5b5061032361094f366004614a29565b6132aa565b34801561096057600080fd5b5061032361096f366004614a55565b61339b565b34801561098057600080fd5b5061032361098f3660046151e6565b613436565b3480156109a057600080fd5b5061069f6109af366004614a55565b6101056020526000908152604090205481565b3480156109ce57600080fd5b506103236109dd366004614a10565b613a93565b60006109ed82613d1c565b806109fc57506109fc82613d3d565b92915050565b6097546001600160a01b03163314610a355760405162461bcd60e51b8152600401610a2c90615260565b60405180910390fd5b610a3f8282613d8d565b5050565b606060658054610a5290615295565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7e90615295565b8015610acb5780601f10610aa057610100808354040283529160200191610acb565b820191906000526020600020905b815481529060010190602001808311610aae57829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b0316610b4e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a2c565b506000908152606960205260409020546001600160a01b031690565b6000610b7582611a1b565b9050806001600160a01b0316836001600160a01b031603610be25760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a2c565b336001600160a01b0382161480610bfe5750610bfe813361327c565b610c705760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a2c565b610c7a8383613e8a565b505050565b336000908152610108602052604090205460ff1680610ca857506097546001600160a01b031633145b610cc45760405162461bcd60e51b8152600401610a2c906152cf565b600081815260ff6020526040902060fe548211801590610ce45750600082115b610d005760405162461bcd60e51b8152600401610a2c90615306565b805460ff1916600117905550565b6097546001600160a01b03163314610d385760405162461bcd60e51b8152600401610a2c90615260565b60005b61010654811015610a3f57816001600160a01b03166101068281548110610d6457610d6461532a565b6000918252602090912001546001600160a01b031603610e49576001600160a01b038216600090815261010560205260408120556101068054610da990600190615356565b81548110610db957610db961532a565b60009182526020909120015461010680546001600160a01b039092169183908110610de657610de661532a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550610106805480610e2657610e26615369565b600082815260209020810160001990810180546001600160a01b03191690550190555b80610e538161537f565b915050610d3b565b6101068181548110610e6c57600080fd5b6000918252602090912001546001600160a01b0316905081565b6097546001600160a01b03163314610eb05760405162461bcd60e51b8152600401610a2c90615260565b60fd80546001600160a01b0319166001600160a01b0392909216919091179055565b610edc3382613ef8565b610ef85760405162461bcd60e51b8152600401610a2c90615398565b610c7a838383613fcf565b600081815260ff6020908152604091829020600501805483518184028101840190945280845260609392830182828015610f5c57602002820191906000526020600020905b815481526020019060010190808311610f48575b50505050509050919050565b600082815260ca602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610fdd57506040805180820190915260c9546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610ffc906001600160601b0316876153e9565b6110069190615400565b91519350909150505b9250929050565b6097546001600160a01b031633146110405760405162461bcd60e51b8152600401610a2c90615260565b600083815260ff6020526040902060fe5484118015906110605750600084115b61107c5760405162461bcd60e51b8152600401610a2c90615422565b600481018054600180820183556000928352602080842090920180546001600160a01b0319166001600160a01b0397909716969096179095556005909201805494850181558152209091015550565b60ff602081905260009182526040909120805460018201546002830154600384015460068501805485881697610100870416966001600160801b036201000090970487169686811696600160801b9004811695169392909161112c90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461115890615295565b80156111a55780601f1061117a576101008083540402835291602001916111a5565b820191906000526020600020905b81548152906001019060200180831161118857829003601f168201915b5050505050908060070180546111ba90615295565b80601f01602080910402602001604051908101604052809291908181526020018280546111e690615295565b80156112335780601f1061120857610100808354040283529160200191611233565b820191906000526020600020905b81548152906001019060200180831161121657829003601f168201915b50505050509080600801805461124890615295565b80601f016020809104026020016040519081016040528092919081815260200182805461127490615295565b80156112c15780601f10611296576101008083540402835291602001916112c1565b820191906000526020600020905b8154815290600101906020018083116112a457829003601f168201915b5050505050908060090180546112d690615295565b80601f016020809104026020016040519081016040528092919081815260200182805461130290615295565b801561134f5780601f106113245761010080835404028352916020019161134f565b820191906000526020600020905b81548152906001019060200180831161133257829003601f168201915b50505050509080600a01805461136490615295565b80601f016020809104026020016040519081016040528092919081815260200182805461139090615295565b80156113dd5780601f106113b2576101008083540402835291602001916113dd565b820191906000526020600020905b8154815290600101906020018083116113c057829003601f168201915b505050505090508c565b6097546001600160a01b031633146114115760405162461bcd60e51b8152600401610a2c90615260565b60005b610106548110156114a55761010681815481106114335761143361532a565b6000918252602090912001546001600160a01b03908116908316036114935760405162461bcd60e51b81526020600482015260166024820152756d656d626572732065786973747320616c726561647960501b6044820152606401610a2c565b8061149d8161537f565b915050611414565b5061010680546001810182556000919091527fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b0180546001600160a01b0319166001600160a01b0392909216919091179055565b610c7a83838360405180602001604052806000815250612c6b565b6097546001600160a01b0316331461153e5760405162461bcd60e51b8152600401610a2c90615260565b85518751146115825760405162461bcd60e51b815260206004820152601060248201526f30b93930bcb99010b9b0b6b2903632b760811b6044820152606401610a2c565b604051806101c00160405280600060ff168152602001600060ff1681526020018b6001600160801b031681526020018a6001600160801b0316815260200160006001600160801b0316815260200160006001600160801b031681526020018981526020018881526020018781526020018681526020018581526020018481526020018381526020018281525060ff600060fe5460016116219190615445565b8152602080820192909252604090810160002083518154858501519386015160ff92831661ffff199092169190911761010092909416919091029290921771ffffffffffffffffffffffffffffffff00001916620100006001600160801b039384160217815560608401516080850151908316600160801b9184169190910217600182015560a08401516002820180546fffffffffffffffffffffffffffffffff1916919093161790915560c0830151600382015560e0830151805191926116f192600485019290910190614864565b50610100820151805161170e9160058401916020909101906148c9565b506101208201516006820190611724908261549e565b50610140820151600782019061173a908261549e565b506101608201516008820190611750908261549e565b506101808201516009820190611766908261549e565b506101a0820151600a82019061177c908261549e565b505060fe80549150600061178f8361537f565b909155505060fe80546000908152610101602052604090819020805460ff19166001179055905490517f77628c9166aca2fc4ccb8b7681fa345c93f54fb929f857d05cfebbfb665bad02916117e79190815260200190565b60405180910390a150505050505050505050565b6000611807600161404f565b9050801561181f576000805461ff0019166101001790555b6118276140dc565b61186c6040518060400160405280600681526020016509c8ca884def60d31b815250604051806040016040528060058152602001645b424f585d60d81b81525061410b565b600460fe556101068054600181810183557fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b91820180546001600160a01b0319908116733428b1746dfd26c7c725913d829be2706aa89b2e1790915583548083018555830180548216734125515f4e5a0db45316bf05a7c102c13e1e5ba117905583549182019093550180548216738c26a91205e531e8b35cf3315f384727b9681d7590811790915561010560205261024e7f7d659e613b32bfa5b74f8681bc7664e295657e1af00cc68a6c03243d54df91c855605a7f8bbb4218caa1843ecad093a73851b628879ba083835a7c224812bcb64887aae455600052601e7fe50f39bcb017ac26a0cd53de034250f561065e063eb6cbca33dde0ad00357e8d5560fc80548216735b8d524b10b8ea587da49f426a76396f80b7bc8417905560fd80546001600160a01b03868116918416919091179091556101078054918516919092161790558015610c7a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b6000818152606760205260408120546001600160a01b0316806109fc5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a2c565b60006001600160a01b038216611afd5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a2c565b506001600160a01b031660009081526068602052604090205490565b6097546001600160a01b03163314611b435760405162461bcd60e51b8152600401610a2c90615260565b611b4d600061413c565b565b6097546001600160a01b03163314611b795760405162461bcd60e51b8152600401610a2c90615260565b600082815260ff6020526040902060fe548311801590611b995750600083115b611bb55760405162461bcd60e51b8152600401610a2c90615422565b60005b6004820154811015611d3a57826001600160a01b0316826004018281548110611be357611be361532a565b6000918252602090912001546001600160a01b031603611d2857600482018054611c0f90600190615356565b81548110611c1f57611c1f61532a565b6000918252602090912001546004830180546001600160a01b039092169183908110611c4d57611c4d61532a565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600401805480611c8e57611c8e615369565b600082815260209020810160001990810180546001600160a01b0319169055019055600582018054611cc290600190615356565b81548110611cd257611cd261532a565b9060005260206000200154826005018281548110611cf257611cf261532a565b60009182526020909120015560058201805480611d1157611d11615369565b600190038181906000526020600020016000905590555b80611d328161537f565b915050611bb8565b50505050565b600081815260ff6020908152604091829020600401805483518184028101840190945280845260609392830182828015610f5c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611d855750505050509050919050565b336000908152610108602052604090205460ff1680611dd757506097546001600160a01b031633145b611df35760405162461bcd60e51b8152600401610a2c906152cf565b600083815260ff602052604090206001810154815460fe54600160801b9092046001600160801b039081169262010000909204169084908711801590611e395750600087115b611e555760405162461bcd60e51b8152600401610a2c90615422565b835460ff1615611e8f5760405162461bcd60e51b8152602060048201526005602482015264216c69766560d81b6044820152606401610a2c565b6000878152610101602052604090205460ff1615611ed85760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b6044820152606401610a2c565b6001600160801b0380831690611ef19087908616615445565b1115611f275760405162461bcd60e51b8152602060048201526005602482015264216d616e7960d81b6044820152606401610a2c565b60fb5460005b826001600160801b0316816001600160801b03161015611fb257611fa0858a6001600160801b0384168b8b82818110611f6857611f6861532a565b9050602002016020810190611f7d9190614a55565b611f906001600160801b03871688615445565b611f9b906001615445565b61418e565b80611faa8161555e565b915050611f2d565b50816001600160801b031660fb6000828254611fce9190615445565b9091555050600185018054839190601090611ffa908490600160801b90046001600160801b0316615584565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550816001600160801b031661010460008a8152602001908152602001600020600082825461204b9190615445565b90915550506001600160801b0383166120648386615584565b6001600160801b03160361207e57845460ff191660011785555b5050505050505050565b606060668054610a5290615295565b6097546001600160a01b031633146120c15760405162461bcd60e51b8152600401610a2c90615260565b6001600160a01b0391909116600090815261010860205260409020805460ff1916911515919091179055565b336000908152610108602052604090205460ff168061211657506097546001600160a01b031633145b6121325760405162461bcd60e51b8152600401610a2c906152cf565b60fe5482111580156121445750600082115b6121605760405162461bcd60e51b8152600401610a2c90615306565b60009182526101016020526040909120805460ff1916911515919091179055565b610a3f338383614241565b6097546001600160a01b031633146121b65760405162461bcd60e51b8152600401610a2c90615260565b60fe5481111580156121c85750600081115b6121e45760405162461bcd60e51b8152600401610a2c90615422565b600081815261010360205260408120805490826122008361537f565b919050559050600a81106122445760405162461bcd60e51b815260206004820152600b60248201526a44697374726f20646f6e6560a81b6044820152606401610a2c565b600082815260ff60205260408120600181015460fd549192600160801b9091046001600160801b0316916001600160a01b031663aaae61eb6122878660326153e9565b6040516001600160e01b031960e084901b168152600481019190915260326024820152604401600060405180830381865afa1580156122ca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122f291908101906155ab565b60fb54909150600090815b603281101561237057600084828151811061231a5761231a61532a565b6020026020010151905060006001600160a01b0316816001600160a01b03161461235d5761234f868a8684611f908289615445565b836123598161537f565b9450505b50806123688161537f565b9150506122fd565b508160fb60008282546123839190615445565b90915550506001850180548391906010906123af908490600160801b90046001600160801b0316615584565b82546101009290920a6001600160801b038181021990931691831602179091558654620100009004811691506123e89084908716615445565b036123f957845460ff191660011785555b8560090361246a5760fd60009054906101000a90046001600160a01b03166001600160a01b031663b8dea0956040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561245157600080fd5b505af1158015612465573d6000803e3d6000fd5b505050505b50505050505050565b600082815260ff602052604090206001810154815460fe54600160801b9092046001600160801b039081169262010000909204169085118015906124b75750600085115b6124d35760405162461bcd60e51b8152600401610a2c90615422565b825460ff161561250d5760405162461bcd60e51b8152602060048201526005602482015264216c69766560d81b6044820152606401610a2c565b6000858152610101602052604090205460ff16156125565760405162461bcd60e51b81526020600482015260066024820152651b1bd8dad95960d21b6044820152606401610a2c565b34846001600160801b0316846003015461257091906153e9565b146125a65760405162461bcd60e51b815260206004820152600660248201526521707269636560d01b6044820152606401610a2c565b6001600160801b0381166125ba8584615584565b6001600160801b031611156125f95760405162461bcd60e51b8152602060048201526005602482015264216d616e7960d81b6044820152606401610a2c565b60018301546000868152610102602090815260408083203384529091529020546001600160801b03918216916126329190871690615445565b11156126695760405162461bcd60e51b8152600401610a2c906020808252600490820152632162757960e01b604082015260600190565b60fb5460005b856001600160801b0316816001600160801b031610156126b5576126a384886001600160801b03841633611f908288615445565b806126ad8161555e565b91505061266f565b50846001600160801b031660fb60008282546126d19190615445565b90915550506001840180548691906010906126fd908490600160801b90046001600160801b0316615584565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550848460020160008282829054906101000a90046001600160801b03166127479190615584565b82546101009290920a6001600160801b03818102199093169183160217909155600088815261010260209081526040808320338452909152902054612790925090871690615445565b6000878152610102602090815260408083203384529091529020556001600160801b0382166127bf8685615584565b6001600160801b0316036127d957835460ff191660011784555b505050505050565b60008181526101006020818152604080842081518083018352815480825260019283015482860152865260ff80855283872084516101c08101865281548084168252978804909216828701526001600160801b036201000090970487168286015292830154808716606083810191909152600160801b90910487166080830152600284015490961660a0820152600383015460c0820152600483018054855181880281018801909652808652889788979096879687968796879691958c95919460e086019390929091908301828280156128e457602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116128c6575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561293c57602002820191906000526020600020905b815481526020019060010190808311612928575b5050505050815260200160068201805461295590615295565b80601f016020809104026020016040519081016040528092919081815260200182805461298190615295565b80156129ce5780601f106129a3576101008083540402835291602001916129ce565b820191906000526020600020905b8154815290600101906020018083116129b157829003601f168201915b505050505081526020016007820180546129e790615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612a1390615295565b8015612a605780601f10612a3557610100808354040283529160200191612a60565b820191906000526020600020905b815481529060010190602001808311612a4357829003601f168201915b50505050508152602001600882018054612a7990615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612aa590615295565b8015612af25780601f10612ac757610100808354040283529160200191612af2565b820191906000526020600020905b815481529060010190602001808311612ad557829003601f168201915b50505050508152602001600982018054612b0b90615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612b3790615295565b8015612b845780601f10612b5957610100808354040283529160200191612b84565b820191906000526020600020905b815481529060010190602001808311612b6757829003601f168201915b50505050508152602001600a82018054612b9d90615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612bc990615295565b8015612c165780601f10612beb57610100808354040283529160200191612c16565b820191906000526020600020905b815481529060010190602001808311612bf957829003601f168201915b5050505050815250509050816000015182602001518260400151836101200151846101400151856101600151866101800151876101a00151995099509950995099509950995099505050919395975091939597565b612c753383613ef8565b612c915760405162461bcd60e51b8152600401610a2c90615398565b611d3a8484848461430f565b60008181526101006020908152604091829020825180840190935280548084526001909101549183019190915260609190612cd757600080fd5b8051600090815260ff6020818152604080842081516101c08101835281548086168252610100810490951681850152620100009094046001600160801b039081168584015260018201548082166060870152600160801b90048116608086015260028201541660a0850152600381015460c0850152600481018054835181860281018601909452808452919360e08601939290830182828015612da357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612d85575b5050505050815260200160058201805480602002602001604051908101604052809291908181526020018280548015612dfb57602002820191906000526020600020905b815481526020019060010190808311612de7575b50505050508152602001600682018054612e1490615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612e4090615295565b8015612e8d5780601f10612e6257610100808354040283529160200191612e8d565b820191906000526020600020905b815481529060010190602001808311612e7057829003601f168201915b50505050508152602001600782018054612ea690615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612ed290615295565b8015612f1f5780601f10612ef457610100808354040283529160200191612f1f565b820191906000526020600020905b815481529060010190602001808311612f0257829003601f168201915b50505050508152602001600882018054612f3890615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612f6490615295565b8015612fb15780601f10612f8657610100808354040283529160200191612fb1565b820191906000526020600020905b815481529060010190602001808311612f9457829003601f168201915b50505050508152602001600982018054612fca90615295565b80601f0160208091040260200160405190810160405280929190818152602001828054612ff690615295565b80156130435780601f1061301857610100808354040283529160200191613043565b820191906000526020600020905b81548152906001019060200180831161302657829003601f168201915b50505050508152602001600a8201805461305c90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461308890615295565b80156130d55780601f106130aa576101008083540402835291602001916130d5565b820191906000526020600020905b8154815290600101906020018083116130b857829003601f168201915b50505091909252505061010754602085015161014084015161012085015161016086015160405163053e37e560e11b81529697506001600160a01b0390941695630a7c6fca95506131299490600401615645565b600060405180830381865afa158015613146573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261316e9190810190615684565b6101075483516020850151604080860151610140870151610180880151610160890151935163f9e1eb5f60e01b81526001600160a01b039097169663f9e1eb5f966131c296909590949392916004016156fb565b600060405180830381865afa1580156131df573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526132079190810190615684565b60405160200161321892919061575c565b60405160208183030381529060405292505050919050565b6097546001600160a01b0316331461325a5760405162461bcd60e51b8152600401610a2c90615260565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b6097546001600160a01b031633146132d45760405162461bcd60e51b8152600401610a2c90615260565b6103e88111156133265760405162461bcd60e51b815260206004820152601860248201527f7368617265206d7573742062652062656c6f77203130303000000000000000006044820152606401610a2c565b60005b61010654811015610c7a57826001600160a01b031661010682815481106133525761335261532a565b6000918252602090912001546001600160a01b031603613389576001600160a01b0383166000908152610105602052604090208290555b806133938161537f565b915050613329565b6097546001600160a01b031633146133c55760405162461bcd60e51b8152600401610a2c90615260565b6001600160a01b03811661342a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a2c565b6134338161413c565b50565b336000908152610108602052604090205460ff168061345f57506097546001600160a01b031633145b61347b5760405162461bcd60e51b8152600401610a2c906152cf565b600085815260ff6020818152604080842081516101c08101835281548086168252610100810490951681850152620100009094046001600160801b039081168584015260018201548082166060870152600160801b90048116608086015260028201541660a0850152600381015460c0850152600481018054835181860281018601909452808452919360e0860193929083018282801561354557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613527575b505050505081526020016005820180548060200260200160405190810160405280929190818152602001828054801561359d57602002820191906000526020600020905b815481526020019060010190808311613589575b505050505081526020016006820180546135b690615295565b80601f01602080910402602001604051908101604052809291908181526020018280546135e290615295565b801561362f5780601f106136045761010080835404028352916020019161362f565b820191906000526020600020905b81548152906001019060200180831161361257829003601f168201915b5050505050815260200160078201805461364890615295565b80601f016020809104026020016040519081016040528092919081815260200182805461367490615295565b80156136c15780601f10613696576101008083540402835291602001916136c1565b820191906000526020600020905b8154815290600101906020018083116136a457829003601f168201915b505050505081526020016008820180546136da90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461370690615295565b80156137535780601f1061372857610100808354040283529160200191613753565b820191906000526020600020905b81548152906001019060200180831161373657829003601f168201915b5050505050815260200160098201805461376c90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461379890615295565b80156137e55780601f106137ba576101008083540402835291602001916137e5565b820191906000526020600020905b8154815290600101906020018083116137c857829003601f168201915b50505050508152602001600a820180546137fe90615295565b80601f016020809104026020016040519081016040528092919081815260200182805461382a90615295565b80156138775780601f1061384c57610100808354040283529160200191613877565b820191906000526020600020905b81548152906001019060200180831161385a57829003601f168201915b5050505050815250509050806000015160ff166001146138c25760405162461bcd60e51b8152600401610a2c906020808252600490820152636c69766560e01b604082015260600190565b8185856000816138d4576138d461532a565b90506020028101906138e6919061578b565b9050146139215760405162461bcd60e51b815260206004820152600960248201526862616420617272617960b81b6044820152606401610a2c565b60005b84811015613a555760005b868660008181106139425761394261532a565b9050602002810190613954919061578b565b9050811015613a425760fc546001600160a01b031663e56e34798686848181106139805761398061532a565b905060200201358989868181106139995761399961532a565b90506020028101906139ab919061578b565b858181106139bb576139bb61532a565b90506020020160208101906139d09190614a55565b6040516001600160e01b031960e085901b16815260048101929092526001600160a01b03166024820152604401600060405180830381600087803b158015613a1757600080fd5b505af1158015613a2b573d6000803e3d6000fd5b505050508080613a3a9061537f565b91505061392f565b5080613a4d8161537f565b915050613924565b5060405184815286907fb3e821bfa4e118cf1cac28128930a4e53e59dd51d9e30c95ee100e4d3b0d2ef29060200160405180910390a2505050505050565b600081815260ff6020526040902060fe548211801590613ab35750600082115b613acf5760405162461bcd60e51b8152600401610a2c90615306565b805460ff166001148015613aea57508054610100900460ff16155b613b245760405162461bcd60e51b815260206004820152600b60248201526a216469737472696275746560a81b6044820152606401610a2c565b613b2d82614342565b613b685760405162461bcd60e51b815260206004820152600c60248201526b39bab690109e90189818129760a11b6044820152606401610a2c565b805461ff00191661010017815560038101546002820154600091613b94916001600160801b03166153e9565b90506000805b61010654811015613c63576103e861010560006101068481548110613bc157613bc161532a565b60009182526020808320909101546001600160a01b03168352820192909252604001902054613bf090856153e9565b613bfa9190615400565b91506101068181548110613c1057613c1061532a565b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015613c50573d6000803e3d6000fd5b5080613c5b8161537f565b915050613b9a565b5060005b6004840154811015613d15576103e8846005018281548110613c8b57613c8b61532a565b906000526020600020015484613ca191906153e9565b613cab9190615400565b9150836004018181548110613cc257613cc261532a565b60009182526020822001546040516001600160a01b039091169184156108fc02918591818181858888f19350505050158015613d02573d6000803e3d6000fd5b5080613d0d8161537f565b915050613c67565b5050505050565b60006001600160e01b0319821663152a902d60e11b14806109fc57506109fc825b60006001600160e01b031982166380ac58cd60e01b1480613d6e57506001600160e01b03198216635b5e139f60e01b145b806109fc57506301ffc9a760e01b6001600160e01b03198316146109fc565b6127106001600160601b0382161115613dfb5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610a2c565b6001600160a01b038216613e515760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610a2c565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b9091021760c955565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613ebf82611a1b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b0316613f715760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a2c565b6000613f7c83611a1b565b9050806001600160a01b0316846001600160a01b03161480613fa35750613fa3818561327c565b80613fc75750836001600160a01b0316613fbc84610ad5565b6001600160a01b0316145b949350505050565b600081815261010060209081526040808320815180830183528154808252600190920154818501529084526101019092529091205460ff16156140445760405162461bcd60e51b815260206004820152600d60248201526c109bde081a5cc81b1bd8dad959609a1b6044820152606401610a2c565b611d3a848484614415565b60008054610100900460ff1615614096578160ff1660011480156140725750303b155b61408e5760405162461bcd60e51b8152600401610a2c906157d5565b506000919050565b60005460ff8084169116106140bd5760405162461bcd60e51b8152600401610a2c906157d5565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff166141035760405162461bcd60e51b8152600401610a2c90615823565b611b4d6145b1565b600054610100900460ff166141325760405162461bcd60e51b8152600401610a2c90615823565b610a3f82826145e1565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051806040016040528085815260200184876001600160801b03166141b49190615445565b6141bf906001615445565b905260008281526101006020908152604090912082518155910151600190910155837f5420392aab8a9f3a70c0145321ff58bc86c3da3596336224396de59f430fc0f5614215856001600160801b038916615445565b614220906001615445565b60408051918252602082018590520160405180910390a2613d158282614621565b816001600160a01b0316836001600160a01b0316036142a25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a2c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61431a848484613fcf565b61432684848484614763565b611d3a5760405162461bcd60e51b8152600401610a2c9061586e565b600081815260ff6020526040812081805b610106548110156143ba57610105600061010683815481106143775761437761532a565b60009182526020808320909101546001600160a01b031683528201929092526040019020546143a69083615445565b9150806143b28161537f565b915050614353565b5060005b6005830154811015614409578260050181815481106143df576143df61532a565b9060005260206000200154826143f59190615445565b9150806144018161537f565b9150506143be565b506103e8149392505050565b826001600160a01b031661442882611a1b565b6001600160a01b03161461448c5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610a2c565b6001600160a01b0382166144ee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a2c565b6144f9600082613e8a565b6001600160a01b0383166000908152606860205260408120805460019290614522908490615356565b90915550506001600160a01b0382166000908152606860205260408120805460019290614550908490615445565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600054610100900460ff166145d85760405162461bcd60e51b8152600401610a2c90615823565b611b4d3361413c565b600054610100900460ff166146085760405162461bcd60e51b8152600401610a2c90615823565b6065614614838261549e565b506066610c7a828261549e565b6001600160a01b0382166146775760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a2c565b6000818152606760205260409020546001600160a01b0316156146dc5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a2c565b6001600160a01b0382166000908152606860205260408120805460019290614705908490615445565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b1561485957604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906147a79033908990889088906004016158c0565b6020604051808303816000875af19250505080156147e2575060408051601f3d908101601f191682019092526147df918101906158fd565b60015b61483f573d808015614810576040519150601f19603f3d011682016040523d82523d6000602084013e614815565b606091505b5080516000036148375760405162461bcd60e51b8152600401610a2c9061586e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613fc7565b506001949350505050565b8280548282559060005260206000209081019282156148b9579160200282015b828111156148b957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614884565b506148c5929150614904565b5090565b8280548282559060005260206000209081019282156148b9579160200282015b828111156148b95782518255916020019190600101906148e9565b5b808211156148c55760008155600101614905565b6001600160e01b03198116811461343357600080fd5b60006020828403121561494157600080fd5b813561494c81614919565b9392505050565b6001600160a01b038116811461343357600080fd5b6000806040838503121561497b57600080fd5b823561498681614953565b915060208301356001600160601b03811681146149a257600080fd5b809150509250929050565b60005b838110156149c85781810151838201526020016149b0565b50506000910152565b600081518084526149e98160208601602086016149ad565b601f01601f19169290920160200192915050565b60208152600061494c60208301846149d1565b600060208284031215614a2257600080fd5b5035919050565b60008060408385031215614a3c57600080fd5b8235614a4781614953565b946020939093013593505050565b600060208284031215614a6757600080fd5b813561494c81614953565b600080600060608486031215614a8757600080fd5b8335614a9281614953565b92506020840135614aa281614953565b929592945050506040919091013590565b6020808252825182820181905260009190848201906040850190845b81811015614aeb57835183529284019291840191600101614acf565b50909695505050505050565b60008060408385031215614b0a57600080fd5b50508035926020909101359150565b600080600060608486031215614b2e57600080fd5b833592506020840135614aa281614953565b60ff8d811682528c16602082015260006101806001600160801b038d1660408401526001600160801b038c1660608401526001600160801b038b1660808401526001600160801b038a1660a08401528860c08401528060e0840152614ba7818401896149d1565b9050828103610100840152614bbc81886149d1565b9050828103610120840152614bd181876149d1565b9050828103610140840152614be681866149d1565b9050828103610160840152614bfb81856149d1565b9f9e505050505050505050505050505050565b80356001600160801b03811681146140d757600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614c6457614c64614c25565b604052919050565b600067ffffffffffffffff821115614c8657614c86614c25565b5060051b60200190565b600082601f830112614ca157600080fd5b81356020614cb6614cb183614c6c565b614c3b565b82815260059290921b84018101918181019086841115614cd557600080fd5b8286015b84811015614cf9578035614cec81614953565b8352918301918301614cd9565b509695505050505050565b600082601f830112614d1557600080fd5b81356020614d25614cb183614c6c565b82815260059290921b84018101918181019086841115614d4457600080fd5b8286015b84811015614cf95780358352918301918301614d48565b600067ffffffffffffffff821115614d7957614d79614c25565b50601f01601f191660200190565b6000614d95614cb184614d5f565b9050828152838383011115614da957600080fd5b828260208301376000602084830101529392505050565b600082601f830112614dd157600080fd5b61494c83833560208501614d87565b6000806000806000806000806000806101408b8d031215614e0057600080fd5b614e098b614c0e565b9950614e1760208c01614c0e565b985060408b0135975060608b013567ffffffffffffffff80821115614e3b57600080fd5b614e478e838f01614c90565b985060808d0135915080821115614e5d57600080fd5b614e698e838f01614d04565b975060a08d0135915080821115614e7f57600080fd5b614e8b8e838f01614dc0565b965060c08d0135915080821115614ea157600080fd5b614ead8e838f01614dc0565b955060e08d0135915080821115614ec357600080fd5b614ecf8e838f01614dc0565b94506101008d0135915080821115614ee657600080fd5b614ef28e838f01614dc0565b93506101208d0135915080821115614f0957600080fd5b50614f168d828e01614dc0565b9150509295989b9194979a5092959850565b60008060408385031215614f3b57600080fd5b8235614f4681614953565b915060208301356149a281614953565b60008060408385031215614f6957600080fd5b8235915060208301356149a281614953565b6020808252825182820181905260009190848201906040850190845b81811015614aeb5783516001600160a01b031683529284019291840191600101614f97565b60008083601f840112614fce57600080fd5b50813567ffffffffffffffff811115614fe657600080fd5b6020830191508360208260051b850101111561100f57600080fd5b60008060006040848603121561501657600080fd5b83359250602084013567ffffffffffffffff81111561503457600080fd5b61504086828701614fbc565b9497909650939450505050565b803580151581146140d757600080fd5b6000806040838503121561507057600080fd5b823561507b81614953565b91506150896020840161504d565b90509250929050565b600080604083850312156150a557600080fd5b823591506150896020840161504d565b600080604083850312156150c857600080fd5b8235915061508960208401614c0e565b60006101008a83528960208401526001600160801b0389166040840152806060840152615107818401896149d1565b9050828103608084015261511b81886149d1565b905082810360a084015261512f81876149d1565b905082810360c084015261514381866149d1565b905082810360e084015261515781856149d1565b9b9a5050505050505050505050565b6000806000806080858703121561517c57600080fd5b843561518781614953565b9350602085013561519781614953565b925060408501359150606085013567ffffffffffffffff8111156151ba57600080fd5b8501601f810187136151cb57600080fd5b6151da87823560208401614d87565b91505092959194509250565b6000806000806000606086880312156151fe57600080fd5b85359450602086013567ffffffffffffffff8082111561521d57600080fd5b61522989838a01614fbc565b9096509450604088013591508082111561524257600080fd5b5061524f88828901614fbc565b969995985093965092949392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806152a957607f821691505b6020821081036152c957634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601a908201527f4e6f7420617574686f726973656420746f20657865637574652e000000000000604082015260600190565b6020808252600a908201526924a21010b2bc34b9ba1760b11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156109fc576109fc615340565b634e487b7160e01b600052603160045260246000fd5b60006001820161539157615391615340565b5060010190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820281158282048414176109fc576109fc615340565b60008261541d57634e487b7160e01b600052601260045260246000fd5b500490565b60208082526009908201526812510808595e1a5cdd60ba1b604082015260600190565b808201808211156109fc576109fc615340565b601f821115610c7a57600081815260208120601f850160051c8101602086101561547f5750805b601f850160051c820191505b818110156127d95782815560010161548b565b815167ffffffffffffffff8111156154b8576154b8614c25565b6154cc816154c68454615295565b84615458565b602080601f83116001811461550157600084156154e95750858301515b600019600386901b1c1916600185901b1785556127d9565b600085815260208120601f198616915b8281101561553057888601518255948401946001909101908401615511565b508582101561554e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006001600160801b0380831681810361557a5761557a615340565b6001019392505050565b6001600160801b038181168382160190808211156155a4576155a4615340565b5092915050565b600060208083850312156155be57600080fd5b825167ffffffffffffffff8111156155d557600080fd5b8301601f810185136155e657600080fd5b80516155f4614cb182614c6c565b81815260059190911b8201830190838101908783111561561357600080fd5b928401925b8284101561563a57835161562b81614953565b82529284019290840190615618565b979650505050505050565b84815260806020820152600061565e60808301866149d1565b828103604084015261567081866149d1565b9050828103606084015261563a81856149d1565b60006020828403121561569657600080fd5b815167ffffffffffffffff8111156156ad57600080fd5b8201601f810184136156be57600080fd5b80516156cc614cb182614d5f565b8181528560208385010111156156e157600080fd5b6156f28260208301602086016149ad565b95945050505050565b8681528560208201526001600160801b038516604082015260c06060820152600061572960c08301866149d1565b828103608084015261573b81866149d1565b905082810360a084015261574f81856149d1565b9998505050505050505050565b6000835161576e8184602088016149ad565b8351908301906157828183602088016149ad565b01949350505050565b6000808335601e198436030181126157a257600080fd5b83018035915067ffffffffffffffff8211156157bd57600080fd5b6020019150600581901b360382131561100f57600080fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906158f3908301846149d1565b9695505050505050565b60006020828403121561590f57600080fd5b815161494c8161491956fea264697066735822122007f0e5581bb6c0ece97be9e59990885831e95eea0a1b45348c537903b5f8a9d064736f6c63430008110033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.