Skip to content

Commit 73278be

Browse files
committed
minor fixes and efficiency improvements
1 parent ce06acf commit 73278be

File tree

11 files changed

+258
-29
lines changed

11 files changed

+258
-29
lines changed

.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// infura ethereum API key
44
INFURA_KEY=
55

6+
// etherscan api key
7+
ETHERSCAN_KEY=
8+
69
// ledger derivation path account index
710
DEPLOYER_INDEX=
811

contracts/ERC20BaseRewardModule.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ abstract contract ERC20BaseRewardModule is IRewardModule {
114114
}
115115

116116
/**
117-
* @notice fund Geyser by locking up reward tokens for future distribution
117+
* @notice fund pool by locking up reward tokens for future distribution
118118
* @param token contract address of reward token
119119
* @param amount number of reward tokens to lock up as funding
120120
* @param duration period (seconds) over which funding will be unlocked

contracts/ERC20CompetitiveRewardModule.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,16 @@ contract ERC20CompetitiveRewardModule is ERC20BaseRewardModule {
162162
/**
163163
* @inheritdoc IRewardModule
164164
*/
165-
function update(address) external override onlyOwner {
165+
function update(address) external override {
166+
requireOwner();
166167
_update();
167168
}
168169

169170
/**
170171
* @inheritdoc IRewardModule
171172
*/
172-
function clean() external override onlyOwner {
173+
function clean() external override {
174+
requireOwner();
173175
_update();
174176
_clean(address(_token));
175177
}

contracts/ERC20FriendlyRewardModule.sol

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ contract ERC20FriendlyRewardModule is ERC20BaseRewardModule {
295295
bytes calldata data
296296
) external override onlyOwner returns (uint256 spent, uint256 vested) {
297297
_update();
298-
_unstake(account, user, shares);
299-
(spent, vested) = _stake(account, user, shares, data);
298+
(, vested) = _unstake(account, user, shares);
299+
(spent, ) = _stake(account, user, shares, data);
300300
}
301301

302302
/**
@@ -312,9 +312,8 @@ contract ERC20FriendlyRewardModule is ERC20BaseRewardModule {
312312
uint256 rewardTally
313313
) internal view returns (uint256) {
314314
return
315-
((rewardsPerStakedShare - rewardTally) * shares * bonus) /
316-
10**DECIMALS / // counteract bonus coefficient
317-
10**DECIMALS; // counteract rewardsPerStakedShare coefficient
315+
((((rewardsPerStakedShare - rewardTally) * shares) / 10**DECIMALS) * // counteract rewardsPerStakedShare coefficient
316+
bonus) / 10**DECIMALS; // counteract bonus coefficient
318317
}
319318

320319
/**
@@ -339,15 +338,17 @@ contract ERC20FriendlyRewardModule is ERC20BaseRewardModule {
339338
/**
340339
* @inheritdoc IRewardModule
341340
*/
342-
function update(address) external override onlyOwner {
341+
function update(address) external override {
342+
requireOwner();
343343
_update();
344344
}
345345

346346
/**
347347
* @notice method called ad hoc to clean up and perform additional accounting
348348
* @dev will only be called manually, and should not contain any essential logic
349349
*/
350-
function clean() external override onlyOwner {
350+
function clean() external override {
351+
requireOwner();
351352
_update();
352353
_clean(address(_token));
353354
}

contracts/ERC20StakingModule.sol

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ contract ERC20StakingModule is IStakingModule {
7777
/**
7878
* @inheritdoc IStakingModule
7979
*/
80-
function totals() public view override returns (uint256[] memory totals_) {
80+
function totals()
81+
external
82+
view
83+
override
84+
returns (uint256[] memory totals_)
85+
{
8186
totals_ = new uint256[](1);
8287
totals_[0] = _token.balanceOf(address(this));
8388
}
@@ -155,12 +160,12 @@ contract ERC20StakingModule is IStakingModule {
155160
/**
156161
* @inheritdoc IStakingModule
157162
*/
158-
function update(address) external override onlyOwner {}
163+
function update(address) external override {}
159164

160165
/**
161166
* @inheritdoc IStakingModule
162167
*/
163-
function clean() external override onlyOwner {}
168+
function clean() external override {}
164169

165170
/**
166171
* @dev internal helper to get user balance

contracts/OwnerController.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ contract OwnerController {
6262
* @dev Modifier that throws if called by any account other than the owner.
6363
*/
6464
modifier onlyOwner() {
65-
requireOwner();
65+
require(_owner == msg.sender, "oc1");
6666
_;
6767
}
6868

6969
/**
7070
* @dev Modifier that throws if called by any account other than the controller.
7171
*/
7272
modifier onlyController() {
73-
requireController();
73+
require(_controller == msg.sender, "oc2");
7474
_;
7575
}
7676

package-lock.json

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"react": "^16.13.1",
2222
"truffle": "^5.1.39",
2323
"truffle-contract-size": "^2.0.0",
24+
"truffle-plugin-verify": "^0.5.8",
2425
"web3": "^1.2.11",
2526
"web3-utils": "^1.3.4"
2627
},

0 commit comments

Comments
 (0)