Files
smom-dbis-138/services/chain138-oracle/chain138_oracle/reference_cache.py
zaragoza444 54ca9bea3b
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 52s
CI/CD Pipeline / Security Scanning (push) Successful in 2m40s
CI/CD Pipeline / Lint and Format (push) Failing after 49s
CI/CD Pipeline / Terraform Validation (push) Failing after 24s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 27s
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Verify Deployment / Verify Deployment (push) Has been cancelled
Validation / validate-smart-contracts (push) Failing after 14s
Validation / validate-security (push) Failing after 1m20s
Validation / validate-documentation (push) Failing after 18s
feat(settlement): wire real Chain 138 contracts for 1,000 BTC ledger
Add canonical btc-l1-ledger config, /btc/contracts API, Python chain138-oracle
service, and production deploy scripts so secure.omdnl.org can serve live cBTC,
DODO, and PMM pool addresses with headroom-aware mint gating.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 02:26:20 -07:00

35 lines
779 B
Python

from __future__ import annotations
import time
from threading import Lock
from typing import Optional
_lock = Lock()
_prices: dict[str, tuple[float, float]] = {}
def prime(symbol: str, price_usd: float, ttl_sec: float = 300) -> None:
if not price_usd or price_usd <= 0:
return
key = symbol.upper()
with _lock:
_prices[key] = (price_usd, time.time() + ttl_sec)
def get(symbol: str) -> Optional[float]:
key = symbol.upper()
with _lock:
row = _prices.get(key)
if not row:
return None
price, expires = row
if expires <= time.time():
return None
return price
def snapshot() -> dict[str, float]:
now = time.time()
with _lock:
return {k: v[0] for k, v in _prices.items() if v[1] > now}