Omniscia fetchai Audit
PoolStorageBase Code Style Findings
PoolStorageBase Code Style Findings
PSB-01C: Redundant storage Read
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | PoolStorageBase.sol:L162, L178, L180 |
Description:
The linked event emissions are reading variables whose value is known in the context of the function.
Example:
contracts/ALP/PoolStorageBase.sol
156function zeroISC(address account, uint256 actId) external {157 requireIsPrivileged();158
159 LoanDetails storage details = loans[account][actId];160 iSCTotal = iSCTotal.sub(details.iSCAmount);161 details.iSCAmount = 0;162 emit UpdateModifier(ISC, details.iSCAmount, account, actId);163 emit UpdateTModifier(ISC, iSCTotal);164}Recommendation:
We advise them to replace the storage reads by the values they are meant to represent at the given point in time (i.e. 0) to reduce the gas cost consumed by the functions.
Alleviation:
Our recommendation was followed for all instances it can be applied for thereby alleviating this exhibit.