Mint
Understanding the minting function step-by-step.
Last updated
Understanding the minting function step-by-step.
Last updated
The event of minting an option requires the following initial information: 1. Option Amount 2. Owner
After the information was supplied to the contract, the mint
function will perform the following activities:
Calculate the number of assets the user has to send to the contract to lock as collateral.
If this is a put option:
If this is a call option:
is a variable where we store the current amount of the strike asset. If the strike asset is an interest-bearing token, it is expected that will have accrued some interest since the last period. We are calling balanceOf()
from ERC20
strike asset to check option contract strike asset balance.
If this is a put option:
If this is a call option:
Update the current number of outstanding options minted by the same user on the same option series.
This factor updates the current owner shares. Important: If the user had previously minted options, those would be accounted for as one factor.
This session described mathematically how the contract logic works. It is not needed to update the total ERC20 balances at the code level since tokens transfer to or from the contract is automatically updated with the ERC20 implementation.
Minting options ✅
is a variable where we store the total amount of underlying assets currently locked in the protocol. This function has a precise fit with call options since in call options, the underlying asset is the asset locked as collateral. We are calling balanceOf()
from ERC20
an underlying asset to check option contract strike asset balance.
is a variable that stores the shares of the user based on the current option contract situation.
If
If we identify the following cases:
is the sum of all the owner's individual factor of .
Using (accrued with interest from the last period) we'll add the to transfer used while minting this option.