@zkp2p/indexer-schema 0.1.3 → 0.2.0
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 +397 -20
- package/dist/types.d.ts +379 -0
- package/dist/types.js +30 -0
- package/dist/types.ts +380 -0
- package/package.json +24 -8
package/README.md
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
# @zkp2p/indexer-schema
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
GraphQL schema and TypeScript types for the ZKP2P indexer. Single source of truth for all downstream consumers (SDK, curator, etc.).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
4
6
|
|
|
5
|
-
Install
|
|
6
7
|
```
|
|
7
8
|
pnpm add @zkp2p/indexer-schema
|
|
8
9
|
```
|
|
9
10
|
|
|
10
|
-
Usage
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### TypeScript Types
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Deposit, Intent, QuoteCandidate, DepositStatus } from '@zkp2p/indexer-schema';
|
|
17
|
+
|
|
18
|
+
// Or import types only
|
|
19
|
+
import type { MethodCurrency, MakerStats } from '@zkp2p/indexer-schema/types';
|
|
11
20
|
```
|
|
12
|
-
|
|
21
|
+
|
|
22
|
+
### Raw SDL String
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
13
25
|
import { schemaSDL } from '@zkp2p/indexer-schema';
|
|
14
|
-
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Schema File (for codegen configs)
|
|
15
29
|
|
|
16
|
-
|
|
30
|
+
```yaml
|
|
17
31
|
schema: node_modules/@zkp2p/indexer-schema/dist/schema.graphql
|
|
18
32
|
```
|
|
19
33
|
|
|
20
|
-
|
|
21
|
-
- Includes: Deposit, Intent, DepositPaymentMethod, MethodCurrency.
|
|
22
|
-
- The file is generated at publish time from the indexer repo.
|
|
34
|
+
## Exported Types
|
|
23
35
|
|
|
36
|
+
**Domain entities:** Deposit, DepositPaymentMethod, MethodCurrency, Intent, QuoteCandidate, ReferralFeeDistribution
|
|
24
37
|
|
|
25
|
-
|
|
38
|
+
**Stats:** TakerStats, MakerStats, MakerPlatformStats, MakerCurrencyStats, ManagerStats, ManagerAggregateStats, ManagerDailySnapshot
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
**Rate management:** RateManager, RateManagerRate
|
|
28
41
|
|
|
29
|
-
|
|
42
|
+
**Price/Profit:** PriceSnapshot, MakerProfitSnapshot
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
pnpm add -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations
|
|
33
|
-
```
|
|
44
|
+
**Activity:** DepositFundActivity, DepositDailySnapshot
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
**Enums:** DepositStatus, IntentStatus, PriceSnapshotStatus, ProfitStatus
|
|
36
47
|
|
|
37
|
-
|
|
38
|
-
schema: node_modules/@zkp2p/indexer-schema/dist/schema.graphql
|
|
39
|
-
# Alternatively, if using a workspace dependency:
|
|
40
|
-
# schema: ../zkp2p-indexer/dist/schema.graphql
|
|
48
|
+
## Breaking Change Detection
|
|
41
49
|
|
|
50
|
+
The indexer CI runs `check-schema-breaking.js` on every PR that touches `schema/`. It fails if any fields, types, or enum values are removed or have incompatible type changes.
|
|
51
|
+
|
|
52
|
+
When making intentional breaking changes:
|
|
53
|
+
1. Bump the package version (minor for breaking)
|
|
54
|
+
2. Update downstream consumers before merging
|
|
55
|
+
3. The CI check will flag the change — this is expected
|
|
56
|
+
|
|
57
|
+
## Codegen Example
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
# codegen.yml
|
|
61
|
+
schema: node_modules/@zkp2p/indexer-schema/dist/schema.graphql
|
|
42
62
|
generates:
|
|
43
63
|
src/__generated__/types.ts:
|
|
44
64
|
plugins:
|
|
45
65
|
- typescript
|
|
46
66
|
- typescript-operations
|
|
47
|
-
config:
|
|
48
|
-
avoidOptionals: true
|
|
49
67
|
```
|
|
50
|
-
|
|
51
|
-
### 3) Add an npm script
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
"scripts": {
|
|
55
|
-
"codegen": "graphql-codegen --config codegen.yml"
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 4) Use the generated types
|
|
60
|
-
|
|
61
|
-
- Import `Deposit`, `Intent`, etc. operation and type definitions from `src/__generated__/types.ts`.
|
|
62
|
-
- If you serve GraphQL in the backend, you can build an executable schema from `domain.graphql` and provide resolvers that read from the indexer’s DB.
|
|
63
|
-
- If you serve REST, use the generated types to type DTOs and service responses.
|
|
64
|
-
|
|
65
|
-
Notes
|
|
66
|
-
- We export the schema needed by backend consumers (no raw event entities). It matches the data model our handlers populate.
|
|
67
|
-
- When the schema changes in a breaking way (e.g., a field becomes non‑null), bump the schema package version and update your backend accordingly.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
const fs = require('fs');
|
|
2
4
|
const path = require('path');
|
|
3
5
|
const schemaSDL = fs.readFileSync(path.join(__dirname, 'schema.graphql'), 'utf8');
|
|
4
|
-
|
|
6
|
+
exports.schemaSDL = schemaSDL;
|
|
7
|
+
// Re-export enums with static assignments for Node CJS-to-ESM named export detection
|
|
8
|
+
const types = require('./types');
|
|
9
|
+
exports.DepositStatus = types.DepositStatus;
|
|
10
|
+
exports.IntentStatus = types.IntentStatus;
|
|
11
|
+
exports.PriceSnapshotStatus = types.PriceSnapshotStatus;
|
|
12
|
+
exports.ProfitStatus = types.ProfitStatus;
|
package/dist/schema.graphql
CHANGED
|
@@ -1,22 +1,52 @@
|
|
|
1
1
|
# Domain types
|
|
2
2
|
|
|
3
|
+
enum DepositStatus {
|
|
4
|
+
ACTIVE
|
|
5
|
+
CLOSED
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
enum IntentStatus {
|
|
9
|
+
SIGNALED
|
|
10
|
+
FULFILLED
|
|
11
|
+
PRUNED
|
|
12
|
+
MANUALLY_RELEASED
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
enum PriceSnapshotStatus {
|
|
16
|
+
LIVE
|
|
17
|
+
BACKFILL
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
enum ProfitStatus {
|
|
21
|
+
COMPUTED
|
|
22
|
+
PENDING
|
|
23
|
+
}
|
|
24
|
+
|
|
3
25
|
type Deposit {
|
|
4
26
|
id: ID! # escrowAddress_depositId
|
|
5
27
|
chainId: Int!
|
|
6
28
|
escrowAddress: String!
|
|
29
|
+
|
|
30
|
+
# Static Deposit details
|
|
7
31
|
depositId: BigInt!
|
|
8
32
|
depositor: String!
|
|
9
33
|
token: String!
|
|
10
|
-
|
|
11
|
-
|
|
34
|
+
|
|
35
|
+
# Deposit details (can be updated)
|
|
36
|
+
delegate: String!
|
|
12
37
|
intentAmountMin: BigInt!
|
|
13
38
|
intentAmountMax: BigInt!
|
|
14
39
|
acceptingIntents: Boolean!
|
|
15
|
-
status:
|
|
40
|
+
status: DepositStatus!
|
|
16
41
|
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
# Deposit amounts used for quote calculations
|
|
43
|
+
# Notes/identities:
|
|
44
|
+
# - balance = remainingDeposits + outstandingIntentAmount
|
|
45
|
+
# - grossDeposited (all-time) = remainingDeposits + outstandingIntentAmount + totalAmountTaken + totalWithdrawn
|
|
46
|
+
remainingDeposits: BigInt! # Total USDC immediately available to be taken / withdrawn
|
|
47
|
+
outstandingIntentAmount: BigInt! # Total USDC locked in pending intents
|
|
48
|
+
totalAmountTaken: BigInt! # Total USDC taken by intents (incl. manual release)
|
|
49
|
+
totalWithdrawn: BigInt! # Total USDC withdrawn via DepositWithdrawn events
|
|
20
50
|
|
|
21
51
|
# Intent counters
|
|
22
52
|
totalIntents: Int!
|
|
@@ -24,47 +54,101 @@ type Deposit {
|
|
|
24
54
|
fulfilledIntents: Int!
|
|
25
55
|
prunedIntents: Int!
|
|
26
56
|
|
|
57
|
+
# Quality signal (basis points 0–10000; new deposits start at 10000)
|
|
58
|
+
successRateBps: Int!
|
|
59
|
+
|
|
27
60
|
# Metadata
|
|
28
61
|
blockNumber: BigInt!
|
|
29
62
|
timestamp: BigInt!
|
|
30
63
|
txHash: String!
|
|
31
64
|
updatedAt: BigInt!
|
|
65
|
+
|
|
66
|
+
# V2.2 delegated rate manager assignment (optional)
|
|
67
|
+
rateManagerId: String @index
|
|
68
|
+
rateManagerAddress: String
|
|
69
|
+
delegatedAt: BigInt
|
|
70
|
+
|
|
71
|
+
# Reverse links for convenience in GraphQL (via @derivedFrom)
|
|
72
|
+
intents: [Intent!]! @derivedFrom(field: "depositId")
|
|
73
|
+
paymentMethods: [DepositPaymentMethod!]! @derivedFrom(field: "depositId")
|
|
74
|
+
currencies: [MethodCurrency!]! @derivedFrom(field: "depositId")
|
|
75
|
+
fundActivities: [DepositFundActivity!]! @derivedFrom(field: "depositId")
|
|
76
|
+
dailySnapshots: [DepositDailySnapshot!]! @derivedFrom(field: "depositId")
|
|
32
77
|
}
|
|
33
78
|
|
|
34
79
|
type DepositPaymentMethod {
|
|
35
80
|
id: ID! # escrowAddress_depositId_paymentMethodHash
|
|
36
81
|
chainId: Int!
|
|
82
|
+
|
|
83
|
+
# Corresponding Deposit details
|
|
84
|
+
depositId: String! @index # escrowAddress_depositId (foreign key)
|
|
37
85
|
depositIdOnContract: BigInt!
|
|
38
|
-
|
|
86
|
+
|
|
87
|
+
# Payment method details
|
|
39
88
|
paymentMethodHash: String!
|
|
40
|
-
verifierAddress: String!
|
|
41
89
|
intentGatingService: String!
|
|
42
90
|
payeeDetailsHash: String!
|
|
91
|
+
active: Boolean!
|
|
43
92
|
}
|
|
44
93
|
|
|
45
94
|
type MethodCurrency {
|
|
46
95
|
id: ID! # escrowAddress_depositId_paymentMethodHash_currencyCode
|
|
47
|
-
chainId: Int!
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
96
|
+
chainId: Int! # Chain where the deposit lives
|
|
97
|
+
|
|
98
|
+
# Corresponding Deposit details
|
|
99
|
+
depositId: String! @index # Foreign key to Deposit.id (escrowAddress_depositId)
|
|
100
|
+
depositIdOnContract: BigInt! # Raw on-chain deposit id
|
|
101
|
+
|
|
102
|
+
# Payment method details
|
|
103
|
+
paymentMethodHash: String! # Payment method bytes32 hash for this tuple
|
|
104
|
+
currencyCode: String! # Fiat currency bytes32 hash for this tuple
|
|
105
|
+
|
|
106
|
+
# Rate state
|
|
107
|
+
minConversionRate: BigInt! # Depositor-set fixed floor only; not oracle-adjusted and not fee-adjusted
|
|
108
|
+
managerRate: BigInt # Delegated manager quote before floor enforcement and before fee
|
|
109
|
+
managerFee: BigInt # 1e18 manager fee rate charged separately by OrchestratorV2 on token release
|
|
110
|
+
conversionRate: BigInt # Final gross resolved rate; contract-aligned and used for intent validation
|
|
111
|
+
takerConversionRate: BigInt # Final taker-facing all-in rate derived from conversionRate
|
|
112
|
+
rateSource: String # Binding source/reason for conversionRate: MANAGER | ORACLE | ESCROW_FLOOR | MANAGER_DISABLED | ORACLE_HALTED | NO_FLOOR
|
|
113
|
+
rateManagerId: String # Delegated rate manager id when this tuple is manager-controlled
|
|
114
|
+
|
|
115
|
+
# Oracle rate config and state
|
|
116
|
+
adapter: String # Oracle adapter contract address
|
|
117
|
+
adapterConfig: String # Encoded adapter configuration bytes
|
|
118
|
+
feed: String # Resolved oracle feed address or feed id
|
|
119
|
+
feedDecimals: Int # Feed decimals used to scale oracle answers
|
|
120
|
+
spreadBps: Int # Depositor-configured spread markup in basis points
|
|
121
|
+
maxStaleness: BigInt # Maximum accepted oracle age in seconds
|
|
122
|
+
invert: Boolean # Whether the oracle answer must be inverted before scaling
|
|
123
|
+
oracleRate: BigInt # Raw oracle rate before spread is applied
|
|
124
|
+
effectiveOracleRate: BigInt # Oracle rate after spread is applied
|
|
125
|
+
lastOracleUpdatedAt: BigInt # Timestamp of the last accepted oracle snapshot
|
|
126
|
+
kind: String @index # Oracle kind: oracle_chainlink | oracle_pyth | oracle_unknown
|
|
53
127
|
}
|
|
54
128
|
|
|
55
129
|
type Intent {
|
|
56
130
|
id: ID! # chainId_intentHash
|
|
57
131
|
intentHash: String!
|
|
58
|
-
|
|
59
|
-
|
|
132
|
+
orchestratorAddress: String!
|
|
133
|
+
|
|
134
|
+
# Corresponding Deposit details
|
|
135
|
+
depositId: String! @index # escrowAddress_depositId (foreign key)
|
|
136
|
+
|
|
137
|
+
# Verifier details
|
|
60
138
|
verifier: String!
|
|
139
|
+
paymentMethodHash: String # Association to payment method
|
|
140
|
+
|
|
141
|
+
# Recipient details
|
|
61
142
|
owner: String!
|
|
62
143
|
toAddress: String!
|
|
144
|
+
|
|
145
|
+
# Payment details
|
|
63
146
|
amount: BigInt!
|
|
64
147
|
fiatCurrency: String!
|
|
65
148
|
conversionRate: BigInt!
|
|
66
|
-
status:
|
|
67
|
-
|
|
149
|
+
status: IntentStatus! @index # SIGNALED | FULFILLED | PRUNED | MANUALLY_RELEASED (on-chain states only)
|
|
150
|
+
isExpired: Boolean! # Set by off-chain reconciler when expiryTime has passed
|
|
151
|
+
|
|
68
152
|
# Tx hashes and timestamps
|
|
69
153
|
signalTxHash: String!
|
|
70
154
|
signalTimestamp: BigInt!
|
|
@@ -72,8 +156,301 @@ type Intent {
|
|
|
72
156
|
fulfillTimestamp: BigInt
|
|
73
157
|
pruneTxHash: String
|
|
74
158
|
pruneTimestamp: BigInt
|
|
159
|
+
expiryTime: BigInt! @index
|
|
75
160
|
updatedAt: BigInt!
|
|
76
161
|
|
|
77
|
-
#
|
|
78
|
-
|
|
162
|
+
# Verified payment details (from UnifiedVerifier_V21_PaymentVerified)
|
|
163
|
+
# These capture the "real" fiat payment details which may differ from signaled values
|
|
164
|
+
# for partial payments or wrong currency scenarios
|
|
165
|
+
paymentAmount: BigInt # Actual fiat amount paid (may be partial)
|
|
166
|
+
paymentCurrency: String # Actual currency paid (may differ from fiatCurrency)
|
|
167
|
+
paymentTimestamp: BigInt # When payment was made (from proof)
|
|
168
|
+
paymentId: String # External payment ID (platform-specific)
|
|
169
|
+
|
|
170
|
+
# Released USDC amount (from Escrow_V21_FundsUnlockedAndTransferred)
|
|
171
|
+
# May differ from signaled `amount` for partial payments
|
|
172
|
+
releasedAmount: BigInt # Actual USDC released (gross, before protocol fees)
|
|
173
|
+
|
|
174
|
+
# Net USDC received by taker (from Orchestrator_V21_IntentFulfilled)
|
|
175
|
+
# This is after protocol and referrer fees are deducted
|
|
176
|
+
takerAmountNetFees: BigInt # Actual USDC taker received (net, after fees)
|
|
177
|
+
|
|
178
|
+
# V2.2 manager fee snapshot (set via IntentManagerFeeSnapshotted)
|
|
179
|
+
rateManagerId: String # Snapshotted delegated manager id for this intent
|
|
180
|
+
managerFee: BigInt # Snapshotted manager fee rate in 1e18 precision
|
|
181
|
+
managerFeeRecipient: String # Recipient that receives the manager fee on release
|
|
182
|
+
managerFeeAmount: BigInt # Signal-time estimate: intent.amount * managerFee / 1e18
|
|
183
|
+
realizedManagerFeeAmount: BigInt # Release-time realized fee: releasedAmount * managerFee / 1e18
|
|
184
|
+
|
|
185
|
+
# Referral fee distribution (set via IntentReferralFeeDistributed at fulfill time)
|
|
186
|
+
totalReferralFeeAmount: BigInt # Sum of all referral fee USDC amounts distributed at fulfill
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type ReferralFeeDistribution {
|
|
190
|
+
id: ID! # chainId_intentHash_feeRecipient
|
|
191
|
+
chainId: Int!
|
|
192
|
+
intentHash: String!
|
|
193
|
+
intentId: String! @index # FK -> Intent.id (chainId_intentHash)
|
|
194
|
+
feeRecipient: String!
|
|
195
|
+
feeAmount: BigInt! # Actual USDC amount distributed to this recipient
|
|
196
|
+
txHash: String!
|
|
197
|
+
timestamp: BigInt!
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
# Per-owner aggregates used by Curator to compute tiers (v0: stats only)
|
|
201
|
+
type TakerStats {
|
|
202
|
+
id: ID! # chainId_owner (owner lowercased)
|
|
203
|
+
chainId: Int!
|
|
204
|
+
owner: String!
|
|
205
|
+
|
|
206
|
+
# Lifetime counters
|
|
207
|
+
lifetimeSignaledCount: Int!
|
|
208
|
+
lifetimeFulfilledCount: Int!
|
|
209
|
+
lifetimeManualReleaseCount: Int!
|
|
210
|
+
lifetimePruneCount: Int!
|
|
211
|
+
totalCancelledVolume: BigInt!
|
|
212
|
+
totalFulfilledVolume: BigInt!
|
|
213
|
+
lockScore: BigInt!
|
|
214
|
+
|
|
215
|
+
# Current state
|
|
216
|
+
lastIntentAt: BigInt
|
|
217
|
+
lastFulfilledAt: BigInt
|
|
218
|
+
firstSeenAt: BigInt
|
|
219
|
+
|
|
220
|
+
# Metadata
|
|
221
|
+
updatedAt: BigInt!
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
type MakerStats {
|
|
225
|
+
id: ID! # chainId_maker (maker lowercased)
|
|
226
|
+
chainId: Int!
|
|
227
|
+
maker: String!
|
|
228
|
+
|
|
229
|
+
totalAmountTaken: BigInt!
|
|
230
|
+
grossDeposited: BigInt!
|
|
231
|
+
totalWithdrawn: BigInt!
|
|
232
|
+
outstandingIntentAmount: BigInt!
|
|
233
|
+
|
|
234
|
+
activeDepositCount: Int!
|
|
235
|
+
totalDepositCount: Int!
|
|
236
|
+
|
|
237
|
+
fulfilledIntents: Int!
|
|
238
|
+
prunedIntents: Int!
|
|
239
|
+
signaledIntents: Int!
|
|
240
|
+
totalIntents: Int!
|
|
241
|
+
manualReleaseCount: Int!
|
|
242
|
+
|
|
243
|
+
successRateBps: Int!
|
|
244
|
+
realizedProfitUsdCents: BigInt!
|
|
245
|
+
aprBps: Int
|
|
246
|
+
|
|
247
|
+
firstSeenAt: BigInt
|
|
248
|
+
updatedAt: BigInt!
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
type MakerPlatformStats {
|
|
252
|
+
id: ID! # chainId_maker_paymentMethodHash
|
|
253
|
+
chainId: Int!
|
|
254
|
+
maker: String!
|
|
255
|
+
paymentMethodHash: String!
|
|
256
|
+
|
|
257
|
+
totalAmountTaken: BigInt!
|
|
258
|
+
fulfilledIntents: Int!
|
|
259
|
+
prunedIntents: Int!
|
|
260
|
+
manualReleaseCount: Int!
|
|
261
|
+
realizedProfitUsdCents: BigInt!
|
|
262
|
+
computedProfitSnapshots: Int!
|
|
263
|
+
updatedAt: BigInt!
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
type MakerCurrencyStats {
|
|
267
|
+
id: ID! # chainId_maker_currencyCode
|
|
268
|
+
chainId: Int!
|
|
269
|
+
maker: String!
|
|
270
|
+
currencyCode: String!
|
|
271
|
+
|
|
272
|
+
totalAmountTaken: BigInt!
|
|
273
|
+
fulfilledIntents: Int!
|
|
274
|
+
prunedIntents: Int!
|
|
275
|
+
manualReleaseCount: Int!
|
|
276
|
+
updatedAt: BigInt!
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
type PriceSnapshot {
|
|
280
|
+
id: ID! # currencyCode_timestampHour
|
|
281
|
+
currencyCode: String!
|
|
282
|
+
timestampDay: BigInt!
|
|
283
|
+
rateUsd: BigInt!
|
|
284
|
+
ratePrecision: Int!
|
|
285
|
+
provider: String!
|
|
286
|
+
source: String!
|
|
287
|
+
status: PriceSnapshotStatus!
|
|
288
|
+
effectiveAt: BigInt!
|
|
289
|
+
retrievedAt: BigInt!
|
|
290
|
+
createdAt: BigInt!
|
|
291
|
+
updatedAt: BigInt!
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
type MakerProfitSnapshot {
|
|
295
|
+
id: ID! # intentId
|
|
296
|
+
chainId: Int!
|
|
297
|
+
maker: String!
|
|
298
|
+
intentId: String!
|
|
299
|
+
depositId: String!
|
|
300
|
+
fiatCurrency: String!
|
|
301
|
+
quoteConversionRate: BigInt!
|
|
302
|
+
oracleRate: BigInt
|
|
303
|
+
spreadBps: Int
|
|
304
|
+
amount: BigInt!
|
|
305
|
+
notionalFiatUsdCents: BigInt
|
|
306
|
+
feeUsd: BigInt
|
|
307
|
+
realizedProfitUsdCents: BigInt
|
|
308
|
+
priceSnapshotId: String
|
|
309
|
+
status: ProfitStatus!
|
|
310
|
+
createdAt: BigInt!
|
|
311
|
+
updatedAt: BigInt!
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
type RateManager {
|
|
315
|
+
id: ID! # chainId_rateManagerAddress_rateManagerId
|
|
316
|
+
chainId: Int!
|
|
317
|
+
rateManagerAddress: String! @index
|
|
318
|
+
rateManagerId: String! @index
|
|
319
|
+
manager: String!
|
|
320
|
+
feeRecipient: String!
|
|
321
|
+
maxFee: BigInt!
|
|
322
|
+
fee: BigInt!
|
|
323
|
+
minLiquidity: BigInt!
|
|
324
|
+
name: String
|
|
325
|
+
uri: String
|
|
326
|
+
createdAt: BigInt!
|
|
327
|
+
updatedAt: BigInt!
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
type RateManagerRate {
|
|
331
|
+
id: ID! # chainId_rateManagerAddress_rateManagerId_paymentMethodHash_currencyCode
|
|
332
|
+
chainId: Int!
|
|
333
|
+
rateManagerAddress: String! @index
|
|
334
|
+
rateManagerId: String! @index
|
|
335
|
+
paymentMethodHash: String!
|
|
336
|
+
currencyCode: String!
|
|
337
|
+
managerRate: BigInt!
|
|
338
|
+
updatedAt: BigInt!
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
type ManagerAggregateStats {
|
|
342
|
+
id: ID! # chainId_rateManagerAddress_rateManagerId
|
|
343
|
+
chainId: Int!
|
|
344
|
+
rateManagerAddress: String! @index
|
|
345
|
+
rateManagerId: String! @index
|
|
346
|
+
manager: String!
|
|
347
|
+
totalFilledVolume: BigInt!
|
|
348
|
+
totalFeeAmount: BigInt!
|
|
349
|
+
totalPnlUsdCents: BigInt!
|
|
350
|
+
fulfilledIntents: Int!
|
|
351
|
+
currentDelegatedBalance: BigInt!
|
|
352
|
+
currentDelegatedDeposits: Int!
|
|
353
|
+
firstSeenAt: BigInt
|
|
354
|
+
updatedAt: BigInt!
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
type ManagerDailySnapshot {
|
|
358
|
+
id: ID! # chainId_rateManagerAddress_rateManagerId_dayTimestamp
|
|
359
|
+
chainId: Int!
|
|
360
|
+
rateManagerAddress: String! @index
|
|
361
|
+
rateManagerId: String! @index
|
|
362
|
+
dayTimestamp: BigInt! @index
|
|
363
|
+
tvl: BigInt!
|
|
364
|
+
delegatedDeposits: Int!
|
|
365
|
+
dailyVolume: BigInt!
|
|
366
|
+
dailyFees: BigInt!
|
|
367
|
+
dailyPnlUsdCents: BigInt!
|
|
368
|
+
dailyFulfilledIntents: Int!
|
|
369
|
+
cumulativeVolume: BigInt!
|
|
370
|
+
cumulativeFees: BigInt!
|
|
371
|
+
cumulativePnlUsdCents: BigInt!
|
|
372
|
+
cumulativeFulfilledIntents: Int!
|
|
373
|
+
updatedAt: BigInt!
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
type DepositFundActivity {
|
|
377
|
+
id: ID! # txHash_logIndex
|
|
378
|
+
chainId: Int!
|
|
379
|
+
depositId: String! @index # FK -> Deposit.id
|
|
380
|
+
depositor: String!
|
|
381
|
+
activityType: String! @index # DEPOSIT_RECEIVED | FUNDS_ADDED | WITHDRAWN | CLOSED
|
|
382
|
+
amount: BigInt!
|
|
383
|
+
blockNumber: BigInt!
|
|
384
|
+
timestamp: BigInt! @index
|
|
385
|
+
txHash: String!
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
type DepositDailySnapshot {
|
|
389
|
+
id: ID! # depositId_dayTimestamp
|
|
390
|
+
chainId: Int!
|
|
391
|
+
depositId: String! @index # FK -> Deposit.id
|
|
392
|
+
depositor: String!
|
|
393
|
+
dayTimestamp: BigInt! @index
|
|
394
|
+
remainingDeposits: BigInt!
|
|
395
|
+
outstandingIntentAmount: BigInt!
|
|
396
|
+
totalAmountTaken: BigInt!
|
|
397
|
+
totalWithdrawn: BigInt!
|
|
398
|
+
signaledIntents: Int!
|
|
399
|
+
fulfilledIntents: Int!
|
|
400
|
+
prunedIntents: Int!
|
|
401
|
+
successRateBps: Int!
|
|
402
|
+
dailyVolume: BigInt! # USDC taken via fulfillments that day
|
|
403
|
+
dailyPnlUsdCents: BigInt! # Realized profit that day
|
|
404
|
+
cumulativeVolume: BigInt!
|
|
405
|
+
cumulativePnlUsdCents: BigInt!
|
|
406
|
+
updatedAt: BigInt!
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
type ManagerStats {
|
|
410
|
+
id: ID! # chainId_rateManagerAddress_rateManagerId_depositId
|
|
411
|
+
chainId: Int!
|
|
412
|
+
rateManagerAddress: String! @index
|
|
413
|
+
rateManagerId: String! @index
|
|
414
|
+
depositId: String! @index
|
|
415
|
+
depositor: String!
|
|
416
|
+
currentDelegatedBalance: BigInt!
|
|
417
|
+
totalAmountTaken: BigInt!
|
|
418
|
+
totalWithdrawn: BigInt!
|
|
419
|
+
fulfilledIntents: Int!
|
|
420
|
+
prunedIntents: Int!
|
|
421
|
+
successRateBps: Int!
|
|
422
|
+
updatedAt: BigInt!
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
"""
|
|
426
|
+
Denormalized view that joins Deposit, MethodCurrency, and DepositPaymentMethod for rate-first quoting.
|
|
427
|
+
"""
|
|
428
|
+
type QuoteCandidate {
|
|
429
|
+
id: ID! # escrowAddress_depositId_paymentMethodHash_currencyCode
|
|
430
|
+
chainId: Int! # Chain where the quoteable deposit lives
|
|
431
|
+
depositIdOnContract: BigInt! # Raw on-chain deposit id
|
|
432
|
+
depositId: String! @index # Foreign key to Deposit.id
|
|
433
|
+
escrowAddress: String! # Escrow address holding the deposit
|
|
434
|
+
depositor: String! # Maker address that owns the deposit
|
|
435
|
+
token: String! # ERC20 token address being sold
|
|
436
|
+
paymentMethodHash: String! # Payment method bytes32 hash
|
|
437
|
+
currencyCode: String! # Fiat currency bytes32 hash
|
|
438
|
+
conversionRate: BigInt # Final gross resolved rate copied from MethodCurrency
|
|
439
|
+
takerConversionRate: BigInt # Final taker-facing all-in rate copied from MethodCurrency
|
|
440
|
+
managerFee: BigInt # 1e18 manager fee rate applied separately at fulfillment
|
|
441
|
+
availableTokenAmount: BigInt! # Maker liquidity currently available for new intents
|
|
442
|
+
maxTokenAvailablePerIntent: BigInt! # min(availableTokenAmount, intentAmountMax) for nearby token quote ordering
|
|
443
|
+
maxFiatAvailablePerIntent: BigInt! # maxTokenAvailablePerIntent converted using takerConversionRate
|
|
444
|
+
maxQuoteableFiat: BigInt! # availableTokenAmount converted using takerConversionRate
|
|
445
|
+
intentAmountMin: BigInt! # Minimum token amount the maker will accept per intent
|
|
446
|
+
intentAmountMax: BigInt! # Maximum token amount the maker will accept per intent
|
|
447
|
+
successRateBps: Int! # Maker success rate for deposit-level filtering
|
|
448
|
+
payeeDetailsHash: String! # Hashed payee details required for verification
|
|
449
|
+
intentGatingService: String # Optional gating service that must authorize takers
|
|
450
|
+
isActive: Boolean! # Whether this tuple is currently quoteable for takers
|
|
451
|
+
hasMinLiquidity: Boolean! # Whether availableTokenAmount is at least intentAmountMin
|
|
452
|
+
minFiatSupported: BigInt! # intentAmountMin converted using takerConversionRate
|
|
453
|
+
maxFiatSupported: BigInt! # intentAmountMax converted using takerConversionRate
|
|
454
|
+
maxFiatAvail: BigInt! # availableTokenAmount converted using takerConversionRate
|
|
455
|
+
updatedAt: BigInt! # Last time the denormalized row was refreshed
|
|
79
456
|
}
|