135 subscribers
join
Rating
Login
Logout

How to use the AUX DEX on Aptos: a tutorial by Pontem

Tutorials

Table of Contents

AUX is a popular DEX/AMM on Aptos for feeless trading, limit orders, and token swapping.. In this tutorial we’ll show you how to use the full potential of AUX with Pontem Wallet.

  1. What is AUX?

AUX is an interesting combination of a classic token swap platform (similar to Uniswap, SushiSwap etc.) and a trading platform that looks similar to centralized exchanges, with limit orders and advanced options  like Fill Or Kill and Immediate Or Cancel. . In other words, AUX features both automated market maker (AMM)  pools and a central limit order book (CLOB).

The dApp even has a router that connects AMM swap pools to the CLOB, ensuring transactions are executed at the best price. The DEX part charges trading fees of up to 0.3% (similar to most AMMs), while the CLOB has no fees at all, even for “takers” -- users who open orders at the current market price.

When talking about AUX, we have to mention its ‘unfathomably based’ ( per the devs) Twitter. Indeed, this could be the funniest and most irreverent DEX Twitter account you’ll ever see, starting from the official tagline ‘Lose your money faster on AUX’.

  1. Install Pontem Wallet

Pontem is the only wallet for Aptos that passed three security audits, by OtterSec, Halborn, and Zellic. It works with all major Aptos dApps and has over 100,000 downloads. Pontem Wallet supports both coins and NFTs and even has a directory of the top Aptos dApps.

Download Pontem Wallet for Aptos as a Chrome extension here. If you don’t have an Aptos wallet yet, click on Create Wallet. Make sure to save the seed phrase in a safe location, as you’ll need it to reinstall the wallet in the future. Create and confirm a password.

If you already have an Aptos wallet, such as Martian or Fewcha, you can import it into Pontem Wallet using the seed phrase.

You’ll need some $APT to start using AUX, Liquidswap, or any other Aptos DEX. There are two ways to get APT in Pontem Wallet:

  1. Buy some $APT on a centralized exchange like Binance or KuCoin and withdraw them to Pontem Wallet.
  2. Bridge USDC, USDT, or WETH using the LayerZero bridge or Portal by Wormhole and swap them for APT on a DEX like Liquidswap or AUX. See the official Pontem bridging tutorial for details.
  1. Connect to AUX with Pontem Wallet

If you’ve used a DEX before, you know the drill: go to the AUX dApp page, click on Connect Wallet, pick your wallet (Pontem in our case), and confirm the connection in the wallet.

Security tip: when connecting to a dApp, read carefully which permissions you’re about to give it. A dApp should be able to request transactions, but never submit them for you (that’s how many scams operate).

Now you’re all set to trade on Aptos mainnet, which is selected by default. If you don’t have any real $APT or you’d like to practice first, you can also switch to testnet or devnet. In this case, don’t forget to switch Pontem Wallet to testnet/devnet, too. You can request testnet $APT by clicking on Faucet in the wallet.

  1. Choose the tokens to swap

AUX supports dozens of tokens, including many assets bridged using Wormhole, LayerZero, and Celer. For a beginner, these can be hard to navigate. For example, if you wish to swap APT for USDC and enter USDC in the search field on AUX, you’ll get quite a few options.

How do you  choose which USDC to swap to? Look at each pool’s reserves. You want to swap into a highly liquid pool to get a good price and avoid slippage. In the Pools tab, search for USDC: you’ll see that the APT-USDC Wormhole pool has by far the highest liquidity at over 405k APT, while the APT-USDC LayerZero pool has only 82 APT.

Interestingly, on Pontem’s Liquidswap the situation is very different: the APT-USDC LayerZero pool had around 200k APT at the time of writing, while the APT-USDC Wormhole pool was much smaller at 20k APT (which is still large enough  for swaps).

  1. Enter the amount and register the tokens

Enter the amount in APT (or another token) that you want to swap (sell) to see how much you’ll receive. If you enter an amount with a decimal point (like 1.5) and it’s not working, make sure that your keyboard is set to English and that you are pressing the key that corresponds to the decimal point on the English keyboard layout.

You can also enter the amount in the destination token that you’d like to receive in the ‘To’ field. In the ‘From’ field, AUX will display the amount in APT that you need to swap.

In this example, we’ll swap 1 APT to get 7.95 USDC. But before you can swap one token or coin for another, both need to be registered in your wallet. Aptos requires tokens to be registered as a fraud prevention measure. It’s the same on AUX, Liquidswap, and all other Aptos DEXes.If one or both aren’t registered yet, AUX will tell you to ‘Register coins to swap’.

In this example, we will swap APT for USDC Wormhole. Here’s the interesting bit: USDC is already on the list of registered assets in Pontem Wallet, so why is the DEX asking us to register it again?

The answer is that they are two different USDCs. Aptos is a new network and doesn’t have a unified naming standard for bridged tokens yet. For example, as of November 2022, USDC bridged with LayerZero is called simply USDC in Pontem Wallet, but zUSDC on AUX. It’s this LayerZero USDC that is already registered in Pontem Wallet. Check out our bridging tutorial to learn more.

Conversely, USDC bridged with Wormhole is simply USDC on AUX but whUSDC on Liquidswap. For now, you just need to be aware of these differences, and hopefully a single naming standard will emerge soon.

Click on Register Coins to Swap, then on Register USDC, and confirm the operation in Pontem Wallet. It will cost you 0.002 APT in gas fees (less than $0.02).

  1. Swap!

Once the tokens are registered, the button in the Swap window will change to Submit Swap. Click on it and confirm in the wallet. The gas fee is 0.002 APT in this example, but it can be higher depending on the pair you’re swapping and the network load.

You’ll see a notification that the swap was successful, and token balances in Pontem Wallet will be updated. Note that what is just USDC on AUX displayed as whUSDC (Wormhole USDC) in the wallet.

  1. How to add liquidity to pools on the AUX Aptos DEX

You can become a liquidity provider on AUX to earn a passive income from trading fees. All the fees generated by each pool are distributed between the wallets that provided liquidity for that pool. How much you’ll receive will depend on your share of the pools and on the trading volume.

Now that we have some Wormhole USDC, we’ll add liquidity to the APT-USDC pool. Note that you always need to add an equivalent amount of both tokens: for example, 1 APT and 1 APT’s worth of USDC, or 5 APT and 5 APT’s worth of USDC, and so on. So once you pick a pool, make sure that you have enough of both and swap some if needed.

In the Pools tab, we’ll search for USDC and choose the Aptos Coin / USD Coin (Wormhole) pool, noting that the trading fee is 0.10%.

If you’ve never been a DeFi liquidity provider (LP) before, it’s important to evaluate how much you can earn and choose a pool that can generate a decent APY. For example, if the pool generates a trading volume of $1,000,000 in a month, and the fee is 0.10% per transaction, the total fee income for all LPs will be 0.10% of that, or $1000. If your share is 1% of the pool, you’ll receive $10 - but 1% of this huge pool is equivalent to over 4,000 APT and 30,000 USDC. But if you only deposit 1 APT and 1 APT’s worth of USDC, the income from fees will be negligible.

A good alternative is to pick pools that have lower reserves but generate a good volume. Often, these are the pools of new projects that get listed after an IDO. Another option is to look for DEXes and pools that offer additional yield farming rewards for liquidity providers. For example, Pontem’s Liquidswap is launching its first batch of incentivized pools very soon.

As you click on the pool, you’ll be taken to the page with a list of all its recent transactions: swaps, liquidity deposits and removals. Click on Add.

Let’s add all the USDC we have. As we enter 7.94 in the USDC field, the APT field will display the corresponding amount in APT that needs to be added - in this case, 1 with a long decimal number after the point.

Now click on Add Liquidity and confirm the operation in Pontem Wallet. The gas fee is 0.003802 APT in this case, or around $0.03.

As the transaction is confirmed, LP tokens will appear in your Pontem Wallet. Depending on the DEX, LPs can be displayed as APT/USD, APT-USD, AOT-USD LP, etc.

That’s it - now you are officially a liquidity provider on AUX. To collect the rewards, you’ll need to withdraw (redeem) the liquidity, burning the LP tokens in the process. We’ll show you how to do it in the next section of the tutorial.

  1. How to withdraw liquidity from AUX on Aptos

To redeem your liquidity, locate the pool on the list in the Pools tab, then click on Remove.

In the popup that appears, drag the slider to set the amount you want to remove. We’ll set it to Max to withdraw all our funds.

Note that the amount in USDC isn’t exactly the same as what we originally deposited. The most common reason is that, as people execute swaps, the ratios of the two tokens in the pool change as their relative prices change.

By the way, this is the source of the infamous impermanent loss, a phenomenon unique to DeFi DEXes. Sometimes it can turn out that you’d have made a better profit just by holding the tokens instead of depositing them in a liquidity pool. See the Pontem Wallet & Liquidswap Q&A for more on impermanent loss.

Click on Remove Liquidity and confirm the transaction. Note that the gas fee is just 0.002 APT ($0.02): on Ethereum you’d pay at least $5.

Click on Confirm, wait for the success notification, then check Pontem Wallet: APT and USDC will have reappeared, while the LP tokens will have disappeared, except for some ‘dust’ (a tiny amount).

  1. How to create a liquidity pool on AUX

When you create a new pool, you become its first liquidity provider. The amount of liquidity for both tokens that you submit (X and Y) will determine the pool’s liquidity curve, as X*Y will always remain the same (k).

If you decide to create a small pool as an experiment, be aware of the following:

  • When reserves are low, every swap can seriously change the token ratios in the pool. If you decide to withdraw the liquidity, the result can be very different from what you deposited.
  • If nobody trades into the pool, you won’t earn anything from trading fees, even though you are the only LP.
  • Remember that your pool is public. If it has tiny reserves and users mistakenly swap into it, they can get a very unfavorable price and lose money.

Let’s see what happens if we try to create a new pool with two tokens for which a pool already exists, such as APT and USDC. Click on Create Pool in the Pools tab and choose APT and USDC.

As you enter an amount in APT, the amount in USDC will be automatically displayed, matching the current market price (7.98 USDC).

Click on Create Pool and confirm in Pontem Wallet. Ouch - a ‘Pool already exists’ error! That’s because you can’t create a pool with the same two tokens for which a pool already exists.

Now let’s try to create a pool that doesn’t exist in AUX yet. We’ll use MOJO (Mojito Markets) and USDC LayerZero. Why these two? Because this pool isn’t on the list yet.

We’ll enter the amounts that we want to deposit. They aren’t random, by the way: 3.95 USDT is worth 184 MOJO on Liquidswap at the time of writing. You can also adjust the fee (for example, set it at 0.30%).

Click on Create Pool and confirm in Pontem Wallet.

In this example, we got a success notification and the pool appeared on the list, but with zero liquidity. The tokens were still in the wallet.

It’s not a big problem, though, as we can now add liquidity to this pool.

Success! MOJO and USDC are gone from Pontem Wallet, replaced by MOJ/USD LP tokens. The pool’s displayed liquidity on AUX isn’t zero anymore, either - though admittedly tiny.

That’s it! Now, if anyone performs a swap between MOJO and USDC LayerZero, the pool’s creator (that is, the author of this article) will receive a trading fee reward (0.10% of the trade). Of course, other liquidity providers can join the pool, too, and share in the rewards.

  1. How to trade with AUX CLOB

The CLOB section is the most complex and interesting part of AUX. If you have experience trading on exchanges like Binance or KuCoin, the interface should feel familiar, starting from price charts and the ability to open a limit order at the desired buy or sell price.

What’s the difference between swaps and limit orders?

When you swap tokens, you accept the current price. This price is calculated based on the liquidity curve x*y=k, where x and y are the amounts of each of the two tokens in a pool and k is a constant.

The liquidity curve formula replaces an orderbook and a market maker, making sure that swaps can always be executed, whatever the level of liquidity in the pool -- though the price can turn out to be very unfavorable. That’s why DEXes like Liquidswap or Uniswap are called automated market makers, or AMMs.

But what if you’re not happy with the current price and you’d like to buy a token cheaper? On a centralized exchange like Binance, you can open a limit order at your desired price and just leave it there. When (or if) the price hits your target, the order will be filled.

For this to work, exchanges match buyers to  sellers in the orderbook. This system is known as CLOB, or central limit order book. DeFi also has its CLOBs, which combine some centralization (the maintenance of the order book) with on-chain features (users have custody of their assets the whole time). AUX’s trading platform is one such CLOB.

Opening an account

Like on a CEX, you’ll need to open an account and deposit some coins in it. Click on Create AUX Account on the page and then in the popup, and confirm in Pontem Wallet. The gas fee is around 0.0035 APT.

The dApp will now prompt you to deposit some crypto in the account. However, before we do it, let’s see what the market and liquidity conditions look like.

Choose what to to trade and deposit tokens in the account

The list of tokens you can deposit in an AUX trading account is really long: it even includes NEAR and SUSHI bridged with Wormhole.

However, the range of pairs that you can actually trade is much more limited. At the time of writing, there were just 8, including APT/USDC, SOL/USDC, APT/tAPT (Tortuga Finance liquid staking token), and others.

However, just because a currency pair is listed doesn’t mean that it’s being actively traded. For example, picking tAPT/APT from the list, we get this:

With 0 trading volume and a very disbalanced order book (a huge buy order at the price of 0.0001 and tiny sell orders at 50, 100, and 99,999), this is not a pair you want to trade on AUX.

APT/USDC is a different story: the order book is small compared to CEX exchanges but healthy, and there is some volume (44 APT in 24 hours). You can at least expect an order to be filled at some point.

Looking at the order book, it seems like most users hope to buy APT between $4 and $3.3 or sell between $16 and $18. As we have some USDC in the wallet after our experiment with swaps, let’s deposit those USDC in the trading account and set a limit buy order for APT.

In the Balances tab, click on Deposit from Wallet. Choose USDC from the list and enter the amount (7.90 USDC in this case). Click on Submit Deposit and confirm the transaction and the gas fee in Pontem Wallet.

Refresh the trading page - you should see the USDC in the account balance.

Placing a limit order

Enter the desired buy price in the Price field (e.g. 4 USDC) and the amount of APT you want to buy. We have 7.90 USDC, but what will happen if we set a buy amount that’s too large, like 2 APT (=8 USDC)? Let’s try this. Click on Submit Trade and…

…Oops! Pontem Wallet warns that there are insufficient funds. Let’s try again with a buy amount that’s less than 7.90 USDC (note that the amount in USDC is displayed in the Total line).

There is a gas fee (0.0057 APT in this case), but the CLOB itself doesn’t charge any trading fees. Once you confirm, the order will appear in the Open Orders tab. It will also appear in the order book.

Checking Pontem Wallet, we see that USDC is gone. The tokens are locked in the CLOB smart contract, though we still have control over them. This is a big difference between decentralized CLOBs and CEXes like Binance, where you have to transfer crypto to an exchange wallet. A CEX holds the private keys to the wallet and thus fully controls the crypto in it. Not your keys, not your coins.

Advanced trading features on AUX

We’ve placed a simple limit order, and a passive one at that. A passive order is set at a price that is different from the current price: you passively wait for the price to come to you. You also act as a market maker, providing liquidity to the market (not to be confused with liquidity providers in swap pools).

By contrast, an aggressive order is set at the current price: use it when you want to buy or sell immediately. You accept the risk that the price might move against you while the order is being filled. Traders who place aggressive orders act as takers, because they take liquidity from the market.

Understanding the difference between passive and aggressive orders should help you to figure out AUX’s advanced features.You can turn them on using a corresponding slider:

Immediate or cancel: if part of the order can be filled immediately, it is, and the rest is canceled. Use this when there are sellers at your desired price (which wasn’t the case in this example, as there are no sellers at the price of 4 USDC in the order book).

Fill or Kill: the order is either filled fully at once or canceled. Otherwise limit orders can take time to fill fully, sometimes days.

Passive Join: set the order at the best available bid or ask price, effectively joining your passive order to others.

Post: make sure that the order is passive. If the price immediately moves against you, it won’t be filled at a worse price as a market (aggressive) order would. Use this when your target price is close to the current price.

Closing an order

Closing (canceling) a limit order on AUX is very easy. Click on the small x icon to the right of the order data in the Open Orders tab.

Confirm in Pontem Wallet. Note that there’s a gas fee for closing an order, just like for opening one. This is a disadvantage of all decentralized CLOBs compared to centralized exchanges, where you pay a fee only when an order is filled. This is a gas fee powering the blockchain, not a trading fee.

Refresh the page. The order should disappear from Open Orders, but you’ll still see it in Order History.

Withdrawing funds from a trading account

To have the tokens back in Pontem Wallet, open the Balances tab on the trading page and click on Withdraw. Choose a token and enter the amount you’d like to withdraw: in this example, 7.90 USDC.

Click on Submit Withdrawal and confirm the operation in Pontem Wallet. This transaction carries a minimal gas fee of 0.002 APT. The tokens will return to your wallet balance.

  1. View your Portfolio on AUX

AUX has a very handy Portfolio section, where you can view all the assets in your Pontem Wallet and AUX trading account and even your stakes in liquidity pools. There are also separate tabs for open and completed trading orders (meaning CLOB orders, not swaps).

Use the Open Orders tab to view your active CLOB orders and Order History to see open, filled, and canceled orders.

  1. Using AUX on devnet

If you’re not ready to commit real funds to trading on Aptos, you can practice on devnet. Switch Pontem Wallet to devnet using the dropdown menu at the top, then click on Faucet to get some free devnet APT. These tokens have absolutely no market value.

Now go to https://devnet.aux.exchange/ and connect Pontem Wallet. You can do all the same things on devnet as on mainnet: swap, add liquidity to pools, create new pools, place limit orders, etc. Don’t be surprised at the huge difference between mainnet and devnet prices. Remember, this is all pretend money.

  1. AUX for builders

If you are into trading bots and coding, you should explore AUX’s GitHub. Among the things you’ll find:

Conclusion

There are already quite a few AMMs and CLOBs on Aptos, including Liquidswap by Pontem, AUX, Aries Markets, Tsunami, OmniBTC, Animeswap, Hippo, and even PancakeSwap. It’s still a wild time of experimentation, so the best approach is to try and compare several DEXes, since their liquidity reserves for the same pair can be very different. Also, keep track of yield farming opportunities as they start to pop up, such as those coming to Liquidswap soon.

About Pontem

Pontem Network is a product studio building for Aptos and the wider Move ecosystem. We work in close collaboration with the Aptos Foundation to deliver secure audited dApps, such as Pontem Wallet and the Liquidswap DEX. We also offer groundbreaking tools for coders, including ByteBabel (the first EVM implementation for Aptos) and Move Code Playground, the first browser code editor for Move. Join us on Twitter, Discord, and Telegram to learn more.

Install our wallet and try DEX

Related posts

how-to-use-the-aux-dex-on-aptos-a-tutorial-by-pontem
636a6277c6197a0e7aff835a
amb-how-to-use-the-aux-dex-on-aptos-a-tutorial-by-pontem