Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 46 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim | 15575254 | 944 days ago | IN | 0 ETH | 0.00215072 | ||||
Claim | 15131761 | 1013 days ago | IN | 0 ETH | 0.00353791 | ||||
Claim | 15017345 | 1032 days ago | IN | 0 ETH | 0.00293849 | ||||
Claim | 15017341 | 1032 days ago | IN | 0 ETH | 0.00305637 | ||||
Claim | 15017321 | 1032 days ago | IN | 0 ETH | 0.00344846 | ||||
Claim | 15017305 | 1032 days ago | IN | 0 ETH | 0.00342065 | ||||
Claim | 14902446 | 1052 days ago | IN | 0 ETH | 0.0057402 | ||||
Claim | 14813842 | 1066 days ago | IN | 0 ETH | 0.0039614 | ||||
Claim | 14813624 | 1066 days ago | IN | 0 ETH | 0.00318985 | ||||
Claim | 14802786 | 1068 days ago | IN | 0 ETH | 0.00375588 | ||||
Claim | 14511741 | 1114 days ago | IN | 0 ETH | 0.00619912 | ||||
Claim | 14449818 | 1124 days ago | IN | 0 ETH | 0.00713027 | ||||
Claim | 14139949 | 1172 days ago | IN | 0 ETH | 0.01884087 | ||||
Claim | 14084568 | 1180 days ago | IN | 0 ETH | 0.03714026 | ||||
Claim | 13886623 | 1211 days ago | IN | 0 ETH | 0.00699916 | ||||
Claim | 13879967 | 1212 days ago | IN | 0 ETH | 0.00562996 | ||||
Claim | 13873858 | 1213 days ago | IN | 0 ETH | 0.00754917 | ||||
Claim | 13867234 | 1214 days ago | IN | 0 ETH | 0.0128228 | ||||
Claim | 13857862 | 1215 days ago | IN | 0 ETH | 0.03376331 | ||||
Claim | 13857857 | 1215 days ago | IN | 0 ETH | 0.01494344 | ||||
Claim | 13857855 | 1215 days ago | IN | 0 ETH | 0.01563783 | ||||
Claim | 13856362 | 1215 days ago | IN | 0 ETH | 0.01502403 | ||||
Claim | 13855593 | 1216 days ago | IN | 0 ETH | 0.01063796 | ||||
Claim | 13855591 | 1216 days ago | IN | 0 ETH | 0.01035225 | ||||
Claim | 13853143 | 1216 days ago | IN | 0 ETH | 0.00874053 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
PlanetsModule
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '../NiftyForge/INiftyForge721.sol'; import '../NiftyForge/Modules/NFBaseModule.sol'; import '../NiftyForge/Modules/INFModuleTokenURI.sol'; import '../NiftyForge/Modules/INFModuleRenderTokenURI.sol'; import '../NiftyForge/Modules/INFModuleWithRoyalties.sol'; import '../v2/AstragladeUpgrade.sol'; import '../ERC2981/IERC2981Royalties.sol'; import '../libraries/Randomize.sol'; import '../libraries/Base64.sol'; /// @title PlanetsModule /// @author Simon Fremaux (@dievardump) contract PlanetsModule is Ownable, NFBaseModule, INFModuleTokenURI, INFModuleRenderTokenURI, INFModuleWithRoyalties { // using ECDSA for bytes32; using Strings for uint256; using Randomize for Randomize.Random; uint256 constant SEED_BOUND = 1000000000; // emitted when planets are claimed event PlanetsClaimed(uint256[] tokenIds); // contract actually holding the planets address public planetsContract; // astraglade contract to claim ids from address public astragladeContract; // contract operator next to the owner address public contractOperator = address(0xD1edDfcc4596CC8bD0bd7495beaB9B979fc50336); // project base render URI string private _baseRenderURI; // whenever all images are uploaded on arweave/ipfs and // this flag allows to stop all update of images, scripts etc... bool public frozenMeta; // base image rendering URI // before all Planets are minted, images will be stored on our servers since // they need to be generated after minting // after all planets are minted, they will all be stored in a decentralized way // and the _baseImagesURI will be updated string private _baseImagesURI; // project description string internal _description; address[3] public feeRecipients = [ 0xe4657aF058E3f844919c3ee713DF09c3F2949447, 0xb275E5aa8011eA32506a91449B190213224aEc1e, 0xdAC81C3642b520584eD0E743729F238D1c350E62 ]; mapping(uint256 => bytes32) public planetSeed; // saving already taken seeds to ensure not reusing a seed mapping(uint256 => bool) public seedTaken; modifier onlyOperator() { require(isOperator(msg.sender), 'Not operator.'); _; } function isOperator(address operator) public view returns (bool) { return owner() == operator || contractOperator == operator; } /// @dev Receive, for royalties receive() external payable {} /// @notice constructor /// @param contractURI_ The contract URI (containing its metadata) - can be empty "" /// @param owner_ Address to whom transfer ownership (can be address(0), then owner is deployer) /// @param astragladeContract_ the contract holding the astraglades constructor( string memory contractURI_, address owner_, address planetsContract_, address astragladeContract_ ) NFBaseModule(contractURI_) { planetsContract = planetsContract_; astragladeContract = astragladeContract_; if (address(0) != owner_) { transferOwnership(owner_); } } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(INFModuleTokenURI).interfaceId || interfaceId == type(INFModuleRenderTokenURI).interfaceId || interfaceId == type(INFModuleWithRoyalties).interfaceId || super.supportsInterface(interfaceId); } /// @inheritdoc INFModuleWithRoyalties function royaltyInfo(uint256 tokenId) public view override returns (address, uint256) { return royaltyInfo(msg.sender, tokenId); } /// @inheritdoc INFModuleWithRoyalties function royaltyInfo(address, uint256) public view override returns (address receiver, uint256 basisPoint) { receiver = address(this); basisPoint = 1000; } /// @inheritdoc INFModuleTokenURI function tokenURI(uint256 tokenId) public view override returns (string memory) { return tokenURI(msg.sender, tokenId); } /// @inheritdoc INFModuleTokenURI function tokenURI(address, uint256 tokenId) public view override returns (string memory) { ( uint256 seed, uint256 astragladeSeed, uint256[] memory attributes ) = getPlanetData(tokenId); return string( abi.encodePacked( 'data:application/json;base64,', Base64.encode( abi.encodePacked( '{"name":"Planet - ', tokenId.toString(), '","license":"CC BY-SA 4.0","description":"', getDescription(), '","created_by":"Fabin Rasheed","twitter":"@astraglade","image":"', abi.encodePacked( getBaseImageURI(), tokenId.toString() ), '","seed":"', seed.toString(), abi.encodePacked( '","astragladeSeed":"', astragladeSeed.toString(), '","attributes":[', _generateJSONAttributes(attributes), '],"animation_url":"', _renderTokenURI( seed, astragladeSeed, attributes ), '"}' ) ) ) ) ); } /// @notice function that returns a string that can be used to render the current token /// @param tokenId tokenId /// @return the URI to render token function renderTokenURI(uint256 tokenId) public view override returns (string memory) { return renderTokenURI(msg.sender, tokenId); } /// @notice function that returns a string that can be used to render the current token /// @param tokenId tokenId /// @return the URI to render token function renderTokenURI(address, uint256 tokenId) public view override returns (string memory) { ( uint256 seed, uint256 astragladeSeed, uint256[] memory attributes ) = getPlanetData(tokenId); return _renderTokenURI(seed, astragladeSeed, attributes); } /// @notice Helper returning all data for a Planet /// @param tokenId the planet id /// @return the planet seed, the astraglade seed and the planet attributes (the integer form) function getPlanetData(uint256 tokenId) public view returns ( uint256, uint256, uint256[] memory ) { require(planetSeed[tokenId] != 0, '!UNKNOWN_TOKEN!'); uint256 seed = uint256(planetSeed[tokenId]) % SEED_BOUND; uint256[] memory attributes = _getAttributes(seed); AstragladeUpgrade.AstragladeMeta memory astraglade = AstragladeUpgrade( payable(astragladeContract) ).getAstraglade(tokenId); return (seed, astraglade.seed, attributes); } /// @notice Returns Metadata for Astraglade id /// @param tokenId the tokenId we want metadata for function getAstraglade(uint256 tokenId) public view returns (AstragladeUpgrade.AstragladeMeta memory astraglade) { return AstragladeUpgrade(payable(astragladeContract)).getAstraglade( tokenId ); } /// @notice helper to get the description function getDescription() public view returns (string memory) { if (bytes(_description).length == 0) { return "Astraglade Planets is an extension of project Astraglade (https://nurecas.com/astraglade). Planets are an interactive and generative 3D art that can be minted for free by anyone who owns an astraglade at [https://astraglade.beyondnft.io/planets/](https://astraglade.beyondnft.io/planets/). When a Planet is minted, the owner's astraglade will orbit forever around the planet that they mint."; } return _description; } /// @notice helper to get the baseRenderURI function getBaseRenderURI() public view returns (string memory) { if (bytes(_baseRenderURI).length == 0) { return 'ar://JYtFvtxlpyur2Cdpaodmo46XzuTpmp0OwJl13rFUrrg/'; } return _baseRenderURI; } /// @notice helper to get the baseImageURI function getBaseImageURI() public view returns (string memory) { if (bytes(_baseImagesURI).length == 0) { return 'https://astraglade-api.beyondnft.io/planets/images/'; } return _baseImagesURI; } /// @inheritdoc INFModule function onAttach() external virtual override(INFModule, NFBaseModule) returns (bool) { // only the first attach is accepted, saves a "setPlanetsContract" call if (planetsContract == address(0)) { planetsContract = msg.sender; return true; } return false; } /// @notice Claim tokenIds[] from the astraglade contract /// @param tokenIds the tokenIds to claim function claim(uint256[] calldata tokenIds) external { address operator = msg.sender; // saves some reads address astragladeContract_ = astragladeContract; address planetsContract_ = planetsContract; for (uint256 i; i < tokenIds.length; i++) { _claim( operator, tokenIds[i], astragladeContract_, planetsContract_ ); } } /// @notice Allows to freeze any metadata update function freezeMeta() external onlyOperator { frozenMeta = true; } /// @notice sets contract uri /// @param newURI the new uri function setContractURI(string memory newURI) external onlyOperator { _setContractURI(newURI); } /// @notice sets planets contract /// @param planetsContract_ the contract containing planets function setPlanetsContract(address planetsContract_) external onlyOperator { planetsContract = planetsContract_; } /// @notice helper to set the description /// @param newDescription the new description function setDescription(string memory newDescription) external onlyOperator { require(frozenMeta == false, '!META_FROZEN!'); _description = newDescription; } /// @notice helper to set the baseRenderURI /// @param newRenderURI the new renderURI function setBaseRenderURI(string memory newRenderURI) external onlyOperator { require(frozenMeta == false, '!META_FROZEN!'); _baseRenderURI = newRenderURI; } /// @notice helper to set the baseImageURI /// @param newBaseImagesURI the new base image URI function setBaseImagesURI(string memory newBaseImagesURI) external onlyOperator { require(frozenMeta == false, '!META_FROZEN!'); _baseImagesURI = newBaseImagesURI; } /// @dev Owner withdraw balance function function withdraw() external onlyOperator { address[3] memory feeRecipients_ = feeRecipients; uint256 balance_ = address(this).balance; payable(address(feeRecipients_[0])).transfer((balance_ * 30) / 100); payable(address(feeRecipients_[1])).transfer((balance_ * 35) / 100); payable(address(feeRecipients_[2])).transfer(address(this).balance); } /// @notice helper to set the fee recipient at `index` /// @param newFeeRecipient the new address /// @param index the index to edit function setFeeRecipient(address newFeeRecipient, uint8 index) external onlyOperator { require(index < feeRecipients.length, '!INDEX_OVERFLOW!'); require(newFeeRecipient != address(0), '!INVALID_ADDRESS!'); feeRecipients[index] = newFeeRecipient; } /// @notice Helper for an operator to change the current operator address /// @param newOperator the new operator function setContractOperator(address newOperator) external onlyOperator { contractOperator = newOperator; } /// @dev Allows to claim a tokenId; the Planet will always be minted to the owner of the Astraglade /// @param operator the one launching the claim (needs to be owner or approved on the Astraglade) /// @param tokenId the Astraglade tokenId to claim /// @param astragladeContract_ the Astraglade contract to check ownership /// @param planetsContract_ the Planet contract (where to mint the tokens) function _claim( address operator, uint256 tokenId, address astragladeContract_, address planetsContract_ ) internal { AstragladeUpgrade astraglade = AstragladeUpgrade( payable(astragladeContract_) ); address owner_ = astraglade.ownerOf(tokenId); // verify that the operator has the right to claim require( owner_ == operator || astraglade.isApprovedForAll(owner_, operator) || astraglade.getApproved(tokenId) == operator, '!NOT_AUTHORIZED!' ); // mint INiftyForge721 planets = INiftyForge721(planetsContract_); // always mint to owner_, not to operator planets.mint(owner_, '', tokenId, address(0), 0, address(0)); // creates a seed bytes32 seed; do { seed = _generateSeed( tokenId, block.timestamp, owner_, blockhash(block.number - 1) ); } while (seedTaken[uint256(seed) % SEED_BOUND]); planetSeed[tokenId] = seed; // ensure we won't have two seeds rendering the same planet seedTaken[uint256(seed) % SEED_BOUND] = true; } /// @dev Calculate next seed using a few on chain data /// @param tokenId tokenId /// @param timestamp current block timestamp /// @param operator current operator /// @param blockHash last block hash /// @return a new bytes32 seed function _generateSeed( uint256 tokenId, uint256 timestamp, address operator, bytes32 blockHash ) internal view returns (bytes32) { return keccak256( abi.encodePacked( tokenId, timestamp, operator, blockHash, block.coinbase, block.difficulty, tx.gasprice ) ); } /// @notice generates the attributes values according to seed /// @param seed the seed to generate the values /// @return attributes an array of attributes (integers) function _getAttributes(uint256 seed) internal pure returns (uint256[] memory attributes) { Randomize.Random memory random = Randomize.Random({seed: seed}); // remember, all numbers returned by randomBetween are // multiplicated by 1000, because solidity has no decimals // so we will divide all those numbers later attributes = new uint256[](6); // density attributes[0] = random.randomBetween(10, 200); // radius attributes[1] = random.randomBetween(5, 15); // cube planet attributes[2] = random.randomBetween(0, 5000); if (attributes[2] < 20000) { // set radius = 10 if cube attributes[1] = 10000; } // shade - remember to actually change 1 into -1 in the HTML attributes[3] = random.randomBetween(0, 2) < 1000 ? 0 : 1; // rings // if cube, 2 or 3 rings if (attributes[2] < 20000) { attributes[4] = random.randomBetween(2, 4) / 1000; } else { // else 30% chances to have rings (1, 2 and 3) attributes[4] = random.randomBetween(0, 10) / 1000; // if more than 3, then none. if (attributes[4] > 3) { attributes[4] = 0; } } // moons, 0, 1, 2 or 3 attributes[5] = random.randomBetween(0, 4) / 1000; } /// @notice Generates the JSON string from the attributes values /// @param attributes the attributes values /// @return jsonAttributes, the string for attributes function _generateJSONAttributes(uint256[] memory attributes) internal pure returns (string memory) { bytes memory coma = bytes(','); // Terrain bytes memory jsonAttributes = abi.encodePacked( _makeAttributes( 'Terrain', attributes[0] < 50000 ? 'Dense' : 'Sparse' ), coma ); // Size if (attributes[1] < 8000) { jsonAttributes = abi.encodePacked( jsonAttributes, _makeAttributes('Size', 'Tiny'), coma ); } else if (attributes[1] < 12000) { jsonAttributes = abi.encodePacked( jsonAttributes, _makeAttributes('Size', 'Medium'), coma ); } else { jsonAttributes = abi.encodePacked( jsonAttributes, _makeAttributes('Size', 'Giant'), coma ); } // Form jsonAttributes = abi.encodePacked( jsonAttributes, _makeAttributes( 'Form', attributes[2] < 20000 ? 'Tesseract' : 'Geo' ), coma, _makeAttributes('Shade', attributes[3] == 0 ? 'Vibrant' : 'Simple'), coma, _makeAttributes('Rings', attributes[4].toString()), coma, _makeAttributes('Moons', attributes[5].toString()) ); return string(jsonAttributes); } function _makeAttributes(string memory name_, string memory value) internal pure returns (bytes memory) { return abi.encodePacked( '{"trait_type":"', name_, '","value":"', value, '"}' ); } /// @notice returns the URL to render the Planet /// @param seed the planet seed /// @param astragladeSeed the astraglade seed /// @param attributes all attributes needed for the planets /// @return the URI to render the planet function _renderTokenURI( uint256 seed, uint256 astragladeSeed, uint256[] memory attributes ) internal view returns (string memory) { bytes memory coma = bytes(','); bytes memory attrs = abi.encodePacked( attributes[0].toString(), coma, attributes[1].toString(), coma, attributes[2].toString(), coma ); return string( abi.encodePacked( getBaseRenderURI(), '?seed=', seed.toString(), '&astragladeSeed=', astragladeSeed.toString(), '&attributes=', abi.encodePacked( attrs, attributes[3].toString(), coma, attributes[4].toString(), coma, attributes[5].toString() ) ) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev 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 {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title IERC2981Royalties /// @dev Interface for the ERC2981 - Token Royalty standard interface IERC2981Royalties { /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _value - the sale price of the NFT asset specified by _tokenId /// @return _receiver - address of who should be sent the royalty payment /// @return _royaltyAmount - the royalty payment amount for value sale price function royaltyInfo(uint256 _tokenId, uint256 _value) external view returns (address _receiver, uint256 _royaltyAmount); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import './OpenSea/BaseOpenSea.sol'; /// @title ERC721Ownable /// @author Simon Fremaux (@dievardump) contract ERC721Ownable is Ownable, ERC721Enumerable, BaseOpenSea { /// @notice constructor /// @param name_ name of the contract (see ERC721) /// @param symbol_ symbol of the contract (see ERC721) /// @param contractURI_ The contract URI (containing its metadata) - can be empty "" /// @param openseaProxyRegistry_ OpenSea's proxy registry to allow gas-less listings - can be address(0) /// @param owner_ Address to whom transfer ownership (can be address(0), then owner is deployer) constructor( string memory name_, string memory symbol_, string memory contractURI_, address openseaProxyRegistry_, address owner_ ) ERC721(name_, symbol_) { // set contract uri if present if (bytes(contractURI_).length > 0) { _setContractURI(contractURI_); } // set OpenSea proxyRegistry for gas-less trading if present if (address(0) != openseaProxyRegistry_) { _setOpenSeaRegistry(openseaProxyRegistry_); } // transferOwnership if needed if (address(0) != owner_) { transferOwnership(owner_); } } /// @notice Allows to burn a tokenId /// @dev Burns `tokenId`. See {ERC721-_burn}. The caller must own `tokenId` or be an approved operator. /// @param tokenId the tokenId to burn function burn(uint256 tokenId) public virtual { require( _isApprovedOrOwner(_msgSender(), tokenId), 'ERC721Burnable: caller is not owner nor approved' ); _burn(tokenId); } /// @notice Allows gas-less trading on OpenSea by safelisting the Proxy of the user /// @dev Override isApprovedForAll to check first if current operator is owner's OpenSea proxy /// @inheritdoc ERC721 function isApprovedForAll(address owner, address operator) public view override returns (bool) { // allows gas less trading on OpenSea if (isOwnersOpenSeaProxy(owner, operator)) { return true; } return super.isApprovedForAll(owner, operator); } /// @notice Helper for the owner of the contract to set the new contract URI /// @dev needs to be owner /// @param contractURI_ new contract URI function setContractURI(string memory contractURI_) external onlyOwner { _setContractURI(contractURI_); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.9; /// @title INiftyForge721 /// @author Simon Fremaux (@dievardump) interface INiftyForge721 { struct ModuleInit { address module; bool enabled; bool minter; } /// @notice totalSupply access function totalSupply() external view returns (uint256); /// @notice helper to know if everyone can mint or only minters function isMintingOpenToAll() external view returns (bool); /// @notice Toggle minting open to all state /// @param isOpen if the new state is open or not function setMintingOpenToAll(bool isOpen) external; /// @notice Mint token to `to` with `uri` /// @param to address of recipient /// @param uri token metadata uri /// @param feeRecipient the recipient of royalties /// @param feeAmount the royalties amount. From 0 to 10000 /// where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50% /// @param transferTo the address to transfer the NFT to after mint /// this is used when we want to mint the NFT to the creator address /// before transferring it to a recipient /// @return tokenId the tokenId function mint( address to, string memory uri, address feeRecipient, uint256 feeAmount, address transferTo ) external returns (uint256 tokenId); /// @notice Mint batch tokens to `to[i]` with `uri[i]` /// @param to array of address of recipients /// @param uris array of token metadata uris /// @param feeRecipients the recipients of royalties for each id /// @param feeAmounts the royalties amounts for each id. From 0 to 10000 /// where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50% /// @return tokenIds the tokenIds function mintBatch( address[] memory to, string[] memory uris, address[] memory feeRecipients, uint256[] memory feeAmounts ) external returns (uint256[] memory tokenIds); /// @notice Mint `tokenId` to to` with `uri` /// Because not all tokenIds have incremental ids /// be careful with this function, it does not increment lastTokenId /// and expects the minter to actually know what it is doing. /// this also means, this function does not verify _maxTokenId /// @param to address of recipient /// @param uri token metadata uri /// @param tokenId token id wanted /// @param feeRecipient the recipient of royalties /// @param feeAmount the royalties amount. From 0 to 10000 /// where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50% /// @param transferTo the address to transfer the NFT to after mint /// this is used when we want to mint the NFT to the creator address /// before transferring it to a recipient /// @return tokenId the tokenId function mint( address to, string memory uri, uint256 tokenId_, address feeRecipient, uint256 feeAmount, address transferTo ) external returns (uint256 tokenId); /// @notice Mint batch tokens to `to[i]` with `uris[i]` /// Because not all tokenIds have incremental ids /// be careful with this function, it does not increment lastTokenId /// and expects the minter to actually know what it's doing. /// this also means, this function does not verify _maxTokenId /// @param to array of address of recipients /// @param uris array of token metadata uris /// @param tokenIds array of token ids wanted /// @param feeRecipients the recipients of royalties for each id /// @param feeAmounts the royalties amounts for each id. From 0 to 10000 /// where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50% /// @return tokenIds the tokenIds function mintBatch( address[] memory to, string[] memory uris, uint256[] memory tokenIds, address[] memory feeRecipients, uint256[] memory feeAmounts ) external returns (uint256[] memory); /// @notice Attach a module /// @param module a module to attach /// @param enabled if the module is enabled by default /// @param canModuleMint if the module has to be given the minter role function attachModule( address module, bool enabled, bool canModuleMint ) external; /// @dev Allows owner to enable a module /// @param module to enable /// @param canModuleMint if the module has to be given the minter role function enableModule(address module, bool canModuleMint) external; /// @dev Allows owner to disable a module /// @param module to disable function disableModule(address module, bool keepListeners) external; /// @notice function that returns a string that can be used to render the current token /// @param tokenId tokenId /// @return the URI to render token function renderTokenURI(uint256 tokenId) external view returns (string memory); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; interface INFModule is IERC165 { /// @notice Called by a Token Registry whenever the module is Attached /// @return if the attach worked function onAttach() external returns (bool); /// @notice Called by a Token Registry whenever the module is Enabled /// @return if the enabling worked function onEnable() external returns (bool); /// @notice Called by a Token Registry whenever the module is Disabled function onDisable() external; /// @notice returns an URI with information about the module /// @return the URI where to find information about the module function contractURI() external view returns (string memory); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './INFModule.sol'; interface INFModuleRenderTokenURI is INFModule { function renderTokenURI(uint256 tokenId) external view returns (string memory); function renderTokenURI(address registry, uint256 tokenId) external view returns (string memory); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './INFModule.sol'; interface INFModuleTokenURI is INFModule { function tokenURI(uint256 tokenId) external view returns (string memory); function tokenURI(address registry, uint256 tokenId) external view returns (string memory); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './INFModule.sol'; interface INFModuleWithRoyalties is INFModule { /// @notice Return royalties (recipient, basisPoint) for tokenId /// @dev Contrary to EIP2981, modules are expected to return basisPoint for second parameters /// This in order to allow right royalties on marketplaces not supporting 2981 (like Rarible) /// @param tokenId token to check /// @return recipient and basisPoint for this tokenId function royaltyInfo(uint256 tokenId) external view returns (address recipient, uint256 basisPoint); /// @notice Return royalties (recipient, basisPoint) for tokenId /// @dev Contrary to EIP2981, modules are expected to return basisPoint for second parameters /// This in order to allow right royalties on marketplaces not supporting 2981 (like Rarible) /// @param registry registry to check id of /// @param tokenId token to check /// @return recipient and basisPoint for this tokenId function royaltyInfo(address registry, uint256 tokenId) external view returns (address recipient, uint256 basisPoint); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; import './INFModule.sol'; /// @title NFBaseModule /// @author Simon Fremaux (@dievardump) contract NFBaseModule is INFModule, ERC165 { using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet internal _attached; event NewContractURI(string contractURI); string private _contractURI; modifier onlyAttached(address registry) { require(_attached.contains(registry), '!NOT_ATTACHED!'); _; } constructor(string memory contractURI_) { _setContractURI(contractURI_); } /// @inheritdoc INFModule function contractURI() external view virtual override returns (string memory) { return _contractURI; } /// @inheritdoc INFModule function onAttach() external virtual override returns (bool) { if (_attached.add(msg.sender)) { return true; } revert('!ALREADY_ATTACHED!'); } /// @notice this contract doesn't really care if it's enabled or not /// since trying to mint on a contract where it's not enabled will fail /// @inheritdoc INFModule function onEnable() external pure virtual override returns (bool) { return true; } /// @inheritdoc INFModule function onDisable() external virtual override {} function _setContractURI(string memory contractURI_) internal { _contractURI = contractURI_; emit NewContractURI(contractURI_); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title OpenSea contract helper that defines a few things /// @author Simon Fremaux (@dievardump) /// @dev This is a contract used to add OpenSea's support contract BaseOpenSea { string private _contractURI; ProxyRegistry private _proxyRegistry; /// @notice Returns the contract URI function. Used on OpenSea to get details // about a contract (owner, royalties etc...) function contractURI() public view returns (string memory) { return _contractURI; } /// @notice Helper for OpenSea gas-less trading /// @dev Allows to check if `operator` is owner's OpenSea proxy /// @param owner the owner we check for /// @param operator the operator (proxy) we check for function isOwnersOpenSeaProxy(address owner, address operator) public view returns (bool) { ProxyRegistry proxyRegistry = _proxyRegistry; return // we have a proxy registry address address(proxyRegistry) != address(0) && // current operator is owner's proxy address address(proxyRegistry.proxies(owner)) == operator; } /// @dev Internal function to set the _contractURI /// @param contractURI_ the new contract uri function _setContractURI(string memory contractURI_) internal { _contractURI = contractURI_; } /// @dev Internal function to set the _proxyRegistry /// @param proxyRegistryAddress the new proxy registry address function _setOpenSeaRegistry(address proxyRegistryAddress) internal { _proxyRegistry = ProxyRegistry(proxyRegistryAddress); } } contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; }
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides a function for encoding some bytes in base64 library Base64 { string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for { } lt(dataPtr, endPtr) { } { dataPtr := add(dataPtr, 3) // read 3 bytes let input := mload(dataPtr) // write 4 characters mstore( resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F)))) ) resultPtr := add(resultPtr, 1) mstore( resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F)))) ) resultPtr := add(resultPtr, 1) mstore( resultPtr, shl(248, mload(add(tablePtr, and(shr(6, input), 0x3F)))) ) resultPtr := add(resultPtr, 1) mstore( resultPtr, shl(248, mload(add(tablePtr, and(input, 0x3F)))) ) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // small library to randomize using (min, max, seed) // all number returned are considered with 3 decimals library Randomize { struct Random { uint256 seed; } /// @notice This function uses seed to return a pseudo random interger between 0 and 1000 /// Because solidity has no decimal points, the number is considered to be [0, 0.999] /// @param random the random seed /// @return the pseudo random number (with 3 decimal basis) function randomDec(Random memory random) internal pure returns (uint256) { random.seed ^= random.seed << 13; random.seed ^= random.seed >> 17; random.seed ^= random.seed << 5; return ((random.seed < 0 ? ~random.seed + 1 : random.seed) % 1000); } /// @notice return a number between [min, max[, multiplicated by 1000 (for 3 decimal basis) /// @param random the random seed /// @return the pseudo random number (with 3 decimal basis) function randomBetween( Random memory random, uint256 min, uint256 max ) internal pure returns (uint256) { return min * 1000 + (max - min) * Randomize.randomDec(random); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '../ERC721Ownable.sol'; import '../ERC2981/IERC2981Royalties.sol'; import './IOldMetaHolder.sol'; /// @title AstragladeUpgrade /// @author Simon Fremaux (@dievardump) contract AstragladeUpgrade is IERC2981Royalties, ERC721Ownable, IERC721Receiver { using ECDSA for bytes32; using Strings for uint256; // emitted when an Astraglade has been upgrade event AstragladeUpgraded(address indexed operator, uint256 indexed tokenId); // emitted when a token owner asks for a metadata update (image or signature) // because of rendering error event RequestUpdate(address indexed operator, uint256 indexed tokenId); struct MintingOrder { address to; uint256 expiration; uint256 seed; string signature; string imageHash; } struct AstragladeMeta { uint256 seed; string signature; string imageHash; } // start at the old contract last token Id minted uint256 public lastTokenId = 84; // signer that signs minting orders address public mintSigner; // how long before an order expires uint256 public expiration; // old astraglade contract to allow upgrade to new token address public oldAstragladeContract; // contract that holds metadata of previous contract Astraglades address public oldMetaHolder; // contract operator next to the owner address public contractOperator = address(0xD1edDfcc4596CC8bD0bd7495beaB9B979fc50336); // max supply uint256 constant MAX_SUPPLY = 5555; // price uint256 constant PRICE = 0.0888 ether; // project base render URI string private _baseRenderURI; // project description string internal _description; // list of Astraglades mapping(uint256 => AstragladeMeta) internal _astraglades; // saves if a minting order was already used or not mapping(bytes32 => uint256) public messageToTokenId; // request updates mapping(uint256 => bool) public requestUpdates; // remaining giveaways uint256 public remainingGiveaways = 100; // user giveaways mapping(address => uint8) public giveaways; // Petri already redeemed mapping(uint256 => bool) public petriRedeemed; address public artBlocks; address[3] public feeRecipients = [ 0xe4657aF058E3f844919c3ee713DF09c3F2949447, 0xb275E5aa8011eA32506a91449B190213224aEc1e, 0xdAC81C3642b520584eD0E743729F238D1c350E62 ]; modifier onlyOperator() { require(isOperator(msg.sender), 'Not operator.'); _; } function isOperator(address operator) public view returns (bool) { return owner() == operator || contractOperator == operator; } /// @notice constructor /// @param name_ name of the contract (see ERC721) /// @param symbol_ symbol of the contract (see ERC721) /// @param contractURI_ The contract URI (containing its metadata) - can be empty "" /// @param openseaProxyRegistry_ OpenSea's proxy registry to allow gas-less listings - can be address(0) /// @param mintSigner_ Address of the wallet used to sign minting orders /// @param owner_ Address to whom transfer ownership (can be address(0), then owner is deployer) constructor( string memory name_, string memory symbol_, string memory contractURI_, address openseaProxyRegistry_, address mintSigner_, address owner_, address oldAstragladeContract_, address oldMetaHolder_, address artBlocks_ ) ERC721Ownable( name_, symbol_, contractURI_, openseaProxyRegistry_, owner_ ) { mintSigner = mintSigner_; oldAstragladeContract = oldAstragladeContract_; oldMetaHolder = oldMetaHolder_; artBlocks = artBlocks_; } /// @notice Mint one token using a minting order /// @dev mintingSignature must be a signature that matches `mintSigner` for `mintingOrder` /// @param mintingOrder the minting order /// @param mintingSignature signature for the mintingOrder /// @param petriId petri id to redeem if owner and not already redeemed the free AG function mint( MintingOrder memory mintingOrder, bytes memory mintingSignature, uint256 petriId ) external payable { bytes32 message = hashMintingOrder(mintingOrder) .toEthSignedMessageHash(); address sender = msg.sender; require( message.recover(mintingSignature) == mintSigner, 'Wrong minting order signature.' ); require( mintingOrder.expiration >= block.timestamp, 'Minting order expired.' ); require( mintingOrder.to == sender, 'Minting order for another address.' ); require(mintingOrder.seed != 0, 'Seed can not be 0'); require(messageToTokenId[message] == 0, 'Token already minted.'); uint256 tokenId = lastTokenId + 1; require(tokenId <= MAX_SUPPLY, 'Max supply already reached.'); uint256 mintingCost = PRICE; // For Each Petri (https://artblocks.io/project/67/) created by Fabin on artblocks.io // the owner can claim a free Astraglade // After a Petri was used, it CAN NOT be used again to claim another Astraglade if (petriId >= 67000000 && petriId < 67000200) { require( // petri was not redeemed already petriRedeemed[petriId] == false && // msg.sender is Petri owner ERC721(artBlocks).ownerOf(petriId) == sender, 'Petri already redeemed or not owner' ); petriRedeemed[petriId] = true; mintingCost = 0; } else if (giveaways[sender] > 0) { // if the user has some free mints giveaways[sender]--; mintingCost = 0; } require( msg.value == mintingCost || isOperator(sender), 'Incorrect value.' ); lastTokenId = tokenId; messageToTokenId[message] = tokenId; _astraglades[tokenId] = AstragladeMeta({ seed: mintingOrder.seed, signature: mintingOrder.signature, imageHash: mintingOrder.imageHash }); _safeMint(mintingOrder.to, tokenId, ''); } /// @inheritdoc ERC165 function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return ERC721Enumerable.supportsInterface(interfaceId) || interfaceId == type(IERC2981Royalties).interfaceId; } /// @notice Helper to get the price /// @return the price to mint function getPrice() external pure returns (uint256) { return PRICE; } /// @notice tokenURI override that returns a data:json application /// @inheritdoc ERC721 function tokenURI(uint256 tokenId) public view override returns (string memory) { AstragladeMeta memory astraglade = getAstraglade(tokenId); string memory astraType; if (tokenId <= 10) { astraType = 'Universa'; } else if (tokenId <= 100) { astraType = 'Galactica'; } else if (tokenId <= 1000) { astraType = 'Nebula'; } else if (tokenId <= 2500) { astraType = 'Meteora'; } else if (tokenId <= 5554) { astraType = 'Solaris'; } else { astraType = 'Quanta'; } return string( abi.encodePacked( 'data:application/json;utf8,{"name":"Astraglade - ', tokenId.toString(), ' - ', astraType, '","license":"CC BY-SA 4.0","description":"', getDescription(), '","created_by":"Fabin Rasheed","twitter":"@astraglade","image":"ipfs://ipfs/', astraglade.imageHash, '","seed":"', astraglade.seed.toString(), '","signature":"', astraglade.signature, '","animation_url":"', renderTokenURI(tokenId), '"}' ) ); } /// @notice function that returns a string that can be used to render the current token /// @param tokenId tokenId /// @return the URI to render token function renderTokenURI(uint256 tokenId) public view returns (string memory) { AstragladeMeta memory astraglade = getAstraglade(tokenId); return string( abi.encodePacked( getBaseRenderURI(), '?seed=', astraglade.seed.toString(), '&signature=', astraglade.signature ) ); } /// @notice Returns Metadata for Astraglade id /// @param tokenId the tokenId we want metadata for function getAstraglade(uint256 tokenId) public view returns (AstragladeMeta memory astraglade) { require(_exists(tokenId), 'Astraglade: nonexistent token'); // if the metadata are in this contract if (_astraglades[tokenId].seed != 0) { astraglade = _astraglades[tokenId]; } else { // or in the old one ( uint256 seed, string memory signature, string memory imageHash ) = IOldMetaHolder(oldMetaHolder).get(tokenId); astraglade.seed = seed; astraglade.signature = signature; astraglade.imageHash = imageHash; } } /// @notice helper to get the description function getDescription() public view returns (string memory) { if (bytes(_description).length == 0) { return 'Astraglade is an interactive, generative, 3D collectible project. Astraglades are collected through a unique social collection mechanism. Each version of Astraglade can be signed with a signature which will remain in the artwork forever.'; } return _description; } /// @notice helper to set the description /// @param newDescription the new description function setDescription(string memory newDescription) external onlyOperator { _description = newDescription; } /// @notice helper to get the base expiration time function getExpiration() public view returns (uint256) { if (expiration == 0) { return 15 * 60; } return expiration; } /// @notice helper to set the expiration /// @param newExpiration the new expiration function setExpiration(uint256 newExpiration) external onlyOperator { expiration = newExpiration; } /// @notice helper to get the baseRenderURI function getBaseRenderURI() public view returns (string memory) { if (bytes(_baseRenderURI).length == 0) { return 'ipfs://ipfs/QmP85DSrtLAxSBnct9iUr7qNca43F3E4vuG6Jv5aoTh9w7'; } return _baseRenderURI; } /// @notice helper to set the baseRenderURI /// @param newRenderURI the new renderURI function setBaseRenderURI(string memory newRenderURI) external onlyOperator { _baseRenderURI = newRenderURI; } /// @notice Helper to do giveaways - there can only be `remainingGiveaways` giveaways given all together /// @param winner the giveaway winner /// @param count how many we giveaway to recipient function giveaway(address winner, uint8 count) external onlyOperator { require(remainingGiveaways >= count, 'Giveaway limit reached'); remainingGiveaways -= count; giveaways[winner] += count; } /// @dev Receive, for royalties receive() external payable {} /// @dev Owner withdraw balance function function withdraw() external onlyOperator { address[3] memory feeRecipients_ = feeRecipients; uint256 balance_ = address(this).balance; payable(address(feeRecipients_[0])).transfer((balance_ * 30) / 100); payable(address(feeRecipients_[1])).transfer((balance_ * 35) / 100); payable(address(feeRecipients_[2])).transfer(address(this).balance); } /// @notice helper to set the fee recipient at `index` /// @param newFeeRecipient the new address /// @param index the index to edit function setFeeRecipient(address newFeeRecipient, uint8 index) external onlyOperator { require(index < feeRecipients.length, 'Index too high.'); require(newFeeRecipient != address(0), 'Invalid address.'); feeRecipients[index] = newFeeRecipient; } /// @notice 10% royalties going to this contract /// @inheritdoc IERC2981Royalties function royaltyInfo(uint256, uint256 value) external view override returns (address receiver, uint256 royaltyAmount) { receiver = address(this); royaltyAmount = (value * 1000) / 10000; } /// @notice Hash the Minting Order so it can be signed by the signer /// @param mintingOrder the minting order /// @return the hash to sign function hashMintingOrder(MintingOrder memory mintingOrder) public pure returns (bytes32) { return keccak256(abi.encode(mintingOrder)); } /// @notice Helper for the owner to change current minting signer /// @dev needs to be owner /// @param mintSigner_ new signer function setMintingSigner(address mintSigner_) external onlyOperator { require(mintSigner_ != address(0), 'Invalid Signer address.'); mintSigner = mintSigner_; } /// @notice Helper for an operator to change the current operator address /// @param newOperator the new operator function setContractOperator(address newOperator) external onlyOperator { contractOperator = newOperator; } /// @notice Helper for the owner to change the oldMetaHolder /// @dev needs to be owner /// @param oldMetaHolder_ new oldMetaHolder address function setOldMetaHolder(address oldMetaHolder_) external onlyOperator { require(oldMetaHolder_ != address(0), 'Invalid Contract address.'); oldMetaHolder = oldMetaHolder_; } /// @notice Helpers that returns the MintingOrder plus the message to sign /// @param to the address of the creator /// @param seed the seed /// @param signature the signature /// @param imageHash image hash /// @return mintingOrder and message to hash function createMintingOrder( address to, uint256 seed, string memory signature, string memory imageHash ) external view returns (MintingOrder memory mintingOrder, bytes32 message) { mintingOrder = MintingOrder({ to: to, expiration: block.timestamp + getExpiration(), seed: seed, signature: signature, imageHash: imageHash }); message = hashMintingOrder(mintingOrder); } /// @notice returns a tokenId from an mintingOrder, used to know if already minted /// @param mintingOrder the minting order to check /// @return an integer. 0 if not minted, else the tokenId function tokenIdFromOrder(MintingOrder memory mintingOrder) external view returns (uint256) { bytes32 message = hashMintingOrder(mintingOrder) .toEthSignedMessageHash(); return messageToTokenId[message]; } /// @notice Allows an owner to request a metadata update. /// Because Astraglade are generated from a backend it can happen that a bug /// blocks the generation of the image OR that a signature with special characters stops the /// token from working. /// This method allows a user to ask for regeneration of the image / signature update /// A contract operator can then update imageHash and / or signature /// @param tokenId the tokenId to update function requestMetaUpdate(uint256 tokenId) external { require(ownerOf(tokenId) == msg.sender, 'Not token owner.'); requestUpdates[tokenId] = true; emit RequestUpdate(msg.sender, tokenId); } /// @notice Allows an operator of this contract to update a tokenId metadata (signature or image hash) /// after it was requested by its owner. /// This is only used in the case the generation of the Preview image did fail /// in some way or if the signature has special characters that stops the token from working /// @param tokenId the tokenId to update /// @param newImageHash the new imageHash (can be empty) /// @param newSignature the new signature (can be empty) function updateMeta( uint256 tokenId, string memory newImageHash, string memory newSignature ) external onlyOperator { require( requestUpdates[tokenId] == true, 'No update request for token.' ); requestUpdates[tokenId] = false; // get the current Astraglade data // for ids 1-82 it can come from oldMetaHolder AstragladeMeta memory astraglade = getAstraglade(tokenId); if (bytes(newImageHash).length > 0) { astraglade.imageHash = newImageHash; } if (bytes(newSignature).length > 0) { astraglade.signature = newSignature; } // save the new state _astraglades[tokenId] = astraglade; } /// @notice function used to allow upgrade of old contract Astraglade to this one. /// @inheritdoc IERC721Receiver function onERC721Received( address, address from, uint256 tokenId, bytes calldata ) external override returns (bytes4) { require(msg.sender == oldAstragladeContract, 'Only old Astraglades.'); // mint tokenId to from _mint(from, tokenId); // burn old tokenId ERC721Burnable(msg.sender).burn(tokenId); emit AstragladeUpgraded(from, tokenId); return 0x150b7a02; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title IOldMetaHolder /// @author Simon Fremaux (@dievardump) interface IOldMetaHolder { function get(uint256 tokenId) external pure returns ( uint256, string memory, string memory ); }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"string","name":"contractURI_","type":"string"},{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"planetsContract_","type":"address"},{"internalType":"address","name":"astragladeContract_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"contractURI","type":"string"}],"name":"NewContractURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"PlanetsClaimed","type":"event"},{"inputs":[],"name":"astragladeContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feeRecipients","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeMeta","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"frozenMeta","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getAstraglade","outputs":[{"components":[{"internalType":"uint256","name":"seed","type":"uint256"},{"internalType":"string","name":"signature","type":"string"},{"internalType":"string","name":"imageHash","type":"string"}],"internalType":"struct AstragladeUpgrade.AstragladeMeta","name":"astraglade","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseImageURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseRenderURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDescription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getPlanetData","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onAttach","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"onDisable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"onEnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"planetSeed","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"planetsContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"renderTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"renderTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"basisPoint","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"seedTaken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseImagesURI","type":"string"}],"name":"setBaseImagesURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newRenderURI","type":"string"}],"name":"setBaseRenderURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator","type":"address"}],"name":"setContractOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newDescription","type":"string"}],"name":"setDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newFeeRecipient","type":"address"},{"internalType":"uint8","name":"index","type":"uint8"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"planetsContract_","type":"address"}],"name":"setPlanetsContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
600680546001600160a01b03191673d1eddfcc4596cc8bd0bd7495beab9b979fc5033617905560e060405273e4657af058e3f844919c3ee713df09c3f2949447608090815273b275e5aa8011ea32506a91449b190213224aec1e60a05273dac81c3642b520584ed0e743729f238d1c350e6260c0526200008490600b9060036200028f565b503480156200009257600080fd5b506040516200340938038062003409833981016040819052620000b591620003e6565b83620000c13362000118565b620000cc8162000168565b50600480546001600160a01b038085166001600160a01b0319928316179092556005805484841692169190911790558316156200010e576200010e83620001ba565b505050506200054a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516200017d906003906020840190620002ec565b507fdf1280b84eee5cd4ce59294c59ec7288bd49034d7f3d142f57ba9b477915636481604051620001af9190620004d8565b60405180910390a150565b6000546001600160a01b031633146200021a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620002815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000211565b6200028c8162000118565b50565b8260038101928215620002da579160200282015b82811115620002da57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620002a3565b50620002e892915062000369565b5090565b828054620002fa906200050d565b90600052602060002090601f0160209004810192826200031e5760008555620002da565b82601f106200033957805160ff1916838001178555620002da565b82800160010185558215620002da579182015b82811115620002da5782518255916020019190600101906200034c565b5b80821115620002e857600081556001016200036a565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620003b357818101518382015260200162000399565b83811115620003c3576000848401525b50505050565b80516001600160a01b0381168114620003e157600080fd5b919050565b60008060008060808587031215620003fd57600080fd5b84516001600160401b03808211156200041557600080fd5b818701915087601f8301126200042a57600080fd5b8151818111156200043f576200043f62000380565b604051601f8201601f19908116603f011681019083821181831017156200046a576200046a62000380565b816040528281528a60208487010111156200048457600080fd5b6200049783602083016020880162000396565b8098505050505050620004ad60208601620003c9565b9250620004bd60408601620003c9565b9150620004cd60608601620003c9565b905092959194509250565b6020815260008251806020840152620004f981604085016020870162000396565b601f01601f19169190910160400192915050565b600181811c908216806200052257607f821691505b602082108114156200054457634e487b7160e01b600052602260045260246000fd5b50919050565b612eaf806200055a6000396000f3fe60806040526004361061021e5760003560e01c8063938e3d7b11610123578063cef6d368116100ab578063e9dc63751161006f578063e9dc637514610669578063ed1b314414610689578063f2fde38b1461069e578063f49f1b24146106be578063f4cc8f57146106d857600080fd5b8063cef6d368146105c1578063dc9ce7a5146105e5578063e879110114610614578063e8a3d48514610634578063e937a37a1461064957600080fd5b8063b240cba3116100f2578063b240cba314610504578063bf598afb14610531578063c15052c114610551578063c87b56dd1461058c578063cc524a89146105ac57600080fd5b8063938e3d7b146104905780639b561135146104b0578063af66be3f146104d0578063b079ac90146104f057600080fd5b806351fe9eff116101a6578063715018a611610175578063715018a6146104085780638bdb75191461041d5780638cd1d9d61461043d5780638da5cb5b1461045257806390c3f38f1461047057600080fd5b806351fe9eff14610360578063652350a0146103985780636ba4c138146103c85780636d70f7ae146103e857600080fd5b80632782d6c7116101ed5780632782d6c7146102b65780633ccfd60b146102fa5780633ef2c42a1461031157806340b42fcf146103315780634c85eb1f1461035157600080fd5b806301ffc9a71461022a5780631a0925411461025f5780631f22d2fe146102815780631f8cbe5c146102a157600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5061024a610245366004612168565b6106f8565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b50610274610765565b60405161025691906121f5565b34801561028d57600080fd5b5061027461029c366004612208565b61082d565b3480156102ad57600080fd5b50610274610839565b3480156102c257600080fd5b506102db6102d1366004612236565b5030916103e89150565b604080516001600160a01b039093168352602083019190915201610256565b34801561030657600080fd5b5061030f61087b565b005b34801561031d57600080fd5b5061030f61032c366004612262565b6109d8565b34801561033d57600080fd5b5061030f61034c3660046122a1565b610ac7565b34801561035d57600080fd5b50005b34801561036c57600080fd5b5061038061037b366004612208565b610b10565b6040516001600160a01b039091168152602001610256565b3480156103a457600080fd5b5061024a6103b3366004612208565b600f6020526000908152604090205460ff1681565b3480156103d457600080fd5b5061030f6103e33660046122be565b610b30565b3480156103f457600080fd5b5061024a6104033660046122a1565b610b8e565b34801561041457600080fd5b5061030f610bd1565b34801561042957600080fd5b5061030f6104383660046123a2565b610c35565b34801561044957600080fd5b50610274610c94565b34801561045e57600080fd5b506000546001600160a01b0316610380565b34801561047c57600080fd5b5061030f61048b3660046123a2565b610cd6565b34801561049c57600080fd5b5061030f6104ab3660046123a2565b610d31565b3480156104bc57600080fd5b50600654610380906001600160a01b031681565b3480156104dc57600080fd5b5061030f6104eb3660046122a1565b610d62565b3480156104fc57600080fd5b50600161024a565b34801561051057600080fd5b5061052461051f366004612208565b610da9565b6040516102569190612422565b34801561053d57600080fd5b50600554610380906001600160a01b031681565b34801561055d57600080fd5b5061057e61056c366004612208565b600e6020526000908152604090205481565b604051908152602001610256565b34801561059857600080fd5b506102746105a7366004612208565b610e4d565b3480156105b857600080fd5b5061030f610e59565b3480156105cd57600080fd5b506102db6105dc366004612208565b5030906103e890565b3480156105f157600080fd5b50610605610600366004612208565b610e8d565b6040516102569392919061246e565b34801561062057600080fd5b50600454610380906001600160a01b031681565b34801561064057600080fd5b50610274610fa0565b34801561065557600080fd5b50610274610664366004612236565b610faf565b34801561067557600080fd5b50610274610684366004612236565b610fda565b34801561069557600080fd5b5061024a6110cc565b3480156106aa57600080fd5b5061030f6106b93660046122a1565b6110fd565b3480156106ca57600080fd5b5060085461024a9060ff1681565b3480156106e457600080fd5b5061030f6106f33660046123a2565b6111c5565b60006001600160e01b03198216630434e6b560e31b148061072957506001600160e01b03198216633d855c6160e21b145b8061074457506001600160e01b0319821663e97405af60e01b145b8061075f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600a8054610774906124c3565b1515905061079d57604051806101c001604052806101868152602001612c506101869139905090565b600a80546107aa906124c3565b80601f01602080910402602001604051908101604052809291908181526020018280546107d6906124c3565b80156108235780601f106107f857610100808354040283529160200191610823565b820191906000526020600020905b81548152906001019060200180831161080657829003601f168201915b5050505050905090565b606061075f3383610faf565b606060098054610848906124c3565b1515905061086e57604051806060016040528060338152602001612e0760339139905090565b600980546107aa906124c3565b61088433610b8e565b6108a95760405162461bcd60e51b81526004016108a0906124fe565b60405180910390fd5b604080516060810191829052600091600b9060039082845b81546001600160a01b031681526001909101906020018083116108c15750939450479350849250600091506108f39050565b60200201516001600160a01b03166108fc606461091184601e612551565b61091b9190612586565b6040518115909202916000818181858888f19350505050158015610943573d6000803e3d6000fd5b5060208201516001600160a01b03166108fc6064610962846023612551565b61096c9190612586565b6040518115909202916000818181858888f19350505050158015610994573d6000803e3d6000fd5b5081600260200201516040516001600160a01b03909116904780156108fc02916000818181858888f193505050501580156109d3573d6000803e3d6000fd5b505050565b6109e133610b8e565b6109fd5760405162461bcd60e51b81526004016108a0906124fe565b60038160ff1610610a435760405162461bcd60e51b815260206004820152601060248201526f21494e4445585f4f564552464c4f572160801b60448201526064016108a0565b6001600160a01b038216610a8d5760405162461bcd60e51b815260206004820152601160248201527021494e56414c49445f414444524553532160781b60448201526064016108a0565b81600b8260ff1660038110610aa457610aa4612525565b0180546001600160a01b0319166001600160a01b03929092169190911790555050565b610ad033610b8e565b610aec5760405162461bcd60e51b81526004016108a0906124fe565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b565b600b8160038110610b2057600080fd5b01546001600160a01b0316905081565b60055460045433916001600160a01b03908116911660005b84811015610b8657610b7484878784818110610b6657610b66612525565b905060200201358585611220565b80610b7e8161259a565b915050610b48565b505050505050565b6000816001600160a01b0316610bac6000546001600160a01b031690565b6001600160a01b0316148061075f5750506006546001600160a01b0391821691161490565b6000546001600160a01b03163314610c2b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108a0565b610b0e60006115ac565b610c3e33610b8e565b610c5a5760405162461bcd60e51b81526004016108a0906124fe565b60085460ff1615610c7d5760405162461bcd60e51b81526004016108a0906125b5565b8051610c909060079060208401906120cf565b5050565b606060078054610ca3906124c3565b15159050610cc957604051806060016040528060318152602001612dd660319139905090565b600780546107aa906124c3565b610cdf33610b8e565b610cfb5760405162461bcd60e51b81526004016108a0906124fe565b60085460ff1615610d1e5760405162461bcd60e51b81526004016108a0906125b5565b8051610c9090600a9060208401906120cf565b610d3a33610b8e565b610d565760405162461bcd60e51b81526004016108a0906124fe565b610d5f816115fc565b50565b610d6b33610b8e565b610d875760405162461bcd60e51b81526004016108a0906124fe565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b610dcd60405180606001604052806000815260200160608152602001606081525090565b60055460405163b240cba360e01b8152600481018490526001600160a01b039091169063b240cba39060240160006040518083038186803b158015610e1157600080fd5b505afa158015610e25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261075f9190810190612621565b606061075f3383610fda565b610e6233610b8e565b610e7e5760405162461bcd60e51b81526004016108a0906124fe565b6008805460ff19166001179055565b6000818152600e60205260408120548190606090610edf5760405162461bcd60e51b815260206004820152600f60248201526e21554e4b4e4f574e5f544f4b454e2160881b60448201526064016108a0565b6000848152600e6020526040812054610efd90633b9aca00906126d2565b90506000610f0a8261164a565b60055460405163b240cba360e01b8152600481018990529192506000916001600160a01b039091169063b240cba39060240160006040518083038186803b158015610f5457600080fd5b505afa158015610f68573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f909190810190612621565b5192979296509094509092505050565b6060600380546107aa906124c3565b60606000806000610fbf85610e8d565b925092509250610fd08383836118a4565b9695505050505050565b60606000806000610fea85610e8d565b9250925092506110a2610ffc866119ec565b611004610765565b61100c610839565b611015896119ec565b604051602001611026929190612702565b60405160208183030381529060405261103e876119ec565b611047876119ec565b61105087611af2565b61105b8a8a8a6118a4565b60405160200161106d93929190612731565b60408051601f198184030181529082905261108e95949392916020016127e1565b604051602081830303815290604052611edf565b6040516020016110b2919061290a565b604051602081830303815290604052935050505092915050565b6004546000906001600160a01b03166110f75750600480546001600160a01b03191633179055600190565b50600090565b6000546001600160a01b031633146111575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108a0565b6001600160a01b0381166111bc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108a0565b610d5f816115ac565b6111ce33610b8e565b6111ea5760405162461bcd60e51b81526004016108a0906124fe565b60085460ff161561120d5760405162461bcd60e51b81526004016108a0906125b5565b8051610c909060099060208401906120cf565b6040516331a9108f60e11b81526004810184905282906000906001600160a01b03831690636352211e9060240160206040518083038186803b15801561126557600080fd5b505afa158015611279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129d919061294f565b9050856001600160a01b0316816001600160a01b0316148061133b575060405163e985e9c560e01b81526001600160a01b038281166004830152878116602483015283169063e985e9c59060440160206040518083038186803b15801561130357600080fd5b505afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b919061296c565b806113c9575060405163020604bf60e21b8152600481018690526001600160a01b03808816919084169063081812fc9060240160206040518083038186803b15801561138657600080fd5b505afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be919061294f565b6001600160a01b0316145b6114085760405162461bcd60e51b815260206004820152601060248201526f214e4f545f415554484f52495a45442160801b60448201526064016108a0565b604051637971ab0f60e11b81526001600160a01b03828116600483015260c06024830152600060c4830181905260448301889052606483018190526084830181905260a483015284919082169063f2e3561e9060e401602060405180830381600087803b15801561147857600080fd5b505af115801561148c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b0919061298e565b5060005b6115328742856114c56001436129a7565b4060408051602081018690529081018490526bffffffffffffffffffffffff19606084811b8216818401526074830184905241901b1660948201524460a88201523a60c882015260009060e801604051602081830303815290604052805190602001209050949350505050565b9050600f6000611546633b9aca00846126d2565b815260208101919091526040016000205460ff166114b4576000878152600e60205260408120829055600190600f90611583633b9aca00856126d2565b81526020810191909152604001600020805460ff19169115159190911790555050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805161160f9060039060208401906120cf565b507fdf1280b84eee5cd4ce59294c59ec7288bd49034d7f3d142f57ba9b47791563648160405161163f91906121f5565b60405180910390a150565b604080516020810182528281528151600680825260e0820190935260609281602001602082028036833701905050915061168781600a60c8612047565b8260008151811061169a5761169a612525565b60209081029190910101526116b2816005600f612047565b826001815181106116c5576116c5612525565b60209081029190910101526116de816000611388612047565b826002815181106116f1576116f1612525565b602002602001018181525050614e208260028151811061171357611713612525565b60200260200101511015611744576127108260018151811061173757611737612525565b6020026020010181815250505b6103e86117548260006002612047565b10611760576001611763565b60005b60ff168260038151811061177957611779612525565b602002602001018181525050614e208260028151811061179b5761179b612525565b602002602001015110156117e7576103e86117b98260026004612047565b6117c39190612586565b826004815181106117d6576117d6612525565b602002602001018181525050611865565b6103e86117f7826000600a612047565b6118019190612586565b8260048151811061181457611814612525565b60200260200101818152505060038260048151811061183557611835612525565b602002602001015111156118655760008260048151811061185857611858612525565b6020026020010181815250505b6103e86118758260006004612047565b61187f9190612586565b8260058151811061189257611892612525565b60200260200101818152505050919050565b60606000604051806040016040528060018152602001600b60fa1b815250905060006118e9846000815181106118dc576118dc612525565b60200260200101516119ec565b82611900866001815181106118dc576118dc612525565b84611917886002815181106118dc576118dc612525565b8660405160200161192d969594939291906129be565b6040516020818303038152906040529050611946610c94565b61194f876119ec565b611958876119ec565b8361196f886003815181106118dc576118dc612525565b866119868a6004815181106118dc576118dc612525565b8861199d8c6005815181106118dc576118dc612525565b6040516020016119b2969594939291906129be565b60408051601f19818403018152908290526119d294939291602001612a3d565b604051602081830303815290604052925050509392505050565b606081611a105750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611a3a5780611a248161259a565b9150611a339050600a83612586565b9150611a14565b60008167ffffffffffffffff811115611a5557611a55612333565b6040519080825280601f01601f191660200182016040528015611a7f576020820181803683370190505b5090505b8415611aea57611a946001836129a7565b9150611aa1600a866126d2565b611aac906030612ade565b60f81b818381518110611ac157611ac1612525565b60200101906001600160f81b031916908160001a905350611ae3600a86612586565b9450611a83565b949350505050565b60606000604051806040016040528060018152602001600b60fa1b81525090506000611ba2604051806040016040528060078152602001662a32b93930b4b760c91b81525061c35086600081518110611b4d57611b4d612525565b602002602001015110611b7e576040518060400160405280600681526020016553706172736560d01b81525061207c565b6040518060400160405280600581526020016444656e736560d81b8152505b61207c565b82604051602001611bb4929190612702565b6040516020818303038152906040529050611f4084600181518110611bdb57611bdb612525565b60200260200101511015611c555780611c2c6040518060400160405280600481526020016353697a6560e01b8152506040518060400160405280600481526020016354696e7960e01b81525061207c565b83604051602001611c3f93929190612af6565b6040516020818303038152906040529050611d27565b612ee084600181518110611c6b57611c6b612525565b60200260200101511015611cbe5780611c2c6040518060400160405280600481526020016353697a6560e01b815250604051806040016040528060068152602001654d656469756d60d01b81525061207c565b80611d026040518060400160405280600481526020016353697a6560e01b8152506040518060400160405280600581526020016411da585b9d60da1b81525061207c565b83604051602001611d1593929190612af6565b60405160208183030381529060405290505b80611db360405180604001604052806004815260200163466f726d60e01b815250614e2087600281518110611d5e57611d5e612525565b602002602001015110611d8c576040518060400160405280600381526020016247656f60e81b81525061207c565b6040518060400160405280600981526020016815195cdcd95c9858dd60ba1b81525061207c565b83611e4060405180604001604052806005815260200164536861646560d81b81525088600381518110611de857611de8612525565b6020026020010151600014611e1b576040518060400160405280600681526020016553696d706c6560d01b81525061207c565b60405180604001604052806007815260200166159a589c985b9d60ca1b81525061207c565b85611e786040518060400160405280600581526020016452696e677360d81b815250611b9d8b6004815181106118dc576118dc612525565b87611eb0604051806040016040528060058152602001644d6f6f6e7360d81b815250611b9d8d6005815181106118dc576118dc612525565b604051602001611ec7989796959493929190612b39565b60408051601f19818403018152919052949350505050565b6060815160001415611eff57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612e3a6040913990506000600384516002611f2e9190612ade565b611f389190612586565b611f43906004612551565b90506000611f52826020612ade565b67ffffffffffffffff811115611f6a57611f6a612333565b6040519080825280601f01601f191660200182016040528015611f94576020820181803683370190505b509050818152600183018586518101602084015b818310156120025760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b93820193909352600401611fa8565b60038951066001811461201c576002811461202d57612039565b613d3d60f01b600119830152612039565b603d60f81b6000198301525b509398975050505050505050565b6000612052846120a8565b61205c84846129a7565b6120669190612551565b612072846103e8612551565b611aea9190612ade565b60608282604051602001612091929190612bde565b604051602081830303815290604052905092915050565b8051600d81901b18601181901c18600581901b18815260006103e8825161075f91906126d2565b8280546120db906124c3565b90600052602060002090601f0160209004810192826120fd5760008555612143565b82601f1061211657805160ff1916838001178555612143565b82800160010185558215612143579182015b82811115612143578251825591602001919060010190612128565b5061214f929150612153565b5090565b5b8082111561214f5760008155600101612154565b60006020828403121561217a57600080fd5b81356001600160e01b03198116811461219257600080fd5b9392505050565b60005b838110156121b457818101518382015260200161219c565b838111156121c3576000848401525b50505050565b600081518084526121e1816020860160208601612199565b601f01601f19169290920160200192915050565b60208152600061219260208301846121c9565b60006020828403121561221a57600080fd5b5035919050565b6001600160a01b0381168114610d5f57600080fd5b6000806040838503121561224957600080fd5b823561225481612221565b946020939093013593505050565b6000806040838503121561227557600080fd5b823561228081612221565b9150602083013560ff8116811461229657600080fd5b809150509250929050565b6000602082840312156122b357600080fd5b813561219281612221565b600080602083850312156122d157600080fd5b823567ffffffffffffffff808211156122e957600080fd5b818501915085601f8301126122fd57600080fd5b81358181111561230c57600080fd5b8660208260051b850101111561232157600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561237257612372612333565b604052919050565b600067ffffffffffffffff82111561239457612394612333565b50601f01601f191660200190565b6000602082840312156123b457600080fd5b813567ffffffffffffffff8111156123cb57600080fd5b8201601f810184136123dc57600080fd5b80356123ef6123ea8261237a565b612349565b81815285602083850101111561240457600080fd5b81602084016020830137600091810160200191909152949350505050565b6020815281516020820152600060208301516060604084015261244860808401826121c9565b90506040840151601f1984830301606085015261246582826121c9565b95945050505050565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156124b557845183529383019391830191600101612499565b509098975050505050505050565b600181811c908216806124d757607f821691505b602082108114156124f857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600d908201526c2737ba1037b832b930ba37b91760991b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561256b5761256b61253b565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261259557612595612570565b500490565b60006000198214156125ae576125ae61253b565b5060010190565b6020808252600d908201526c214d4554415f46524f5a454e2160981b604082015260600190565b600082601f8301126125ed57600080fd5b81516125fb6123ea8261237a565b81815284602083860101111561261057600080fd5b611aea826020830160208701612199565b60006020828403121561263357600080fd5b815167ffffffffffffffff8082111561264b57600080fd5b908301906060828603121561265f57600080fd5b60405160608101818110838211171561267a5761267a612333565b6040528251815260208301518281111561269357600080fd5b61269f878286016125dc565b6020830152506040830151828111156126b757600080fd5b6126c3878286016125dc565b60408301525095945050505050565b6000826126e1576126e1612570565b500690565b600081516126f8818560208601612199565b9290920192915050565b60008351612714818460208801612199565b835190830190612728818360208801612199565b01949350505050565b7311161130b9ba3930b3b630b232a9b2b2b2111d1160611b81528351600090612761816014850160208901612199565b6f222c2261747472696275746573223a5b60801b6014918401918201528451612791816024840160208901612199565b722e961130b734b6b0ba34b7b72fbab936111d1160691b6024929091019182015283516127c5816037840160208801612199565b61227d60f01b6037929091019182015260390195945050505050565b7103d913730b6b2911d11283630b732ba1016960751b8152855160009061280f816012850160208b01612199565b7f222c226c6963656e7365223a2243432042592d534120342e30222c2264657363601291840191820152693934b83a34b7b7111d1160b11b6032820152865161285f81603c840160208b01612199565b7f222c22637265617465645f6279223a22466162696e2052617368656564222c22603c92909101918201527f74776974746572223a22406173747261676c616465222c22696d616765223a22605c82015285516128c381607c840160208a01612199565b6911161139b2b2b2111d1160b11b607c929091019182015284516128ee816086840160208901612199565b6128fd608682840101866126e6565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161294281601d850160208701612199565b91909101601d0192915050565b60006020828403121561296157600080fd5b815161219281612221565b60006020828403121561297e57600080fd5b8151801515811461219257600080fd5b6000602082840312156129a057600080fd5b5051919050565b6000828210156129b9576129b961253b565b500390565b6000875160206129d18285838d01612199565b8851918401916129e48184848d01612199565b88519201916129f68184848c01612199565b8751920191612a088184848b01612199565b8651920191612a1a8184848a01612199565b8551920191612a2c8184848901612199565b919091019998505050505050505050565b60008551612a4f818460208a01612199565b653f736565643d60d01b9083019081528551612a72816006840160208a01612199565b6f266173747261676c616465536565643d60801b600692909101918201528451612aa3816016840160208901612199565b6b26617474726962757465733d60a01b601692909101918201528351612ad0816022840160208801612199565b016022019695505050505050565b60008219821115612af157612af161253b565b500190565b60008451612b08818460208901612199565b845190830190612b1c818360208901612199565b8451910190612b2f818360208801612199565b0195945050505050565b600089516020612b4c8285838f01612199565b8a5191840191612b5f8184848f01612199565b8a51920191612b718184848e01612199565b8951920191612b838184848d01612199565b8851920191612b958184848c01612199565b8751920191612ba78184848b01612199565b8651920191612bb98184848a01612199565b8551920191612bcb8184848901612199565b919091019b9a5050505050505050505050565b6e3d913a3930b4ba2fba3cb832911d1160891b81528251600090612c0981600f850160208801612199565b6a1116113b30b63ab2911d1160a91b600f918401918201528351612c3481601a840160208801612199565b61227d60f01b601a9290910191820152601c0194935050505056fe4173747261676c61646520506c616e65747320697320616e20657874656e73696f6e206f662070726f6a656374204173747261676c616465202868747470733a2f2f6e7572656361732e636f6d2f6173747261676c616465292e20506c616e6574732061726520616e20696e74657261637469766520616e642067656e657261746976652033442061727420746861742063616e206265206d696e74656420666f72206672656520627920616e796f6e652077686f206f776e7320616e206173747261676c616465206174205b68747470733a2f2f6173747261676c6164652e6265796f6e646e66742e696f2f706c616e6574732f5d2868747470733a2f2f6173747261676c6164652e6265796f6e646e66742e696f2f706c616e6574732f292e205768656e206120506c616e6574206973206d696e7465642c20746865206f776e65722773206173747261676c6164652077696c6c206f7262697420666f72657665722061726f756e642074686520706c616e657420746861742074686579206d696e742e61723a2f2f4a5974467674786c7079757232436470616f646d6f3436587a7554706d70304f774a6c31337246557272672f68747470733a2f2f6173747261676c6164652d6170692e6265796f6e646e66742e696f2f706c616e6574732f696d616765732f4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220f30cbbceaf5ea0b3e2efc2973708fcf6f41ca23d522b84480b98dfc503e8993764736f6c63430008090033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6680e700394e7fdc1edc8d57653f507a41929310000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x60806040526004361061021e5760003560e01c8063938e3d7b11610123578063cef6d368116100ab578063e9dc63751161006f578063e9dc637514610669578063ed1b314414610689578063f2fde38b1461069e578063f49f1b24146106be578063f4cc8f57146106d857600080fd5b8063cef6d368146105c1578063dc9ce7a5146105e5578063e879110114610614578063e8a3d48514610634578063e937a37a1461064957600080fd5b8063b240cba3116100f2578063b240cba314610504578063bf598afb14610531578063c15052c114610551578063c87b56dd1461058c578063cc524a89146105ac57600080fd5b8063938e3d7b146104905780639b561135146104b0578063af66be3f146104d0578063b079ac90146104f057600080fd5b806351fe9eff116101a6578063715018a611610175578063715018a6146104085780638bdb75191461041d5780638cd1d9d61461043d5780638da5cb5b1461045257806390c3f38f1461047057600080fd5b806351fe9eff14610360578063652350a0146103985780636ba4c138146103c85780636d70f7ae146103e857600080fd5b80632782d6c7116101ed5780632782d6c7146102b65780633ccfd60b146102fa5780633ef2c42a1461031157806340b42fcf146103315780634c85eb1f1461035157600080fd5b806301ffc9a71461022a5780631a0925411461025f5780631f22d2fe146102815780631f8cbe5c146102a157600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5061024a610245366004612168565b6106f8565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b50610274610765565b60405161025691906121f5565b34801561028d57600080fd5b5061027461029c366004612208565b61082d565b3480156102ad57600080fd5b50610274610839565b3480156102c257600080fd5b506102db6102d1366004612236565b5030916103e89150565b604080516001600160a01b039093168352602083019190915201610256565b34801561030657600080fd5b5061030f61087b565b005b34801561031d57600080fd5b5061030f61032c366004612262565b6109d8565b34801561033d57600080fd5b5061030f61034c3660046122a1565b610ac7565b34801561035d57600080fd5b50005b34801561036c57600080fd5b5061038061037b366004612208565b610b10565b6040516001600160a01b039091168152602001610256565b3480156103a457600080fd5b5061024a6103b3366004612208565b600f6020526000908152604090205460ff1681565b3480156103d457600080fd5b5061030f6103e33660046122be565b610b30565b3480156103f457600080fd5b5061024a6104033660046122a1565b610b8e565b34801561041457600080fd5b5061030f610bd1565b34801561042957600080fd5b5061030f6104383660046123a2565b610c35565b34801561044957600080fd5b50610274610c94565b34801561045e57600080fd5b506000546001600160a01b0316610380565b34801561047c57600080fd5b5061030f61048b3660046123a2565b610cd6565b34801561049c57600080fd5b5061030f6104ab3660046123a2565b610d31565b3480156104bc57600080fd5b50600654610380906001600160a01b031681565b3480156104dc57600080fd5b5061030f6104eb3660046122a1565b610d62565b3480156104fc57600080fd5b50600161024a565b34801561051057600080fd5b5061052461051f366004612208565b610da9565b6040516102569190612422565b34801561053d57600080fd5b50600554610380906001600160a01b031681565b34801561055d57600080fd5b5061057e61056c366004612208565b600e6020526000908152604090205481565b604051908152602001610256565b34801561059857600080fd5b506102746105a7366004612208565b610e4d565b3480156105b857600080fd5b5061030f610e59565b3480156105cd57600080fd5b506102db6105dc366004612208565b5030906103e890565b3480156105f157600080fd5b50610605610600366004612208565b610e8d565b6040516102569392919061246e565b34801561062057600080fd5b50600454610380906001600160a01b031681565b34801561064057600080fd5b50610274610fa0565b34801561065557600080fd5b50610274610664366004612236565b610faf565b34801561067557600080fd5b50610274610684366004612236565b610fda565b34801561069557600080fd5b5061024a6110cc565b3480156106aa57600080fd5b5061030f6106b93660046122a1565b6110fd565b3480156106ca57600080fd5b5060085461024a9060ff1681565b3480156106e457600080fd5b5061030f6106f33660046123a2565b6111c5565b60006001600160e01b03198216630434e6b560e31b148061072957506001600160e01b03198216633d855c6160e21b145b8061074457506001600160e01b0319821663e97405af60e01b145b8061075f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600a8054610774906124c3565b1515905061079d57604051806101c001604052806101868152602001612c506101869139905090565b600a80546107aa906124c3565b80601f01602080910402602001604051908101604052809291908181526020018280546107d6906124c3565b80156108235780601f106107f857610100808354040283529160200191610823565b820191906000526020600020905b81548152906001019060200180831161080657829003601f168201915b5050505050905090565b606061075f3383610faf565b606060098054610848906124c3565b1515905061086e57604051806060016040528060338152602001612e0760339139905090565b600980546107aa906124c3565b61088433610b8e565b6108a95760405162461bcd60e51b81526004016108a0906124fe565b60405180910390fd5b604080516060810191829052600091600b9060039082845b81546001600160a01b031681526001909101906020018083116108c15750939450479350849250600091506108f39050565b60200201516001600160a01b03166108fc606461091184601e612551565b61091b9190612586565b6040518115909202916000818181858888f19350505050158015610943573d6000803e3d6000fd5b5060208201516001600160a01b03166108fc6064610962846023612551565b61096c9190612586565b6040518115909202916000818181858888f19350505050158015610994573d6000803e3d6000fd5b5081600260200201516040516001600160a01b03909116904780156108fc02916000818181858888f193505050501580156109d3573d6000803e3d6000fd5b505050565b6109e133610b8e565b6109fd5760405162461bcd60e51b81526004016108a0906124fe565b60038160ff1610610a435760405162461bcd60e51b815260206004820152601060248201526f21494e4445585f4f564552464c4f572160801b60448201526064016108a0565b6001600160a01b038216610a8d5760405162461bcd60e51b815260206004820152601160248201527021494e56414c49445f414444524553532160781b60448201526064016108a0565b81600b8260ff1660038110610aa457610aa4612525565b0180546001600160a01b0319166001600160a01b03929092169190911790555050565b610ad033610b8e565b610aec5760405162461bcd60e51b81526004016108a0906124fe565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b565b600b8160038110610b2057600080fd5b01546001600160a01b0316905081565b60055460045433916001600160a01b03908116911660005b84811015610b8657610b7484878784818110610b6657610b66612525565b905060200201358585611220565b80610b7e8161259a565b915050610b48565b505050505050565b6000816001600160a01b0316610bac6000546001600160a01b031690565b6001600160a01b0316148061075f5750506006546001600160a01b0391821691161490565b6000546001600160a01b03163314610c2b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108a0565b610b0e60006115ac565b610c3e33610b8e565b610c5a5760405162461bcd60e51b81526004016108a0906124fe565b60085460ff1615610c7d5760405162461bcd60e51b81526004016108a0906125b5565b8051610c909060079060208401906120cf565b5050565b606060078054610ca3906124c3565b15159050610cc957604051806060016040528060318152602001612dd660319139905090565b600780546107aa906124c3565b610cdf33610b8e565b610cfb5760405162461bcd60e51b81526004016108a0906124fe565b60085460ff1615610d1e5760405162461bcd60e51b81526004016108a0906125b5565b8051610c9090600a9060208401906120cf565b610d3a33610b8e565b610d565760405162461bcd60e51b81526004016108a0906124fe565b610d5f816115fc565b50565b610d6b33610b8e565b610d875760405162461bcd60e51b81526004016108a0906124fe565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b610dcd60405180606001604052806000815260200160608152602001606081525090565b60055460405163b240cba360e01b8152600481018490526001600160a01b039091169063b240cba39060240160006040518083038186803b158015610e1157600080fd5b505afa158015610e25573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261075f9190810190612621565b606061075f3383610fda565b610e6233610b8e565b610e7e5760405162461bcd60e51b81526004016108a0906124fe565b6008805460ff19166001179055565b6000818152600e60205260408120548190606090610edf5760405162461bcd60e51b815260206004820152600f60248201526e21554e4b4e4f574e5f544f4b454e2160881b60448201526064016108a0565b6000848152600e6020526040812054610efd90633b9aca00906126d2565b90506000610f0a8261164a565b60055460405163b240cba360e01b8152600481018990529192506000916001600160a01b039091169063b240cba39060240160006040518083038186803b158015610f5457600080fd5b505afa158015610f68573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f909190810190612621565b5192979296509094509092505050565b6060600380546107aa906124c3565b60606000806000610fbf85610e8d565b925092509250610fd08383836118a4565b9695505050505050565b60606000806000610fea85610e8d565b9250925092506110a2610ffc866119ec565b611004610765565b61100c610839565b611015896119ec565b604051602001611026929190612702565b60405160208183030381529060405261103e876119ec565b611047876119ec565b61105087611af2565b61105b8a8a8a6118a4565b60405160200161106d93929190612731565b60408051601f198184030181529082905261108e95949392916020016127e1565b604051602081830303815290604052611edf565b6040516020016110b2919061290a565b604051602081830303815290604052935050505092915050565b6004546000906001600160a01b03166110f75750600480546001600160a01b03191633179055600190565b50600090565b6000546001600160a01b031633146111575760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108a0565b6001600160a01b0381166111bc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108a0565b610d5f816115ac565b6111ce33610b8e565b6111ea5760405162461bcd60e51b81526004016108a0906124fe565b60085460ff161561120d5760405162461bcd60e51b81526004016108a0906125b5565b8051610c909060099060208401906120cf565b6040516331a9108f60e11b81526004810184905282906000906001600160a01b03831690636352211e9060240160206040518083038186803b15801561126557600080fd5b505afa158015611279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129d919061294f565b9050856001600160a01b0316816001600160a01b0316148061133b575060405163e985e9c560e01b81526001600160a01b038281166004830152878116602483015283169063e985e9c59060440160206040518083038186803b15801561130357600080fd5b505afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b919061296c565b806113c9575060405163020604bf60e21b8152600481018690526001600160a01b03808816919084169063081812fc9060240160206040518083038186803b15801561138657600080fd5b505afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be919061294f565b6001600160a01b0316145b6114085760405162461bcd60e51b815260206004820152601060248201526f214e4f545f415554484f52495a45442160801b60448201526064016108a0565b604051637971ab0f60e11b81526001600160a01b03828116600483015260c06024830152600060c4830181905260448301889052606483018190526084830181905260a483015284919082169063f2e3561e9060e401602060405180830381600087803b15801561147857600080fd5b505af115801561148c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b0919061298e565b5060005b6115328742856114c56001436129a7565b4060408051602081018690529081018490526bffffffffffffffffffffffff19606084811b8216818401526074830184905241901b1660948201524460a88201523a60c882015260009060e801604051602081830303815290604052805190602001209050949350505050565b9050600f6000611546633b9aca00846126d2565b815260208101919091526040016000205460ff166114b4576000878152600e60205260408120829055600190600f90611583633b9aca00856126d2565b81526020810191909152604001600020805460ff19169115159190911790555050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805161160f9060039060208401906120cf565b507fdf1280b84eee5cd4ce59294c59ec7288bd49034d7f3d142f57ba9b47791563648160405161163f91906121f5565b60405180910390a150565b604080516020810182528281528151600680825260e0820190935260609281602001602082028036833701905050915061168781600a60c8612047565b8260008151811061169a5761169a612525565b60209081029190910101526116b2816005600f612047565b826001815181106116c5576116c5612525565b60209081029190910101526116de816000611388612047565b826002815181106116f1576116f1612525565b602002602001018181525050614e208260028151811061171357611713612525565b60200260200101511015611744576127108260018151811061173757611737612525565b6020026020010181815250505b6103e86117548260006002612047565b10611760576001611763565b60005b60ff168260038151811061177957611779612525565b602002602001018181525050614e208260028151811061179b5761179b612525565b602002602001015110156117e7576103e86117b98260026004612047565b6117c39190612586565b826004815181106117d6576117d6612525565b602002602001018181525050611865565b6103e86117f7826000600a612047565b6118019190612586565b8260048151811061181457611814612525565b60200260200101818152505060038260048151811061183557611835612525565b602002602001015111156118655760008260048151811061185857611858612525565b6020026020010181815250505b6103e86118758260006004612047565b61187f9190612586565b8260058151811061189257611892612525565b60200260200101818152505050919050565b60606000604051806040016040528060018152602001600b60fa1b815250905060006118e9846000815181106118dc576118dc612525565b60200260200101516119ec565b82611900866001815181106118dc576118dc612525565b84611917886002815181106118dc576118dc612525565b8660405160200161192d969594939291906129be565b6040516020818303038152906040529050611946610c94565b61194f876119ec565b611958876119ec565b8361196f886003815181106118dc576118dc612525565b866119868a6004815181106118dc576118dc612525565b8861199d8c6005815181106118dc576118dc612525565b6040516020016119b2969594939291906129be565b60408051601f19818403018152908290526119d294939291602001612a3d565b604051602081830303815290604052925050509392505050565b606081611a105750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611a3a5780611a248161259a565b9150611a339050600a83612586565b9150611a14565b60008167ffffffffffffffff811115611a5557611a55612333565b6040519080825280601f01601f191660200182016040528015611a7f576020820181803683370190505b5090505b8415611aea57611a946001836129a7565b9150611aa1600a866126d2565b611aac906030612ade565b60f81b818381518110611ac157611ac1612525565b60200101906001600160f81b031916908160001a905350611ae3600a86612586565b9450611a83565b949350505050565b60606000604051806040016040528060018152602001600b60fa1b81525090506000611ba2604051806040016040528060078152602001662a32b93930b4b760c91b81525061c35086600081518110611b4d57611b4d612525565b602002602001015110611b7e576040518060400160405280600681526020016553706172736560d01b81525061207c565b6040518060400160405280600581526020016444656e736560d81b8152505b61207c565b82604051602001611bb4929190612702565b6040516020818303038152906040529050611f4084600181518110611bdb57611bdb612525565b60200260200101511015611c555780611c2c6040518060400160405280600481526020016353697a6560e01b8152506040518060400160405280600481526020016354696e7960e01b81525061207c565b83604051602001611c3f93929190612af6565b6040516020818303038152906040529050611d27565b612ee084600181518110611c6b57611c6b612525565b60200260200101511015611cbe5780611c2c6040518060400160405280600481526020016353697a6560e01b815250604051806040016040528060068152602001654d656469756d60d01b81525061207c565b80611d026040518060400160405280600481526020016353697a6560e01b8152506040518060400160405280600581526020016411da585b9d60da1b81525061207c565b83604051602001611d1593929190612af6565b60405160208183030381529060405290505b80611db360405180604001604052806004815260200163466f726d60e01b815250614e2087600281518110611d5e57611d5e612525565b602002602001015110611d8c576040518060400160405280600381526020016247656f60e81b81525061207c565b6040518060400160405280600981526020016815195cdcd95c9858dd60ba1b81525061207c565b83611e4060405180604001604052806005815260200164536861646560d81b81525088600381518110611de857611de8612525565b6020026020010151600014611e1b576040518060400160405280600681526020016553696d706c6560d01b81525061207c565b60405180604001604052806007815260200166159a589c985b9d60ca1b81525061207c565b85611e786040518060400160405280600581526020016452696e677360d81b815250611b9d8b6004815181106118dc576118dc612525565b87611eb0604051806040016040528060058152602001644d6f6f6e7360d81b815250611b9d8d6005815181106118dc576118dc612525565b604051602001611ec7989796959493929190612b39565b60408051601f19818403018152919052949350505050565b6060815160001415611eff57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612e3a6040913990506000600384516002611f2e9190612ade565b611f389190612586565b611f43906004612551565b90506000611f52826020612ade565b67ffffffffffffffff811115611f6a57611f6a612333565b6040519080825280601f01601f191660200182016040528015611f94576020820181803683370190505b509050818152600183018586518101602084015b818310156120025760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b93820193909352600401611fa8565b60038951066001811461201c576002811461202d57612039565b613d3d60f01b600119830152612039565b603d60f81b6000198301525b509398975050505050505050565b6000612052846120a8565b61205c84846129a7565b6120669190612551565b612072846103e8612551565b611aea9190612ade565b60608282604051602001612091929190612bde565b604051602081830303815290604052905092915050565b8051600d81901b18601181901c18600581901b18815260006103e8825161075f91906126d2565b8280546120db906124c3565b90600052602060002090601f0160209004810192826120fd5760008555612143565b82601f1061211657805160ff1916838001178555612143565b82800160010185558215612143579182015b82811115612143578251825591602001919060010190612128565b5061214f929150612153565b5090565b5b8082111561214f5760008155600101612154565b60006020828403121561217a57600080fd5b81356001600160e01b03198116811461219257600080fd5b9392505050565b60005b838110156121b457818101518382015260200161219c565b838111156121c3576000848401525b50505050565b600081518084526121e1816020860160208601612199565b601f01601f19169290920160200192915050565b60208152600061219260208301846121c9565b60006020828403121561221a57600080fd5b5035919050565b6001600160a01b0381168114610d5f57600080fd5b6000806040838503121561224957600080fd5b823561225481612221565b946020939093013593505050565b6000806040838503121561227557600080fd5b823561228081612221565b9150602083013560ff8116811461229657600080fd5b809150509250929050565b6000602082840312156122b357600080fd5b813561219281612221565b600080602083850312156122d157600080fd5b823567ffffffffffffffff808211156122e957600080fd5b818501915085601f8301126122fd57600080fd5b81358181111561230c57600080fd5b8660208260051b850101111561232157600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561237257612372612333565b604052919050565b600067ffffffffffffffff82111561239457612394612333565b50601f01601f191660200190565b6000602082840312156123b457600080fd5b813567ffffffffffffffff8111156123cb57600080fd5b8201601f810184136123dc57600080fd5b80356123ef6123ea8261237a565b612349565b81815285602083850101111561240457600080fd5b81602084016020830137600091810160200191909152949350505050565b6020815281516020820152600060208301516060604084015261244860808401826121c9565b90506040840151601f1984830301606085015261246582826121c9565b95945050505050565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b818110156124b557845183529383019391830191600101612499565b509098975050505050505050565b600181811c908216806124d757607f821691505b602082108114156124f857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252600d908201526c2737ba1037b832b930ba37b91760991b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561256b5761256b61253b565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261259557612595612570565b500490565b60006000198214156125ae576125ae61253b565b5060010190565b6020808252600d908201526c214d4554415f46524f5a454e2160981b604082015260600190565b600082601f8301126125ed57600080fd5b81516125fb6123ea8261237a565b81815284602083860101111561261057600080fd5b611aea826020830160208701612199565b60006020828403121561263357600080fd5b815167ffffffffffffffff8082111561264b57600080fd5b908301906060828603121561265f57600080fd5b60405160608101818110838211171561267a5761267a612333565b6040528251815260208301518281111561269357600080fd5b61269f878286016125dc565b6020830152506040830151828111156126b757600080fd5b6126c3878286016125dc565b60408301525095945050505050565b6000826126e1576126e1612570565b500690565b600081516126f8818560208601612199565b9290920192915050565b60008351612714818460208801612199565b835190830190612728818360208801612199565b01949350505050565b7311161130b9ba3930b3b630b232a9b2b2b2111d1160611b81528351600090612761816014850160208901612199565b6f222c2261747472696275746573223a5b60801b6014918401918201528451612791816024840160208901612199565b722e961130b734b6b0ba34b7b72fbab936111d1160691b6024929091019182015283516127c5816037840160208801612199565b61227d60f01b6037929091019182015260390195945050505050565b7103d913730b6b2911d11283630b732ba1016960751b8152855160009061280f816012850160208b01612199565b7f222c226c6963656e7365223a2243432042592d534120342e30222c2264657363601291840191820152693934b83a34b7b7111d1160b11b6032820152865161285f81603c840160208b01612199565b7f222c22637265617465645f6279223a22466162696e2052617368656564222c22603c92909101918201527f74776974746572223a22406173747261676c616465222c22696d616765223a22605c82015285516128c381607c840160208a01612199565b6911161139b2b2b2111d1160b11b607c929091019182015284516128ee816086840160208901612199565b6128fd608682840101866126e6565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161294281601d850160208701612199565b91909101601d0192915050565b60006020828403121561296157600080fd5b815161219281612221565b60006020828403121561297e57600080fd5b8151801515811461219257600080fd5b6000602082840312156129a057600080fd5b5051919050565b6000828210156129b9576129b961253b565b500390565b6000875160206129d18285838d01612199565b8851918401916129e48184848d01612199565b88519201916129f68184848c01612199565b8751920191612a088184848b01612199565b8651920191612a1a8184848a01612199565b8551920191612a2c8184848901612199565b919091019998505050505050505050565b60008551612a4f818460208a01612199565b653f736565643d60d01b9083019081528551612a72816006840160208a01612199565b6f266173747261676c616465536565643d60801b600692909101918201528451612aa3816016840160208901612199565b6b26617474726962757465733d60a01b601692909101918201528351612ad0816022840160208801612199565b016022019695505050505050565b60008219821115612af157612af161253b565b500190565b60008451612b08818460208901612199565b845190830190612b1c818360208901612199565b8451910190612b2f818360208801612199565b0195945050505050565b600089516020612b4c8285838f01612199565b8a5191840191612b5f8184848f01612199565b8a51920191612b718184848e01612199565b8951920191612b838184848d01612199565b8851920191612b958184848c01612199565b8751920191612ba78184848b01612199565b8651920191612bb98184848a01612199565b8551920191612bcb8184848901612199565b919091019b9a5050505050505050505050565b6e3d913a3930b4ba2fba3cb832911d1160891b81528251600090612c0981600f850160208801612199565b6a1116113b30b63ab2911d1160a91b600f918401918201528351612c3481601a840160208801612199565b61227d60f01b601a9290910191820152601c0194935050505056fe4173747261676c61646520506c616e65747320697320616e20657874656e73696f6e206f662070726f6a656374204173747261676c616465202868747470733a2f2f6e7572656361732e636f6d2f6173747261676c616465292e20506c616e6574732061726520616e20696e74657261637469766520616e642067656e657261746976652033442061727420746861742063616e206265206d696e74656420666f72206672656520627920616e796f6e652077686f206f776e7320616e206173747261676c616465206174205b68747470733a2f2f6173747261676c6164652e6265796f6e646e66742e696f2f706c616e6574732f5d2868747470733a2f2f6173747261676c6164652e6265796f6e646e66742e696f2f706c616e6574732f292e205768656e206120506c616e6574206973206d696e7465642c20746865206f776e65722773206173747261676c6164652077696c6c206f7262697420666f72657665722061726f756e642074686520706c616e657420746861742074686579206d696e742e61723a2f2f4a5974467674786c7079757232436470616f646d6f3436587a7554706d70304f774a6c31337246557272672f68747470733a2f2f6173747261676c6164652d6170692e6265796f6e646e66742e696f2f706c616e6574732f696d616765732f4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220f30cbbceaf5ea0b3e2efc2973708fcf6f41ca23d522b84480b98dfc503e8993764736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6680e700394e7fdc1edc8d57653f507a41929310000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : contractURI_ (string):
Arg [1] : owner_ (address): 0x0000000000000000000000000000000000000000
Arg [2] : planetsContract_ (address): 0x0000000000000000000000000000000000000000
Arg [3] : astragladeContract_ (address): 0xf6680e700394e7fDC1Edc8d57653F507A4192931
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 000000000000000000000000f6680e700394e7fdc1edc8d57653f507a4192931
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.