code-423n4 / 2024-02-spectra-findings

4 stars 2 forks source link

_getCurrentPTandIBTRates return err value of currentPTRate #186

Closed c4-bot-4 closed 8 months ago

c4-bot-4 commented 8 months ago

Lines of code

https://github.com/code-423n4/2024-02-spectra/blob/main/src/tokens/PrincipalToken.sol#L906-L912

Vulnerability details

Impact

currentIBTRate < ibtRate should be currentIBTRate > ibtRate if current IBT Rate is bigger than old IBT rate, then need calculate the new ptRate

Recommended Mitigation Steps

uint256 currentPTRate = currentIBTRate > ibtRate
        ? ptRate.mulDiv(
            currentIBTRate,
            ibtRate,
            roundUpPTRate ? Math.Rounding.Ceil : Math.Rounding.Floor
        )
        : ptRate;

Assessed type

Error

c4-bot-2 commented 8 months ago

Withdrawn by Billy_Parallel