Omniscia Keyko Audit

Community Code Style Findings

Community Code Style Findings

COM-01C: Inefficient Event Storage Reads

Description:

All linked events emit the values of variables in storage that were written to by the function itself with in-memory values.

Example:

contracts/community/Community.sol
549/** @notice Updates params of a community
550 *
551 * @param minTranche_ minimum amount that the community will receive when requesting funds
552 * @param maxTranche_ maximum amount that the community will receive when requesting funds
553 */
554function updateCommunityParams(uint256 minTranche_, uint256 maxTranche_)
555 external
556 override
557 onlyOwner
558{
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

TypeSeverityLocation
Code StyleInformationalCommunity.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:

contracts/community/Community.sol
328/**
329 * @notice Returns the previousCommunity address
330 */
331function previousCommunity() external view override returns (ICommunity) {
332 return _previousCommunity;
333}
334
335/**
336 * @notice Returns the claimAmount value
337 */
338function claimAmount() external view override returns (uint256) {
339 return _claimAmount;
340}
341
342/**
343 * @notice Returns the baseInterval value
344 */
345function baseInterval() external view override returns (uint256) {
346 return _baseInterval;
347}
348
349/**
350 * @notice Returns the incrementInterval value
351 */
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

TypeSeverityLocation
Gas OptimizationInformationalCommunity.sol:L33, L34, L35

Description:

The linked variables are meant to be an internally accessible constants yet are declared as public.

Example:

contracts/community/Community.sol
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.