Function: mintWithDiscountAndLock(uint256 shares, uint32 lockDuration, address receiver)
Deposits assets into the vault in order to mint a specified amount of shares minus a discount and then locks the shares into a minted NFT.
Inputs
shares
Control: Arbitrary.
Constraints: Must be less than max mint. Asset transfer to pay for shares must succeed.
Impact: Amount of shares to mint.
lockDuration
Control: Arbitrary.
Constraints: Must cause nonzero discount.
Impact: Duration before NFT can be redeemed.
receiver
Control: Arbitrary.
Constraints: None.
Impact: Receiver of the NFT.
Branches and code coverage
Intended branches
Deposit and lock succeeds.
Negative behavior
Deposit fails due to whitelist.
Deposit fails due to being over max mint.
Deposit fails due to asset-transfer failure.
Deposit fails due to zero or negative discount.
Function call analysis
this._executeDiscountAndLock(assets, assets * OstiumVault.PRECISION_2 * uint16(100) / OstiumVault.PRECISION_2 * uint16(100) + this.lockDiscountP(this.collateralizationP(), lockDuration), shares, lockDuration, receiver)
See
_executeDiscountAndLock
(ref↗).