Inter-canister calls are not atomic on the Internet Computer, to avoid the atomicity problem, we employed a tight coupling architecture design for DSwap, the AMM functions are implemented in a single canister. Check out our medium article for details.
In order to swap your tokens or provide liquidity, you need to deposit the tokens into DSwap first, we provide a Swap Wallet interface for you to manage your assets in DSwap:
Deposit: deposit tokens into DSwap.
Send: internal transfer, transfer your tokens to others inside DSwap, without needing to withdraw first.
Withdraw: withdraw your tokens, the tokens are sent to your DFinance wallet by default.
DSwap wallet interface
Each swap is charged 0.3% trading fee, there is a dev fee switch in DSwap, it is on during the testnet period, so liquidity providers earn 0.25% trading fees, 0.05% of the trading fee goes to the developer address.
If your token is not yet listed on DSwap(not in the Asset tab), you can click Add Token button to list your token on DSwap:
Note: the total number of tokens can be listed on DSwap is limited to 100 in testnet period.
Add token to DSwap
Then, choose another token and create a pair for your token:
Create new pair
Finally, add some liquidity for your pair and people can trade your token now!
Add liquidity for your pair
In the menu, click Deposit
Select the token you want to deposit
Enter the amount you want to deposit and then click Approve
Click Deposit and wait for it to complete
Select the token you want to withdraw and enter the amount
Click Withdraw and wait for it to complete
Click the Exchange tab
2. Choose the token you want to swap, for example, DFCT to WICPT
Swap 10 DFCT to WICPT
3. Set the slippage tolerance(default 0.5%), then click Swap to complete the swap
Set slippage tolerance
Go to the Liquidity tab, choose the pair you want to provide liquidity
Enter the amount, then click Add Liquidity and wait for it to complete
Note: if the token pair you choose does not exist, the button would show "Create New Pair", click it and the new pair will be created.
Create a new pair
Alternatively, you can add liquidity from the Liquidity tab.
To remove your liquidity, go to the Liquidity tab and click Redeem:
Enter the amount of liquidity provider tokens you want to redeem and click Remove.