π©βπ¬Minting Resolution (Technical)
Explanation of how the minting attempts are resolved, and a prize is selected.
After a user mints, the minting process happens in three steps:
A random number is requested from the Chainlink VRF contracts
Chainlink VRF fulfills the request for random numbers by prodiving them
The random numbers are used to determine the outcome of the minting attempt
This section is concerned with step 3 of the process - the method by which the mint outcomes are determined.
Resolution Process
To begin with, two random numbers are received from Chainlink VRF. The first is used to determine whether an asset has been one. If no asset is won, the second random number is used to determine which $MINT tier is selected. Therefore, there are up to two steps to determine a minting outcome:
Determine if an asset is won
If no asset is won, select a $MINT tier.
Normalizing Random Values
Every percentage calculation involves a "base" - for example, in the case of "percent" the base is 100, so that 10% means "10 out of 100". In the PerpetualMint contracts, the base of 1000000000 is used - this means that 10% corresponds to "100 000 000 out of 1 000 000 000".
The random numbers received from Chainlink VRF have a range from 0
to 2^256 - 1
so the values are normalized to the base prior to being used in percentage calculations. Thus, the random number is normalized to using the modulo function with the base :
Now is such that hence it represents a probability.
Determining if an Asset is Won
Each asset collection has a risk associated with it, known as the "collection risk" and denoted by . Given the probability derived from the random number,, the winning condition is simply:
If this condition is satisfied, an ERC1155 token is minted to the minting account, which is derived from the collection address. This token is the receipt (or "IOU") that an account has an asset owed to them. Minters may trade these tokens freely!
Determining $MINT Tier
If an asset is not won, then the second random number is normalized and used to select the $MINT tier rarity. The second normalized random number will be denoted by for simplicity.
If each tier has an associated probability of being selected , the condition for selecting the tier with that probability:
This check is done against every tier, with its associated probability, until the above inequality is satisfied, at which point, the tier corresponding to that risk is selected, and the $MINT tokens are minted.
Last updated