Function: callerFundedMint(MintParams params, uint256 depositAmount, bytes signature)
This function mints an amount of USDf tokens for the recipient, calculated based on the token price.
Inputs
paramsControl: Fully controlled by the caller.
Constraints: N/A.
Impact: Struct of
MintParamsthat has information for minting.
depositAmountControl: Fully controlled by the caller.
Constraints: N/A.
Impact: Amount of tokens to deposit.
signatureControl: Fully controlled by the caller.
Constraints: The address recovered using the generated hash and corresponding signature must possess the
MINTER_ROLE.Impact: Bytes of signature.
Branches and code coverage
Intended branches
Check if the caller is equal to
params.caller.Check if
depositAmountis not zero.Check if
depositAmountis smaller thanparams.maxAmount.Check if
params.recipientis not the zero address.Check if
params.expiryis bigger thanblock.timestampto confirm the transaction is not expired.Check that the nonce has not been used before.
Check if the recovered address using the signature has
BACKEND_SIGNER_ROLE.Transfer collateral to treasury.
Calculate mint amount with precise scaling and mint an amount of USDf.
Negative behavior
If the caller is not equal to
params.caller, the transaction will be reverted.If
depositAmountis zero, the transaction will be reverted.If
depositAmountis bigger than or equal toparams.maxAmount, the transaction will be reverted.If
params.recipientis the zero address, the transaction will be reverted.If
params.expiryis smaller than or equal toblock.timestamp, the transaction will be reverted.If the nonce has been used before, the transaction will be reverted.
If the recovered address using the signature does not have
BACKEND_SIGNER_ROLE, the transaction will be reverted.