* Init contracts and sdk * Add basic example of swapping with sushi and curve 2pool * Initial ts and graph setup Revert "Initial ts and graph setup" This reverts commit a07cd1280e985f2301de25ab9ffe5a5cccc106f7. Add sushi and uni request Add types for requests * Testing querying pools for 2 tokens * Add Trader Joe pools * Sequence updator of pools * fix get token pair for sushiswap * add uniswapv3 pool integration * query for uniswap and test time * Initial architecture for sending queries * Uniswap query send integration * Abstraction for dexes Irina helped a LOT * All files under 1 architecture * Add parseToPool for SushiSwapV2 DEX * trader joe integration with Pool class * Add algo for direct swap * Call init swap from UI to sdk * Moved sdk to UI/src folder * Dikstra routing architecture * Delete clashing dependencies * Add fallback RPC provider + USD amounts of tokens * Dijkstra UniswapV2 pool routing algorithm implementation * Organize npm and add quality of life scripts * Revert "Organize npm and add quality of life scripts" This reverts commit a5cf92153fa56b228ec061546ef6b2d6976d0095. * Update algorithm * Create quote for sushiswap and add basic test for swapping * Add RateX.js test and config files * Oracles for WBTC and WETH work * Update RPC Provider * Connect solidity to front * Organize npm and add quality of life scripts * Fix input delay caused by asynchronous React hooks * Fix bad price state updates on token select * Update prices on swap * M1_18: Send amount as bigNumber and fix missmatching addresses issue * M1_25: Automate deploy script * M1_26: Connect with the selected network * M1_22: Display and auto-refresh quoted prices * M1_23: Show price impact * M1_29: GraphQL - fetch pool IDs for 2 tokens * M1_30: Fetch Pool Data from graph for SushiV2 and UniV3 * M1_30: Fix token pairs pool info * M1_31: Improvement - format code for consistency * M1_34: Add and improve basic swap algorithm * M1_33: Routing - one hop swap * M1_38: Refactoring code before DP algo * M1_38: Implement DP algo * M1_32: Basic future-proof routing UI * M2_36: Implement quote call for uniswap v3 using default quoter * M2_42: Call quote on frontend and get the best pool * M2_39: Routing - one hop swap (with split) Proof of concept for later expansion to multi hop. Instead of checking every route for the best output amount in every iteration, there will be a DP algorithm to find the best route for that iteration. * M2_37: Implement swap function and connect it with frontend, also add some loading, error checking and styling on frontend * M2_45: Setup tenderly fork and fix env variables on frontend * M1_44: Reformat frontend (#1) Migrate to SASS, standardize variable names, reformat everything * Improvement/p23-40 reformat sdk code (#2) Co-authored-by: Daniil Grbić <daniilgrbic@gmail.com> * M3_27: Add debounce and loader on quote call (#4) * Synchronize async calls and add input constraints * Add debounce * Appease Dragan * M3_57: Retrieve Curve data on-chain * M3_56: Create view function for getting ticks data and test quoter with logic needed for SDK * M3_56: Create first version of off chain uniswap quoter * P23-53 Integrate multi-hop logic (#5) MultiHop algo integration * Revert "P23-53 Integrate multi-hop logic (#5)" (#6) This reverts commit f4928509f60cce21dc6c6902523dd260c811250a. * P23-53 Integrate multi-hop logic (#5) (#7) MultiHop algo integration * Feature/P23-64:Add_curve_logic_to_rateX_repo (#8) Add Curve queries and outputAmount calculation Co-authored-by: Brankonymous <brankogrbic01@gmail.com> * M3_56: Refactor offchain quoter and simplify data retrival from contract * P23-67: Update algo for pools with more than 2 tokens (#9) * Feature P23-63 get sushi swap pool info (#10) * Delete unnecessary files * Solidity SushiSwapHelper * Algo and types update, fetching pools data * Add proper quote typing (#11) * M3_56: Adapt uniswap quoter to dex interface and create simple storage for ticks * P23-73:Connect routing diagram to quote * Filter out Curve V2 pools when querying Graph API * Fix communication with multihop algorithm * Format, remove logs * M3_61: Add swap function for multihop and connect it with frontend * Improvement/minor UI improvements and bugfixes (#14) * Handle unknown tokens and better routing diagram * Visually improve loading animation * Add tooltips for tokens in route diagram * Use variables for ant css * M3_60: Paralleize calls to speed up time taken to find route * M3_75: Modify Curve Graph calls * M3: Remove unused code for previous milestones * M3_49: Compute all routes with backtrack * M3_49: Finish sdk part for uni like algo * Uncomment routing diagram and previous version * P23-71: Integrate curve into algo (#18) * Solve merge conflicts * Edit curve data retrieval * Remove old Curve contract * P23-89: Get direct pools * Fix deployment issues and remove duplicate script for tenderly deployment * Feature/Swap on curve (#19) * Add swap for curve * Fix imports * M3_86: Reformat and refactor addresses config * M3_86: Fix tests * M3_86: Refactor deployment scripts * Feature/p23-77: Update pools and split algo (#20) * Update function for curve and sushi, basic split algo test * Add split routing * Bugfix curve update pool * P23-90: Integrate Camelot Dex (#21) * P23-89: Get direct pools * Fix deployment issues and remove duplicate script for tenderly deployment * Add initial graph query Co-authored-by: irinatomic <irina.z.tomic@gmail.com> * Add Camelot off-chain calculations Co-Authored-By: Daniil Grbić <mi20042@alas.matf.bg.ac.rs> * Feature/Swap on curve (#19) * Add swap for curve * Fix imports * M3_86: Reformat and refactor addresses config * M3_86: Fix tests * M3_86: Refactor deployment scripts * Fetch pool info on-chain Co-authored-by: irinatomic <irina.z.tomic@gmail.com> * Retrieve stableSwap on-chain * CamelotHelper contract for fetching data on-chain Co-Authored-By: Daniil Grbić <mi20042@alas.matf.bg.ac.rs> * Add complete logic for on-chain data fetching Co-Authored-By: Daniil Grbić <mi20042@alas.matf.bg.ac.rs> * Redeployment * Camelot is a silly place Co-authored-by: irinatomic <irina.z.tomic@gmail.com> --------- Co-authored-by: irinatomic <irina.z.tomic@gmail.com> * Add update function for Camelot pool * Fix impersonated DAI address * Set initial tokenFromAmount display value to empty string Quality of life thing * M3_81: Adapt uniswap quoter to include state changes (#22) * Feature/p23-59 :retrieve balancer data for weighted pools (#23) * M3_66: Get Balancer pool info from Graph and fix refactoring mistakes * Initial Balancer Stable Math * Change placement of sdk utils folder * Fetch pool info on-chain * Initial Balancer Weighted Math * Trying to test Balancer Swap function * Add logic for testing Balancer Stable Math * M3_79: Retrieve Balancer data on-chain * Enable sending funds for testing Tenderly * Merge with M3 (fix additional bugs) * remove not used data * Resolve conflict with UniV3 * M3_79: Unify balancer data * M3_79: Fix bugs * M3_79: Fix bugs 2 * M3_79: UI improvement, test done on Sushi, Uni and Balancer * NOT using Balancer Stable * M3_88: Add custom address * Fix balancer stable constructor bug * M3_87: Base for executing swap. Error: BAL#401 while calling BalancerVault.swap() * Balancer solidty swap integration * Resolve conflicts with M1 Co-Authored-By: Daniil Grbić <mi20042@alas.matf.bg.ac.rs> * Resolve merge conflicts * Add Dai funding * Resolve mini M3 branch conflicts --------- Co-authored-by: Irina Tomic <irina.z.tomic@gmail.com> Co-authored-by: Daniil Grbić <daniilgrbic@gmail.com> Co-authored-by: Daniil Grbić <mi20042@alas.matf.bg.ac.rs> * Change hardhat to tenderly * Add comments * P23-41: Detailed routing diagram and various minor improvements * Hash intermediary values for Curve calculations * M3_98: Add Camelot swap * Add missing Radiant Oracle * Implement swap function including splits (#24) * M3_80: Implement first version of swap function with splitting * M3_80: Add missing amount in difference * M3_80: Refactor swap function for splitting and change format * M3_80: Refactor types for splitting and uni like algo and make it generic for split function * Add curve fix and include balancer poolId slice * M3_99: Refactor solidity and add some improvements (#25) * Introduction and app * Change * Add solidity and improvements docs * Add algo_unilike, enhanced introduction and app * Iterative splitting algo docs * Minor improvements added in introduction and solidity * Add result page * Add data retrieval page and change image sizes * Fix missing images * Add decenter logo * Change decenter logo * Change overall README * Delete .DS_Store * Center images * Add "Why Arbitrum" explanation * Mini improvement * Update 2_app.md * Choose pools * Update README.md --------- Co-authored-by: Rajko Zagorac <rajkozgrc4@gmail.com> Co-authored-by: Dragan Mitrašinović <dragan.mitrasinovic19@gmail.com> Co-authored-by: Daniil Grbić <daniilgrbic@gmail.com> Co-authored-by: Brankonymous <brankogrbic01@gmail.com> Co-authored-by: Rajko Zagorac <57317299+rajko-z@users.noreply.github.com> Co-authored-by: Brankonymous <45096660+Brankonymous@users.noreply.github.com> Co-authored-by: Daniil Grbić <mi20042@alas.matf.bg.ac.rs>
1.4 KiB
1.4 KiB
The App
The app consists of 3 parts:
- UI/UX
- SDK (routing logic)
- Solidity (pool data retrieval and swap execution)
The flow graph of the app can be seen in the next chapter.
How the app looks
How to run
Run locally
Fill in contracts/.env and UI/.env files (only the RPC provider part - alchemy key). Position yourself in the RateX/contracts files and run:
npx hardhat node - starting a local hardhat fork
npx hardhat run scripts/deploy.js --network localhost - deploys smart contracts
npx hardhat run scrips/fundHardhat.js --network localhost - funds the first hardhat account
Then, from the RateX folder run npm start.
Run on a Tenderly fork
Create a Tenderly fork and fill in contracts/.env and UI/.env files. Position yourself in the RateX/contracts folder and run:
npx hardhat node
npx hardhat run scripts/deploy.js --network tenderly - deploys smart contracts
npx hardhat run scrips/fundTenderly.js --network tenderly - funds the first wallet account
Then, from the RateX folder run npm start.
Choose pools
Change variable files in function initializeDexes found in:
UI/src/sdk/quoter/graph_communication.ts
