Omniscia Stakewise Audit
Roles Code Style Findings
Roles Code Style Findings
ROL-01C: Unspecified Numerical Accuracy
| Type | Severity | Location |
|---|---|---|
| Code Style | Informational | Roles.sol:L26, L43 |
Description:
The setOperator and setPartner functions apply a maximum limit of 1e4 for the revenueShare, however, the actual accuracy of revenueShare may be different thus causing ambiguity as to its purpose.
Example:
contracts/Roles.sol
21/**22 * @dev See {IRoles-setOperator}.23 */24function setOperator(address account, uint256 revenueShare) external override onlyAdmin whenNotPaused {25 require(account != address(0), "Roles: account is the zero address");26 require(revenueShare <= 1e4, "Roles: invalid revenue share");27 emit OperatorUpdated(account, revenueShare);28}29
30/**31 * @dev See {IRoles-removeOperator}.32 */33function removeOperator(address account) external override onlyAdmin whenNotPaused {34 require(account != address(0), "Roles: account is the zero address");35 emit OperatorRemoved(account);36}37
38/**39 * @dev See {IRoles-setPartner}.40 */41function setPartner(address account, uint256 revenueShare) external override onlyAdmin whenNotPaused {42 require(account != address(0), "Roles: account is the zero address");43 require(revenueShare <= 1e4, "Roles: invalid revenue share");44 emit PartnerUpdated(account, revenueShare);45}Recommendation:
We advise the value to be set to a contract-level constant that clearly depicts its purpose via surrounding comments. This does not alter the generated bytecode of the contract and increases the legibility and maintainability of the code.
Alleviation:
A MAX_PERCENT constant was introduced to the codebase according to our recommendation.