pancakeswap / pancake-v4-core

GNU General Public License v2.0
52 stars 36 forks source link

chore: tweak min share validation #169

Closed ChefMist closed 1 month ago

ChefMist commented 1 month ago

This PR tweaks the minBinShareForDonate from 1e18 to 1e3

Context:

  1. we added the limitation as part of this PR: https://github.com/pancakeswap/pancake-v4-core/pull/148
  2. 1e18 was a magic number we derived as for most cases, most pool will have at least that amount of liquidity easily

Why we change:

  1. potentially there might be other scenario that we've missed where pool might have lesser than 1e18 liqudity (eg. pool where token0 and token1 price differences are very big and very little token in pool)

  2. 1e3 would probably be a good min level (similar to pcs v2 of burning 10e3 lp), as attacker need at least 3x fund of victim to perform share inflation. eg. if they mint with 1000 token, attacker need 1000 * 1e3 tokens.

However we are keeping the initial 2 ** 128 for now until we see such cases where we need to adjust setMinBinSharesForDonate