Arena: TWAP-derived initial charmPriceWad (#303) #447
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega!447
Loading…
Reference in a new issue
No description provided.
Delete branch "cursor/gitlab-issue-workflow-696a"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements GitLab #303: production
TimeArena.charmPriceWadis derived from Kumbaya V3 TWAP (Sir 15-minute window) on DOUB/WETH (fee 100) and WETH/USDm (fee 3000), anchored so ~$1 DOUB notional buys 1 CHARM (charmPriceWad = floor(1e36 / doubUsdTwap)). DeployDev / Anvil remain1000e18.Changes
ArenaCharmPriceTwaplibrary + minimal V3 oracle helpers (observe,getQuoteAtTick)DeployProductioncomputes TWAP on chain 4326 unlessARENA_CHARM_PRICE_WADoverride is set (fail-closed; no silent1000e18)bash scripts/compute-arena-charm-price-twap.shops dry-runINV-TIME-ARENA-CHARM-TWAP-INITin invariantsPARAMETERS.md, deployment guide, arena product docs,kumbaya.mdBlocker note
MegaETH mainnet currently has no DOUB/WETH pool at fee 100 — TWAP dry-run and production deploy will revert until that pool exists (or ops sets
ARENA_CHARM_PRICE_WADfor rehearsal).Acceptance checklist
docs/integrations/kumbaya.md,PARAMETERS.md,INV-TIME-ARENA-CHARM-TWAP-INITDeployProduction._resolveCharmPriceWad+ formula inArenaCharmPriceTwapminDoubSpend = 0.99×charmPriceWad,max = 10×in library + testsARENA_CHARM_PRICE_WADoverrideDeployProduction+deploy-megaeth-contracts.sh1000e18on 4326; script exits non-zeroDeployDev.s.solstill1000e18INV-TIME-ARENA-DOUB-PRICEupdatedarena-v2.md,time-arena.mdcd contracts && forge test --match-contract ArenaCharmPriceTwapcd contracts && forge test --no-match-contract DoubAirdropMegaethForkdoub.csvfork tests SKIP/FAIL without csv)bash scripts/compute-arena-charm-price-twap.shbash scripts/verify-time-arena-buy-router-anvil.shcd frontend && npm run typecheck && npm testFORK_URL=… forge test --match-contract ArenaCharmPriceTwapForkVerification for reviewers
mentioned in issue #303
changed the description
changed the description
Security review (automated)
Commit reviewed:
69e05c9ac07628cea8f0e700d67dd529c59cfb28Scope: GitLab #303 —
ArenaCharmPriceTwaplibrary,DeployProductionTWAP init, V3 oracle helpers, dry-run script, deploy script + docs/invariants (20 files in MR diff).Outcome
FINDINGS: 0 medium+
Security review: no medium+ findings on this diff.
Summary
Reviewed deploy-time TWAP derivation for production
charmPriceWad, fail-closed guards (ARENA_CHARM_PRICE_WADoverride, chain-id gate, missing-pool revert), and ops dry-run script.ArenaCharmPriceTwapis consumed only by the Foundry deploy/dry-run path — not linked into runtimeTimeArenabytecode — so there is no post-deploy user-callable oracle sink.Controls traced:
SIR_TWAP_SECONDS = 900)MIN_DOUB_USD_WAD–MAX_DOUB_USD_WAD)1000e18fallback on mainnetDeploy-time pool manipulation / thin-liquidity TWAP bias is an operational deployment concern mitigated by dry-run (
scripts/compute-arena-charm-price-twap.sh), documented override, and post-deploysetCharmPriceWadgovernance — not an exploitable production authn/authz or injection path introduced here.Inline threads
None (zero medium+ findings).
Cursor security-review automation · MR !447
mentioned in merge request !450
mentioned in merge request !451