Repository navigation
Add wind-down feed for Curve coin-0 pricing - #143
Closed
cryptoharry wants to merge 14 commits into
Closed
cryptoharry wants to merge 14 commits into
cryptoharry wants to merge 14 commits into
Conversation
FrontierV2 contracts first draft
* Add GOhmTokenEscrow * Add ALE * Add Cvx Crv feed and escrow * Add Cvx Fxs feed and escrow * Add DAI feed and escrow * Add wstETH feed * Add st-yETH feed * Add wBTC feed * Add GovToken escrow * Add DbrDistributor ------------------------------------------------------------------------------------------------------------------ Co-authored-by: webmass <webmass@inverse.finance> Co-authored-by: Nour Haridy <nourharidy@gmail.com> Co-authored-by: lacoop6tu <burzi.andrea@gmail.com> Co-authored-by: lacoop6tu <57543189+lacoop6tu@users.noreply.github.com> Co-authored-by: 0xtj24 <tabboz23@proton.me> Co-authored-by: 0xtj24 <158189165+0xtj24@users.noreply.github.com>
08xmt
requested changes
Sep 24, 2026
08xmt
reviewed
Sep 25, 2026
08xmt
approved these changes
Sep 30, 2026
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Curve StableSwap's capped EMA creates a downside price floor when inverted to price
coins[0]. This adds standaloneChainlinkCurveWindDownFeedundersrc/feeds, using the existing coin-0 pricing formula with permissionless wind-down and RWG-controlled recovery.ChainlinkCurveFeedis unchanged.Behaviour
coins[0].1.9e18immediately setsupdatedAt = 0while preserving the live price, blocking borrowing wherever FiRM's staleness check is enabled before a keeper starts wind-down. Below the threshold, the upstream timestamp is returned again.canStartWindDown()checks only that no wind-down is active and EMA >=1.9e18. There is no persistence window, additional EMA ceiling or USD timestamp restriction.startWindDown()records the current USD price (at least 100 raw feed units) and activation time. The recorded price decays linearly to 100 raw 18-decimal feed units ($1e-16) over the configured duration, then remains there until RWG resets it.WindDownStartedrecords activation and the reward.Eligibility does not guarantee transaction success: activation still needs a readable USD starting price of at least 100 raw feed units and a successful DOLA call. Stale USD timestamps are accepted.
(0, 0, 0, 0, 0). FiRM's Oracle rejects that invalid price instead of accepting an artificial near-zero valuation.startWindDown()rejects it before recording activation or paying a reward. Upstream calls and arithmetic can still revert.The 100-unit terminal floor provides a rounding buffer for downstream LP/vault conversions. The LP calculation remains positive at virtual price >= 0.01e18 when the wind-down feed supplies the minimum coin price; any additional vault conversion must be checked separately. Activation below the floor reverts to prevent decay underflow. Live pricing and the documented V12 invalid-price policy are unchanged.
RWG recovery
stopWindDown()is restricted to the nonzero RWG address fixed at deployment. It clears the recorded starting price and time, restores live pricing, and emitsWindDownStopped. It can also be called after the terminal price is reached.1.9e18, allowing borrowing again subject to normal market checks. Stale upstream data remains stale.1.9e18,updatedAtremains zero and borrowing stays blocked where the staleness check is enabled. Anyone can immediately start another wind-down.Validation
34 local Foundry tests passed, including 512 fuzz cases. Coverage includes normal pricing, pre-activation threshold blocking and recovery, RWG reset above the threshold, invalid-price propagation and Oracle rejection, activation and decay, rewards, RWG authorization, restoration of live data, repeat activation, recorded-low persistence and expiry, activation below and at the terminal floor, and LP/Yearn rounding and timestamp propagation through Oracle and BorrowController.
forge test --match-path test/feeds/ChainlinkCurveWindDownFeed.t.sol --evm-version shanghai -vvDraft for review; no deployment has been performed.