Skip to content

chore: initial repo skeleton + 14-protocol catalog seed#1

Merged
chrisli30 merged 2 commits into
mainfrom
chore/initial-setup
May 29, 2026
Merged

chore: initial repo skeleton + 14-protocol catalog seed#1
chrisli30 merged 2 commits into
mainfrom
chore/initial-setup

Conversation

@chrisli30
Copy link
Copy Markdown
Member

Summary

Bootstraps @avaprotocol/protocols as a standalone npm package — the data-only DeFi catalog (addresses, ABI fragments, event topic hashes) extracted from @avaprotocol/sdk-js@4.0.0-dev.2.

Cross-repo conversation between sdk-js, context-memory, and studio concluded that the catalog should ship as a separate public package both repos depend on rather than each maintaining its own copy. Background:

  • AAVE template e2e tests in sdk-js were re-typing the same Pool address + ABI per file.
  • context-memory needed the same map for human-readable contract labels (see AvaProtocol/context-memory#20).
  • Studio's protocol catalog has UI metadata (slug/label/description) that doesn't belong in partner SDKs.

A standalone package (this repo) is the natural home — public so partner SDKs in Python/Rust can consume the JSON, narrow surface so it stays light, single source of truth.

What's in this PR

  • Repo skeleton: package.json, dual tsconfig.json (editor) + tsconfig.build.json (declaration emit), .gitignore, MIT LICENSE.
  • Source (src/): chains.ts (EIP-155 ID constants), index.ts (top-level export), protocols/ (14 protocol modules + shared common.ts + erc20.ts + types.ts + index.ts namespacing).
  • Tests (tests/catalog.test.ts): 15 tests covering namespace surface, address/topic shape, per-protocol completeness, cross-chain coverage parity, shared-ABI reference identity.
  • CI (.github/workflows/ci.yml): typecheck + test + build + tarball verification on Node 18/20/22.
  • README: usage, supported protocols table, design principles, comparison with adjacent projects (bgd-labs/aave-address-book, Uniswap sdk-core, blockchain-addressbook, TokenLists), contribution guide, versioning policy.

Surface

import { Protocols, Chains } from "@avaprotocol/protocols";

const pool = Protocols.aaveV3.pool[Chains.Sepolia];
// "0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951"

const abi  = Protocols.uniswapV3.swapRouter02Abi;
// readonly AbiFragment[] with exactInputSingle + exactOutputSingle

const sig  = Protocols.aaveV3.eventTopics.Borrow;
// 0xb3d084820fb1a9decffb176436bd02558d15fac9b0ddfed8c465bc7359d7dce0

14 protocols × 4–5 chains × addresses + curated ABI fragments + event topic hashes. Full table in README.md.

Package shape

  • Dual CJS (dist/index.cjs) + ESM (dist/index.js) + full .d.ts
  • Tarball: 45 files, 14.7 kB
  • Node 18+ — no Node-specific runtime; works in browsers + workers
  • MIT, public npm access
  • Type exports: Chains, ChainId, Protocols, AbiFragment, AddressByChain, aggregatorV3Abi, erc4626VaultAbi

Test plan

  • yarn typecheck — clean
  • yarn test:run — 15/15 pass
  • yarn build — emits dist/index.cjs (27.4 KB) + dist/index.js (25.9 KB) + nested .d.ts
  • CJS smoke: requires + resolves Protocols / Chains
  • ESM smoke: imports + resolves Protocols / Chains
  • npm pack --dry-run — tarball contents include dist/ recursively, README, LICENSE
  • Once merged + published as 0.1.0 (or dev tag), bump @avaprotocol/sdk-js to consume from here and drop the duplicate src/v4/protocols/ tree.
  • Bump context-memory to optionally consume the address map for label resolution (currently inlined per AvaProtocol/context-memory#20).

🤖 Generated with Claude Code

Bootstraps @avaprotocol/protocols as a standalone npm package. Ships
the static-data DeFi catalog (addresses, ABI fragments, event topic
hashes) that previously lived inside @avaprotocol/sdk-js@4.0.0-dev.2
at packages/sdk-js/src/v4/protocols/. Extracted unchanged at the
data level; doc comments rewritten for standalone context.

Protocols covered (14 + shared ERC-20 helper):
  - aaveV3       Pool/Oracle/wethGateway × 4 chains + ABI + topics
  - aerodrome    Router on Base
  - chainlink    ETH/USD + BTC/USD feeds + AggregatorV3 ABI
  - compoundV3   USDC Comet on mainnet + Base
  - ethena       sUSDe vault + USDe + custom (cooldown) ABI
  - fraxEther    sfrxETH vault + frxETH + ERC-4626 ABI
  - lido         wstETH × 2 + stETH + L1 wrap/unwrap ABI
  - morphoBlue   Singleton on mainnet + Base + MarketParams ABI
  - rocketPool   rETH × 2 chains + L1 burn/rate/value ABI
  - sky          sDAI vault + ERC-4626 ABI
  - spark        SparkLend Pool (AAVE V3 fork)
  - superfluid   CFAv1Forwarder × 2 + setFlowrate/createFlow ABI
  - uniswapV3    Router/Quoter/Permit2/Factory/PM/UR × 4 + ABIs
  - wrapped      WETH × 4 chains + WETH9 ABI
  - erc20        Standard approve fragment

Shared ABIs in common.ts:
  - aggregatorV3Abi  Any Chainlink-compatible price feed
  - erc4626VaultAbi  Standard ERC-4626 vault (Frax sfrxETH, Sky sDAI)

Package shape:
  - Dual CJS (.cjs) + ESM (.js) + .d.ts via tsup + tsc
  - Built tarball: 45 files, 14.7 kB
  - Node 18+, MIT, public access on npm
  - Type imports surface: `Chains`, `ChainId`, `Protocols`,
    `AbiFragment`, `AddressByChain`, `aggregatorV3Abi`,
    `erc4626VaultAbi`

Infra:
  - tsconfig.json (root) for editor/dev mode, tsconfig.build.json
    pinning rootDir=src/outDir=dist for declaration emit
  - vitest @ 1.6
  - GitHub Actions CI: typecheck + test + build + tarball
    verification on Node 18/20/22

Tests (15/15 pass):
  - Namespace surface (every protocol enumerated + frozen)
  - Address shape (every 0x[40-hex] across the catalog)
  - Event-topic shape (32-byte keccak hashes)
  - AAVE V3 per-chain Pool coverage + Pool method ABI completeness
    + Borrow event ABI/topic lockstep
  - Uniswap V3 per-chain SwapRouter02 + exactInputSingle/
    exactOutputSingle + Permit2 same-address invariant
  - Shared ABI references stay object-identical across protocol
    modules (Frax/Sky share the same erc4626VaultAbi instance)
  - Cross-chain coverage parity (AAVE Pool/Oracle/Gateway all
    cover the same chain set; Uniswap Router/Factory match)
EOF
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 29, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedvitest@​1.6.1961007998100
Addedtsup@​8.5.1981009583100
Addedtypescript@​5.9.3100100909590

View full report

tsup with package.json "type": "module" emits ESM as index.js and
CJS as index.cjs — verify those, not the legacy index.mjs that doesn't
exist. The exports map already points at the correct filenames; this
just brings the CI check in line.
@chrisli30 chrisli30 merged commit 1774435 into main May 29, 2026
6 checks passed
@chrisli30 chrisli30 deleted the chore/initial-setup branch May 29, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant