Skip to main content

Class: MemoryStore

Defined in: packages/overcast-core/src/storage/memory.ts:82

In-memory reference implementation of the storage ports. Backs both the trusted write side (OvercastStore) and the public read side (OvercastView); a real deployment swaps this for a database-backed store implementing the same interfaces.

Reads return curated (display) shapes, so the store is constructed with an OvercastCurator — the asset metadata plus the address boundary, used only on the way out. The projections it folds events into are canonical (Bytes32 throughout, so getId needs nothing extra); curation is what turns those slots back into chain-formatted addresses and resolves each leg's asset. Filtering, sorting and pagination are done in JS here — the same query objects a SQL implementation would push down to the database.

The curator is per-domain on both halves because the event stream is not single-chain: whatever domains the indexer feeding it scans all land in the same maps, so the boundary and the asset metadata are picked per record from the domain its own terms name (OptionDetails.domain), and a domain with no layer registered curates through hex (see OvercastUtilsRegistry).

Implements​

Constructors​

Constructor​

new MemoryStore(curator?): MemoryStore;

Defined in: packages/overcast-core/src/storage/memory.ts:137

Parameters​

ParameterType
curatorOvercastCurator

Returns​

MemoryStore

Properties​

authorizedKeys​

authorizedKeys: Map<string, AuthorizedKey>;

Defined in: packages/overcast-core/src/storage/memory.ts:113

Delegated signing keys, keyed ${domain}:${owner}:${authorizedKey} — the same key the SQL projection uses. Without the domain a revoke on one chain would deactivate the same pair on another.


backfillComplete​

backfillComplete: Set<number>;

Defined in: packages/overcast-core/src/storage/memory.ts:90

Domains whose backfill is complete.


checkpoints​

checkpoints: Map<string, Checkpoint>;

Defined in: packages/overcast-core/src/storage/memory.ts:88

Resume cursors, keyed ${domain}:${kind} — a cursor is a position in one deployment's log, so domains keep their own (see OvercastStore.getCheckpoint).


offerCancelled​

offerCancelled: Map<Bytes32, OfferCancelled>;

Defined in: packages/overcast-core/src/storage/memory.ts:97


offerCreated​

offerCreated: Map<Bytes32, OfferCreated>;

Defined in: packages/overcast-core/src/storage/memory.ts:95

Indexed *Created events, retained for their createdAt (checkpoint ts).


offers​

offers: Map<Bytes32, Offer>;

Defined in: packages/overcast-core/src/storage/memory.ts:107

Every offer ever created — open or closed; see lifecycleOf.


operations​

operations: Map<string, ConsumedOperation>;

Defined in: packages/overcast-core/src/storage/memory.ts:119

Delegated operations' replay-protection records, keyed ${domain}:${key} (same key as the SQL projection). Folded by applyOperations.


optionBorrowed​

optionBorrowed: Map<Bytes32, OptionBorrowed[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:101


optionCreated​

optionCreated: Map<Bytes32, MarketOptionCreated>;

Defined in: packages/overcast-core/src/storage/memory.ts:96


optionExercised​

optionExercised: Map<Bytes32, OptionExercised[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:99

Exercise / redeem / borrow / repay events, keyed by the option id they belong to.


optionRedeemed​

optionRedeemed: Map<Bytes32, OptionRedeemed[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:100


optionRepaid​

optionRepaid: Map<Bytes32, OptionRepaid[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:102


options​

options: Map<Bytes32, MarketOption>;

Defined in: packages/overcast-core/src/storage/memory.ts:105

Derived current-state projections.


quotes​

quotes: Map<string, StoredQuote>;

Defined in: packages/overcast-core/src/storage/memory.ts:123


rfqs​

rfqs: Map<string, StoredRfq>;

Defined in: packages/overcast-core/src/storage/memory.ts:122

Off-chain RFQ channel, persisted for after-the-fact fetches.

Methods​

getCheckpoint()​

getCheckpoint(domain, kind): Promise<Checkpoint | null>;

Defined in: packages/overcast-core/src/storage/memory.ts:243

One deployment's resume cursor for the given loop (see CheckpointKind). Cursors are keyed by (domain, kind): an indexer runs per deployment and its cursor is a position in that chain's log, so two deployments' loops must not share one.

Parameters​

ParameterType
domainnumber
kindCheckpointKind

Returns​

Promise<Checkpoint | null>

Implementation of​

OvercastStorage.getCheckpoint

getOffer()​

getOffer(id): Promise<
| WithId<CuratedOffer>
| null>;

Defined in: packages/overcast-core/src/storage/memory.ts:374

Parameters​

ParameterTypeDescription
idBytes32the offer's content-address (see getId).

Returns​

Promise< | WithId<CuratedOffer> | null>

Implementation of​

OvercastStorage.getOffer

getOption()​

getOption(id): Promise<CuratedMarketOption | null>;

Defined in: packages/overcast-core/src/storage/memory.ts:343

Parameters​

ParameterTypeDescription
idBytes32the option's content-address (see getId).

Returns​

Promise<CuratedMarketOption | null>

Implementation of​

OvercastStorage.getOption

getOptionExercised()​

getOptionExercised(option): Promise<OptionExercised[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:459

Parameters​

ParameterType
optionBytes32

Returns​

Promise<OptionExercised[]>

Implementation of​

OvercastEventHistory.getOptionExercised


getOptionRedeemed()​

getOptionRedeemed(option): Promise<OptionRedeemed[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:462

Parameters​

ParameterType
optionBytes32

Returns​

Promise<OptionRedeemed[]>

Implementation of​

OvercastEventHistory.getOptionRedeemed


getOptionTotals()​

getOptionTotals(option): Promise<OptionTotals>;

Defined in: packages/overcast-core/src/storage/memory.ts:465

Parameters​

ParameterType
optionBytes32

Returns​

Promise<OptionTotals>

Implementation of​

OvercastEventHistory.getOptionTotals


getRfq()​

getRfq(id): Promise<StoredRfq | null>;

Defined in: packages/overcast-core/src/storage/memory.ts:440

Parameters​

ParameterType
idstring

Returns​

Promise<StoredRfq | null>

Implementation of​

OvercastStorage.getRfq

insertEvents()​

insertEvents(events, _commitment): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:147

Insert a batch of indexed on-chain events at the given commitment (default live), updating the derived offer / option / totals projections. Idempotent per event so re-indexing a range is safe; a finalized insert upgrades an existing live row.

Parameters​

ParameterType
eventsIndexedEvents[]
_commitmentCommitment

Returns​

Promise<void>

Implementation of​

OvercastStorage.insertEvents

isBackfillComplete()​

isBackfillComplete(domain): Promise<boolean>;

Defined in: packages/overcast-core/src/storage/memory.ts:271

Whether one deployment's backfill is complete.

Parameters​

ParameterType
domainnumber

Returns​

Promise<boolean>

Implementation of​

OvercastStorage.isBackfillComplete

listAssets()​

listAssets(query?): Promise<object[]>;

Defined in: packages/overcast-core/src/storage/memory.ts:451

The assets the deployment holds curated metadata for (GET /assets) — what raw OptionDetails asset addresses are resolved against. Drives a client's pick-from-list UX, symbol display and decimal scaling. Returned as a bare list (not paged) — it is small, curated reference data, not indexed data.

Not a permission list. An asset that is absent is uncurated, not unsupported: the protocol trades whatever an offer's terms name, so options are written over it all the same — its amounts simply render in native units against a bare address until someone describes it.

Filter by domain for one chain's assets; unfiltered returns every domain the deployment serves, each asset tagged with its own Asset.domain. A consumer pinned to one chain wants the filtered form — which is what OvercastApp.assets() asks for.

Parameters​

ParameterType
query?AssetQuery

Returns​

Promise<object[]>

Implementation of​

OvercastStorage.listAssets

listAuthorizedKeys()​

listAuthorizedKeys(query?): Promise<Page<AuthorizedKey>>;

Defined in: packages/overcast-core/src/storage/memory.ts:384

Delegated signing keys, paginated and filterable — the projection of the AuthorizedKeySet / AuthorizedKeyRemoved history. Revoked keys are included by default; filter on active to get only the live delegations.

This is a read of on-chain authorization state, not an authorization check: it says who an account has delegated to, and the protocol still verifies every SignedOperation against the chain itself.

Parameters​

ParameterType
query?AuthorizedKeyQuery

Returns​

Promise<Page<AuthorizedKey>>

Implementation of​

OvercastStorage.listAuthorizedKeys

listOffers()​

listOffers(query?): Promise<Page<WithId<CuratedOffer>>>;

Defined in: packages/overcast-core/src/storage/memory.ts:353

Offers, each tagged with its content-address id and its lifecycle OfferStatus. Matched and cancelled offers are included by default; filter on status for just the open book (open) or just the history (closed).

Parameters​

ParameterType
query?OfferQuery

Returns​

Promise<Page<WithId<CuratedOffer>>>

Implementation of​

OvercastStorage.listOffers

listOperations()​

listOperations(query?): Promise<Page<ConsumedOperation>>;

Defined in: packages/overcast-core/src/storage/memory.ts:403

Delegated operations' replay-protection records, paginated and filterable — the projection of OperationConsumed / OperationReplayProtectionKeyCleared. Sorted by expiry ascending by default, so a expired: true, cleared: false page is a ready-made oldest-first sweep of on-chain replay-protection state to reclaim.

Parameters​

ParameterType
query?OperationQuery

Returns​

Promise<Page<ConsumedOperation>>

Implementation of​

OvercastStorage.listOperations

listOptions()​

listOptions(query?): Promise<Page<CuratedMarketOption>>;

Defined in: packages/overcast-core/src/storage/memory.ts:290

Curated market options, paginated and filterable.

Parameters​

ParameterType
query?OptionQuery

Returns​

Promise<Page<CuratedMarketOption>>

Implementation of​

OvercastStorage.listOptions

listQuotes()​

listQuotes(rfqId, page?): Promise<Page<StoredQuote>>;

Defined in: packages/overcast-core/src/storage/memory.ts:444

Quotes submitted against a given RFQ.

Parameters​

ParameterType
rfqIdstring
page?Pagination

Returns​

Promise<Page<StoredQuote>>

Implementation of​

OvercastStorage.listQuotes

listRfqs()​

listRfqs(query?): Promise<Page<StoredRfq>>;

Defined in: packages/overcast-core/src/storage/memory.ts:424

Persisted RFQs — both still-open and historical.

Parameters​

ParameterType
query?RfqQuery

Returns​

Promise<Page<StoredRfq>>

Implementation of​

OvercastStorage.listRfqs

listUserDeposits()​

listUserDeposits(_query?): Promise<Page<UserDepositWire>>;

Defined in: packages/overcast-core/src/storage/memory.ts:286

Live vault balances, paginated and filterable. Still uncurated — canonical slots and a decimal-string amount (UserDepositWire).

Parameters​

ParameterType
_query?UserDepositQuery

Returns​

Promise<Page<UserDepositWire>>

Implementation of​

OvercastStorage.listUserDeposits

recordQuote()​

recordQuote(quote): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:210

Persist (or update) an off-chain quote submitted against an RFQ.

Parameters​

ParameterType
quoteStoredQuote

Returns​

Promise<void>

Implementation of​

OvercastStorage.recordQuote

recordRfq()​

recordRfq(rfq): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:202

Persist (or update) an off-chain RFQ so it is fetchable after the fact.

Parameters​

ParameterType
rfqStoredRfq

Returns​

Promise<void>

Implementation of​

OvercastStorage.recordRfq

setBackfillComplete()​

setBackfillComplete(domain, complete): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:274

Mark, or on false clear, one deployment's backfill as complete.

Parameters​

ParameterType
domainnumber
completeboolean

Returns​

Promise<void>

Implementation of​

OvercastStorage.setBackfillComplete

setCheckpoint()​

setCheckpoint(
domain,
kind,
checkpoint): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:256

Write, or on null clear, one deployment's cursor for the given loop.

Parameters​

ParameterType
domainnumber
kindCheckpointKind
checkpointCheckpoint | null

Returns​

Promise<void>

Implementation of​

OvercastStorage.setCheckpoint

setQuoteStatus()​

setQuoteStatus(
quoteId,
status,
optionId?): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:226

Transition a quote to a new status (and bind its optionId once accepted), stamping updatedAt. No-op if the quote is unknown.

Parameters​

ParameterType
quoteIdstring
statusQuoteStatus
optionId?Bytes32

Returns​

Promise<void>

Implementation of​

OvercastStorage.setQuoteStatus

setRfqStatus()​

setRfqStatus(rfqId, status): Promise<void>;

Defined in: packages/overcast-core/src/storage/memory.ts:218

Transition a persisted RFQ to a new lifecycle status, stamping updatedAt. A cheaper alternative to reconstructing the whole StoredRfq for a recordRfq upsert. No-op if the RFQ is unknown.

Parameters​

ParameterType
rfqIdstring
statusRfqStatus

Returns​

Promise<void>

Implementation of​

OvercastStorage.setRfqStatus