yieldprotocol / yieldspace-tv

Yield Protocol: Yieldspace AMM for fyTokens and tokenized vault tokens
Other
46 stars 4 forks source link

Incorrect return value on `PoolNonTV::mint` #93

Open ultrasecreth opened 1 year ago

ultrasecreth commented 1 year ago

Small bug to report, I don't think it's a security risk, but may have some effects on any strategy/code that deals with minting LP tokens on a pool.

For PoolNonTV, the mint function is incorrect as it assumes any amount of base is what the user deposits, but for non-tv pools, there'll be base already, so the baseIn return param is wrong, it misleads the caller saying a bigger amount of base was used for minting the LP tokens

The value is only used for return and for the event, so it shouldn't have a negative effect on the mint logic

IMO, an easy fix is to change this line (baseIn = baseToken.balanceOf(address(this));) to also subtract the cached base tokens.

Where this bug could be problematic?: