Boost _ Folks Finance 34030 - [Smart Contract - Low] Incorrect rounding down in HubPoolLogicupdateWi
Description
Description
File: /contracts/hub/logic/HubPoolLogic.sol
function updateWithWithdraw(
HubPoolState.PoolData storage pool,
uint256 amount,
bool isFAmount
) external returns (DataTypes.WithdrawPoolParams memory withdrawPoolParams) {
// can withdraw even if pool is depreciated
// update interest indexes before the interest rates change
pool.updateInterestIndexes();
if (isFAmount) {
withdrawPoolParams.fAmount = amount;
withdrawPoolParams.underlingAmount = amount.toUnderlingAmount(pool.depositData.interestIndex);
} else {
withdrawPoolParams.underlingAmount = amount;
withdrawPoolParams.fAmount = amount.toFAmount(pool.depositData.interestIndex); @<-- incorrect rounding down
}
pool.depositData.totalAmount -= withdrawPoolParams.underlingAmount;
pool.updateInterestRates();
}
File: /contracts/hub/libraries/MathUtils.sol
function toFAmount(uint256 underlyingAmount, uint256 depositInterestIndexAtT) internal pure returns (uint256) {
return underlyingAmount.mulDiv(ONE_18_DP, depositInterestIndexAtT);
}Impact
Proof of concept
Proof-of-Concept
Steps
PreviousBoost _ Folks Finance 34029 - [Smart Contract - Medium] Contract fails to mitigate potential criticaNextBoost _ Folks Finance 34047 - [Smart Contract - Low] Adversaries can create a position that is nearl
Last updated
Was this helpful?