Skip to content

Latest commit

 

History

History
66 lines (41 loc) · 2.41 KB

File metadata and controls

66 lines (41 loc) · 2.41 KB

Fast Khaki Raccoon

Medium

LinearInterestRate can never be used

Summary

When interest is calculated FraxlendPairCore calls IRateCalculatorV2::getNewRate, which can be 2 possible contracts - LinearInterestRate or VariableInterestRate

https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/fraxlend/src/contracts/FraxlendPairCore.sol#L404-L407

            (_results.newRate, _results.newFullUtilizationRate) = IRateCalculatorV2(rateContract).getNewRate(
                _deltaTime, _utilizationRate, _currentRateInfo.fullUtilizationRate
            );

However due to LinearInterestRate implementing the old interface and thus the old getNewRate function FraxlendPairCore will not be able to be used with it, as it's function uses bytes calldata _data, bytes calldata _initData as inputs instead of _deltaTime, _utilizationRate, _currentRateInfo.fullUtilizationRate:

https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/fraxlend/src/contracts/LinearInterestRate.sol#L74

    function getNewRate(bytes calldata _data, bytes calldata _initData) external pure returns (uint64 _newRatePerSec) {

Root Cause

https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/fraxlend/src/contracts/LinearInterestRate.sol#L74

    function getNewRate(bytes calldata _data, bytes calldata _initData) external pure returns (uint64 _newRatePerSec) {

getNewRate accepting 2 params that are never imputed into this function interface, the only time it is called:

https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/fraxlend/src/contracts/FraxlendPairCore.sol#L404-L407

            (_results.newRate, _results.newFullUtilizationRate) = IRateCalculatorV2(rateContract).getNewRate(
                _deltaTime, _utilizationRate, _currentRateInfo.fullUtilizationRate
            );

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

The contract will be just unusable, and thus no linear rate would be possible.

Impact

One of the 2 interest rate contracts will be unusable. Contracts in scope will not be able to be used because it's input params don't match the one place where it's interface function is called.

PoC

No response

Mitigation

Update the function to accept the same parameters as VariableInterestRate, in order for the contract to be usable again.