Omniscia Keyko Audit
Community Code Style Findings
Community Code Style Findings
COM-01C: Inefficient Event Storage Reads
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Community.sol:L483, L485, L494, L496, L529-L533, L541-L545, L567-L568, L570 |
Description:
All linked events emit
the values of variables in storage that were written to by the function itself with in-memory values.
Example:
549/** @notice Updates params of a community550 *551 * @param minTranche_ minimum amount that the community will receive when requesting funds552 * @param maxTranche_ maximum amount that the community will receive when requesting funds553 */554function updateCommunityParams(uint256 minTranche_, uint256 maxTranche_)555 external556 override557 onlyOwner558{559 require(560 minTranche_ <= maxTranche_,561 "Community::updateCommunityParams: minTranche should not be greater than maxTranche"562 );563
564 uint256 oldMinTranche = _minTranche;565 uint256 oldMaxTranche = _maxTranche;566
567 _minTranche = minTranche_;568 _maxTranche = maxTranche_;569
570 emit CommunityParamsUpdated(oldMinTranche, oldMaxTranche, _minTranche, _maxTranche);571}
Recommendation:
We advise the in-memory values from the function arguments to be utilized directly significantly reducing the gas cost of those functions.
Alleviation:
The linked event emissions were optimised to now properly utilise input arguments where applicable.
COM-02C: Redundant User-Defined Getter Functions
Type | Severity | Location |
---|---|---|
Code Style | Informational | Community.sol:L328-L403, L412-L450 |
Description:
All linked functions can be omitted from the codebase by declaring the corresponding variables returned as public
and renaming them.
Example:
328/**329 * @notice Returns the previousCommunity address330 */331function previousCommunity() external view override returns (ICommunity) {332 return _previousCommunity;333}334
335/**336 * @notice Returns the claimAmount value337 */338function claimAmount() external view override returns (uint256) {339 return _claimAmount;340}341
342/**343 * @notice Returns the baseInterval value344 */345function baseInterval() external view override returns (uint256) {346 return _baseInterval;347}348
349/**350 * @notice Returns the incrementInterval value351 */352function incrementInterval() external view override returns (uint256) {353 return _incrementInterval;354}
Recommendation:
We advise this to be done so to significantly reduce the code size of the contract and ensure ease-of-maintenance of the codebase.
Alleviation:
The variables were renamed and adjusted as advised.
COM-03C: Redundant Visibility Specifiers
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Community.sol:L33, L34, L35 |
Description:
The linked variables are meant to be an internally accessible constant
s yet are declared as public
.
Example:
33bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");34uint256 public constant DEFAULT_AMOUNT = 5e16;35uint256 public constant VERSION = 1;
Recommendation:
We advise the public
specifier to be replaced by either an internal
or private
one given the variables have no use outside of the contract and can be represented by their literal form.
Alleviation:
The linked variables were set to private
addressing the exhibit.