Omniscia Tokemak Network Audit

RewardsManager Code Style Findings

RewardsManager Code Style Findings

RMR-01C: Redundant Application of Access Control

TypeSeverityLocation
Gas OptimizationInformationalRewardsManager.sol:L46-L49

Description:

The initialize function invokes the public facing setter functions that impose the onlyOwner modifier redundantly.

Example:

contracts/rewards/RewardsManager.sol
37function initialize(
38 address _managerAddress,
39 address _rewardsAddress,
40 address _rewardsHashAddress,
41 address _voteTrackerAddress
42) public initializer {
43 __Context_init_unchained();
44 __Ownable_init_unchained();
45
46 setManagerAddress(_managerAddress);
47 setRewardsAddress(_rewardsAddress);
48 setRewardsHashAddress(_rewardsHashAddress);
49 setVoteTrackerAddress(_voteTrackerAddress);
50}
51
52function setManagerAddress(address _managerAddress) public override onlyOwner {
53 require(_managerAddress != address(0), "Manager address cannot be zero");
54 managerAddress = _managerAddress;
55 emit ManagerAddressUpdated(managerAddress);
56}
57
58function setRewardsAddress(address _rewardsAddress) public override onlyOwner {
59 require(_rewardsAddress != address(0), "Rewards address cannot be zero");
60 rewardsAddress = _rewardsAddress;
61 emit RewardsAddressUpdated(rewardsAddress);
62}
63
64function setRewardsHashAddress(address _rewardsHashAddress) public override onlyOwner {
65 require(_rewardsHashAddress != address(0), "RewardsHash address cannot be zero");
66 rewardsHashAddress = _rewardsHashAddress;
67 emit RewardsHashAddressUpdated(rewardsHashAddress);
68}
69
70function setVoteTrackerAddress(address _voteTrackerAddress) public override onlyOwner {
71 require(_voteTrackerAddress != address(0), "VoteTracker address cannot be zero");
72 voteTrackerAddress = _voteTrackerAddress;
73 emit VoteTrackerAddressUpdated(voteTrackerAddress);
74}

Recommendation:

We advise the functions to be refactored to utilize internal ones that do not impose the modifier and thus are more gas efficient.

Alleviation:

The Tokemak team stated that while the exhibit is valid, they will retain the current behaviour in place to ensure it remains simple and verbose.