πΆββοΈ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
0and2^256 - 1. This range is far too large for our purposes, since all probabilities are determined relative to a denominator or basis B, which for PerpetualMint, is B=1000000000. 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 number1289312375is random, and it is chunked into12893and12375, 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 t is used to determine whether the mint is successful and the second random number p is used to determine which of the deposited assets is picked.The method to determine the outcome of the mint attempt using t is outlined below:
Each deposited NFT has a risk parameter Riββ(0,B]associated with it.
The chance for a mint to be successful, denoted by P(M), is the average risk parameter across all deposited assets in a pool. Given that each deposited NFT has a risk parameter Riβ assigned to it, the total risk across all assets is S=i=1βNβRiβ where N is the number of deposited assets. Hence, P(M) is found to be P(M)=N1βi=1βNβRiβ, where 0<P(M)β€B.
Since the random number tβ[0,2128β1] may be larger than the basis B, we normalize it by taking t~=tmod(B) in order to ensure t~β[0,Bβ1]. This number t~ is referred to as the "mint number".
If t~ is greater than or equal to the average risk, t~β₯P(M), 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 Riββ(0,B] associated with it, and that the total risk across all assets is S=i=1βNβRiβ, where N is the number of deposited assets.
Since the random number p may be larger than the sum of risks S, we once again normalize it by taking p~β=pmod(S), where p~ββ[0,Sβ1]. This number p~β is referred to as the "picking number".
We then compare the sampled value of p~β to the cumulative sums of the risks Riβ. The selected index is the smallest i which satisfies the condition p~β<j=1βiβRjβ. In other words, if p~β lies in the interval [j=1βiβ1βRjβ,j=1βiβRjβ), the index i 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 p is further chunked into p1β and p2β, 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 Rdβ, corresponding to the selected token ID that is to be paid out as a prize. Rdβ 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 Rdβ=Kβ Riβ, where K is the number of tokens deposited, and Riβ is the user-defined risk parameter for the NFT.
The random number p1β is normalized with respect to the sum of depositor risks R=d=0βDβRdβ, where D is the number of depositors; giving us p1β~β=p1βmod(R).
The individual depositor risks Rdβ are added until p1β~β 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 p2β is used to determine the rarity of the consolation prize that is minted.
The consolation assets have five tiers with the following probabilities:
TierΒ 1:Β P(T1)=1000000000500000000β=50% ,
TierΒ 2:Β P(T2)=1000000000330000000β=33% ,
TierΒ 3:Β P(T3)=1000000000125000000β=12.5% ,
TierΒ 4:Β P(T4)=100000000040000000β=4% , and
TierΒ 5:Β P(T5)=10000000005000000β=0.5% .
The number p2β is then normalized to be smaller than the sample space S, which in this case is the basis B; resulting in a "picking number" of p2β~β=p2βmod(B).
The number p2β~β is then compared to T1,T2,T3,T4,T5 so that, for example, if p2β~β<T1 a tier 1 asset is minted, if T3<p2β~β<T2 a tier 2 asset is minted and if p2β~β<T5 a tier 5 asset is minted. The method of value determination for the consolation assets may be found here.
Last updated