Skip to content

feat(simulation): enable sDAI in the erc4626 and curve filters - #1627

Merged
zizou0x merged 5 commits into
mainfrom
zz/yield-vault-filter-check
Oct 19, 2026
Merged

zizou0x merged 5 commits into
mainfrom
zz/yield-vault-filter-check

Conversation

@zizou0x

@zizou0x zizou0x commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

What

  • erc4626_filter no longer excludes the sDAI vault (0x83f2…beea, DAI ↔ sDAI).
  • curve_filter now has an ERC4626 vault allowlist (TRUSTED_ERC4626_COINS), matched against the pool's coins attribute. sDAI is the only entry, so Curve pools with sDAI as an ERC4626 coin (asset_types 0x03) are kept, for example FRAX/sDAI.
  • The Sky README and the supported-protocols page now describe this.

Why

Fynd does not route sDAI today. The vault is the only DAI ↔ sDAI venue on Tycho; the sky protocol covers only the PSM, the PSM wrapper and the DaiUsds converter.

The filter entry came from a Dec 2025 integration-test revert. sDAI's maxDeposit returns type(uint256).max. The test sized swaps at 0.1% of get_limits with a faked DAI balance, so vat.move reverted on vat.dai[daiJoin], which equals the real DAI supply. A real deposit cannot reach that limit: an eth_call deposit of the full 4.5B DAI supply succeeds and equals previewDeposit. The test has capped swaps at about $10k since June 2026. sUSDS has the same maxDeposit and is live.

The sDAI rate reads only pot slots (dsr, chi, rho) on every branch. pot is not a component token, so DCI indexes all of its storage.

scrvUSD is not on the allowlist. After its profit unlock period ends, convertToAssets reads balance_of[vault], which DCI does not capture. The rate is then 3.7 bps too low. Over the last 175 days this happened 2.9% of the time.

Tested

  • Unit tests: trusted ERC4626 coin kept, scrvUSD excluded, sDAI vault kept. All 15 filter tests pass. clippy and fmt (nightly-2026-06-28) are clean.
  • Quotes on the tycho-beta stream with these filters, blocks 26203779-26203909, compared with the chain at the same block. Curve pools with sDAI matched get_dy to the wei on update blocks. sDAI vault quotes were at most 7e-19 relative below previewDeposit/previewRedeem. Between updates, the rate accrual drifts the quote by at most 0.006 bps.
  • tycho-integration-test on erc4626 and vm:curve, 60 blocks: 108 router executions each on the sDAI vault and on FRAX/sDAI. Executed amounts were at most 0.003 bps below the quote. The only failures were RPC rate limits.

Fynd picks this up after a tycho-simulation version bump.

🤖 Generated with Claude Code

Remove sDAI from erc4626_filter and add an ERC4626 vault allowlist to
curve_filter with sDAI as its only entry. sDAI's rate reads only `pot`,
which DCI indexes in full, so quotes match the chain on every branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…entries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@zach030 zach030 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Just a few nits.

Comment on lines 117 to 124

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This first paragraph still says only oracle coins can be trusted. With this PR an ERC4626 coin can be trusted too, and the stETH pool allowlist already made it out of date.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. The paragraph now lists all three trusted lists: oracle providers, ERC4626 vaults and rebase pool ids. The has_unsupported_asset_type doc had the same gap and is fixed too.

Comment on lines +233 to +237
const TRUSTED_ERC4626_COINS: [&str; 1] = [
// sDAI: the rate reads only `pot` (`chi`, `dsr`, `rho`) on every branch. `pot` is not a
// component token, so DCI indexes all of its storage.
"0x83f20f44975d03b1b09e64809b757c47f942beea",
];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: TRUSTED_ERC4626_COINS is declared after the let ... else, but TRUSTED_RATE_ORACLES is at the top of the function. Moving it next to TRUSTED_RATE_ORACLES keeps both allowlists together.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Moved. Both allowlists are now at the top of has_unsupported_asset_type.

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Tycho Oct 16, 2026
zizou0x and others added 3 commits October 19, 2026 11:34
The curve_filter and has_unsupported_asset_type docs said only oracle
coins can be trusted. They now also name trusted ERC4626 vaults and
trusted rebase pools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move TRUSTED_ERC4626_COINS next to TRUSTED_RATE_ORACLES at the top of
has_unsupported_asset_type, before the asset_types early return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zizou0x
zizou0x enabled auto-merge October 19, 2026 11:47
@zizou0x
zizou0x merged commit 0e6669b into main Oct 19, 2026
38 checks passed
@zizou0x
zizou0x deleted the zz/yield-vault-filter-check branch October 19, 2026 11:53
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Tycho Oct 19, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants