From ff307623f03ae3bd3f34372e10c5404b71713e57 Mon Sep 17 00:00:00 2001 From: Shahul Hameed <10547529+shahthepro@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:24:38 +0530 Subject: [PATCH] Change names --- ...ewardsSource.sol => FixedRateRewardsSource.sol} | 14 +++++++------- ...ceProxy.sol => FixedRateRewardsSourceProxy.sol} | 2 +- tests/staking/OGNRewardsSource.t.sol | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) rename contracts/{OGNRewardsSource.sol => FixedRateRewardsSource.sol} (92%) rename contracts/upgrades/{OGNRewardsSourceProxy.sol => FixedRateRewardsSourceProxy.sol} (66%) diff --git a/contracts/OGNRewardsSource.sol b/contracts/FixedRateRewardsSource.sol similarity index 92% rename from contracts/OGNRewardsSource.sol rename to contracts/FixedRateRewardsSource.sol index e7243600..e07d2c32 100644 --- a/contracts/OGNRewardsSource.sol +++ b/contracts/FixedRateRewardsSource.sol @@ -5,7 +5,7 @@ import {Governable} from "./Governable.sol"; import {Initializable} from "./upgrades/Initializable.sol"; import "OpenZeppelin/openzeppelin-contracts@4.6.0/contracts/token/ERC20/IERC20.sol"; -contract OGNRewardsSource is Governable, Initializable { +contract FixedRateRewardsSource is Governable, Initializable { error UnauthorizedCaller(); error InvalidRewardRate(); @@ -14,7 +14,7 @@ contract OGNRewardsSource is Governable, Initializable { event RewardsPerSecondChanged(uint256 newRPS, uint256 oldRPS); event RewardCollected(uint256 amountCollected); - address public immutable ogn; + address public immutable rewardToken; address public strategistAddr; @@ -39,8 +39,8 @@ contract OGNRewardsSource is Governable, Initializable { _; } - constructor(address _ogn) { - ogn = _ogn; + constructor(address _rewardToken) { + rewardToken = _rewardToken; } /// @dev Initialize the proxy implementation @@ -82,7 +82,7 @@ contract OGNRewardsSource is Governable, Initializable { // Intentionally skipping balance check to save some gas // since `transfer` anyway would fail in case of low balance - IERC20(ogn).transfer(_target, rewardAmount); + IERC20(rewardToken).transfer(_target, rewardAmount); } } @@ -126,13 +126,13 @@ contract OGNRewardsSource is Governable, Initializable { } /// @dev Set the rate of reward emission - /// @param _rewardsPerSecond Amount of OGN to distribute per second + /// @param _rewardsPerSecond Amount of rewardToken to distribute per second function setRewardsPerSecond(uint256 _rewardsPerSecond) external onlyGovernorOrStrategist { _setRewardsPerSecond(_rewardsPerSecond); } /// @dev Set the rate of reward emission - /// @param _rewardsPerSecond Amount of OGN to distribute per second + /// @param _rewardsPerSecond Amount of rewardToken to distribute per second function _setRewardsPerSecond(uint256 _rewardsPerSecond) internal { if (_rewardsPerSecond > type(uint192).max) { revert InvalidRewardRate(); diff --git a/contracts/upgrades/OGNRewardsSourceProxy.sol b/contracts/upgrades/FixedRateRewardsSourceProxy.sol similarity index 66% rename from contracts/upgrades/OGNRewardsSourceProxy.sol rename to contracts/upgrades/FixedRateRewardsSourceProxy.sol index b5b74297..ac48b516 100644 --- a/contracts/upgrades/OGNRewardsSourceProxy.sol +++ b/contracts/upgrades/FixedRateRewardsSourceProxy.sol @@ -4,4 +4,4 @@ pragma solidity 0.8.10; import {InitializeGovernedUpgradeabilityProxy} from "./InitializeGovernedUpgradeabilityProxy.sol"; -contract OGNRewardsSourceProxy is InitializeGovernedUpgradeabilityProxy {} +contract FixedRateRewardsSourceProxy is InitializeGovernedUpgradeabilityProxy {} diff --git a/tests/staking/OGNRewardsSource.t.sol b/tests/staking/OGNRewardsSource.t.sol index 90a3673c..91373da9 100644 --- a/tests/staking/OGNRewardsSource.t.sol +++ b/tests/staking/OGNRewardsSource.t.sol @@ -1,11 +1,11 @@ import "forge-std/Test.sol"; -import "contracts/upgrades/OGNRewardsSourceProxy.sol"; -import "contracts/OGNRewardsSource.sol"; +import "contracts/upgrades/FixedRateRewardsSourceProxy.sol"; +import "contracts/FixedRateRewardsSource.sol"; import "contracts/tests/MockOGN.sol"; -contract OGNRewardsSourceTest is Test { +contract FixedRateRewardsSourceTest is Test { MockOGN ogn; - OGNRewardsSource rewards; + FixedRateRewardsSource rewards; address staking = address(0x42); address governor = address(0x43); @@ -15,12 +15,12 @@ contract OGNRewardsSourceTest is Test { function setUp() public { vm.startPrank(governor); ogn = new MockOGN(); - rewards = new OGNRewardsSource(address(ogn)); + rewards = new FixedRateRewardsSource(address(ogn)); // Setup Rewards Proxy - OGNRewardsSourceProxy rewardsProxy = new OGNRewardsSourceProxy(); + FixedRateRewardsSourceProxy rewardsProxy = new FixedRateRewardsSourceProxy(); rewardsProxy.initialize(address(rewards), governor, ""); - rewards = OGNRewardsSource(address(rewardsProxy)); + rewards = FixedRateRewardsSource(address(rewardsProxy)); // Configure Rewards rewards.initialize(strategist, staking, uint192(100 ether)); // 100 OGN per second