Conversation
| d_prod: U256, | ||
| sum_x: Balance, | ||
| ) -> Option<U256> { | ||
| let ann = amp_factor.checked_mul(N_COINS.into())?; |
There was a problem hiding this comment.
I guess ann should be amp_factor * N ** N, but here is amp_factor * N
| .checked_div(x.checked_mul(N_COINS.into())?.into())?; | ||
| c = c | ||
| .checked_mul(d)? | ||
| .checked_div(ann.checked_mul(N_COINS.into())?.into())?; |
There was a problem hiding this comment.
the code logic shows n ** (2+n) but comment suggests n ** (2n)
| for (idx, min_amount) in min_amounts.iter().enumerate() { | ||
| if *min_amount != 0 { | ||
| let (amount_out, fee) = invariant | ||
| .compute_withdraw_one( |
There was a problem hiding this comment.
It seems compute_withdraw_one has figured out the outcome for remove shares with one type of token. When user want withdraw both tokens, each output token balance represent the shares, so cause an insistency with share reduced and tokens balances withdrawed.
|
When LP deposit and/or withdraw liquidity in a not perfect ratio, a fee will be charged. So, Why not we just suggest them to deposit and withdraw with perfect ratio to avoid fees? Is there any requirements that leads to support the unbalanced deposit/withdraw actions especially withdraw with one type of token? |
marco-sundsk
left a comment
There was a problem hiding this comment.
Besides comments, I made some changes in my folk repo and initate a PR to this repo, please check it.
Adding a new type of pool for stable swap between two tokens that have equally priced.