Skip to content

feat(erc): add compiled ERC-4626 tokenized vault ABI - #206

Merged
nishuzumi merged 2 commits into
nishuzumi:mainfrom
zkasuran:feat/erc4626-abi
Oct 10, 2026
Merged

nishuzumi merged 2 commits into
nishuzumi:mainfrom
zkasuran:feat/erc4626-abi

Conversation

@zkasuran

@zkasuran zkasuran commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Adds the compiled ERC4626Abi for EIP-4626 tokenized vaults to @themoss/erc. ERC-4626 is the standard under most lending and yield vaults on Monad (Morpho MetaMorpho, Euler EVK), so the interface layer should own its ABI in the compiled tier (ADR 0007).

This is the ABI slice #13 records as landable on its own first. It does not decide the vault-identity composition model (generic vault address parameter vs manifest-time instantiation vs curated per-package catalogs). That is the needs-design half. It can settle in a follow-up on top of this ABI without being blocked on it.

contracts/IERC4626.sol is the source of truth. It extends IERC20 because a vault's shares are themselves an ERC-20 token, so the generated ABI covers the vault surface and the share-token surface together, plus the Deposit and Withdraw events. IERC4626.sol/** is added to the wagmi include list and src/abis/erc.ts is regenerated with pnpm gen:abis (forge + @wagmi/cli), so the artifact is compiled rather than hand-written. The interface was checked against the EIP-4626 text for signatures, mutability and event indexing.

Part of #13.

Type of change

  • Tooling / dependency
  • Protocol / Capability / Query
  • Core / simulator / MCP server
  • Bug fix
  • Documentation / example

Framework and package impact

One new public export from @themoss/erc: ERC4626Abi, a viem-typed as const ABI. No change to any Protocol, Capability tree, Change or Receipt behavior. No new addresses. No runtime code, only the compiled interface and its export.

Verification

  • pnpm build
  • pnpm typecheck
  • pnpm lint
  • pnpm test (see note)
  • User-facing package changes include a changeset
  • Docs and examples match the implemented API

Note on tests: run in a sandbox, so I ran pnpm test:offline across the workspace (green) plus the full @themoss/erc suite including its live Monad-mainnet ERC-1155 case (25 passed). I did not run the whole live e2e suite for the other protocol packages. This change is ABI-only in @themoss/erc and adds no address or Protocol, so there is no new live path to exercise.

Protocol changes

N/A. No Protocol, Capability, Query or Receipt in this PR.

Evidence

New test/erc4626.test.ts (6 tests) locks the compiled ABI against source drift:

  • every EIP-4626 function is present with the standard parameter types, mutability and return types;
  • the inherited ERC-20 share-token surface (transfer, approve, balanceOf, totalSupply, decimals) and the Transfer, Approval, Deposit, Withdraw events are all present;
  • deposit and redeem calldata round-trips through encodeFunctionData/decodeFunctionData with the expected 4-byte selectors;
  • Deposit and Withdraw logs decode with the correct indexed topics and non-indexed assets/shares.

ABI regeneration is deterministic: re-running pnpm gen:abis produces byte-identical output. Generated src/abis/** stays excluded from the formatter.


AI assistance (Claude, Anthropic) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting: pnpm lint, pnpm build, pnpm typecheck, the full @themoss/erc test suite (25 passed, including a live Monad-mainnet case) and the workspace pnpm test:offline suite, all green. The EIP-4626 interface was checked against the spec text.

zkasuran and others added 2 commits September 22, 2026 15:48
EIP-4626 is the standard under most lending and yield vaults on Monad
(Morpho MetaMorpho, Euler EVK). Add it to the interface layer's compiled
tier (ADR 0007).

contracts/IERC4626.sol is the source of truth. It extends IERC20, so the
generated ABI covers the vault surface (asset, totalAssets, convertTo*,
and the deposit/mint/withdraw/redeem flows with their max/preview reads)
together with the ERC-20 share-token surface and the Deposit and Withdraw
events. Regenerated with pnpm gen:abis (forge + @wagmi/cli), exported as
ERC4626Abi beside the other standard ABIs.

Scoped to the compiled ABI, which the issue records as landable on its own
first. The vault-identity composition model is left for a follow-up.

Part of nishuzumi#13

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Biome's lint/complexity/useOptionalChain fails the CI lint step, which
treats warnings as errors. Rewrite the function-item guard as item?.type
so the file lints clean under `biome ci`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@zkasuran

Copy link
Copy Markdown
Contributor Author

CI status, so the red is not mistaken for this PR:

This PR touches only @themoss/erc (a compiled ABI and its export) and adds no Kuru code.

@nishuzumi
nishuzumi merged commit 70f5395 into nishuzumi:main Oct 10, 2026
1 of 2 checks passed
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.

2 participants