Metacenter

risk-feed

Publisher-gated mirror of mainnet distributions on testnet, storing raw inputs and deriving metrics on-chain.

risk-feed runs on testnet and its values mirror mainnet data (mirrored). The publisher posts only raw inputs from each mainnet calculate-rewards event plus a price. The contract checks that they add up the way pox-5 splits a pool, then derives every metric itself, so anyone can recompute each figure from the stored inputs.

Functions

FunctionKindArgumentsReturns / effect
post-snapshotpublic, publisher onlyindex uint, the raw inputs tuple (cycle, calculation height, source txid, gross, bond target, bond paid, STX-only, reserve deposit, reserve balance, STX shares, price e6, price source, price timestamp)Stores the inputs and derived metrics; prints metacenter-snapshot
deriveread-onlygross, target, paid, stx-only, reserve-balance, stx-shares, price-e6{ coverage-bps, headroom-bps, shortfall-sats, reserve-cover-cycles-x100, stx-yield-sats-per-stx-e9, cliff-sats-per-stx-e6 }
get-snapshotread-onlyindex uintoptional record
get-latest-index / get-latest-snapshotread-onlynonethe newest distribution index / its record
get-coverage-summaryread-onlynonetrait summary, period-kind: "interval", provenance: "mirrored"
set-publisher / set-ownerpublic, owner onlyprincipalRotate the publisher / transfer ownership
get-owner / get-publisherread-onlynoneprincipal

Errors

CodeMeaning
u100Not the owner
u101Not the publisher
u102Index already posted (no overwrites)
u103Inputs do not add up the way pox-5 splits them
u104No data yet

Consistency checks on every post

  • bond paid ≤ gross, and bond paid = min(gross, target)
  • reserve deposit = 15% of the remainder, or the whole remainder when no STX is staked
  • bond paid + STX-only + reserve deposit = gross
Edit on GitHub

On this page