Liquidity Automated Replenishment Service (LARS) is a vital component of the Ferrum Network designed to facilitate cross-chain swaps on MultiSwap while maintaining controlled liquidity levels. It operates within the Fund Manager Network Liquidity (FMNL), employing limited liquidity to avoid honeypots. LARS provides a systematic approach to liquidity replenishment, governed by high and low thresholds.
LARS automatically manages liquidity based on predefined thresholds. If the liquidity in the Fund Manager surpasses the LARS high threshold, excess liquidity is promptly removed. Conversely, if liquidity falls to or below the LARS low threshold, the service adds the necessary liquidity to restore optimal levels in the Fund Manager.
- High Threshold: USDC 10,000
- Low Threshold: USDC 5,000
main.js is the entry point for the Liquidity Automated Replenishment Service (LARS). It allows you to configure the low and high threshold, initializes the necessary services and automate the monitoring of the liquidity.
The initServices.js script plays a crucial role in initializing the Liquidity Automated Replenishment Service (LARS) application. This script is responsible for setting up the necessary environment, connecting to the Ethereum blockchain, initializing the token contract, and obtaining the required addresses.
The BalanceMonitoringService periodically checks the token balance held by the fund manager and takes actions based on specified low and high thresholds.
The BalanceManagementService is responsible for adding liquidity when the balance falls below the low threshold and removing excess liquidity when it exceeds the high threshold.
Before you begin, ensure you have the following:
- Node.js installed on your machine.
- An Ethereum wallet with a private key.
- The necessary environment variables set in a .env file.
-
Clone this repository:
git clone https://github.com/ferrumnet/LARS.git
-
Navigate to the project directory:
cd LARS -
Install dependencies:
npm install
Create a .env file in the root directory of the project with the following variables:
TOKEN_ADDRESS=0xYourTokenAddress
FUND_MANAGER=0xYourFundManagerAddress
PRIVATE_KEY0=0xYourPrivateKeyRun the application using:
npm start <network> <lowThreshold> <highThreshold> <interval>npm start ethereum 500 1000 180