_harvestAndReport function in strategies is not implemented correctly, which will lead to wrong accounting.
Yearn docs state [here] (https://docs.yearn.fi/developers/v3/strategy_writing_guide#_harvestandreport) that ⇒ _totalAssets
: A trusted and accurate account for the total amount of 'asset' the strategy currently holds including loose funds.
But the _harvestAndReport
function, in its current implementation, does not follow this. Let’s look at the function in StrategyMainnet.sol contract:
The function above fails in the following:
Actually claim claimable rewards
Swap underlying (WETH) to the asset (ALETH)
Include claimable amount in total assets calculation
Convert all balances to a consistent denomination (underlying or asset)
Some insights: You see that there is a note that suggests the swapping between underlying to asset can be done here, or in tending. But it is done in neither: First, it’s not done here, second, _tend is never utilized.
Also, according to the Yearn tokenized strategies docs, underlyingBalance here is not related to the _totalAssets. It should only be denominated in the asset, not in the underlying in this protocol.
The same issue persists in other strategies: StrategyArb.sol
and StrategyOp.sol
This function will not work correctly. The accounting will be wrong.
Follow the yearn docs here strictly and make sure _totalAssets returns the correct value.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.