Skip to content

feat(price-guard): support per-source staleness windows (#86) - #1140

Closed
jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:feat/price-guard-source-staleness-86
Closed

jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:feat/price-guard-source-staleness-86

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Closes #86

Summary

  • Adds DataKey::SourceMaxStaleness(Address, Symbol), configure_source(env, admin, asset, name, max_staleness_s), and source_staleness(env, asset, name) -> u64 to contracts/price-guard/src/lib.rs.
  • Updates evaluate to check each source against source_staleness(env, &asset, &source.name) (falling back to config.max_staleness_s when no per-source override is set).
  • Adds a unit test configuring a 24h window on "issuer" and a 1h window on "redston", verifying freshness behavior at 30m (Ok), 2h (Degraded due to stale "redston"), and 25h (Degraded with both stale).

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.

Add per-source staleness windows to PriceGuard

1 participant