diff --git a/flat/IStakingRewards.f.sol b/flat/IStakingRewards.f.sol new file mode 100644 index 0000000..9abf8ba --- /dev/null +++ b/flat/IStakingRewards.f.sol @@ -0,0 +1,32 @@ +// hevm: flattened sources of src/interfaces/IStakingRewards.sol + +pragma solidity >=0.4.24; + +////// src/interfaces/IStakingRewards.sol +/* pragma solidity >=0.4.24; */ + +interface IStakingRewards { + // Views + function lastTimeRewardApplicable() external view returns (uint256); + + function rewardPerToken() external view returns (uint256); + + function earned(address account) external view returns (uint256); + + function getRewardForDuration() external view returns (uint256); + + function totalSupply() external view returns (uint256); + + function balanceOf(address account) external view returns (uint256); + + // Mutative + + function stake(uint256 amount) external; + + function withdraw(uint256 amount) external; + + function getReward() external; + + function exit() external; +} + diff --git a/flat/KTONStakingRewards.f.sol b/flat/KTONStakingRewards.f.sol index 22d4aa7..2788d17 100644 --- a/flat/KTONStakingRewards.f.sol +++ b/flat/KTONStakingRewards.f.sol @@ -426,9 +426,10 @@ contract ReentrancyGuard { /* pragma solidity ^0.5.16; */ contract RewardsDistributionRecipient { - address public rewardsDistribution; + // "sc/ktnstk" in bytes. + address public constant rewardsDistribution = 0x73632F6b746e73746B0000000000000000000000; - function notifyRewardAmount() external payable; + function notifyRewardAmount() external; modifier onlyRewardsDistribution() { require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract"); @@ -483,7 +484,7 @@ contract KTONStakingRewards is IStakingRewards, RewardsDistributionRecipient, Re /* ========== STATE VARIABLES ========== */ - IERC20 public stakingToken; + IERC20 public constant stakingToken = IERC20(0x0000000000000000000000000000000000000402); uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public rewardsDuration = 7200; @@ -496,13 +497,6 @@ contract KTONStakingRewards is IStakingRewards, RewardsDistributionRecipient, Re uint256 private _totalSupply; mapping(address => uint256) private _balances; - /* ========== CONSTRUCTOR ========== */ - - constructor(address _rewardsDistribution, address _stakingToken) public { - stakingToken = IERC20(_stakingToken); - rewardsDistribution = _rewardsDistribution; - } - /* ========== VIEWS ========== */ function totalSupply() external view returns (uint256) { @@ -570,9 +564,7 @@ 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"); + function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { diff --git a/flat/RewardsDistributionRecipient.f.sol b/flat/RewardsDistributionRecipient.f.sol new file mode 100644 index 0000000..a5b14c7 --- /dev/null +++ b/flat/RewardsDistributionRecipient.f.sol @@ -0,0 +1,19 @@ +// hevm: flattened sources of src/RewardsDistributionRecipient.sol + +pragma solidity >=0.5.16 <0.6.0; + +////// src/RewardsDistributionRecipient.sol +/* pragma solidity ^0.5.16; */ + +contract RewardsDistributionRecipient { + // "sc/ktnstk" in bytes. + address public constant rewardsDistribution = 0x73632F6b746e73746B0000000000000000000000; + + function notifyRewardAmount() external; + + modifier onlyRewardsDistribution() { + require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract"); + _; + } +} + diff --git a/src/KTONStakingRewards.sol b/src/KTONStakingRewards.sol index 866e3e6..e719ba9 100644 --- a/src/KTONStakingRewards.sol +++ b/src/KTONStakingRewards.sol @@ -96,9 +96,7 @@ 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"); + function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(rewardsDuration); } else { diff --git a/src/RewardsDistributionRecipient.sol b/src/RewardsDistributionRecipient.sol index 9319fb8..1c9d1e1 100644 --- a/src/RewardsDistributionRecipient.sol +++ b/src/RewardsDistributionRecipient.sol @@ -1,10 +1,10 @@ pragma solidity ^0.5.16; contract RewardsDistributionRecipient { - // "KTONStakingRewards" in bytes. - address public constant rewardsDistribution = 0x4b544f4e5374616b696e67526577617264730000; + // "sc/ktnstk" in bytes. + address public constant rewardsDistribution = 0x73632F6b746e73746B0000000000000000000000; - function notifyRewardAmount() external payable; + function notifyRewardAmount() external; modifier onlyRewardsDistribution() { require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract");