DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Valid

_harvestAndReport() deos not account for claimable in calculating _totalAssets

Summary

_harvestAndReport() deos not account for claimable in calculating _totalAssets

Vulnerability Details

function _harvestAndReport()
internal
override
returns (uint256 _totalAssets)
{
uint256 claimable = transmuter.getClaimableBalance(address(this));
if (claimable > 0) {
// transmuter.claim(claimable, address(this));
}
// NOTE : we can do this in harvest or can do seperately in tend
// if (underlying.balanceOf(address(this)) > 0) {
// _swapUnderlyingToAsset(underlying.balanceOf(address(this)));
// }
uint256 unexchanged = transmuter.getUnexchangedBalance(address(this));
// NOTE : possible some dormant WETH that isn't swapped yet (although we can restrict to only claim & swap in one tx)
uint256 underlyingBalance = underlying.balanceOf(address(this));
_totalAssets = unexchanged + asset.balanceOf(address(this)) + underlyingBalance;
}

As seen above, when totalAssets is being calculated, only unexchanged, asset ballance and underlying balance were taken into consideration excluding claimable amount. This reduces what the totalAsset should be. This also goes against what comment indicates in BaseStrategy.sol [here](https://github.com/yearn/tokenized-strategy/blob/9ef68041bd034353d39941e487499d111c3d3901/src/BaseStrategy.sol#L213-L214)

Impact

It impacts share-asset calculation for user

Tools Used

Manual review

Recommendations

_totalAssets = unexchanged + asset.balanceOf(address(this)) + underlyingBalance + claimable;```
Updates

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Incorrect accounting in `_harvestAndReport` claimable should be included

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.