Giter VIP home page Giter VIP logo

ratex's Introduction

πŸ’‘ RateX - A Decentralized DEX Aggregator

decenter

🌟 Introduction

RateX is a decentralized DEX aggregator designed to integrate seamlessly into existing applications, enabling users to leverage the best trade routes across multiple decentralized exchanges without taking positive slippage or fees. This project focuses on offering a competitive alternative to current DEX aggregators, which are mostly closed source and may take positive slippage. RateX runs directly on the user's machine or in their browser, ensuring transparency and control over the routing process.

If you want to learn more about the RateX architecture and how it all works behind the scenes, please read the Architecture documentation.

Why are we making this?

Current DEX aggregators do not charge any fees but do take the positive slippage, if there is one. Slippage is the difference between the expected price of a trade and the price at which the trade is executed. Additionally, their routing algorithms are typically closed source, so if they suddenly started charging fees, they would effectively have no immediate competition.

Our idea was to create the 'competition'. We would:

  1. Not take the positive slippage and fees.
  2. Make the routing algorithm open source.
  3. Create the code (SDK) to be executed on the user's machine (in browser), instead of on a server.

✨ Features

  • πŸ” Optimal Route Discovery across multiple DEXes
  • πŸ’° No Fees or Positive Slippage
  • πŸ–₯️ Client-side Execution: Ensures transparency and security.
  • πŸ”“ Open-Source: Promotes community-driven development.
  • ⚑ Support for Arbitrum and Ethereum networks

🌐 RateX Contracts

Contract Name Ethereum ⚫ Arbitrum πŸ”΅
RateX 0xAC64cF5B37124e62Ad716e664faF711Bd0882056 0x1D3ac829f8b0056972491095342730710e956629
Uniswap Helper 0xBFA0CAC4e1FC4958Ef24732F5b1e063637D20704 0xBf70F85011047C4cF31696780BdB6db752527d7c
Sushiswap Helper 0xAc62F8Ff99B1fEa563Cf8D47Ce1B9fE76F3AC5b8 0x141fc598Ed85a23e78f2b58ABe95AC013d196249
Balancer Helper 0xf77f3E6ed19DAFe90f90c3C1609207902C7414f9 0xd1dFeDe71160a0a1e869e2D3F428A47531726BfE
Uniswap V2 Helper 0x043EEB82faC75641146955Fea5509C824b2AD22A 0x24725a85903e83A4829F51287B8E0BD321121DbC
Camelot Helper N/A 0x91DE0353a4f93BD460dE3a373Feb50c53571c078

Note: Camelot Helper is not available on Ethereum mainnet.

Getting Started

This repository includes both a frontend and contracts that can be used with the existing RateX contracts to immediately start trading or, alternatively, provides users the option to deploy their own custom contracts to tailor the experience to their specific needs.

πŸ› οΈ Requirements

Ensure you have Node.js installed

πŸ“¦ Installation

In the project root directory, run the postinstall script to set up both the UI and contracts:

npm run postinstall

Copy code

Running Frontend

Before starting the frontend, ensure you fill out the .env file based on the provided .env.example to configure the environment variables necessary for the application:

# .env file setup
REACT_APP_MAINNET_URL=<Your_Mainnet_Node_URL>
REACT_APP_ARBITRUM_URL=<Your_Arbitrum_Node_URL>
REACT_APP_GRAPH_API_KEY=<Your_Graph_API_Key>

Once the .env file is configured, navigate to the UI directory and start the application:

cd UI
npm run start

This will launch the frontend, where you can interact with the default RateX contracts or deploy and interact with your custom contracts if desired. If everything is set up correctly, you should see the following interface:

decenter

Setting Up Smart Contracts (Optional)

1. Compile and Test Contracts

Navigate to the RateX/contracts directory:

cd contracts

Compile the smart contracts and run tests to ensure everything is functioning correctly:

npx hardhat compile
npx hardhat test

2. Deploy Contracts

To deploy the contracts to a specific network, first ensure you have filled out the .env file based on the provided .env.example for contracts. Adjust environment variables accordingly:

# .env file setup for contracts
MAINNET_URL=<Your_Mainnet_Node_URL>
ARBITRUM_URL=<Your_Arbitrum_Node_URL>
TENDERLY_FORK_ID_MAINNET=<Your_Tenderly_Fork_Mainnet_Id>
TENDERLY_FORK_ID_ARBITRUM=<Your_Tenderly_Fork_Arbitrum_Id>
SECRET_KEY=<Your_Private_Key>

Then, run the deployment script:

npx hardhat run scripts/deploy --network networkName

Local Development Environment

For local testing and development, follow these steps:

Start a local Hardhat node:
npx hardhat node
Deploy smart contracts to the local network:
npx hardhat run scripts/deploy.js --network localhost
Fund the first account on the Hardhat node to simulate transactions:
npx hardhat run scripts/utils/fundHardhat.js --network localhost

After setting up the local environment, navigate back to the RateX UI folder and start the application:

npm start

Run on a Tenderly Fork

To use Tenderly for a simulated blockchain environment:

  1. Create a Tenderly fork.
  2. Ensure you fill in the .env values in both the contracts and UI directories.

Position yourself in the RateX/contracts folder and deploy the smart contracts to your Tenderly fork:

npx hardhat run scripts/deploy.js --network tenderly

Fund the first wallet account on the Tenderly fork to simulate transactions:

npx hardhat run scripts/utils/fundTenderly.js --network tenderly

Finally, from the RateX folder, start the frontend application:

npm start

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgements

Special thanks to Decenter internship teams for supporting this project and all the contributors who made this possible.

πŸ“¬ Contact

For any questions or support, please open an issue on our GitHub repository.


Built with ❀️ by the RateX team

ratex's People

Contributors

scannty avatar skocimis avatar vaniiiii avatar viktorvujke avatar irinatomic avatar rajko-z avatar

Stargazers

 avatar  avatar  avatar Shun Kakinoki avatar William Southard avatar  avatar  avatar Brankonymous  avatar  avatar Daniil Grbić avatar

Watchers

 avatar

ratex's Issues

Subgraph endpoint update required

Hey team,

We've noticed that you're referencing a subgraph deployed on The Graph's hosted service in this repository. Just a heads-up: after June 12th, hosted service subgraph endpoints will no longer be available as the offering is being deprecated.

If you are the subgraph owner or maintainer, it's time to upgrade your subgraph to the network. This ensures everything keeps running smoothly and you get access to all the latest features and improvements. Here is a quick guide with all the upgrade steps.

If you're not the subgraph owner or maintainer, check Graph Explorer to see if the subgraph development team has already upgraded to the network. If you don’t find an upgraded subgraph, a friendly nudge to the subgraph development team would be greatly appreciatedβ€”it's a quick process that benefits everyone. Here's the upgrade guide with all the necessary steps for the subgraph development team.

Once the subgraph is upgraded to the network, you can create an API key and updated query URL in Subgraph Studio then update this repository to query from the new endpoint, https://api.studio.thegraph.com/query/<ID>/<SUBGRAPH_NAME>/<VERSION>

Need more support or have more questions? Feel free to reach out to [email protected]. We're here to help!

Cheers,

Paka

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.