Develop the backend part for a simple decentralized exchange (DEX) on the TON blockchain. Your task is to create an API for interacting with the DEX smart contract and implement basic token exchange logic.
As you'll be working in an Agile environment with a team of developers, we'll use GitHub flow for our branching strategy. You'll need to split this task into smaller, manageable pieces and update the main branch accordingly.
- Create a new branch for each subtask from the main branch
- Work on the subtask in its dedicated branch
- Create a pull request when the subtask is complete
- Have the pull request reviewed by a team member (in this case, your self)
- Merge the approved pull request into the main branch
-
Technologies:
- Python 3.9+
- FastAPI
- TON SDK (pytonlib or ton-py)
- PostgreSQL
- Redis (for caching)
-
Functionality:
- Implement an API endpoint for getting the current token exchange rate
- Create an endpoint for executing SWAP operations
- Implement asynchronous transaction processing
- Add basic user authentication
- Implement caching of rate data in Redis
-
Additional:
- Write unit tests for key functions
- Add API documentation (using Swagger)
- Implement a simple logging system
- Focusing on core functionality: Implement only the rate retrieval and SWAP operation endpoints, leaving out additional features like user authentication.
- Simplifying the tech stack: You can use a simpler database like SQLite instead of PostgreSQL, and skip Redis caching initially if it's overhead from your point of view.
- Reducing the scope of TON integration: Mock the blockchain interactions instead of setting up a real connection to the TON test network.
- Minimizing testing requirements: Focus on manual testing and implement only a few key unit tests.
- Simplifying documentation: Provide basic API documentation without using Swagger.