πŸ‘©β€πŸ”¬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:

  1. A random number is requested from the Chainlink VRF contracts

  2. Chainlink VRF fulfills the request for random numbers by prodiving them

  3. 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:

  1. Determine if an asset is won

  2. 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 RR is normalized to R~\tilde{R} using the modulo function with the base BB:

R~=Rmod  (B)\tilde{R} =R\mod (B)

Now R~\tilde{R} is such that R~∈(0,B]=(0,1000000000]\tilde{R} \in (0, B] = (0, 1000000000]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 Rˉ\bar{R} . Given the probability derived from the random number,R~\tilde{R}, the winning condition is simply:

R~<Rˉ\tilde{R} < \bar{R}

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 R~\tilde{R} for simplicity.

If each tier tt has an associated probability of being selected RtR_t, the condition for selecting the tier with that probability:

R~<Rt\tilde{R} < R_t

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