AfraSwap: The New Age Decentralized Cryptocurrency Exchange

Aryacoin
10 min readNov 2, 2021

--

Introduction

Afraswap is the new age decentralized cryptocurrency exchange created by the Aryacoin Team to enable and offer users the decentralized and the most secure exchange experience throughout multiple blockchains. Initially AfraSwap will be deployed on Binance Smart Chain due to the low fees and high scalability of the platform , in future we would scale Afraswap to multiple blockchains.Afraswap uses the Automated Market Maker (AMM) technology used by various leading exchanges to provide the complete decentralized experience. Along with AMM, AfraSwap aggregates prices from all the leading Swaps to provide the user with the best exchange rates possible, this also allows users to just use AfraSwap rather than using multiple different Swaps to find the best exchange rates. AfraSwap handles all the approvals and transfers without excessive gas costs, this allows users to securely exchange without the risk and time involved in enabling multiple different exchanges.

Afraswap’s native token will be called AFRA, which will allow users to participate in the project. A small amount of Afra tokens will be premined but that would be solely used for the purposes of Airdrops during promotions and setting up liquidity pools. Users can also receive Afra by staking their Afra , Aryacoin or Afra liquidity tokens in farms and pools to recieve Afra as reward.

Afraswap also allows users to gain BNB through playing completely on chain games like BNB price predictions and lotteries.

This document will go over the following aspects of Afraswap:

  1. AMM Swaps
  2. Aggregation Protocol
  3. Afra Tokens
  4. Farms and Pools
  5. Governance and Security using Voting , Gnosis Safe , Timelock and no migration
  6. Lottery and Prediction games

1) AMM Swaps :

Afraswap’s AMM works like other standard AMM swaps , harnessing the power of liquidity to make the markets. AMM works in a simple yet effective way by using liquidity pools to determine the price of an asset, this allows a completely decentralized way to trade without the risk of price and liquidity manipulation. Thus allowing the user to be sure of what they are buying and how.

In the core of AMM is liquidity pools and at its core, a liquidity pool is a shared pot of tokens , users can add their tokens into liquidity pools in pairs and receive Afra-LP in return, the tokens they add are then used to maintain the market and allow other users to trade on the platform. The liquidity pools receive a flat fee of 0.3% (or 0.25% if the platform fee is enabled) on each trade that happens through the liquidity pool, the total fee is shared among the providers based on their share of liquidity they provide, this allows for the liquidity providers to receive gains over time by making the market,

Other than the fees the liquidity providers can stake their Afra-LP token into AfraSwap Farms which incentivises users to provide liquidity to the market. The liquidity providers can lock their Afra-LP (Liquidity) in these farms and earn Afra tokens in return. (Explained in the Farms and Pools section)

The simple mathematical formula used by AMM is:

tokenA_balance(p) * tokenB_balance(p) = k

and popularized by Uniswap as:

x * y = k

The constant, represented by “k” means there is a constant balance of assets that determines the price of tokens in a liquidity pool.

This fine balance allows Liquidity providers and investors to earn returns over their holdings while providing the trades and users an opportunity to trade their cryptocurrencies securely. This process also allows the price to remain stable and provides little to no opportunity for any malicious actor to exploit and profit from the process.

2) Aggregation Protocol :

As most swaps work through AMM , and operate their own liquidity pools there is always a high chance that there would be a price difference between prices on each swap. Usually these price differences are minor and usually overlooked but overtime these can create losses for active traders and investors.

Along with this each swap requires approval to spend the user’s tokens , this is achieved by the ERC20/BEP20 Approve function , which allows another blockchain address to spend the tokens, which in most cases is the Swap Router. As there are many leading swaps with each of them requiring their own Approvals , this creates an issue for traders as most of these swaps do not allow easy processes to remove these approvals. This also creates an opportunity for any malicious actor to use attacks like phishing to gain an approval from an unsuspecting user, which could allow the attacker to steal all the funds from the user’s wallet.

To overcome the mentioned challenges AfraSwap created an onchain aggregation protocol which allows trades through multiple AMM’s using a single Afraswap interface and without the need for multiple approvals or transactions.

AMM aggregation allows a single router to route the exchanges through multiple different swaps and exchanges following similar structure and protocols. This allows users to interact with just one smart contract and do trades through multiple smart contracts and exchanges. This also allows the user an advantage over using standard approach as the process allows users to get the best price possible for their trades.

The Aggregation protocol works as follows:

  1. When the user inputs the from currency , to currency and amount , the aggregation protocol finds the Swap offering the best price for the exchange.
  2. The details are shown to the user and once the user confirms the trade goes through our aggregation router and is routed through to the targeted swap.

This whole process is currently completely unbiased and does not favor Afraswap. The user’s trades will always go through with the swap offering the best price. But the users have a choice if they do not want to use any other they can stick with Afraswap.

3) Afra and Abra Tokens:

Afra Tokens are the governance and Afraswap’s native token. These allow users to take part in voting by creating proposals or voting on active proposals.

The tokens are only issued using the active AfraSwap Farms and Pools running on the blockchain, there would be a small premine for Afra Tokens to allow for initial airdrops and pool creations. The complete pre mine would be used for Airdrops and Liquidity Pools and none would be kept by the team.

Afra tokens would be the core of Afraswap and allow users to actively participate in the future of the project so that the project and users can grow together.

Once the initial airdrop is over , the only ways to receive Afra tokens would be to stake Afra in the Afra pools which would reward them with more Afra tokens over time or to stake their Afra-LP liquidity tokens in the farms.

The Team would be performing periodic buy backs of Afra tokens , which would then be burned to create deflation and regulate price. The first buyback and burn would be processed just after the airdrop is over to allow the users who want to sell the tokens to not cause a price dump for Afra. The team is committed to burn Afra tokens every month.

Abra tokens are currently used to track staking in the pools , but in future might be used in some other ways.

4) Farms and Pools :

Farms and pools are core part of Afraswap, they allow yield farming by staking their Liquidity Provider Tokens and to stake their Afra tokens in pools to earn Afra Tokens.

Farms provide an opportunity for Liquidity Providers to earn more profits from their investment in the ecosystem, this also incentivizes liquidity providers to keep providing more liquidity and keep their liquidity for long amounts of time while receiving a constant return on their investment without the need to remove the liquidity.

Pools provide an opportunity for Afra holders to keep holding their tokens and not sell , this is achieved by allowing users to stake their Afra in pools and earn more Afra Tokens over time. This incentives holding the token which allows for market stability and acts as an reward program for all the committed holders of the project.

In the start , the following farms would be offered:

  1. AFRA-BNB
  2. AFRA-BUSD
  3. AYA-BNB
  4. AYA-BUSD

These would allow these pairs to receive a head start and allow more liquidity to be locked in these pairs.

Also the following pools will be offered:

  1. Afra Automatic
  2. Afra Manual

These would incentivize holding Afra over time to gain more rewards.

More Farms and Pools will be added overtime through auctions and community voting, all the funds raised by auctioning Farms and Pools would be used to buyback and burn Afra overtime.

5) Governance and Security :

Governance and security are two major pillars for any Decentralized application to stand on. These provide transparency for the users and allows users to be aware of anything happening with the project that might affect them directly or indirectly.

Governance allows for users to directly participate in decisions that might affect them , the users who have sufficient voting power can create proposals and all users having voting power can vote on the proposal. Users can receive voting powers when they receive Afra as reward from farms and pools.

Voting is done through an offchain and widely used and trusted service known as snapshot.org, Snapshot allows the holders to vote without the need for an onchain transaction, which allows all participating members to vote without the restraint of having BNB in their account.

Snapshot uses signatures for validation and is used by major Defi Applications for Governance and Voting.

Security is one of the biggest concerns in DeFi , and the AfraSwap Team follows a security first approach to keep the users funds secure and allow safe operations throughout the ecosystem. This is acheived by using few already perfected security practices and code used by AfraSwap is well tested and audited by the team. We have few independent audits in the process as well for AfraSwap to prove our security first claim.

The AfraSwap Team uses a Gnosis Safe , which requires all actions on the contract to be approved by at least 3 members of the Core Team to be processed. Gnosis Safe is widely used and is proven to increase security in Decentralized Applications by removing a single point of access as any action requires multiple team members to authorize before execution.

Along with multisig approach the team also uses TimeLock , which requires all contract altering operations to be queued for at least 24 hrs before execution.

Timelock adds another layer of protection by adding a delay for each operation , so that the operations can be audited by all the stakeholders and users of the project, thus allowing a delay for users to exit the ecosystem , if any malicious action is queued for execution. Timelocks are critical for all decentralized projects as there have been many projects which have done malicious actions to steal funds from users. A timelock prevents such action to be immediately executed and thus provides critical time to resolve any such actions.

Along with the standard security practices mentioned above , AfraSwap has taken a non standard approach to increase security and trust in the project by removing the migration code from the main Farming contract. The migration code allows the Liquidity provider tokens held in the contract to be moved to another contract , this is a standard practice to leave such code in the contract as this allows moving Liquidity from one contract to another in case of upgrades by removing the extra step for the users to manually migrate the liquidity.

While this method is usually intended to facilitate quick and easy migration , the code can be used maliciously by the Core Team to steal all the funds locked inside the contract. This is commonly referred to as a Rug Pull and due to the migration code it is easy for the Core Team to run away with the funds but still this function exists in almost all AMM based Swaps , even major swaps like pancake have this function.

So as a measure to increase trust and transparency and showing our commitment to security for our users AfraSwap has decided not to include this function in our core contracts to remove any possibility of a Rug Pull , thus making AfraSwap more trustable than most Swaps and exchanges out there.

6) Lottery and Prediction games :

Along with Farms , Pools , Liquidity Pools Afraswap offers few games to allow users to win huge prizes using BNB.

The lottery is a simple game in which the user can buy lottery tickets with specific numbers , each lottery runs for a specific amount of time and results are generated through the widely used ChainLink VRF and Random Number Generator , which allows decentralized applications to generate true decentralized randomness, The numbers generated are then matched with the user’s tickets and the user is rewarded according to numbers. The whole process is completely decentralized allowing a fair outcome each time and allowing users to win huge prizes with even very small investments.

The price prediction game allows users to predict the BNB price every 5 mins , the user can predict the price of BNB every 5 mins and win the prize pool based on the amount they bet and if their guess is correct. The price prediction contract uses ChainLinks PriceFeed contracts to gather the most recent price on each round end, thus allowing no chance of any wrong doings and allowing a fair change for everyone.

Both the games leave a share of the prize pool to a treasury, the treasury is used to collect the fees on these games. All the fees collected are then used to buyback Afra tokens and burn Afra tokens.

Conclusion:

Afraswap is the new age decentralized cryptocurrency exchange made with the highest standard of security and stability. Afraswap allows easy trading experience for users and provides best prices by aggregating all prices from multiple AMM’s for the user and processes the transaction on the blockchain.

Afraswap allows multiple avenues to invest and earn profits on crypto holdings for the users and we believe Afra would be one of the top DEX”s soon.

Currently AfraSwap is in the final stages of testing and will be launched soon.

--

--

Aryacoin

Aryacoin works to build a better cryptocurrency ecosystem by upholding the core principles of crypto.