Skip to content

Commit

Permalink
resolve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoyangLiu committed Jun 1, 2020
1 parent 2c43b5d commit 1eeb193
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
11 changes: 8 additions & 3 deletions contracts/RelayerIncentivize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {

event paramChange(string key, bytes value);

modifier onlyInit() {
require(alreadyInit, "the contract not init yet");
_;
}

function init() public {
require(!alreadyInit, "already initialized");
moleculeHeaderRelayer=MOLECULE_HEADER_RELAYER;
Expand All @@ -52,7 +57,7 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
event LogDistributeCollectedReward(uint256 sequence, uint256 roundRewardForHeaderRelayer, uint256 roundRewardForTransferRelayer);


function addReward(address payable headerRelayerAddr, address payable caller) external onlyTokenHub override payable returns (bool) {
function addReward(address payable headerRelayerAddr, address payable caller) external onlyTokenHub onlyInit override payable returns (bool) {

countInRound++;

Expand Down Expand Up @@ -89,7 +94,7 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
return reward.mul(moleculeHeaderRelayer).div(denominatorHeaderRelayer);
}

function distributeHeaderRelayerReward(address payable caller) internal returns (bool) {
function distributeHeaderRelayerReward(address payable caller) internal {
uint256 totalReward = collectedRewardForHeaderRelayer;

uint256 totalWeight=0;
Expand Down Expand Up @@ -120,7 +125,7 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
delete headerRelayerAddressRecord;
}

function distributeTransferRelayerReward(address payable caller) internal returns (bool) {
function distributeTransferRelayerReward(address payable caller) internal {
uint256 totalReward = collectedRewardForTransferRelayer;

uint256 totalWeight=0;
Expand Down
11 changes: 8 additions & 3 deletions contracts/RelayerIncentivize.template
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {

event paramChange(string key, bytes value);

modifier onlyInit() {
require(alreadyInit, "the contract not init yet");
_;
}

function init() public {
require(!alreadyInit, "already initialized");
moleculeHeaderRelayer=MOLECULE_HEADER_RELAYER;
Expand All @@ -54,7 +59,7 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
{% if mock %}
function addReward(address payable headerRelayerAddr, address payable caller) external override payable returns (bool) {
{% else %}
function addReward(address payable headerRelayerAddr, address payable caller) external onlyTokenHub override payable returns (bool) {
function addReward(address payable headerRelayerAddr, address payable caller) external onlyTokenHub onlyInit override payable returns (bool) {
{% endif %}
countInRound++;

Expand Down Expand Up @@ -91,7 +96,7 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
return reward.mul(moleculeHeaderRelayer).div(denominatorHeaderRelayer);
}

function distributeHeaderRelayerReward(address payable caller) internal returns (bool) {
function distributeHeaderRelayerReward(address payable caller) internal {
uint256 totalReward = collectedRewardForHeaderRelayer;

uint256 totalWeight=0;
Expand Down Expand Up @@ -122,7 +127,7 @@ contract RelayerIncentivize is IRelayerIncentivize, System, IParamSubscriber {
delete headerRelayerAddressRecord;
}

function distributeTransferRelayerReward(address payable caller) internal returns (bool) {
function distributeTransferRelayerReward(address payable caller) internal {
uint256 totalReward = collectedRewardForTransferRelayer;

uint256 totalWeight=0;
Expand Down
Loading

0 comments on commit 1eeb193

Please sign in to comment.