Augustus is the exchange proxy that enables swaps to happen in ParaSwap.
In this section, we'll describe the architecture of Augustus Swapper and its different internal mechanisms.
Simple Swap is the simplest way for swapping tokens where there is no need to use any intermediary token.
Eg: Swapping 50 ETH --> MKR through one or more DEXs.
A multi-path swap corresponds to using one or multiple intermediary tokens in a single swap in order to maximize the gain of the destination Token.
An example would be 100 ETH --> USDT, where the best route could be:
- First, swapping 100 ETH to DAI,
- Then, swapping the corresponding DAI to USDT.
Here each step would use one or multiple DEXs.
Example from paraswap.io
Mega Path is a generalized case for Multi Swap. Here, a swap can be broken down into multiple Multi-Swaps. It's generally useful with larger amounts.
ParaSwap currently doesn't charge any fees from its end-users directly, except in the case of positive slippage.
If a positive slippage occurs in your transaction, ParaSwap will charge 50% of the positive slippage amount.
Example Transaction: A swap of 10 ETH --> DAI; If ParaSwap guarantees an expected amount of 30,000 DAI for the transaction, whereas after the execution 30,500 DAI is returned, then ParaSwap would charge 50% of the slippage. i.e: 500/2 = 250 DAI.
If you choose to integrate ParaSwap with your service, you can choose to charge the end-user a desired fee.
- 1.If you are not a registered partner, you can simply pass the
partnerAddress(your address) while calling ParaSwap. (Note: ParaSwap will charge a 15% fee cut from the fees charged by the partner.)
- 2.If you are a registered partner:
- You have the option to alter your fee cut (if you wish to increase from more than 85% by default) from the fees charged from the customer.
Partner Fees With Slippage
If a partner is not registered and slippage occurs in the transaction:
- 50% of the positive slippage goes to Paraswap, 50% to the user. Partner fee is then calculated on the basis of the actual expected amount.
If a partner is registered and then slippage occurs:
- If the partner has specified that positive slippage should not be taken into account, then the fee is calculated on the received amount irrespective of the positive slippage that occurred.
- If the partner has specified that positive slippage should go to the user, then 50% of the slippage goes to Paraswap and the other 50% to the user. The fee is calculated on the basis of the expected amount (i.e: before the occurrence of slippage).
- If the partner has specified that positive slippage should not go to the user, then 50% goes of the slippage goes to Paraswap and 50% to the Partner. The partner fee is then calculated on the basis of the expected amount.
Let's look at an example:
A swap of 10 ETH to 30,000 DAI occurred through a partner integrated with ParaSwap.
If the partner charges 1% fees from the user (300 DAI in this case), then the partner will receive (by default) 85% of the fees, i.e - 85% of 300 DAI = 255 DAI, and ParaSwap will receive the other 15%, i.e - 15% of 300 DAI = 45 DAI.
The primary AugustusSwapper contract acts as a proxy contract. It passes on the calls to respective routers as per the function signature. Each function call has its own specific router which needs to be registered by the admin.
For each specific trade type, we have built a separate router. Currently, we have routers for:
- Multipath (with Megapath included),
- direct swaps on Uniswap V2 (and forks)
- direct swaps on 0x V2 and V4 (used to execute RFQ orders from ParaSwapPools)
- Additional helper functions (used by simple swap for example)
Multipath routers delegate calls to adapters.
Adapters are a collection of different exchange handlers. The number of exchange handlers is limited by the quantity of code allowed in one contract, so multiple adapters may be in use to cover all possible exchanges.
These are not part of the Augustus architecture per se but independent contracts. These are for use with simple swap where normally we'd use the official router contract of a DEX, but instead we may use a customized router (optimized to save gas). Currently this is only done for Uniswap V2 and similar forks.