Open hats-bug-reporter[bot] opened 1 year ago
We want the price of LP tokens. If the beefy vault is yield aggregating an LP token, the payouts will also be in that LP token, so the fair pricing is to get the price of the LP token as the underlying. See: https://app.beefy.com/vault/velodrome-wsteth-weth. Quote: "Earned token is swapped for wstETH and ETH in order to acquire more of the same LP token." Also, the link you provided is for BNB chain
We want the price of LP tokens. If the beefy vault is yield aggregating an LP token, the payouts will also be in that LP token, so the fair pricing is to get the price of the LP token as the underlying. See: https://app.beefy.com/vault/velodrome-wsteth-weth. Quote: "Earned token is swapped for wstETH and ETH in order to acquire more of the same LP token." Also, the link you provided is for BNB chain
If you are taking LP in getBeefyPrice
then pls change the variable name and if that's the case then you want to use price of LP in getYearnPrice
function, but that's not the case, its getting underlying
In both cases it gets the price of the underlying. If the vault is for say USDC, it will get the price of USDC. If the vault is for a LP, it will get the price of the LP. There is no issue
In both cases it gets the price of the underlying. If the vault is for say USDC, it will get the price of USDC. If the vault is for a LP, it will get the price of the LP. There is no issue
Please make it clear that are you referring to LP price or underlying price. Because the variable names are underlying and not everyone oracle have price of every token
The underlying could be LP too. Underlying just means what you deposit to the yearn vault to earn rewards
Github username: -- Submission hash (on-chain): 0x1205903146dbf337279ca88ecf2e6533a7b9946e73a842e27275b5d32355276a Severity: high severity
Description:
Summary
In the function
getBeefyPrice()
we are usinggetAssetPrice(beefyVault.want());
to get the price of underlying asset but instead of underlying asset we will actually get the Price of LP tokens.Description
In the function
getYearnPrice()
we are usinggetAssetPrice(yearnVault.token())
and are getting the correct price of underlying asset but in the functiongetBeefyPrice()
instead of the underlying asset we are actually getting the price of LP tokens and it is because of simply using thewant
. you can check this behaviour in the follwing link https://bscscan.com/address/0x4Ea9af68bC24d14935460bb6E6d39ae11bb0Ed99#readContractRecommendation
If we want to get the price of underlying token then instead of this line
we have to change it to