You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Practically, what is needed to implement this is some toggle in the user interface (checkbox, toggle switch, etc) that lets a user choose whether 'Gasless Transactions' are enabled. It should probably be disabled by default. We probably also want to add a tooltip to this toggle that explains that you are paying for the transaction as a % of the tokens you are trading (they aren't free).
If this toggle is set to true, then instead of calculating the miner tip in advance and calling:
swapExactTokensforETHAndTipAmount
swapExactTokensforTokensAndTipAmount
swapTokensForExactETHAndTipAmount
swapTokensForExactTokensAndTipAmount
We estimate the amount of the resulting ETH we expect from the trade and calculate the tip as % of that ETH that equates to the roughly same effective gas price. We then use that % as an input in the following methods:
swapExactTokensforETHAndTipPct
swapExactTokensforTokensAndTipPct
swapTokensForExactETHAndTipPct
swapTokensForExactTokensAndTipPct
The implementation for swapping tokens to ETH will be easier because you are already estimating the ETH output as part of the original trade. Swapping tokens for tokens will be a little trickier because in addition to estimating the original trade from Token A -> Token B, you will also need to estimate an additional trade from Token B -> ETH and include both trade 'paths' as params to the function call.
Description
ArcherSwapRouter
contract enable users to pay for tips using tokens. We would like to surface this feature on the application.New Option
Pay with tokens (on/off) - default off
Behavior
When pay with tokens is enabled, the tip should be paid with the "destination" tokens. The UI should reflect this payment in tokens.
When pay with tokens is disabled, the existing functionality should be used (pay in eth).
The text was updated successfully, but these errors were encountered: