Missing performance fee deduction when closing an IchiVaultSpell position
Summary
Closing an IchiVaultSpell position and realizing potential profits denominated in borrowToken should be subject to a performance fee of 10%. However, the IchiVaultSpell contract does not deduct any such fees when closing a position, resulting in missed potential profits for the protocol.
Vulnerability Detail
The Blueberry Parameters & Flows.pdf document states that any profits made by a strategy should be subject to a performance fee of 10%. However, when a position is closed in the IchiVaultSpell contract, the contract does not deduct the performance fee from the realized profits.
When closing an IchiVaultSpell position, the IchiVaultSpell.withdrawInternal function swaps the withdrawn tokens to the borrowed token, repays the borrowed token debt, and refunds the remaining borrowToken balance to the current bank.EXECUTOR() in L328. The refunded borrowToken tokens represent the realized profits from the position and should be subject to a performance fee of 10%.
Please note that a performance fee is deducted from farmed rewards in L391.
Impact
The Blueberry protocol misses out on potential performance fees realized when closing a IchiVaultSpell position.
Consider using doCutRewardsFee(borrowToken) at the end of the IchiVaultSpell.withdrawInternal function to deduct performance fees from potential profits.
berndartmueller
medium
Missing performance fee deduction when closing an
IchiVaultSpell
positionSummary
Closing an
IchiVaultSpell
position and realizing potential profits denominated inborrowToken
should be subject to a performance fee of10%
. However, theIchiVaultSpell
contract does not deduct any such fees when closing a position, resulting in missed potential profits for the protocol.Vulnerability Detail
The
Blueberry Parameters & Flows.pdf
document states that any profits made by a strategy should be subject to a performance fee of10%
. However, when a position is closed in theIchiVaultSpell
contract, the contract does not deduct the performance fee from the realized profits.When closing an
IchiVaultSpell
position, theIchiVaultSpell.withdrawInternal
function swaps the withdrawn tokens to the borrowed token, repays the borrowed token debt, and refunds the remainingborrowToken
balance to the currentbank.EXECUTOR()
in L328. The refundedborrowToken
tokens represent the realized profits from the position and should be subject to a performance fee of10%
.Please note that a performance fee is deducted from farmed rewards in L391.
Impact
The Blueberry protocol misses out on potential performance fees realized when closing a
IchiVaultSpell
position.Code Snippet
spell/IchiVaultSpell.sol#L328
Tool used
Manual Review
Recommendation
Consider using
doCutRewardsFee(borrowToken)
at the end of theIchiVaultSpell.withdrawInternal
function to deduct performance fees from potential profits.