From 6ef98e10247eb7684a131fa400f96fbe2bb116c0 Mon Sep 17 00:00:00 2001 From: Meet Mangukiya Date: Sun, 29 Aug 2021 17:13:25 +0530 Subject: [PATCH] Allow disabiling autoLiquidity --- CAKEBANK.sol | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CAKEBANK.sol b/CAKEBANK.sol index 88140c7..d44c774 100644 --- a/CAKEBANK.sol +++ b/CAKEBANK.sol @@ -318,8 +318,12 @@ contract CAKEBANK is ERC20, Ownable { uint256 marketingTokens = contractTokenBalance.mul(marketingFee).div(totalFees); swapAndSendToFee(marketingTokens); - uint256 swapTokens = contractTokenBalance.mul(liquidityFee).div(totalFees); - swapAndLiquify(swapTokens); + // do not add liquidity if liquidity fee is 0, i.e. ability to disable adding liquidity by setting + // liquidityFee to 0. + if (liquidityFee > 0) { + uint256 swapTokens = contractTokenBalance.mul(liquidityFee).div(totalFees); + swapAndLiquify(swapTokens); + } uint256 sellTokens = balanceOf(address(this)); swapAndSendDividends(sellTokens);