Skip to content

Commit

Permalink
fix: initialize staking pal to null address if is operator
Browse files Browse the repository at this point in the history
- save gas on pool creation and handle condition
  • Loading branch information
gabririgo committed Oct 25, 2022
1 parent 7a6e708 commit caeec6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/staking/staking_pools/MixinStakingPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract contract MixinStakingPool is MixinStakingPoolRewards {
address operator = IRigoblockV3Pool(payable(rigoblockPoolAddress)).owner();

// add stakingPal, which receives part of operator reward
address stakingPal = msg.sender;
address stakingPal = msg.sender != operator ? msg.sender : address(0);

// operator initially shares 30% with stakers
uint32 operatorShare = uint32(700000);
Expand Down
4 changes: 3 additions & 1 deletion contracts/staking/staking_pools/MixinStakingPoolRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ abstract contract MixinStakingPoolRewards is IStaking, MixinAbstract, MixinCumul
(operatorReward, membersReward) = _computePoolRewardsSplit(pool.operatorShare, reward, membersStake);

if (operatorReward > 0) {
if (pool.operator == pool.stakingPal) {

// if staking pal is null, pool operator receives full reward
if (pool.stakingPal == address(0)) {
// Transfer the operator's grg reward to the operator
getGrgContract().transfer(pool.operator, operatorReward);
} else {
Expand Down

0 comments on commit caeec6d

Please sign in to comment.