Skip to content

Commit

Permalink
Merge branch 'shah/ogn-rewards-source' into shah/fix-preview-rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVF authored May 8, 2024
2 parents 9b985c7 + 51035a9 commit ada8a9f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/FixedRateRewardsSource.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ contract FixedRateRewardsSource is Governable, Initializable {
/// @return rewardAmount Amount of reward that'll be distributed if collected now
function previewRewards() public view returns (uint256 rewardAmount) {
RewardConfig memory _config = rewardConfig;


if (_config.lastCollect == 0) {
return 0;
}

rewardAmount = (block.timestamp - _config.lastCollect) * _config.rewardsPerSecond;

uint256 balance = IERC20(rewardToken).balanceOf(address(this));
if (rewardAmount > balance) {
rewardAmount = balance;
Expand Down

0 comments on commit ada8a9f

Please sign in to comment.