The getAddedAmount function only works correctly when called with (VADER/USDV, pool) or (pool, pool).
However, when called with (token, pool) where token is neither VADER/USDV/pool, it returns the wrong results:
Anyone can break individual pairs by calling sync(token1, token2) where the token1 balance is less than mapToken_tokenAmount[token2]. This will add the difference to mapToken_tokenAmount[token2] and break the accounting and result in a wrong swap logic.
Furthermore, this can also be used to swap tokens without having to pay anthing with swap(token1, token2, member, toBase=false).
Recommend adding a require statement in the else branch that checks that _token == _pool.
strictly-scarce (vader) confirmed:
strictly-scarce (vader) commented:
