Skip to content

xtycoonfi/liquidate_llamalend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Curve LLamaLend  Curve LlamaLend Liquidation Bot

A concrete example of a liquidation bot designed for Curve LlamaLend showing how to identify & liquidate unhealthy positions, contributing to the platform stability while offering profit opportunities.

How it works?

This bot iterates throught LlamaLend lending pools & check for unhealthy positions. When an unhealthy position is detected, it calculates if the liquidation is profitable by simulating a swap of collateral_token to borrowed_token.

If the liquidation is profitable, it proccess the liquidation in an atomic transaction like this :

  • Flashloan USDC (Balancer => 0% fee)
  • Swap USDC to crvUSD
  • Uses crvUSD to liquidate & get collateral_token
  • Swap back collateral_token to USDC
  • Repay flashloan & keep profit

Example TX: https://arbiscan.io/tx/0xc62dcb45c27344cad148ebe006ac827574b512adb276e85e048752ca48f66d8d

How to test it?

1. Install dependencies

  • Using npm: npm i

2. Fill .env

An example is available in the .env.example file.

PUBLIC_KEY=<public-key>
PRIVATE_KEY=<private-key>
ARB_RPC_URL=<arbitrum-rpc>
ARB_RPC_WSS=<arbitrum-rpc> //Not used in this demo
ETH_RPC_URL=<ethereum-rpc>
ETH_RPC_WSS=<ethereum-rpc> //Not used in this demo
TG_TOKEN='bot<api-key>' //Telegram notifications
TG_CHANNEL='-<channel-id>' //Telegram notifications

3. Run

  • Arbitrum: npm run start_arbitrum
  • Ethereum: npm run start_mainnet

Additional informations

Instead of swapping USDC for crvUSD on Ethereum mainnet, you can also call flashloan method from crvUSD FlashLender (0.01% fee)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published