MCPcopy Index your code
hub / github.com/bonedaddy/go-defi

github.com/bonedaddy/go-defi @v0.0.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.4 ↗ · + Follow
828 symbols 1,506 edges 51 files 784 documented · 95% updated 4y agov0.0.4 · 2022-02-17★ 86
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

A golang sdk for working with DeFi protocols and general utilities for working with ethereum-compatible blockchains.

packages

  • bclient
  • bindings
  • cli
  • config
  • database
  • sushiswap
  • uniswap
  • testenv
  • utils

bclient

Provides a wrapper around the ethclient package

bindings

Provides code generated by abigen for working with smart contracts:

  • bindings/erc20 provides generated code for working with ERC20 contracts
  • bindings/oneinch/v2 provides generated code for working with OneInch V2 router contracts
  • bindings/oneinch/v3 provides generated code for working with OneInch V3 router contracts
  • unicrypt/presalefactory provides generated code for working with UniCrypt presale factories
  • uniswap/* provides generated code for working with Uniswap V2 contracts (note these can also be used for working with the corresponding sushiswap contracts)

cli

cli package

config

configuration management package

database

database management packlage

sushiswap

Wrapper around go-ethereum's ethclient package for using sushiswap v2.

uniswap

Wrapper around go-ethereum's ethclient package for using uniswap v2.

testenv

Provides a wrapper around the SimulatedBackend allowing for an in-memory blockchain. It is particularly useful for local smart contract development, or developing backend dApps.

utils

Provides utility functions including all goethereum book utils, a helper to make bind.TransactOpts safe for concurrent use, as well as a general Blockchain interface that satisfies all functions provided by simulated backend, as well as ethclient which is useful for drop-in replacement of actual RPC clients, and test environments.

examples

transaction matching

$> /go-defi txm --methods transfer --methods transferFrom --methods buy --contract.address 0x5ade7aE8660293F2ebfcEfaba91d141d72d221e8

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 567
Struct 155
Function 104
Interface 1
TypeAlias 1

Languages

Go100%

Modules by API surface

bindings/uniswap/pair/v2pair.go150 symbols
bindings/uniswap/router/bindings.go93 symbols
bindings/oneinch/v2/bindings.go88 symbols
bindings/uniswap/erc20/v2erc20.go76 symbols
bindings/oneinch/v3/bindings.go76 symbols
bindings/unicrypt/presalefactory/bindings.go67 symbols
bindings/erc20/bindings.go64 symbols
bindings/uniswap/factory/v2factory.go53 symbols
bindings/uniswap/callee/v2callee.go24 symbols
utils/blockchain.go17 symbols
config/config.go11 symbols
bclient/bclient.go11 symbols

For agents

$ claude mcp add go-defi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page