Automated Market Makers (AMMs) are smart contracts that enable users to trade different assets via a preset algorithm. This creates an opportunity for liquidity providers to lock their capital into the AMM and earn yields on their funds. The fundamental problem decentralized exchanges try to address is to execute smooth swaps with low-price slippage while at the same time enabling efficient price discovery. Protocols like UniswapV2, Balancer, and Curve adopted different invariant curves appropriate for various asset classes. These equation curves, set by the protocols, define the parameters of trading and liquidity provisioning in the contract.
|Functioning of DefiEdge|
UniswapV3 introduced capital efficiency by allowing liquidity providers to set their own ranges and earn rewards for active ranges via virtual liquidity rather than liquidity spread across the complete price ranges of the pool. This significantly improves both capital efficiency and price discovery.
Ticks-Based Liquidity Provision
UniswapV3 represents the prices via discrete mathematical notations called ticks. These have the following mathematical notation:
These ticks help represent the discrete prices rather than an infinite number of possibilities. Liquidity providers (LPs) can allocate their assets over different price ranges which can be presented via ticks, the basic counting unit for UniswapV3.
|Comparison between UniswapV2 and UniswapV3|
While this new liquidity provisioning approach improves LPs' capital efficiency, it comes with its risks. In UniswapV2, LPs could suffer impermanent loss if the price deviates significantly. This risk is amplified in UniswapV3. If the trading price in the pool goes outside a position’s price range, all the capital will get converted to the cheaper asset, resulting in a significant loss of reserves.
|Illustrative comparison between impermanent loss in UniswapV2 and UniswapV3 (this is illustrative only, true impermanent loss depends upon the user's exact position and their choice of price range)|
Active Liquidity Management
To counter the market volatility and anticipate price trends, LPs need to manage their positions and sometimes frequently update the price ranges actively. But if continuous rebalancing happens it may lead to high gas costs which makes it difficult for retail users who prefer to provide passive liquidity efficiently.
One possible solution to these issues is to create an on-chain protocol where liquidity providers can invest their assets in various technical strategies via a smart contract. The contract would then rebalance the positions based on different technical indicators. While the approach makes sense at first glance, it may run into various problems such as:
- Deploying strategies on smart contracts will make the protocol too rigid.
- Savvy programmers can decipher the strategy from the contract code and front-run high volume strategies and, in the process, gain profits at the expense of liquidity providers in these protocols.
- It is not possible to implement very complex strategies due to the limitations of solidity and blockchain limitations as compared to traditional financial strategies and infrastructure.
Introducing DefiEdge: The Asset Management Protocol Built on UniV3
DefiEdge is a protocol that connects liquidity providers with strategy managers to streamline user investment in UniswapV3 pools. Strategy managers will actively manage assets provided by users helping them take advantage of amplified yields in UniswapV3 without spending too much time and effort continuously following market fluctuations.
DefiEdge uses smart contracts to create strategies for LP management on top of Uniswap V3. This allows strategy managers to connect with LPs in a permissionless and scalable manner. The core functionality of DefiEdge is intended to enable liquidity holders to earn better fees for their UniswapV3 positions which is managed by efficient strategy managers. With evolution of mechanisms for options, UniswapV3 positions can also be used to create exposure similar to various options-like derivatives see Uniswap V3 LP Tokens as Perpetual Put and Call Options for more information.
The primary idea to keep in mind is that the geometric mean of the lower and upper bounds in a UniswapV3 position is the price at which a liquidity provider is willing to sell and buy the token. This means that the DefiEdge framework has the potential to go beyond earning yield from passive fee generation. A strategy manager can even generate returns by placing range orders or buy-sell orders.
DefiEdge enables permissionless and decentralized liquidity provisioning. Anyone can set up a liquidity management contract using the factory contract for our protocol. Liquidity providers can then deposit assets in these contracts to earn returns as strategy managers collectively optimize their positions. Rebalancing positions on UniswapV3 through DefiEdge smart contracts will now happen in large blocks, decreasing the number of actions from all users and reducing the relative impact of gas fees. DefiEdge contracts create a scalable layer over UniswapV3 pools and enable collective management of multiple individual positions.
The strategy managers on DefiEdge are responsible for optimizing user liquidity in UniswapV3 pools. They are free to adopt strategies in response to dynamic market conditions and actively pursue profitable opportunities, delivering high-quality returns.
There are three forms of fees on our platform; protocol fee, liquidity management fee (shown as management fee while creating a strategy and deposition of liquidity), and performance fee.
The liquidity management fee is defined and charged by the strategy manager to the liquidity providers. Whenever a liquidity provider adds liquidity to the strategy contract, an upfront percentage gets charged and is available to be claimed by the manager in the form of DE shares.
The strategy manager also decides and charges the performance fee. It is determined as a fraction of the fee earned from the UniswapV3 pool. The management fee and the protocol fee can both be claimable by the strategy manager from the strategy management page.
3.The protocol fee is determined and collected by the protocol. Currently, this is set to zero, and can be initialized at later stages via governance mechanisms which will be released in upcoming versions of the platform. It is set to be executable at two places: as a percentage of management fees, and as a percentage of performance fees.
Providing liquidity on DefiEdge
The UniswapV3 algorithm is ideal for efficient and inexpensive trading of volatile tokens. It balances the needs of traders and liquidity providers by enabling efficient price discovery, but this exposes users to amplified impermanent loss. DefiEdge allows users to deposit assets in managed strategies. The option to accept liquidity in or both the pool assets lies with the strategy manager as described below
- Dual Liquidity Provisioning: DefiEdge allows the strategy manager to set multiple ranges and the first range is the one where any new liquidity is deployed. Now if the manager chooses to accept both assets forming the liquidity pool, then liquidity will be accepted from the user in the following ratio :
Where : current price,
: the lower bound of the price range provided
: the upper bound of the price range provided
- Single Side Liquidity Provisioning: UniswapV3 requires users to provide liquidity in multiple assets to maintain proportional reserves. DefiEdge protocol enables single-sided liquidity provisioning. Liquidity providers can add single-sided liquidity in either of the tokens in the corresponding UniswapV3 pool. These tokens are held in the contract and can later be swapped and deployed by the strategy manager.
Protocol shares (also called DEshares), an ERC20 token, are shares allocated by the liquidity management smart contracts to the investors in the ratio invested by the users. Their initial value is set to $100. Therefore the first time an LP deposits tokens in a strategy they will receive shares according to the following formula:
: the capital user wants to deploy
: the price of token0/token1 in USD
- Principal liquidity in the UniV3 pools managed by the DefiEdge Protocol liquidity manager.
- Returns earned from liquidity provisioning to the strategies.
DEshares enable users to track their position and liquidity within a defined strategy. The number of DEshares allocated to a user is calculated as follows:
: extant shares of an existing liquidity management pool,
: the current pool composition and
: the capital user wants to deploy
: the price of token0/token1 in USD
is the number of shares that will be minted, such that :
User will get
where and are the protocol and management fees (in percentage terms).
Their positions represented as ERC20 tokens allow liquidity users to stake their investments in other protocols as collateral and obtain other assets. This enables liquidity providers to mine more liquidity and increase or diversify their exposure if they wish to do so.
The price for calculating pool share tokens is obtained from chainlink to prevent economic attacks on the protocol by price manipulation using flash loans. On every action in the contract, the price in the pool is compared to the price from Chainlink. If the deviation is greater than a minimum threshold (set by the governance), those transactions get reverted to protect the assets of liquidity providers in the smart contract.
DeFiEdge connects users with capital looking for passive yield to users who have designed profitable strategies to invest in UniswapV3, creating a win-win situation for all. Capital providers get an opportunity to invest in high-yield strategies. Liquidity managers, on the other hand, are rewarded by management fees. If their fund generates high yields, it will attract more capital, thereby enhancing their share of the rewards.
Launching a Strategy Management Contract
Strategy managers can launch new strategies using the factory contract & are restricted to the asset pair that they select during the deployment. Future updates will allow multiple assets to be managed by the same smart strategy, with the manager being able to deploy a percentage of AUM (Assets Under Management) to different pools. For now, the manager will specify a liquidity pool from asset pools available on Uniswap V3.
The manager, through the adoption of varying strategies :
- Predicts the ranges where they expect to see the most trading volume and consequently earn high swap fees.
- Deploy at ranges where they wish to buy or sell.
DefiEdge allows the manager to decide the percentage of funds allocated to each price range to maximize returns. The manager ensures that the user funds remain within the active liquidity range by constantly rebalancing them in case of price deviation. The liquidity manager pays the gas fees for all rebalancing actions in the fund. Every time the liquidity manager performs rebalancing, all the liquidity in the pool is removed along with the accrued fees, which are then reinvested. This causes compounding returns from the pool and, consequently higher returns for liquidity providers. Strategy managers can also claim fees directly from the strategy page.
Swap and hold
If the manager anticipates a lot of one-sided price action for their pool assets, they can choose to hold the asset they expect to gain in value. While this forsakes trading fees from UniswapV3, it avoids impermanent loss for the fund and gains value, as you will be holding the asset whose price is rising.
When performing swaps, the strategy manager can access liquidity across the chain through our 1inch integration. To prevent manipulation, only swaps with price slippage below 2% are allowed.