```\n  function compound(GMXTypes.Store storage self, GMXTypes.CompoundParams memory cp) external {lt\n      if (self.tokenA.balanceOf(address(self.trove)) > 0) {\n          self.tokenA.safeTransferFrom(address(self.trove), address(this), self.tokenA.balanceOf(address(self.trove)));\n      }\n      if (self.tokenB.balanceOf(address(self.trove)) > 0) {\n          self.tokenB.safeTransferFrom(address(self.trove), address(this), self.tokenB.balanceOf(address(self.trove)));\n      }\n\n      uint256 _tokenInAmt = IERC20(cp.tokenIn).balanceOf(address(this));\n\n      // Only compound if tokenIn amount is more than 0\n      if (_tokenInAmt > 0) {\n          self.refundee = payable(msg.sender); // the msg.sender is the keeper.\n\n          self.compoundCache.compoundParams = cp; // storage update.\n\n          ISwap.SwapParams memory _sp;\n\n          _sp.tokenIn = cp.tokenIn;\n          _sp.tokenOut = cp.tokenOut;\n          _sp.amountIn = _tokenInAmt;\n          _sp.amountOut = 0; // amount out minimum calculated in Swap\n          _sp.slippage = self.minSlippage; // minSlipage may result to a revert an cause the tokens stays in this contract.\n          _sp.deadline = cp.deadline;\n\n          GMXManager.swapExactTokensForTokens(self, _sp); // return value not checked.\n\n          GMXTypes.AddLiquidityParams memory _alp;\n\n          _alp.tokenAAmt = self.tokenA.balanceOf(address(this));\n          _alp.tokenBAmt = self.tokenB.balanceOf(address(this));\n          /// what this return in case zero balance?? zero\n          self.compoundCache.depositValue = GMXReader.convertToUsdValue(\n              self, address(self.tokenA), self.tokenA.balanceOf(address(this))\n          ) + GMXReader.convertToUsdValue(self, address(self.tokenB), self.tokenB.balanceOf(address(this)));\n          // revert if zero value, status not open or compound_failed , executionFee < minExecutionFee.\n          GMXChecks.beforeCompoundChecks(self);\n\n          self.status = GMXTypes.Status.Compound;\n\n          _alp.minMarketTokenAmt =\n              GMXManager.calcMinMarketSlippageAmt(self, self.compoundCache.depositValue, cp.slippage);\n\n          _alp.executionFee = cp.executionFee;\n          self.compoundCache.depositKey = GMXManager.addLiquidity(self, _alp);\n      }\n```\n