
building-blocks
DeFi legos and protocol composability on Ethereum and L2s. Major protocols per chain — Aerodrome on Base, GMX/Pendle on Arbitrum, Velodrome on Optimism — plus mainnet primitives (Uniswap, Aave, Compound, Curve). How they work, how to build on them, and how to combine them. Use when building DeFi integrations, choosing protocols on a specific L2, designing yield strategies, or composing existing protocols into something new.
- Installs
- 41
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/austintgriffith/ethskills --skill building-blocks- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads building-blocks automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Building Blocks (DeFi Legos)
What You Probably Got Wrong
DeFi TVL: Check DeFi Llama for current Ethereum DeFi TVL. If you're quoting numbers from 2023-2024, they're stale.
Uniswap V4 is live. Launched mainnet January 31, 2025 on 10+ chains. V4 introduced a hooks system — custom logic attached to pools (dynamic fees, TWAMM, limit orders, custom oracles). This is the biggest composability upgrade since flash loans. PoolManager addresses are different per chain (NOT deterministic like V3).
Costs changed everything: A flash loan arbitrage on mainnet costs ~$0.05-0.50 in gas now (was $5-50). This opens composability patterns that were previously uneconomical.
The dominant DEX on each L2 is NOT Uniswap. Aerodrome and Velodrome merged into Aero (November 2025, Dromos Labs) — the unified DEX dominates both Base and Optimism. Camelot is a major native DEX on Arbitrum. Don't default to Uniswap on every chain.
Key Protocol Addresses (Verified Mar 2026)
| Protocol | Contract | Mainnet Address |
|---|---|---|
| Uniswap V2 Router | Router | 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D |
| Uniswap V2 Factory | Factory | 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f |
| Uniswap V3 Factory | Factory | 0x1F98431c8aD98523631AE4a59f267346ea31F984 |
| Uniswap V3 SwapRouter02 | Router | 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 |
| Uniswap V4 PoolManager | PoolManager | 0x000000000004444c5dc75cB358380D2e3dE08A90 |
| Uniswap Universal Router (V4) | Router | 0x66a9893cc07d91d95644aedd05d03f95e1dba8af |
| Aave V3 Pool | Pool | 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2 |
See addresses/SKILL.md for complete multi-chain address list including L2-native protocols (Aerodrome, GMX, Pendle, Velodrome, Camelot, SyncSwap, Morpho).
Uniswap V4 Hooks (New)
Hooks let you add custom logic that runs before/after swaps, liquidity changes, and donations. This is the biggest composability upgrade since flash loans.
Hook Interface (Solidity)
import {BaseHook} from "v4-periphery/src/utils/BaseHook.sol";
import {IPoolManager} from "v4-core/interfaces/IPoolManager.sol";
import {PoolKey} from "v4-core/types/PoolKey.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "v4-core/types/BeforeSwapDelta.sol";
contract DynamicFeeHook is BaseHook {
constructor(IPoolManager _manager) BaseHook(_manager) {}
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
return Hooks.Permissions({
beforeInitialize: false,
afterInitialize: false,
beforeAddLiquidity: false,
afterAddLiquidity: false,
beforeRemoveLiquidity: false,
afterRemoveLiquidity: false,
beforeSwap: true, // ← We hook here
afterSwap: false,
beforeDonate: false,
afterDonate: false,
beforeSwapReturnDelta: false,
afterSwapReturnDelta: false,
afterAddLiquidityReturnDelta: false,
afterRemoveLiquidityReturnDelta: false
});
}
// Dynamic fee: higher fee during high-volume periods
function beforeSwap(
address,
PoolKey calldata key,
IPoolManager.SwapParams calldata params,
bytes calldata
) external override returns (bytes4, BeforeSwapDelta, uint24) {
// Return dynamic fee override (e.g., 0.05% normally, 0.30% during volatility)
uint24 fee = _isHighVolatility() ? 3000 : 500;
return (this.beforeSwap.selector, BeforeSwapDeltaLibrary.ZERO_DELTA, fee | 0x800000);
}
}
Hook use cases with real code patterns:
- Dynamic fees — adjust based on volatility, time-of-day, or oracle data
- TWAMM — split large orders over time to reduce price impact
- Limit orders — execute when price crosses a threshold
- MEV protection — auction swap ordering rights to searchers
- Custom oracles — TWAP updated on every swap
Composability Patterns (Updated for 2026 Gas)
These patterns are now economically viable even for small amounts due to sub-dollar gas:
Flash Loan Arbitrage
Borrow from Aave → swap on Uniswap for profit → repay Aave. All in one transaction. If unprofitable, reverts (lose only gas: ~$0.05-0.50).
Leveraged Yield Farming
Deposit ETH on Aave → borrow stablecoin → swap for more ETH → deposit again → repeat. Gas cost per loop: ~$0.02 on mainnet, negligible on L2.
Meta-Aggregation
Route swaps across multiple DEXs for best execution. 1inch and Paraswap check Uniswap, Curve, Sushi simultaneously.
ERC-4626 Yield Vaults
Standard vault interface — the "ERC-20 of yield." Every vault exposes the same functions regardless of strategy.
import {ERC4626} from "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";
import {ERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract SimpleYieldVault is ERC4626 {
constructor(IERC20 asset_)
ERC4626(asset_)
ERC20("Vault Shares", "vSHARE")
{}
// totalAssets() drives the share price
// As yield accrues, totalAssets grows → shares worth more
function totalAssets() public view override returns (uint256) {
return IERC20(asset()).balanceOf(address(this)) + _getAccruedYield();
}
}
// Usage: deposit/withdraw are standardized
// vault.deposit(1000e6, msg.sender); // deposit 1000 USDC, get shares
// vault.redeem(shares, msg.sender, msg.sender); // burn shares, get USDC back
// vault.convertToAssets(shares); // how much USDC are my shares worth?
Why ERC-4626 matters: Composability. Any protocol can integrate any vault without custom adapters. Yearn V3, Aave's wrapped tokens, Morpho vaults, Pendle yield tokens — all ERC-4626.
Flash Loan (Aave V3 — Complete Pattern)
import {FlashLoanSimpleReceiverBase} from
"@aave/v3-core/contracts/flashloan-v3/base/FlashLoanSimpleReceiverBase.sol";
import {IPoolAddressesProvider} from
"@aave/v3-core/contracts/interfaces/IPoolAddressesProvider.sol";
contract FlashLoanArb is FlashLoanSimpleReceiverBase {
constructor(IPoolAddressesProvider provider)
FlashLoanSimpleReceiverBase(provider) {}
function executeArb(address token, uint256 amount) external {
// Borrow `amount` of `token` — must repay + 0.05% fee in same tx
POOL.flashLoanSimple(address(this), token, amount, "", 0);
}
function executeOperation(
address asset,
uint256 amount,
uint256 premium, // 0.05% fee
address,
bytes calldata
) external override returns (bool) {
// --- Your arbitrage logic here ---
// Buy cheap on DEX A, sell expensive on DEX B
// Must end with at least `amount + premium` of `asset`
uint256 owed = amount + premium;
IERC20(asset).approve(address(POOL), owed);
return true; // If unprofitable, revert here — lose only gas (~$0.05-0.50)
}
}
Aave V3 Pool (mainnet): 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2
Flash loan fee: 0.05% (5 basis points). Free if you repay to an Aave debt position.
Building on Base
Dominant DEX: Aero (formerly Aerodrome, ~$500-600M TVL) — NOT Uniswap. In November 2025, Dromos Labs merged Aerodrome (Base) and Velodrome (Optimism) into a unified cross-chain DEX called Aero. Same contracts, same ve(3,3) model, new brand.
How Aero Works (Critical Difference from Uniswap)
- LPs deposit tokens into pools → earn AERO emissions (not trading fees!)
- veAERO voters lock AERO → vote on which pools get emissions → earn 100% of trading fees + bribes
- This is the opposite of Uniswap where LPs earn fees directly
- Flywheel: Pools generating most fees → attract most votes → get most emissions → attract more LPs → deeper liquidity → more fees
Aerodrome Swap (Router Interface)
// Aerodrome Router: 0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43 (Base)
struct Route {
address from;
address to;
bool stable; // true = stable pair (like Curve), false = volatile (like Uni V2)
address factory; // 0x420DD381b31aEf6683db6B902084cB0FFECe40Da
}
// Swap via Router
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
Route[] calldata routes,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
Base-Specific Patterns
- Coinbase Smart Wallet — ERC-4337 wallet, passkey auth, gasless txs via Coinbase paymaster
- Farcaster Frames v2 — mini-apps embedded in social posts that trigger onchain actions
- AgentKit — Coinbase's framework for AI agents to interact onchain
Building on Arbitrum (Highest DeFi Liquidity)
GMX V2 — How GM Pools Work
- Each market has its own isolated pool (unlike V1's single GLP pool)
- LPs deposit into GM (liquidity) pools → receive GM tokens
- Fully Backed markets: ETH/USD backed by ETH + USDC. Backing tokens match the traded asset.
- Synthetic markets: DOGE/USD backed by ETH + USDC. Uses ADL (Auto-Deleveraging) when thresholds are reached.
- LPs earn: trading fees, liquidation fees, borrowing fees, swap fees. But bear risk from trader PnL.
Pendle — Yield Tokenization
Pendle splits yield-bearing assets into principal and yield components:
- SY (Standardized Yield): Wraps any yield-bearing asset. E.g., wstETH → SY-wstETH.
- PT (Principal Token): The principal. Redeemable 1:1 at maturity. Trades at a discount (discount = implied yield).
- YT (Yield Token): All yield until maturity. Value decays to 0 at maturity.
- Core invariant:
SY_value = PT_value + YT_value
Use cases:
- Buy PT at discount = lock in fixed yield (like a zero-coupon bond)
- Buy YT = leverage your yield exposure (bet yield goes up)
- LP in Pendle pools = earn trading fees + PENDLE incentives
Arbitrum-Specific Tech
- Stylus: Write smart contracts in Rust/C++/WASM alongside EVM (10-100x gas savings for compute-heavy operations)
- Orbit: Launch custom L3 chains (47 live on mainnet)
See addresses/SKILL.md for all verified protocol addresses (GMX, Pendle, Camelot, Aerodrome, Velodrome, SyncSwap, Morpho).
Discovery Resources
- DeFi Llama: https://defillama.com — TVL rankings, yield rankings, all chains
- Dune Analytics: https://dune.com — query onchain data
- ethereum.org/en/dapps/ — curated list
Guardrails for Composability
- Every protocol you compose with is a dependency. If Aave gets hacked, your vault depending on Aave is affected.
- Oracle manipulation = exploits. Verify oracle sources.
- Impermanent loss is real for AMM LPs. Quantify it before providing liquidity.
- The interaction between two safe contracts can create unsafe behavior. Audit compositions.
- Start with small amounts. Test with minimal value before scaling.
- Flash loan attacks can manipulate prices within a single transaction. Design for this.
FAQ
What does the building-blocks skill do?
DeFi legos and protocol composability on Ethereum and L2s. Major protocols per chain — Aerodrome on Base, GMX/Pendle on Arbitrum, Velodrome on Optimism — plus mainnet primitives (Uniswap, Aave, Compound, Curve). How they work, how to build on them, and how to combine them. Use when building DeFi integrations, choosing protocols on a specific L2, designing yield strategies, or composing existing protocols into something new.
How do I install building-blocks?
Run npx skills add https://github.com/austintgriffith/ethskills --skill building-blocks in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/building-blocks/ (personal) or .claude/skills/building-blocks/ (project).
Which AI agents can use building-blocks?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is building-blocks safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains building-blocks?
It is published by austintgriffith in austintgriffith/ethskills. It has 41 recorded installs.
More from austintgriffith/ethskills
ethskills
austintgriffith/ethskills
Use when a request involves Ethereum, the EVM, or blockchain systems. Applies to building, auditing, deploying, or interacting with smart contracts, dApps, wallets, or DeFi protocols. Covers Solidity development, contract addresses, token standards (ERC-20, ERC-721, ERC-4626, etc.), Layer 2 networks (Base, Arbitrum, Optimism, zkSync, Polygon), and integrations with DeFi protocols such as Uniswap, Aave, and Curve. Includes topics such as gas costs, contract decimals, oracle safety, reentrancy, MEV, bridging, wallets, querying data from onchain, production deployment, and protocol evolution (EIP lifecycle, fork tracking, upcoming changes).
concepts
austintgriffith/ethskills
Use when designing or explaining anything onchain that has to keep working with nobody running it: who calls each function and why they would, where randomness comes from, whether it can be censored or paused, and what it exposes to everyone onchain. Also use when writing the notes or handoff a build ends with, or when explaining to your human how something onchain actually works. Not for scoping which parts go onchain and the launch plan (/ship) or the safety of the contract code itself (/security).
Popular business & finance skills
sales-enablement
coreyhaines31/marketingskills
When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),
revops
coreyhaines31/marketingskills
When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.
sales-funnel-blueprint
autonnel/autonnel-skills
Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.
pricing
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.
cross-border-ecommerce
nexscope-ai/ecommerce-skills
Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.
pricing-strategy
coreyhaines31/marketingskills
When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.