Automated market makers (AMMs) are smart contracts that allow users to trade assets following a predetermined algorithm. It is enabled by tapping into capital provided by liquidity providers, who are rewarded with transaction fees charged on all trades. 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. The curve, fixed by the protocol, constraints trading and liquidity provisioning in the contract.
|Functioning of DefiEdge|
UniswapV3 introduces a new dimension to liquidity provisioning by letting the market decide how to appropriate liquidity for different price ranges. It significantly improves both capital efficiency and price discovery.
Ticks-Based Liquidity Provision
To allow liquidity providers to deploy capital at different price ranges, UniswapV3 demarcates the entire price range with discrete ticks. Liquidity providers (LPs) can allocate their assets over a specific price range defined as the range between two price ticks.
|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 this possibility, LPs need to manage their positions and frequently update the price range actively. Not only do they need to monitor their positions continuously, but they also anticipate market volatility and price trends. On the other hand, continuous rebalancing will also lead to high gas costs. This makes it difficult for retail users who want to provide passive liquidity efficiently.
A 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 can run into various problems.
- 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 will not be possible to implement very complex strategies due to the limitations of solidity.
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 enables the creation of smart contracts that connect liquidity providers on one side to effectively-managed strategies in a permissionless and scalable manner. While the primary goal for DefiEdge was to enable liquidity holders to passively earn more trading fees, 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.
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, and performance fee.
- The liquidity management fee is defined and charged by the strategy manager to the liquidity providers. The amount of fees is decided by the strategy manager. 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 protocol fee is determined and collected by the protocol. It is collected two times. The protocol management fee is charged as a percentage of the liquidity LPs deposit in a strategy. The protocol performance fee is a percentage of the fee collected from the UniswapV3 pool. Initially, both are set to 0% but can change by the governance.
The management fee and the protocol fee can both be claimable by the strategy manager from the strategy management page.
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.