From 44d786872de5feea41417b9addc03f5da25d3bfe Mon Sep 17 00:00:00 2001 From: Anton Bukov Date: Mon, 25 Sep 2023 16:07:23 +0200 Subject: [PATCH] Add extra safety check to FarmingPool constructor --- contracts/FarmingPool.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/FarmingPool.sol b/contracts/FarmingPool.sol index b607737..89d01d3 100644 --- a/contracts/FarmingPool.sol +++ b/contracts/FarmingPool.sol @@ -16,6 +16,7 @@ contract FarmingPool is IFarmingPool, Ownable, ERC20 { using Address for address payable; using FarmingLib for FarmingLib.Info; + error SameStakingAndRewardsTokens(); error ZeroStakingTokenAddress(); error ZeroRewardsTokenAddress(); error ZeroDistributorAddress(); @@ -43,6 +44,7 @@ contract FarmingPool is IFarmingPool, Ownable, ERC20 { string(abi.encodePacked("farm", stakingToken_.symbol())) ) { + if (stakingToken_ == rewardsToken_) revert SameStakingAndRewardsTokens(); if (address(stakingToken_) == address(0)) revert ZeroStakingTokenAddress(); if (address(rewardsToken_) == address(0)) revert ZeroRewardsTokenAddress(); stakingToken = stakingToken_;