```\nfunction addLiquidity(\n    LiquidityParams calldata lp,\n    uint deadline\n) external override ensure(deadline) returns (uint256 amountBase) {\n    if (IDAOfiV1Factory(factory).getPair(\n        lp.tokenBase,\n        lp.tokenQuote,\n        lp.slopeNumerator,\n        lp.n,\n        lp.fee\n    ) == address(0)) {\n        IDAOfiV1Factory(factory).createPair(\n            address(this),\n            lp.tokenBase,\n            lp.tokenQuote,\n            msg.sender,\n            lp.slopeNumerator,\n            lp.n,\n            lp.fee\n        );\n    }\n    address pair = DAOfiV1Library.pairFor(\n        factory, lp.tokenBase, lp.tokenQuote, lp.slopeNumerator, lp.n, lp.fee\n    );\n\n    TransferHelper.safeTransferFrom(lp.tokenBase, lp.sender, pair, lp.amountBase);\n    TransferHelper.safeTransferFrom(lp.tokenQuote, lp.sender, pair, lp.amountQuote);\n    amountBase = IDAOfiV1Pair(pair).deposit(lp.to);\n}\n```\n