From 2a0a61f1e161b3a01726442e9c26b0a01df9addd Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Wed, 15 Dec 2021 00:54:54 +0530 Subject: [PATCH] update --- .../connectors/sushi-incentive/main.sol | 10 +++++----- .../sushiswapIncentive.test.ts | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/contracts/mainnet/connectors/sushi-incentive/main.sol b/contracts/mainnet/connectors/sushi-incentive/main.sol index 2adfafe2..9f48ed77 100644 --- a/contracts/mainnet/connectors/sushi-incentive/main.sol +++ b/contracts/mainnet/connectors/sushi-incentive/main.sol @@ -35,7 +35,7 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events { token1 = changeEthAddrToWethAddr(token1); token2 = changeEthAddrToWethAddr(token2); amount = getUint(getId, amount); - if(data.poolId == uint256(-1)|| data.version < 0 || data.lpToken == address(0)){ + if(data.poolId == uint256(-1)|| data.version <= 0 || data.lpToken == address(0)){ data = _getPoolId( token1, token2 @@ -74,7 +74,7 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events { token1 = changeEthAddrToWethAddr(token1); token2 = changeEthAddrToWethAddr(token2); amount = getUint(getId, amount); - if(data.poolId == uint256(-1)|| data.version < 0){ + if(data.poolId == uint256(-1)|| data.version <= 0){ data = _getPoolId( token1, token2 @@ -106,7 +106,7 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events { { token1 = changeEthAddrToWethAddr(token1); token2 = changeEthAddrToWethAddr(token2); - if(data.poolId == uint256(-1)|| data.version < 0 ){ + if(data.poolId == uint256(-1)|| data.version <= 0 ){ data = _getPoolId( token1, token2 @@ -145,7 +145,7 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events { token1 = changeEthAddrToWethAddr(token1); token2 = changeEthAddrToWethAddr(token2); amount = getUint(getId, amount); - if(data.poolId == uint256(-1)|| data.version < 0){ + if(data.poolId == uint256(-1)|| data.version <= 0){ data = _getPoolId( token1, token2 @@ -178,7 +178,7 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events { { token1 = changeEthAddrToWethAddr(token1); token2 = changeEthAddrToWethAddr(token2); - if(data.poolId == uint256(-1)|| data.version < 0 ){ + if(data.poolId == uint256(-1)|| data.version <= 0 ){ data = _getPoolId( token1, token2 diff --git a/test/mainnet/sushiswapIncentive/sushiswapIncentive.test.ts b/test/mainnet/sushiswapIncentive/sushiswapIncentive.test.ts index b8a9c32a..f0dca1ad 100644 --- a/test/mainnet/sushiswapIncentive/sushiswapIncentive.test.ts +++ b/test/mainnet/sushiswapIncentive/sushiswapIncentive.test.ts @@ -94,6 +94,12 @@ describe("Sushiswap", function () { }); describe("Main", function () { + const data = { + poolId: 0, + version: 0, + lpToken: ethers.constants.AddressZero + } + it("Should deposit successfully", async function () { const ethAmount = ethers.utils.parseEther("2") // 1 ETH const daiUnitAmount = ethers.utils.parseEther("4000") // 1 ETH @@ -134,7 +140,8 @@ describe("Sushiswap", function () { DAI_ADDR, ethers.utils.parseEther("10"), getId, - setId + setId, + data ] } ] @@ -152,7 +159,8 @@ describe("Sushiswap", function () { args: [ WETH_ADDR, DAI_ADDR, - setId + setId, + data ] } ] @@ -173,7 +181,8 @@ describe("Sushiswap", function () { DAI_ADDR, ethers.utils.parseEther("1"), getId, - setId + setId, + data ] } ] @@ -194,7 +203,8 @@ describe("Sushiswap", function () { DAI_ADDR, ethers.utils.parseEther("1"), getId, - setId + setId, + data ] } ]