Skip to main content

Schema Reference

Every entity exposed by the vault indexer, generated from the deployed schema.

Each entity has two resolvers:

  • Singularvault(id: "0x…") returns one record or null
  • Pluralvaults(where:, orderBy:, orderDirection:, limit:, offset:) returns a page

A page always carries items, totalCount and pageInfo. limit caps at 1000; see Limits and gotchas before writing a client.

Types are lower-case

Ponder generates this API from the indexer's table definitions, so type names match the table names and are lower-case (vault, not Vault). The plural of stats is statss for the same reason — the generator appends an s.

Core vault

The vault lifecycle and the actors that secure it. These entities exist regardless of which DeFi application a vault is used with.

vault

One BTCVault and its full lifecycle state — a depositor’s native Bitcoin locked in a UTXO on the Bitcoin network. status is the authority on where it sits; the timestamp fields cover only part of the path.

Query with vault(…) or vaults(…).

FieldTypeRequiredNotes
idString!yes
peginTxHashString!yes
depositorString!yesDepositor address, lowercase hex. Filters are case-sensitive.
depositorBtcPubKeyString!yes
vaultProviderString!yes
vaultProviderCommissionBpsInt!yes
amountBigInt!yesVault size in satoshis.
applicationEntryPointString!yes
statusvaultStatusnoWhere the vault is in its lifecycle. Treat this as authoritative; not every state has a timestamp.
inUseBoolean!yesWhether the vault is currently pledged to an application.
ackCountInt!yesHow many of the security set have acknowledged. Reaches 6 when complete. A vault sitting at 0 is stalling, and usually expires with ack_timeout.
depositorSignedPeginTxString!yes
unsignedPrePeginTxString!yes
appVaultKeepersVersionInt!yes
universalChallengersVersionInt!yes
offchainParamsVersionInt!yes
proverCircuitVersionInt!yes
vaultCoreVersionInt!yes
referralCodeInt!yes
depositorPayoutBtcAddressString!yes
btcPopSignatureStringno
depositorWotsPkHashStringno
peginSigsPostedAtBigIntnoUnix seconds. Dates the signatures_collected state.
prePeginTxHashStringno
htlcVoutInt!yes
hashlockString!yes
secretStringno
currentOwnerStringno
pendingAtBigInt!yesUnix seconds. Dates the pending state.
verifiedAtBigIntnoUnix seconds. Dates the verified state.
activatedAtBigIntnoUnix seconds. Dates the available state.
expiredAtBigIntnoUnix seconds. Dates the expired state.
expirationReasonStringnoWhy the peg-in expired, for example ack_timeout.
claimExpiredUntilBigIntnoA block number, not a timestamp, despite sitting among the timestamp fields. The contract sets it to the expiry block plus a grace period. Compare it against the block in _meta, never against a clock.
expiredClaimedAtBigIntno
blockNumberBigInt!yes
transactionHashString!yes
applicationapplicationno

vaultStatus values: pending · signatures_collected · verified · available · redeemed · liquidated · expired · invalid · depositor_withdrawn

vaultActivity

Append-only event log. It records six of the nine vaultActivityType values — deposit, borrow, repay, redeem, liquidation and claim_expired. It is not a complete history of everything that happens to a vault. See Known data gaps.

Query with vaultActivity(…) or vaultActivitys(…).

FieldTypeRequiredNotes
idString!yes
vaultIdStringnoNull on borrow and repay. Those events are scoped to an Aave position rather than to one vault. This is by design, not missing data.
depositorString!yes
typevaultActivityType!yesIn practice one of deposit, borrow, repay, redeem, liquidation, claim_expired. The enum also declares withdrawal, add_collateral and remove_collateral, but nothing writes them.
amountBigInt!yesSatoshis except on borrow and repay, where it is denominated in the debt asset. Resolve debtReserveId against aaveReserve before formatting.
debtReserveIdBigIntnoSet on borrow and repay. Join to aaveReserve for the debt asset symbol and decimals.
timestampBigInt!yesUnix seconds. Use with timestamp_gt as a sync watermark.
blockNumberBigInt!yes
transactionHashString!yes

vaultActivityType values: deposit · withdrawal · add_collateral · remove_collateral · liquidation · borrow · repay · redeem · claim_expired

vaultProvider

The depositor's Vault Provider: the operator that sets up, redeems and defends the BTCVault. A depositor can run their own.

Query with vaultProvider(…) or vaultProviders(…).

FieldTypeRequiredNotes
idString!yes
btcPubKeyString!yes
applicationEntryPointString!yes
commissionBpsInt!yesBasis points. 100 is 1%.
nameStringno
rpcUrlStringno
grpcUrlStringno
daemonGrpcUrlStringno
metadataStatusStringno
metadataRejectionReasonStringno
registeredAtBigInt!yes
blockNumberBigInt!yes
transactionHashString!yes

vaultProviderStats

Aggregated counters per vault provider.

Query with vaultProviderStats(…) or vaultProviderStatss(…).

FieldTypeRequiredNotes
idString!yes
activeVaultCountInt!yesNumber of active vaults for this provider.
totalActiveSatsBigInt!yesSatoshis across the provider's active vaults.
updatedAtBigInt!yes
providervaultProviderno

vaultKeeper

An App Keeper: the operator appointed by an integrated application, holding claim and challenge rights under that application's rules.

Query with vaultKeeper(…) or vaultKeepers(…).

FieldTypeRequired
idString!yes
btcPubKeyString!yes
firstSeenAtBigInt!yes
blockNumberBigInt!yes

vaultKeeperApplication

Join between an App Keeper and an application.

Query with vaultKeeperApplication(…) or vaultKeeperApplications(…).

FieldTypeRequired
idString!yes
vaultKeeperString!yes
applicationEntryPointString!yes
versionInt!yes
registeredAtBigInt!yes
blockNumberBigInt!yes
vaultKeeperInfovaultKeeperno

universalChallenger

A Universal Challenger: one of a global set of operators with challenge-only rights, which challenges invalid claims across every BTCVault.

Query with universalChallenger(…) or universalChallengers(…).

FieldTypeRequired
idString!yes
btcPubKeyString!yes
firstSeenAtBigInt!yes
blockNumberBigInt!yes

universalChallengerVersion

Versioned challenger set.

Query with universalChallengerVersion(…) or universalChallengerVersions(…).

FieldTypeRequired
idString!yes
challengerIdString!yes
versionInt!yes
blockNumberBigInt!yes
challengerInfouniversalChallengerno

feeConfig

Fee configuration. Empty on testnet — fee escrows exist without a matching config row.

Query with feeConfig(…) or feeConfigs(…).

FieldTypeRequired
idString!yes
vpFeeRateBigInt!yes
ucFeeRateBigInt!yes
avkFeeRateBigInt!yes
protocolPegInFeeRateBigInt!yes
vpRegistrationFeeBigInt!yes
updatedAtBigInt!yes
blockNumberBigInt!yes

vaultFeeEscrow

Escrowed fees for one vault. One row per vault, keyed by vaultId.

Query with vaultFeeEscrow(…) or vaultFeeEscrows(…).

FieldTypeRequiredNotes
vaultIdString!yes
totalAmountBigInt!yesEscrowed amount in wei, not satoshis.
vaultProviderString!yes
numUniversalChallengersInt!yes
numAppVaultKeepersInt!yes
statusfeeEscrowStatus!yes
escrowedAtBigInt!yes
distributedAtBigIntno
refundedAtBigIntno
forfeitedAtBigIntno
blockNumberBigInt!yes
transactionHashString!yes
vaultvaultno

feeEscrowStatus values: escrowed · distributed · refunded · forfeited

application

A DeFi protocol integrated with the vault system. Aave v4 is the first.

Query with application(…) or applications(…).

FieldTypeRequiredNotes
idString!yes
nameStringno
latestVKVersionIntno
totalCapBTCBigIntnoSatoshis, despite the BTC suffix.
perAddressCapBTCBigIntnoSatoshis, despite the BTC suffix.
statusapplicationStatus!yes
registeredAtBigInt!yes
blockNumberBigInt!yes
transactionHashString!yes

applicationStatus values: none · active · paused

token

A token known to the indexer, keyed by contract address.

Query with token(…) or tokens(…).

FieldTypeRequiredNotes
addressString!yes
symbolString!yes
nameString!yes
decimalsInt!yesDecimal places for this token. Needed to format any amount denominated in it.

stats

Protocol-wide totals. Singleton, id global.

Query with stats(…) or statss(…).

FieldTypeRequiredNotes
idString!yes
totalAvailableSatsBigInt!yesSatoshis across all available vaults.
availableVaultCountInt!yesNumber of vaults currently available.
updatedAtBigInt!yes

protocolState

Protocol-level singleton state, such as the active vault-core version.

Query with protocolState(…) or protocolStates(…).

FieldTypeRequired
idString!yes
activeVaultCoreVersionInt!yes
updatedAtBigInt!yes
blockNumberBigInt!yes
transactionHashString!yes

Aave application

State for the Aave v4 integration — the first application built on TBV. A vault used as Aave collateral appears in both domains.

aavePosition

A depositor position in Aave, keyed by depositor address rather than by id.

Query with aavePosition(…) or aavePositions(…).

FieldTypeRequiredNotes
depositorAddressString!yesThe key for this entity. Query with aavePosition(depositorAddress: "0x…").
proxyContractString!yes
totalCollateralBigInt!yesSatoshis. Equals the sum of amount across collateral rows where removedAt is null.
createdAtBigInt!yes
updatedAtBigInt!yes
blockNumberBigInt!yes
transactionHashString!yes
collaterals(…)aavePositionCollateralPageno

aavePositionCollateral

One vault pledged as collateral against a position. Released rows are kept for history.

Query with aavePositionCollateral(…) or aavePositionCollaterals(…).

FieldTypeRequiredNotes
depositorAddressString!yes
vaultIdString!yes
amountBigInt!yes
addedAtBigInt!yes
removedAtBigIntnoNull while the vault is still pledged. Filter on removedAt: null for live collateral.
liquidationIndexInt!yes
blockNumberBigInt!yes
transactionHashString!yes
positionaavePositionno
vaultvaultno

aaveVaultStatus

Per-vault usage status within Aave, keyed by vaultId.

Query with aaveVaultStatus(…) or aaveVaultStatuss(…).

FieldTypeRequiredNotes
vaultIdString!yes
applicationEntryPointString!yes
statusaaveVaultUsageStatus!yesOne of collateralized, llp_owned or redeemed.
metadataJSONno
updatedAtBigInt!yes
vaultvaultno

aaveVaultUsageStatus values: collateralized · llp_owned · redeemed

aaveUserProxy

The proxy contract deployed for a user, keyed by user.

Query with aaveUserProxy(…) or aaveUserProxys(…).

FieldTypeRequired
userString!yes
proxyString!yes
createdAtBigInt!yes
blockNumberBigInt!yes
transactionHashString!yes

aaveReserve

An Aave reserve and its parameters. Join here to resolve debt amounts.

Query with aaveReserve(…) or aaveReserves(…).

FieldTypeRequiredNotes
idBigInt!yes
underlyingString!yes
hubString!yes
assetIdInt!yes
decimalsInt!yes
dynamicConfigKeyBigInt!yes
pausedBoolean!yes
frozenBoolean!yes
borrowableBoolean!yesWhether the reserve can be borrowed. The vaultBTC reserve, which represents BTCVault collateral, is collateral only.
collateralRiskInt!yes
collateralFactorInt!yesBasis points. 7800 is 78%.
createdAtBigInt!yes
updatedAtBigInt!yes
blockNumberBigInt!yes
underlyingTokentokennoThe reserve asset. Read symbol and decimals to format borrow and repay amounts.

aaveConfig

Aave integration configuration. Singleton with an Int id — pass 1, not "1".

Query with aaveConfig(…) or aaveConfigs(…).

FieldTypeRequired
idInt!yes
adapterAddressString!yes
vaultBtcAddressString!yes
btcVaultRegistryAddressString!yes
btcVaultCoreSpokeAddressString!yes
vaultBtcReserveIdBigInt!yes

Full SDL

The complete schema is committed at /schema/vault-indexer.graphql.

Introspection is available but depth-capped — see Limits and gotchas for the four short queries that reconstruct it.