SwaprHQ / swapr-dapp

DEX meta agregator
https://swapr.eth.limo/
GNU General Public License v3.0
49 stars 58 forks source link

Gas estimation #1726

Open Mi-Lan opened 1 year ago

Mi-Lan commented 1 year ago

Linked to this sdk pr https://github.com/ImpeccableHQ/swapr-sdk/pull/276

To test:

Some notes from my research:

1) Looking into the uniswaps smart order router I think this comment sums it up pretty good they basically do it off chain https://github.com/Uniswap/smart-order-router/blob/adf5b62fe5264f72903571537861de327c850751/src/routers/alpha-router/gas-models/gas-model.ts#L104 2) Tenderly Simulation api won't work since forks and simulation api is rate limited to wayy below our needs https://docs.tenderly.co/simulations-and-forks/simulation-api/simulation-api-rate-limits#simulation-api 3) Alchemy's bundle simulation https://docs.alchemy.com/reference/simulation-bundle could potentially work but there seems to be some issues on their side I submitted a ticket on discord and they contacted me thanking for pointing it out so well see based on response if this is feasable. Also regarding api limits one api call costs 2500 CU and with paid plan we get 400,000,000CPU's so that comes to about 160,000 estimations a month. Which I think its enough with some optimizations for fetching it will be fine! I made it so that if regular estimate gas fails it will try this simulation api...Not in all cases

netlify[bot] commented 1 year ago

Deploy Preview for swapr ready!

Name Link
Latest commit d5517edc64afadca5146b6d7cc39d1c356db996d
Latest deploy log https://app.netlify.com/sites/swapr/deploys/6400ddecefa8d30007ba28e2
Deploy Preview https://deploy-preview-1726--swapr.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

MilanVojnovic95 commented 1 year ago

Tested and looks ok to me 👍