From 123574dee593b449ed0d9fe9099c6daf7cec39b2 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 6 Feb 2024 15:33:55 +0800 Subject: [PATCH 1/2] notify with native token --- src/KTONStakingRewards.sol | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/KTONStakingRewards.sol b/src/KTONStakingRewards.sol index 0eb4aab..5ff9e79 100644 --- a/src/KTONStakingRewards.sol +++ b/src/KTONStakingRewards.sol @@ -31,10 +31,7 @@ contract KTONStakingRewards is IStakingRewards, RewardsDistributionRecipient, Re /* ========== CONSTRUCTOR ========== */ - constructor( - address _rewardsDistribution, - address _stakingToken - ) public { + constructor(address _rewardsDistribution, address _stakingToken) public { stakingToken = IERC20(_stakingToken); rewardsDistribution = _rewardsDistribution; } @@ -106,7 +103,9 @@ contract KTONStakingRewards is IStakingRewards, RewardsDistributionRecipient, Re /* ========== RESTRICTED FUNCTIONS ========== */ - function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) { + function notifyRewardAmount() external payable onlyRewardsDistribution updateReward(address(0)) { + uint256 reward = msg.value; + require(reward >= rewardsDuration, "Provided reward too low"); if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { From a42a6f6b595e60978c3715d6c027e3ee7c4aa875 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 6 Feb 2024 15:35:19 +0800 Subject: [PATCH 2/2] fmt --- src/KTONStakingRewards.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/KTONStakingRewards.sol b/src/KTONStakingRewards.sol index 5ff9e79..392219d 100644 --- a/src/KTONStakingRewards.sol +++ b/src/KTONStakingRewards.sol @@ -104,8 +104,8 @@ contract KTONStakingRewards is IStakingRewards, RewardsDistributionRecipient, Re /* ========== RESTRICTED FUNCTIONS ========== */ function notifyRewardAmount() external payable onlyRewardsDistribution updateReward(address(0)) { - uint256 reward = msg.value; - require(reward >= rewardsDuration, "Provided reward too low"); + uint256 reward = msg.value; + require(reward >= rewardsDuration, "Provided reward too low"); if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else {