Omniscia fetchai Audit

InterestManager Manual Review Findings

InterestManager Manual Review Findings

IMR-01M: Accuracy Potentially Low

Description:

The linked functions are meant to calculate the per-second percentage rate which may ultimately require a very high degree of accuracy to reliably calculate.

Example:

contracts/ALP/InterestManager.sol
169lenderLPSPR = (xSCLpValueNext.mul(ONE_UNIT).div(xSCLpValueNow).sub(ONE_UNIT));
170accountLPSPR = (iSCLpValueNext.mul(ONE_UNIT).div(iSCLpValueNow).sub(ONE_UNIT));
171accountLLSPR = (iSCLlValueNext.mul(ONE_UNIT).div(iSCLlValueNow).sub(ONE_UNIT));

Recommendation:

We advise a greater degree of accuracy to be applied here (i.e. 27 decimals of precision) to ensure that non-negligible fractional values will be properly accounted for.

Alleviation:

The accuracy of this function is purely utilized for off-chain UI purposes and as such it is tolerable.