Repository navigation
feat(erc): add compiled ERC-4626 tokenized vault ABI - #206
Merged
Merged
Conversation
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>
Contributor
Author
|
CI status, so the red is not mistaken for this PR:
This PR touches only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Adds the compiled
ERC4626Abifor 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
vaultaddress parameter vs manifest-time instantiation vs curated per-package catalogs). That is theneeds-designhalf. It can settle in a follow-up on top of this ABI without being blocked on it.contracts/IERC4626.solis the source of truth. It extendsIERC20because 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 theDepositandWithdrawevents.IERC4626.sol/**is added to the wagmi include list andsrc/abis/erc.tsis regenerated withpnpm 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
Framework and package impact
One new public export from
@themoss/erc:ERC4626Abi, a viem-typedas constABI. 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 buildpnpm typecheckpnpm lintpnpm test(see note)Note on tests: run in a sandbox, so I ran
pnpm test:offlineacross the workspace (green) plus the full@themoss/ercsuite 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/ercand 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:transfer,approve,balanceOf,totalSupply,decimals) and theTransfer,Approval,Deposit,Withdrawevents are all present;depositandredeemcalldata round-trips throughencodeFunctionData/decodeFunctionDatawith the expected 4-byte selectors;DepositandWithdrawlogs decode with the correct indexed topics and non-indexedassets/shares.ABI regeneration is deterministic: re-running
pnpm gen:abisproduces byte-identical output. Generatedsrc/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/erctest suite (25 passed, including a live Monad-mainnet case) and the workspacepnpm test:offlinesuite, all green. The EIP-4626 interface was checked against the spec text.