I am reading through UniswapV2 docs and can't understand the inputs of addLiquidity
method properly.
As listed in the docs:
amountAMin
(uint): Bounds the extent to which the B/A price can go up before the transaction reverts. Must be <= amountADesired.
amountBMin
(uint): Bounds the extent to which the A/B price can go up before the transaction reverts. Must be <= amountBDesired.
What does it mean? Can you please give an example? Let's say, I set amountADesired
and amountBDesired
to 4 and amountAMin
and amountBMin
to 1. What will happen?
blockchain transactions are not immediate, but must queue before being mined on the blockchain and be effective
When you add liquidity given amountADesired
you have to give it amountBDesired
in proportion to the existing pair (example pair: 2:1 you have to put 2 tokens A and 1 token B)
once you send the transaction, before it is mined it may happen that others make operations on that liquidity pool, changing the proportion accordingly
by entering amountAmin
and amountBmin
you are practically telling him: "as long as the proportion is between amountADesired
:amountBDesired
and amountAMin
:amountBmin
accepts my liquidity addition, if instead the proportion exceeds my range, cancel my transaction"