👩🔬

# 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.

- 1.Determine if an asset is won
- 2.If no asset is won, select a $MINT tier.

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 $R$

is normalized to $\tilde{R}$

using the modulo function with the base $B$

:$\tilde{R} =R\mod (B)$

Now

$\tilde{R}$

is such that $\tilde{R} \in (0, B] = (0, 1000000000]$

hence it represents a probability.Each asset collection has a risk associated with it, known as the "collection risk" and denoted by

$\bar{R}$

. Given the probability derived from the random number,$\tilde{R}$

, the winning condition is simply:

$\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!**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

$\tilde{R}$

for simplicity.If each tier

$t$

has an associated probability of being selected $R_t$

, the condition for selecting the tier with that probability:$\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 modified 2mo ago