Skip to main content
Each Windrose currency is minted by an FxVault that holds the chain’s dollar. Two tables describe a vault: vaultEvent records what people did, and vaultSnapshot records the vault’s accounting right after each of those events.

vaultEvent

Indexes: (vault, timestamp), user.

vaultSnapshot

One row per vault event, keyed by the same txHash-logIndex, holding vault.status() plus the two supplies at that block. Index: (vault, timestamp).
vault.status() reverts with StalePrice when the oracle’s last rate is older than the stale limit (five days). The indexer then recomputes liability, equity and crBps from vault.assets() and the last known rate (the event’s rate, else the indexed currency.lastRate) and writes the row with fresh: false, so the series never has a hole.

Examples

Snapshots (latest first) and recent events for one vault:
The vault address for a code comes from the currency row, or from the deployment file on the addresses page. Latest snapshot of every vault in one query:
One backer’s deposits and withdrawals across every vault:
Mints and redeems of a vault in a window, to measure fee income:
Redeems that took a haircut:
Collateral ratio history for a chart:
With curl:

Reading a snapshot

  • assets, liability and equity are the chain’s dollar in 6 decimals: equity / 1e6 is the dollar buffer backers have put in plus accumulated fees, minus any adverse FX move.
  • crBps / 100 is the collateral ratio in percent. Treat 2^256 - 1 (115792089237316195423570985008687907853269984665640564039457584007913129639935) as “no liability” rather than a number.
  • Vaults mint at a minimum collateral ratio of 100%, so a fresh vault with no backers sits exactly at 100% after its first mint. Below 100% redeems are paid pro rata (haircut: true on the event).
  • A backer’s share of equity is shares / shareSupply; multiply by equity for the current dollar value of a position.
  • Fee income to backers is the sum of fee over mint and redeem events minus the protocol’s 20% share, which is tracked inside the contract rather than as separate rows. The FxVault reference has the exact accounting.