Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add full SOR support for MixedRoutes (Uniswap#101)
* add quoterV3 abi * Add on-chain-quote-provider, accepts MixedRoute type input * Add IQuoterV3 for types * Add helpers for new quote provider * bump v3-sdk to ^3.8.3 * Add log * pin v3-sdk at 3.8.2 * set v3-sdk to ^3.7.0 but install to resolve to latest * Add MixedRouteWithValidQuote typings and wrangle with typescript about string encodings * finish adding getMixedQuotes * Add hack to estimate gas for mixed route * Create on-chain-heuristic-gas-model and add to alpha router * Fix errors, ready for specific integ test for v3 quoter * fix routeToString error * prevent round tripping in IL routes * change to .symbol * Add tests using new on quoterV3 to quote mixed paths * Save state * refactor SOR to accomdate new sdk change * Stuck at out of gas error on v3 * currently broken * update package-lock.json * pin ethersproject/providers at 5.4.0 and ethers at 5.6.1 to fix quoteProvider bug * pass all standard integ tets :) * add guard against quoterv2 address in on chain provider * remove some comments * remove block pinning * add caret * clean up integ tests file * remove some console.logs * package-lock add caret * some fixes * implement candidatePools for mixedRoutes * combine v3 and v2 candidate pools * revisions * fix errors from merge from main * some comments * bump tsnode 10.7.0 * Change mixedRouteHeuristicGasModel * -1 for num hops in v2 case * Just some comments for debugging * testing more mixed routes * rmeove comment * Create OnChainQuoteProvider generic class for v3 and mixed to inherit from * large refactor - remove v3 quote provider files\ * all unit tests pass when we don't query for mixedroutes which makes sense * Add validation checks against malformed routes param, and interface conditional * revert package.json to main * Save state * Add blockGasLimit, remove legacy testing stuff * Feat->feat branch add heuristics to mixed routes selection (Uniswap#117) * Add basic logic for comparing relative liquidity between pools v2 and v3 * Add first heuristic for mixed routes - relative liq in v2 pools * trying to get reserveUSD to be returned from v2 * Create instance of subgraph provider and call explictly * create custom subgraphProvider arg for v2 in mixedRoute * update to use reserveUSD * feat: add stale config (Uniswap#116) * [Docs] Added section in README on how to add a new chain to SOR (Uniswap#119) * add comment * Fix errors caused by bumping router-sdk * Update mixedRouteQuoteProvider params to avoid gasError * Remove exactOutput branch in methodParameters * remove unsued testing stuff * Remove maxApproval check * Save state * add testing stuff * Clean up testing * Change wording in comments for on chain quoter and add TODOs * Clean up comments, logs, and etc. before merge into feat branch Co-authored-by: marktoda <[email protected]> Co-authored-by: raghava-pamula <[email protected]> * Fix validation check for exact_input * Remove unused calculateL1Fee from MixedRouteGasModel * Add optional argument to onChainQuoteProvider for addressesLookup * Guard against case where addressLookup is not provided nor override * Replace QuoterV3 abi with new MixedRouteQuoterV1 abi * Bump ts-node to ^10.8.1 inline with main * Add disableMixedRoutesConsideration key to routingConfig * Change constructor params for OnChainQuoteProvider to have boolean flag * Add newly deployed Quoter address for testing * Fix import error in base-command * Add TODO for unit test and fix comment * USe router-sdk typing for protcols key in config * Change routeAmountsToString value for MIXED to V2 + V3 for interface * Fix compile error with mocked mixedRouteQuoteProvider * Disable mixedRoutes consideration for routeToRatio to pass unit tests * Remove console.logs and add some log.infos * Change behavior for non v2 liq chains to allow construction of class, but restrict usage * Do not construct mixedRouteQuoteProvider for non V2 supported chains * Fix comments, other non crit * self revisions * Remove skip, console.logs * Minor changes from offline disc Co-authored-by: Sara Reynolds <[email protected]> * Initial revisions, add comments, refactor some code for readibility * Add logic for routing across MIXED protocols explictly, fialing unit tests * Remove while/while logic in mixed-route-heuristic-gas-model and add router-sdk func * Allow token round trip in mixedRoute route generation * Oops fix error in checking token amounts in validateExecuteSwap * Add mixedRoute explicit cases for unit test * Add test where mixedRoute is selected, and check output * Unskip tests * locally bump package-json router-sdk version * bump local router-sdk version * Use v3PoolHelper funcs in mixedRouteHeuristicGasModel * Refactor gas models to use IOnChainGasFactory, and for mixedRoute to extend v3Factory class * Use published router-sdk1.3.0 version * Remove failing test * remove console.log * Add base unit test for exactOut. not called for mixedRouteQuotes * feat -> feat Eric/refactor gas factories (Uniswap#155) * Refactor gas models to use IOnChainGasFactory, and for mixedRoute to extend v3Factory class * now both mixed route and v3 extend IOnChainFactory, * protected -> private * Restrict return generic type for IOnChainGasModel to V3 or Mixed * Change buildGasModel to universally take an object as params, and add v2 helpers * Use highest native V2 pool in the case that the v3 does not exist * Fix unit tests for new inputs * Move COST_PER_UNINIT_TICK to v3/gas-costs * change inTermsOfToken to token * Remove skipped tests * remove logger * feat -> feat add cli support mixed routes (Uniswap#157) * Add flag in CLI quote.ts and update .route() call * Add mixedRoutes query into README.md * bump @uniswap/swap-router-contracts to 1.3.0 * Add protocol flag to SOR version of SDK routes (Uniswap#156) * Save state before fetching * Initial commit for refacto * Add unit test to make sure exactOut is not being called for mixed * Remove disable flag and add forceMixedRoutes flag, adjust logic + tests * Comments and revisions * Remove unsued inputs * Update natspec, comments * Add test that swap is null when exactOut + mixed * Add integ-tests for other chains * Change naming of getV2NativePool * Remove comment * fix comments * remove .only * Fix natspec * Fix candidate pools logic, and change naming of params + gasmodel * Remove some legacy stuff * Remove MixedRouteQuoter abis * Update readme * Change validateRoutes logic * Add integ tests for external on chain quote provider class * resolve new router-sdk to 1.3.0 * Fix validation and add tests * Add some comments * remove .only * finish up the test * untrack binaries * rollback changes, since we can't use new quoter with v3 since not deployed * Fix comment abt forceMixedRoutes Co-authored-by: marktoda <[email protected]> Co-authored-by: raghava-pamula <[email protected]> Co-authored-by: Sara Reynolds <[email protected]>
- Loading branch information