Skip to content

add PoolRewardDistributor#8

Open
mul53 wants to merge 3 commits intomasterfrom
feat/farm-reward-distributor
Open

add PoolRewardDistributor#8
mul53 wants to merge 3 commits intomasterfrom
feat/farm-reward-distributor

Conversation

@mul53
Copy link
Collaborator

@mul53 mul53 commented Nov 25, 2022

No description provided.

@mul53 mul53 requested a review from t0mcr8se November 25, 2022 17:50
Comment on lines 28 to 32
function recoverFuse() public onlyOwner {
uint256 fuseBalance = address(this).balance;
address payable _owner = address(this);
_owner.call{value: fuseBalance}("");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contract cannot have fuse balance because it's all being distributed among the pools

@mul53 mul53 requested a review from t0mcr8se December 6, 2022 10:42
_removePool(_pid);
}

function distributeRewards() external payable onlyOwner {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it payable?

}

function _removePool(uint256 _pid) internal {
require(_hasPool(_pid), 'pool not found');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already checked in _poolIndex()

Comment on lines 94 to 112
function _poolIndex(uint256 _pid) internal view returns (uint256) {
require(_hasPool(_pid), 'pool not found');

for (uint256 i = 0; i < pools.length; i++) {
if (pools[i].pid == _pid) {
return i;
}
}
}

function _hasPool(uint256 _pid) internal view returns (bool) {
for (uint256 i = 0; i < pools.length; i++) {
if (pools[i].pid == _pid) {
return true;
}
}
return false;
}
}
Copy link

@t0mcr8se t0mcr8se Dec 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function _poolIndex(uint256 _pid) internal view returns (uint256) {
require(_hasPool(_pid), 'pool not found');
for (uint256 i = 0; i < pools.length; i++) {
if (pools[i].pid == _pid) {
return i;
}
}
}
function _hasPool(uint256 _pid) internal view returns (bool) {
for (uint256 i = 0; i < pools.length; i++) {
if (pools[i].pid == _pid) {
return true;
}
}
return false;
}
}
function _poolIndex(uint256 _pid) internal view returns (uint256) {
for (uint256 i = 0; i < pools.length; i++) {
if (pools[i].pid == _pid) {
return i;
}
}
revert('pool not found');
}
}

Copy link

@t0mcr8se t0mcr8se left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants