Skip to content

[simplex]: ERC-4626 vault funding venue#958

Merged
seunlanlege merged 13 commits into
mainfrom
roy/aave-v3-funding
Jun 18, 2026
Merged

[simplex]: ERC-4626 vault funding venue#958
seunlanlege merged 13 commits into
mainfrom
roy/aave-v3-funding

Conversation

@royvardhan

@royvardhan royvardhan commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Implements #939 — yield-venue funding via ERC-4626.

Adds a filler-wide ERC-4626 venue for sourcing and managing stablecoin liquidity. Any compliant vault (Aave stataToken, Morpho, an issuer yield vault) is a config entry — no protocol-specific code:

  • Sourcing: when wallet balance is short on a fill, withdraw the deficit from the solver's vault position (vault.withdraw), prepended atomically before fillOrder in the same ERC-7821 batch; capped by vault.maxWithdraw. Wired into both the stable and FX strategies.
  • Sweeping: a timer deposits wallet balance above a configured threshold into the vault (exact approve + deposit, batched in one ERC-7821 call), keeping the threshold liquid for fills.
  • Shutdown: all vault positions are redeemed back to the underlying asset.
  • Config: top-level [erc4626].vaults = [{ chain, vault, threshold? }]; the underlying asset is resolved on-chain from the vault.
  • Renamed the basic strategy to stable.

@royvardhan royvardhan changed the title [simplex]: Aave V3 funding venue + stable-strategy sourcing [simplex]: Aave V3 funding venue Jun 9, 2026
@royvardhan royvardhan marked this pull request as draft June 9, 2026 08:47
@seunlanlege

Copy link
Copy Markdown
Member

haven't looked at the code yet, but this should support hydrating free USDC/USDT balances at startup to aave & everytime its cumulative stablecoin free balance crosses some minimum threshhold.

@royvardhan royvardhan changed the title [simplex]: Aave V3 funding venue [simplex]: ERC-4626 vault funding venue Jun 11, 2026
@royvardhan royvardhan marked this pull request as ready for review June 12, 2026 09:09
Comment thread docs/content/developers/evm/intent-gateway/simplex.mdx Outdated
@seunlanlege

Copy link
Copy Markdown
Member

also do we check maxDeposit/maxWithdrawal before interacting with the vault?

@seunlanlege seunlanlege left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Inline review of the ERC-4626 vault funding venue. Two pre-existing concerns plus the two requested additions (maxDeposit check, redeemOnShutdown flag) are left as inline comments at the relevant sections.

Blocking-ish: (1) the [erc4626] vs [vault] config-key mismatch silently disables the feature for anyone following the docs; (2) the reservation (consumed) accounting looks like it leaks for evaluated-but-not-won orders and can degrade sourcing to zero over time — worth confirming. Everything else is polish. Nice use of maxWithdraw as the authoritative sourcing cap, and good atomic approve+deposit batching.

Comment thread sdk/packages/simplex/src/bin/simplex.ts Outdated
Comment thread sdk/packages/simplex/src/funding/vault/VaultFundingPlanner.ts
Comment thread sdk/packages/simplex/src/funding/vault/VaultLiquidityState.ts Outdated
Comment thread sdk/packages/simplex/src/funding/vault/VaultFundingPlanner.ts Outdated
Comment thread sdk/packages/simplex/src/config/abis/Erc4626.ts
Comment thread sdk/packages/simplex/src/funding/types.ts Outdated

@seunlanlege seunlanlege left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-reviewed at 4f0421d — thanks, all four items from the last pass are addressed:

  • Config key — now [vault] consistently across code, filler-config-example.toml, and docs (planner name also renamed "Vault").
  • Reservation leak — replaced the monotonic consumed counter with TTL-bounded reservations; won bids release immediately on the realised position drop, lost bids expire. Good back-to-back-fill and TTL-expiry tests.
  • maxDeposit clamp — added to the ABI and the sweep now deposits min(excess, maxDeposit), skipping when headroom < minSweep. Covered by two new tests.
  • redeemOnShutdown — per-vault flag, defaults false (positions kept across restarts), honoured in redeemChain and documented in the example config. Tested both ways.

Also a nice unprompted catch: ordering the vault venue before the V4 LP for the FX strategy so stablecoins source from the treasury before draining (and perturbing the price of) a concentrated-liquidity position.

Two small non-blocking notes inline (TTL vs. slow cross-chain settlement; a benign FIFO-vs-expiry ordering nit in releaseReserved). LGTM otherwise.

Comment thread sdk/packages/simplex/src/funding/vault/VaultLiquidityState.ts Outdated
Comment thread sdk/packages/simplex/src/funding/vault/VaultLiquidityState.ts

@seunlanlege seunlanlege left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One follow-up design suggestion on the sweep config naming/semantics — non-blocking, details inline on VaultConfig and sweepChain. TL;DR: replace threshold (retained float) + minSweep (dust floor) with minBalance (floor to keep in wallet) + threshold (high-water trigger that sweeps down to minBalance). Drops minSweep entirely and gives clean hysteresis with two self-explanatory knobs.

Comment thread sdk/packages/simplex/src/funding/types.ts Outdated
Comment thread sdk/packages/simplex/src/funding/vault/VaultFundingPlanner.ts Outdated
@royvardhan royvardhan requested a review from seunlanlege June 17, 2026 09:47
@seunlanlege

Copy link
Copy Markdown
Member

lets try to get tests passing & we can merge

seunlanlege

This comment was marked as spam.

@seunlanlege

Copy link
Copy Markdown
Member

Simplex test failing

@seunlanlege seunlanlege merged commit 2791e1d into main Jun 18, 2026
1 of 2 checks passed
@seunlanlege seunlanlege deleted the roy/aave-v3-funding branch June 18, 2026 20:39
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