How it works
Last updated
Last updated
At the heart of every Covenants application is the Aggregator. By liberating on-chain AMM aggregation, it allows any wallet, Organization, DAO or customized smart contract to farm, inflate, multi-swap, arbitrage, craft liquidity, collateralize stablecoins and more across multiple AMMs at the same time.The AMM Aggregator is the first ever on-chain AMM aggregator and it provides a set of fully on-chain, general-purpose DeFi APIs that any dApp can use to integrate the Aggregator, and thus exploit its full potential. Covenants is built on the AMM Aggregator but any developer can build his own application integrating the AMM Aggregator.
All other aggregators—1inch, for example—operate semi on-chain. While excellent at finding the best prices for trades, they process all transactions via their off-chain frontends. Smart contracts cannot read frontends, so they can’t interact with these aggregators. Only human individual wallets and off-chain arbitration bots can, and only for basic token swaps.The Covenant Aggregator is free from such limitations. It is equipped with AMM-standardizing Solidity APIs that smart contracts can read. This means that any wallet, dApp, Organization, DAO or customized smart contract can use it, and for much more than just token swaps: multi-AMM farming, on-chain arbitrage, token inflation, liquidity crafting, stablecoin collateralization and other functionalities are possible.
All AMMs implement the same three basic functions—swap liquidity, add liquidity and remove liquidity—in different ways. Uniswap routes users to liquidity pools via hard-coded lists; Mooniswap connects users directly; Balancer allows for multi-token pools; and so on.However, they all do this using the same standard logic. The Aggregator’s APIs interact with each AMM via the pathways of this logic, and this is how it can facilitate fully on-chain aggregation and the unprecedented possibilities instantiated by Covenant contracts.
This is the Aggregator’s extendible knowledge base. It keeps track of all whitelisted AMMs and allows them to be upgraded / downgraded via a plugin system. There are multiple plugins for each AMM, each with its own version number, upgradable features and previous bug fixes.