OpenBazaar/smart-contracts

Improve rewards contract readability

Closed this issue · 1 comments

Recommendation 1

The function _claimReward is a private function, contains only 3 lines of code, and is referenced only by one other function (namely executeAndClaim).

To improve code readability I recommend deleting this function and simply placing its three lines of code directly in the executeAndClaim function.

Recommendation 2

Similarly, the function _calculateReward is a private function, consists of a simple if/then/else statement, and is called by only one other function (namely _getTokensToReward).

I recommend deleting this function and just putting its code directly into the _getTokensToReward function.