@zkp2p/indexer-schema 0.1.4 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -40
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -1
- package/dist/schema.graphql +377 -18
- package/dist/types.d.ts +855 -0
- package/dist/types.js +30 -0
- package/dist/types.ts +857 -0
- package/docs/schema-field-reference.md +1391 -0
- package/llms.txt +660 -0
- package/package.json +27 -9
package/dist/types.ts
ADDED
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
// Auto-generated from schema/domain.graphql — do not edit directly.
|
|
2
|
+
// Enriched with field documentation from docs/schema-field-reference.md.
|
|
3
|
+
// Run `node scripts/copy-schema.js` to regenerate.
|
|
4
|
+
|
|
5
|
+
export enum DepositStatus {
|
|
6
|
+
/** Deposit can still participate in the maker lifecycle. Whether it is currently quoteable also depends on `acceptingIntents`, remaining liquidity, payment-method activity, and a non-zero resolved rate. */
|
|
7
|
+
ACTIVE = 'ACTIVE',
|
|
8
|
+
/** Deposit has been explicitly closed on-chain. Quote candidates for closed deposits are deleted. */
|
|
9
|
+
CLOSED = 'CLOSED',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum IntentStatus {
|
|
13
|
+
/** Intent exists and funds may be locked, but settlement is not final yet. */
|
|
14
|
+
SIGNALED = 'SIGNALED',
|
|
15
|
+
/** Intent completed normally. */
|
|
16
|
+
FULFILLED = 'FULFILLED',
|
|
17
|
+
/** Intent was cancelled/unlocked on-chain. */
|
|
18
|
+
PRUNED = 'PRUNED',
|
|
19
|
+
/** Funds were released through the manual-release path rather than the normal verifier path. */
|
|
20
|
+
MANUALLY_RELEASED = 'MANUALLY_RELEASED',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum PriceSnapshotStatus {
|
|
24
|
+
/** Snapshot was fetched during normal live indexing. */
|
|
25
|
+
LIVE = 'LIVE',
|
|
26
|
+
/** Snapshot was created during historical catch-up or another non-live backfill flow. */
|
|
27
|
+
BACKFILL = 'BACKFILL',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export enum ProfitStatus {
|
|
31
|
+
/** Profit could be computed because a usable FX snapshot existed. */
|
|
32
|
+
COMPUTED = 'COMPUTED',
|
|
33
|
+
/** Profit row exists, but the oracle side of the comparison was unavailable at write time. */
|
|
34
|
+
PENDING = 'PENDING',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Canonical maker-owned escrow position. This is the root entity for most business queries. Deposit rows are created from deposit-received events and then mutated by funding, withdrawal, closing, intent lock/unlock, delegated-rate-manager, and oracle-resolution flows.
|
|
39
|
+
*
|
|
40
|
+
* @id escrowAddress_depositId
|
|
41
|
+
*
|
|
42
|
+
* **Relationships:**
|
|
43
|
+
* - Parent of `Intent`, `DepositPaymentMethod`, `MethodCurrency`, `DepositFundActivity`, and `DepositDailySnapshot`
|
|
44
|
+
* - Indirect source for `QuoteCandidate`
|
|
45
|
+
* - Optional many-to-one relationship to `RateManager`
|
|
46
|
+
* - Source record for `MakerStats`, `ManagerStats`, and manager aggregate balances
|
|
47
|
+
*/
|
|
48
|
+
export interface Deposit {
|
|
49
|
+
/** Canonical deposit key `escrowAddress_depositId`. This exists because raw on-chain `depositId` is not globally unique across escrows. */
|
|
50
|
+
id: string;
|
|
51
|
+
/** Chain where the escrow contract lives. */
|
|
52
|
+
chainId: number;
|
|
53
|
+
/** Escrow contract address that owns the deposit funds and scopes the deposit namespace. */
|
|
54
|
+
escrowAddress: string;
|
|
55
|
+
/** Raw on-chain deposit identifier emitted by the escrow contract. */
|
|
56
|
+
depositId: string;
|
|
57
|
+
/** Maker address that created and owns the deposit. */
|
|
58
|
+
depositor: string;
|
|
59
|
+
/** ERC20 token being sold. In practice the indexer only materializes supported USDC addresses. */
|
|
60
|
+
token: string;
|
|
61
|
+
/** Address currently allowed to manage deposit settings on behalf of the maker. */
|
|
62
|
+
delegate: string;
|
|
63
|
+
/** Smallest token amount the maker will accept for a single intent. */
|
|
64
|
+
intentAmountMin: string;
|
|
65
|
+
/** Largest token amount the maker will accept for a single intent. */
|
|
66
|
+
intentAmountMax: string;
|
|
67
|
+
/** Explicit maker toggle. Quotes should be suppressed when this is `false` even if liquidity still exists. */
|
|
68
|
+
acceptingIntents: boolean;
|
|
69
|
+
/** Coarse lifecycle state. `CLOSED` means the deposit was explicitly closed; it is stronger than merely having no liquidity. */
|
|
70
|
+
status: DepositStatus;
|
|
71
|
+
/** Immediately available maker liquidity that can still be locked into new intents or withdrawn. */
|
|
72
|
+
remainingDeposits: string;
|
|
73
|
+
/** Liquidity currently reserved by signaled intents that have not been fully resolved yet. */
|
|
74
|
+
outstandingIntentAmount: string;
|
|
75
|
+
/** All-time amount that actually left the deposit to takers through fulfillment or manual release. */
|
|
76
|
+
totalAmountTaken: string;
|
|
77
|
+
/** All-time amount withdrawn back to the maker through withdrawal events. */
|
|
78
|
+
totalWithdrawn: string;
|
|
79
|
+
/** Total number of intents ever locked against the deposit. */
|
|
80
|
+
totalIntents: number;
|
|
81
|
+
/** Count of intent-lock events seen for this deposit. */
|
|
82
|
+
signaledIntents: number;
|
|
83
|
+
/** Count of intents that finished successfully or via manual release. */
|
|
84
|
+
fulfilledIntents: number;
|
|
85
|
+
/** Count of intents that were unlocked/cancelled without fulfillment. */
|
|
86
|
+
prunedIntents: number;
|
|
87
|
+
/** Deposit-level quality score in basis points. New deposits start at `10000`; later it tracks `fulfilled / total` in basis points. */
|
|
88
|
+
successRateBps: number;
|
|
89
|
+
/** Block in which the deposit was first seen. */
|
|
90
|
+
blockNumber: string;
|
|
91
|
+
/** Creation timestamp from the deposit-received event. */
|
|
92
|
+
timestamp: string;
|
|
93
|
+
/** Transaction that created the deposit row. */
|
|
94
|
+
txHash: string;
|
|
95
|
+
/** Timestamp of the most recent mutation to this deposit row. */
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
/** Optional delegated rate-manager identifier currently assigned to the deposit. */
|
|
98
|
+
rateManagerId?: string;
|
|
99
|
+
/** Optional rate-manager contract address paired with `rateManagerId`. */
|
|
100
|
+
rateManagerAddress?: string;
|
|
101
|
+
/** Timestamp when the current delegated manager assignment was applied. */
|
|
102
|
+
delegatedAt?: string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Deposit-scoped payment platform configuration. Each row says "this deposit accepts this payment-method hash, with these payee details and optional gating requirements."
|
|
107
|
+
*
|
|
108
|
+
* @id escrowAddress_depositId_paymentMethodHash
|
|
109
|
+
*
|
|
110
|
+
* **Relationships:**
|
|
111
|
+
* - Many-to-one to `Deposit` through `depositId`
|
|
112
|
+
* - Logical sibling of `MethodCurrency` on `(depositId, paymentMethodHash)`
|
|
113
|
+
* - One of the three source entities used to materialize `QuoteCandidate`
|
|
114
|
+
*/
|
|
115
|
+
export interface DepositPaymentMethod {
|
|
116
|
+
/** Composite key `escrowAddress_depositId_paymentMethodHash`. */
|
|
117
|
+
id: string;
|
|
118
|
+
/** Chain where the parent deposit lives. */
|
|
119
|
+
chainId: number;
|
|
120
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
121
|
+
depositId: string;
|
|
122
|
+
/** Raw on-chain deposit id copied for convenience and external correlation. */
|
|
123
|
+
depositIdOnContract: string;
|
|
124
|
+
/** Canonical bytes32-like payment-method identifier used by contracts and quoting. */
|
|
125
|
+
paymentMethodHash: string;
|
|
126
|
+
/** Optional external service address/string that must authorize or gate takers before they can use this method. */
|
|
127
|
+
intentGatingService: string;
|
|
128
|
+
/** Hash of the off-chain payee details that the taker must prove they paid. */
|
|
129
|
+
payeeDetailsHash: string;
|
|
130
|
+
/** Method-level on/off toggle. `QuoteCandidate.isActive` also depends on this value. */
|
|
131
|
+
active: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Per `(deposit, payment method, fiat currency)` pricing configuration. This is the most important rate-resolution entity in the schema. It stores the depositor's fixed floor, delegated manager input, oracle configuration and snapshots, and the final resolved rate that quoting and validation use.
|
|
136
|
+
*
|
|
137
|
+
* @id escrowAddress_depositId_paymentMethodHash_currencyCode
|
|
138
|
+
*
|
|
139
|
+
* **Relationships:**
|
|
140
|
+
* - Many-to-one to `Deposit`
|
|
141
|
+
* - Logical many-to-one to `DepositPaymentMethod` by `(depositId, paymentMethodHash)`
|
|
142
|
+
* - Optional many-to-one to `RateManager` through `rateManagerId` plus the deposit's `rateManagerAddress`
|
|
143
|
+
* - Source record for `QuoteCandidate`; the quote row reuses this entity's identity
|
|
144
|
+
*/
|
|
145
|
+
export interface MethodCurrency {
|
|
146
|
+
/** Composite key `escrowAddress_depositId_paymentMethodHash_currencyCode`. */
|
|
147
|
+
id: string;
|
|
148
|
+
/** Chain where the parent deposit lives. */
|
|
149
|
+
chainId: number;
|
|
150
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
151
|
+
depositId: string;
|
|
152
|
+
/** Raw on-chain deposit id for cross-checking with contract logs. */
|
|
153
|
+
depositIdOnContract: string;
|
|
154
|
+
/** Payment-method component of the tuple. */
|
|
155
|
+
paymentMethodHash: string;
|
|
156
|
+
/** Fiat currency component of the tuple. */
|
|
157
|
+
currencyCode: string;
|
|
158
|
+
/** Maker-defined fixed floor for the tuple. In legacy flows this can also be the directly used static rate. */
|
|
159
|
+
minConversionRate: string;
|
|
160
|
+
/** Delegated manager quote before floor enforcement and before manager fee is applied. */
|
|
161
|
+
managerRate?: string;
|
|
162
|
+
/** Delegated manager fee rate in 1e18 precision. This does not lower `conversionRate`; it is turned into a taker-facing markup when computing `takerConversionRate`. */
|
|
163
|
+
managerFee?: string;
|
|
164
|
+
/** Final gross resolved rate used for intent validation and contract-aligned quote logic. */
|
|
165
|
+
conversionRate?: string;
|
|
166
|
+
/** Final all-in rate shown to takers. In delegated mode this incorporates manager fee on top of the gross rate. */
|
|
167
|
+
takerConversionRate?: string;
|
|
168
|
+
/** Resolution reason for `conversionRate`, such as `MANAGER`, `ORACLE`, `ESCROW_FLOOR`, `MANAGER_DISABLED`, `ORACLE_HALTED`, or `NO_FLOOR`. */
|
|
169
|
+
rateSource?: string;
|
|
170
|
+
/** Delegated manager id that supplied the current delegated rate, if any. */
|
|
171
|
+
rateManagerId?: string;
|
|
172
|
+
/** Oracle adapter contract address used to interpret `adapterConfig`. */
|
|
173
|
+
adapter?: string;
|
|
174
|
+
/** Encoded adapter config bytes stored exactly as emitted. */
|
|
175
|
+
adapterConfig?: string;
|
|
176
|
+
/** Resolved oracle feed address or feed id after decoding the adapter config. */
|
|
177
|
+
feed?: string;
|
|
178
|
+
/** Feed decimals used to normalize oracle answers into the shared 1e18 rate format. */
|
|
179
|
+
feedDecimals?: number;
|
|
180
|
+
/** Maker-configured markup applied to raw oracle output before final floor/manager resolution. */
|
|
181
|
+
spreadBps?: number;
|
|
182
|
+
/** Maximum acceptable oracle age in seconds before the tuple is considered stale. */
|
|
183
|
+
maxStaleness?: string;
|
|
184
|
+
/** Whether the oracle answer must be inverted before being converted into the shared rate representation. */
|
|
185
|
+
invert?: boolean;
|
|
186
|
+
/** Raw oracle-derived rate before spread markup. */
|
|
187
|
+
oracleRate?: string;
|
|
188
|
+
/** Oracle rate after applying `spreadBps`. */
|
|
189
|
+
effectiveOracleRate?: string;
|
|
190
|
+
/** Timestamp of the latest accepted oracle datapoint used by this row. */
|
|
191
|
+
lastOracleUpdatedAt?: string;
|
|
192
|
+
/** Decoded oracle kind, currently `oracle_chainlink`, `oracle_pyth`, or `oracle_unknown`. */
|
|
193
|
+
kind?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Canonical taker intent row. An `Intent` starts when the taker signals intent and ends in fulfillment or prune. This entity intentionally separates on-chain lifecycle (`status`) from off-chain expiry reconciliation (`isExpired`).
|
|
198
|
+
*
|
|
199
|
+
* @id chainId_intentHash
|
|
200
|
+
*
|
|
201
|
+
* **Relationships:**
|
|
202
|
+
* - Many-to-one to `Deposit`
|
|
203
|
+
* - Parent of `ReferralFeeDistribution`
|
|
204
|
+
* - Feeds `TakerStats`, maker stats rollups, profit snapshots, and manager aggregates
|
|
205
|
+
*/
|
|
206
|
+
export interface Intent {
|
|
207
|
+
/** Canonical key `chainId_intentHash`. */
|
|
208
|
+
id: string;
|
|
209
|
+
/** Raw on-chain intent hash. */
|
|
210
|
+
intentHash: string;
|
|
211
|
+
/** Contract address that coordinated the intent. In legacy v2 this is effectively the escrow address; in newer flows it is the orchestrator. */
|
|
212
|
+
orchestratorAddress: string;
|
|
213
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
214
|
+
depositId: string;
|
|
215
|
+
/** Verifier contract or address associated with the payment proof. In v21 it is updated again when payment verification arrives. */
|
|
216
|
+
verifier: string;
|
|
217
|
+
/** Payment-method hash associated with the intent. Optional because some legacy flows populate it indirectly. */
|
|
218
|
+
paymentMethodHash?: string;
|
|
219
|
+
/** Taker wallet that owns the intent. */
|
|
220
|
+
owner: string;
|
|
221
|
+
/** Recipient address for the released token payout. */
|
|
222
|
+
toAddress: string;
|
|
223
|
+
/** Token amount signaled for the intent. This is the nominal amount, not necessarily the realized release amount. */
|
|
224
|
+
amount: string;
|
|
225
|
+
/** Fiat currency signaled at quote time. */
|
|
226
|
+
fiatCurrency: string;
|
|
227
|
+
/** Quote-time rate captured on the intent. */
|
|
228
|
+
conversionRate: string;
|
|
229
|
+
/** On-chain lifecycle state only. This does not encode off-chain expiry reconciliation. */
|
|
230
|
+
status: IntentStatus;
|
|
231
|
+
/** Off-chain reconciler flag that says the lock has timed out and liquidity was already unlocked off-chain. An intent can be `status = SIGNALED` and `isExpired = true` at the same time. */
|
|
232
|
+
isExpired: boolean;
|
|
233
|
+
/** Transaction that created/signaled the intent. */
|
|
234
|
+
signalTxHash: string;
|
|
235
|
+
/** Signal timestamp taken from the emitted event/proof context. */
|
|
236
|
+
signalTimestamp: string;
|
|
237
|
+
/** Transaction that fulfilled or manually released the intent. */
|
|
238
|
+
fulfillTxHash?: string;
|
|
239
|
+
/** Timestamp of fulfillment/manual release. */
|
|
240
|
+
fulfillTimestamp?: string;
|
|
241
|
+
/** Transaction that pruned/unlocked the intent. */
|
|
242
|
+
pruneTxHash?: string;
|
|
243
|
+
/** Timestamp of prune/unlock. */
|
|
244
|
+
pruneTimestamp?: string;
|
|
245
|
+
/** Canonical expiry timestamp used by the block reconciler. It is refined by lock/extend events after the signal event. */
|
|
246
|
+
expiryTime: string;
|
|
247
|
+
/** Last mutation timestamp for this intent row. */
|
|
248
|
+
updatedAt: string;
|
|
249
|
+
/** Actual fiat amount proven by the verifier. This may differ from `amount` in partial-payment scenarios. */
|
|
250
|
+
paymentAmount?: string;
|
|
251
|
+
/** Actual fiat currency proven by the verifier. This may differ from `fiatCurrency`. */
|
|
252
|
+
paymentCurrency?: string;
|
|
253
|
+
/** Timestamp contained in the verified payment proof. */
|
|
254
|
+
paymentTimestamp?: string;
|
|
255
|
+
/** External payment identifier from the payment rail/provider. */
|
|
256
|
+
paymentId?: string;
|
|
257
|
+
/** Gross token amount released from escrow before protocol or referral fees. May differ from `amount`. */
|
|
258
|
+
releasedAmount?: string;
|
|
259
|
+
/** Net token amount actually received by the taker after protocol and referrer deductions. */
|
|
260
|
+
takerAmountNetFees?: string;
|
|
261
|
+
/** Snapshotted delegated manager id relevant to this intent, if a manager fee applied. */
|
|
262
|
+
rateManagerId?: string;
|
|
263
|
+
/** Snapshotted manager fee rate in 1e18 precision. */
|
|
264
|
+
managerFee?: string;
|
|
265
|
+
/** Address that receives the manager fee on settlement. */
|
|
266
|
+
managerFeeRecipient?: string;
|
|
267
|
+
/** Signal-time fee estimate based on the signaled intent amount. */
|
|
268
|
+
managerFeeAmount?: string;
|
|
269
|
+
/** Release-time manager fee based on the actual released amount. */
|
|
270
|
+
realizedManagerFeeAmount?: string;
|
|
271
|
+
/** Sum of all `ReferralFeeDistribution.feeAmount` rows written for this intent. */
|
|
272
|
+
totalReferralFeeAmount?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Per-recipient referral-fee settlement rows for v2.2. The `Intent` stores the aggregate; this entity preserves recipient-level detail.
|
|
277
|
+
*
|
|
278
|
+
* @id chainId_intentHash_feeRecipient
|
|
279
|
+
*
|
|
280
|
+
* **Relationships:**
|
|
281
|
+
* - Many-to-one to `Intent` through `intentId`
|
|
282
|
+
*/
|
|
283
|
+
export interface ReferralFeeDistribution {
|
|
284
|
+
/** Composite key `chainId_intentHash_feeRecipient`. */
|
|
285
|
+
id: string;
|
|
286
|
+
/** Chain where the parent intent settled. */
|
|
287
|
+
chainId: number;
|
|
288
|
+
/** Raw on-chain intent hash. */
|
|
289
|
+
intentHash: string;
|
|
290
|
+
/** Foreign-key string to `Intent.id`. */
|
|
291
|
+
intentId: string;
|
|
292
|
+
/** Address that received this referral-fee slice. */
|
|
293
|
+
feeRecipient: string;
|
|
294
|
+
/** Actual token amount distributed to `feeRecipient`. */
|
|
295
|
+
feeAmount: string;
|
|
296
|
+
/** Transaction that emitted the distribution event. */
|
|
297
|
+
txHash: string;
|
|
298
|
+
/** Settlement timestamp for this distribution row. */
|
|
299
|
+
timestamp: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Per-owner behavioral aggregate. This row is updated from signaled, fulfilled/manual-release, and prune flows. In v21 it also carries a `lockScore` penalty based on how long cancelled intents kept liquidity locked.
|
|
304
|
+
*
|
|
305
|
+
* @id chainId_owner (owner lowercased)
|
|
306
|
+
*
|
|
307
|
+
* **Relationships:**
|
|
308
|
+
* - Implicit many-to-one from all `Intent` rows whose `owner` matches `TakerStats.owner`
|
|
309
|
+
*/
|
|
310
|
+
export interface TakerStats {
|
|
311
|
+
/** Composite key `chainId_owner`, with the owner lowercased. */
|
|
312
|
+
id: string;
|
|
313
|
+
/** Chain on which the taker activity occurred. */
|
|
314
|
+
chainId: number;
|
|
315
|
+
/** Lowercased taker address used as the aggregation key. */
|
|
316
|
+
owner: string;
|
|
317
|
+
/** Number of intents ever signaled by this taker. */
|
|
318
|
+
lifetimeSignaledCount: number;
|
|
319
|
+
/** Number of non-manual intents that fulfilled successfully. */
|
|
320
|
+
lifetimeFulfilledCount: number;
|
|
321
|
+
/** Number of intents that ended via manual release. */
|
|
322
|
+
lifetimeManualReleaseCount: number;
|
|
323
|
+
/** Number of intents that were pruned/cancelled. Same-tx prune-then-fulfill cases are rolled back. */
|
|
324
|
+
lifetimePruneCount: number;
|
|
325
|
+
/** Sum of token amount from cancelled/pruned intents, with rollback if a same-tx prune later fulfills. */
|
|
326
|
+
totalCancelledVolume: string;
|
|
327
|
+
/** Sum of token amount from fulfilled/manual-release intents. */
|
|
328
|
+
totalFulfilledVolume: string;
|
|
329
|
+
/** Penalty-style score derived from cancelled intent lock duration. Currently meaningful only in the v21 path. */
|
|
330
|
+
lockScore: string;
|
|
331
|
+
/** Timestamp of the taker's most recent intent signal. */
|
|
332
|
+
lastIntentAt?: string;
|
|
333
|
+
/** Timestamp of the taker's most recent fulfillment/manual release. */
|
|
334
|
+
lastFulfilledAt?: string;
|
|
335
|
+
/** Timestamp of the taker's first observed intent. */
|
|
336
|
+
firstSeenAt?: string;
|
|
337
|
+
/** Last time this aggregate row changed. */
|
|
338
|
+
updatedAt: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Per-maker aggregate across every deposit owned by the maker on a chain. This is deposit-derived state plus realized-profit rollups.
|
|
343
|
+
*
|
|
344
|
+
* @id chainId_maker (maker lowercased)
|
|
345
|
+
*
|
|
346
|
+
* **Relationships:**
|
|
347
|
+
* - Implicit aggregation over all `Deposit` rows where `Deposit.depositor = MakerStats.maker`
|
|
348
|
+
* - Parent summary for `MakerPlatformStats` and `MakerCurrencyStats`
|
|
349
|
+
*/
|
|
350
|
+
export interface MakerStats {
|
|
351
|
+
/** Composite key `chainId_maker`, with maker lowercased in the id. */
|
|
352
|
+
id: string;
|
|
353
|
+
/** Chain on which the maker operates. */
|
|
354
|
+
chainId: number;
|
|
355
|
+
/** Maker/depositor address used as the aggregation key. */
|
|
356
|
+
maker: string;
|
|
357
|
+
/** Sum of `Deposit.totalAmountTaken` across the maker's deposits. */
|
|
358
|
+
totalAmountTaken: string;
|
|
359
|
+
/** All-time gross capital committed by the maker, derived per deposit as `remaining + outstanding + taken + withdrawn`. */
|
|
360
|
+
grossDeposited: string;
|
|
361
|
+
/** Sum of maker withdrawals across all deposits. */
|
|
362
|
+
totalWithdrawn: string;
|
|
363
|
+
/** Sum of liquidity currently locked in active intents across all deposits. */
|
|
364
|
+
outstandingIntentAmount: string;
|
|
365
|
+
/** Number of deposits that are both `ACTIVE` and `acceptingIntents = true`. */
|
|
366
|
+
activeDepositCount: number;
|
|
367
|
+
/** Number of deposit rows ever created for the maker. */
|
|
368
|
+
totalDepositCount: number;
|
|
369
|
+
/** Sum of `Deposit.fulfilledIntents` across the maker's deposits. */
|
|
370
|
+
fulfilledIntents: number;
|
|
371
|
+
/** Sum of `Deposit.prunedIntents` across the maker's deposits. */
|
|
372
|
+
prunedIntents: number;
|
|
373
|
+
/** Sum of `Deposit.signaledIntents` across the maker's deposits. */
|
|
374
|
+
signaledIntents: number;
|
|
375
|
+
/** Sum of `Deposit.totalIntents` across the maker's deposits. */
|
|
376
|
+
totalIntents: number;
|
|
377
|
+
/** Number of maker fills that happened through manual release. */
|
|
378
|
+
manualReleaseCount: number;
|
|
379
|
+
/** Maker-level fulfillment rate in basis points, derived from aggregate `fulfilledIntents / totalIntents`. */
|
|
380
|
+
successRateBps: number;
|
|
381
|
+
/** Sum of computed realized profit across all maker profit snapshots. */
|
|
382
|
+
realizedProfitUsdCents: string;
|
|
383
|
+
/** Reserved APR-style metric. It is present in the schema but not currently maintained by handlers. */
|
|
384
|
+
aprBps?: number;
|
|
385
|
+
/** Timestamp of the maker's earliest observed deposit. */
|
|
386
|
+
firstSeenAt?: string;
|
|
387
|
+
/** Last time the aggregate changed. */
|
|
388
|
+
updatedAt: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Per-maker, per-payment-method aggregate. This lets consumers break a maker's business down by payment rail or method hash.
|
|
393
|
+
*
|
|
394
|
+
* @id chainId_maker_paymentMethodHash
|
|
395
|
+
*
|
|
396
|
+
* **Relationships:**
|
|
397
|
+
* - Implicit aggregation over intents/fills for one maker and one `paymentMethodHash`
|
|
398
|
+
*/
|
|
399
|
+
export interface MakerPlatformStats {
|
|
400
|
+
/** Composite key `chainId_maker_paymentMethodHash`. */
|
|
401
|
+
id: string;
|
|
402
|
+
/** Chain on which the activity occurred. */
|
|
403
|
+
chainId: number;
|
|
404
|
+
/** Maker address. */
|
|
405
|
+
maker: string;
|
|
406
|
+
/** Payment-method aggregation dimension. */
|
|
407
|
+
paymentMethodHash: string;
|
|
408
|
+
/** Sum of fulfilled/manual-release volume for this maker-method pair. */
|
|
409
|
+
totalAmountTaken: string;
|
|
410
|
+
/** Count of fulfilled/manual-release intents for this pair. */
|
|
411
|
+
fulfilledIntents: number;
|
|
412
|
+
/** Count of pruned intents for this pair. */
|
|
413
|
+
prunedIntents: number;
|
|
414
|
+
/** Count of manual-release fills for this pair. */
|
|
415
|
+
manualReleaseCount: number;
|
|
416
|
+
/** Sum of realized profit allocated to this maker-method pair. */
|
|
417
|
+
realizedProfitUsdCents: string;
|
|
418
|
+
/** Number of profit snapshots that successfully contributed realized profit to this pair. */
|
|
419
|
+
computedProfitSnapshots: number;
|
|
420
|
+
/** Last time the row changed. */
|
|
421
|
+
updatedAt: string;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Per-maker, per-fiat-currency aggregate.
|
|
426
|
+
*
|
|
427
|
+
* @id chainId_maker_currencyCode
|
|
428
|
+
*
|
|
429
|
+
* **Relationships:**
|
|
430
|
+
* - Implicit aggregation over intents/fills for one maker and one fiat currency
|
|
431
|
+
*/
|
|
432
|
+
export interface MakerCurrencyStats {
|
|
433
|
+
/** Composite key `chainId_maker_currencyCode`. */
|
|
434
|
+
id: string;
|
|
435
|
+
/** Chain on which the activity occurred. */
|
|
436
|
+
chainId: number;
|
|
437
|
+
/** Maker address. */
|
|
438
|
+
maker: string;
|
|
439
|
+
/** Fiat-currency aggregation dimension. */
|
|
440
|
+
currencyCode: string;
|
|
441
|
+
/** Sum of fulfilled/manual-release volume for this maker-currency pair. */
|
|
442
|
+
totalAmountTaken: string;
|
|
443
|
+
/** Count of fulfilled/manual-release intents for this pair. */
|
|
444
|
+
fulfilledIntents: number;
|
|
445
|
+
/** Count of pruned intents for this pair. */
|
|
446
|
+
prunedIntents: number;
|
|
447
|
+
/** Count of manual releases for this pair. */
|
|
448
|
+
manualReleaseCount: number;
|
|
449
|
+
/** Last time the row changed. */
|
|
450
|
+
updatedAt: string;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Daily FX snapshot used to translate local-fiat quote rates into a USD-denominated profitability view.
|
|
455
|
+
*
|
|
456
|
+
* @id currencyCode_timestampHour
|
|
457
|
+
*
|
|
458
|
+
* **Relationships:**
|
|
459
|
+
* - Referenced by `MakerProfitSnapshot.priceSnapshotId`
|
|
460
|
+
* - Used indirectly by manager aggregate PnL computation
|
|
461
|
+
*/
|
|
462
|
+
export interface PriceSnapshot {
|
|
463
|
+
/** Composite key `currencyCode_timestampDay`. */
|
|
464
|
+
id: string;
|
|
465
|
+
/** Normalized fiat currency code of the quote being converted to USD. */
|
|
466
|
+
currencyCode: string;
|
|
467
|
+
/** Start-of-day UTC bucket in seconds. */
|
|
468
|
+
timestampDay: string;
|
|
469
|
+
/** Provider-supplied fiat-to-USD conversion rate in provider precision. */
|
|
470
|
+
rateUsd: string;
|
|
471
|
+
/** Precision/scaling factor associated with `rateUsd`. */
|
|
472
|
+
ratePrecision: number;
|
|
473
|
+
/** Upstream provider name used to fetch the quote. */
|
|
474
|
+
provider: string;
|
|
475
|
+
/** Source string or provider endpoint label. */
|
|
476
|
+
source: string;
|
|
477
|
+
/** Whether this snapshot came from live indexing or backfill. */
|
|
478
|
+
status: PriceSnapshotStatus;
|
|
479
|
+
/** Timestamp at which the provider says the quote is valid/effective. */
|
|
480
|
+
effectiveAt: string;
|
|
481
|
+
/** Timestamp when the indexer fetched the quote. */
|
|
482
|
+
retrievedAt: string;
|
|
483
|
+
/** First time this snapshot row was written. */
|
|
484
|
+
createdAt: string;
|
|
485
|
+
/** Last time this snapshot row was written. Usually equal to `createdAt`. */
|
|
486
|
+
updatedAt: string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Per-intent realized-profit record for makers. This is the bridge between intent settlement and USD-denominated reporting.
|
|
491
|
+
*
|
|
492
|
+
* @id intentId
|
|
493
|
+
*
|
|
494
|
+
* **Relationships:**
|
|
495
|
+
* - One row per settled `Intent` (`id = intentId`)
|
|
496
|
+
* - Many-to-one to `Deposit`
|
|
497
|
+
* - Optional many-to-one to `PriceSnapshot`
|
|
498
|
+
*/
|
|
499
|
+
export interface MakerProfitSnapshot {
|
|
500
|
+
/** Equal to `intentId`, enforcing one profit row per intent. */
|
|
501
|
+
id: string;
|
|
502
|
+
/** Chain where the intent settled. */
|
|
503
|
+
chainId: number;
|
|
504
|
+
/** Maker address that owned the deposit. */
|
|
505
|
+
maker: string;
|
|
506
|
+
/** Foreign-key string to `Intent.id`. */
|
|
507
|
+
intentId: string;
|
|
508
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
509
|
+
depositId: string;
|
|
510
|
+
/** Fiat currency used for the quote/profit comparison. */
|
|
511
|
+
fiatCurrency: string;
|
|
512
|
+
/** Quote-time rate captured from the intent. */
|
|
513
|
+
quoteConversionRate: string;
|
|
514
|
+
/** USD-derived market reference rate computed from the linked `PriceSnapshot`. */
|
|
515
|
+
oracleRate?: string;
|
|
516
|
+
/** Basis-point difference between `quoteConversionRate` and `oracleRate`. */
|
|
517
|
+
spreadBps?: number;
|
|
518
|
+
/** Token amount used for the profit calculation. */
|
|
519
|
+
amount: string;
|
|
520
|
+
/** USD-cent value of the local-fiat notional implied by the quote. */
|
|
521
|
+
notionalFiatUsdCents?: string;
|
|
522
|
+
/** Reserved fee field. It is currently written as zero. */
|
|
523
|
+
feeUsd?: string;
|
|
524
|
+
/** Realized profit in USD cents. Can be negative. */
|
|
525
|
+
realizedProfitUsdCents?: string;
|
|
526
|
+
/** Optional reference to the `PriceSnapshot` used to compute `oracleRate`. */
|
|
527
|
+
priceSnapshotId?: string;
|
|
528
|
+
/** `COMPUTED` when an FX reference existed, `PENDING` otherwise. */
|
|
529
|
+
status: ProfitStatus;
|
|
530
|
+
/** Timestamp when the profit row was created. */
|
|
531
|
+
createdAt: string;
|
|
532
|
+
/** Last update timestamp for the profit row. */
|
|
533
|
+
updatedAt: string;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Registry row for a delegated rate manager. A deposit can point at one of these via `(rateManagerAddress, rateManagerId)`.
|
|
538
|
+
*
|
|
539
|
+
* @id chainId_rateManagerAddress_rateManagerId
|
|
540
|
+
*
|
|
541
|
+
* **Relationships:**
|
|
542
|
+
* - Parent of `RateManagerRate`
|
|
543
|
+
* - Parent/source of `ManagerAggregateStats`, `ManagerDailySnapshot`, and `ManagerStats`
|
|
544
|
+
* - Optional target of deposit delegation
|
|
545
|
+
*/
|
|
546
|
+
export interface RateManager {
|
|
547
|
+
/** Composite key `chainId_rateManagerAddress_rateManagerId`. */
|
|
548
|
+
id: string;
|
|
549
|
+
/** Chain where the manager contract exists. */
|
|
550
|
+
chainId: number;
|
|
551
|
+
/** Rate-manager contract address. */
|
|
552
|
+
rateManagerAddress: string;
|
|
553
|
+
/** On-contract manager identifier. */
|
|
554
|
+
rateManagerId: string;
|
|
555
|
+
/** Account recognized as the logical manager/operator. */
|
|
556
|
+
manager: string;
|
|
557
|
+
/** Account that receives manager fees on settlement. */
|
|
558
|
+
feeRecipient: string;
|
|
559
|
+
/** Maximum allowed fee configured at manager creation. */
|
|
560
|
+
maxFee: string;
|
|
561
|
+
/** Current fee rate in 1e18 precision. */
|
|
562
|
+
fee: string;
|
|
563
|
+
/** Configured minimum liquidity threshold advertised by the manager contract. */
|
|
564
|
+
minLiquidity: string;
|
|
565
|
+
/** Optional human-readable name. */
|
|
566
|
+
name?: string;
|
|
567
|
+
/** Optional metadata URI. */
|
|
568
|
+
uri?: string;
|
|
569
|
+
/** First-seen timestamp. */
|
|
570
|
+
createdAt: string;
|
|
571
|
+
/** Last config update timestamp. */
|
|
572
|
+
updatedAt: string;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Per-manager quote sheet. Each row is a manager-supplied rate for one payment-method/currency pair. Deposits delegated to that manager read these rows when resolving `MethodCurrency.conversionRate`.
|
|
577
|
+
*
|
|
578
|
+
* @id chainId_rateManagerAddress_rateManagerId_paymentMethodHash_currencyCode
|
|
579
|
+
*/
|
|
580
|
+
export interface RateManagerRate {
|
|
581
|
+
/** Composite key `chainId_rateManagerAddress_rateManagerId_paymentMethodHash_currencyCode`. */
|
|
582
|
+
id: string;
|
|
583
|
+
/** Chain where the manager contract exists. */
|
|
584
|
+
chainId: number;
|
|
585
|
+
/** Manager contract address. */
|
|
586
|
+
rateManagerAddress: string;
|
|
587
|
+
/** Manager identifier. */
|
|
588
|
+
rateManagerId: string;
|
|
589
|
+
/** Payment-method dimension for the manager quote. */
|
|
590
|
+
paymentMethodHash: string;
|
|
591
|
+
/** Fiat-currency dimension for the manager quote. */
|
|
592
|
+
currencyCode: string;
|
|
593
|
+
/** Gross manager-provided rate before floor enforcement. */
|
|
594
|
+
managerRate: string;
|
|
595
|
+
/** Timestamp of the last rate update event for this pair. */
|
|
596
|
+
updatedAt: string;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Portfolio-level aggregate for one delegated rate manager. This is the top-level manager reporting row.
|
|
601
|
+
*
|
|
602
|
+
* @id chainId_rateManagerAddress_rateManagerId
|
|
603
|
+
*
|
|
604
|
+
* **Relationships:**
|
|
605
|
+
* - One-to-one logical summary for one `RateManager`
|
|
606
|
+
* - Source for `ManagerDailySnapshot`
|
|
607
|
+
* - Updated from delegated deposit balance changes and fulfilled intents
|
|
608
|
+
*/
|
|
609
|
+
export interface ManagerAggregateStats {
|
|
610
|
+
/** Same identity as the corresponding `RateManager.id`. */
|
|
611
|
+
id: string;
|
|
612
|
+
/** Chain on which the manager operates. */
|
|
613
|
+
chainId: number;
|
|
614
|
+
/** Manager contract address. */
|
|
615
|
+
rateManagerAddress: string;
|
|
616
|
+
/** Manager identifier. */
|
|
617
|
+
rateManagerId: string;
|
|
618
|
+
/** Manager account/operator. */
|
|
619
|
+
manager: string;
|
|
620
|
+
/** Cumulative token volume filled across all delegated deposits. */
|
|
621
|
+
totalFilledVolume: string;
|
|
622
|
+
/** Cumulative manager fee amount actually earned across fills. */
|
|
623
|
+
totalFeeAmount: string;
|
|
624
|
+
/** Cumulative USD-cent PnL measured against daily FX snapshots. */
|
|
625
|
+
totalPnlUsdCents: string;
|
|
626
|
+
/** Number of fulfilled delegated intents. */
|
|
627
|
+
fulfilledIntents: number;
|
|
628
|
+
/** Current delegated TVL, computed as the sum of `remainingDeposits + outstandingIntentAmount` across delegated deposits. */
|
|
629
|
+
currentDelegatedBalance: string;
|
|
630
|
+
/** Number of deposits currently delegated to this manager. */
|
|
631
|
+
currentDelegatedDeposits: number;
|
|
632
|
+
/** First timestamp the manager aggregate was created. */
|
|
633
|
+
firstSeenAt?: string;
|
|
634
|
+
/** Last time the aggregate changed. */
|
|
635
|
+
updatedAt: string;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Daily bucketed snapshot for `ManagerAggregateStats`.
|
|
640
|
+
*
|
|
641
|
+
* @id chainId_rateManagerAddress_rateManagerId_dayTimestamp
|
|
642
|
+
*/
|
|
643
|
+
export interface ManagerDailySnapshot {
|
|
644
|
+
/** Composite key `chainId_rateManagerAddress_rateManagerId_dayTimestamp`. */
|
|
645
|
+
id: string;
|
|
646
|
+
/** Chain on which the manager operates. */
|
|
647
|
+
chainId: number;
|
|
648
|
+
/** Manager contract address. */
|
|
649
|
+
rateManagerAddress: string;
|
|
650
|
+
/** Manager identifier. */
|
|
651
|
+
rateManagerId: string;
|
|
652
|
+
/** Start-of-day UTC bucket in seconds. */
|
|
653
|
+
dayTimestamp: string;
|
|
654
|
+
/** End-of-update delegated balance for that day. */
|
|
655
|
+
tvl: string;
|
|
656
|
+
/** Number of currently delegated deposits at snapshot time. */
|
|
657
|
+
delegatedDeposits: number;
|
|
658
|
+
/** Volume filled during that day. */
|
|
659
|
+
dailyVolume: string;
|
|
660
|
+
/** Manager fees earned during that day. */
|
|
661
|
+
dailyFees: string;
|
|
662
|
+
/** Daily PnL in USD cents. */
|
|
663
|
+
dailyPnlUsdCents: string;
|
|
664
|
+
/** Number of fulfilled intents on that day. */
|
|
665
|
+
dailyFulfilledIntents: number;
|
|
666
|
+
/** Cumulative filled volume up to this snapshot. */
|
|
667
|
+
cumulativeVolume: string;
|
|
668
|
+
/** Cumulative manager fees up to this snapshot. */
|
|
669
|
+
cumulativeFees: string;
|
|
670
|
+
/** Cumulative PnL up to this snapshot. */
|
|
671
|
+
cumulativePnlUsdCents: string;
|
|
672
|
+
/** Cumulative fulfilled-intent count up to this snapshot. */
|
|
673
|
+
cumulativeFulfilledIntents: number;
|
|
674
|
+
/** Last mutation time for the day's bucket. */
|
|
675
|
+
updatedAt: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Append-only normalized ledger of deposit funding activity. This is easier to query than replaying all raw event families.
|
|
680
|
+
*
|
|
681
|
+
* @id txHash_logIndex
|
|
682
|
+
*
|
|
683
|
+
* **Relationships:**
|
|
684
|
+
* - Many-to-one to `Deposit`
|
|
685
|
+
*/
|
|
686
|
+
export interface DepositFundActivity {
|
|
687
|
+
/** Composite key `txHash_logIndex`. */
|
|
688
|
+
id: string;
|
|
689
|
+
/** Chain where the activity happened. */
|
|
690
|
+
chainId: number;
|
|
691
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
692
|
+
depositId: string;
|
|
693
|
+
/** Maker address that owns the deposit. */
|
|
694
|
+
depositor: string;
|
|
695
|
+
/** Normalized activity class: `DEPOSIT_RECEIVED`, `FUNDS_ADDED`, `WITHDRAWN`, or `CLOSED`. */
|
|
696
|
+
activityType: string;
|
|
697
|
+
/** Token amount relevant to the activity. `CLOSED` can legitimately record zero amount. */
|
|
698
|
+
amount: string;
|
|
699
|
+
/** Block number for the activity. */
|
|
700
|
+
blockNumber: string;
|
|
701
|
+
/** Timestamp for the activity. */
|
|
702
|
+
timestamp: string;
|
|
703
|
+
/** Transaction hash for the activity. */
|
|
704
|
+
txHash: string;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Daily bucketed snapshot of one deposit's state and realized profitability.
|
|
709
|
+
*
|
|
710
|
+
* @id depositId_dayTimestamp
|
|
711
|
+
*
|
|
712
|
+
* **Relationships:**
|
|
713
|
+
* - Many-to-one to `Deposit`
|
|
714
|
+
* - Receives daily-volume and daily-PnL deltas from fulfillment flows
|
|
715
|
+
*/
|
|
716
|
+
export interface DepositDailySnapshot {
|
|
717
|
+
/** Composite key `depositId_dayTimestamp`. */
|
|
718
|
+
id: string;
|
|
719
|
+
/** Chain where the deposit exists. */
|
|
720
|
+
chainId: number;
|
|
721
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
722
|
+
depositId: string;
|
|
723
|
+
/** Maker address that owns the deposit. */
|
|
724
|
+
depositor: string;
|
|
725
|
+
/** Start-of-day UTC bucket in seconds. */
|
|
726
|
+
dayTimestamp: string;
|
|
727
|
+
/** Deposit liquidity available at the time of the last update to that bucket. */
|
|
728
|
+
remainingDeposits: string;
|
|
729
|
+
/** Deposit liquidity currently locked in intents at the last update. */
|
|
730
|
+
outstandingIntentAmount: string;
|
|
731
|
+
/** Cumulative taken volume at the last update. */
|
|
732
|
+
totalAmountTaken: string;
|
|
733
|
+
/** Cumulative withdrawn volume at the last update. */
|
|
734
|
+
totalWithdrawn: string;
|
|
735
|
+
/** Cumulative signal count at the last update. */
|
|
736
|
+
signaledIntents: number;
|
|
737
|
+
/** Cumulative fulfillment count at the last update. */
|
|
738
|
+
fulfilledIntents: number;
|
|
739
|
+
/** Cumulative prune count at the last update. */
|
|
740
|
+
prunedIntents: number;
|
|
741
|
+
/** Deposit success rate at the last update. */
|
|
742
|
+
successRateBps: number;
|
|
743
|
+
/** Volume taken during that day only. */
|
|
744
|
+
dailyVolume: string;
|
|
745
|
+
/** Realized PnL accrued during that day only. */
|
|
746
|
+
dailyPnlUsdCents: string;
|
|
747
|
+
/** All-time volume through the deposit as of this bucket. */
|
|
748
|
+
cumulativeVolume: string;
|
|
749
|
+
/** All-time realized PnL through the deposit as of this bucket. */
|
|
750
|
+
cumulativePnlUsdCents: string;
|
|
751
|
+
/** Last mutation time for the day's bucket. */
|
|
752
|
+
updatedAt: string;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Per-deposit stats row for a delegated manager. Where `ManagerAggregateStats` is portfolio-level, `ManagerStats` is deposit-level attribution.
|
|
757
|
+
*
|
|
758
|
+
* @id chainId_rateManagerAddress_rateManagerId_depositId
|
|
759
|
+
*
|
|
760
|
+
* **Relationships:**
|
|
761
|
+
* - Many-to-one to `Deposit`
|
|
762
|
+
* - Many-to-one to `RateManager`
|
|
763
|
+
*/
|
|
764
|
+
export interface ManagerStats {
|
|
765
|
+
/** Composite key `chainId_rateManagerAddress_rateManagerId_depositId`. */
|
|
766
|
+
id: string;
|
|
767
|
+
/** Chain on which the delegation exists. */
|
|
768
|
+
chainId: number;
|
|
769
|
+
/** Manager contract address. */
|
|
770
|
+
rateManagerAddress: string;
|
|
771
|
+
/** Manager identifier. */
|
|
772
|
+
rateManagerId: string;
|
|
773
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
774
|
+
depositId: string;
|
|
775
|
+
/** Maker that owns the delegated deposit. */
|
|
776
|
+
depositor: string;
|
|
777
|
+
/** Current delegated balance for this one deposit: `remainingDeposits + outstandingIntentAmount`. */
|
|
778
|
+
currentDelegatedBalance: string;
|
|
779
|
+
/** Deposit's all-time taken amount while tracked under the manager. */
|
|
780
|
+
totalAmountTaken: string;
|
|
781
|
+
/** Deposit's all-time withdrawn amount while tracked under the manager. */
|
|
782
|
+
totalWithdrawn: string;
|
|
783
|
+
/** Deposit-level fulfillment count. */
|
|
784
|
+
fulfilledIntents: number;
|
|
785
|
+
/** Deposit-level prune count. */
|
|
786
|
+
prunedIntents: number;
|
|
787
|
+
/** Deposit-level success rate. */
|
|
788
|
+
successRateBps: number;
|
|
789
|
+
/** Last mutation time for the row. */
|
|
790
|
+
updatedAt: string;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Read-optimized quoting view. This is intentionally denormalized so curator/quote APIs do not need to join `Deposit`, `DepositPaymentMethod`, and `MethodCurrency` at request time.
|
|
795
|
+
*
|
|
796
|
+
* @id escrowAddress_depositId_paymentMethodHash_currencyCode
|
|
797
|
+
*
|
|
798
|
+
* **Relationships:**
|
|
799
|
+
* - Derived from exactly one `(Deposit, DepositPaymentMethod, MethodCurrency)` tuple
|
|
800
|
+
* - `id` intentionally equals the corresponding `MethodCurrency.id`
|
|
801
|
+
*/
|
|
802
|
+
export interface QuoteCandidate {
|
|
803
|
+
/** Same composite identity as the backing `MethodCurrency`: `escrowAddress_depositId_paymentMethodHash_currencyCode`. */
|
|
804
|
+
id: string;
|
|
805
|
+
/** Chain where the quoteable deposit lives. */
|
|
806
|
+
chainId: number;
|
|
807
|
+
/** Raw on-chain deposit id. */
|
|
808
|
+
depositIdOnContract: string;
|
|
809
|
+
/** Foreign-key string to `Deposit.id`. */
|
|
810
|
+
depositId: string;
|
|
811
|
+
/** Escrow contract address copied from `Deposit`. */
|
|
812
|
+
escrowAddress: string;
|
|
813
|
+
/** Maker address copied from `Deposit`. */
|
|
814
|
+
depositor: string;
|
|
815
|
+
/** Token address copied from `Deposit`. */
|
|
816
|
+
token: string;
|
|
817
|
+
/** Payment-method hash copied from the tuple. */
|
|
818
|
+
paymentMethodHash: string;
|
|
819
|
+
/** Fiat currency copied from the tuple. */
|
|
820
|
+
currencyCode: string;
|
|
821
|
+
/** Final gross resolved rate copied from `MethodCurrency`. */
|
|
822
|
+
conversionRate?: string;
|
|
823
|
+
/** Final all-in taker-facing rate copied from `MethodCurrency`. */
|
|
824
|
+
takerConversionRate?: string;
|
|
825
|
+
/** Manager fee rate copied from `MethodCurrency`, defaulting to zero if absent. */
|
|
826
|
+
managerFee?: string;
|
|
827
|
+
/** Current immediately available maker liquidity, copied from `Deposit.remainingDeposits`. */
|
|
828
|
+
availableTokenAmount: string;
|
|
829
|
+
/** `min(availableTokenAmount, intentAmountMax)`, used for quote ordering and max-per-intent checks. */
|
|
830
|
+
maxTokenAvailablePerIntent: string;
|
|
831
|
+
/** Fiat value of `maxTokenAvailablePerIntent` using the taker-facing rate. */
|
|
832
|
+
maxFiatAvailablePerIntent: string;
|
|
833
|
+
/** Fiat value of the full currently available liquidity using the taker-facing rate. */
|
|
834
|
+
maxQuoteableFiat: string;
|
|
835
|
+
/** Minimum quoteable token amount copied from `Deposit`. */
|
|
836
|
+
intentAmountMin: string;
|
|
837
|
+
/** Maximum quoteable token amount copied from `Deposit`. */
|
|
838
|
+
intentAmountMax: string;
|
|
839
|
+
/** Deposit-level success signal copied from `Deposit`. */
|
|
840
|
+
successRateBps: number;
|
|
841
|
+
/** Hashed payee details copied from `DepositPaymentMethod`. */
|
|
842
|
+
payeeDetailsHash: string;
|
|
843
|
+
/** Optional gating service copied from `DepositPaymentMethod`. */
|
|
844
|
+
intentGatingService?: string;
|
|
845
|
+
/** Final quoteability flag. It is `true` only when the payment method is active, the deposit is accepting intents, and the taker-facing rate is non-zero. */
|
|
846
|
+
isActive: boolean;
|
|
847
|
+
/** Whether `availableTokenAmount >= intentAmountMin`. */
|
|
848
|
+
hasMinLiquidity: boolean;
|
|
849
|
+
/** Fiat value of `intentAmountMin` using the taker-facing rate. */
|
|
850
|
+
minFiatSupported: string;
|
|
851
|
+
/** Fiat value of `intentAmountMax` using the taker-facing rate. */
|
|
852
|
+
maxFiatSupported: string;
|
|
853
|
+
/** Fiat value of `availableTokenAmount` using the taker-facing rate. */
|
|
854
|
+
maxFiatAvail: string;
|
|
855
|
+
/** Last time the denormalized row was recomputed. */
|
|
856
|
+
updatedAt: string;
|
|
857
|
+
}
|