Capsule.sol
Last updated
Last updated
The Capsule NFT contract ("Capsule contract") is the base ERC-721 NFT utilized by the Capsule Protocol. The other contracts (CapsuleFactory.sol and CapsuleMinter.sol) mint, burn, and interact with this contract. Any NFT generated from the Capsule Protocol is of this type.
A new instance of this contract is deployed each time a Capsule Collection is created.
Usage: Lock the collection at a provided NFT count (the collection total Capsule NFT count), preventing any further minting past the given number. The set maxId
of this collection will be the provided NFT count minus one, for clarity (without subtracting 1, a lock count of 15
would provide for 16
NFTs, as it includes the 0
count).
Parameters:
_name
: (uint256) - the count at which to lock the Capsule Collection from further minting
Usage: Check if the Capsule Collection is locked. This is checked by ensuring the maxId
is less than the counter.
Parameters: (none)
Usage: Transfer ownership of the Capsule to _newOwner
. The new owner of the Capsule NFT will be able to call any owner-only methods from the contract.
Parameters:
_account
: (address) - The address (account) to pass ownership onto. This can also be the zero address.
Usage: Check the tokenURI of a Capsule at id tokenId
. The tokenURI will map to the NFT metadata.
Parameters:
_tokenId
: (uint256) - the id of the NFT
Usage: Set new token URI for a given tokenId. Only the tokenURI owner, also known as the Metamaster, can set a new URI.
Parameters:
_tokenId
: (uint256) - the id of the NFT to burn
_newTokenURI
: (string) - the new NFT at _tokenId
's tokenURI
Usage: Update the tokenURIowner. Only the tokenURIOwner, also known as the Metamaster, can call this function.
Parameters:
_account
: (address) - The new address to become the tokenURIOwner (Metamaster)
Usage: Check if the passed in address of _account
is allowed to mint from the collection.
Parameters:
_account
: (address) - The address (account) to check
Usage: Check if a Capsule (at id tokenId
) of the current collection exists.
Parameters:
_tokenId
: (uint256) - the id of the NFT
Usage: Called upon creation of Capsule. The CapsuleFactory calls the constructor upon creation of a Capsule Collection.
Parameters:
_name
: (string) - the name of the Capsule Collection
_symbol
: (string) - the symbol of the Capsule Collection
_tokenURIOwner
: (address) - the address of the Capsule Collection tokenURIOwner (also known as the Metamaster)
_isCollectionPrivate
: (boolean) - whether the Capsule Collection is designated as private
Usage: Create an NFT from this collection. This method is uneditable by users, as only the CapsuleMinter may mint NFTs from this collection. Users interact with this mint through the CapsuleMinter's mintCapsule
methods.
Parameters:
_account
: (address) - the account to receive the NFT
_uri
: (string) - the set NFT tokenURI
Usage: Burn an NFT from this collection. This method is uneditable by users, as only the CapsuleMinter may burn NFTs from this collection. Users interact with this burn through the CapsuleMinter's burnCapsule
methods.
Parameters:
_account
: (address) - the account that is burning the NFT
_tokenId
: (uint256) - the id of the NFT to burn
Usage: The current version.
Usage: The current Capsule Collection counter (used as an id).
Usage: The maximum id the collection is allowed to mint up to (this may also be set to the MaxUInt256
to signify no maximum). The maxId may be set to a number lower than the current counter
or id, in which case no further Capsules may be minted from this collection.
Usage: The address of the CapsuleFactory this Capsule is attached to.
Usage: The current tokenURIOwner of the collection - this parameter may also be known as the 'Metamaster'.
Usage: A boolean which designates whether the collection is private (true
) or public (false
).