Augmentlabs StableCoin with AMCF
  • Overview
    • 💡About Us
    • ✨Our Vision
  • Smart Contracts
    • 🪙USC Token
    • 🪙AGC Token
    • ⚖️Token Controller
    • 👨‍🍳MasterChef
    • ⚙️Uniswap Liquidity Auto Provider
    • ⚙️Pancakeswap Liquidity Auto Provider
    • 🕰️Timelock
    • 🔗AGC Governor
Powered by GitBook
On this page
  • Overview
  • Dependencies
  • How it works
  • Roles
  • Participants
  1. Smart Contracts

Uniswap Liquidity Auto Provider

The smart contract that allows user to deposit USC or USDT to provide liquidity to the pool without having to perform manual steps in Uniswap.

PreviousMasterChefNextPancakeswap Liquidity Auto Provider

Last updated 2 years ago

Overview

Contract:

LpAutoProvider is an Upgradeable smartcontract that swaps 50% of user's USC or USDT for another, then take both swapped and remaining 50% of the original token to provide liquidity to the position owned by the contract itself.

Augmentlabs will pre-provide a certain amount of liquidity into the USC/USDT pool using UniswapV3 protocol. We need to allow our users to use either USDT or USC to back the liquidity of this pool by performing the swap-and-add-liquidity flow above.

The liquidity pool created on Uniswap:

There are some requirements that this smartcontract must satisfy:

  • Owner can collect fees but can't withdraw any liquidity to owner wallet without governance decision of token holders. This must be enforced that only the timelock can call the withdrawLiquidity function.

  • Should have slippage protection to prevent sandwich attack.

Dependencies

  • Pausable: Allows for pausing/unpausing of the smart contract.

  • AccessControl: Allows for multiple permission roles to exist in the same contract.

How it works

The Liquidity Auto Provider will swap 50% of the provided token (either USC or USDT) using the Uniswap SwapRouter. After that, both the swapped amount and the remaining token will be used to provide liquidity to the position that Augmentlabs has minted.

Roles

  • Admin (DEFAULT_ADMIN_ROLE): Admin role is able to pause/unpause the smart contract and grant roles to other users. Admin role will be held by a gnosis safe address to ensure security.

  • Pauser (PAUSER_ROLE): Pauser role is able to pause/unpause the contract in case of emergencies. Initially no specific address is the holder of the Pauser role other than the Admin.

  • Upgrader (UPGRADER_ROLE): Upgrader role is able to upgrade the smart contract for future phases. Initially no specific address is the holder of the Upgrader role other than the Admin.

  • Operator (OPERATOR_ROLE): Operator role is able to perform the slippage tolerance change or change the contract's position ID should the change is required.

  • Withdrawer (WITHDRAWER_ROLE): Withdrawer role is able to withdraw a certain amount of liquidity from the pool to the owner address.

Participants

  • Gnosis-safe address as Admin, Pauser, Upgrader, Operator: This ensures important roles are secure and doesn't have single-point-of-failure. Also for future extension, Admin can grant roles to other addresses if needed.

  • Timelock as Withdrawer: This ensures that normally all liquidity are locked so the ecosystem is healthy. The withdraw liquidity is only available if it's approved through governance of AGC token holders.

  • User: Performs the swap-and-add-liquidity flow using USC/USDT on Uniswap.

⚙️
LpAutoProvider.sol
https://app.uniswap.org/#/pool/450538
AGC