$ git clone https://github.com/Thorn-Protocol/thorn-protocol-contract.git
$ cd thorn-protocol-contract
$ npm install --save-dev --force
- Copy and update from .env_example_bsc_testnet for bsc testnet network
- Copy and update from .env_example_oasis_sapphire_mainnet for sapphire oasis network
Thorn is an exchange liquidity pool on Sapphire designed for extremely efficient stablecoin trading and low risk, supplemental fee income for liquidity providers, without an opportunity cost.
Thorn allows user to trade between correlated cryptocurrencies with a low slippage, low fee algorithm and ensures privacy through Sapphire's confidential state features.
There are 5 main contract types:
- StableSwapFactory: Creates new pools and provides contract infomation.
- Pool contracts: Pairs stablecoins, allowing users to add or remove liquidity, and exchange tokens.
- StableSwapLPFactory: Generates LP tokens rewarded to liquidity providers
- StableSwapRouter: Facilitates cryptocurrency exchanges across mutiple pools.
- Info contracts: Supplies information about pools
Compile contract before deploying:
npx hardhat compile
Deploy contracts in the order:
npx hardhat deploy --network <your-network>
- New pools are creating through 'create' functions in SwapFactory contrac,by only the contract owner
- Once created, the pools information is retrieved using 'get info' functions in SwapFactory
The test suite common tests for pools, as well as router tests.
To run tests :
npx hardhat test tests/<test file name>