Interface: OvercastReader
Defined in: packages/overcast-core/src/protocol/reader.ts:9
Extended by
Methods
balance()
balance(user, asset): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:30
Gets the current balance for an asset in the protocols vault
Parameters
| Parameter | Type | Description |
|---|---|---|
user | Bytes32 | - |
asset | { address: string; cashLike?: boolean; chain?: string; coinGeckoId?: string; decimals?: number; domain?: number; lastKnownPriceUsd?: number; logoUrl?: string; name?: string; rwa?: boolean; symbol?: string; volatility?: number; } | - |
asset.address | string | The on-chain address (mint) identifying the asset, in the layer's own encoding (base58 on Solana, 0x… on an EVM chain) — see Address. |
asset.cashLike? | boolean | Whether or not the asset can be treated similar to cash |
asset.chain? | string | The chain the asset lives on, e.g. "base". A display label only — it is a caller-chosen name (see ChainName), carried by no wire payload and never used to key or look up an asset. domain is the identity. |
asset.coinGeckoId? | string | CoinGecko id for price lookups, e.g. usd-coin. |
asset.decimals? | number | Number of decimal places in the asset's native units. |
asset.domain? | number | The protocol domain the asset lives on — the same separator OptionDetails.domain carries and every indexed event is tagged with, and the first half of the asset's key in an AssetRegistry. Optional because a single-domain deployment has nothing to disambiguate; such an asset registers as a wildcard, matching any domain that has no asset of its own at that address. Populate it as soon as one backend serves two domains — an address is only unique within a domain. |
asset.lastKnownPriceUsd? | number | Last known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset. |
asset.logoUrl? | string | Logo of the coin |
asset.name? | string | Human name of the asset. |
asset.rwa? | boolean | Whether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset. |
asset.symbol? | string | Human ticker, e.g. USDC. |
asset.volatility? | number | Volatility of the asset |
Returns
Promise<bigint>
borrowedCollateral()
borrowedCollateral(option): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:57
Native (smallest-unit) amount of option.details.collateralAsset currently
borrowed out of the option's collateral escrow and not yet repaid — the one
mutable part of a live option.
Zero for an option that never borrowed and for one that does not exist: an unset ledger entry and a fully repaid loan are the same thing on-chain. Use optionExists to tell those apart.
Parameters
| Parameter | Type |
|---|---|
option | MarketOption |
Returns
Promise<bigint>
exerciseClaims()
exerciseClaims(option, user): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:123
returns the user balance of exercise claims for the given option
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
user | Bytes32 | - |
Returns
Promise<bigint>
exerciseClaimsSupply()
exerciseClaimsSupply(option): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:103
Returns the total supply of exercise claims for the given option
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
Returns
Promise<bigint>
getOptionBalances()
getOptionBalances(option): Promise<{
collateral: bigint;
settlement: bigint;
}>;
Defined in: packages/overcast-core/src/protocol/reader.ts:65
Looks up how much collateral / settlement are locked in the option's escrow.
Takes the whole option for the same reason optionExists does. A missing option reads as zeros.
Parameters
| Parameter | Type |
|---|---|
option | MarketOption |
Returns
Promise<{
collateral: bigint;
settlement: bigint;
}>
getOptionFees()
getOptionFees(option): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:75
Calculates the fee that will be deduced on option creation. This is useful to know, what premium the end-user will actually receive. Option buyer/taker pays premium, fee is deduced from that. The leftover amount is paid to the maker of the option / the user. The fee is always denominated in the premium asset.
Parameters
| Parameter | Type |
|---|---|
option | MarketOption |
Returns
Promise<bigint>
fee in premium
getProtocolState()
getProtocolState(): Promise<ProtocolState>;
Defined in: packages/overcast-core/src/protocol/reader.ts:25
Reads the protocol's global ProtocolState — the live
ProtocolConfig (authority, pause authority, option-creation hook and
both pause bitmasks) together with the immutable domain.
This is the authoritative answer to the questions no per-record read can
settle: whether the action a caller is about to submit is currently paused,
whether a fee hook is configured (and so whether a premium will be skimmed),
who may change either, and which domain an offer's terms must name to be
accepted here.
Always present on a deployed protocol — initialization creates it, and
nothing can remove it — so this resolves to a state rather than null, and
throws if the protocol is not initialized at the configured address.
Returns
Promise<ProtocolState>
offerExists()
offerExists(id): Promise<boolean>;
Defined in: packages/overcast-core/src/protocol/reader.ts:85
Whether an offer with this content-address Bytes32 exists on-chain.
Existence is all the chain has left to say: an offer is stored under the
hash of its own terms, so a caller holding the id that resolves here
already holds — or can fetch from the curated backend
(app.api.getOffer) — every term it was created with.
Parameters
| Parameter | Type |
|---|---|
id | Bytes32 |
Returns
Promise<boolean>
optionExists()
optionExists(option): Promise<boolean>;
Defined in: packages/overcast-core/src/protocol/reader.ts:46
Whether the given option exists on-chain.
Takes the option's whole terms rather than an id because that is what both
chains need to reach the record: EVM keys options by the content-address of
their terms, Solana by the (collateralOffer, settlementOffer) pair its
account's PDA is seeded with. Neither is derivable from the other, and the
terms carry both.
Only existence, not the stored option: nothing about a live option is
on-chain that the terms don't already say, apart from
borrowedCollateral, which has its own read. Fetch the terms
themselves from the curated backend (app.api.getOption).
Parameters
| Parameter | Type |
|---|---|
option | MarketOption |
Returns
Promise<boolean>
redeemClaims()
redeemClaims(option, user): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:116
returns the user balance of redeem claims for the given option
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
user | Bytes32 | - |
Returns
Promise<bigint>
redeemClaimsSupply()
redeemClaimsSupply(option): Promise<bigint>;
Defined in: packages/overcast-core/src/protocol/reader.ts:109
Returns the total supply of redeem claims for the given option
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
Returns
Promise<bigint>
settlementLayerKind()
settlementLayerKind(settlementLayer): Promise<KnownSettlementLayer>;
Defined in: packages/overcast-core/src/protocol/reader.ts:97
Classify a settlement-layer config (OptionDetails.settlementLayer) into its KnownSettlementLayer kind by inspecting the on-chain config account it points at.
An option commits to a settlement layer as a single opaque config
Bytes32; this resolves that id to the abstract kind ("physical" /
"oracle") without a caller needing to know the chain's layer programs.
Throws if the account doesn't exist or isn't a recognized layer config.
Parameters
| Parameter | Type |
|---|---|
settlementLayer | Bytes32 |
Returns
Promise<KnownSettlementLayer>