1

Could someone explain to me like I'm 5 the purpose of the notifyRewardAmount() function on the Synthetix's StakingRewards contract please?

I think it's connected to modifying the rewards campaign's finish time if there are still more rewards to distribute, but I can't seem to wrap my head around the purpose of the function in a clear way.

function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) {
        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(rewardsDuration);
        } else {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = reward.add(leftover).div(rewardsDuration);
        }

        uint balance = rewardsToken.balanceOf(address(this));
        require(rewardRate <= balance.div(rewardsDuration), "Provided reward too high");

        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(rewardsDuration);
        emit RewardAdded(reward);
    } 

Full contract here.

1 Answer 1

1

SOLUTION:

The answer to this question can be found in this video in the minute 7:40 --> https://www.youtube.com/watch?v=OJ-IRzCYSXI

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.