Algofi’s New Feature: NanoSwap
Learn what NanoSwap is and how to use it
Welcome back to the Club, gov!
This past Friday, Algofi launched their new feature NanoSwap, an AMM optimized for stablecoins, to solve a major pain point for the Algorand DeFi ecosystem: the lack of a constant 1:1 exchange rate between stablecoins and the unnecessary amounts of slippage that occur when swapping them. NanoSwap solves this by using Curve’s stableswap invariant AMM formula which is designed to minimize that slippage between stablecoins.
Gov Tip: If you’re unfamiliar with Curve, check out this explainer from Binance Academy. And if dense math is your thing, check out this stableswap Invariant explainer to learn more about how it all works.
NanoSwap achieves a roughly 1:1 exchange rate between stablecoins by automatically rebalancing the pool based on the amount of liquidity in it which leads to a pool ratio that is different from the exchange ratio. For example, if you have roughly an equal amount of STBL & USDC, you will not be providing them to the LP in a 1:1 ratio. You may provide them in a 0.83 ratio – meaning for every STBL you provide to the pool you would only need to provide 0.83 USDC to match.
Okay, enough math. Let’s run through a couple more quick notes about NanoSwap before we get started:
The Algofi team discussed a bug in how Zap interacts with NanoSwap, so they have disconnected the two features from each other until they can deploy a fix.
To ensure there is enough liquidity for NanoSwap, Algofi will be sunsetting their STBL-USDC liquidity pool from their DEX. Don’t worry, gov. We’ll show you have to migrate your liquidity over.
How to Migrate DEX Liquidity to NanoSwap
If you didn’t provide liquidity to the STBL-USDC pool, you can skip to the ‘How to Determine Stablecoin Ratio’ section below.
Step 1: Unstake Liquidity Pool Tokens (LPTs) from Farm
Navigate to the ‘Farm’ page and expand the STBL-USDC pool.
Select the ‘Unstake’ button above the ‘Amount’ bar, and then click ‘Max’ to automatically enter your total Liquidity Pool tokens (LPT) amount. When you’re ready, select the ‘Unstake’ button next to ‘Max’ button, and confirm your transaction with your wallet:
Step 2: Burn your LPTs
Click over to the ‘Pool’ homepage next and select ‘Remove’ (instead of ‘Add’). Make use of the ‘Max’ button to input the total amount of LPTs you hold, and then select ‘Remove’ when you’re ready.
Confirm the details on the next screen and then select ‘Send Burn Transaction’ and confirm the transaction with your wallet:
You should have a roughly even split of STBL and USDC when this process is done.
Now let’s put those stablecoins to use again.
How to Determine Stablecoin Ratio
As mentioned earlier, the exchange rate between STBL and USDC (roughly 1:1) will be different than the pool ratio which varies depending on the amount of liquidity in the pool.
Due to this, we will need to do some initial investigation to determine how much STBL vs. USDC we need to provide liquidity using our total capital. We can determine this by using the ‘Pool’ tab within the NanoSwap feature.
Let’s say you have a stablecoin balance of 200 (100 STBL & 100 USDC) to provide to the NanoSwap LP at a pool ratio of 0.72. If you input 100 STBL into the ‘Pool’ tab, the protocol will determine you need ~72 USDC to maintain the current pool ratio (1 STBL = ~0.72 USDC). By confirming this transaction, you will effectively leave 28 USDC on the sidelines:
As you can see from the above, you would actually need about 116 STBL and 84 USDC to provide your total amount to the pool. To do this, we can exchange 16 USDC for 16 STBL using the ‘Swap’ tab within NanoSwap.
Gov Tip: Once the ‘Zap’ feature is integrated with NanoSwap again, we can skip this entire step and just zap right into the LP.
How to (Nano)Swap
Using NanoSwap’s swapper is fairly straightforward as it more or less mimics the main DEX. You can use the asset icons to select which assets you’d like to swap. For our example, we’ve set up a swap to convert 16 USDC to roughly 16 STBL:
Once you’re ready to make a swap, click Swap’ and confirm the transaction with your wallet:
Now let’s provide liquidity to the new STBL-USDC pool.
How to Provide Liquidity to a NanoSwap Pool
Once your swap is complete, select ‘Pool’ within NanoSwap. Provide both STBL and USDC and then select ‘Supply’ when you’re ready to proceed:
Select ‘Send Pool Transaction’ and confirm the transaction with your wallet to receive your LP tokens.
Once you receive your tokens, you can navigate over to the ‘Farm’ section again and opt-in to the new STBL-USDC pool. You’ll know you’ve selected the right pool if you see the ‘NanoSwap’ pink icon in the upper left:
Once you’ve opted-in, make use of the ‘Max’ button to input your total amount of LPTs, and then select ‘Stake’. Finalize the transaction by signing it with your wallet.
And now you’re a NanoSwap pro.
Subscribe to upgrade your Algorand DeFi game
Until next time, gov.
Disclaimer: This isn’t financial advice! As we say in crypto, don’t trust – VERIFY! Do your own research and don’t ever invest more than you’re willing to lose. Like any DeFi project, Algofi comes with risks. The project can fail, smart contracts can be hacked, assets could be compromised, users can be liquidated, oracles may provide inaccurate information, etc. You can learn more about the risks associated with using Algofi here.
Be safe out there and make sure you do enough research before you decide if Algofi is right for you.