Welcome to Soroswap, a decentralized exchange (DEX) that draws inspiration from the Uniswap V2 protocol and is specifically tailored for the Soroban network.
Before you begin, ensure you have met the following requirements:
- docker >= v24.0.2
- Freighter Wallet v5.6.3 Please use this version. You can have an intependent environment following the instructios in this post
-
Clone the Repository
git clone https://github.com/soroswap/frontend.git cd frontend
-
Set Up Environment Variables
Copy the .env.example file to create a new .env file:
cp .env.local.example .env
Now, edit the
.env
file and provide theNEXT_PUBLIC_BACKEND_URL
,NEXT_PUBLIC_SOROSWAP_BACKEND_API_KEY
andNEXT_PUBLIC_TEST_TOKENS_ADMIN_SECRET_KEY
variables. This will tell the frontend where to look for:- the list of known tokens
- the SoroswapFactory address
- the SoroswapRouter address
- the admin key for token minting
If you are following the instructions in
https://github.com/soroswap/core
in order to deploy the smart contacts in your local environment and serve the API. you should have:NEXT_PUBLIC_BACKEND_URL=http://localhost:8010
If you don't want to use the backend, you should also set the following variable:
NEXT_PUBLIC_SOROSWAP_BACKEND_ENABLED=false
Also, the variable
NEXT_PUBLIC_TEST_TOKENS_ADMIN_SECRET_KEY
should be the same as the one that deployed the tokens in thecore
repository.If you are ready for production, you can take Futurenet Contracts information from
https://api.soroswap.finance
and just docp .env.production.example .env
❗️❗️ Note that some Futurenet RPC's might not have the same version, so we recomend you to connect to a local quickstart node following the instructions in
https://github.com/soroswap/core
; and setting up your Freighter Wallet as in step 6. -
Start Docker
Navigate to the the
run.sh
script inside thedocker
folderbash docker/run.sh
This script will set up and start the Docker containers required for Soroswap.
-
Install the Dependencies
After the Docker container is up, you will be inside the root folder on the container. Then, install the dependencies using Yarn:
yarn install
-
Run the Development Instance
Now you are ready to start the development instance. Run the following command:
yarn dev
This will start the Soroswap development instance.
-
Configure your Freigher Wallet
For Standalone network
Name Local Standalone HORIZON RPC URL http://localhost:8000 SOROBAN RPC URL http://localhost:8000/soroban/rpc Passphrase Standalone Network ; February 2017 Friendbot http://localhost:8000/friendbot Allow HTTP connection Enabled Switch to this network Enabled For Futurenet network
Name Local Futurenet HORIZON RPC URL http://localhost:8000 SOROBAN RPC URL http://localhost:8000/soroban/rpc Passphrase Test SDF Future Network ; October 2022 Friendbot http://localhost:8000/friendbot Allow HTTP connection Enabled Switch to this network Enabled ** Important:** You should also do: Preferences> Allow experimental mode
-
Last, but not least, add some lumens to your Freighter wallet!
Do it directly on the wallet or use:
For Standalone:
http://localhost:8000/friendbot?addr=<your address>
For Futurenet, visit: https://laboratory.stellar.org/#create-account
🚀 Congrats! 🚀
You have successfully set up Soroswap on your local machine! Start swapping, pooling, and exploring the possibilities of decentralized finance (DeFi) on the Soroban network.
To execute the tests, you must first start the development container. To do this, run the following command from your host machine:
bash docker/run.sh
Once the development container is running, you can install the dependencies for the tests by running the following command:
## 🧪🔨 Testing 🧪🔨
To execute the tests, you must first start the development container. To do this, run the following command from your host machine:
```bash
bash docker/run.sh
Once the development container is running, you can install the dependencies for the tests by running the following command:
yarn install
Finally, to run the tests, run the following command from within the development container:
yarn test
This will run all of the unit and integration tests for the project.
The tests are written using Vitest & testing-library.
For more information on Vitest, please see the Vitest documentation: https://vitest.dev/.
For more information on Testing Library, please see the Testing Library documentation: https://testing-library.com/docs/react-testing-library/intro/
If you find a bug or have a feature request, please create an issue or submit a pull request. Contributions are always welcome!
License: MIT
Special thanks to the Uniswap team for providing the base protocol on which Soroswap is built.
Thank you to the Stellar Community for the continuous support.
Made with ❤️ by the Soroswap Team.