-
Notifications
You must be signed in to change notification settings - Fork 516
3. DeX
Bette edited this page Apr 30, 2020
·
8 revisions
The Acala DeX protocol is inspired by Uniswap, but built as a runtime module as part of the Acala Substrate chain to serve the aUSD community. Each liquidity pool contains a balance of two tokens, and the exchange rate is simply the amount of one token divides that of the other. Users enjoys instant token swap without the need for an order book, whereas liquidity provider could supply liquidity of the two tokens in a pool to earn a fee.
Refer to Deposit & Earn for liquidity provider returns.
- Check Exchange Rate
- Swap Tokens
Use Chain state
-> dex
-> liquidityPool
to check the amount of aUSD and the amount of selected token in the pool
Convert the hex value to number.
- number of DOT tokens
0x00000000000000003d055121747a4273
as4397009815327097459
- number of aUSD tokens
0x000000000000003babfb8f48dfeed58e
as1100750556691660985742
- exchange rate (DOT to aUSD) = number of aUSD tokens / number of DOT tokens = 250
Use Extrinsics
-> dex
-> swapCurrency
to swap tokens.
-
Supply
is the token you pay -
Target
is the token you want to buy, target price also covers for slippage