Files
calctext/_bmad-output/implementation-artifacts/12-5-built-in-plugin-crypto-and-defi.md
2026-03-16 19:54:53 -04:00

48 lines
1.8 KiB
Markdown

---
epic: 12
story: 12.5
title: "Built-in Plugin: Crypto & DeFi"
status: draft
---
## Epic 12 — Plugin & Extension System
**Goal:** Let power users extend CalcPad.
### Story 12.5: Built-in Plugin: Crypto & DeFi
As a crypto-focused user,
I want to query cryptocurrency prices and DeFi protocol data in CalcPad expressions,
So that I can incorporate live blockchain data into my calculations.
**Acceptance Criteria:**
**Given** a user types `ETH gas price` in a sheet
**When** the expression is evaluated
**Then** the current Ethereum gas price is fetched (from an API such as Etherscan or similar)
**And** the result is displayed in gwei (e.g., `25 gwei`)
**Given** a user types `AAVE lending rate` in a sheet
**When** the expression is evaluated
**Then** the current AAVE lending rate is fetched from DeFi Llama or the AAVE API
**And** the result is displayed as a percentage (e.g., `3.45%`)
**Given** crypto price data is sourced from CoinGecko
**When** a user types `BTC price` or `ETH price`
**Then** the current market price is returned in USD (or user's preferred currency)
**And** the data source is CoinGecko's public API
**Given** DeFi protocol data is sourced from DeFi Llama
**When** a user queries lending rates, TVL, or yield data
**Then** the data is fetched from DeFi Llama's API
**And** the result is formatted appropriately (percentage for rates, currency for TVL)
**Given** the API is unreachable or rate-limited
**When** a user queries crypto or DeFi data
**Then** a cached value is used if available (with a staleness indicator)
**And** if no cached value exists, an error message indicates the data source is unavailable
**Given** a user types an unsupported token or protocol name
**When** the expression is evaluated
**Then** an error message indicates the token or protocol was not recognized
**And** suggestions for similar valid names are shown if possible