Augustus Swapper
Augustus is the exchange proxy that enables swaps to happen in ParaSwap.
Last updated
Augustus is the exchange proxy that enables swaps to happen in ParaSwap.
Last updated
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.
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.
Partners integrating with ParaSwap using the ParaSwap API can control the fee structure of their integration, deciding whether to charge a swap fee or participate in surplus sharing.
For more information on how Partner Fees are implemented, please refer to the API Partners - Revenue Share Overview Section.
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:
SimpleSwap,
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.