erc4626-patterns

Design and implement ERC-4626 compliant tokenized vaults with secure share math.

120|12|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ccashwell/evm-cortex --skill erc4626-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: erc4626-patterns
Source: https://github.com/ccashwell/evm-cortex/tree/main/skills/erc4626-patterns
Command: npx skills add https://github.com/ccashwell/evm-cortex --skill erc4626-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design and implement ERC-4626 compliant tokenized vaults that correctly manage deposits, withdrawals, and share calculations, while ensuring secure accounting and protection against common edge-case attacks.

Core Features & Use Cases

  • ERC-4626 interface coverage: asset(), totalAssets(), deposit/mint/withdraw/redeem, and preview functions.
  • Secure share math with rounding rules that favor the vault, including first-depositor attack mitigations.
  • Yield strategy integration patterns and ecosystem interoperability with OpenZeppelin-style vaults.
  • Use cases include building yield-bearing vaults for DeFi protocols, custodial vaults, and asset-backed tokenization workflows.

Quick Start

Apply ERC-4626 vault patterns to implement secure, compliant yield-bearing vaults.

Frequently Asked Questions about erc4626-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent the first depositor attack in an ERC-4626 vault?

To prevent the first depositor attack in an ERC-4626 vault, implement secure share math with rounding rules that favor the vault and apply first-depositor attack mitigations during initial minting.

What is the correct rounding direction for ERC-4626 deposit and withdraw functions?

The correct rounding direction for ERC-4626 vault operations requires calculations that favor the vault, ensuring deposits round shares down and withdrawals round assets down for secure accounting.

How do I implement yield strategy hooks in a tokenized vault?

You implement yield strategy hooks in a tokenized vault by integrating custom strategy patterns within deposit and withdraw flows, enabling asset management interoperability with OpenZeppelin-style vault architectures.

Can I use OpenZeppelin-style vaults for asset-backed tokenization workflows?

Yes, you can use OpenZeppelin-style vaults for asset-backed tokenization workflows by applying ERC-4626 compliant tokenized vault patterns that provide standard interfaces for custodial vaults and yield-bearing assets.

What preview functions are required for ERC-4626 interface coverage?

Required ERC-4626 preview functions include previewDeposit, previewMint, previewWithdraw, and previewRedeem, which calculate expected shares or assets before executing state-changing vault operations.

When do I need ERC-4626 vault patterns for DeFi protocol integration?

You need ERC-4626 vault patterns for DeFi protocol integration when building yield-bearing vaults requiring standardized deposit, withdraw, and share calculation interfaces to ensure secure accounting and cross-protocol interoperability.