Function: mint(address to)
This function can be called to mint liquidity tokens in exchange for providing liquidity.
Inputs
toControl: Arbitrary.
Constraints: None.
Impact: Recipient of the tokens.
Branches and code coverage
Intended branches
Computes and mints the amount of liquidity tokens owed to the caller (initial case when
_totalSupplyis zero).Computes and mints the amount of liquidity tokens owed to the caller (
_totalSupplyis not zero).Handles minting fees.
Updates cached reserves.
Updates cached liquidity EMA value every time a new block is processed.
Negative behavior
Reverts if no liquidity tokens are minted.
Function call analysis
IERC20(this.token0).balanceOf(address(this))What is controllable? Nothing.
If the return value is controllable, how is it used and how can it go wrong? Used to determine the amount of
token0in.What happens if it reverts, reenters or does other unusual control flow? Reverts are propagated upwards. Reentrancy is prevented via reentrancy guards.
IERC20(this.token1).balanceOf(address(this))What is controllable? Nothing.
If the return value is controllable, how is it used and how can it go wrong? Used to determine the amount of
token1in.What happens if it reverts, reenters or does other unusual control flow? Reverts are propagated upwards. Reentrancy is prevented via reentrancy guards.
this._mintFee(_reserve0, _reserve1) -> IDeltaSwapFactory(this.factory).feeTo()What is controllable? Nothing.
If the return value is controllable, how is it used and how can it go wrong? Not controllable.
What happens if it reverts, reenters or does other unusual control flow? N/A.
this._update(balance0, balance1, _reserve0, _reserve1)What is controllable?
balance0andbalance1, by transferring to the contract.If the return value is controllable, how is it used and how can it go wrong? Not used.
What happens if it reverts, reenters or does other unusual control flow? Reverts are propagated upwards. Reentrancy is not possible.