Error handling in depositWithPermit
The function depositWithPermit
allows a user to deposit USDC into the contract with a permit signature, bypassing the need for a separate approval transaction. The function's current implementation includes a try-catch block surrounding the permit
call but not the subsequent safeTransferFrom
call.
Ideally, safeTransferFrom
could not fail unexpectedly, but it is better to put the entire function in a try-catch block to catch any unexpected errors. This will make the function more clear and robust, and also the user will be able to see the error message.