Submitted by kirk-baird, also found by 0x52, cccz, csanuragjain, kenzo, and WatchPug
The function swapExactTokensForTokens() will return and array with the 0 index being the input amount follow by each output amount. The 0 index is incorrectly used in Pendle lend() function as the output amount. As a result the value of returned will be the invalid (i.e. the input rather than the output).
Since this impacts how many PTs will be minted to the msg.sender, the value will very likely be significantly over or under stated depending on the exchange rate. Hence the msg.sender will receive an invalid number of PT tokens.
The amount of principal returned should be index 1 of the array returned by swapExactTokensForTokens().
sourabhmarathe (Illuminate) confirmed
