Interface: OvercastChain<L>
Defined in: packages/overcast-core/src/protocol/chain.ts:27
The protocol's on-chain surface: authoritative reads (OvercastReader)
and signed writes (OvercastWriter, yielding one
TxStep<L["receipt"]> per transaction the operation took — see
SigningWriter), merged into one object. Everything here touches the
settlement layer directly — it costs gas, needs the signer, and is
chain-specific — as opposed to the cheap, curated backend reads exposed on
app.api (an OvercastView).
Exposed to consumers as app.chain.
Extends
OvercastReader.OvercastWriter<L,L["receipt"]>
Type Parameters
| Type Parameter | Description |
|---|---|
L extends OvercastLayer | the OvercastLayer describing this settlement layer. |
Properties
chainSigner
chainSigner: OvercastChainSigner<L>;
Defined in: packages/overcast-core/src/protocol/chain.ts:31
txBuilder
txBuilder: OvercastWriter<L, L["tx"]>;
Defined in: packages/overcast-core/src/protocol/chain.ts:30
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>
Inherited from
borrowCollateral()
borrowCollateral(
option,
amount,
metadata?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:148
borrows collateral out of the option's escrow into the taker's own
collateral token account, tracking an outstanding-borrow debt on the
option. Only permitted while option.details.borrowAllowed is set and
before the option's exercise window starts
(option.details.startTimestamp); the settlement layer additionally
decides whether the borrow is allowed. Repayment is trusted, not
enforced on chain — only take a borrow-enabled option from a taker you
trust to honor it. The option is neither exercisable nor redeemable
until all borrowed collateral is repaid. The taker must sign this
transaction themselves (not delegable).
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | native (smallest-unit) amount of option.details.collateralAsset to borrow. |
metadata? | Metadata | opaque settlement-layer metadata, forwarded to the layer's borrow check verbatim (see exerciseOption). Defaults to empty. |
Returns
Promise<L["receipt"][]>
Inherited from
OvercastWriter.borrowCollateral
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>
Inherited from
OvercastReader.borrowedCollateral
cancelOffer()
cancelOffer(offer, operation?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:92
cancels an open offer, refunding its escrowed collateral/premium to the creator's deposit vault
Parameters
| Parameter | Type | Description |
|---|---|---|
offer | Offer | the offer to close (must match the on-chain, content-addressed offer exactly). |
operation? | SignedOperation | delegated authorization by the offer's maker; the operation must have been signed over this offer's id. |
Returns
Promise<L["receipt"][]>
Inherited from
createOffer()
createOffer(offer, operation?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:82
creates a new offer
Parameters
| Parameter | Type | Description |
|---|---|---|
offer | Offer | - |
operation? | SignedOperation | delegated authorization by the offer's creator; the operation must have been signed over this exact offer. |
Returns
Promise<L["receipt"][]>
Inherited from
deposit()
deposit(deposit): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:175
deposits funds into the depositor's protocol escrow vault
The one operation that is routinely more than one transaction: where the
chain gates the pull on a standing allowance (ERC-20 on EVM), the returned
list is [approve, deposit] — the approval for exactly deposit.amount,
omitted when the existing allowance already covers it. See TxStep.
Parameters
| Parameter | Type | Description |
|---|---|---|
deposit | DepositParams | - |
Returns
Promise<L["receipt"][]>
Inherited from
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>
Inherited from
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>
Inherited from
OvercastReader.exerciseClaimsSupply
exerciseOption()
exerciseOption(
option,
amount,
params?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:110
exercises an option with the given amount
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | - |
params? | SettlementParams<L> | SettlementParams: the layer metadata, an optional delegating operation by the option's taker (signed over the exercise payload — option offer ids, amount and metadata exactly as passed here), and the layer's chain-specific settlement context. |
Returns
Promise<L["receipt"][]>
Inherited from
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;
}>
Inherited from
OvercastReader.getOptionBalances
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
Inherited from
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>
Inherited from
OvercastReader.getProtocolState
matchOffer()
matchOffer(settlementOffer, collateralOffer): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:99
matches settlement and collateral offer
Parameters
| Parameter | Type | Description |
|---|---|---|
settlementOffer | Offer | - |
collateralOffer | Offer | - |
Returns
Promise<L["receipt"][]>
Inherited from
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>
Inherited from
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>
Inherited from
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>
Inherited from
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>
Inherited from
OvercastReader.redeemClaimsSupply
redeemOption()
redeemOption(
option,
amount,
params?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:124
redeems an option with the given amount
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | - |
params? | SettlementParams<L> | SettlementParams, as for exerciseOption, except the delegating operation is the option's maker's and is signed over the redeem payload. |
Returns
Promise<L["receipt"][]>
Inherited from
removeAuthorizedKey()
removeAuthorizedKey(key): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:207
revokes a key previously authorized via setAuthorizedKey, closing
its signing-key record (the rent is refunded to the wallet). Operations
signed with key are rejected afterwards. The wallet must sign this
transaction itself.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | Bytes32 | the public key to deauthorize. |
Returns
Promise<L["receipt"][]>
Inherited from
OvercastWriter.removeAuthorizedKey
repayCollateral()
repayCollateral(option, amount): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:164
repays previously borrowed collateral back into the option's escrow, reducing the outstanding-borrow debt tracked on the option. Permissionless — any signer holding the collateral asset may repay on the taker's behalf; the repaying wallet must sign this transaction itself.
Parameters
| Parameter | Type | Description |
|---|---|---|
option | MarketOption | - |
amount | bigint | native (smallest-unit) amount of option.details.collateralAsset to repay; must not exceed the option's current outstanding borrow. |
Returns
Promise<L["receipt"][]>
Inherited from
OvercastWriter.repayCollateral
setAuthorizedKey()
setAuthorizedKey(key, permissions?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:197
authorizes key to sign SignedOperations on the calling wallet's
behalf. Registers a signing-key record owned by the wallet; thereafter an
operator may submit that wallet's delegable calls (createCollateralOffer,
createSettlementOffer, exerciseOption) by presenting an operation signed
with key. The wallet must sign this transaction itself — you can only
authorize keys for yourself.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | Bytes32 | the public key to authorize as a signer for this wallet. |
permissions? | number | the permissions bitmap - defaults to 0xFFFF granting all permissions. Build the bitmap with buildPermissionsBitmap |
Returns
Promise<L["receipt"][]>
Inherited from
OvercastWriter.setAuthorizedKey
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>
Inherited from
OvercastReader.settlementLayerKind
withdraw()
withdraw(withdraw, signedOperation?): Promise<L["receipt"][]>;
Defined in: packages/overcast-core/src/protocol/writer.ts:181
withdraws funds from the withdrawer's protocol escrow vault
Parameters
| Parameter | Type | Description |
|---|---|---|
withdraw | WithdrawParams | - |
signedOperation? | SignedOperation | - |
Returns
Promise<L["receipt"][]>