Skip to content

Deployment Script#50

Closed
jordanschalm wants to merge 4 commits into
mainfrom
jord/deploy-script
Closed

Deployment Script#50
jordanschalm wants to merge 4 commits into
mainfrom
jord/deploy-script

Conversation

@jordanschalm

Copy link
Copy Markdown
Member

No description provided.

jordanschalm and others added 4 commits June 10, 2026 15:57
Implements the missing yieldOracle dependency for FCMVault. FUSDEV is
itself an ERC4626 vault whose underlying asset is PYUSD0, so its
convertToAssets exchange rate IS the yield token price in loan-token
terms, with both tokens' decimals already embedded. The oracle is a
thin adapter scaling that rate to Morpho's IOracle 1e36 convention --
the same shape as Morpho's own ERC4626 oracle adapters.

NAV pricing cannot be moved by trading against the thin FlowSwap pool
(no TWAP machinery needed); it is only as trustworthy as FUSDEV's own
share accounting, and reflects redemption value rather than the pool's
executable swap price -- documented in the contract NatSpec.

Unit tests cover rate scaling across decimal regimes and constructor
validation; fork tests against the live FUSDEV vault run when
FLOW_MAINNET_RPC_URL is set and skip otherwise.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds a committed deployments/mainnet.json (pinning the existing Morpho
WETH/PYUSD0 market params and FlowSwap pools) and four forge scripts,
all chain-id-guarded and dry-runnable by dropping --broadcast:

- Status: read-only report on market, pools, oracle prices, balances;
  survives a reverting (stale) Pyth market oracle and reports it
- SeedMarket: supply PYUSD0 liquidity to the existing empty market
- DeployVault: deploy YieldTokenOracle (when not yet configured) and
  FCMVault, grant EARLY_ACCESS_ROLE, set MAX_TVL; aborts on missing
  market/liquidity/pool mismatches
- LiveCheck: real deposit -> redeem integration check with a
  round-trip tolerance, config-free (reads everything from the vault)

ConfiguredScript is the shared base (config load, market id, pool and
market pre-flight checks). Replaces the bare env-var FCMVault.s.sol.
foundry.toml gains deployments/ read permission and the flow_mainnet
RPC endpoint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Make targets (manual only, never run from CI): mainnet-status,
mainnet-seed-market, mainnet-deploy, mainnet-check, each with a -dry
variant that fork-simulates without broadcasting, plus
mainnet-fork-test for the oracle fork tests. A labeled slot is left
for the Cadence VaultRebalancer (PR #38) once it merges.

solidity/README.md gains the full runbook (status -> seed -> deploy ->
check, always dry-run first), script/env reference, post-deploy
record-keeping steps, and key-handling guidance. Root README gains a
Deployment section with the deployed contracts table and market id.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Runs the entire production sequence -- SeedMarket -> DeployVault ->
LiveCheck -- against an anvil fork of live mainnet, with state carried
between steps, real Morpho/FlowSwap/Pyth contracts, zero real funds,
and no PRIVATE_KEY (uses anvil's public dev account, funded with
WETH/PYUSD0 via impersonated transfers from the FlowSwap pools).

If the Pyth WETH/USD market oracle is stale (it reverts with StalePrice
after 1h without a push, the current live state), the script posts a
fresh signed update from Hermes -- the same permissionless remedy an
operator would use on real mainnet.

Cleanup removes the rehearsal's broadcast/*/747/ records so they cannot
masquerade as real deployment records; the script refuses to start if
uncommitted broadcast records are already present.

Verified end-to-end: seed 50k PYUSD0, deploy oracle + vault, live check
round-trip 9997 bps.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jordanschalm

Copy link
Copy Markdown
Member Author

Closing in favor of #51, #52

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.

1 participant