Skip to content

Implement Oracle Price Feed Update Path in Contract #1710

Description

@RUKAYAT-CODER

Overview

oracle.rs defines types and storage functions but there is no entrypoint to push or update price data. est_oracle.rs is 784 bytes with a single placeholder test.

Background

The oracle is needed to validate reward amounts against live token prices and to prevent quest creators from setting rewards below a minimum USD value.

Specifications

Features:

  • set_price(env, caller, token, price_data) entrypoint gated behind OracleAdmin role
  • Price staleness check: reject prices older than configurable TTL
  • Circuit-breaker: halt new quest registrations when price feed is stale

Tasks:

  • Implement set_price in oracle.rsn- Add staleness check in �alidation.rsn- Expand est_oracle.rs with staleness and circuit-breaker tests

Impacted Files:

  • contracts/earn-quest/src/oracle.rsn- contracts/earn-quest/src/validation.rsn- contracts/earn-quest/tests/test_oracle.rs`n

Acceptance Criteria:

  • Price update accepted from OracleAdmin
  • Stale price (>1h) causes quest registration to fail
  • All new oracle tests pass

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions