{
    "Function": "notifyRewardAmount",
    "File": "contracts/staking-rewards/StakingRewards.sol",
    "Parent Contracts": [
        "contracts/staking-rewards/Pausable.sol",
        "node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol",
        "contracts/staking-rewards/RewardsDistributionRecipient.sol",
        "contracts/staking-rewards/Owned.sol",
        "contracts/staking-rewards/IStakingRewards.sol"
    ],
    "High-Level Calls": [
        "IERC20"
    ],
    "Internal Calls": [
        "onlyRewardsDistribution",
        "require(bool,string)",
        "updateReward"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function notifyRewardAmount(uint reward)\n        external\n        override\n        onlyRewardsDistribution\n        updateReward(address(0))\n    {\n        if (block.timestamp >= periodFinish) {\n            rewardRate = reward / rewardsDuration;\n        } else {\n            uint remaining = periodFinish - block.timestamp;\n            uint leftover = remaining * rewardRate;\n            rewardRate = (reward + leftover) / rewardsDuration;\n        }\n        // Ensure the provided reward amount is not more than the balance in the contract.\n        // This keeps the reward rate in the right range, preventing overflows due to\n        // very high values of rewardRate in the earned and rewardsPerToken functions;\n        // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.\n        uint balance = rewardsToken.balanceOf(address(this));\n        require(rewardRate <= balance / rewardsDuration, \"Provided reward too high\");\n\n        lastUpdateTime = block.timestamp;\n        periodFinish = block.timestamp + rewardsDuration;\n        emit RewardAdded(reward);\n    }"
}