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
Include values in token list as custom fields calculated above
In the frontend, calculate the fee to be charged in the base token by:
Summing the gas values for transfer, approve, and swap
Checking the market rate for gas via gasnow API and multiplying by gas used in ETH
Take the amount calculated in previous step and apply some function to adjust it for Flashbots estimate, e.g. it will likely cost more than market gas rate from mempool, but how much more? 2x? Something more complicated? Should this be UI configurable? Gas premium toggle Low/High for example?
Use coingecko or other API to get spot price of the token in USD & the spot price of ETH in USD
Use values above to calculate amount of token needed for bribe to display to user
Alternatively: can we look directly at Uniswap v2 Pool spot price or swap estimation? Whichever is easier
Display the fee in selected token in non-editable (greyed out) field or other UI component
Validate that the user's total token balance is greater than or equal to the sum of the transfer amount & the fee/bribe amount; show error message if not
How to figure out gas that will be used by the transactions
Gas usage heuristic— how to figure out the gas price
User Experience
Note: look into other solutions
The text was updated successfully, but these errors were encountered: