Skip to content

Instantly share code, notes, and snippets.

@kksudo
Created March 28, 2025 14:57
Show Gist options
  • Save kksudo/1968fc1d298abf86908dd4c50d56b2be to your computer and use it in GitHub Desktop.
Save kksudo/1968fc1d298abf86908dd4c50d56b2be to your computer and use it in GitHub Desktop.

Task: Developing a Backend for a Mini-DEX on TON Blockchain

Description:

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.

GitHub Flow Process:

  1. Create a new branch for each subtask from the main branch
  2. Work on the subtask in its dedicated branch
  3. Create a pull request when the subtask is complete
  4. Have the pull request reviewed by a team member (in this case, your self)
  5. Merge the approved pull request into the main branch

Requirements:

  1. Technologies:

    • Python 3.9+
    • FastAPI
    • TON SDK (pytonlib or ton-py)
    • PostgreSQL
    • Redis (for caching)
  2. 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
  3. Additional:

    • Write unit tests for key functions
    • Add API documentation (using Swagger)
    • Implement a simple logging system

If you think, the task is too big

  • 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment