Skip to content

Comments

Examples/oracle contract#280

Merged
Timi16 merged 2 commits intoTimi16:mainfrom
promisszn:examples/oracle-contract
Feb 24, 2026
Merged

Examples/oracle contract#280
Timi16 merged 2 commits intoTimi16:mainfrom
promisszn:examples/oracle-contract

Conversation

@promisszn
Copy link
Contributor

Closes #260

Implements a Soroban oracle price feed contract demonstrating:
- set_price / get_price / get_timestamp / is_stale functions
- Per-asset price + timestamp stored in persistent storage
- Admin-gated price updates with staleness TTL
- README showing how to debug stale price scenarios with the debugger
- Storage diff walkthrough for price updates
- 9 unit tests covering all functions and error paths
- Created test_get_timestamp.1.json to validate timestamp retrieval.
- Added test_initialize_and_set_get_price.1.json for initializing and setting price.
- Introduced test_invalid_price_rejected.1.json to ensure invalid price submissions are rejected.
- Implemented test_price_becomes_stale_after_ttl.1.json to check price staleness after TTL expiration.
- Added test_price_not_stale_immediately_after_update.1.json to verify price remains valid post-update.
- Created test_update_price_refreshes_staleness.1.json to ensure updating price refreshes staleness correctly.
@Timi16
Copy link
Owner

Timi16 commented Feb 24, 2026

Closes #260

First quality code i've read all day

@Timi16 Timi16 merged commit 30bca61 into Timi16:main Feb 24, 2026
3 of 5 checks passed
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.

Create Example: Oracle Price Feed Contract

2 participants