```\nFile: NapierRouter.sol\n    function swapUnderlyingForYt(\n        address pool,\n        uint256 index,\n        uint256 ytOutDesired,\n        uint256 underlyingInMax,\n        address recipient,\n        uint256 deadline\n    ) external payable override nonReentrant checkDeadline(deadline) returns (uint256) {\n..SNIP..\n            // Variable Definitions:\n            // - `uDeposit`: The amount of underlying asset that needs to be deposited to issue PT and YT.\n            // - `ytOutDesired`: The desired amount of PT and YT to be issued.\n            // - `cscale`: Current scale of the Tranche.\n            // - `maxscale`: Maximum scale of the Tranche (denoted as 'S' in the formula).\n            // - `issuanceFee`: Issuance fee in basis points. (10000 =100%).\n\n            // Formula for `Tranche.issue`:\n            // ```\n            // shares = uDeposit / s\n            // fee = shares * issuanceFeeBps / 10000\n            // pyIssue = (shares - fee) * S\n            // ```\n\n            // Solving for `uDeposit`:\n            // ```\n            // uDeposit = (pyIssue * s / S) / (1 - issuanceFeeBps / 10000)\n            // ```\n            // Hack:\n            // Buffer is added to the denominator.\n            // This ensures that at least `ytOutDesired` amount of PT and YT are issued.\n            // If maximum scale and current scale are significantly different or `ytOutDesired` is small, the function might fail.\n            // Without this buffer, any rounding errors that reduce the issued PT and YT could lead to an insufficient amount of PT to be repaid to the pool.\n            uint256 uDepositNoFee = cscale * ytOutDesired / maxscale;\n            uDeposit = uDepositNoFee * MAX_BPS / (MAX_BPS - (series.issuanceFee + 1)); // 0.01 bps buffer\n```\n