Skip to content

SVOIcom/tonswap-SC

Repository files navigation

Introduction

photo_2020-12-15_20-21-41 Hello there!
SVOI dev team greets you and would like to present the results of created Decentralized Exchange for the FreeTON Community contest:
#23 FreeTon DEX Implementation Stage 2 Contest.

Goal of this work is to create Decentralized Exchange based on Liquidity Pool mechanism and develop instruments, such as debot and site for interacting with developed smart contracts.

Links

Channel on Telegram

Repository for smart contracts compilation and deployment - https://github.com/SVOIcom/ton-testing-suite

Used ton-solidity compiler - solidity compiler v0.39.0

Used tvm-linker - latest tvm linker

tonswap-SC

This repository contains smart contracts that are used for Decentralized Exchange based on Liquidity Pairs

Smart contracts description

Swap pair contracts

There are two main contracts related to swap pair - RootSwapPairContract and SwapPairContract.
RootSwapPairContract is used to deploy swap pair contract, update it and store information about already deployed swap pairs to prevent dublication of swap pairs.
SwapPairContract is used to implement liquidity pool swap mechanics and to provide access to it for users.

Below is short description of iterfaces and smart contracts.

Interfaces

These interfaces may be used to implement smart contracts that interact with swap pair or swap pair root contract

Contains main functionality of RootSwapPairContract - deployment of swap pair

Contains functions for swap pair contract upgrade

Contains structure with service information

Contains main functionality of SwapPairContract

Contains debug functions of SwapPairContract which could be implemented if debug version is required

Contains information structures used in SwapPairContract

Contains function to upgrade swap pair code

Contracts

This is RootSwapPairContract. It is used to deploy swap pairs and keep track of unique swap pairs.

Contract implementing liquidity pair mechanism

Tokens

Used tokens are TIP-3 tokens initially developed by Broxus for bridges between Ethereum and TON.
We decided that it will be great not to create a ton of new TIP-3 token types and used already existing and working solution.

Interfaces

Interfaces can be found at contracts/TIP-3/interfaces/

Contracts

Contracts can be found at contracts/TIP-3/

Some additional contracts that can help you to deploy your own swap pair or tokens

Contract compilation and deployment

There are compiled contracts at release page. You can use them for quick start.
If you want to compile smart contracts - please check repository https://github.com/SVOIcom/ton-testing-suite
There you will find instructions and instruments for smart contract compilation and testing/deploying test swap pair and debot contracts.

Pre-deployed smart contracts for tests

Deployed root swap pair contract: 0:3dc2f941650dbb757e47363109841a943c04a4824a6652b8be7377b945603137 Deployed test swap pair contract: 0:12987e0102acf7ebfe916da94a1308540b9894b3b99f8d5c7043a39725c08bdf

If you have any questions - feel free to ask our team in Telegram.