[AS6] - LiquidEase 🏅

LiquidEase is a DeFi tool that offers single sided liquidity, with optimal swaps via 0x API. Users can change their positions as needed with the use of customizable triggers. Automates smart contract calls for liquidity using OpenZeppelin's Defender.

0
1

Challenges

0x Labs: Build Token Swaps with 0x Swap API

Ranked 7,000 USDC

Consider the following scenario: a user holds 5000 DAI and wishes to provide liquidity to an ETH/DAI pool. With our intuitive user interface, they can deposit their DAI with ease. Our smart contract then executes an optimal swap, calculating the precise amount of DAI to be swapped with ETH. This ensures that the provider can deposit 100% of their capital without fear of the AMM rejecting any of their tokens. Our groundbreaking solution leverages the power of the 0x Swap API, which aggregates multiple liquidity providers to pinpoint the best swap price, thereby reducing slippage to an absolute minimum. With 0x Labs, you can rest assured that your token swaps are not only quick and convenient, but also optimized to perfection.

OpenZeppelin Defender Integration

Ranked 10,000 USDC

LiquidEase's commitment to user-friendly and highly customizable solutions is one of the hallmarks of our project. We empower our users with customizable triggers that provide them with the flexibility to modify their positions as they see fit. These triggers include both event and time-based options, giving providers the freedom to increase or decrease their liquidity as well as withdraw their position entirely. For example, if an LP experiences a significant drop in trading volume of over 15% in a 24-hour period, our automated system enables providers to swiftly and seamlessly exit their position. We rely on OpenZeppelin's Defender, harnessing the full power of autotasks and sentinel technology to automate and monitor smart contract calls. By leveraging LiquidEase, users can rest easy knowing that their liquidity positions are fully customizable and can be tailored to their unique needs, preferences, and risk tolerance levels. Our innovative triggers and monitoring mechanisms offer a level of precision and control that sets us apart from the competition, enabling our users to optimize their positions with confidence and ease.

#BUIDLathon 2023 DeFi Track

Pool 15,000 MATIC

At the heart of our innovation lies an unshakable commitment to flexibility and convenience in liquidity provision. Our groundbreaking concept rests upon the dynamic interplay between LP statistics and cutting-edge AMM mechanisms that trigger precisely calibrated contract calls. We strive to break down the barriers to entry that have previously hindered participation in DeFi and boldly position ourselves as pioneers of the DeFi 3.0 revolution.

Connect the world with Chainlink

Pool 10,000 ETH

The utilization of AggregatorV3Interface for Chainlink price feeds forms an integral cornerstone of our liquidity provider's ability to tailor their experience to their exacting specifications. Our smart contract facilitates enhancements and retractions in liquidity via both time-based and event-based triggers. The latter includes critical factors such as percentage variations in key LP metrics like 24-hour trading volume, impermanent loss, and APY. To accurately calculate these metrics within our smart contract, we depend on Chainlink's oracles, which are an indispensable component of our system.

Project details

Introduction

LiquidEase is an innovative DeFi technology whose goal is to boost the adoption of DeFi by lowering friction for liquidity providers. In conventional LP models, to provide liquidity, a liquidity provider must provide two or more tokens. By giving liquidity providers the choice to supply single-sided liquidity, LiquidEase aims to expedite this procedure.

Key features
Say for instance a user has 100% exposure to DAI. They own 5000 DAI and would like to provide liquidity to an ETH/DAI pool. They can simply deposit DAI using our intuitive UI, and our protocol does an optimal swap. In essence, our smart contract calculates the optimal amount of DAI to swap with ETH, and performs that swap. Through this mechanism, providers are able to deposit a 100% of the capital that they’d like to, and not have to worry about the AMM not accepting some of their tokens. The swap is done via the 0x swap API, which aggregates multiple LPs in order to find the best swap price, and minimize slippage. 


Notably, LiquidEase also increases customizability for its users through its provision of customizable triggers that enable providers to alter their positions how they see fit. This includes event and time based triggers that increase liquidity, decrease liquidity, or remove their position entirely. For instance, if an LPs trading volume falls by over 15% in 24 hours, providers can automate exiting their position. This is made possible through the use of OpenZeppelin's Defender, where we use autotasks and sentinel to automate and monitor smart contract calls.

Smart Contract Overview

  • The contract uses several Solidity libraries such as SafeMath, IERC20, and AggregatorV3Interface, as well as imported contracts such as IUniswapV2Pair and IUniswapV2Router02 from Uniswap and IUniswapV2Factory from Uniswap's v2-core library.

  • The constructor takes in the initial supplies of the two tokens in the liquidity pool and the liquidity pool address as inputs.

  • The getTokenValue() function is a helper function that takes in a token address and an amount and returns the token value of that amount based on a price feed address specific to the token.


The main functions of the contract are:

  • provideLiquidity(): Allows a user to provide liquidity to a Uniswap trading pair by depositing two tokens. It calculates the amount of LP tokens to be received and emits a LiquidityProvided event.

  • removeLiquidity(): Allows a user to remove liquidity from a Uniswap trading pair by specifying the LP token amount and the two tokens to receive. It calculates the amounts of tokens to be received and emits a LiquidtyRemoved event.

  • calculateLPStats(): Calculates daily statistics about a Uniswap trading pair such as trading volume, liquidity pool supply, and differences in token supply. It emits an LPStatsCalculated event with the calculated values.

  • executeSwap(): Swaps tokens using 0x ExchangeProxy and emits a BoughtTokens event with the amount of tokens bought.

  • The contract also has several state variables such as volume0, volume1, and diff1 used for calculating the daily statistics. The contract is deployed on both the Goerli and Ethereum mainnet with different addresses for tokens and the liquidity pool.


Improvements for the future

Scalability: The current infrastructure might not be able to handle the additional load when more users start using LiquidEase. Investigating layer 2 options, such as zk-rollups or optimistic rollups, could be one way to boost transaction throughput and cut gas costs.

Security: Security risks are always a possibility. Regular security audits should be carried out to make sure the smart contract is safe and compliant with the most recent security best practices in order to reduce these risks.

Decentralization: Despite being a decentralized financial instrument, LiquidEase is presently deployed on the Ethereum network. It would be advantageous to investigate other blockchain networks like Polkadot or Cosmos as the DeFi ecosystem develops in order to improve decentralization and lessen dependency on a single network.

User Experience: The current user interface is simple, but there is always room for improvement. To make using the platform more simpler for users, LiquidEase may look at future additions like smartphone compatibility or more sophisticated analytics tools.

Interoperability: Uniswap trading pairs are the only ones that LiquidEase presently supports, although it would be advantageous in the future to include additional decentralized exchanges and liquidity pools. To make flawless interoperability possible, bridges across various protocols and networks would need to be built.