Comment on page
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 using the
partnerAddress(your address) parameters while calling ParaSwap. (Note: ParaSwap will charge a 15% fee cut from the fees charged by the partner.)
Partner Fees With Slippage
If the partner chooses not to charge a swap fee or keeps it below 0.5%, ParaSwap takes 50% of positive slippage and leaves the other 50% to be used as best suited to the partner's interest. Otherwise, if the partner swap fee is equal to or above 0.5%, ParaSwap leaves 100% of positive slippage to be used as best suited to the partner's interest.
Partner fee is calculated on the basis of the actual 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.