In December, trading volume on decentralized exchanges (Decentralized Exchanges, DEX) surpassed $127 billion. The Total Value Locked (TVL) at the largest of them — Uniswap and PancakeSwap — amounted to $6.18 billion and $4.1 billion respectively.
We feature BotSwap, an app that helps optimize activity on these trading platforms.
BotSwap in Brief
The app is developed by the British blockchain startup Fetch.ai — the creator of the eponymous platform with the ERC-20 token FET.
In February 2019, Fetch.ai raised $6 million in 22 seconds via an IEO on Binance Launchpad. In March 2021 the company launched the derivatives DEX Mettalex, and three months later — the first version of BotSwap.
BotSwap automatically withdraws liquidity from Uniswap V2 or PancakeSwap V2 pools when the asset price reaches a certain level. This helps cap impermanent loss — the difference in the value of assets held in a wallet and in the liquidity pool.
Additionally, BotSwap users can create limit orders for trading pairs: the app will swap tokens when the price hits the set level.
Agents and Triggers
Users create DeFi agents — subaccounts that perform actions on the exchange. They trigger when certain conditions are met — triggers.
BotSwap allows creating up to five agents. Each can have only one trigger connected to it.
The cost of operating one agent is 30 FET per month ($10 at the time of publication). BotSwap users receive 5 bonus tokens, which can be spent on these goals.
As of publication, BotSwap offers two triggers:
- Withdraw Liquidity — withdraws liquidity from the pool when the token price falls below the level set by the user;
- Swap Token — swaps tokens when the price reaches the level set by the user.
To use BotSwap you will need:
- MetaMask wallet;
- FET tokens;
- LP tokens on PancakeSwap or Uniswap;
- Binance Coin (BNB) or Ethereum (ETH).
We tested the app on Binance Smart Chain: created an agent and two triggers — for liquidity withdrawal from the pool and token swaps on PancakeSwap.
Creating a DeFi Agent
To add an agent, go to the BotSwap app and connect MetaMask. Then open the Dashboard menu and click Add Agent. This can also be done in the Agents tab.
Click the Create button in the window that opens. Leave the default values in the fields: the network can be changed later when configuring the agent.
The DeFi agent appeared in the Agents tab.
The app automatically generated the DeFi agent identifier — zero-knowledge-performer. It can be changed by clicking the agent’s name.
Withdrawing Liquidity
Created a trigger to withdraw liquidity from the anyMTLX/BUSD pool on PancakeSwap. To do this, went to the Triggers tab and clicked New Trigger.
Selected Withdraw Liquidity in the opened window and clicked Next.
We did not change the network and linked the trigger to the agent zero-knowledge-performer. Again clicked Next.
Specified the pool address for anyMTLX/BUSD on PancakeSwap.
The app automatically identified 7 LP tokens — our share in the anyMTLX/BUSD pool.
Set the price at which the agent will withdraw liquidity — 1.40 anyMTLX/BUSD.
For paying the operation, we chose the slow fee of 10 Gwei. In this window you can set a higher fee or specify another value in the Custom field.
After setting parameters, clicked Next.
Confirmed the setup in MetaMask:
- granted BotSwapDFA smart-contract access to wallet funds;
- registered the agent in the contract;
- sent 0.005 BNB to the agent to execute the liquidity swap.
After clicking Next, the trigger appeared in the Triggers tab.
BotSwap does not allow editing triggers. To change the parameters, you must delete and create a new trigger.
Exchanging Tokens
Most recently, tested the trigger for exchanging WBNB and BUSD tokens.
For this, created a new agent — innovative-crypto-bot — following the instructions above. Then went to the Triggers tab, selected Swap Token Trigger, and clicked Next.
Linked the trigger to the agent innovative-crypto-bot for the trigger. Left the value BSC Mainnet in the Network field and clicked Next.
Selected the token BNB and the stablecoin BUSD as assets to swap. In the Amount field, entered 0.02 BNB and clicked Next.
Set the trigger — the price at which the agent will swap 0.02 BNB for BUSD. Chose the fee for the swap transaction and pressed Next.
When creating the trigger, BotSwap automatically wrapped BNB into Wrapped BNB (WBNB). The app then asked to confirm trigger installation in MetaMask. We approved:
- smart contract BotSwapDFA access to wallet funds;
- agent registration in the contract;
- sending 0.005 BNB to the agent to execute the token swap.
After this, the Swap trigger appeared in the Triggers tab.
An instruction for working with BotSwap on Ethereum is available on Fetch.ai’s YouTube channel.
Future of the Project
In the near term, the Fetch.ai team will add support for DeFi protocols SushiSwap and 1inch, as well as new triggers:
- APY monitor — withdraw liquidity if yield falls below the percentage set by the user;
- Best Pool — move liquidity to the pool with higher yield;
- ETH Fees — withdraw liquidity if Ethereum network fees rise too quickly over a period;
- Stop-loss (Uniswap v3) — move liquidity to a new active range if the current range no longer earns fees;
- Portfolio management (Uniswap V3) — portfolio rebalancing;
- ETH fund management V1 — automatic replenishment to one or more Ethereum addresses;
- ETH fund management V2 — swapping ERC20 tokens for Ether if their price falls below a certain level.
Additionally, Fetch.ai developers are considering integrating BotSwap with the DeFi asset management platform Zapper.
Conclusion
BotSwap — a minimalist app that simplifies working with popular decentralized exchanges Uniswap and PancakeSwap. Its users automatically swap tokens and withdraw liquidity from pools.
The only drawback of BotSwap is its modest set of triggers. However, Fetch.ai launched it just four months ago and is already working on expanding its functionality.
Read ForkLog’s bitcoin news in our Telegram — cryptocurrency news, rates and analytics.
