FIX: ILP Attack Vector For Staged Pools
Overview
If a pool is set with a deliberately low asset price during staged, the deployer of the pool can claim a large ILP even if the asset is legitimate.
Desired
During staging, the price might be very wrong. It will only be correct when swaps are enabled and arbitrage can happen. Only write deposit values for computing ILP when the pool is active.
Implementation
During staged, set all LP deposit values to 0. This means they can never claim an ILP.
When pools go active, LP deposit values need to be refreshed. Pools might have large sets of members (2000+), so iterating over them is expensive.
Instead, LPs with 0 deposit values can refresh their values by adding/removing liquidity. This means they pay for the gas cost to update.
User Interfaces will need to coax LPs to "activate ILP" by adding/removing small amounts of liquidity.
Refreshing Deposit Values
Done simply by:
rune_deposit_value = member_units / pool_units * rune_depth
asset_deposit_value = member_units / pool_units * asset_depth
Should be performed with the updated member_units - ie, after member has added or removed liquidity
No Change to Normal LPs
Note: there is no change to anything regarding adding/removing liquidity for already activated pools (the vast majority of users).