Skip to content

Commit

Permalink
for system reward package, just need to claim reward once
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoyangLiu committed Jan 8, 2021
1 parent 035c3eb commit 3ad28d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
9 changes: 4 additions & 5 deletions contracts/RelayerIncentivize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {

uint256 actualAmount;
if (fromSystemReward) {
actualAmount = ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), amount);
actualAmount = ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), amount.add(compensateRelayerAmount));
} else {
actualAmount = ISystemReward(TOKEN_HUB_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), amount);
}

if (compensateRelayerAmount > 0) {
actualAmount = actualAmount.add(ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), compensateRelayerAmount));
if (compensateRelayerAmount > 0) {
actualAmount = actualAmount.add(ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), compensateRelayerAmount));
}
}

countInRound++;
Expand Down
9 changes: 4 additions & 5 deletions contracts/RelayerIncentivize.template
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
{% endif %}
uint256 actualAmount;
if (fromSystemReward) {
actualAmount = ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), amount);
actualAmount = ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), amount.add(compensateRelayerAmount));
} else {
actualAmount = ISystemReward(TOKEN_HUB_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), amount);
}

if (compensateRelayerAmount > 0) {
actualAmount = actualAmount.add(ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), compensateRelayerAmount));
if (compensateRelayerAmount > 0) {
actualAmount = actualAmount.add(ISystemReward(SYSTEM_REWARD_ADDR).claimRewards(address(uint160(INCENTIVIZE_ADDR)), compensateRelayerAmount));
}
}

countInRound++;
Expand Down

0 comments on commit 3ad28d9

Please sign in to comment.