/amm-market-making-bot

A Uniswap V3 Position Management Service

Primary LanguageTypeScript

Uniswap V3 Management Service

Abstract

This service is built to interact with Uniswap V3 pools on the Ethereum blockchain. It provides functionalities for managing liquidity pools, positions, and collecting fees. It encapsulates complex smart contract interactions into a simple service layer, making it easier to work with Uniswap V3 pools.

Tech Stack

  • NestJS - A progressive Node.js framework for building efficient and scalable server-side applications.
  • Ethers.js - A complete Ethereum wallet implementation and utilities in JavaScript and TypeScript.
  • Class-Validator - Validation made easy using TypeScript decorators.
  • Uniswap V3 SDK - A JavaScript library for interacting with Uniswap V3.

Installation

  1. Clone the repository:
git clone https://github.com/OxMarco/uniswap-v3-management-service.git
cd uniswap-v3-management-service
  1. Install dependencies:
npm install
  1. Setup your environment variables: Create a .env file in the root directory. Add the following variables:
RPC_URL=https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID
PRIVATE_KEY=YOUR_PRIVATE_KEY
API_KEY=some_random_string
  1. Build and run the service: npm run build npm run start

Tests

Run the tests:

npx hardhat node --fork ALCHEMY_URL

Pick one of the addresses from the console and add it to the .env file as the PRIVATE_KEY variable and use http://127.0.0.1:8545 ad the RPC_URL variable.

Expected Usage and Applications

This service is ideal for developers and liquidity providers who want to manage their Uniswap V3 positions programmatically. It offers a range of functionalities including:

  • Retrieving chain data and gas prices.
  • Querying token balances.
  • Getting pool and position information.
  • Initializing a pool by approving token transfers.
  • Minting a new liquidity position.
  • Rebalancing a liquidity position.
  • Collecting fees from a liquidity position.
  • By using this service, you can automate the management of your Uniswap V3 positions, optimize your fee earnings, and react quickly to market conditions.

Further Development

Extend the service to support more functionalities, handle errors robustly, and optimize for gas efficiency. Contributions are welcome!