diff --git a/contracts/tokens/EsToken.sol b/contracts/tokens/EsToken.sol index b72e7e5..010f643 100644 --- a/contracts/tokens/EsToken.sol +++ b/contracts/tokens/EsToken.sol @@ -10,6 +10,7 @@ contract EsToken is RestrictedToken, IEsToken { constructor(string memory _name, string memory _symbol, address _claimableToken) RestrictedToken(_name, _symbol, TokenType.ESCROW) { + require(_claimableToken != address(0), "ZERO_ADDRESS"); claimableToken = _claimableToken; } } \ No newline at end of file diff --git a/package.json b/package.json index 24d22c8..5ac58ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gammaswap/v1-staking", - "version": "0.10.8", + "version": "0.10.9", "description": "Staking contracts for GammaSwapV1 protocol", "scripts": { "hardhat": "hardhat", diff --git a/test/foundry/StakingRouter.t.sol b/test/foundry/StakingRouter.t.sol index 5063e98..850c638 100644 --- a/test/foundry/StakingRouter.t.sol +++ b/test/foundry/StakingRouter.t.sol @@ -6,6 +6,7 @@ import "@gammaswap/v1-core/contracts/base/GammaPoolERC20.sol"; import "../../contracts/interfaces/IRewardTracker.sol"; import "./fixtures/CPMMGammaSwapSetup.sol"; +import "../../contracts/tokens/EsToken.sol"; contract StakingRouterTest is CPMMGammaSwapSetup { function setUp() public { @@ -27,6 +28,14 @@ contract StakingRouterTest is CPMMGammaSwapSetup { approveUserForStaking(user2, address(pool2)); } + function testEscrowToken() public { + EsToken esToken = new EsToken("test token", "TOK1", address(0x123)); + assertEq(esToken.claimableToken(), address(0x123)); + + vm.expectRevert("ZERO_ADDRESS"); + EsToken esTokenTest = new EsToken("test token", "TOK1", address(0)); + } + function testStakingContractsAlreadySet() public { vm.expectRevert(bytes4(keccak256("GSTokensAlreadySet()"))); stakingRouter.initializeGSTokens(address(gs), address(esGs), address(esGsb), address(bnGs), address(weth));