JBTiered721DelegateStore
Inherits: IJBTiered721DelegateStore
This contract stores and manages data for an IJBTiered721Delegate's NFTs.
State Variables
_ONE_BILLION
Just a kind reminder to our readers.
Used in token ID generation.
uint256 private constant _ONE_BILLION = 1_000_000_000;
_tierIdAfter
Returns the tier ID which should come after the provided tier ID when sorting by contribution floor.
If empty, assume the next tier ID should come after.
mapping(address => mapping(uint256 => uint256)) internal _tierIdAfter;
_reservedTokenBeneficiaryOf
Returns optional reserved token beneficiary addresses for the provided tier and NFT contract.
mapping(address => mapping(uint256 => address)) internal _reservedTokenBeneficiaryOf;
_storedTierOf
Returns the tier at the provided contract and tier ID.
mapping(address => mapping(uint256 => JBStored721Tier)) internal _storedTierOf;
_flagsOf
Returns flags that influence the behavior of each NFT contract.
mapping(address => JBTiered721Flags) internal _flagsOf;
_isTierRemovedBitmapWord
For each tier ID, return a bitmap containing flags indicating whether the tier has been removed.
mapping(address => mapping(uint256 => uint256)) internal _isTierRemovedBitmapWord;
_trackedLastSortTierIdOf
For each NFT, return the tier ID that comes last when sorting.
If not set, it is assumed the maxTierIdOf
is the last sorted.
mapping(address => uint256) internal _trackedLastSortTierIdOf;
_startingTierIdOfCategory
Returns the ID of the first tier in the provided NFT contract and category.
mapping(address => mapping(uint256 => uint256)) internal _startingTierIdOfCategory;
maxTierIdOf
Returns the largest tier ID used on the provided NFT contract.
This may not include the last tier ID if it has been removed.
mapping(address => uint256) public override maxTierIdOf;
tierBalanceOf
Returns the number of NFTs held by the provided address which belong to the provided tier and NFT contract.
mapping(address => mapping(address => mapping(uint256 => uint256))) public override tierBalanceOf;
numberOfReservesMintedFor
Returns the number of reserved tokens which have been minted within the provided tier and NFT contract.
mapping(address => mapping(uint256 => uint256)) public override numberOfReservesMintedFor;
numberOfBurnedFor
Returns the number of tokens belonging to the provided tier and NFT contract which have been burned.
mapping(address => mapping(uint256 => uint256)) public override numberOfBurnedFor;
defaultReservedTokenBeneficiaryOf
Returns the reserved token beneficiary address used when a tier doesn't specify a beneficiary.
mapping(address => address) public override defaultReservedTokenBeneficiaryOf;
tokenUriResolverOf
Returns a custom token URI resolver which supersedes the base URI.
mapping(address => IJB721TokenUriResolver) public override tokenUriResolverOf;
encodedIPFSUriOf
Returns the encoded IPFS URI for the provided tier and NFT contract.
Token URIs managed by this contract are stored as 32 bytes and based on stripped down IPFS hashes.
mapping(address => mapping(uint256 => bytes32)) public override encodedIPFSUriOf;
Functions
tiersOf
Gets an array of active tiers.
function tiersOf(
address _nft,
uint256[] calldata _categories,
bool _includeResolvedUri,
uint256 _startingId,
uint256 _size
) external view override returns (JB721Tier[] memory _tiers);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to get tiers for. |
_categories | uint256[] | The categories of the tiers to get. Send empty for all categories. |
_includeResolvedUri | bool | If enabled, if there's a token URI resolver, the content will be resolved and included. |
_startingId | uint256 | The starting tier ID of the array of tiers sorted by contribution floor. Send 0 to get all active tiers. |
_size | uint256 | The number of tiers to include. |
Returns
Name | Type | Description |
---|---|---|
_tiers | JB721Tier[] | An array of active tiers. |
tierOf
Return the tier for the provided tier ID and NFT contract.
function tierOf(address _nft, uint256 _id, bool _includeResolvedUri) public view override returns (JB721Tier memory);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to get a tier from. |
_id | uint256 | The tier ID of the tier to get. |
_includeResolvedUri | bool | If enabled, if there's a token URI resolver, the content will be resolved and included. |
Returns
Name | Type | Description |
---|---|---|
<none> | JB721Tier | The tier. |
tierOfTokenId
Return the tier for the provided token ID and NFT contract.
function tierOfTokenId(address _nft, uint256 _tokenId, bool _includeResolvedUri)
external
view
override
returns (JB721Tier memory);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to get a tier from. |
_tokenId | uint256 | The token ID to return the tier of. |
_includeResolvedUri | bool | If enabled, if there's a token URI resolver, the content will be resolved and included. |
Returns
Name | Type | Description |
---|---|---|
<none> | JB721Tier | The tier. |
totalSupplyOf
The total number of NFTs issued from all tiers of the provided NFT contract.
function totalSupplyOf(address _nft) external view override returns (uint256 supply);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to get a total supply of. |
Returns
Name | Type | Description |
---|---|---|
supply | uint256 | The total number of NFTs issued from all tiers. |
numberOfReservedTokensOutstandingFor
Returns the number of currently mintable reserved tokens for the provided tier ID and NFT contract.
function numberOfReservedTokensOutstandingFor(address _nft, uint256 _tierId) external view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to check for mintable reserved tokens. |
_tierId | uint256 | The tier ID to check for mintable reserved tokens. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of currently outstanding reserved tokens within the tier and contract. |
votingUnitsOf
Returns the total voting units from all of an addresses' NFTs (across all tiers) for the provided NFT contract. NFTs have a tier-specific number of voting units.
function votingUnitsOf(address _nft, address _account) external view virtual override returns (uint256 units);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to get voting units within. |
_account | address | The address to get the voting units of. |
Returns
Name | Type | Description |
---|---|---|
units | uint256 | The total voting units for the address. |
tierVotingUnitsOf
Returns the voting units for an addresses' NFTs in one tier. NFTs have a tier-specific number of voting units.
function tierVotingUnitsOf(address _nft, address _account, uint256 _tierId)
external
view
virtual
override
returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to get voting units within. |
_account | address | The address to get the voting units of. |
_tierId | uint256 | The tier ID to get voting units within. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The voting units for the address within the tier. |
encodedTierIPFSUriOf
Resolves the encoded IPFS URI of the tier for the provided token ID and NFT contract.
function encodedTierIPFSUriOf(address _nft, uint256 _tokenId) external view override returns (bytes32);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to which the encoded IPFS URI belongs. |
_tokenId | uint256 | The token ID to get the encoded IPFS URI of. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | The encoded IPFS URI. |
flagsOf
Flags that influence the behavior of each NFT.
function flagsOf(address _nft) external view override returns (JBTiered721Flags memory);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract for which the flags apply. |
Returns
Name | Type | Description |
---|---|---|
<none> | JBTiered721Flags | The flags. |
isTierRemoved
Check if the provided tier has been removed from the current set of tiers.
function isTierRemoved(address _nft, uint256 _tierId) external view override returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract of the tier to check for removal. |
_tierId | uint256 | The tier ID to check for removal. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the tier has been removed. |
balanceOf
The total number of tokens owned by the provided address.
function balanceOf(address _nft, address _owner) public view override returns (uint256 balance);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract to check the balance within. |
_owner | address | The address to check the balance of. |
Returns
Name | Type | Description |
---|---|---|
balance | uint256 | The number of tokens owned by the owner across all tiers within the NFT contract. |
redemptionWeightOf
The cumulative redemption weight of the given token IDs compared to the totalRedemptionWeight
.
function redemptionWeightOf(address _nft, uint256[] calldata _tokenIds) public view override returns (uint256 weight);
Parameters
Name | Type | Description |
---|---|---|
_nft | address | The NFT contract which the redemption weight is being calculated within. |
_tokenIds | uint256[] | The IDs of the tokens to get the cumulative redemption weight of. |
Returns
Name | Type | Description |
---|---|---|
weight | uint256 | The weight. |