Uniswap / interface

🦄 Open source interfaces for the Uniswap protocol
https://app.uniswap.org
GNU General Public License v3.0
4.99k stars 5.05k forks source link

Allow deadline to be omitted #2924

Open NoahZinsmeister opened 2 years ago

NoahZinsmeister commented 2 years ago

After full router-sdk support lands, deadline will be an optional parameter for swaps. In cases when it is omitted, resulting transactions can be anywhere from 1-5k gas cheaper, because of the calldata reduction associated with not passing it. So, we should consider omitting this parameter for specific swaps to save gas. The biggest (5k) savings are when the transaction would otherwise be able to bypass multicall, but beacuse of deadline has to use more expensive encoding, so possibly we could limit this feature to that case.

This is related to #2141, however the goal of that change would be to reduce transaction failures in cases when failure due to deadline is not desired.

willhennessy commented 2 years ago

Notes: we have two options on how to integrate this

  1. Manual setting to omit the tx deadline. Include a tooltip that explains you can save some gas by omitting the tx deadline. This could be a toggle ("Omit tx deadline") or a setting in the tx deadline field such as MAX_INT
  2. Potentially we could predict a very high success rate (i.e. a typical USDC:DAI swap) and autmoatically omit the tx deadline in that scenario. (#2141)