Function: mint(address to)
This function can be called to mint liquidity tokens in exchange for providing liquidity.
Inputs
to
Control: 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
_totalSupply
is zero).Computes and mints the amount of liquidity tokens owed to the caller (
_totalSupply
is 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
token0
in.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
token1
in.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?
balance0
andbalance1
, 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.