sherlock-audit / 2023-01-derby-judging

4 stars 1 forks source link

ak1 - Vault.sol#L178 : rebalanceCheckProtocols would revert in certain condition. #418

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

ak1

medium

Vault.sol#L178 : rebalanceCheckProtocols would revert in certain condition.

Summary

rebalanceCheckProtocols is used for following purpose.

/// @notice Rebalances i.e deposit or withdraw from all underlying protocols /// @dev Loops over all protocols in ETF, calculate new currentAllocation based on deltaAllocation /// @dev Also calculate the performance fee here. This is an amount, based on the current TVL (before the rebalance), /// @dev the performanceFee and difference between the current exchangeRate and the exchangeRate of the last rebalance of the vault.

at below line, the calculation is done such that,'

https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Vault.sol#L194-L195

if amountToProtocol > currentBalance , the the line will revet.

it is possible when underlying balance is less than amount to protocol

Vulnerability Detail

Refer the summary section

Impact

calculation would revert,

Code Snippet

https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Vault.sol#L195

Tool used

Manual Review

Recommendation

Check and update the condition check.