Lack of slippage control for `issue` function
The lack of slippage control for `issue` function can lead to a loss of assets for the affected users.\\nDuring the issuance, the user will deposit underlying assets (e.g., ETH) to the Tranche contract, and the Tranche contract will forward them to the Adaptor contract for depositing at Line 208 below. The number of shares minted is depending on the current scale of the adaptor. The current scale of the adaptor can increase or decrease at any time, depending on the current on-chain condition when the transaction is executed. For instance, the LIDO's daily oracle/rebase update will increase the stETH balance, which will, in turn, increase the adaptor's scale. On the other hand, if there is a mass validator slashing event, the ETH claimed from the withdrawal queue will be less than expected, leading to a decrease in the adaptor's scale. Thus, one cannot ensure the result from the off-chain simulation will be the same as the on-chain execution.\\nHaving said that, the number of shared minted will vary (larger or smaller than expected) if there is a change in the current scale. Assuming that Alice determined off-chain that depositing 100 ETH would issue $x$ amount of PT/YT. When she executes the TX, the scale increases, leading to the amount of PT/YT issued being less than $x$. The slippage is more than what she can accept.\\nIn summary, the `issue` function lacks the slippage control that allows the users to revert if the amount of PT/YT they received is less than the amount they expected.\\n```\\nFile: Tranche.sol\\n    function issue(\\n        address to,\\n        uint256 underlyingAmount\\n    ) external nonReentrant whenNotPaused notExpired returns (uint256 issued) {\\n..SNIP..\\n        // Transfer underlying from user to adapter and deposit it into adapter to get target token\\n        _underlying.safeTransferFrom(msg.sender, address(adapter), underlyingAmount);\\n        (, uint256 sharesMinted) = adapter.prefundedDeposit();\\n\\n        // Deduct the issuance fee from the amount of target token minted + reinvested yield\\n        // Fee should be rounded up towards the protocol (against the user) so that issued principal is rounded down\\n        // Hackmd: F0\\n        // ptIssued\\n        // = (u/s + y - fee) * S\\n        // = (sharesUsed - fee) * S\\n        // where u = underlyingAmount, s = current scale, y = reinvested yield, S = maxscale\\n        uint256 sharesUsed = sharesMinted + accruedInTarget;\\n        uint256 fee = sharesUsed.mulDivUp(issuanceFeeBps, MAX_BPS);\\n        issued = (sharesUsed - fee).mulWadDown(_maxscale);\\n\\n        // Accumulate issueance fee in units of target token\\n        issuanceFees += fee;\\n        // Mint PT and YT to user\\n        _mint(to, issued);\\n        _yt.mint(to, issued);\\n\\n        emit Issue(msg.sender, to, issued, sharesUsed);\\n    }\\n\\n```\\n
Implement a slippage control that allows the users to revert if the amount of PT/YT they received is less than the amount they expected.
Loss of assets for the affected users.
```\\nFile: Tranche.sol\\n    function issue(\\n        address to,\\n        uint256 underlyingAmount\\n    ) external nonReentrant whenNotPaused notExpired returns (uint256 issued) {\\n..SNIP..\\n        // Transfer underlying from user to adapter and deposit it into adapter to get target token\\n        _underlying.safeTransferFrom(msg.sender, address(adapter), underlyingAmount);\\n        (, uint256 sharesMinted) = adapter.prefundedDeposit();\\n\\n        // Deduct the issuance fee from the amount of target token minted + reinvested yield\\n        // Fee should be rounded up towards the protocol (against the user) so that issued principal is rounded down\\n        // Hackmd: F0\\n        // ptIssued\\n        // = (u/s + y - fee) * S\\n        // = (sharesUsed - fee) * S\\n        // where u = underlyingAmount, s = current scale, y = reinvested yield, S = maxscale\\n        uint256 sharesUsed = sharesMinted + accruedInTarget;\\n        uint256 fee = sharesUsed.mulDivUp(issuanceFeeBps, MAX_BPS);\\n        issued = (sharesUsed - fee).mulWadDown(_maxscale);\\n\\n        // Accumulate issueance fee in units of target token\\n        issuanceFees += fee;\\n        // Mint PT and YT to user\\n        _mint(to, issued);\\n        _yt.mint(to, issued);\\n\\n        emit Issue(msg.sender, to, issued, sharesUsed);\\n    }\\n\\n```\\n