Coder Social home page Coder Social logo

zikkuratti / comet-liquidator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ajb413/comet-liquidator

0.0 0.0 0.0 155 KB

A continuously running script that liquidates Compound III accounts that violate collateral requirements.

JavaScript 0.65% TypeScript 81.14% Solidity 18.21%

comet-liquidator's Introduction

Comet Liquidator powered by Alchemy

A continuously running script that liquidates Compound III accounts that violate collateral requirements.

Alchemy is used to find out the current Comet borrower accounts. Alchemy Transact is used to test the liquidation transactions before they are submitted to the blockchain. Alchemy Notify is used with a Alchemy Mined Transaction Webhook. An Autocode webhook listens for the http request and sends an email via SendGrid to the liquidator.

The code in this repository is a fork of the example Comet liquidation bot in the Comet repository. Find this Compound Comet Liquidation guide for more details.

Install

Clone this repository and install Node.js and Yarn.

yarn install
yarn build

Alchemy

Get your API keys for FREE at Alchemy.com.

Autocode

Set up your Autocode account for FREE at Autocode.com. Set up the webhook (autocode/index.js) after setting up the Alchemy Notify Mined Transaction Webhook.

SendGrid

If you want to send email alerts when a transaction is mined, open a SendGrid account for FREE at sendgrid.com.

Liquidator Contract Deployments

The liquidator contract (./contracts/OnChainLiquidator.sol) is deployed and verified. Any caller of the contract can initalize a liquidation and receive the resulting excess base asset tokens if a liquidation transaction is successful.

arbitrum: '0x18A715c11Cf4ed6A0cf94FCc93a290d4b2d14dD7'
polygon: '0xbf4555f5c127479b225332cd5520cd54c68f814c'
mainnet: '0xC70e2915f019e27BAA493972e4627dbc0ED7a794'

Test Run

This command will run the liquidation bot but it will not try to liquidate borrowers, it will use Alchemy to estimate the arbitrage transaction results using Alchemy Transact simulation (Asset Changes JSON RPC endpoint).

Polygon example:

ALCHEMY_KEY="YOUR_ALCHEMY_API_KEY" \
DEPLOYMENT="usdc" \
LIQUIDATOR_ADDRESS="0xbf4555f5c127479b225332cd5520cd54c68f814c" \
USE_FLASHBOTS="false" \
ETH_PK="YOUR_PRIVATE_EVM_ACCOUNT_KEY" \
TESTRUN="true" \
npx hardhat run scripts/liquidation_bot/index.ts --network polygon

Production Run

Same as above, simply remove the TESTRUN environment variable.

ALCHEMY_KEY="YOUR_ALCHEMY_API_KEY" \
DEPLOYMENT="usdc" \
LIQUIDATOR_ADDRESS="0xbf4555f5c127479b225332cd5520cd54c68f814c" \
USE_FLASHBOTS="false" \
ETH_PK="YOUR_PRIVATE_EVM_ACCOUNT_KEY" \
npx hardhat run scripts/liquidation_bot/index.ts --network polygon

comet-liquidator's People

Contributors

ajb413 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.