go-defi

module
v2.0.0-...-7e5f7d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2023 License: Apache-2.0

README

go-defi

Based on https://github.com/bonedaddy/go-compound

go-defi is a Golang client, and library for interacting with the Defi API protocols Aave and Compound.Finance, and interacting with their contracts, allowing for the creation of bots trading with the Aave/Compound protocol.

WARNING: this code deals with money both by making blockchain calls and returning information that can be used to lose/gain money. Please use cautiously and dont come complaining if you end up losing money.

Contents

  • abi contains json abi definitions for various compound smart contracts
  • bindigns contains abigen generated golang bindings for the various abi's
  • client contains a client library to build applications that use the Aave/Compound API and interact with the smart contracts
  • cmd contains a small command-line client
  • models contains Golang types for the various responses that the API gives. Currently it has types for CTokenService and AccountService responses.
  • pb contains protobuf definitions for the compound APIs. Do not use
  • sampler contains sampler configurations to enable console based monitoring of your compound accounts

Current Capabilities

APIs

Client Library

  • Access to APIs via Golang programs, and not having to deal with raw http calls
  • Watch account health, signalling and printing on different account health states
  • Retrieve supply interest earned for a particular token
  • Retrieve total supply interest earned
  • Retrieve borrow interest owed for a particular token
  • Borrow from any compound contract
  • Get borrow rate for any compound contract
  • Retrieve list of liquidatable addresses
  • Mint tokens
  • Withdraw tokens
  • Other methods

CLI

  • Pretty print full AccountService::AccountResponse information, suitable for piping to jq
  • Retrieve account health
  • Retrieve supply interest earned for a particular token
  • Retrieve total supply interest earned
  • Retrieve borrow interest owed for a particular token
  • Retrieve a list of addresses that can be liquidated

Monitoring

  • Enables monitoring your account with sampler.
  • Default sampler config located in sampler/sampler.yml however you'll need to replace the addresses as needed.

Long Term Goals

  • Enable persisting retrieve data locally in a DB for fast lookups
  • Enable report generation of your holdings
  • Enable the MarketHistoryService API
  • Enable graphing of MarketHistoryService metrics
  • Enable arbitrage between uniswap and compound
    • Enable things like spotting interest rate arbitrages
    • Repayment arbitrages
    • ???

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL