Multi-feeder oracle, circuit-breaker, token registry, multi-hop conversion - #554
Merged
OxDev-max merged 6 commits intoJul 28, 2026
Conversation
…n#501) Adds canonical Address-to-Symbol registry for on-chain token resolution, eliminating hardcoded symbol assumptions in consumers. Includes register_token_symbol, resolve_symbol, and convert_by_address entrypoints. Closes OpenLedger-Foundation#501
…Ledger-Foundation#500) Implements configurable maximum price deviation (default 10% / 1000 bps) that rejects price updates deviating beyond the threshold. Includes set_price_override for legitimate large moves bypassing the check. Closes OpenLedger-Foundation#500
…r-Foundation#499) Adds authorized feeder registry separate from admin. Multiple feeders can independently submit prices for pairs, with get_price returning the median across all active feeders. Includes add_feeder/remove_feeder management, and tests demonstrating single malicious feeder cannot unilaterally control the aggregated price. Closes OpenLedger-Foundation#499
…edger-Foundation#502) Implements fallback triangulation through configurable base currency when direct pair is unavailable. Direct pairs are preferred when available. Both legs independently checked for staleness. Includes set_base_currency for admin configuration. Closes OpenLedger-Foundation#502
|
@Jambox11 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Four foundational improvements to the price oracle architecture addressing centralization risk, safety guards, and extensibility:
set_price#500): Configurable max-deviation check prevents catastrophic mispricingset_pricewith no multi-feeder/aggregation model concentrates conversion-rate trust in one key #499): Authorized independent feeders with median aggregation vs. single-admin concentrationconvert()only supports direct registered pairs with no multi-hop/triangulation through a common base currency #502): Triangulation through base currency for derivable pairsChanges
#501 — Token-Symbol Registry
DataKey::TokenSymbol(Address) -> Symbolpersistent mappingregister_token_symbol(admin, token, symbol)— admin-gated registrationresolve_symbol(token) -> Symbol— lookup viewconvert_by_address(amount, from_token, to_token)— convenience entrypoint using addresses#500 — Circuit-breaker with Max-Deviation
DataKey::MaxDeviation(default 1000 bps = 10%)set_price()now validates deviation from aggregated price; rejects if exceededset_price_override()bypasses check for legitimate large moves (de-peg events)set_max_deviation(admin, bps)— reconfigurable threshold#499 — Multi-feeder Model
DataKey::Feeder(Address) -> bool— admin-managed feeder registryDataKey::FeederPrice(Symbol, Symbol, Address)— per-feeder submissionsDataKey::PriceFeeders(Symbol, Symbol)— tracks which feeders have submitted for each pairset_price()now accepts submissions from any authorized feederget_price()aggregates via median across all active (non-stale) feedersadd_feeder(admin, feeder)andremove_feeder(admin, feeder)— feeder lifecycle#502 — Multi-hop Conversion
DataKey::BaseCurrency— configurable currency for triangulationset_base_currency(admin, symbol)— admin configurationconvert()enhanced: tries direct pair first, falls back to triangulation through baseArchitecture Notes
Test Coverage
✅ Token registry: registration, resolution, address-based conversion, error paths
✅ Circuit-breaker: deviation success/failure, override bypass, reconfiguration
✅ Multi-feeder: single vs. multiple, median correctness, malicious containment, feeder management
✅ Multi-hop: triangulation success, preference hierarchy, missing base, staleness checks
✅ Existing tests: all converted to new feeder model
Closes #499, Closes #500, Closes #501, Closes #502