```\nfunction addLiquidity(address inputToken, uint256 inputAmount, uint256 minLP)\n    external\n    payable\n    onlyListedToken(inputToken)\n    override\n    returns (uint256 actualLP)\n  {\n    // Check that the exchange is unlocked and thus open for business\n    Config memory _config = DFPconfig;\n    require(_config.unlocked, "DFP: Locked");\n\n    // Pull in input token and check the exchange balance for that token\n    uint256 initialBalance;\n    if (inputToken == address(0)) {\n      require(msg.value == inputAmount, "DFP: Incorrect amount of ETH");\n      initialBalance = address(this).balance - inputAmount;\n    } else {\n      initialBalance = IERC20(inputToken).balanceOf(address(this));\n      IERC20(inputToken).safeTransferFrom(msg.sender, address(this), inputAmount);\n    }\n\n    // Prevent excessive liquidity add which runs of the approximation curve\n    require(inputAmount < initialBalance, "DFP: Too much at once");\n\n    // See https://en.wikipedia.org/wiki/Binomial_approximation for the below\n    // Compute the 6th power binomial series approximation of R.\n    //\n    //                   X   15 X^2   155 X^3   7285 X^4   91791 X^5   2417163 X^6\n    // (1+X)^1/16 - 1 ≈ -- - ------ + ------- - -------- + --------- - -----------\n    //                  16    512      8192      524288     8388608     268435456\n    //\n    // Note that we need to terminate at an even order to guarantee an underestimate\n    // for safety. The underestimation leads to slippage for higher amounts, but\n    // protects funds of those that are already invested.\n    uint256 X = (inputAmount * _config.oneMinusTradingFee) / initialBalance;  // 0.64 bits\n    uint256 X_ = X * X;                                // X^2   0.128 bits\n    uint256 R_ = (X >> 4) - (X_ * 15 >> 73);           // R2    0.64 bits\n    X_ = X_ * X;                                       // X^3   0.192 bits\n    R_ = R_ + (X_ * 155 >> 141);                       // R3    0.64 bits\n    X_ = X_ * X >> 192;                                // X^4   0.64 bits\n    R_ = R_ - (X_ * 7285 >> 19);                       // R4    0.64 bits\n    X_ = X_ * X;                                       // X^5   0.128 bits\n    R_ = R_ + (X_ * 91791 >> 87);                      // R5    0.64 bits\n    X_ = X_ * X;                                       // X^6   0.192 bits\n    R_ = R_ - (X_ * 2417163 >> 156);                   // R6    0.64 bits\n\n    // Calculate and mint LPs to be awarded\n    actualLP = R_ * totalSupply() >> 64;\n    require(actualLP > minLP, "DFP: No deal");\n    _mint(msg.sender, actualLP);\n\n    // Emitting liquidity add event to enable better governance decisions\n    emit LiquidityAdded(msg.sender, inputToken, inputAmount, actualLP);\n  }\n\n\n```\n