Skip to content

[I-05] Redundant code #38

@ddimitrov22

Description

@ddimitrov22

A lot of functions inside CapitalAgent.sol that don't make any external calls and are protected by the onlyRole(ADMIN_ROLE) modifier also have the nonReentrant modifier which is redundant and just wastes gas. Such functions are:

  • setSalesPolicyFactory
  • setOperator
  • addPoolWhiteList
  • removePoolWhiteList
  • removePool
  • setPolicy
  • setPolicyByAdmin
  • removePolicy

There are redundant zero address checks in some of the remove functions like removePool and removePoolWhiteList. The check that the pool exists is enough as there is a zero address check in the add functions.

A redundant zero address check in setPolicy - checking that the salesPolicyFactory == msg.sender is enough.

The collectPremiumInETH function inside PremiumPool.sol also has a redundant nonReentrant modifier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions