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 protocols try to address is to obtain reliable and smooth functioning, 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, which is fixed by the protocol, constraints trading and liquidity provisioning in the contract.
Functioning of DefiEdge

Active Liquidity

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 approach to liquidity provisioning improves capital efficiency for LPs, 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 actively manage their positions and frequently update the price range. Not only do they need to continuously monitor their positions but 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 would want to earn yields on their liquidity passively.
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 in continuously following market fluctuations.

Architecture Approach:

DefiEdge enables the creation of smart contracts that connect liquidity providers on one side to effectively-managed strategies in a permission-less 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 permission-less 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. To achieve this, they are free to adopt strategies in response to dynamic market conditions and actively pursue profitable opportunities, delivering high-quality returns.

Fee Structure

Liquidity providers pay two types of fees when they deposit assets into a strategy management contract; the platform fee and the liquidity-management fee.
  • The protocol fee is the fee charged by the DefiEdge protocol. The platform fee is the fee charged by the DeFiEdge protocol. This is a percentage of the fee charged by the strategy manager. The protocol fee is a percentage of the performance and management fee charged by the manager.
  • The liquidity management fee is defined and charged by the strategy manager to the investors. 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.
  • The performance fee is decided and charged by the strategy manager. It is determined as a fraction of the fees earned from the UniswapV3 pool.
The management fee and the protocol fee are both 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 for 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. Liquidity providers have the option to deposit liquidity in one or both the pool assets depending upon the UniswapV3 pool that the strategy manager has chosen.
  • 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. If the liquidity provider chooses to deposit both assets forming the liquidity pool, then liquidity will be accepted from the user in the following ratio :
ratio=pppmin1ppmaxratio = \sqrt{p} * \frac{\sqrt{p} - \sqrt{p_{min}}}{1-\frac{\sqrt{p}}{\sqrt{p_{max}}}}
: 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 two tokens from the corresponding UniswapV3 pool. These token are held in the contract and can later be swapped and deployed by the strategy manager according to their judgement.

Share Distribution

Protocol shares (also called DEshares), an ERC20 token, are shares that are allocated by the liquidity management smart contracts to the investors in the ratio invested by the users.
DEshares represent:
  • Principal liquidity in the UniV3 pools managed by the DefiEdge Protocol strategy 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
is the number of shares that will be minted, such that :
f=Fx0px+y0pyxpx+ypyf = F*\frac{x_0p_{x} + y_0p_{y}}{xp_{x} + yp_{y}}
User will get
f(1pm100+m100)f*(1 - \frac{\frac{p*m}{100}+m}{100})
are the protocol and management fees (in percentage terms). Please note that the protocol fees is charged as a percentage on the management fees.
Having their positions represented as ERC20 tokens allows liquidity users to stake their investments in other protocols as collateral and obtain further 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 our Oracle (GM of UNIV3 TWAP & 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 the Oracle. 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 UniswapV3.


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 to be allocated to each price range to maximize returns. The manager ensures that the user funds always 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 the returns from the pool and consequently higher returns for liquidity providers.

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. The fund will not accept new assets if all the capital is held in one token.
When performing swaps, the strategy manager has the choice to execute the orders using the normal pool or use auto-router ( The auto-router optimizes over a sequence of multiple routes across different UniswapV3 pools to minimize slippage. To prevent manipulation using the auto-router, the amount finally received after a swap is compared to the price feed from Chainlink.
Implementing auto-router
Last modified 1yr ago