🚶♂️Minter Reward Model (the Math)
The mechanism of how mint attempts are resolved.
Summary
Upon mint attempt, the PerpetualMint contracts request a random number from ChainlinkVRF. The random number is used to determine whether the mint attempt is successful, and then, if the attempt was successful, which of the deposited tokens is minted. If the attempt is unsuccessful, an alternative prize is minted, and the random number is used to determine what rarity the prize will have.
Determining Mint Outcome
This is an outline of what the protocol does upon a user minting:
When a user requests to mint, Insrt fetches a random number from ChainlinkVRF.
The size of the random number is between
0
and2^256 - 1
. This range is far too large for our purposes, since all probabilities are determined relative to a denominator or basis , which for PerpetualMint, is . This means the random number can be "Chunked" and maintain its randomness. "Chunking" is the process where a number is split up into its bit constituents. Since the bits are random to begin with, splitting them maintains the original randomness, so long as no bit shifting is done. For example, if a number1289312375
is random, and it is chunked into12893
and12375
, then those two numbers are also random. The amount of chunks depends on how many random numbers are needed overall. In the case of an ERC721 asset mint, this is two numbers, so the random number is chunked into two. The first number is used to determine whether the mint is successful and the second random number is used to determine which of the deposited assets is picked.The method to determine the outcome of the mint attempt using is outlined below:
Each deposited NFT has a risk parameter associated with it.
The chance for a mint to be successful, denoted by , is the average risk parameter across all deposited assets in a pool. Given that each deposited NFT has a risk parameter assigned to it, the total risk across all assets is where is the number of deposited assets. Hence, is found to be , where .
Since the random number may be larger than the basis , we normalize it by taking in order to ensure . This number is referred to as the "mint number".
If is greater than or equal to the average risk, , the mint is deemed successful. Otherwise, the mint is deemed unsuccessful and no deposited NFT is minted.
Determining Minted Asset Upon Successful Mint
In the case of a successful mint, another random number is used to select which deposited NFT is assigned from a collection.
Recall that each deposited NFT has a risk parameter associated with it, and that the total risk across all assets is , where is the number of deposited assets.
Since the random number may be larger than the sum of risks , we once again normalize it by taking , where . This number is referred to as the "picking number".
We then compare the sampled value of to the cumulative sums of the risks . The selected index is the smallest which satisfies the condition . In other words, if lies in the interval , the index is selected.
Determining ERC1155 Minted Asset Owner
The process for determining whether an ERC1155 asset is minted, and which token from the collection is minted, is similar to the steps taken for ERC721 collections outlined above. The key difference is that since more than one Depositor may have deposited the same token ID, it is necessary to determine which Depositor is chosen out of those who have deposited the minted token ID.
If the mint attempt pertains to an ERC1155 collection, the second random number is further chunked into and , which are used to select the minted token, and the depositor of the minted token respectively, as there may be more than one depositor.
Each Depositor is associated with a "total risk", denoted by , corresponding to the selected token ID that is to be paid out as a prize. represents the aggregate risk of a Depositor for a specific token ID, accounting for the possibility that a single user may deposit more than one token with the same ID. Formally, we can say , where is the number of tokens deposited, and is the user-defined risk parameter for the NFT.
The random number is normalized with respect to the sum of depositor risks , where is the number of depositors; giving us .
The individual depositor risks are added until exceeds the cumulative risk. At that point, the depositor matching the last added risk value is selected as the depositor of the minted asset.
Determining Consolation Asset
If the mint is unsuccessful, the second random number is used to determine the rarity of the consolation prize that is minted.
The consolation assets have five tiers with the following probabilities:
,
,
,
, and
.
The number is then normalized to be smaller than the sample space , which in this case is the basis ; resulting in a "picking number" of .
The number is then compared to so that, for example, if a tier 1 asset is minted, if a tier 2 asset is minted and if a tier 5 asset is minted. The method of value determination for the consolation assets may be found here.
Last updated