Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
vm06007 committed Sep 24, 2024
1 parent 5b1eb00 commit ce1e687
Show file tree
Hide file tree
Showing 36 changed files with 4,668 additions and 103 deletions.
2 changes: 1 addition & 1 deletion contracts/Babylonian.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

library Babylonian {

Expand Down
2 changes: 1 addition & 1 deletion contracts/CodeCheck.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: --BCOM--

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./SimpleFarm.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/Counter.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- WISE --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

contract Counter {

Expand Down
2 changes: 1 addition & 1 deletion contracts/Counter.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- WISE --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "forge-std/Test.sol";
import "./Counter.sol";
Expand Down
86 changes: 68 additions & 18 deletions contracts/DualRewardFarm.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./TokenWrapper.sol";

Expand Down Expand Up @@ -83,7 +83,7 @@ contract DualRewardFarm is TokenWrapper {
uint256 tokenAmount
);

event RewardAdded(
event RewardsAdded(
uint256 rewardRateA,
uint256 rewardRateB,
uint256 tokenAmountA,
Expand Down Expand Up @@ -160,16 +160,22 @@ contract DualRewardFarm is TokenWrapper {
managerAddress = _managerAddress;
}

/**
* @dev Tracks timestamp for when reward was applied last time
*/
function lastTimeRewardApplicable()
public
view
returns (uint256)
returns (uint256 res)
{
return block.timestamp < periodFinished
res = block.timestamp < periodFinished
? block.timestamp
: periodFinished;
}

/**
* @dev Relative value on reward for single staked token for token A
*/
function rewardPerTokenA()
public
view
Expand All @@ -190,6 +196,9 @@ contract DualRewardFarm is TokenWrapper {
return perTokenStoredA + extraFund;
}

/**
* @dev Relative value on reward for single staked token for token B
*/
function rewardPerTokenB()
public
view
Expand All @@ -210,6 +219,9 @@ contract DualRewardFarm is TokenWrapper {
return perTokenStoredB + extraFund;
}

/**
* @dev Reports earned amount of token A by wallet address not yet collected
*/
function earnedA(
address _walletAddress
)
Expand All @@ -226,6 +238,9 @@ contract DualRewardFarm is TokenWrapper {
+ userRewardsA[_walletAddress];
}

/**
* @dev Reports earned amount of token B by wallet address not yet collected
*/
function earnedB(
address _walletAddress
)
Expand All @@ -242,6 +257,9 @@ contract DualRewardFarm is TokenWrapper {
+ userRewardsB[_walletAddress];
}

/**
* @dev Performs deposit of staked token into the farm
*/
function farmDeposit(
uint256 _stakeAmount
)
Expand Down Expand Up @@ -372,10 +390,9 @@ contract DualRewardFarm is TokenWrapper {
external
onlyOwner
{
require(
_newOwner != ZERO_ADDRESS,
"DualRewardFarm: WRONG_ADDRESS"
);
if (_newOwner == ZERO_ADDRESS) {
revert("DualRewardFarm: WRONG_ADDRESS");
}

proposedOwner = _newOwner;

Expand Down Expand Up @@ -465,7 +482,7 @@ contract DualRewardFarm is TokenWrapper {
);
}

function setRewardRate(
function setRewardRates(
uint256 _newRewardRateA,
uint256 _newRewardRateB
)
Expand All @@ -479,8 +496,13 @@ contract DualRewardFarm is TokenWrapper {
);

require(
_newRewardRateA > 0 && _newRewardRateB > 0,
"DualRewardFarm: INVALID_RATE"
_newRewardRateA > 0,
"DualRewardFarm: INVALID_RATE_A"
);

require(
_newRewardRateB > 0,
"DualRewardFarm: INVALID_RATE_B"
);

uint256 currentPeriodFinish = periodFinished;
Expand All @@ -489,17 +511,25 @@ contract DualRewardFarm is TokenWrapper {
periodFinished = block.timestamp + rewardDuration;

if (block.timestamp < currentPeriodFinish) {

require(
_newRewardRateA >= rewardRateA,
"DualRewardFarm: RATE_A_CANT_DECREASE"
);

require(
_newRewardRateA >= rewardRateA &&
_newRewardRateB >= rewardRateB,
"DualRewardFarm: RATE_CANT_DECREASE"
"DualRewardFarm: RATE_B_CANT_DECREASE"
);

uint256 remainingTime = currentPeriodFinish
- block.timestamp;

uint256 rewardRemainsA = remainingTime * rewardRateA;
uint256 rewardRemainsB = remainingTime * rewardRateB;
uint256 rewardRemainsA = remainingTime
* rewardRateA;

uint256 rewardRemainsB = remainingTime
* rewardRateB;

safeTransfer(
rewardTokenA,
Expand All @@ -517,11 +547,31 @@ contract DualRewardFarm is TokenWrapper {
rewardRateA = _newRewardRateA;
rewardRateB = _newRewardRateB;

emit RewardAdded(
uint256 newRewardAmountA = rewardDuration
* _newRewardRateA;

uint256 newRewardAmountB = rewardDuration
* _newRewardRateB;

safeTransferFrom(
rewardTokenA,
managerAddress,
address(this),
newRewardAmountA
);

safeTransferFrom(
rewardTokenB,
managerAddress,
address(this),
newRewardAmountB
);

emit RewardsAdded(
rewardRateA,
rewardRateB,
_newRewardRateA,
_newRewardRateB
newRewardAmountA,
newRewardAmountB
);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/DummyToken.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: --BCOM--

pragma solidity =0.8.25;
pragma solidity =0.8.26;

contract DummyToken {

Expand Down
2 changes: 1 addition & 1 deletion contracts/FarmFactory.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

interface ISimpleFarm {

Expand Down
2 changes: 1 addition & 1 deletion contracts/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

interface IERC20 {

Expand Down
2 changes: 1 addition & 1 deletion contracts/ITimeLockFarmV2Dual.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

interface ITimeLockFarmV2Dual {

Expand Down
2 changes: 1 addition & 1 deletion contracts/ManagerHelper.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

struct Allocation {
bool unlock20Percent;
Expand Down
2 changes: 1 addition & 1 deletion contracts/ManagerSetup.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./SafeERC20.sol";
import "./ITimeLockFarmV2Dual.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/MigrationSetup.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./SafeERC20.sol";
import "./ManagerHelper.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/MigrationSetup.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/MigrationSetupLive.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/PrivateFarm2X.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./TokenWrapperSQRT.sol";
import "./Babylonian.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/PrivateFarm2X.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- WISE --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "forge-std/Test.sol";
import "./PrivateFarm2X.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/RescueSetup.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./SafeERC20.sol";
import "./ManagerSetup.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/SafeERC20.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./IERC20.sol";

Expand Down
5 changes: 2 additions & 3 deletions contracts/Scripts/Deployer.s.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "forge-std/Script.sol";

Expand All @@ -10,7 +10,6 @@ import { FarmFactory } from "../FarmFactory.sol";
import "../RescueSetup.sol";
import "../MigrationSetup.sol";
import "../TimeLockFarmV2Dual.sol";

contract DeployTimeLockFarmV2Dual is Script {

function setUp() public {}
Expand Down Expand Up @@ -162,7 +161,7 @@ contract DeployFarmFactory is Script {
);

address implementation = address (
0x545465f965c3Fdfb97Af0328E458ed66514bE286
0x3087Fc9cA1DbE935D5E09Aa94Df813239368Aee9
);

FarmFactory factory = new FarmFactory(
Expand Down
2 changes: 1 addition & 1 deletion contracts/SimpleFarm.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./TokenWrapper.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/SimpleFarm2X.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./TokenWrapper.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/SimpleManager.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

interface ISimpleFarm {

Expand Down
2 changes: 1 addition & 1 deletion contracts/TestToken.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: --BCOM--

pragma solidity =0.8.25;
pragma solidity =0.8.26;

contract TestToken {

Expand Down
2 changes: 1 addition & 1 deletion contracts/TimeLockFarm.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./TokenWrapper.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/TimeLockFarmV2.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: -- BCOM --

pragma solidity =0.8.25;
pragma solidity =0.8.26;

import "./TokenWrapper.sol";

Expand Down
Loading

0 comments on commit ce1e687

Please sign in to comment.