Skip to content

feat(blue-sdk): accrue nested Vault V2 entities to a single timestamp - #911

Draft
Foulks-Plb wants to merge 2 commits into
mainfrom
kingstown
Draft

feat(blue-sdk): accrue nested Vault V2 entities to a single timestamp#911
Foulks-Plb wants to merge 2 commits into
mainfrom
kingstown

Conversation

@Foulks-Plb

Copy link
Copy Markdown
Contributor

Motivation

AccrualVaultV2.accrueInterest advanced only vault-level accounting while leaving its nested adapters, markets, and positions at their pre-accrual lastUpdate — so the returned entity graph was internally inconsistent and diverged from MetaMorpho V1 (AccrualVault.accrueInterest), which accrues its nested positions.

Solution

Accrue every underlying adapter and the liquidity adapter (and, transitively, their markets / positions / nested V1 vault) to the same timestamp, so the whole returned graph shares one lastUpdate; this adds an additive accrueInterest(timestamp?) method to IAccrualVaultV2Adapter and each adapter implementation. Vault-level _totalAssets, totalSupply, and fee shares are byte-for-byte unchanged (nested re-accrual is idempotent at a fixed timestamp), backed by new unit tests. Ships a blue-sdk minor changeset with patch bumps for the direct maintained dependents (blue-sdk-viem, morpho-sdk, wdk-protocol-lending-morpho-evm).

🤖 Generated with Claude Code

AccrualVaultV2.accrueInterest now accrues every underlying adapter, market, and
position to the same timestamp, so the returned entity graph shares one
`lastUpdate` — matching MetaMorpho V1 (AccrualVault.accrueInterest) instead of
leaving nested adapters at pre-accrual state. Adds an additive
`accrueInterest(timestamp?)` method to IAccrualVaultV2Adapter and each adapter.
Vault-level `_totalAssets`, `totalSupply`, and fee shares are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Foulks-Plb Foulks-Plb added the enhancement New feature or request label Jul 29, 2026
@Foulks-Plb Foulks-Plb self-assigned this Jul 29, 2026
@Foulks-Plb

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: feb22102f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .changeset/vault-v2-accrue-nested-entities.md
Comment thread packages/blue-sdk/src/vault/v2/VaultV2Adapter.ts Outdated
Comment thread packages/blue-sdk/src/vault/v2/VaultV2Adapter.ts Outdated
Make the new IAccrualVaultV2Adapter.accrueInterest method optional and guard the
vault call with a fallback, so adding it stays backward compatible (minor, not
major): pre-existing TS/JS adapters without it are left at their pre-accrual
state instead of failing to compile or crashing at runtime. Require the
timestamp argument so every nested market accrues to the same instant rather
than each defaulting to its own lastUpdate. Complete the JSDoc contract
(@returns, @throws, @example) on the interface method, its implementations, and
AccrualVaultV2.accrueInterest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant