web3-ethereum-defi

repository·master·Indexed 21 days ago

https://github.com/tradingstrategy-ai/web3-ethereum-defi

A Pythonic interface for interacting with EVM-compatible Web3 and DeFi protocols, designed for automation, data analysis, and AI agent integration. Version 1.1 includes GuardV0, an on-chain trade validation smart contract for asset management that enforces security via sender, call-site, asset, and receiver whitelisting. It supports protocols such as Aave V3, ERC-4626, GMX V2, and Hypercore, and provides a TradingStrategyModuleV0 Zodiac-module for Gnosis Safe multisignature wallets.

Tokens
215.7K
Snippets
506
Records
971
Agent score
72%

What's inside web3-ethereum-defi

  1. Overview of Frax vault families

    master

    The Frax adapter supports two distinct product families: Fraxlend and Staking vaults. While both report the protocol name Frax, they have different fee structures and underlying implementations.

    Supported Chains

    • Fraxlend: Ethereum and Arbitrum.
    • Staking vaults: Ethereum.

    Product Details

    Fraxlend

    • Mechanism: Fraxlend pairs use an internalised fee model. The protocol mints shares to itself, diluting lenders as interest accrues.
    • Fees: The adapter reads the protocol share of lender interest revenue on-chain via the currentRateInfo() method, as this value varies by pair.
    • Example Pair: 0x0601b72bef2b3f09e9f48b7d60a8d7d2d3800c6e (Ethereum).

    Staking Vaults

    • Mechanism: Includes sFRAX and sfrxUSD vaults.
    • Fees: These vaults are reported as feeless. Specifically, sfrxUSD has no staking or unstaking fees.
    • Example Addresses:
      • 0x03cb4438d015b9646d666316b617a694410c216d (Ethereum)
      • 0xa663b02cf0a4b149d2ad41910cb81e23e1c41c32 (Ethereum)
      • 0xcf62f905562626cfcdd2261162a51fd02fc9c5b6 (Ethereum)
  2. Overview of Core3 Projects Data API

    master

    Core3 (formerly CER.live) is a risk intelligence platform providing a standardized Probability of Loss (PoL) metric for crypto projects and exchanges. The PoL score ranges from 0 (Exceptional) to 100 (Critical risk).

    API Details

    • Type: REST / JSON (Read-only GET endpoints)
    • Base URL: https://api.core3.io/projects_data/v1
    • Authentication: Requires an x-api-key header (keys prefixed with core3_).
    • Environment Variable: CORE3_API_KEY
    • Requirement: A User-Agent header must be provided to avoid Cloudflare 403/1010 errors.
    • Coverage: Approximately 1,427 crypto projects.
  3. Overview of the High-frequency (HF) Hyperliquid vault data fetcher

    master

    The High-frequency (HF) pipeline is a specialized data collector for Hyperliquid vaults designed for responsive PnL tracking. Unlike the standard daily pipeline which produces one data point per vault per day, the HF pipeline captures metrics (share prices, TVL, cumulative PnL, and deposit/withdrawal flows) at the finest resolution provided by the Hyperliquid API (approximately every 20 minutes).

    Key characteristics:

    • Resolution: Captures intra-day volatility by storing raw API timestamps instead of truncating to dates.
    • Storage: Uses a separate DuckDB database (hyperliquid-vaults-hf.duckdb) with a vault_high_freq_prices table.
    • Resilience: Uses a >= timestamp comparison during polling to ensure no data gaps occur if a cycle is missed, and to refresh corrected values.
    • Parallelism: Employs a proxy-aware session pool to bypass Hyperliquid's rate limits (1200 weight/min/IP) using Webshare rotating proxies.
  4. Overview of the Hyperliquid native vault metrics pipeline

    master

    The Hyperliquid native vault metrics pipeline scans non-EVM Hyperliquid vaults, records synthetic scanner prices, and merges this data into the existing ERC-4626 vault metrics pipeline. This allows vault-analysis-json.py to produce a single unified JSON output containing both EVM and Hyperliquid vault data.

    Key processing steps:

    • Raw scanner prices are replaced by a conservative PnL/NAV economic-performance index via process_raw_vault_scan_data().
    • Current public positions are attached to the price frame using a generic temporal join.
    • perp_metrics_observed_at preserves one-second-resolution measurement times for raw and cleaned Parquet files.
  5. Overview of the ApeX native vault reader

    master

    The ApeX native vault reader is a read-only integration that scrapes metadata, current observations, and recoverable history for all native ApeX Omni vaults via their public web API.

    Key Characteristics:

    • Read-Only: No authentication, private data, trading, deposits, or withdrawals are performed.
    • Storage: Data is stored in a DuckDB database located at ~/.tradingstrategy/vaults/apex-vaults.duckdb.
    • Identity Model: Uses the platform's string vaultId as the primary database identity. It generates a stable synthetic address in the format apex-vault-{vaultId}.
    • Warning: Do not use the vaultEthAddress as a unique identifier, as multiple platform vaultIds may share the same Ethereum address.
    • Chain Context: Uses synthetic chain ID 9995 (APEX_CHAIN_ID).
  6. Overview of the Feed post collection submodule

    master
    The eth_defi/feed submodule is responsible for collecting, parsing, and storing social media and RSS/Atom posts related to DeFi protocols. It handles URL normalization, duplicate detection, text cleaning, and idempotent data storage using DuckDB. The system is designed to be extensible for future features like AI summarization and post-to-vault matching.
  7. Overview of the Feed Post Collection Submodule

    master

    The Feed Post Collection submodule is a tool for gathering vault-related information from public web sources. It collects posts from RSS feeds, Twitter/X usernames, and LinkedIn company feeds, normalizes them into a standard format, and stores them in a DuckDB database for analysis.

    Key capabilities:

    • Normalization: Converts diverse social and RSS data into a shared post format.
    • Storage: Uses DuckDB to manage tracked_sources and posts.
    • Idempotency: Ensures repeated collection runs only insert new posts.
    • Metadata Support: Allows attaching company websites and descriptions to feeders.

    Current Limitations:

    • It is currently collection-only. It does not yet perform vault matching or generate AI summaries.
  8. Overview of the Lighter native pool metrics pipeline

    master

    The Lighter native pool metrics pipeline scans Lighter DEX deployments on both Ethereum and Robinhood Chain. It fetches native pool (vault) share price history via public REST APIs and integrates this data into the existing ERC-4626 vault metrics pipeline. This integration allows vault-analysis-json.py to generate a unified JSON output containing data for EVM, Hyperliquid, GRVT, and Lighter pools.

    Key characteristics:

    • No authentication required: All data is retrieved from public endpoints.
    • Data Cleaning: Lighter data is processed through the standard process_raw_vault_scan_data() cleaning pipeline used for EVM vaults.
  9. Epoch RWA logo assets

    master

    The epoch-rwa vault includes original logo assets extracted from the official Epoch RWA website.

    • epoch-rwa.generic.ico: The square, transparent favicon used by the site.
    • epoch-rwa.generic.svg: The vector logo artwork (note: the source artwork is a cropped, low-opacity decorative variant).
    • Formatted PNGs: 256x256 PNG versions were generated from the favicon using the scripts/logos/post-process-logo.py utility.
  10. Identify infiniFi logo sources and assets

    master

    The infinifi protocol logo assets are primarily sourced from the Coingecko API, specifically using the iUSD token logo. The logo is described as a stylized infinity symbol.

    Available Files:

    • infinifi.generic.jpg: Generic infiniFi logo (250x250 JPEG)

    Primary Source:

    • Coingecko API: https://api.coingecko.com/api/v3/coins/infinifi-usd
    • Direct Image URL: https://coin-images.coingecko.com/coins/images/67385/large/iusd.jpg
  11. Access Avant Protocol brand assets and logos

    master

    The avant vault contains official brand assets for the Avant Protocol. These assets include various formats (SVG, PNG) for different use cases such as main logos, icons, and favicons.

    Available Files

    • avant.generic.svg: Main logo
    • avant.generic.png: Large icon
    • avant.light.svg: White/light variant
    • avant.icon.svg: Icon only
    • avant.favicon.png: Favicon (64x64)

    Brand Guidelines

    When using these assets, adhere to the following rules from the official brand kit:

    • Do not alter colours, proportions, or orientation.
    • Avoid adding effects like shadows or gradients that are not part of the original design.