{
    "Function": "notifyRewardAmount",
    "File": "src/UniStaker.sol",
    "Parent Contracts": [
        "lib/openzeppelin-contracts/contracts/utils/Nonces.sol",
        "lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol",
        "lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol",
        "lib/openzeppelin-contracts/contracts/utils/Multicall.sol",
        "src/interfaces/INotifiableRewardReceiver.sol"
    ],
    "High-Level Calls": [
        "IERC20"
    ],
    "Internal Calls": [
        "rewardPerTokenAccumulated",
        "revert UniStaker__Unauthorized(bytes32,address)",
        "revert UniStaker__InvalidRewardRate()",
        "revert UniStaker__InsufficientRewardBalance()"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function notifyRewardAmount(uint256 _amount) external {\n    if (!isRewardNotifier[msg.sender]) revert UniStaker__Unauthorized(\"not notifier\", msg.sender);\n\n    // We checkpoint the accumulator without updating the timestamp at which it was updated, because\n    // that second operation will be done after updating the reward rate.\n    rewardPerTokenAccumulatedCheckpoint = rewardPerTokenAccumulated();\n\n    if (block.timestamp >= rewardEndTime) {\n      scaledRewardRate = (_amount * SCALE_FACTOR) / REWARD_DURATION;\n    } else {\n      uint256 _remainingReward = scaledRewardRate * (rewardEndTime - block.timestamp);\n      scaledRewardRate = (_remainingReward + _amount * SCALE_FACTOR) / REWARD_DURATION;\n    }\n\n    rewardEndTime = block.timestamp + REWARD_DURATION;\n    lastCheckpointTime = block.timestamp;\n\n    if ((scaledRewardRate / SCALE_FACTOR) == 0) revert UniStaker__InvalidRewardRate();\n\n    // This check cannot _guarantee_ sufficient rewards have been transferred to the contract,\n    // because it cannot isolate the unclaimed rewards owed to stakers left in the balance. While\n    // this check is useful for preventing degenerate cases, it is not sufficient. Therefore, it is\n    // critical that only safe reward notifier contracts are approved to call this method by the\n    // admin.\n    if (\n      (scaledRewardRate * REWARD_DURATION) > (REWARD_TOKEN.balanceOf(address(this)) * SCALE_FACTOR)\n    ) revert UniStaker__InsufficientRewardBalance();\n\n    emit RewardNotified(_amount, msg.sender);\n  }"
}