10887 lines
389 KiB
Plaintext
10887 lines
389 KiB
Plaintext
// DBIS Core Banking System - Database Schema
|
||
// Sovereign-grade financial infrastructure
|
||
|
||
generator client {
|
||
provider = "prisma-client-js"
|
||
}
|
||
|
||
datasource db {
|
||
provider = "postgresql"
|
||
url = env("DATABASE_URL")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Sovereign Banks & Identity
|
||
// ============================================================================
|
||
|
||
model SovereignBank {
|
||
id String @id @default(uuid())
|
||
sovereignCode String @unique // OMNL, etc.
|
||
name String
|
||
bic String? @unique
|
||
lei String? @unique
|
||
hsmIdentity String? // HSM-backed identity reference
|
||
rootSovereignKey String? // RSK reference
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
// Relations
|
||
accounts BankAccount[]
|
||
identities SovereignIdentity[]
|
||
ledgerEntries LedgerEntry[]
|
||
fxTrades FxTrade[]
|
||
cbdcIssuance CbdcIssuance[]
|
||
complianceRecords ComplianceRecord[]
|
||
contracts SmartContract[]
|
||
isoMessages IsoMessage[]
|
||
liquidityPools LiquidityPool[]
|
||
creditLines InterbankCreditLine[]
|
||
settlementNodes SovereignSettlementNode[]
|
||
// Volume X Relations
|
||
metaCouncilMembers MetaSovereignCouncilMember[]
|
||
privileges SovereignPrivilege[]
|
||
faceEconomies FaceEconomy[]
|
||
chronoSettlementsSource ChronoSettlement[] @relation("ChronoSettlementSource")
|
||
chronoSettlementsDestination ChronoSettlement[] @relation("ChronoSettlementDestination")
|
||
// Volume XII Relations
|
||
ummcMappings UmmcSovereignMapping[]
|
||
temporalCurrencyTransactions TemporalCurrencyTransaction[]
|
||
aifxTrades AifxTrade[]
|
||
interplanetarySsuTransactions InterplanetarySsuTransaction[]
|
||
continuityIdentities SovereignContinuityIdentity[]
|
||
// Volume XIV Relations
|
||
infiniteLayerIdentities InfiniteLayerIdentity[]
|
||
holographicAnchors HolographicAnchor[]
|
||
// Supplement B Relations
|
||
dsez DigitalSovereignEconomicZone[]
|
||
// Volume II: Supranational Relations
|
||
supranationalMemberships SupranationalEntityMember[]
|
||
// Nostro/Vostro Relations
|
||
nostroVostroParticipants NostroVostroParticipant[]
|
||
|
||
@@index([sovereignCode])
|
||
@@index([bic])
|
||
@@map("sovereign_banks")
|
||
}
|
||
|
||
model SovereignIdentity {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
identityType String // Master, Treasury, CBDC, Settlement, API
|
||
identityKey String // Cryptographic key reference
|
||
hsmKeyId String? // HSM key identifier
|
||
certificate String? // X.509 certificate
|
||
quantumKeyId String? // Reference to quantum-safe cryptographic key
|
||
isQuantumEnabled Boolean @default(false) // Whether quantum-safe crypto is enabled
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([identityType])
|
||
@@index([quantumKeyId])
|
||
@@map("sovereign_identities")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Account Management
|
||
// ============================================================================
|
||
|
||
model BankAccount {
|
||
id String @id @default(uuid())
|
||
accountNumber String @unique
|
||
sovereignBankId String
|
||
accountType String // sovereign, treasury, commercial, correspondent, settlement
|
||
currencyCode String // ISO 4217
|
||
assetType String @default("fiat") // fiat, cbdc, commodity, security
|
||
balance Decimal @default(0) @db.Decimal(32, 8)
|
||
availableBalance Decimal @default(0) @db.Decimal(32, 8)
|
||
reservedBalance Decimal @default(0) @db.Decimal(32, 8)
|
||
reserveRequirement Decimal? @db.Decimal(32, 8)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
// Ledger relations
|
||
debitEntries LedgerEntry[] @relation("DebitAccount")
|
||
creditEntries LedgerEntry[] @relation("CreditAccount")
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([accountNumber])
|
||
@@index([accountType])
|
||
@@index([currencyCode])
|
||
@@map("bank_accounts")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Global Ledger System
|
||
// ============================================================================
|
||
|
||
model LedgerEntry {
|
||
id String @id @default(uuid())
|
||
ledgerId String // Master, Sovereign, or Sub-ledger ID
|
||
debitAccountId String
|
||
creditAccountId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String // ISO 4217
|
||
fxRate Decimal? @db.Decimal(32, 12)
|
||
assetType String @default("fiat")
|
||
transactionType String // Type A-G
|
||
referenceId String
|
||
timestampUtc DateTime @default(now())
|
||
blockHash String // SHA-3 hash
|
||
previousHash String? // Previous entry hash for chaining
|
||
auditFlag Boolean @default(false)
|
||
amlRiskScore Int? @default(0)
|
||
status String @default("pending") // pending, posted, settled, reversed
|
||
metadata Json? // Additional transaction data
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
debitAccount BankAccount @relation("DebitAccount", fields: [debitAccountId], references: [id])
|
||
creditAccount BankAccount @relation("CreditAccount", fields: [creditAccountId], references: [id])
|
||
|
||
@@index([ledgerId])
|
||
@@index([referenceId])
|
||
@@index([timestampUtc])
|
||
@@index([status])
|
||
@@index([blockHash])
|
||
@@index([transactionType])
|
||
@@map("ledger_entries")
|
||
}
|
||
|
||
// Sub-ledgers
|
||
model FxSubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
fxTradeId String
|
||
baseCurrency String
|
||
quoteCurrency String
|
||
baseAmount Decimal @db.Decimal(32, 8)
|
||
quoteAmount Decimal @db.Decimal(32, 8)
|
||
fxRate Decimal @db.Decimal(32, 12)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([fxTradeId])
|
||
@@map("fx_sub_ledger")
|
||
}
|
||
|
||
model SecuritiesSubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
securityId String
|
||
securityType String // bond, equity, tokenized
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
price Decimal? @db.Decimal(32, 12)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([securityId])
|
||
@@map("securities_sub_ledger")
|
||
}
|
||
|
||
model CommoditiesSubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
commodityType String // gold, oil, metals
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
unit String // oz, barrel, kg
|
||
price Decimal? @db.Decimal(32, 12)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([commodityType])
|
||
@@map("commodities_sub_ledger")
|
||
}
|
||
|
||
model DerivativesSubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
derivativeType String
|
||
notionalAmount Decimal @db.Decimal(32, 8)
|
||
markToMarket Decimal? @db.Decimal(32, 12)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("derivatives_sub_ledger")
|
||
}
|
||
|
||
model CbdcSubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
cbdcIssuanceId String
|
||
walletId String?
|
||
operationType String // mint, burn, transfer
|
||
amount Decimal @db.Decimal(32, 8)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([cbdcIssuanceId])
|
||
@@index([walletId])
|
||
@@map("cbdc_sub_ledger")
|
||
}
|
||
|
||
model CustodySubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
custodianId String
|
||
assetType String
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([custodianId])
|
||
@@map("custody_sub_ledger")
|
||
}
|
||
|
||
model CollateralSubLedger {
|
||
id String @id @default(uuid())
|
||
ledgerEntryId String @unique
|
||
collateralType String
|
||
pledgedAmount Decimal @db.Decimal(32, 8)
|
||
valuation Decimal @db.Decimal(32, 12)
|
||
createdAt DateTime @default(now())
|
||
|
||
@@map("collateral_sub_ledger")
|
||
}
|
||
|
||
// ============================================================================
|
||
// FX Engine
|
||
// ============================================================================
|
||
|
||
model FxPair {
|
||
id String @id @default(uuid())
|
||
baseCurrency String
|
||
quoteCurrency String
|
||
pairCode String @unique // OMF/USD
|
||
pricingMethod String // VWAP, TWAP, DBIS_SCI
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
trades FxTrade[]
|
||
|
||
@@index([pairCode])
|
||
@@index([baseCurrency, quoteCurrency])
|
||
@@map("fx_pairs")
|
||
}
|
||
|
||
model FxTrade {
|
||
id String @id @default(uuid())
|
||
tradeId String @unique
|
||
sovereignBankId String
|
||
fxPairId String
|
||
baseCurrency String
|
||
quoteCurrency String
|
||
tradeType String // spot, forward, swap, option, cbdc_cross_chain
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
price Decimal @db.Decimal(32, 12)
|
||
orderType String // market, limit, stop, sovereign
|
||
initiatorEntity String
|
||
counterpartyEntity String?
|
||
settlementMode String // RTGS, T+1, atomic
|
||
status String @default("pending") // pending, executed, settled, cancelled
|
||
timestampUtc DateTime @default(now())
|
||
executedAt DateTime?
|
||
settledAt DateTime?
|
||
metadata Json?
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id])
|
||
fxPair FxPair @relation(fields: [fxPairId], references: [id])
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([tradeId])
|
||
@@index([status])
|
||
@@index([timestampUtc])
|
||
@@map("fx_trades")
|
||
}
|
||
|
||
model LiquidityPool {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
currencyCode String
|
||
totalLiquidity Decimal @db.Decimal(32, 8)
|
||
availableLiquidity Decimal @db.Decimal(32, 8)
|
||
reservedLiquidity Decimal @db.Decimal(32, 8)
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@unique([sovereignBankId, currencyCode])
|
||
@@index([sovereignBankId])
|
||
@@map("liquidity_pools")
|
||
}
|
||
|
||
// ============================================================================
|
||
// CBDC System
|
||
// ============================================================================
|
||
|
||
model CbdcIssuance {
|
||
id String @id @default(uuid())
|
||
recordId String @unique
|
||
sovereignBankId String
|
||
walletId String?
|
||
amountMinted Decimal @default(0) @db.Decimal(32, 8)
|
||
amountBurned Decimal @default(0) @db.Decimal(32, 8)
|
||
netChange Decimal @default(0) @db.Decimal(32, 8)
|
||
operationType String // mint, burn, transfer
|
||
operatorIdentity String
|
||
reserveBacking Decimal? @db.Decimal(32, 8) // 1:1 backing verification
|
||
timestampUtc DateTime @default(now())
|
||
metadata Json?
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([walletId])
|
||
@@index([timestampUtc])
|
||
@@map("cbdc_issuance")
|
||
}
|
||
|
||
model CbdcWallet {
|
||
id String @id @default(uuid())
|
||
walletId String @unique
|
||
sovereignBankId String
|
||
walletType String // retail, wholesale, institutional
|
||
currencyCode String
|
||
balance Decimal @default(0) @db.Decimal(32, 8)
|
||
status String @default("active")
|
||
tieredAccess Json? // Access control configuration
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([walletType])
|
||
@@map("cbdc_wallets")
|
||
}
|
||
|
||
model CbdcOfflineCapsule {
|
||
id String @id @default(uuid())
|
||
capsuleId String @unique
|
||
senderWalletId String
|
||
receiverWalletId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
timestamp DateTime
|
||
expiryWindow Int // Allowed time window in seconds
|
||
doubleSpendToken String @unique
|
||
signature String
|
||
status String @default("pending") // pending, validated, synced, rejected
|
||
syncedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([capsuleId])
|
||
@@index([doubleSpendToken])
|
||
@@index([status])
|
||
@@map("cbdc_offline_capsules")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Securities & Commodities
|
||
// ============================================================================
|
||
|
||
model Security {
|
||
id String @id @default(uuid())
|
||
securityId String @unique
|
||
securityType String // bond, equity, tokenized
|
||
issuer String
|
||
currencyCode String
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
price Decimal? @db.Decimal(32, 12)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([securityId])
|
||
@@index([securityType])
|
||
@@map("securities")
|
||
}
|
||
|
||
model Commodity {
|
||
id String @id @default(uuid())
|
||
commodityType String // gold, oil, metals
|
||
unit String // oz, barrel, kg
|
||
spotPrice Decimal @db.Decimal(32, 12)
|
||
priceSource String
|
||
lastUpdated DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@unique([commodityType, unit])
|
||
@@index([commodityType])
|
||
@@map("commodities")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Compliance & Risk
|
||
// ============================================================================
|
||
|
||
model ComplianceRecord {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
transactionId String?
|
||
recordType String // aml_check, sanctions_screening, pep_check, risk_score
|
||
entityName String?
|
||
entityType String?
|
||
riskScore Int @default(0)
|
||
status String @default("clear") // clear, flagged, blocked
|
||
screeningResult Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([transactionId])
|
||
@@index([recordType])
|
||
@@index([status])
|
||
@@map("compliance_records")
|
||
}
|
||
|
||
model SuspiciousActivityReport {
|
||
id String @id @default(uuid())
|
||
reportId String @unique
|
||
transactionId String?
|
||
reportType String // SAR, STR
|
||
severity String // low, medium, high, critical
|
||
description String
|
||
status String @default("pending") // pending, submitted, acknowledged
|
||
submittedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([reportId])
|
||
@@index([status])
|
||
@@map("suspicious_activity_reports")
|
||
}
|
||
|
||
model SanctionsList {
|
||
id String @id @default(uuid())
|
||
entityName String
|
||
entityType String // individual, organization, country
|
||
listSource String // OFAC, EU, UN
|
||
listId String
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([entityName])
|
||
@@index([listSource])
|
||
@@index([status])
|
||
@@map("sanctions_lists")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Smart Contracts
|
||
// ============================================================================
|
||
|
||
model SmartContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
sovereignBankId String
|
||
templateType String // FX_SWAP, LETTER_OF_CREDIT, SOVEREIGN_GUARANTEE, CBDC_CONDITIONAL, COMMODITY_REDEMPTION
|
||
contractState String @default("draft") // draft, active, executed, expired, cancelled
|
||
parameters Json
|
||
signatories Json // Array of required signatories
|
||
signatures Json? // Collected signatures
|
||
executionResult Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
executedAt DateTime?
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([contractId])
|
||
@@index([templateType])
|
||
@@index([contractState])
|
||
@@map("smart_contracts")
|
||
}
|
||
|
||
// ============================================================================
|
||
// ISO 20022 Messages
|
||
// ============================================================================
|
||
|
||
model IsoMessage {
|
||
id String @id @default(uuid())
|
||
messageId String @unique
|
||
sovereignBankId String
|
||
messageType String // PACS.008, PACS.002, CAMT.053, FXMT.001, etc.
|
||
direction String // inbound, outbound
|
||
status String @default("pending") // pending, processed, failed, acknowledged
|
||
rawMessage String @db.Text
|
||
parsedData Json?
|
||
dbisExtensions Json? // SOV-ID, MACI, CBDC-MODE
|
||
hsmSignature String?
|
||
createdAt DateTime @default(now())
|
||
processedAt DateTime?
|
||
acknowledgedAt DateTime?
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([messageId])
|
||
@@index([messageType])
|
||
@@index([status])
|
||
@@index([createdAt])
|
||
@@map("iso_messages")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Treasury & Liquidity
|
||
// ============================================================================
|
||
|
||
model InterbankCreditLine {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
counterpartyBankId String
|
||
creditLimit Decimal @db.Decimal(32, 8)
|
||
usedAmount Decimal @default(0) @db.Decimal(32, 8)
|
||
availableAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
status String @default("active")
|
||
expiryDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([counterpartyBankId])
|
||
@@map("interbank_credit_lines")
|
||
}
|
||
|
||
model LiquidityForecast {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
forecastDate DateTime
|
||
forecastType String // daily, weekly, monthly
|
||
lcr Decimal? @db.Decimal(32, 8) // Liquidity Coverage Ratio
|
||
nsfr Decimal? @db.Decimal(32, 8) // Net Stable Funding Ratio
|
||
hqla Decimal? @db.Decimal(32, 8) // High-Quality Liquid Assets
|
||
forecastData Json
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([forecastDate])
|
||
@@map("liquidity_forecasts")
|
||
}
|
||
|
||
// ============================================================================
|
||
// ICC Trade Finance
|
||
// ============================================================================
|
||
|
||
model LetterOfCredit {
|
||
id String @id @default(uuid())
|
||
lcId String @unique
|
||
applicantBankId String
|
||
beneficiaryBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
expiryDate DateTime
|
||
status String @default("issued") // issued, presented, accepted, rejected, expired
|
||
documents Json? // eUCP 2.0 compliant documents
|
||
contractReference String? // Smart contract reference
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([lcId])
|
||
@@index([status])
|
||
@@map("letters_of_credit")
|
||
}
|
||
|
||
model SovereignGuarantee {
|
||
id String @id @default(uuid())
|
||
guaranteeId String @unique
|
||
guarantorBankId String
|
||
beneficiaryBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
guaranteeType String // demand_guarantee, bank_guarantee
|
||
expiryDate DateTime
|
||
status String @default("active") // active, invoked, expired, cancelled
|
||
contractReference String? // Smart contract reference
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([guaranteeId])
|
||
@@index([status])
|
||
@@map("sovereign_guarantees")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Governance & Rulebook
|
||
// ============================================================================
|
||
|
||
model RulebookRule {
|
||
id String @id @default(uuid())
|
||
ruleId String @unique
|
||
ruleCategory String // eligibility, liquidity, settlement, default
|
||
ruleName String
|
||
ruleDescription String @db.Text
|
||
ruleLogic Json // Rule evaluation logic
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([ruleCategory])
|
||
@@index([status])
|
||
@@map("rulebook_rules")
|
||
}
|
||
|
||
model DefaultEvent {
|
||
id String @id @default(uuid())
|
||
eventId String @unique
|
||
sovereignBankId String
|
||
eventType String // technical_default, liquidity_default, reserve_breach
|
||
severity String // low, medium, high, critical
|
||
status String @default("active") // active, resolved, escalated
|
||
description String @db.Text
|
||
resolutionActions Json?
|
||
createdAt DateTime @default(now())
|
||
resolvedAt DateTime?
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([eventType])
|
||
@@index([status])
|
||
@@map("default_events")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Audit & Monitoring
|
||
// ============================================================================
|
||
|
||
model AuditLog {
|
||
id String @id @default(uuid())
|
||
eventType String
|
||
entityType String
|
||
entityId String
|
||
action String
|
||
actorId String?
|
||
actorType String?
|
||
details Json?
|
||
timestamp DateTime @default(now())
|
||
ipAddress String?
|
||
userAgent String?
|
||
|
||
@@index([eventType])
|
||
@@index([entityType, entityId])
|
||
@@index([timestamp])
|
||
@@map("audit_logs")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: Constitution & Governance
|
||
// ============================================================================
|
||
|
||
model ConstitutionArticle {
|
||
id String @id @default(uuid())
|
||
articleNumber String // I, II, III, etc.
|
||
articleTitle String
|
||
section String? // 1.1, 1.2, etc.
|
||
content String @db.Text
|
||
version Int @default(1)
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
status String @default("active") // active, superseded, archived
|
||
metadata Json? // Additional legal references
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([articleNumber])
|
||
@@index([version])
|
||
@@index([status])
|
||
@@map("constitution_articles")
|
||
}
|
||
|
||
model GovernanceBody {
|
||
id String @id @default(uuid())
|
||
bodyType String // BoardOfGovernors, MSC, CAA, SCC
|
||
name String
|
||
description String @db.Text
|
||
memberCount Int?
|
||
votingMechanism String // simple_majority, supermajority_2_3, unanimous
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
members GovernanceBodyMember[]
|
||
votingRecords VotingRecord[]
|
||
|
||
@@index([bodyType])
|
||
@@index([status])
|
||
@@map("governance_bodies")
|
||
}
|
||
|
||
model GovernanceBodyMember {
|
||
id String @id @default(uuid())
|
||
governanceBodyId String
|
||
sovereignBankId String?
|
||
memberName String
|
||
memberRole String // Governor, Officer, Auditor, etc.
|
||
votingWeight Decimal? @db.Decimal(32, 8) // Calculated based on liquidity + stability
|
||
status String @default("active")
|
||
appointedAt DateTime @default(now())
|
||
termEndDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
governanceBody GovernanceBody @relation(fields: [governanceBodyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([governanceBodyId])
|
||
@@index([sovereignBankId])
|
||
@@map("governance_body_members")
|
||
}
|
||
|
||
model VotingRecord {
|
||
id String @id @default(uuid())
|
||
governanceBodyId String
|
||
proposalId String @unique
|
||
proposalType String // amendment, operational_update, membership_change, liquidity_guarantee
|
||
proposalTitle String
|
||
proposalContent String @db.Text
|
||
requiredVoteType String // simple_majority, supermajority_2_3, unanimous
|
||
status String @default("pending") // pending, approved, rejected, withdrawn
|
||
votesFor Int @default(0)
|
||
votesAgainst Int @default(0)
|
||
votesAbstain Int @default(0)
|
||
totalVotingWeight Decimal @default(0) @db.Decimal(32, 8)
|
||
votingDeadline DateTime?
|
||
votedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
governanceBody GovernanceBody @relation(fields: [governanceBodyId], references: [id])
|
||
votes Vote[]
|
||
|
||
@@index([governanceBodyId])
|
||
@@index([proposalId])
|
||
@@index([status])
|
||
@@map("voting_records")
|
||
}
|
||
|
||
model Vote {
|
||
id String @id @default(uuid())
|
||
votingRecordId String
|
||
memberId String
|
||
vote String // for, against, abstain
|
||
votingWeight Decimal @db.Decimal(32, 8)
|
||
timestamp DateTime @default(now())
|
||
|
||
votingRecord VotingRecord @relation(fields: [votingRecordId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([votingRecordId])
|
||
@@index([memberId])
|
||
@@map("votes")
|
||
}
|
||
|
||
model DisputeResolution {
|
||
id String @id @default(uuid())
|
||
disputeId String @unique
|
||
sovereignBankId1 String
|
||
sovereignBankId2 String
|
||
disputeType String // settlement, fx, liquidity, compliance
|
||
description String @db.Text
|
||
stage String @default("bilateral") // bilateral, caa_mediation, binding_arbitration
|
||
status String @default("active") // active, resolved, escalated
|
||
resolution String? @db.Text
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([disputeId])
|
||
@@index([sovereignBankId1])
|
||
@@index([sovereignBankId2])
|
||
@@index([stage])
|
||
@@index([status])
|
||
@@map("dispute_resolutions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: Quantum-Safe Cryptography
|
||
// ============================================================================
|
||
|
||
model QuantumMigrationPhase {
|
||
id String @id @default(uuid())
|
||
phaseNumber Int // 1, 2, 3
|
||
phaseName String // Phase I - Hybrid, Phase II - Full PQC, Phase III - Quantum-Native
|
||
description String @db.Text
|
||
targetComponents Json // Array of components to migrate
|
||
status String @default("planned") // planned, in_progress, completed
|
||
startDate DateTime?
|
||
completionDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
migrations MigrationAudit[]
|
||
|
||
@@index([phaseNumber])
|
||
@@index([status])
|
||
@@map("quantum_migration_phases")
|
||
}
|
||
|
||
model CryptographicKey {
|
||
id String @id @default(uuid())
|
||
keyId String @unique
|
||
keyType String // ecc_521, pqc_kyber, pqc_dilithium, hybrid, xmss, sphincs_plus
|
||
keyPurpose String // ledger_hashing, api_signature, cbdc_capsule, smart_contract, sovereign_identity
|
||
publicKey String @db.Text
|
||
privateKeyRef String? // Reference to HSM-stored private key
|
||
hsmKeyId String? // HSM key identifier
|
||
algorithm String // CRYSTALS-Kyber, CRYSTALS-Dilithium, ECC-521, etc.
|
||
keySize Int? // Key size in bits
|
||
status String @default("active") // active, rotated, revoked
|
||
createdAt DateTime @default(now())
|
||
rotatedAt DateTime?
|
||
expiresAt DateTime?
|
||
|
||
@@index([keyId])
|
||
@@index([keyType])
|
||
@@index([keyPurpose])
|
||
@@index([status])
|
||
@@map("cryptographic_keys")
|
||
}
|
||
|
||
model MigrationAudit {
|
||
id String @id @default(uuid())
|
||
phaseId String
|
||
componentType String // ledger, api, cbdc, smart_contract, identity
|
||
componentId String
|
||
migrationStatus String // pending, in_progress, completed, failed
|
||
oldKeyId String?
|
||
newKeyId String?
|
||
migrationDate DateTime?
|
||
notes String? @db.Text
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
phase QuantumMigrationPhase @relation(fields: [phaseId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([phaseId])
|
||
@@index([componentType])
|
||
@@index([componentId])
|
||
@@index([migrationStatus])
|
||
@@map("migration_audits")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: Sovereign Risk Index (SRI)
|
||
// ============================================================================
|
||
|
||
model SovereignRiskIndex {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
sriScore Decimal @db.Decimal(32, 8) // 0-100 scale
|
||
sriRating String // AAA, AA, A, BBB, BB, B, CCC
|
||
calculatedAt DateTime @default(now())
|
||
effectiveDate DateTime @default(now())
|
||
status String @default("active") // active, historical
|
||
metadata Json? // Calculation details
|
||
|
||
inputs SRIInput[]
|
||
enforcements SRIEnforcement[]
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([sriScore])
|
||
@@index([sriRating])
|
||
@@index([calculatedAt])
|
||
@@map("sovereign_risk_indices")
|
||
}
|
||
|
||
model SRIInput {
|
||
id String @id @default(uuid())
|
||
sriId String
|
||
inputCategory String // financial_stability, fx_commodity, operational
|
||
inputType String // SLCR, NSFR_S, cross_border_exposure, fx_volatility_30d, fx_volatility_90d, commodity_reserve, settlement_failure_rate, aml_compliance, cyber_defense
|
||
inputValue Decimal @db.Decimal(32, 8)
|
||
weight Decimal? @db.Decimal(32, 8) // Weight in calculation
|
||
source String? // Data source
|
||
timestamp DateTime @default(now())
|
||
|
||
sri SovereignRiskIndex @relation(fields: [sriId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sriId])
|
||
@@index([inputCategory])
|
||
@@index([inputType])
|
||
@@map("sri_inputs")
|
||
}
|
||
|
||
model SRIEnforcement {
|
||
id String @id @default(uuid())
|
||
sriId String
|
||
sovereignBankId String
|
||
triggerLevel String // sri_40, sri_60
|
||
enforcementType String // liquidity_requirement, fx_stabilization, enhanced_monitoring, crisis_protocol, liquidity_injection, settlement_restriction
|
||
action String @db.Text
|
||
status String @default("active") // active, executed, resolved
|
||
executedAt DateTime?
|
||
resolvedAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sri SovereignRiskIndex @relation(fields: [sriId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([sriId])
|
||
@@index([sovereignBankId])
|
||
@@index([triggerLevel])
|
||
@@index([status])
|
||
@@map("sri_enforcements")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: Accounting & Reporting Standards
|
||
// ============================================================================
|
||
|
||
model ConsolidatedStatement {
|
||
id String @id @default(uuid())
|
||
statementId String @unique
|
||
statementType String // CSLR, CrossBorderExposure, CBDCReserveAdequacy
|
||
reportDate DateTime
|
||
periodStart DateTime
|
||
periodEnd DateTime
|
||
status String @default("draft") // draft, final, published
|
||
statementData Json // Consolidated data
|
||
publishedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([statementId])
|
||
@@index([statementType])
|
||
@@index([reportDate])
|
||
@@index([status])
|
||
@@map("consolidated_statements")
|
||
}
|
||
|
||
model SovereignReport {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
reportId String @unique
|
||
reportType String // daily_liquidity, weekly_fx_reserve, monthly_aml_compliance, quarterly_cbdc_audit
|
||
reportPeriod String // daily, weekly, monthly, quarterly
|
||
reportDate DateTime
|
||
dueDate DateTime
|
||
status String @default("pending") // pending, submitted, reviewed, overdue
|
||
reportData Json // Report data
|
||
submittedAt DateTime?
|
||
reviewedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([reportId])
|
||
@@index([reportType])
|
||
@@index([reportDate])
|
||
@@index([status])
|
||
@@map("sovereign_reports")
|
||
}
|
||
|
||
model ValuationRule {
|
||
id String @id @default(uuid())
|
||
ruleId String @unique
|
||
assetType String // fiat, cbdc, commodity, security, derivative
|
||
valuationMethod String // fair_value, commodity_feed, fx_reference_rate
|
||
feedSource String? // Data feed source
|
||
updateFrequency String // real_time, hourly, daily
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
ruleConfig Json? // Configuration parameters
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([ruleId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("valuation_rules")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: Instant Settlement Network (ISN)
|
||
// ============================================================================
|
||
|
||
model SettlementRoute {
|
||
id String @id @default(uuid())
|
||
routeId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
currencyCode String
|
||
routeType String // direct, via_intermediary, mesh
|
||
intermediaryBankIds Json? // Array of intermediary bank IDs
|
||
liquidityProximity Decimal? @db.Decimal(32, 8)
|
||
trustWeight Decimal? @db.Decimal(32, 8)
|
||
fxCost Decimal? @db.Decimal(32, 12)
|
||
estimatedLatency Int? // Milliseconds
|
||
// SIRE extensions
|
||
sireCost Decimal? @db.Decimal(32, 12) // Total SIRE calculated cost
|
||
sriRiskScore Decimal? @db.Decimal(32, 8)
|
||
liquidityPenalty Decimal? @db.Decimal(32, 8)
|
||
ssuAdjustment Decimal? @db.Decimal(32, 8)
|
||
status String @default("active")
|
||
lastUsedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
routingDecisions SireRoutingDecision[]
|
||
|
||
@@index([routeId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([currencyCode])
|
||
@@index([status])
|
||
@@map("settlement_routes")
|
||
}
|
||
|
||
model AtomicSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
transactionId String?
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // currency, cbdc, commodity, security
|
||
settlementMode String // atomic, rtgs
|
||
dualLedgerCommit Boolean @default(false)
|
||
sovereignLedgerHash String?
|
||
dbisLedgerHash String?
|
||
settlementTime Int? // Milliseconds to settle
|
||
status String @default("pending") // pending, committed, settled, failed
|
||
committedAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([settlementId])
|
||
@@index([transactionId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@index([committedAt])
|
||
@@map("atomic_settlements")
|
||
}
|
||
|
||
model SyntheticSettlementUnit {
|
||
id String @id @default(uuid())
|
||
ssuId String @unique
|
||
ssuName String
|
||
description String @db.Text
|
||
underlyingAssets Json // Array of underlying assets
|
||
conversionRate Decimal? @db.Decimal(32, 12)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
compositions SsuComposition[]
|
||
transactions SsuTransaction[]
|
||
redemptionRequests SsuRedemptionRequest[]
|
||
|
||
@@index([ssuId])
|
||
@@index([status])
|
||
@@map("synthetic_settlement_units")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: RegTech Framework
|
||
// ============================================================================
|
||
|
||
model SupervisionRule {
|
||
id String @id @default(uuid())
|
||
ruleId String @unique
|
||
ruleName String
|
||
ruleType String // aml_behavior, sanctions_matching, fx_anomaly, transaction_velocity, clustering
|
||
ruleLogic Json // Rule evaluation logic
|
||
threshold Decimal? @db.Decimal(32, 8)
|
||
severity String // low, medium, high, critical
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([ruleId])
|
||
@@index([ruleType])
|
||
@@index([status])
|
||
@@map("supervision_rules")
|
||
}
|
||
|
||
model SupervisoryDashboard {
|
||
id String @id @default(uuid())
|
||
dashboardId String @unique
|
||
sovereignBankId String?
|
||
dashboardType String // real_time_sri, liquidity_stress, cbdc_penetration, incident_alerts
|
||
metrics Json // Dashboard metrics
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([dashboardId])
|
||
@@index([sovereignBankId])
|
||
@@index([dashboardType])
|
||
@@map("supervisory_dashboards")
|
||
}
|
||
|
||
model ComplianceSandbox {
|
||
id String @id @default(uuid())
|
||
sandboxId String @unique
|
||
sovereignBankId String
|
||
scenarioType String // rule_change, aml_scenario, policy_validation
|
||
scenarioName String
|
||
scenarioConfig Json // Scenario configuration
|
||
testResults Json?
|
||
status String @default("draft") // draft, running, completed, failed
|
||
startedAt DateTime?
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([sandboxId])
|
||
@@index([sovereignBankId])
|
||
@@index([scenarioType])
|
||
@@index([status])
|
||
@@map("compliance_sandboxes")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume II: Internal Operations & HR
|
||
// ============================================================================
|
||
|
||
model DbisRole {
|
||
id String @id @default(uuid())
|
||
roleId String @unique
|
||
roleName String // Governor, MSC_Officer, CAA_Auditor, Sovereign_Relations_Director, Crisis_Operations_Commander
|
||
roleDescription String @db.Text
|
||
accessLevel String // tier_1, tier_2, tier_3, tier_4
|
||
permissions Json // Array of permissions
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
employees EmployeeCredential[]
|
||
|
||
@@index([roleId])
|
||
@@index([roleName])
|
||
@@index([accessLevel])
|
||
@@map("dbis_roles")
|
||
}
|
||
|
||
model EmployeeCredential {
|
||
id String @id @default(uuid())
|
||
employeeId String @unique
|
||
roleId String
|
||
employeeName String
|
||
email String
|
||
securityClearance String // tier_1, tier_2, tier_3, tier_4
|
||
cryptographicBadgeId String? // Cryptographic identity badge reference
|
||
hsmCredentialId String? // HSM-secured credential reference
|
||
status String @default("active") // active, suspended, revoked
|
||
issuedAt DateTime @default(now())
|
||
expiresAt DateTime?
|
||
revokedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
role DbisRole @relation(fields: [roleId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([employeeId])
|
||
@@index([roleId])
|
||
@@index([securityClearance])
|
||
@@index([status])
|
||
@@map("employee_credentials")
|
||
}
|
||
|
||
model CrisisProtocol {
|
||
id String @id @default(uuid())
|
||
protocolId String @unique
|
||
protocolName String
|
||
crisisType String // fx_collapse, default_event, liquidity_freeze, cyber_attack
|
||
escalationChain Json // Array of escalation steps
|
||
activationCriteria Json // Criteria for activation
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
activatedAt DateTime?
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([protocolId])
|
||
@@index([crisisType])
|
||
@@index([status])
|
||
@@map("crisis_protocols")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Global Settlement System (GSS)
|
||
// ============================================================================
|
||
|
||
model SovereignSettlementNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
sovereignBankId String
|
||
layer String // layer_1_sovereign, layer_2_master, layer_3_scf, layer_4_fil
|
||
nodeType String // SSN (Sovereign Settlement Node)
|
||
status String @default("active") // active, suspended, inactive
|
||
lastSyncAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
masterLedgerEntries GssMasterLedger[]
|
||
stateBlocks StateBlock[]
|
||
|
||
@@index([nodeId])
|
||
@@index([sovereignBankId])
|
||
@@index([layer])
|
||
@@index([status])
|
||
@@map("sovereign_settlement_nodes")
|
||
}
|
||
|
||
model GssMasterLedger {
|
||
id String @id @default(uuid())
|
||
entryId String @unique
|
||
nodeId String
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // fiat, cbdc, commodity, security, synthetic
|
||
sovereignSignature String?
|
||
dbisSignature String?
|
||
dualLedgerCommit Boolean @default(false)
|
||
sovereignLedgerHash String?
|
||
dbisLedgerHash String?
|
||
status String @default("pending") // pending, committed, settled, failed
|
||
committedAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node SovereignSettlementNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([entryId])
|
||
@@index([nodeId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@index([committedAt])
|
||
@@map("gss_master_ledger")
|
||
}
|
||
|
||
model GssLayer {
|
||
id String @id @default(uuid())
|
||
layerId String @unique
|
||
layerNumber Int // 1, 2, 3, 4
|
||
layerName String // Sovereign, DBIS Master, Smart Clearing Fabric, Finality & Irreversibility
|
||
description String @db.Text
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([layerId])
|
||
@@index([layerNumber])
|
||
@@map("gss_layers")
|
||
}
|
||
|
||
model StateBlock {
|
||
id String @id @default(uuid())
|
||
blockId String @unique
|
||
nodeId String
|
||
transactionPayload Json
|
||
sovereignSignature String
|
||
hashLock String // SHA3(tx_payload + sovereign_signature)
|
||
blockHash String
|
||
previousBlockHash String?
|
||
status String @default("locked") // locked, unlocked, final
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node SovereignSettlementNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([blockId])
|
||
@@index([nodeId])
|
||
@@index([hashLock])
|
||
@@index([status])
|
||
@@map("state_blocks")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: CBDC Interoperability Matrix (CIM)
|
||
// ============================================================================
|
||
|
||
model CimIdentityMapping {
|
||
id String @id @default(uuid())
|
||
mappingId String @unique
|
||
sourceSovereignBankId String
|
||
targetSovereignBankId String
|
||
sourceIdentityId String
|
||
targetIdentityId String
|
||
identityType String // kyc, aml, cbdc_wallet
|
||
certificationLevel String // basic, enhanced, sovereign
|
||
crossCertificationHash String?
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([mappingId])
|
||
@@index([sourceSovereignBankId])
|
||
@@index([targetSovereignBankId])
|
||
@@index([identityType])
|
||
@@map("cim_identity_mappings")
|
||
}
|
||
|
||
model CimInterledgerConversion {
|
||
id String @id @default(uuid())
|
||
conversionId String @unique
|
||
sourceSovereignBankId String
|
||
targetSovereignBankId String
|
||
sourceCbdcCode String
|
||
targetCbdcCode String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
fxRate Decimal? @db.Decimal(32, 12)
|
||
conversionType String // fx_linked, commodity_backed
|
||
dualPostingStatus String @default("pending") // pending, scb_posted, dbis_posted, both_posted
|
||
scbLedgerHash String?
|
||
dbisLedgerHash String?
|
||
status String @default("pending") // pending, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([conversionId])
|
||
@@index([sourceSovereignBankId])
|
||
@@index([targetSovereignBankId])
|
||
@@index([status])
|
||
@@map("cim_interledger_conversions")
|
||
}
|
||
|
||
model CimContractTemplate {
|
||
id String @id @default(uuid())
|
||
templateId String @unique
|
||
templateCode String // DBIS-CT-001, DBIS-CT-002, etc.
|
||
templateName String
|
||
templateType String // time_locked, condition_based, cross_border
|
||
contractLogic Json // Contract logic definition
|
||
validationRules Json // Unified rule validation
|
||
status String @default("active")
|
||
version Int @default(1)
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([templateId])
|
||
@@index([templateCode])
|
||
@@index([templateType])
|
||
@@index([status])
|
||
@@map("cim_contract_templates")
|
||
}
|
||
|
||
model CimOfflineCapsule {
|
||
id String @id @default(uuid())
|
||
capsuleId String @unique
|
||
sourceSovereignBankId String
|
||
targetSovereignBankId String
|
||
senderWalletId String
|
||
receiverWalletId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
timestamp DateTime
|
||
expiryWindow Int // Allowed time window in seconds
|
||
doubleSpendToken String @unique
|
||
signature String
|
||
crossSovereignRecognition Boolean @default(false)
|
||
globalSyncStatus String @default("pending") // pending, recognized, synced, rejected
|
||
syncedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([capsuleId])
|
||
@@index([doubleSpendToken])
|
||
@@index([sourceSovereignBankId])
|
||
@@index([targetSovereignBankId])
|
||
@@index([globalSyncStatus])
|
||
@@map("cim_offline_capsules")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Synthetic Settlement Unit (SSU) Extensions
|
||
// ============================================================================
|
||
|
||
model SsuComposition {
|
||
id String @id @default(uuid())
|
||
ssuId String
|
||
currencyWeight Decimal @db.Decimal(32, 8) // 40%
|
||
commodityWeight Decimal @db.Decimal(32, 8) // 30%
|
||
cbdcWeight Decimal @db.Decimal(32, 8) // 20%
|
||
lamWeight Decimal @db.Decimal(32, 8) // 10% (Liquidity Adjustment Mechanism)
|
||
topSovereigns Json // Top 10 SCBs
|
||
commodities Json // Gold, oil, rare metals
|
||
cbdcs Json // Sovereign CBDC tier
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ssu SyntheticSettlementUnit @relation(fields: [ssuId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([ssuId])
|
||
@@map("ssu_compositions")
|
||
}
|
||
|
||
model SsuTransaction {
|
||
id String @id @default(uuid())
|
||
transactionId String @unique
|
||
ssuId String
|
||
transactionType String // mint, burn, settle, redeem, recycle
|
||
amount Decimal @db.Decimal(32, 8)
|
||
sourceBankId String?
|
||
destinationBankId String?
|
||
settlementId String?
|
||
status String @default("pending") // pending, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ssu SyntheticSettlementUnit @relation(fields: [ssuId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([transactionId])
|
||
@@index([ssuId])
|
||
@@index([transactionType])
|
||
@@index([status])
|
||
@@map("ssu_transactions")
|
||
}
|
||
|
||
model SsuRedemptionRequest {
|
||
id String @id @default(uuid())
|
||
requestId String @unique
|
||
ssuId String
|
||
sovereignBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
targetAssetType String // currency, commodity, cbdc
|
||
targetCurrencyCode String?
|
||
status String @default("pending") // pending, approved, processed, rejected
|
||
processedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ssu SyntheticSettlementUnit @relation(fields: [ssuId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([requestId])
|
||
@@index([ssuId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("ssu_redemption_requests")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Commodity-Backed Digital System (CBDS)
|
||
// ============================================================================
|
||
|
||
model CommodityDigitalToken {
|
||
id String @id @default(uuid())
|
||
cdtId String @unique
|
||
commodityType String // GOLD, SILVER, PLATINUM, OIL, GAS, AGRICULTURAL
|
||
weight Decimal @db.Decimal(32, 8) // e.g., 1.000 troy ounce
|
||
unit String // troy_ounce, barrel, kg
|
||
reserveCertificateId String
|
||
custodianId String
|
||
sovereignIssuerId String
|
||
timestamp DateTime @default(now())
|
||
signature String // HSM signature
|
||
status String @default("active") // active, burned, redeemed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserveCertificate CommodityReserveCertificate @relation(fields: [reserveCertificateId], references: [id])
|
||
custodian CommodityCustodian @relation(fields: [custodianId], references: [id])
|
||
transactions CdtTransaction[]
|
||
|
||
@@index([cdtId])
|
||
@@index([commodityType])
|
||
@@index([reserveCertificateId])
|
||
@@index([custodianId])
|
||
@@index([status])
|
||
@@map("commodity_digital_tokens")
|
||
}
|
||
|
||
model CommodityReserveCertificate {
|
||
id String @id @default(uuid())
|
||
certificateId String @unique
|
||
commodityType String
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
unit String
|
||
custodianId String
|
||
certificateHash String // HASH256(...)
|
||
verificationStatus String @default("pending") // pending, verified, rejected
|
||
auditDate DateTime?
|
||
nextAuditDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
custodian CommodityCustodian @relation(fields: [custodianId], references: [id])
|
||
cdts CommodityDigitalToken[]
|
||
|
||
@@index([certificateId])
|
||
@@index([certificateHash])
|
||
@@index([custodianId])
|
||
@@index([verificationStatus])
|
||
@@map("commodity_reserve_certificates")
|
||
}
|
||
|
||
model CdtTransaction {
|
||
id String @id @default(uuid())
|
||
transactionId String @unique
|
||
cdtId String
|
||
transactionType String // transfer, burn, exchange_cbdc, cross_commodity_swap
|
||
sourceBankId String?
|
||
destinationBankId String?
|
||
targetAssetType String? // cbdc, commodity, ssu
|
||
targetAssetId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
status String @default("pending") // pending, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
cdt CommodityDigitalToken @relation(fields: [cdtId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([transactionId])
|
||
@@index([cdtId])
|
||
@@index([transactionType])
|
||
@@index([status])
|
||
@@map("cdt_transactions")
|
||
}
|
||
|
||
model CommodityCustodian {
|
||
id String @id @default(uuid())
|
||
custodianId String @unique
|
||
custodianName String
|
||
entityType String // approved_entity, sovereign_custodian
|
||
approvalStatus String @default("pending") // pending, approved, suspended
|
||
approvalDate DateTime?
|
||
commoditiesHandled Json // Array of commodity types
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
certificates CommodityReserveCertificate[]
|
||
cdts CommodityDigitalToken[]
|
||
|
||
@@index([custodianId])
|
||
@@index([approvalStatus])
|
||
@@map("commodity_custodians")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Global Liquidity Pool (GLP)
|
||
// ============================================================================
|
||
|
||
model GlobalLiquidityPool {
|
||
id String @id @default(uuid())
|
||
poolId String @unique
|
||
totalLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
availableLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
reservedLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
assetType String // multi_asset
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contributions GlpContribution[]
|
||
withdrawals GlpWithdrawal[]
|
||
|
||
@@index([poolId])
|
||
@@map("global_liquidity_pools")
|
||
}
|
||
|
||
model GlpContribution {
|
||
id String @id @default(uuid())
|
||
contributionId String @unique
|
||
poolId String
|
||
sovereignBankId String
|
||
contributionType String // scb_reserve, commodity_reserve, cbdc_liquidity, dbis_stabilization
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
assetType String?
|
||
status String @default("pending") // pending, confirmed, failed
|
||
confirmedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GlobalLiquidityPool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([contributionId])
|
||
@@index([poolId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("glp_contributions")
|
||
}
|
||
|
||
model GlpWithdrawal {
|
||
id String @id @default(uuid())
|
||
withdrawalId String @unique
|
||
poolId String
|
||
sovereignBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
withdrawalTier String // tier_1_automatic, tier_2_assisted, tier_3_crisis_intervention
|
||
liquidityScore Decimal? @db.Decimal(32, 8)
|
||
triggerCondition String? // <85% liquidity score, msc_approval, scc_activation
|
||
approvalEntityId String?
|
||
approvalStatus String @default("pending") // pending, approved, rejected, executed
|
||
approvedAt DateTime?
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GlobalLiquidityPool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([withdrawalId])
|
||
@@index([poolId])
|
||
@@index([sovereignBankId])
|
||
@@index([withdrawalTier])
|
||
@@index([approvalStatus])
|
||
@@map("glp_withdrawals")
|
||
}
|
||
|
||
model LiquidityScore {
|
||
id String @id @default(uuid())
|
||
scoreId String @unique
|
||
sovereignBankId String
|
||
score Decimal @db.Decimal(32, 8) // 0-100 scale
|
||
bufferLevel Decimal? @db.Decimal(32, 8)
|
||
riskFactors Json? // Risk factors affecting score
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([scoreId])
|
||
@@index([sovereignBankId])
|
||
@@index([score])
|
||
@@index([calculatedAt])
|
||
@@map("liquidity_scores")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Cross-Chain Settlement
|
||
// ============================================================================
|
||
|
||
model CrossChainSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
sourceChainType String // dbis_sovereign, scb_cbdc, commodity_tokenization, security_token
|
||
sourceChainId String
|
||
targetChainType String
|
||
targetChainId String
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
assetType String
|
||
status String @default("pending") // pending, verified, committed, settled, failed
|
||
committedAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
commitments CrossChainCommitment[]
|
||
chainHeaders ChainHeader[]
|
||
|
||
@@index([settlementId])
|
||
@@index([sourceChainType])
|
||
@@index([targetChainType])
|
||
@@index([sourceBankId])
|
||
@@index([status])
|
||
@@map("cross_chain_settlements")
|
||
}
|
||
|
||
model ChainHeader {
|
||
id String @id @default(uuid())
|
||
headerId String @unique
|
||
settlementId String
|
||
chainType String
|
||
chainId String
|
||
blockNumber String?
|
||
blockHash String
|
||
previousBlockHash String?
|
||
timestamp DateTime
|
||
verificationStatus String @default("pending") // pending, verified, rejected
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement CrossChainSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([headerId])
|
||
@@index([settlementId])
|
||
@@index([chainType])
|
||
@@index([blockHash])
|
||
@@index([verificationStatus])
|
||
@@map("chain_headers")
|
||
}
|
||
|
||
model CrossChainCommitment {
|
||
id String @id @default(uuid())
|
||
commitmentId String @unique
|
||
settlementId String
|
||
chainId String // SCB1, SCB2, DBIS
|
||
commitmentHash String
|
||
commitmentType String // scb1_commit, scb2_commit, dbis_commit
|
||
status String @default("pending") // pending, committed, verified
|
||
committedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement CrossChainSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([commitmentId])
|
||
@@index([settlementId])
|
||
@@index([chainId])
|
||
@@index([commitmentType])
|
||
@@map("cross_chain_commitments")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Sovereign Interoperability Routing Engine (SIRE)
|
||
// ============================================================================
|
||
|
||
model SireRoutingDecision {
|
||
id String @id @default(uuid())
|
||
decisionId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
routeId String?
|
||
routeType String // scb_to_scb, scb_to_dbis_to_scb, scb_to_dbis_to_private_bank
|
||
optimalRoute Json // Calculated optimal route
|
||
fxCost Decimal? @db.Decimal(32, 12)
|
||
sriRiskScore Decimal? @db.Decimal(32, 8)
|
||
liquidityPenalty Decimal? @db.Decimal(32, 8)
|
||
ssuAdjustment Decimal? @db.Decimal(32, 8)
|
||
totalCost Decimal @db.Decimal(32, 12)
|
||
decisionTimestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
route SettlementRoute? @relation(fields: [routeId], references: [id])
|
||
metrics SireRoutingMetrics?
|
||
|
||
@@index([decisionId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([routeId])
|
||
@@map("sire_routing_decisions")
|
||
}
|
||
|
||
model SireRoutingMetrics {
|
||
id String @id @default(uuid())
|
||
metricsId String @unique
|
||
decisionId String
|
||
fxVolatility Decimal? @db.Decimal(32, 12)
|
||
liquidityBufferLevel Decimal? @db.Decimal(32, 8)
|
||
sriScore Decimal? @db.Decimal(32, 8)
|
||
syntheticSettlementCost Decimal? @db.Decimal(32, 12)
|
||
commodityIndex Json? // Commodity index values
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
decision SireRoutingDecision @relation(fields: [decisionId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([metricsId])
|
||
@@index([decisionId])
|
||
@@map("sire_routing_metrics")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Global Derivatives Settlement Layer (GDSL)
|
||
// ============================================================================
|
||
|
||
model DerivativeContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
derivativeType String // irs, fx_forward, fx_swap, sovereign_cds, oil_future, gold_swap, agricultural_forward, cbdc_liquidity_future, synthetic_ssu_option, tokenized_bond_future
|
||
party1BankId String
|
||
party2BankId String
|
||
notionalAmount Decimal @db.Decimal(32, 8)
|
||
contractTerms Json // Contract terms and parameters
|
||
smartContractId String? // Reference to smart contract
|
||
status String @default("active") // active, expired, terminated, settled
|
||
initiatedAt DateTime @default(now())
|
||
maturityDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
margins DerivativeMargin[]
|
||
settlements DerivativeSettlement[]
|
||
collaterals DerivativeCollateral[]
|
||
|
||
@@index([contractId])
|
||
@@index([derivativeType])
|
||
@@index([party1BankId])
|
||
@@index([party2BankId])
|
||
@@index([status])
|
||
@@map("derivative_contracts")
|
||
}
|
||
|
||
model DerivativeMargin {
|
||
id String @id @default(uuid())
|
||
marginId String @unique
|
||
contractId String
|
||
marginType String // initial_margin, variation_margin
|
||
amount Decimal @db.Decimal(32, 8)
|
||
exposure Decimal? @db.Decimal(32, 8)
|
||
volatility Decimal? @db.Decimal(32, 12)
|
||
sriFactor Decimal? @db.Decimal(32, 12)
|
||
markToMarket Decimal? @db.Decimal(32, 12)
|
||
previousMarkToMarket Decimal? @db.Decimal(32, 12)
|
||
calculatedAt DateTime @default(now())
|
||
status String @default("pending") // pending, posted, settled
|
||
postedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contract DerivativeContract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([marginId])
|
||
@@index([contractId])
|
||
@@index([marginType])
|
||
@@index([status])
|
||
@@map("derivative_margins")
|
||
}
|
||
|
||
model DerivativeSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
contractId String
|
||
settlementAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // fiat, cbdc, commodity, security
|
||
hashLock String // Hash-lock for finality
|
||
sovereignLedgerHash String?
|
||
dbisLedgerHash String?
|
||
dualLedgerCommit Boolean @default(false)
|
||
status String @default("pending") // pending, committed, settled, final
|
||
committedAt DateTime?
|
||
settledAt DateTime?
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contract DerivativeContract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([contractId])
|
||
@@index([hashLock])
|
||
@@index([status])
|
||
@@map("derivative_settlements")
|
||
}
|
||
|
||
model DerivativeCollateral {
|
||
id String @id @default(uuid())
|
||
collateralId String @unique
|
||
contractId String
|
||
assetType String // fiat, cbdc, commodity, security, ssu
|
||
assetId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
valuation Decimal @db.Decimal(32, 12)
|
||
haircut Decimal? @db.Decimal(32, 12)
|
||
status String @default("active") // active, released, liquidated
|
||
allocatedAt DateTime @default(now())
|
||
releasedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contract DerivativeContract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([collateralId])
|
||
@@index([contractId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("derivative_collaterals")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Inter-SCB Bond Issuance Network (IBIN)
|
||
// ============================================================================
|
||
|
||
model DigitalBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
issuerBankId String
|
||
couponRate Decimal @db.Decimal(32, 12) // Percentage
|
||
maturityDate DateTime
|
||
principal Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
settlementMode String @default("cbdc") // cbdc, fiat
|
||
collateral Json? // Optional commodity or SSU
|
||
hsmSignature String // HSM-signed signature
|
||
status String @default("issued") // issued, active, matured, redeemed
|
||
issuedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
trades BondTrade[]
|
||
couponPayments BondCouponPayment[]
|
||
|
||
@@index([bondId])
|
||
@@index([issuerBankId])
|
||
@@index([maturityDate])
|
||
@@index([status])
|
||
@@map("digital_bonds")
|
||
}
|
||
|
||
model BondOrderBook {
|
||
id String @id @default(uuid())
|
||
orderId String @unique
|
||
bondId String
|
||
orderType String // buy, sell
|
||
price Decimal @db.Decimal(32, 12)
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
participantBankId String
|
||
priority Int // Price-time priority
|
||
status String @default("pending") // pending, matched, cancelled, expired
|
||
placedAt DateTime @default(now())
|
||
matchedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([orderId])
|
||
@@index([bondId])
|
||
@@index([orderType])
|
||
@@index([status])
|
||
@@index([priority])
|
||
@@map("bond_order_books")
|
||
}
|
||
|
||
model BondTrade {
|
||
id String @id @default(uuid())
|
||
tradeId String @unique
|
||
bondId String
|
||
buyerBankId String
|
||
sellerBankId String
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
price Decimal @db.Decimal(32, 12)
|
||
tradeAmount Decimal @db.Decimal(32, 8)
|
||
settlementId String? // Reference to settlement
|
||
status String @default("pending") // pending, settled, failed
|
||
tradedAt DateTime @default(now())
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond DigitalBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([tradeId])
|
||
@@index([bondId])
|
||
@@index([buyerBankId])
|
||
@@index([sellerBankId])
|
||
@@index([status])
|
||
@@map("bond_trades")
|
||
}
|
||
|
||
model BondCouponPayment {
|
||
id String @id @default(uuid())
|
||
paymentId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
paymentDate DateTime
|
||
settlementMode String @default("cbdc") // cbdc with FX conversion as needed
|
||
sovereignLedgerHash String?
|
||
dbisLedgerHash String?
|
||
dualLedgerCommit Boolean @default(false)
|
||
status String @default("pending") // pending, settled, failed
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond DigitalBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([paymentId])
|
||
@@index([bondId])
|
||
@@index([paymentDate])
|
||
@@index([status])
|
||
@@map("bond_coupon_payments")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Digital Sovereign Debt Market (DSDM)
|
||
// ============================================================================
|
||
|
||
model SovereignDebtInstrument {
|
||
id String @id @default(uuid())
|
||
instrumentId String @unique
|
||
issuerBankId String
|
||
participantBankId String
|
||
instrumentType String // bond, note, bill
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
maturityDate DateTime
|
||
participantType String // scb, supranational, pension_fund, licensed_institution
|
||
status String @default("active") // active, matured, redeemed
|
||
issuedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([instrumentId])
|
||
@@index([issuerBankId])
|
||
@@index([participantBankId])
|
||
@@index([participantType])
|
||
@@index([status])
|
||
@@map("sovereign_debt_instruments")
|
||
}
|
||
|
||
model DebtLadder {
|
||
id String @id @default(uuid())
|
||
ladderId String @unique
|
||
sovereignBankId String
|
||
maturityDate DateTime
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
rolloverContractId String? // Reference to rollover contract
|
||
status String @default("active") // active, rolled_over, matured
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([ladderId])
|
||
@@index([sovereignBankId])
|
||
@@index([maturityDate])
|
||
@@index([status])
|
||
@@map("debt_ladders")
|
||
}
|
||
|
||
model DebtRollover {
|
||
id String @id @default(uuid())
|
||
rolloverId String @unique
|
||
sovereignBankId String
|
||
originalLadderId String
|
||
newLadderId String?
|
||
rolloverAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
fundingSource String @default("cbdc") // cbdc, fiat
|
||
status String @default("pending") // pending, executed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([rolloverId])
|
||
@@index([sovereignBankId])
|
||
@@index([originalLadderId])
|
||
@@index([status])
|
||
@@map("debt_rollovers")
|
||
}
|
||
|
||
model PublicMarketOperation {
|
||
id String @id @default(uuid())
|
||
pmoId String @unique
|
||
sovereignBankId String
|
||
operationType String // maturity_ladder, rollover, debt_refinancing
|
||
operationData Json // Operation configuration
|
||
status String @default("pending") // pending, executed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([pmoId])
|
||
@@index([sovereignBankId])
|
||
@@index([operationType])
|
||
@@index([status])
|
||
@@map("public_market_operations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Quantum-Safe CBDC Wallet Standards
|
||
// ============================================================================
|
||
|
||
model QuantumWallet {
|
||
id String @id @default(uuid())
|
||
walletId String @unique
|
||
sovereignBankId String
|
||
walletType String // retail, wholesale, institutional
|
||
currencyCode String
|
||
balance Decimal @default(0) @db.Decimal(32, 8)
|
||
dilithiumKeyId String // PQC signature key (Dilithium)
|
||
kyberKeyId String // PQC key exchange key (Kyber)
|
||
hsmIdentityCert String // HSM-bound identity certificate
|
||
waoId String? // Wallet Attestation Object reference
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
attestations WalletAttestationObject[]
|
||
capsules QuantumWalletCapsule[]
|
||
riskScores WalletRiskScore[]
|
||
|
||
@@index([walletId])
|
||
@@index([sovereignBankId])
|
||
@@index([walletType])
|
||
@@index([status])
|
||
@@map("quantum_wallets")
|
||
}
|
||
|
||
model WalletAttestationObject {
|
||
id String @id @default(uuid())
|
||
waoId String @unique
|
||
walletId String
|
||
deviceAttestation Json // Device attestation data
|
||
attestationHash String // Hash of attestation
|
||
attestationCycle Int // 12-hour cycle number
|
||
status String @default("valid") // valid, expired, revoked
|
||
attestedAt DateTime @default(now())
|
||
expiresAt DateTime
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
wallet QuantumWallet @relation(fields: [walletId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([waoId])
|
||
@@index([walletId])
|
||
@@index([status])
|
||
@@index([attestationCycle])
|
||
@@map("wallet_attestation_objects")
|
||
}
|
||
|
||
model QuantumWalletCapsule {
|
||
id String @id @default(uuid())
|
||
capsuleId String @unique
|
||
senderWalletId String
|
||
receiverWalletId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
timestamp DateTime
|
||
expiryWindow Int // Allowed time window in seconds
|
||
doubleSpendToken String @unique
|
||
pqcSignature String // PQC-secured signature
|
||
scbVerification Boolean @default(false)
|
||
dbisVerification Boolean @default(false)
|
||
status String @default("pending") // pending, validated, synced, rejected
|
||
syncedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
wallet QuantumWallet @relation(fields: [senderWalletId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([capsuleId])
|
||
@@index([doubleSpendToken])
|
||
@@index([status])
|
||
@@map("quantum_wallet_capsules")
|
||
}
|
||
|
||
model WalletRiskScore {
|
||
id String @id @default(uuid())
|
||
scoreId String @unique
|
||
walletId String
|
||
riskScore Decimal @db.Decimal(32, 8) // 0-100 scale
|
||
riskFactors Json? // Risk factors
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
wallet QuantumWallet @relation(fields: [walletId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([scoreId])
|
||
@@index([walletId])
|
||
@@index([calculatedAt])
|
||
@@map("wallet_risk_scores")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Settlement Law Codebook
|
||
// ============================================================================
|
||
|
||
model SettlementLawArticle {
|
||
id String @id @default(uuid())
|
||
articleId String @unique
|
||
articleNumber String // 12, 19, 27, etc.
|
||
articleTitle String
|
||
content String @db.Text
|
||
principle String? // Principle 1 (Finality), Principle 2 (Irrevocability), Principle 3 (Multilateral Recognition)
|
||
version Int @default(1)
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
status String @default("active") // active, superseded, archived
|
||
metadata Json? // Additional legal references
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
finalities SettlementFinality[]
|
||
disputes SettlementDispute[]
|
||
|
||
@@index([articleId])
|
||
@@index([articleNumber])
|
||
@@index([principle])
|
||
@@index([status])
|
||
@@map("settlement_law_articles")
|
||
}
|
||
|
||
model SettlementFinality {
|
||
id String @id @default(uuid())
|
||
finalityId String @unique
|
||
transactionId String
|
||
articleId String
|
||
masterLedgerCommit Boolean @default(false)
|
||
legalBinding Boolean @default(false)
|
||
principle String // Principle 1, 2, or 3
|
||
status String @default("pending") // pending, final, disputed
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
article SettlementLawArticle @relation(fields: [articleId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([finalityId])
|
||
@@index([transactionId])
|
||
@@index([articleId])
|
||
@@index([status])
|
||
@@map("settlement_finalities")
|
||
}
|
||
|
||
model SettlementDispute {
|
||
id String @id @default(uuid())
|
||
disputeId String @unique
|
||
transactionId String
|
||
articleId String
|
||
party1BankId String
|
||
party2BankId String
|
||
disputeType String // settlement, finality, cross_border
|
||
description String @db.Text
|
||
stage String @default("bilateral") // bilateral, caa_review, arbitration_tribunal
|
||
status String @default("active") // active, resolved, escalated
|
||
resolution String? @db.Text
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
article SettlementLawArticle @relation(fields: [articleId], references: [id], onDelete: Cascade)
|
||
arbitrations SettlementArbitration[]
|
||
|
||
@@index([disputeId])
|
||
@@index([transactionId])
|
||
@@index([articleId])
|
||
@@index([stage])
|
||
@@index([status])
|
||
@@map("settlement_disputes")
|
||
}
|
||
|
||
model SettlementArbitration {
|
||
id String @id @default(uuid())
|
||
arbitrationId String @unique
|
||
disputeId String
|
||
tribunalDecision String @db.Text
|
||
decisionType String // final, binding, appealable
|
||
status String @default("pending") // pending, decided, enforced
|
||
decidedAt DateTime?
|
||
enforcedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
dispute SettlementDispute @relation(fields: [disputeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([arbitrationId])
|
||
@@index([disputeId])
|
||
@@index([status])
|
||
@@map("settlement_arbitrations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Sovereign Stablecoin Compliance Framework
|
||
// ============================================================================
|
||
|
||
model SovereignStablecoin {
|
||
id String @id @default(uuid())
|
||
stablecoinId String @unique
|
||
issuerBankId String
|
||
stablecoinCode String @unique
|
||
name String
|
||
totalSupply Decimal @default(0) @db.Decimal(32, 8)
|
||
collateralizationRatio Decimal @db.Decimal(32, 12) // Must be >= 1.0
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
collaterals StablecoinCollateral[]
|
||
reserves StablecoinReserve[]
|
||
audits StablecoinAudit[]
|
||
|
||
@@index([stablecoinId])
|
||
@@index([issuerBankId])
|
||
@@index([stablecoinCode])
|
||
@@index([status])
|
||
@@map("sovereign_stablecoins")
|
||
}
|
||
|
||
model StablecoinCollateral {
|
||
id String @id @default(uuid())
|
||
collateralId String @unique
|
||
stablecoinId String
|
||
assetType String // cbdc, gold, commodity, security, ssu
|
||
assetId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
valuation Decimal @db.Decimal(32, 12)
|
||
status String @default("active") // active, released
|
||
allocatedAt DateTime @default(now())
|
||
releasedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
stablecoin SovereignStablecoin @relation(fields: [stablecoinId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([collateralId])
|
||
@@index([stablecoinId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("stablecoin_collaterals")
|
||
}
|
||
|
||
model StablecoinReserve {
|
||
id String @id @default(uuid())
|
||
reserveId String @unique
|
||
stablecoinId String
|
||
snapshotDate DateTime
|
||
totalReserves Decimal @db.Decimal(32, 8)
|
||
totalSupply Decimal @db.Decimal(32, 8)
|
||
collateralizationRatio Decimal @db.Decimal(32, 12)
|
||
reserveBreakdown Json // Breakdown by asset type
|
||
status String @default("pending") // pending, verified, published
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
stablecoin SovereignStablecoin @relation(fields: [stablecoinId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reserveId])
|
||
@@index([stablecoinId])
|
||
@@index([snapshotDate])
|
||
@@index([status])
|
||
@@map("stablecoin_reserves")
|
||
}
|
||
|
||
model StablecoinAudit {
|
||
id String @id @default(uuid())
|
||
auditId String @unique
|
||
stablecoinId String
|
||
auditDate DateTime
|
||
auditType String // daily_reserve, hsm_signed, zk_proof
|
||
hsmSignature String? // HSM-signed audit
|
||
zkProof String? // Zero-knowledge collateral proof
|
||
auditResult Json // Audit findings
|
||
status String @default("pending") // pending, verified, published
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
stablecoin SovereignStablecoin @relation(fields: [stablecoinId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([auditId])
|
||
@@index([stablecoinId])
|
||
@@index([auditDate])
|
||
@@index([auditType])
|
||
@@index([status])
|
||
@@map("stablecoin_audits")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Multi-Asset Collateralization Engine (MACE)
|
||
// ============================================================================
|
||
|
||
model MultiAssetCollateral {
|
||
id String @id @default(uuid())
|
||
collateralId String @unique
|
||
assetType String // fiat, cbdc, commodity, security, ssu
|
||
assetId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
valuation Decimal @db.Decimal(32, 12)
|
||
haircut Decimal? @db.Decimal(32, 12)
|
||
fxCost Decimal? @db.Decimal(32, 12)
|
||
liquidityWeight Decimal? @db.Decimal(32, 12)
|
||
sriRiskPenalty Decimal? @db.Decimal(32, 12)
|
||
optimizationScore Decimal? @db.Decimal(32, 12)
|
||
status String @default("active") // active, released, liquidated
|
||
allocatedAt DateTime @default(now())
|
||
releasedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
optimizations CollateralOptimization[]
|
||
|
||
@@index([collateralId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("multi_asset_collaterals")
|
||
}
|
||
|
||
model CollateralOptimization {
|
||
id String @id @default(uuid())
|
||
optimizationId String @unique
|
||
collateralId String
|
||
optimizationType String // allocation, rebalancing, liquidation
|
||
optimalAllocation Json // Optimal allocation result
|
||
totalCost Decimal @db.Decimal(32, 12) // haircuts + fx_cost + liquidity_weight + risk_penalty
|
||
calculationMethod String // argmin optimization
|
||
status String @default("pending") // pending, applied, rejected
|
||
calculatedAt DateTime @default(now())
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
collateral MultiAssetCollateral @relation(fields: [collateralId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([optimizationId])
|
||
@@index([collateralId])
|
||
@@index([optimizationType])
|
||
@@index([status])
|
||
@@map("collateral_optimizations")
|
||
}
|
||
|
||
model CollateralHaircut {
|
||
id String @id @default(uuid())
|
||
haircutId String @unique
|
||
assetType String // fiat, cbdc, commodity, security, ssu
|
||
haircutRate Decimal @db.Decimal(32, 12) // Percentage
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([haircutId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("collateral_haircuts")
|
||
}
|
||
|
||
model CollateralLiquidity {
|
||
id String @id @default(uuid())
|
||
liquidityId String @unique
|
||
assetType String
|
||
liquidityWeight Decimal @db.Decimal(32, 12)
|
||
liquidityScore Decimal? @db.Decimal(32, 8) // 0-100 scale
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([liquidityId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("collateral_liquidities")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IV: Global DeFi-Integrated Sovereign Layer
|
||
// ============================================================================
|
||
|
||
model DeFiModule {
|
||
id String @id @default(uuid())
|
||
moduleId String @unique
|
||
moduleName String
|
||
moduleType String // swap, lending, staking, liquidity_pool
|
||
permissionLevel String // permissioned, sovereign_verified
|
||
status String @default("pending") // pending, approved, active, suspended
|
||
approvalDate DateTime?
|
||
approvedBy String? // SCB or DBIS entity
|
||
moduleConfig Json // Module configuration
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
nodes DeFiNode[]
|
||
pools DeFiLiquidityPool[]
|
||
swaps DeFiSwap[]
|
||
|
||
@@index([moduleId])
|
||
@@index([moduleType])
|
||
@@index([permissionLevel])
|
||
@@index([status])
|
||
@@map("defi_modules")
|
||
}
|
||
|
||
model DeFiNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
moduleId String
|
||
sovereignBankId String?
|
||
nodeType String // sovereign_verified, dbis_governed
|
||
verificationStatus String @default("pending") // pending, verified, revoked
|
||
verificationDate DateTime?
|
||
nodeAddress String? // Node network address
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
module DeFiModule @relation(fields: [moduleId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([nodeId])
|
||
@@index([moduleId])
|
||
@@index([sovereignBankId])
|
||
@@index([verificationStatus])
|
||
@@index([status])
|
||
@@map("defi_nodes")
|
||
}
|
||
|
||
model DeFiLiquidityPool {
|
||
id String @id @default(uuid())
|
||
poolId String @unique
|
||
moduleId String
|
||
poolName String
|
||
assetTypes Json // Array of asset types in pool
|
||
totalLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
governanceModel String @default("dbis_governed") // dbis_governed, scb_oversight
|
||
status String @default("active") // active, paused, closed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
module DeFiModule @relation(fields: [moduleId], references: [id], onDelete: Cascade)
|
||
swaps DeFiSwap[]
|
||
|
||
@@index([poolId])
|
||
@@index([moduleId])
|
||
@@index([status])
|
||
@@map("defi_liquidity_pools")
|
||
}
|
||
|
||
model DeFiSwap {
|
||
id String @id @default(uuid())
|
||
swapId String @unique
|
||
moduleId String
|
||
poolId String?
|
||
sourceAssetType String
|
||
targetAssetType String
|
||
sourceAmount Decimal @db.Decimal(32, 8)
|
||
targetAmount Decimal @db.Decimal(32, 8)
|
||
exchangeRate Decimal @db.Decimal(32, 12)
|
||
participantBankId String
|
||
scbOversight Boolean @default(true)
|
||
onChainTxHash String? // On-chain transaction hash
|
||
status String @default("pending") // pending, executed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
module DeFiModule @relation(fields: [moduleId], references: [id], onDelete: Cascade)
|
||
pool DeFiLiquidityPool? @relation(fields: [poolId], references: [id])
|
||
|
||
@@index([swapId])
|
||
@@index([moduleId])
|
||
@@index([poolId])
|
||
@@index([status])
|
||
@@map("defi_swaps")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VI: Global Regulatory Harmonization, Sovereign Digital Identity,
|
||
// Autonomous Liquidity Systems, AML Pattern Language, and Financial Ontology
|
||
// ============================================================================
|
||
|
||
// UDFO - Unified DBIS Financial Ontology
|
||
model UDFOAsset {
|
||
id String @id @default(uuid())
|
||
assetType String // FIAT, CBDC, SSU, COMMODITY, SECURITY
|
||
code String @unique
|
||
name String
|
||
definition String @db.Text
|
||
properties Json
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([assetType])
|
||
@@index([code])
|
||
@@map("udfo_assets")
|
||
}
|
||
|
||
model UDFOEntity {
|
||
id String @id @default(uuid())
|
||
entityType String // SCB, BANK, INDIVIDUAL, INSTITUTION, CONTRACT
|
||
identifier String @unique
|
||
name String
|
||
definition String @db.Text
|
||
properties Json
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([entityType])
|
||
@@index([identifier])
|
||
@@map("udfo_entities")
|
||
}
|
||
|
||
model UDFOProcess {
|
||
id String @id @default(uuid())
|
||
processType String // SETTLEMENT, ISSUANCE, CONVERSION, REDEMPTION, COLLATERALIZATION
|
||
code String @unique
|
||
name String
|
||
definition String @db.Text
|
||
inputs String[] // Asset/Entity IDs
|
||
outputs String[] // Asset/Entity IDs
|
||
triggers String[] // Event triggers
|
||
properties Json
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([processType])
|
||
@@index([code])
|
||
@@map("udfo_processes")
|
||
}
|
||
|
||
model OntologyMapping {
|
||
id String @id @default(uuid())
|
||
sourceDomain String // ASSET, ENTITY, PROCESS
|
||
sourceId String
|
||
targetDomain String // ASSET, ENTITY, PROCESS
|
||
targetId String
|
||
mappingType String
|
||
confidence Decimal @db.Decimal(5, 4) // 0-1
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([sourceDomain, sourceId])
|
||
@@index([targetDomain, targetId])
|
||
@@map("ontology_mappings")
|
||
}
|
||
|
||
// SDIP - Sovereign Digital Identity Passport
|
||
model SovereignDigitalIdentityPassport {
|
||
id String @id @default(uuid())
|
||
passportId String @unique
|
||
entityType String // SCB, BANK, PERSON, INSTITUTION, CONTRACT
|
||
entityId String // Reference to GBIG identity
|
||
sovereignIssuer String // SCB code
|
||
rootCert String // HSM signature
|
||
pqSignature String // Dilithium signature
|
||
trustLevel String // TL0, TL1, TL2, TL3, TL4
|
||
expiry DateTime
|
||
revocationStatus String @default("ACTIVE") // ACTIVE, REVOKED, EXPIRED
|
||
attributes Json
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
revocations SDIPRevocation[]
|
||
|
||
@@index([passportId])
|
||
@@index([entityId])
|
||
@@index([sovereignIssuer])
|
||
@@index([trustLevel])
|
||
@@index([revocationStatus])
|
||
@@map("sovereign_digital_identity_passports")
|
||
}
|
||
|
||
model SDIPRevocation {
|
||
id String @id @default(uuid())
|
||
revocationId String @unique
|
||
passportId String
|
||
reason String @db.Text
|
||
revokedBy String
|
||
createdAt DateTime @default(now())
|
||
|
||
passport SovereignDigitalIdentityPassport @relation(fields: [passportId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([revocationId])
|
||
@@index([passportId])
|
||
@@map("sdip_revocations")
|
||
}
|
||
|
||
// GRHS - Global Regulatory Harmonization Suite
|
||
model RegulatoryHarmonizationRule {
|
||
id String @id @default(uuid())
|
||
pillar String // MONETARY, LEGAL, COMPLIANCE, TRADE
|
||
ruleCode String
|
||
name String
|
||
description String @db.Text
|
||
requirements String[]
|
||
applicableSovereigns String[] // Empty = all
|
||
status String @default("ACTIVE") // ACTIVE, DRAFT, SUSPENDED
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@unique([pillar, ruleCode])
|
||
@@index([pillar])
|
||
@@index([ruleCode])
|
||
@@index([status])
|
||
@@map("regulatory_harmonization_rules")
|
||
}
|
||
|
||
model RegulatoryEquivalenceScore {
|
||
id String @id @default(uuid())
|
||
scoreId String @unique
|
||
sovereignBankId String
|
||
compliance Decimal @db.Decimal(5, 2) // 0-100
|
||
transparency Decimal @db.Decimal(5, 2) // 0-100
|
||
amlStrength Decimal @db.Decimal(5, 2) // 0-100
|
||
cbdcMaturity Decimal @db.Decimal(5, 2) // 0-100
|
||
repScore Decimal @db.Decimal(5, 2) // Calculated
|
||
equivalent Boolean @default(false) // repScore >= 95%
|
||
calculatedAt DateTime @default(now())
|
||
|
||
@@index([scoreId])
|
||
@@index([sovereignBankId])
|
||
@@index([equivalent])
|
||
@@index([calculatedAt])
|
||
@@map("regulatory_equivalence_scores")
|
||
}
|
||
|
||
model HarmonizationCompliance {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String
|
||
pillar String // MONETARY, LEGAL, COMPLIANCE, TRADE
|
||
complianceScore Decimal @db.Decimal(5, 2) // 0-100
|
||
lastAssessment DateTime
|
||
nextAssessment DateTime
|
||
issues String[]
|
||
status String @default("COMPLIANT") // COMPLIANT, NON_COMPLIANT, PARTIAL
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([pillar])
|
||
@@index([status])
|
||
@@map("harmonization_compliance")
|
||
}
|
||
|
||
model FastTrackPrivilege {
|
||
id String @id @default(uuid())
|
||
privilegeId String @unique
|
||
sovereignBankId String
|
||
privilegeType String // SETTLEMENT, LIQUIDITY, OVERSIGHT
|
||
grantedAt DateTime @default(now())
|
||
expiresAt DateTime?
|
||
status String @default("ACTIVE") // ACTIVE, REVOKED, EXPIRED
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([privilegeId])
|
||
@@index([sovereignBankId])
|
||
@@index([privilegeType])
|
||
@@index([status])
|
||
@@map("fast_track_privileges")
|
||
}
|
||
|
||
// GASE - Global AML & Sanctions Engine
|
||
model GlobalSanctionsList {
|
||
id String @id @default(uuid())
|
||
entityName String
|
||
entityType String // individual, organization, country
|
||
listSource String // OFAC, EU, UN, etc.
|
||
listId String
|
||
country String?
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@unique([entityName, listSource])
|
||
@@index([entityName])
|
||
@@index([listSource])
|
||
@@index([status])
|
||
@@map("global_sanctions_lists")
|
||
}
|
||
|
||
model PEPGraphNode {
|
||
id String @id @default(uuid())
|
||
entityId String @unique
|
||
entityName String
|
||
pepType String
|
||
country String
|
||
position String
|
||
riskLevel String // LOW, MEDIUM, HIGH
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
edgesFrom PEPGraphEdge[] @relation("FromNode")
|
||
edgesTo PEPGraphEdge[] @relation("ToNode")
|
||
|
||
@@index([entityId])
|
||
@@index([entityName])
|
||
@@index([country])
|
||
@@map("pep_graph_nodes")
|
||
}
|
||
|
||
model PEPGraphEdge {
|
||
id String @id @default(uuid())
|
||
fromNodeId String
|
||
toNodeId String
|
||
relationshipType String
|
||
strength Decimal @db.Decimal(5, 4) // 0-1
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
fromNode PEPGraphNode @relation("FromNode", fields: [fromNodeId], references: [entityId], onDelete: Cascade)
|
||
toNode PEPGraphNode @relation("ToNode", fields: [toNodeId], references: [entityId], onDelete: Cascade)
|
||
|
||
@@index([fromNodeId])
|
||
@@index([toNodeId])
|
||
@@index([relationshipType])
|
||
@@map("pep_graph_edges")
|
||
}
|
||
|
||
model SuspiciousActivityScore {
|
||
id String @id @default(uuid())
|
||
sasId String @unique
|
||
transactionId String
|
||
entityId String
|
||
score Decimal @db.Decimal(5, 2) // 0-100
|
||
factors Json // { sanctionsMatch, pepMatch, patternRisk, velocityAnomaly, geographicRisk }
|
||
riskTier String // TIER_1, TIER_2, TIER_3, TIER_4
|
||
calculatedAt DateTime @default(now())
|
||
|
||
@@index([sasId])
|
||
@@index([transactionId])
|
||
@@index([entityId])
|
||
@@index([riskTier])
|
||
@@index([calculatedAt])
|
||
@@map("suspicious_activity_scores")
|
||
}
|
||
|
||
model RiskTier {
|
||
id String @id @default(uuid())
|
||
entityId String @unique
|
||
riskTier String // TIER_1, TIER_2, TIER_3, TIER_4
|
||
assignedAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([entityId])
|
||
@@index([riskTier])
|
||
@@map("risk_tiers")
|
||
}
|
||
|
||
// WAPL - Worldwide AML Pattern Language
|
||
model WAPLPattern {
|
||
id String @id @default(uuid())
|
||
patternCode String @unique
|
||
name String
|
||
description String @db.Text
|
||
patternDefinition String @db.Text
|
||
severity String // LOW, MEDIUM, HIGH, CRITICAL
|
||
status String @default("ACTIVE") // ACTIVE, DRAFT, SUSPENDED
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
matches PatternMatch[]
|
||
|
||
@@index([patternCode])
|
||
@@index([status])
|
||
@@map("wapl_patterns")
|
||
}
|
||
|
||
model PatternMatch {
|
||
id String @id @default(uuid())
|
||
patternId String
|
||
transactionId String
|
||
matchScore Decimal @db.Decimal(5, 4) // 0-1
|
||
matchedConditions String[]
|
||
alertGenerated Boolean @default(false)
|
||
detectedAt DateTime @default(now())
|
||
|
||
pattern WAPLPattern @relation(fields: [patternId], references: [id], onDelete: Cascade)
|
||
alerts PatternAlert[]
|
||
|
||
@@index([id])
|
||
@@index([patternId])
|
||
@@index([transactionId])
|
||
@@index([detectedAt])
|
||
@@map("pattern_matches")
|
||
}
|
||
|
||
model PatternAlert {
|
||
id String @id @default(uuid())
|
||
patternMatchId String
|
||
transactionId String
|
||
patternCode String
|
||
severity String
|
||
description String @db.Text
|
||
status String @default("PENDING") // PENDING, REVIEWED, RESOLVED, FALSE_POSITIVE
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
patternMatch PatternMatch @relation(fields: [patternMatchId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([id])
|
||
@@index([patternMatchId])
|
||
@@index([transactionId])
|
||
@@index([status])
|
||
@@index([createdAt])
|
||
@@map("pattern_alerts")
|
||
}
|
||
|
||
// ALPS - Autonomous Liquidity Provision System
|
||
model AutonomousLiquidityAction {
|
||
id String @id @default(uuid())
|
||
actionId String @unique
|
||
actionType String // INJECTION, WITHDRAWAL
|
||
sovereignBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
triggerReason String @db.Text
|
||
executedAt DateTime?
|
||
status String @default("PENDING") // PENDING, EXECUTED, FAILED
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([actionId])
|
||
@@index([sovereignBankId])
|
||
@@index([actionType])
|
||
@@index([status])
|
||
@@map("autonomous_liquidity_actions")
|
||
}
|
||
|
||
model LiquidityStressEvent {
|
||
id String @id @default(uuid())
|
||
eventId String @unique
|
||
sovereignBankId String
|
||
predictedAt DateTime @default(now())
|
||
predictedStressDate DateTime
|
||
stressLevel String // LOW, MEDIUM, HIGH, CRITICAL
|
||
predictedLiquidityRatio Decimal @db.Decimal(5, 2)
|
||
confidence Decimal @db.Decimal(5, 4) // 0-1
|
||
status String @default("PREDICTED") // PREDICTED, OCCURRED, MITIGATED, FALSE_POSITIVE
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([eventId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@index([predictedStressDate])
|
||
@@map("liquidity_stress_events")
|
||
}
|
||
|
||
model SovereignLiquidityRatio {
|
||
id String @id @default(uuid())
|
||
sovereignBankId String @unique
|
||
ratio Decimal @db.Decimal(5, 2) // SXLR
|
||
riskFactors String[]
|
||
calculatedAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([sovereignBankId])
|
||
@@index([ratio])
|
||
@@index([calculatedAt])
|
||
@@map("sovereign_liquidity_ratios")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: DBIS Cyber-Defense Command (DCDC)
|
||
// ============================================================================
|
||
|
||
model DcdcDivision {
|
||
id String @id @default(uuid())
|
||
divisionId String @unique
|
||
divisionType String // SDD, ODU, FRB, CIST
|
||
divisionName String
|
||
description String @db.Text
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
threats CyberThreatIncident[]
|
||
actions DefenseLayerAction[]
|
||
|
||
@@index([divisionId])
|
||
@@index([divisionType])
|
||
@@index([status])
|
||
@@map("dcdc_divisions")
|
||
}
|
||
|
||
model CyberThreatIncident {
|
||
id String @id @default(uuid())
|
||
incidentId String @unique
|
||
divisionId String?
|
||
threatType String // technical, financial, coordination
|
||
threatCategory String // T1, T2, T3
|
||
severity String // low, medium, high, critical
|
||
sourceBankId String?
|
||
targetBankId String?
|
||
description String @db.Text
|
||
detectionMethod String // ml_anomaly, pq_signature, sgse, manual
|
||
status String @default("detected") // detected, contained, neutralized, resolved
|
||
detectedAt DateTime @default(now())
|
||
containedAt DateTime?
|
||
neutralizedAt DateTime?
|
||
resolvedAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
division DcdcDivision? @relation(fields: [divisionId], references: [id])
|
||
actions DefenseLayerAction[]
|
||
mitigations ThreatMitigation[]
|
||
|
||
@@index([incidentId])
|
||
@@index([divisionId])
|
||
@@index([threatCategory])
|
||
@@index([severity])
|
||
@@index([status])
|
||
@@index([detectedAt])
|
||
@@map("cyber_threat_incidents")
|
||
}
|
||
|
||
model DefenseLayerAction {
|
||
id String @id @default(uuid())
|
||
actionId String @unique
|
||
divisionId String?
|
||
incidentId String?
|
||
layer String // A (Detection), B (Containment), C (Neutralization), D (Restoration)
|
||
actionType String // anomaly_detection, route_isolation, kill_switch, ledger_freeze, rollback
|
||
targetNodeId String?
|
||
targetBankId String?
|
||
description String @db.Text
|
||
actionStatus String @default("pending") // pending, executed, failed, rolled_back
|
||
executedAt DateTime?
|
||
rolledBackAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
division DcdcDivision? @relation(fields: [divisionId], references: [id])
|
||
incident CyberThreatIncident? @relation(fields: [incidentId], references: [id])
|
||
|
||
@@index([actionId])
|
||
@@index([divisionId])
|
||
@@index([incidentId])
|
||
@@index([layer])
|
||
@@index([actionStatus])
|
||
@@map("defense_layer_actions")
|
||
}
|
||
|
||
model SovereignGraphSecurityEngine {
|
||
id String @id @default(uuid())
|
||
sgseId String @unique
|
||
graphType String // threat_graph, identity_graph, transaction_graph
|
||
graphData Json // Graph structure data
|
||
nodeCount Int?
|
||
edgeCount Int?
|
||
lastUpdated DateTime @default(now())
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
anomalies LedgerAnomaly[]
|
||
|
||
@@index([sgseId])
|
||
@@index([graphType])
|
||
@@index([status])
|
||
@@map("sovereign_graph_security_engines")
|
||
}
|
||
|
||
model LedgerAnomaly {
|
||
id String @id @default(uuid())
|
||
anomalyId String @unique
|
||
sgseId String?
|
||
ledgerId String
|
||
anomalyType String // double_spend, invalid_signature, hash_mismatch, unauthorized_transaction
|
||
severity String // low, medium, high, critical
|
||
detectedAt DateTime @default(now())
|
||
remediatedAt DateTime?
|
||
remediationAction String?
|
||
status String @default("detected") // detected, under_investigation, remediated
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sgse SovereignGraphSecurityEngine? @relation(fields: [sgseId], references: [id])
|
||
|
||
@@index([anomalyId])
|
||
@@index([sgseId])
|
||
@@index([ledgerId])
|
||
@@index([anomalyType])
|
||
@@index([status])
|
||
@@map("ledger_anomalies")
|
||
}
|
||
|
||
model NodeQuarantine {
|
||
id String @id @default(uuid())
|
||
quarantineId String @unique
|
||
nodeId String
|
||
sovereignBankId String?
|
||
quarantineReason String
|
||
quarantineType String // automatic, manual, dcdc_ordered
|
||
status String @default("quarantined") // quarantined, released, permanent
|
||
quarantinedAt DateTime @default(now())
|
||
releasedAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([quarantineId])
|
||
@@index([nodeId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("node_quarantines")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: Planetary Settlement Grid (PSG)
|
||
// ============================================================================
|
||
|
||
model PsgSovereignNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
sovereignBankId String
|
||
region String // Geographic region
|
||
nodeType String // geo_redundant
|
||
replicationLinks Json? // PQ-encrypted replication link configs
|
||
status String @default("active") // active, suspended, inactive
|
||
lastSyncAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
epochs SettlementEpoch[]
|
||
stateBlocks PsgStateBlock[]
|
||
|
||
@@index([nodeId])
|
||
@@index([sovereignBankId])
|
||
@@index([region])
|
||
@@index([status])
|
||
@@map("psg_sovereign_nodes")
|
||
}
|
||
|
||
model PsgMasterGrid {
|
||
id String @id @default(uuid())
|
||
gridId String @unique
|
||
gridName String @default("DBIS Master Grid")
|
||
consensusEngine String // quantum_grade_consensus
|
||
status String @default("active")
|
||
lastConsensusAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
epochs SettlementEpoch[]
|
||
relayHubs SupraSovereignRelayHub[]
|
||
|
||
@@index([gridId])
|
||
@@index([status])
|
||
@@map("psg_master_grids")
|
||
}
|
||
|
||
model SupraSovereignRelayHub {
|
||
id String @id @default(uuid())
|
||
hubId String @unique
|
||
gridId String?
|
||
hubName String
|
||
region String // Continent/region
|
||
optimizedRoutes Json? // Optimized routing paths
|
||
latencyStats Json? // Latency statistics
|
||
status String @default("active") // active, suspended, maintenance
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
grid PsgMasterGrid? @relation(fields: [gridId], references: [id])
|
||
|
||
@@index([hubId])
|
||
@@index([gridId])
|
||
@@index([region])
|
||
@@index([status])
|
||
@@map("supra_sovereign_relay_hubs")
|
||
}
|
||
|
||
model SettlementEpoch {
|
||
id String @id @default(uuid())
|
||
epochId String @unique
|
||
gridId String?
|
||
nodeId String?
|
||
assetType String // cbdc_fiat, commodity, security
|
||
epochInterval Int // 1 (CBDC/fiat), 5 (commodity), 10 (securities) seconds
|
||
epochNumber Int
|
||
stateHash String // PSG_State = HASH(SCB_blocks + CBDC_tx + Commodity_tx + Security_tx)
|
||
committedAt DateTime @default(now())
|
||
status String @default("committed") // committed, final, rolled_back
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
grid PsgMasterGrid? @relation(fields: [gridId], references: [id])
|
||
node PsgSovereignNode? @relation(fields: [nodeId], references: [id])
|
||
stateBlocks PsgStateBlock[]
|
||
|
||
@@index([epochId])
|
||
@@index([gridId])
|
||
@@index([nodeId])
|
||
@@index([assetType])
|
||
@@index([epochNumber])
|
||
@@map("settlement_epochs")
|
||
}
|
||
|
||
model PsgStateBlock {
|
||
id String @id @default(uuid())
|
||
blockId String @unique
|
||
epochId String?
|
||
nodeId String?
|
||
scbBlocks Json // SCB block references
|
||
cbdcTransactions Json? // CBDC transactions
|
||
commodityTransactions Json? // Commodity transactions
|
||
securityTransactions Json? // Security transactions
|
||
stateHash String
|
||
previousBlockHash String?
|
||
status String @default("pending") // pending, committed, final
|
||
committedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
epoch SettlementEpoch? @relation(fields: [epochId], references: [id])
|
||
node PsgSovereignNode? @relation(fields: [nodeId], references: [id])
|
||
|
||
@@index([blockId])
|
||
@@index([epochId])
|
||
@@index([nodeId])
|
||
@@index([stateHash])
|
||
@@index([status])
|
||
@@map("psg_state_blocks")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: Distributed Sovereign Compute Mesh (DSCM-X)
|
||
// ============================================================================
|
||
|
||
model DscmNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
sovereignBankId String?
|
||
nodeType String // SEN, CEN, FXN, CTN
|
||
nodeName String
|
||
computeCapacity Decimal? @db.Decimal(32, 8) // Compute units
|
||
latency Int? // Latency in milliseconds
|
||
sovereignPriority Int? // Priority level (1-10)
|
||
riskWeight Decimal? @db.Decimal(32, 8)
|
||
status String @default("active") // active, suspended, offline
|
||
registeredAt DateTime @default(now())
|
||
lastHeartbeat DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
tasks ComputeTask[]
|
||
aiTasks FederatedAiTask[]
|
||
|
||
@@index([nodeId])
|
||
@@index([sovereignBankId])
|
||
@@index([nodeType])
|
||
@@index([status])
|
||
@@map("dscm_nodes")
|
||
}
|
||
|
||
model ComputeTask {
|
||
id String @id @default(uuid())
|
||
taskId String @unique
|
||
nodeId String
|
||
taskType String // smart_contract, settlement, risk_calculation, compliance_check
|
||
taskPayload Json
|
||
computeCost Decimal? @db.Decimal(32, 8)
|
||
latency Int? // Milliseconds
|
||
distributionScore Decimal? @db.Decimal(32, 8) // compute_cost + latency + sovereign_priority + risk_weight
|
||
status String @default("pending") // pending, executing, completed, failed
|
||
assignedAt DateTime @default(now())
|
||
startedAt DateTime?
|
||
completedAt DateTime?
|
||
result Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node DscmNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([taskId])
|
||
@@index([nodeId])
|
||
@@index([taskType])
|
||
@@index([status])
|
||
@@map("compute_tasks")
|
||
}
|
||
|
||
model FederatedAiTask {
|
||
id String @id @default(uuid())
|
||
taskId String @unique
|
||
nodeId String
|
||
aiType String // risk_analysis, compliance_check, threat_detection
|
||
taskPayload Json
|
||
federatedNodes Json? // Array of participating nodes
|
||
consensusResult Json?
|
||
status String @default("pending") // pending, running, consensus_reached, failed
|
||
startedAt DateTime?
|
||
consensusReachedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node DscmNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([taskId])
|
||
@@index([nodeId])
|
||
@@index([aiType])
|
||
@@index([status])
|
||
@@map("federated_ai_tasks")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: CBDC Governance & Monetary Modeling
|
||
// ============================================================================
|
||
|
||
model CbdcMonetaryCommittee {
|
||
id String @id @default(uuid())
|
||
committeeId String @unique
|
||
sovereignBankId String
|
||
committeeName String
|
||
memberCount Int?
|
||
votingMechanism String // simple_majority, supermajority
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
supplyControls CbdcSupplyControl[]
|
||
velocityControls CbdcVelocityControl[]
|
||
|
||
@@index([committeeId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("cbdc_monetary_committees")
|
||
}
|
||
|
||
model DbisMonetaryCouncil {
|
||
id String @id @default(uuid())
|
||
councilId String @unique
|
||
councilName String @default("DBIS Monetary & Settlement Council")
|
||
memberCount Int?
|
||
votingMechanism String // simple_majority, supermajority_2_3
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([councilId])
|
||
@@index([status])
|
||
@@map("dbis_monetary_councils")
|
||
}
|
||
|
||
model CbdcComplianceBoard {
|
||
id String @id @default(uuid())
|
||
boardId String @unique
|
||
boardName String @default("CBDC Compliance & Enforcement Board")
|
||
memberCount Int?
|
||
enforcementLevel String // advisory, binding
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([boardId])
|
||
@@index([status])
|
||
@@map("cbdc_compliance_boards")
|
||
}
|
||
|
||
model CbdcSupplyControl {
|
||
id String @id @default(uuid())
|
||
controlId String @unique
|
||
committeeId String?
|
||
sovereignBankId String
|
||
operationType String // issue, burn
|
||
amount Decimal @db.Decimal(32, 8)
|
||
dualSignature1 String? // First signature (SCB)
|
||
dualSignature2 String? // Second signature (DBIS)
|
||
stressAdjustedCap Decimal? @db.Decimal(32, 8)
|
||
status String @default("pending") // pending, approved, executed
|
||
approvedAt DateTime?
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
committee CbdcMonetaryCommittee? @relation(fields: [committeeId], references: [id])
|
||
|
||
@@index([controlId])
|
||
@@index([committeeId])
|
||
@@index([sovereignBankId])
|
||
@@index([operationType])
|
||
@@index([status])
|
||
@@map("cbdc_supply_controls")
|
||
}
|
||
|
||
model CbdcVelocityControl {
|
||
id String @id @default(uuid())
|
||
controlId String @unique
|
||
committeeId String?
|
||
sovereignBankId String
|
||
walletId String?
|
||
walletLevelLimit Decimal? @db.Decimal(32, 8)
|
||
spendingCategory String? // Category-based spending limits
|
||
timeBasedThrottle Json? // Time-based throttle configuration
|
||
status String @default("active")
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
committee CbdcMonetaryCommittee? @relation(fields: [committeeId], references: [id])
|
||
|
||
@@index([controlId])
|
||
@@index([committeeId])
|
||
@@index([sovereignBankId])
|
||
@@index([walletId])
|
||
@@index([status])
|
||
@@map("cbdc_velocity_controls")
|
||
}
|
||
|
||
model CbdcLiquidityWindow {
|
||
id String @id @default(uuid())
|
||
windowId String @unique
|
||
sovereignBankId String
|
||
windowType String // standing, emergency
|
||
availableLiquidity Decimal @db.Decimal(32, 8)
|
||
swapRate Decimal? @db.Decimal(32, 12) // CBDC-to-SSU swap rate
|
||
status String @default("open") // open, closed, suspended
|
||
openedAt DateTime @default(now())
|
||
closedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([windowId])
|
||
@@index([sovereignBankId])
|
||
@@index([windowType])
|
||
@@index([status])
|
||
@@map("cbdc_liquidity_windows")
|
||
}
|
||
|
||
model CbdcMonetarySimulation {
|
||
id String @id @default(uuid())
|
||
simulationId String @unique
|
||
sovereignBankId String?
|
||
simulationType String // cross_border_flows, liquidity_shock, fx_spillover, commodity_backed_circulation
|
||
supplyChange Decimal? @db.Decimal(32, 8)
|
||
velocityFactor Decimal? @db.Decimal(32, 12)
|
||
fxReserveStrength Decimal? @db.Decimal(32, 12)
|
||
impactScore Decimal? @db.Decimal(32, 12) // CBDC_supply_change * velocity_factor * FX_reserve_strength
|
||
simulationResults Json?
|
||
status String @default("running") // running, completed, failed
|
||
startedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([simulationId])
|
||
@@index([sovereignBankId])
|
||
@@index([simulationType])
|
||
@@index([status])
|
||
@@map("cbdc_monetary_simulations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: Global Quantum Ledger (GQL)
|
||
// ============================================================================
|
||
|
||
model GqlBlock {
|
||
id String @id @default(uuid())
|
||
blockId String @unique
|
||
timestamp DateTime @default(now())
|
||
pqSignatures Json // Array of PQ signatures
|
||
quantumStateCommit String? // ENTANGLED_HASH (future)
|
||
multiAssetRoot String // HASH(cbdc, fiat, ssu, commodity, security)
|
||
previousBlockHash String?
|
||
blockHash String
|
||
status String @default("pending") // pending, verified, final
|
||
verifiedAt DateTime?
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pqSignatureBlocks PqSignatureBlock[]
|
||
quantumHashes QuantumHash[]
|
||
|
||
@@index([blockId])
|
||
@@index([blockHash])
|
||
@@index([previousBlockHash])
|
||
@@index([status])
|
||
@@map("gql_blocks")
|
||
}
|
||
|
||
model QuantumStateCommitment {
|
||
id String @id @default(uuid())
|
||
commitmentId String @unique
|
||
blockId String?
|
||
entangledHash String? // Entanglement-based hash (future)
|
||
commitmentType String // entangled_state_commitment
|
||
status String @default("pending") // pending, verified (future module)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([commitmentId])
|
||
@@index([blockId])
|
||
@@map("quantum_state_commitments")
|
||
}
|
||
|
||
model PqSignatureBlock {
|
||
id String @id @default(uuid())
|
||
signatureId String @unique
|
||
blockId String
|
||
algorithm String // XMSS, SPHINCS+
|
||
signature String @db.Text
|
||
publicKey String @db.Text
|
||
verificationStatus String @default("pending") // pending, verified, rejected
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
block GqlBlock @relation(fields: [blockId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([signatureId])
|
||
@@index([blockId])
|
||
@@index([algorithm])
|
||
@@index([verificationStatus])
|
||
@@map("pq_signature_blocks")
|
||
}
|
||
|
||
model QuantumHash {
|
||
id String @id @default(uuid())
|
||
hashId String @unique
|
||
blockId String?
|
||
hashAlgorithm String // Q-Keccak
|
||
hashValue String
|
||
originalData Json? // Original data hashed
|
||
createdAt DateTime @default(now())
|
||
|
||
block GqlBlock? @relation(fields: [blockId], references: [id])
|
||
|
||
@@index([hashId])
|
||
@@index([blockId])
|
||
@@index([hashAlgorithm])
|
||
@@map("quantum_hashes")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: Advanced FX/CBDC/SSU Simulation Engine (A-FCSS)
|
||
// ============================================================================
|
||
|
||
model AfcssSimulation {
|
||
id String @id @default(uuid())
|
||
simulationId String @unique
|
||
simulationType String // fx_volatility, cbdc_circulation, ssu_stabilization, multi_asset_contagion
|
||
parameters Json
|
||
impactScore Decimal? @db.Decimal(32, 12) // (FX_vol * CBDC_velocity * SSU_weight) - liquidity_shock + sovereign_stability_index
|
||
simulationResults Json?
|
||
status String @default("running") // running, completed, failed
|
||
startedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
impacts FxCbdcSsuImpact[]
|
||
contagionRisks MultiAssetContagionRisk[]
|
||
|
||
@@index([simulationId])
|
||
@@index([simulationType])
|
||
@@index([status])
|
||
@@map("afcss_simulations")
|
||
}
|
||
|
||
model FxCbdcSsuImpact {
|
||
id String @id @default(uuid())
|
||
impactId String @unique
|
||
simulationId String
|
||
fxVolatility Decimal? @db.Decimal(32, 12)
|
||
cbdcVelocity Decimal? @db.Decimal(32, 12)
|
||
ssuWeight Decimal? @db.Decimal(32, 12)
|
||
liquidityShock Decimal? @db.Decimal(32, 12)
|
||
sovereignStabilityIndex Decimal? @db.Decimal(32, 12)
|
||
impactScore Decimal @db.Decimal(32, 12)
|
||
impactType String // fx_impact, cbdc_impact, ssu_impact, combined
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
simulation AfcssSimulation @relation(fields: [simulationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([impactId])
|
||
@@index([simulationId])
|
||
@@index([impactType])
|
||
@@map("fx_cbdc_ssu_impacts")
|
||
}
|
||
|
||
model MultiAssetContagionRisk {
|
||
id String @id @default(uuid())
|
||
riskId String @unique
|
||
simulationId String
|
||
sourceAsset String // cbdc, fiat, commodity, security, ssu
|
||
targetAsset String
|
||
contagionScore Decimal @db.Decimal(32, 12) // 0-100 scale
|
||
riskFactors Json?
|
||
severity String // low, medium, high, critical
|
||
assessedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
simulation AfcssSimulation @relation(fields: [simulationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([riskId])
|
||
@@index([simulationId])
|
||
@@index([sourceAsset, targetAsset])
|
||
@@index([severity])
|
||
@@map("multi_asset_contagion_risks")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VIII: Supra-Sovereign Threat Matrix (SSTM)
|
||
// ============================================================================
|
||
|
||
model SupraSovereignThreat {
|
||
id String @id @default(uuid())
|
||
threatId String @unique
|
||
threatCategory String // T1 (Technical), T2 (Financial), T3 (Coordination)
|
||
threatType String // pq_key_extraction, smart_contract_infiltration, fx_destabilization, cbdc_bank_run, state_linked_warfare, insider_collusion
|
||
severity String // low, medium, high, critical
|
||
affectedBanks Json? // Array of affected SCB IDs
|
||
coordinationLevel String? // single_scb, multi_scb, supra_sovereign
|
||
description String @db.Text
|
||
detectedAt DateTime @default(now())
|
||
status String @default("detected") // detected, mitigated, resolved
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
patterns CoordinatedThreatPattern[]
|
||
mitigations ThreatMitigation[]
|
||
|
||
@@index([threatId])
|
||
@@index([threatCategory])
|
||
@@index([threatType])
|
||
@@index([severity])
|
||
@@index([status])
|
||
@@map("supra_sovereign_threats")
|
||
}
|
||
|
||
model CoordinatedThreatPattern {
|
||
id String @id @default(uuid())
|
||
patternId String @unique
|
||
threatId String
|
||
patternType String // multi_scb_attack, synthetic_asset_manipulation, rogue_ai_economic_actor
|
||
affectedBanks Json // Array of SCB IDs
|
||
attackVector String?
|
||
patternSignature Json? // Pattern signature for detection
|
||
detectedAt DateTime @default(now())
|
||
status String @default("detected") // detected, analyzed, mitigated
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
threat SupraSovereignThreat @relation(fields: [threatId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([patternId])
|
||
@@index([threatId])
|
||
@@index([patternType])
|
||
@@index([status])
|
||
@@map("coordinated_threat_patterns")
|
||
}
|
||
|
||
model ThreatMitigation {
|
||
id String @id @default(uuid())
|
||
mitigationId String @unique
|
||
threatId String?
|
||
incidentId String?
|
||
mitigationType String // dcdc_response, quarantine, ledger_freeze, multi_scb_coordination
|
||
action String @db.Text
|
||
affectedEntities Json? // Affected nodes, banks, assets
|
||
status String @default("pending") // pending, executing, completed, failed
|
||
initiatedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
threat SupraSovereignThreat? @relation(fields: [threatId], references: [id])
|
||
incident CyberThreatIncident? @relation(fields: [incidentId], references: [id])
|
||
|
||
@@index([mitigationId])
|
||
@@index([threatId])
|
||
@@index([incidentId])
|
||
@@index([mitigationType])
|
||
@@index([status])
|
||
@@map("threat_mitigations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: Global Payments Network (GPN)
|
||
// ============================================================================
|
||
|
||
model GpnPayment {
|
||
id String @id @default(uuid())
|
||
paymentId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // fiat, cbdc, commodity, security, ssu
|
||
paymentType String // person_to_person, bank_to_bank, scb_to_scb, commodity_backed, security_linked, cross_chain
|
||
routeId String?
|
||
layer1Status String @default("pending") // pending, authenticated, rejected
|
||
layer2Status String @default("pending") // pending, routed, rejected
|
||
layer3Status String @default("pending") // pending, settled, failed
|
||
hashLock String? // Hash-lock for finality
|
||
scbLedgerHash String? // SCB ledger hash
|
||
dbisLedgerHash String? // DBIS Master Ledger hash
|
||
isoMessageId String? // ISO 20022 message reference
|
||
smeEnvelope Json? // Sovereign Message Envelope
|
||
status String @default("pending") // pending, processing, settled, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
route GpnRoute? @relation(fields: [routeId], references: [id])
|
||
settlementLocks GpnSettlementLock[]
|
||
|
||
@@index([paymentId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([routeId])
|
||
@@index([status])
|
||
@@index([hashLock])
|
||
@@map("gpn_payments")
|
||
}
|
||
|
||
model GpnRoute {
|
||
id String @id @default(uuid())
|
||
routeId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
currencyCode String
|
||
routePath Json // Array of intermediate nodes
|
||
fxCost Decimal @db.Decimal(32, 12)
|
||
liquidityScore Decimal @db.Decimal(32, 8)
|
||
sriWeight Decimal @db.Decimal(32, 8)
|
||
totalCost Decimal @db.Decimal(32, 12)
|
||
status String @default("active") // active, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
payments GpnPayment[]
|
||
|
||
@@index([routeId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@map("gpn_routes")
|
||
}
|
||
|
||
model GpnSettlementLock {
|
||
id String @id @default(uuid())
|
||
lockId String @unique
|
||
paymentId String
|
||
hashLock String // Hash-lock value
|
||
scbLedgerHash String? // SCB ledger hash
|
||
dbisLedgerHash String? // DBIS Master Ledger hash
|
||
lockStatus String @default("pending") // pending, matched, expired
|
||
matchedAt DateTime?
|
||
expiresAt DateTime
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
payment GpnPayment @relation(fields: [paymentId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([lockId])
|
||
@@index([paymentId])
|
||
@@index([hashLock])
|
||
@@index([lockStatus])
|
||
@@map("gpn_settlement_locks")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: Multi-Asset RTGS System (M-RTGS)
|
||
// ============================================================================
|
||
|
||
model MrtgsQueue {
|
||
id String @id @default(uuid())
|
||
queueId String @unique
|
||
paymentId String
|
||
priorityTier Int // 1 = Sovereign & systemic, 2 = Interbank, 3 = Retail CBDC
|
||
priorityScore Decimal @db.Decimal(32, 12) // systemic_value + fx_cost_penalty + liquidity_weight + SRI_adjustment
|
||
assetType String // fiat, cbdc, ssu, commodity, security
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
sourceBankId String
|
||
destinationBankId String
|
||
queuePosition Int
|
||
status String @default("queued") // queued, processing, settled, failed
|
||
queuedAt DateTime @default(now())
|
||
processedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement MrtgsSettlement?
|
||
|
||
@@index([queueId])
|
||
@@index([paymentId])
|
||
@@index([priorityTier])
|
||
@@index([priorityScore])
|
||
@@index([status])
|
||
@@index([queuedAt])
|
||
@@map("mrtgs_queues")
|
||
}
|
||
|
||
model MrtgsSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
queueId String @unique
|
||
paymentId String
|
||
assetType String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
sourceBankId String
|
||
destinationBankId String
|
||
settlementTime Int // Milliseconds
|
||
ledgerSyncStatus Json // Multi-ledger synchronization status
|
||
status String @default("pending") // pending, settled, failed
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
queue MrtgsQueue @relation(fields: [queueId], references: [id], onDelete: Cascade)
|
||
riskAlerts MrtgsRiskAlert[]
|
||
|
||
@@index([settlementId])
|
||
@@index([queueId])
|
||
@@index([paymentId])
|
||
@@index([status])
|
||
@@map("mrtgs_settlements")
|
||
}
|
||
|
||
model MrtgsRiskAlert {
|
||
id String @id @default(uuid())
|
||
alertId String @unique
|
||
settlementId String
|
||
alertType String // velocity, liquidity_congestion, fx_slip, commodity_shock, cbdc_routing_anomaly
|
||
severity String // low, medium, high, critical
|
||
description String @db.Text
|
||
metrics Json // Alert metrics
|
||
status String @default("active") // active, resolved, acknowledged
|
||
createdAt DateTime @default(now())
|
||
resolvedAt DateTime?
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement MrtgsSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([alertId])
|
||
@@index([settlementId])
|
||
@@index([alertType])
|
||
@@index([severity])
|
||
@@index([status])
|
||
@@map("mrtgs_risk_alerts")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: Sovereign Cloud Infrastructure (SCI)
|
||
// ============================================================================
|
||
|
||
model SovereignComputeZone {
|
||
id String @id @default(uuid())
|
||
zoneId String @unique
|
||
sovereignBankId String
|
||
zoneName String
|
||
zoneType String // primary, replica, backup
|
||
region String
|
||
zeroTrustConfig Json // Zero-trust isolation configuration
|
||
pqHsmConfig Json? // PQ-HSM configuration
|
||
status String @default("active") // active, suspended, decommissioned
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
replications SovereignReplication[]
|
||
contracts SevmContract[]
|
||
attestations SovereignAttestation[]
|
||
|
||
@@index([zoneId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("sovereign_compute_zones")
|
||
}
|
||
|
||
model SovereignReplication {
|
||
id String @id @default(uuid())
|
||
replicationId String @unique
|
||
zoneId String
|
||
targetZoneId String
|
||
replicationType String // metadata, full, incremental
|
||
metadataHash String // Hash of metadata (updated every 30s)
|
||
lastHashTime DateTime
|
||
status String @default("active") // active, paused, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
zone SovereignComputeZone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([replicationId])
|
||
@@index([zoneId])
|
||
@@index([targetZoneId])
|
||
@@index([status])
|
||
@@map("sovereign_replications")
|
||
}
|
||
|
||
model SevmContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
zoneId String
|
||
contractType String // cbdc_workflow, fx_swap, commodity_redemption, settlement_contract
|
||
contractAddress String // SEVM contract address
|
||
contractCode String @db.Text // Smart contract code
|
||
contractHash String // Hash of contract code
|
||
deployerBankId String
|
||
status String @default("pending") // pending, deployed, active, suspended
|
||
deployedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
zone SovereignComputeZone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([contractId])
|
||
@@index([zoneId])
|
||
@@index([contractType])
|
||
@@index([contractAddress])
|
||
@@index([status])
|
||
@@map("sevm_contracts")
|
||
}
|
||
|
||
model SovereignAttestation {
|
||
id String @id @default(uuid())
|
||
attestationId String @unique
|
||
zoneId String
|
||
attestationType String // tpm_integrity, pq_encryption, cross_zone_firewall, continuous_integrity
|
||
attestationData Json // Attestation evidence
|
||
integrityHash String // Integrity verification hash
|
||
status String @default("pending") // pending, verified, failed
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
zone SovereignComputeZone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([attestationId])
|
||
@@index([zoneId])
|
||
@@index([attestationType])
|
||
@@index([status])
|
||
@@map("sovereign_attestations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: ZK-CBDC Validation Framework
|
||
// ============================================================================
|
||
|
||
model ZkProof {
|
||
id String @id @default(uuid())
|
||
proofId String @unique
|
||
walletId String
|
||
proofType String // zkBP (balance), zkCP (compliance), zkIP (identity)
|
||
proofData String @db.Text // ZK proof data
|
||
publicInputs Json // Public inputs for verification
|
||
verificationKey String // Verification key reference
|
||
status String @default("pending") // pending, verified, rejected
|
||
verifiedAt DateTime?
|
||
expiresAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
verifications ZkVerification[]
|
||
|
||
@@index([proofId])
|
||
@@index([walletId])
|
||
@@index([proofType])
|
||
@@index([status])
|
||
@@map("zk_proofs")
|
||
}
|
||
|
||
model ZkVerification {
|
||
id String @id @default(uuid())
|
||
verificationId String @unique
|
||
proofId String
|
||
contractId String? // Smart contract reference
|
||
verificationType String // balance_check, compliance_check, identity_check, combined
|
||
zkbpResult Boolean? // ZK-Balance Proof result
|
||
zkcpResult Boolean? // ZK-Compliance Proof result
|
||
zkipResult Boolean? // ZK-Identity Proof result
|
||
overallResult Boolean // Combined: zkBP && zkCP && zkIP
|
||
status String @default("pending") // pending, verified, rejected
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
proof ZkProof @relation(fields: [proofId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([verificationId])
|
||
@@index([proofId])
|
||
@@index([contractId])
|
||
@@index([verificationType])
|
||
@@index([status])
|
||
@@map("zk_verifications")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: Autonomous Regulatory Intelligence (ARI)
|
||
// ============================================================================
|
||
|
||
model AriPolicy {
|
||
id String @id @default(uuid())
|
||
policyId String @unique
|
||
policyType String // aml, fx_risk, liquidity, sanctions, settlement
|
||
policyName String
|
||
policyRules Json // Policy rules and conditions
|
||
layer String // cortex, reflex, execution
|
||
status String @default("active") // active, suspended, archived
|
||
effectiveDate DateTime
|
||
expiryDate DateTime?
|
||
createdBy String @default("ari") // ari, msc, caa
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
decisions AriDecision[]
|
||
updates AriPolicyUpdate[]
|
||
|
||
@@index([policyId])
|
||
@@index([policyType])
|
||
@@index([layer])
|
||
@@index([status])
|
||
@@map("ari_policies")
|
||
}
|
||
|
||
model AriDecision {
|
||
id String @id @default(uuid())
|
||
decisionId String @unique
|
||
policyId String?
|
||
decisionType String // policy_update, fx_band_adjustment, liquidity_limit_change, aml_rule_update, sanctions_update
|
||
targetSystem String // gpn, m_rtgs, alps, gase, fx_engine
|
||
decisionData Json // Decision parameters and actions
|
||
triggerCondition String @db.Text // Condition that triggered decision (e.g., "SARE.FXSP > 0.35")
|
||
status String @default("pending") // pending, applied, rejected, overridden
|
||
appliedAt DateTime?
|
||
reviewedBy String? // MSC or CAA reviewer
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
policy AriPolicy? @relation(fields: [policyId], references: [id])
|
||
|
||
@@index([decisionId])
|
||
@@index([policyId])
|
||
@@index([decisionType])
|
||
@@index([targetSystem])
|
||
@@index([status])
|
||
@@map("ari_decisions")
|
||
}
|
||
|
||
model AriPolicyUpdate {
|
||
id String @id @default(uuid())
|
||
updateId String @unique
|
||
policyId String
|
||
updateType String // creation, modification, suspension, reactivation
|
||
previousRules Json? // Previous policy rules
|
||
newRules Json // New policy rules
|
||
reason String @db.Text
|
||
updatedBy String @default("ari") // ari, msc, caa
|
||
reviewWindow DateTime? // MSC review window
|
||
caaOverride Boolean @default(false)
|
||
status String @default("pending") // pending, approved, rejected
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
policy AriPolicy @relation(fields: [policyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([updateId])
|
||
@@index([policyId])
|
||
@@index([updateType])
|
||
@@index([status])
|
||
@@map("ari_policy_updates")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: Cross-Border Algorithmic Settlement Optimizer (CASO)
|
||
// ============================================================================
|
||
|
||
model CasoRoute {
|
||
id String @id @default(uuid())
|
||
routeId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
currencyCode String
|
||
assetType String
|
||
fxCost Decimal @db.Decimal(32, 12)
|
||
liquidityPenalty Decimal @db.Decimal(32, 12)
|
||
volatilityRisk Decimal @db.Decimal(32, 12)
|
||
sriFactor Decimal @db.Decimal(32, 12)
|
||
ssuCost Decimal @db.Decimal(32, 12)
|
||
totalCost Decimal @db.Decimal(32, 12) // argmin result
|
||
routePath Json // Optimized route path
|
||
status String @default("active") // active, applied, expired
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
optimizations CasoOptimization[]
|
||
|
||
@@index([routeId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@map("caso_routes")
|
||
}
|
||
|
||
model CasoOptimization {
|
||
id String @id @default(uuid())
|
||
optimizationId String @unique
|
||
routeId String
|
||
optimizationType String // gpn_routing, m_rtgs_queueing, sire_integration, alps_liquidity
|
||
inputParameters Json // Input parameters for optimization
|
||
optimizationResult Json // Optimization result data
|
||
status String @default("pending") // pending, applied, rejected
|
||
calculatedAt DateTime @default(now())
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
route CasoRoute @relation(fields: [routeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([optimizationId])
|
||
@@index([routeId])
|
||
@@index([optimizationType])
|
||
@@index([status])
|
||
@@map("caso_optimizations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume VII: Decentralized Sovereign Compliance Nodes (DSCN)
|
||
// ============================================================================
|
||
|
||
model DscnNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
sovereignBankId String?
|
||
privateBankId String?
|
||
nodeType String // scb, private_bank, regulated_institution
|
||
nodeName String
|
||
nodeAddress String // Network address
|
||
registrationStatus String @default("pending") // pending, approved, active, suspended
|
||
approvedAt DateTime?
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
complianceResults DscnComplianceResult[]
|
||
syncRecords DscnSyncRecord[]
|
||
|
||
@@index([nodeId])
|
||
@@index([sovereignBankId])
|
||
@@index([privateBankId])
|
||
@@index([nodeType])
|
||
@@index([status])
|
||
@@map("dscn_nodes")
|
||
}
|
||
|
||
model DscnComplianceResult {
|
||
id String @id @default(uuid())
|
||
resultId String @unique
|
||
nodeId String
|
||
complianceType String // aml_scan, sanctions_check, identity_verification
|
||
entityId String // Entity being checked
|
||
entityType String // wallet, account, transaction
|
||
scanResult String // pass, fail, review_required
|
||
riskScore Decimal? @db.Decimal(32, 8)
|
||
details Json // Detailed compliance results
|
||
status String @default("pending") // pending, synced, failed
|
||
syncedToDbis Boolean @default(false)
|
||
syncedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node DscnNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([resultId])
|
||
@@index([nodeId])
|
||
@@index([complianceType])
|
||
@@index([entityId])
|
||
@@index([scanResult])
|
||
@@index([status])
|
||
@@map("dscn_compliance_results")
|
||
}
|
||
|
||
model DscnSyncRecord {
|
||
id String @id @default(uuid())
|
||
syncId String @unique
|
||
nodeId String
|
||
syncType String // compliance_result, ledger_state, identity_update
|
||
syncData Json // Data being synchronized
|
||
dbisLedgerHash String? // DBIS Master Ledger hash after sync
|
||
syncStatus String @default("pending") // pending, synced, failed
|
||
syncedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node DscnNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([syncId])
|
||
@@index([nodeId])
|
||
@@index([syncType])
|
||
@@index([syncStatus])
|
||
@@map("dscn_sync_records")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IX: Global Synthetic Derivatives System (GSDS)
|
||
// ============================================================================
|
||
|
||
model SyntheticDerivative {
|
||
id String @id @default(uuid())
|
||
derivativeId String @unique
|
||
derivativeType String // synthetic_currency, multi_asset, synthetic_credit, behavioral
|
||
party1BankId String
|
||
party2BankId String?
|
||
underlyingAsset String // SSU, CBDC, commodity, security, fiat, fx
|
||
notionalAmount Decimal @db.Decimal(32, 8)
|
||
contractTerms Json // Contract terms and parameters
|
||
smartContractId String? // Reference to smart contract
|
||
status String @default("active") // active, expired, terminated, settled, auto_closed
|
||
initiatedAt DateTime @default(now())
|
||
maturityDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pricing GsdsPricingEngine[]
|
||
collaterals SyntheticDerivativeCollateral[]
|
||
settlements SyntheticDerivativeSettlement[]
|
||
|
||
@@index([derivativeId])
|
||
@@index([derivativeType])
|
||
@@index([party1BankId])
|
||
@@index([party2BankId])
|
||
@@index([status])
|
||
@@map("synthetic_derivatives")
|
||
}
|
||
|
||
model GsdsPricingEngine {
|
||
id String @id @default(uuid())
|
||
pricingId String @unique
|
||
derivativeId String
|
||
baseValue Decimal @db.Decimal(32, 12)
|
||
volatilityFactor Decimal @db.Decimal(32, 12)
|
||
collateralRatio Decimal @db.Decimal(32, 12)
|
||
liquidityPenalty Decimal @db.Decimal(32, 12)
|
||
sriAdjustment Decimal @db.Decimal(32, 12)
|
||
syntheticPrice Decimal @db.Decimal(32, 12) // Calculated: base_value + volatility_factor + collateral_ratio - liquidity_penalty + SRI_adjustment
|
||
pricingSource String // gql_state, msc_parameters, ai_liquidity_estimator
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
derivative SyntheticDerivative @relation(fields: [derivativeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([pricingId])
|
||
@@index([derivativeId])
|
||
@@index([calculatedAt])
|
||
@@map("gsds_pricing_engine")
|
||
}
|
||
|
||
model SyntheticDerivativeCollateral {
|
||
id String @id @default(uuid())
|
||
collateralId String @unique
|
||
derivativeId String
|
||
assetType String // cbdc, ssu, commodity, security, fiat
|
||
assetId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
valuation Decimal @db.Decimal(32, 12)
|
||
marginRequirement Decimal @db.Decimal(32, 12)
|
||
status String @default("active") // active, released, liquidated
|
||
allocatedAt DateTime @default(now())
|
||
releasedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
derivative SyntheticDerivative @relation(fields: [derivativeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([collateralId])
|
||
@@index([derivativeId])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("synthetic_derivative_collaterals")
|
||
}
|
||
|
||
model SyntheticDerivativeSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
derivativeId String
|
||
settlementAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // fiat, cbdc, commodity, security, ssu
|
||
hashLock String? // Hash-lock for finality
|
||
sovereignLedgerHash String?
|
||
dbisLedgerHash String?
|
||
dualLedgerCommit Boolean @default(false)
|
||
status String @default("pending") // pending, committed, settled, final
|
||
committedAt DateTime?
|
||
settledAt DateTime?
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
derivative SyntheticDerivative @relation(fields: [derivativeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([derivativeId])
|
||
@@index([hashLock])
|
||
@@index([status])
|
||
@@map("synthetic_derivative_settlements")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IX: Interplanetary Settlement Pathways (ISP)
|
||
// ============================================================================
|
||
|
||
model InterplanetaryNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
planetaryLocation String // earth, lunar, martian
|
||
sovereignBankId String?
|
||
nodeType String // scb, sovereign_authority, economic_council
|
||
nodeName String
|
||
nodeAddress String // Network address
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
relayGrid InterplanetaryRelayGrid[]
|
||
settlements InterplanetarySettlement[]
|
||
issuances InterplanetarySSU[]
|
||
cbdcIssuances InterplanetaryCBDC[]
|
||
|
||
@@index([nodeId])
|
||
@@index([planetaryLocation])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("interplanetary_nodes")
|
||
}
|
||
|
||
model InterplanetaryRelayGrid {
|
||
id String @id @default(uuid())
|
||
relayId String @unique
|
||
sourceNodeId String
|
||
targetNodeId String
|
||
relayType String // deep_space_relay, sovereign_relay
|
||
messageType String // settlement, cbdc_issuance, state_sync
|
||
messagePayload Json // PQC-light messaging payload
|
||
pqcSignature String? // Post-quantum cryptography signature
|
||
latency Int? // Estimated latency in seconds
|
||
highLatencyBuffer Boolean @default(false) // High-latency settlement buffer
|
||
status String @default("pending") // pending, relayed, delivered, failed
|
||
relayedAt DateTime?
|
||
deliveredAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sourceNode InterplanetaryNode @relation("SourceNode", fields: [sourceNodeId], references: [id], onDelete: Cascade)
|
||
targetNode InterplanetaryNode @relation("TargetNode", fields: [targetNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([relayId])
|
||
@@index([sourceNodeId])
|
||
@@index([targetNodeId])
|
||
@@index([status])
|
||
@@map("interplanetary_relay_grid")
|
||
}
|
||
|
||
model InterplanetarySettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
sourceNodeId String
|
||
targetNodeId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // cbdc, ssu, fiat, commodity
|
||
settlementType String // direct, relayed, temporal
|
||
hashLock String? // Hash-lock for finality
|
||
status String @default("pending") // pending, committed, settled, final
|
||
committedAt DateTime?
|
||
settledAt DateTime?
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sourceNode InterplanetaryNode @relation("SourceSettlement", fields: [sourceNodeId], references: [id], onDelete: Cascade)
|
||
targetNode InterplanetaryNode @relation("TargetSettlement", fields: [targetNodeId], references: [id], onDelete: Cascade)
|
||
temporalEngine TemporalSettlementEngine?
|
||
|
||
@@index([settlementId])
|
||
@@index([sourceNodeId])
|
||
@@index([targetNodeId])
|
||
@@index([status])
|
||
@@map("interplanetary_settlements")
|
||
}
|
||
|
||
model TemporalSettlementEngine {
|
||
id String @id @default(uuid())
|
||
tseId String @unique
|
||
settlementId String @unique
|
||
futureStateEstimate Json // Predictive state estimate
|
||
preCommitHash String // HASH(future_state_estimate)
|
||
communicationDelay Int // Delay in seconds
|
||
predictiveContract Json? // Predictive contract terms
|
||
status String @default("pending") // pending, committed, verified, settled
|
||
committedAt DateTime?
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement InterplanetarySettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([tseId])
|
||
@@index([settlementId])
|
||
@@index([preCommitHash])
|
||
@@index([status])
|
||
@@map("temporal_settlement_engine")
|
||
}
|
||
|
||
model InterplanetarySSU {
|
||
id String @id @default(uuid())
|
||
issuId String @unique
|
||
nodeId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
gravityAdjustment Decimal? @db.Decimal(32, 12) // Gravity-adjusted economic valuation
|
||
radiationEnvelope String? // Radiation-hardened cryptographic envelope
|
||
status String @default("active") // active, redeemed, expired
|
||
issuedAt DateTime @default(now())
|
||
redeemedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node InterplanetaryNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([issuId])
|
||
@@index([nodeId])
|
||
@@index([status])
|
||
@@map("interplanetary_ssu")
|
||
}
|
||
|
||
model InterplanetaryCBDC {
|
||
id String @id @default(uuid())
|
||
icbdcId String @unique
|
||
nodeId String
|
||
currencyCode String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
issuanceType String // mars_issuance, lunar_issuance
|
||
sovereignAutonomy Boolean @default(true) // Sovereign autonomy flag
|
||
dualLedgerFinality Boolean @default(false) // Dual-ledger finality respecting DBIS authority
|
||
status String @default("active") // active, redeemed, expired
|
||
issuedAt DateTime @default(now())
|
||
redeemedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node InterplanetaryNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([icbdcId])
|
||
@@index([nodeId])
|
||
@@index([currencyCode])
|
||
@@index([status])
|
||
@@map("interplanetary_cbdc")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IX: Behavioral Economics & Incentive Engine (BEIE)
|
||
// ============================================================================
|
||
|
||
model BehavioralMetric {
|
||
id String @id @default(uuid())
|
||
metricId String @unique
|
||
entityId String // User, institution, or sovereign ID
|
||
entityType String // retail_cbdc_user, institution, sovereign_liquidity_actor
|
||
metricType String // ccv, ilb, srp
|
||
metricValue Decimal @db.Decimal(32, 12)
|
||
metricData Json? // Additional metric data
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([metricId])
|
||
@@index([entityId])
|
||
@@index([entityType])
|
||
@@index([metricType])
|
||
@@index([calculatedAt])
|
||
@@map("behavioral_metrics")
|
||
}
|
||
|
||
model BehavioralIncentive {
|
||
id String @id @default(uuid())
|
||
incentiveId String @unique
|
||
entityId String
|
||
entityType String // retail_cbdc_user, institution, sovereign
|
||
incentiveType String // cbdc_micro_reward, ssu_fee_adjustment
|
||
incentiveAmount Decimal @db.Decimal(32, 8)
|
||
incentiveReason String // stabilizing_behavior, low_risk_flow
|
||
status String @default("pending") // pending, applied, expired
|
||
appliedAt DateTime?
|
||
expiresAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([incentiveId])
|
||
@@index([entityId])
|
||
@@index([entityType])
|
||
@@index([incentiveType])
|
||
@@index([status])
|
||
@@map("behavioral_incentives")
|
||
}
|
||
|
||
model BehavioralPenalty {
|
||
id String @id @default(uuid())
|
||
penaltyId String @unique
|
||
entityId String
|
||
entityType String // retail_cbdc_user, institution, sovereign
|
||
penaltyType String // liquidity_penalty, fee_increase, access_restriction
|
||
penaltyAmount Decimal? @db.Decimal(32, 8)
|
||
penaltyReason String // risky_behavior_detected, srp_risk_threshold_exceeded
|
||
riskScore Decimal @db.Decimal(32, 12) // SRP_risk or other risk metric
|
||
threshold Decimal @db.Decimal(32, 12) // Threshold that triggered penalty
|
||
predictiveContract Json? // Predictive penalty contract
|
||
status String @default("pending") // pending, applied, resolved
|
||
appliedAt DateTime?
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([penaltyId])
|
||
@@index([entityId])
|
||
@@index([entityType])
|
||
@@index([penaltyType])
|
||
@@index([status])
|
||
@@map("behavioral_penalties")
|
||
}
|
||
|
||
model BehavioralProfile {
|
||
id String @id @default(uuid())
|
||
profileId String @unique
|
||
entityId String
|
||
entityType String // retail_cbdc_user, institution, sovereign
|
||
ccvScore Decimal? @db.Decimal(32, 12) // Consumer CBDC Velocity
|
||
ilbScore Decimal? @db.Decimal(32, 12) // Institutional Liquidity Behavior
|
||
srpScore Decimal? @db.Decimal(32, 12) // Sovereign Reaction Profile
|
||
behaviorPattern Json? // Behavioral pattern data
|
||
riskLevel String @default("low") // low, medium, high, critical
|
||
status String @default("active") // active, suspended, archived
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([profileId])
|
||
@@index([entityId])
|
||
@@index([entityType])
|
||
@@index([riskLevel])
|
||
@@index([status])
|
||
@@map("behavioral_profiles")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IX: Supra-National Funds Network (SNFN)
|
||
// ============================================================================
|
||
|
||
model SupraFundNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
nodeType String // sfn, dfn, csn
|
||
nodeName String
|
||
fundType String // sovereign_wealth_fund, supranational_institution, development_fund, stabilization_pool
|
||
totalAssets Decimal @db.Decimal(32, 8)
|
||
availableLiquidity Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
loans SupraFundLoan[]
|
||
settlements SupraFundSettlement[]
|
||
|
||
@@index([nodeId])
|
||
@@index([nodeType])
|
||
@@index([fundType])
|
||
@@index([status])
|
||
@@map("supra_fund_nodes")
|
||
}
|
||
|
||
model DevelopmentFundNode {
|
||
id String @id @default(uuid())
|
||
dfnId String @unique
|
||
nodeId String
|
||
directLendingCap Decimal @db.Decimal(32, 8)
|
||
commodityBackedLoans Boolean @default(true)
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node SupraFundNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([dfnId])
|
||
@@index([nodeId])
|
||
@@index([status])
|
||
@@map("development_fund_nodes")
|
||
}
|
||
|
||
model CrisisStabilizationNode {
|
||
id String @id @default(uuid())
|
||
csnId String @unique
|
||
nodeId String
|
||
triggerCondition String // sri_critical, fx_collapse, commodity_shock
|
||
triggerThreshold Decimal @db.Decimal(32, 12)
|
||
stabilizationCap Decimal @db.Decimal(32, 8)
|
||
status String @default("standby") // standby, activated, deactivated
|
||
activatedAt DateTime?
|
||
deactivatedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node SupraFundNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([csnId])
|
||
@@index([nodeId])
|
||
@@index([triggerCondition])
|
||
@@index([status])
|
||
@@map("crisis_stabilization_nodes")
|
||
}
|
||
|
||
model SupraFundLoan {
|
||
id String @id @default(uuid())
|
||
loanId String @unique
|
||
nodeId String
|
||
borrowerBankId String
|
||
loanAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
sriFactor Decimal @db.Decimal(32, 12)
|
||
reserveStrength Decimal @db.Decimal(32, 12)
|
||
fxExposure Decimal @db.Decimal(32, 12)
|
||
liquidityShortfall Decimal @db.Decimal(32, 12)
|
||
loanEligibility Decimal @db.Decimal(32, 12) // Calculated: SRI_factor + reserve_strength + FX_exposure + liquidity_shortfall
|
||
interestRate Decimal? @db.Decimal(32, 12)
|
||
maturityDate DateTime?
|
||
status String @default("pending") // pending, approved, disbursed, repaid, defaulted
|
||
approvedAt DateTime?
|
||
disbursedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node SupraFundNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([loanId])
|
||
@@index([nodeId])
|
||
@@index([borrowerBankId])
|
||
@@index([status])
|
||
@@map("supra_fund_loans")
|
||
}
|
||
|
||
model SupraFundSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
nodeId String
|
||
loanId String?
|
||
disbursementType String // cbdc, ssu, commodity_token, tokenized_bond
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetId String? // Asset ID if tokenized
|
||
status String @default("pending") // pending, disbursed, settled
|
||
disbursedAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node SupraFundNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([nodeId])
|
||
@@index([loanId])
|
||
@@index([status])
|
||
@@map("supra_fund_settlements")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IX: Multi-Reality Ledger Interfaces (MRLI)
|
||
// ============================================================================
|
||
|
||
model MultiRealityLedger {
|
||
id String @id @default(uuid())
|
||
ledgerId String @unique
|
||
ledgerName String
|
||
ledgerType String // classical, distributed, quantum, simulation
|
||
mergedState Json? // MERGE(classical_state, dlt_state, quantum_state, simulated_state)
|
||
status String @default("active") // active, syncing, conflict, resolved
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
interfaces ClassicalInterface[]
|
||
dltInterfaces DistributedLedgerInterface[]
|
||
quantumInterfaces QuantumLedgerInterface[]
|
||
simInterfaces SimulationInterface[]
|
||
synchronizations MRLISynchronization[]
|
||
|
||
@@index([ledgerId])
|
||
@@index([ledgerType])
|
||
@@index([status])
|
||
@@map("multi_reality_ledgers")
|
||
}
|
||
|
||
model ClassicalInterface {
|
||
id String @id @default(uuid())
|
||
interfaceId String @unique
|
||
ledgerId String
|
||
connectionType String // sql, nosql, dbms
|
||
connectionString String // Connection details
|
||
stateSnapshot Json? // Classical state snapshot
|
||
status String @default("active") // active, disconnected, error
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger MultiRealityLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([interfaceId])
|
||
@@index([ledgerId])
|
||
@@index([status])
|
||
@@map("classical_interfaces")
|
||
}
|
||
|
||
model DistributedLedgerInterface {
|
||
id String @id @default(uuid())
|
||
interfaceId String @unique
|
||
ledgerId String
|
||
ledgerType String // tokenized_asset, security_token_platform
|
||
chainId String?
|
||
stateSnapshot Json? // DLT state snapshot
|
||
status String @default("active") // active, disconnected, error
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger MultiRealityLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([interfaceId])
|
||
@@index([ledgerId])
|
||
@@index([status])
|
||
@@map("distributed_ledger_interfaces")
|
||
}
|
||
|
||
model QuantumLedgerInterface {
|
||
id String @id @default(uuid())
|
||
interfaceId String @unique
|
||
ledgerId String
|
||
gqlStateAccess Boolean @default(true) // GQL state access
|
||
entanglementSnapshot Json? // Entanglement-based snapshots
|
||
status String @default("active") // active, disconnected, error
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger MultiRealityLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([interfaceId])
|
||
@@index([ledgerId])
|
||
@@index([status])
|
||
@@map("quantum_ledger_interfaces")
|
||
}
|
||
|
||
model SimulationInterface {
|
||
id String @id @default(uuid())
|
||
interfaceId String @unique
|
||
ledgerId String
|
||
simulationType String // ai_economic_simulation, hypothetical_ledger_state
|
||
simulationState Json? // Simulated ledger state
|
||
status String @default("active") // active, disconnected, error
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger MultiRealityLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([interfaceId])
|
||
@@index([ledgerId])
|
||
@@index([status])
|
||
@@map("simulation_interfaces")
|
||
}
|
||
|
||
model MRLISynchronization {
|
||
id String @id @default(uuid())
|
||
syncId String @unique
|
||
ledgerId String
|
||
classicalState Json?
|
||
dltState Json?
|
||
quantumState Json?
|
||
simulatedState Json?
|
||
mergedState Json // MERGE result
|
||
conflictDetected Boolean @default(false)
|
||
conflictResolution Json? // Conflict resolution using sovereign trust graph
|
||
resolutionMethod String? // sovereign_trust_graph, dbis_arbitration
|
||
status String @default("pending") // pending, merged, conflict, resolved
|
||
syncedAt DateTime?
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger MultiRealityLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([syncId])
|
||
@@index([ledgerId])
|
||
@@index([status])
|
||
@@map("mrli_synchronizations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume IX: Advanced Sovereign Simulation Stack (ASSS)
|
||
// ============================================================================
|
||
|
||
model SovereignSimulation {
|
||
id String @id @default(uuid())
|
||
simulationId String @unique
|
||
simulationName String
|
||
simulationType String // stress_test, policy_design, fx_band_calibration
|
||
status String @default("running") // running, completed, failed, cancelled
|
||
startedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
layers SimulationLayer[]
|
||
outcomes SimulationOutcome[]
|
||
scenario SimulationScenario?
|
||
|
||
@@index([simulationId])
|
||
@@index([simulationType])
|
||
@@index([status])
|
||
@@map("sovereign_simulations")
|
||
}
|
||
|
||
model SimulationLayer {
|
||
id String @id @default(uuid())
|
||
layerId String @unique
|
||
simulationId String
|
||
layerType String // macro, sovereign, micro, asset
|
||
layerConfig Json // Layer configuration
|
||
layerData Json? // Layer-specific data
|
||
status String @default("active") // active, completed, error
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
simulation SovereignSimulation @relation(fields: [simulationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([layerId])
|
||
@@index([simulationId])
|
||
@@index([layerType])
|
||
@@index([status])
|
||
@@map("simulation_layers")
|
||
}
|
||
|
||
model SimulationOutcome {
|
||
id String @id @default(uuid())
|
||
outcomeId String @unique
|
||
simulationId String
|
||
outcomeType String // fx_projection, cbdc_impact, ssu_interaction, commodity_cycle, behavior_impact, risk_assessment
|
||
outcomeData Json // Model results: MODEL(FX, CBDC, SSU, commodity, behavior, risk)
|
||
projection Json? // Projected outcomes
|
||
accuracy Decimal? @db.Decimal(32, 12) // Accuracy score if validated
|
||
status String @default("pending") // pending, validated, archived
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
simulation SovereignSimulation @relation(fields: [simulationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([outcomeId])
|
||
@@index([simulationId])
|
||
@@index([outcomeType])
|
||
@@index([status])
|
||
@@map("simulation_outcomes")
|
||
}
|
||
|
||
model SimulationScenario {
|
||
id String @id @default(uuid())
|
||
scenarioId String @unique
|
||
simulationId String @unique
|
||
scenarioName String
|
||
scenarioType String // liquidity_shock, fx_collapse, commodity_depletion, sovereign_default
|
||
scenarioConfig Json // Scenario configuration
|
||
stressLevel String // low, medium, high, extreme
|
||
status String @default("active") // active, completed, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
simulation SovereignSimulation @relation(fields: [simulationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([scenarioId])
|
||
@@index([simulationId])
|
||
@@index([scenarioType])
|
||
@@index([status])
|
||
@@map("simulation_scenarios")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XII: Unified Multiverse Monetary Constitution, Temporal Currency Engines, Interplanetary FX, Infinite-State Reserves, and Omega-Layer Settlement Fabric
|
||
// ============================================================================
|
||
|
||
// ============================================================================
|
||
// Volume XII: Unified Multiverse Monetary Constitution (UMMC)
|
||
// ============================================================================
|
||
|
||
model UmmcConstitutionalPillar {
|
||
id String @id @default(uuid())
|
||
pillarId String @unique
|
||
pillarNumber Int // 1, 2, 3, 4, 5
|
||
pillarName String // Cross-Reality Sovereign Integrity, Temporal Alignment, Quantum Coherence, Holographic Equivalence, Parallel-State Reconciliation
|
||
description String @db.Text
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
clauses UmmcBindingClause[]
|
||
mappings UmmcSovereignMapping[]
|
||
|
||
@@index([pillarId])
|
||
@@index([pillarNumber])
|
||
@@index([status])
|
||
@@map("ummc_constitutional_pillars")
|
||
}
|
||
|
||
model UmmcBindingClause {
|
||
id String @id @default(uuid())
|
||
clauseId String @unique
|
||
clauseCode String // XII-A, XII-F, XII-K
|
||
clauseName String
|
||
description String @db.Text
|
||
pillarId String?
|
||
bindingType String // multiversal_finality, anti_divergence, sovereign_identity_equivalence
|
||
enforcementLevel String // strict, moderate, advisory
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pillar UmmcConstitutionalPillar? @relation(fields: [pillarId], references: [id], onDelete: SetNull)
|
||
validations UmmcClauseValidation[]
|
||
|
||
@@index([clauseId])
|
||
@@index([clauseCode])
|
||
@@index([pillarId])
|
||
@@index([status])
|
||
@@map("ummc_binding_clauses")
|
||
}
|
||
|
||
model UmmcClauseValidation {
|
||
id String @id @default(uuid())
|
||
validationId String @unique
|
||
clauseId String
|
||
sovereignBankId String?
|
||
validationType String // compliance_check, divergence_measure, identity_verification
|
||
validationResult String // compliant, non_compliant, pending
|
||
validationData Json? // Validation details
|
||
validatedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
clause UmmcBindingClause @relation(fields: [clauseId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([validationId])
|
||
@@index([clauseId])
|
||
@@index([sovereignBankId])
|
||
@@index([validationResult])
|
||
@@map("ummc_clause_validations")
|
||
}
|
||
|
||
model UmmcSovereignMapping {
|
||
id String @id @default(uuid())
|
||
mappingId String @unique
|
||
sovereignBankId String
|
||
realityLayer String // classical, distributed, quantum, holographic, parallel
|
||
identityAnchor String // Cross-reality identity anchor
|
||
ledgerAnchor String? // Ledger anchor reference
|
||
settlementAnchor String? // Settlement anchor reference
|
||
divergenceBand Decimal? @db.Decimal(32, 12) // Maximum allowed divergence
|
||
pillarId String?
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
pillar UmmcConstitutionalPillar? @relation(fields: [pillarId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([mappingId])
|
||
@@index([sovereignBankId])
|
||
@@index([realityLayer])
|
||
@@index([status])
|
||
@@map("ummc_sovereign_mappings")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XII: Synthetic Temporal Currency Engine (STCE)
|
||
// ============================================================================
|
||
|
||
model TemporalCurrencyUnit {
|
||
id String @id @default(uuid())
|
||
tcuId String @unique
|
||
tcuCode String @unique // TCU code (e.g., TCU-EARTH, TCU-LUNA)
|
||
tcuName String
|
||
description String @db.Text
|
||
baseCurrency String? // Reference currency for TCU
|
||
presentValue Decimal @db.Decimal(32, 12)
|
||
primeTemporalBond Boolean @default(true) // Bonded to Prime Ledger
|
||
status String @default("active") // active, suspended, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
projections TemporalProjection[]
|
||
stabilityStates TemporalStabilityState[]
|
||
transactions TemporalCurrencyTransaction[]
|
||
|
||
@@index([tcuId])
|
||
@@index([tcuCode])
|
||
@@index([status])
|
||
@@map("temporal_currency_units")
|
||
}
|
||
|
||
model TemporalProjection {
|
||
id String @id @default(uuid())
|
||
projectionId String @unique
|
||
tcuId String
|
||
projectionType String // forward_indexed, retro_correction
|
||
timeDelta Decimal @db.Decimal(32, 12) // Δt in temporal units
|
||
projectedValue Decimal @db.Decimal(32, 12)
|
||
economicData Json? // Economic projection data
|
||
confidence Decimal? @db.Decimal(32, 12) // Confidence score
|
||
projectedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
tcu TemporalCurrencyUnit @relation(fields: [tcuId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([projectionId])
|
||
@@index([tcuId])
|
||
@@index([projectionType])
|
||
@@index([projectedAt])
|
||
@@map("temporal_projections")
|
||
}
|
||
|
||
model TemporalStabilityState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
tcuId String
|
||
presentValue Decimal @db.Decimal(32, 12)
|
||
futureWeight Decimal @db.Decimal(32, 12)
|
||
retroFactor Decimal @db.Decimal(32, 12)
|
||
ssuAnchor Decimal? @db.Decimal(32, 12) // SSU anchor value
|
||
calculatedValue Decimal @db.Decimal(32, 12) // TCU_value from stability equation
|
||
stabilityScore Decimal? @db.Decimal(32, 12) // Stability metric
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
tcu TemporalCurrencyUnit @relation(fields: [tcuId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([stateId])
|
||
@@index([tcuId])
|
||
@@index([calculatedAt])
|
||
@@map("temporal_stability_states")
|
||
}
|
||
|
||
model TemporalCurrencyTransaction {
|
||
id String @id @default(uuid())
|
||
transactionId String @unique
|
||
tcuId String
|
||
sovereignBankId String
|
||
transactionType String // issuance, redemption, transfer, exchange
|
||
amount Decimal @db.Decimal(32, 12)
|
||
valueAtTime Decimal @db.Decimal(32, 12) // Value at transaction time
|
||
timestamp DateTime @default(now())
|
||
status String @default("pending") // pending, executed, settled, failed
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
tcu TemporalCurrencyUnit @relation(fields: [tcuId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([transactionId])
|
||
@@index([tcuId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@index([timestamp])
|
||
@@map("temporal_currency_transactions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XII: Autonomous Interplanetary FX Zone (AIFX)
|
||
// ============================================================================
|
||
|
||
model AifxCorridor {
|
||
id String @id @default(uuid())
|
||
corridorId String @unique
|
||
corridorName String // Earth ↔ Luna, Earth ↔ Mars, Mars ↔ Luna, Interplanetary SSU
|
||
originPlanet String // Earth, Luna, Mars
|
||
destinationPlanet String // Earth, Luna, Mars
|
||
baseCurrency String
|
||
quoteCurrency String
|
||
lagAdjustment Decimal @db.Decimal(32, 12) // Latency adjustment factor
|
||
gravityFactor Decimal @db.Decimal(32, 12) // Gravity-based adjustment
|
||
radiationRiskSpread Decimal @db.Decimal(32, 12) // Volatility spread
|
||
velocityNormalization Decimal @db.Decimal(32, 12) // Planetary velocity normalization
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
trades AifxTrade[]
|
||
pricingStates AifxPricingState[]
|
||
|
||
@@index([corridorId])
|
||
@@index([originPlanet, destinationPlanet])
|
||
@@index([status])
|
||
@@map("aifx_corridors")
|
||
}
|
||
|
||
model AifxTrade {
|
||
id String @id @default(uuid())
|
||
tradeId String @unique
|
||
corridorId String
|
||
sovereignBankId String
|
||
baseCurrency String
|
||
quoteCurrency String
|
||
amount Decimal @db.Decimal(32, 12)
|
||
fxPrice Decimal @db.Decimal(32, 12)
|
||
liquidityWeight Decimal @db.Decimal(32, 12)
|
||
gravityFactor Decimal @db.Decimal(32, 12)
|
||
latencyCost Decimal @db.Decimal(32, 12)
|
||
timeDilationIndex Decimal @db.Decimal(32, 12)
|
||
ssuStability Decimal? @db.Decimal(32, 12)
|
||
settlementMode String // atomic, rtgs, delayed
|
||
status String @default("pending") // pending, executed, settled, failed
|
||
executedAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
corridor AifxCorridor @relation(fields: [corridorId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([tradeId])
|
||
@@index([corridorId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@index([executedAt])
|
||
@@map("aifx_trades")
|
||
}
|
||
|
||
model AifxPricingState {
|
||
id String @id @default(uuid())
|
||
pricingId String @unique
|
||
corridorId String
|
||
fxPrice Decimal @db.Decimal(32, 12)
|
||
liquidityWeight Decimal @db.Decimal(32, 12)
|
||
gravityFactor Decimal @db.Decimal(32, 12)
|
||
latencyCost Decimal @db.Decimal(32, 12)
|
||
timeDilationIndex Decimal @db.Decimal(32, 12)
|
||
ssuStability Decimal? @db.Decimal(32, 12)
|
||
pricingMethod String // nce, caso, hybrid
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
corridor AifxCorridor @relation(fields: [corridorId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([pricingId])
|
||
@@index([corridorId])
|
||
@@index([calculatedAt])
|
||
@@map("aifx_pricing_states")
|
||
}
|
||
|
||
model InterplanetarySsu {
|
||
id String @id @default(uuid())
|
||
issuId String @unique
|
||
issuCode String @unique // iSSU code
|
||
description String @db.Text
|
||
basePlanet String? // Reference planet
|
||
composition Json? // Asset composition
|
||
conversionRate Decimal? @db.Decimal(32, 12)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
transactions InterplanetarySsuTransaction[]
|
||
|
||
@@index([issuId])
|
||
@@index([issuCode])
|
||
@@index([status])
|
||
@@map("interplanetary_ssus")
|
||
}
|
||
|
||
model InterplanetarySsuTransaction {
|
||
id String @id @default(uuid())
|
||
transactionId String @unique
|
||
issuId String
|
||
sovereignBankId String
|
||
amount Decimal @db.Decimal(32, 12)
|
||
originPlanet String
|
||
destinationPlanet String
|
||
settlementMode String
|
||
status String @default("pending")
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
issu InterplanetarySsu @relation(fields: [issuId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([transactionId])
|
||
@@index([issuId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("interplanetary_ssu_transactions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XII: Infinite-State Reserve Model (ISRM)
|
||
// ============================================================================
|
||
|
||
model InfiniteStateReserve {
|
||
id String @id @default(uuid())
|
||
reserveId String @unique
|
||
reserveName String
|
||
classicalReserve Decimal @db.Decimal(32, 12)
|
||
quantumReserve Decimal? @db.Decimal(32, 12) // Quantum superposition reserve
|
||
parallelReserve Decimal? @db.Decimal(32, 12) // Parallel state reserve
|
||
holographicReserve Decimal? @db.Decimal(32, 12) // Holographic projection reserve
|
||
temporalReserve Decimal? @db.Decimal(32, 12) // Temporal future reserve
|
||
totalReserve Decimal @db.Decimal(32, 12) // Calculated total
|
||
variance Decimal? @db.Decimal(32, 12) // Cross-state variance
|
||
entropy Decimal? @db.Decimal(32, 12) // Quantum entropy
|
||
status String @default("active")
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
quantumStates QuantumReserveState[]
|
||
parallelBranches ParallelReserveBranch[]
|
||
temporalFutures TemporalReserveFuture[]
|
||
|
||
@@index([reserveId])
|
||
@@index([status])
|
||
@@index([calculatedAt])
|
||
@@map("infinite_state_reserves")
|
||
}
|
||
|
||
model QuantumReserveState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
reserveId String
|
||
quantumState Json // Quantum state representation
|
||
probabilityAmplitude Decimal @db.Decimal(32, 12)
|
||
entanglementHash String? // Entanglement reference
|
||
coherence Decimal? @db.Decimal(32, 12) // Quantum coherence measure
|
||
measuredAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserve InfiniteStateReserve @relation(fields: [reserveId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([stateId])
|
||
@@index([reserveId])
|
||
@@index([measuredAt])
|
||
@@map("quantum_reserve_states")
|
||
}
|
||
|
||
model ParallelReserveBranch {
|
||
id String @id @default(uuid())
|
||
branchId String @unique
|
||
reserveId String
|
||
branchName String
|
||
branchState String // parallel_outcome_1, parallel_outcome_2, etc.
|
||
reserveAmount Decimal @db.Decimal(32, 12)
|
||
probability Decimal? @db.Decimal(32, 12) // Branch probability
|
||
divergence Decimal? @db.Decimal(32, 12) // Divergence from prime
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserve InfiniteStateReserve @relation(fields: [reserveId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([branchId])
|
||
@@index([reserveId])
|
||
@@index([branchState])
|
||
@@index([status])
|
||
@@map("parallel_reserve_branches")
|
||
}
|
||
|
||
model TemporalReserveFuture {
|
||
id String @id @default(uuid())
|
||
futureId String @unique
|
||
reserveId String
|
||
futureTime DateTime // Projected future time
|
||
projectedReserve Decimal @db.Decimal(32, 12)
|
||
confidence Decimal? @db.Decimal(32, 12)
|
||
scenario String? // Future scenario identifier
|
||
projectedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserve InfiniteStateReserve @relation(fields: [reserveId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([futureId])
|
||
@@index([reserveId])
|
||
@@index([futureTime])
|
||
@@map("temporal_reserve_futures")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XII: Omega-Layer Settlement Fabric (Ω-LSF)
|
||
// ============================================================================
|
||
|
||
model OmegaLayer {
|
||
id String @id @default(uuid())
|
||
layerId String @unique
|
||
layerNumber Int // 0, 1, 2, 3, 4
|
||
layerName String // Ω0: Prime Ledger, Ω1: Quantum Ledger, Ω2: Holographic Simulation, Ω3: Parallel-State Ledger, Ω4: Temporal Ledger
|
||
description String @db.Text
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
states OmegaState[]
|
||
reconciliations OmegaReconciliation[]
|
||
|
||
@@index([layerId])
|
||
@@index([layerNumber])
|
||
@@index([status])
|
||
@@map("omega_layers")
|
||
}
|
||
|
||
model OmegaState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
layerId String
|
||
stateHash String // State hash/identifier
|
||
stateData Json // Layer-specific state data
|
||
primeState Json? // Ω0 prime state reference
|
||
quantumState Json? // Ω1 quantum state
|
||
holographicState Json? // Ω2 holographic state
|
||
parallelState Json? // Ω3 parallel state
|
||
temporalState Json? // Ω4 temporal state
|
||
mergedState Json? // MERGE result
|
||
consistencyStatus String @default("pending") // pending, consistent, inconsistent, corrected
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
layer OmegaLayer @relation(fields: [layerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([stateId])
|
||
@@index([layerId])
|
||
@@index([consistencyStatus])
|
||
@@index([timestamp])
|
||
@@map("omega_states")
|
||
}
|
||
|
||
model OmegaReconciliation {
|
||
id String @id @default(uuid())
|
||
reconciliationId String @unique
|
||
layerId String?
|
||
reconciliationType String // dimensional, cross_reality, temporal, quantum_temporal
|
||
primeState Json?
|
||
quantumState Json?
|
||
holographicState Json?
|
||
parallelState Json?
|
||
temporalState Json?
|
||
mergedState Json // MERGE result
|
||
inconsistencyDetected Boolean @default(false)
|
||
correctionMethod String? // quantum_temporal_correction, realign_all_states
|
||
correctionApplied Json? // Correction details
|
||
status String @default("pending") // pending, reconciled, inconsistent, corrected
|
||
reconciledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
layer OmegaLayer? @relation(fields: [layerId], references: [id], onDelete: SetNull)
|
||
consistencyEvents OmegaConsistencyEvent[]
|
||
|
||
@@index([reconciliationId])
|
||
@@index([layerId])
|
||
@@index([status])
|
||
@@index([reconciledAt])
|
||
@@map("omega_reconciliations")
|
||
}
|
||
|
||
model OmegaConsistencyEvent {
|
||
id String @id @default(uuid())
|
||
eventId String @unique
|
||
reconciliationId String
|
||
eventType String // inconsistency_detected, correction_executed, realignment_complete
|
||
eventData Json? // Event details
|
||
consistencyBefore String? // Consistency status before event
|
||
consistencyAfter String? // Consistency status after event
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reconciliation OmegaReconciliation @relation(fields: [reconciliationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([eventId])
|
||
@@index([reconciliationId])
|
||
@@index([eventType])
|
||
@@index([timestamp])
|
||
@@map("omega_consistency_events")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XII: Sovereign Multiverse Continuity Protocols (SMCP)
|
||
// ============================================================================
|
||
|
||
model SovereignContinuityIdentity {
|
||
id String @id @default(uuid())
|
||
continuityId String @unique
|
||
sovereignBankId String
|
||
unifiedIdentity String // Unified SCB identity across all realities
|
||
classicalIdentity String? // Classical reality identity
|
||
quantumIdentity String? // Quantum realm identity
|
||
holographicIdentity String? // Holographic/simulated identity
|
||
parallelIdentity Json? // Parallel state identities (array)
|
||
temporalIdentity String? // Temporal identity anchor
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
stateMappings MultiverseStateMapping[]
|
||
|
||
@@index([continuityId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("sovereign_continuity_identities")
|
||
}
|
||
|
||
model MultiverseStateMapping {
|
||
id String @id @default(uuid())
|
||
mappingId String @unique
|
||
continuityId String
|
||
realityType String // classical, quantum, holographic, parallel, temporal
|
||
stateIdentifier String // State identifier in that reality
|
||
stateData Json? // State-specific data
|
||
divergence Decimal? @db.Decimal(32, 12) // Divergence from unified identity
|
||
lastSynced DateTime?
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
continuity SovereignContinuityIdentity @relation(fields: [continuityId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([mappingId])
|
||
@@index([continuityId])
|
||
@@index([realityType])
|
||
@@index([status])
|
||
@@map("multiverse_state_mappings")
|
||
}
|
||
|
||
// Add relations to existing SovereignBank model
|
||
// These will be added via separate search_replace operations
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Supra-Constitutional DBIS Charter (SCDC)
|
||
// ============================================================================
|
||
|
||
model SupraConstitutionalCharter {
|
||
id String @id @default(uuid())
|
||
charterId String @unique
|
||
version String // Version of the charter
|
||
effectiveDate DateTime @default(now())
|
||
status String @default("active") // active, superseded, archived
|
||
metaSovereignPrimacy Boolean @default(true)
|
||
dimensionalConsistency Boolean @default(true)
|
||
temporalNonContradiction Boolean @default(true)
|
||
economicCausality Boolean @default(true)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
articles CharterArticle[]
|
||
integrityChecks TemporalIntegrityCheck[]
|
||
aiActions AIAutonomousAction[]
|
||
|
||
@@index([charterId])
|
||
@@index([version])
|
||
@@index([status])
|
||
@@map("supra_constitutional_charter")
|
||
}
|
||
|
||
model CharterArticle {
|
||
id String @id @default(uuid())
|
||
articleId String @unique
|
||
charterId String
|
||
articleNumber Int // Article 1, 9, 14, 22, etc.
|
||
title String
|
||
content String @db.Text
|
||
principleType String? // settlement_supremacy, temporal_integrity, multiversal_recognition, ai_mandate
|
||
enforcementLevel String @default("mandatory") // mandatory, advisory, optional
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
charter SupraConstitutionalCharter @relation(fields: [charterId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([articleId])
|
||
@@index([charterId])
|
||
@@index([articleNumber])
|
||
@@index([principleType])
|
||
@@map("charter_articles")
|
||
}
|
||
|
||
model TemporalIntegrityCheck {
|
||
id String @id @default(uuid())
|
||
checkId String @unique
|
||
charterId String
|
||
transactionId String? // Related transaction if applicable
|
||
checkType String // causality, non_contradiction, timeline_integrity
|
||
checkResult String // passed, failed, warning
|
||
checkDetails Json? // Detailed check results
|
||
contradictionDetected Boolean @default(false)
|
||
resolved Boolean @default(false)
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
charter SupraConstitutionalCharter @relation(fields: [charterId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([checkId])
|
||
@@index([charterId])
|
||
@@index([transactionId])
|
||
@@index([checkType])
|
||
@@index([checkResult])
|
||
@@map("temporal_integrity_checks")
|
||
}
|
||
|
||
model AIAutonomousAction {
|
||
id String @id @default(uuid())
|
||
actionId String @unique
|
||
charterId String
|
||
aiSystem String // NCE, ARI, SARE
|
||
actionType String // stability_enforcement, risk_mitigation, settlement_correction
|
||
actionDetails Json // Action parameters and results
|
||
authorizationLevel String // autonomous, supervised, manual
|
||
status String @default("pending") // pending, executing, completed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
charter SupraConstitutionalCharter @relation(fields: [charterId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([actionId])
|
||
@@index([charterId])
|
||
@@index([aiSystem])
|
||
@@index([actionType])
|
||
@@index([status])
|
||
@@map("ai_autonomous_actions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Global Multiversal Monetary Theory (GMMT)
|
||
// ============================================================================
|
||
|
||
model RealityLayer {
|
||
id String @id @default(uuid())
|
||
layerId String @unique
|
||
layerName String
|
||
layerType String // classical, quantum, simulated, holographic, parallel
|
||
authenticationStatus String @default("pending") // pending, authenticated, rejected
|
||
coherenceLevel Decimal @db.Decimal(32, 12) // Consistency with Prime Ledger
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
monetaryUnits MultiversalMonetaryUnit[]
|
||
conversions MonetaryUnitConversion[]
|
||
valuations ValuationCalculation[]
|
||
|
||
@@index([layerId])
|
||
@@index([layerType])
|
||
@@index([authenticationStatus])
|
||
@@map("reality_layers")
|
||
}
|
||
|
||
model MultiversalMonetaryUnit {
|
||
id String @id @default(uuid())
|
||
unitId String @unique
|
||
layerId String
|
||
unitType String // PMU, QMU, HMU, PSU
|
||
unitName String
|
||
anchorValue Decimal? @db.Decimal(32, 12) // Anchor to Prime Monetary Unit
|
||
derivationFormula Json? // How unit is derived (SSU + temporal stability functions)
|
||
quantumState Json? // For QMU: quantum resonance states
|
||
holographicEncoding Json? // For HMU: holographic projection data
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
layer RealityLayer @relation(fields: [layerId], references: [id], onDelete: Cascade)
|
||
conversions MonetaryUnitConversion[] @relation("SourceUnit")
|
||
targetConversions MonetaryUnitConversion[] @relation("TargetUnit")
|
||
valuations ValuationCalculation[]
|
||
|
||
@@index([unitId])
|
||
@@index([layerId])
|
||
@@index([unitType])
|
||
@@map("multiversal_monetary_units")
|
||
}
|
||
|
||
model MonetaryUnitConversion {
|
||
id String @id @default(uuid())
|
||
conversionId String @unique
|
||
sourceUnitId String
|
||
targetUnitId String
|
||
conversionRate Decimal @db.Decimal(32, 12)
|
||
conversionFormula Json? // Conversion calculation details
|
||
confidenceLevel Decimal @db.Decimal(32, 12) // 0-1 confidence in conversion
|
||
status String @default("active")
|
||
validFrom DateTime @default(now())
|
||
validTo DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sourceUnit MultiversalMonetaryUnit @relation("SourceUnit", fields: [sourceUnitId], references: [id], onDelete: Cascade)
|
||
targetUnit MultiversalMonetaryUnit @relation("TargetUnit", fields: [targetUnitId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([conversionId])
|
||
@@index([sourceUnitId])
|
||
@@index([targetUnitId])
|
||
@@index([status])
|
||
@@map("monetary_unit_conversions")
|
||
}
|
||
|
||
model ValuationCalculation {
|
||
id String @id @default(uuid())
|
||
valuationId String @unique
|
||
layerId String
|
||
unitId String
|
||
assetId String? // Asset being valued
|
||
classicalValue Decimal @db.Decimal(32, 12)
|
||
quantumExpectedValue Decimal? @db.Decimal(32, 12)
|
||
holographicProjection Decimal? @db.Decimal(32, 12)
|
||
parallelArbitrageAdjustment Decimal? @db.Decimal(32, 12)
|
||
totalValue Decimal @db.Decimal(32, 12) // Sum of all components
|
||
calculationFormula Json // Full formula breakdown
|
||
status String @default("active")
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
layer RealityLayer @relation(fields: [layerId], references: [id], onDelete: Cascade)
|
||
unit MultiversalMonetaryUnit @relation(fields: [unitId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([valuationId])
|
||
@@index([layerId])
|
||
@@index([unitId])
|
||
@@index([assetId])
|
||
@@map("valuation_calculations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Temporal Liquidity Portals (TLP)
|
||
// ============================================================================
|
||
|
||
model TemporalLiquidityPortal {
|
||
id String @id @default(uuid())
|
||
portalId String @unique
|
||
portalName String
|
||
targetTimeDelta Int // Δ in seconds (future time window)
|
||
confidenceLevel Decimal @db.Decimal(32, 12) // 0-1 confidence
|
||
maxLiquidityBorrow Decimal @db.Decimal(32, 8) // Maximum liquidity that can be borrowed
|
||
status String @default("active") // active, suspended, closed
|
||
activatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserves FutureLiquidityReserve[]
|
||
paradoxDetections ParadoxDetection[]
|
||
buffers TemporalBuffer[]
|
||
|
||
@@index([portalId])
|
||
@@index([status])
|
||
@@map("temporal_liquidity_portals")
|
||
}
|
||
|
||
model FutureLiquidityReserve {
|
||
id String @id @default(uuid())
|
||
reserveId String @unique
|
||
portalId String
|
||
predictedTime DateTime // t+Δ
|
||
predictedReserves Decimal @db.Decimal(32, 8)
|
||
confidenceLevel Decimal @db.Decimal(32, 12)
|
||
availableLiquidity Decimal @db.Decimal(32, 8) // predicted_reserves * confidence_level
|
||
borrowedAmount Decimal @default(0) @db.Decimal(32, 8)
|
||
status String @default("available") // available, borrowed, exhausted, expired
|
||
expiresAt DateTime
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
portal TemporalLiquidityPortal @relation(fields: [portalId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reserveId])
|
||
@@index([portalId])
|
||
@@index([predictedTime])
|
||
@@index([status])
|
||
@@map("future_liquidity_reserves")
|
||
}
|
||
|
||
model ParadoxDetection {
|
||
id String @id @default(uuid())
|
||
detectionId String @unique
|
||
portalId String
|
||
transactionId String? // Related transaction
|
||
paradoxType String // causality_violation, timeline_contradiction, economic_paradox
|
||
severity String // low, medium, high, critical
|
||
detectedAt DateTime @default(now())
|
||
resolved Boolean @default(false)
|
||
resolutionMethod String? // rollback, adjustment, rejection
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
portal TemporalLiquidityPortal @relation(fields: [portalId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([detectionId])
|
||
@@index([portalId])
|
||
@@index([transactionId])
|
||
@@index([paradoxType])
|
||
@@index([resolved])
|
||
@@map("paradox_detections")
|
||
}
|
||
|
||
model TemporalBuffer {
|
||
id String @id @default(uuid())
|
||
bufferId String @unique
|
||
portalId String
|
||
bufferType String // interplanetary_settlement, csse, ai_policy_correction
|
||
bufferAmount Decimal @db.Decimal(32, 8)
|
||
allocatedAmount Decimal @default(0) @db.Decimal(32, 8)
|
||
status String @default("active") // active, allocated, exhausted
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
portal TemporalLiquidityPortal @relation(fields: [portalId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([bufferId])
|
||
@@index([portalId])
|
||
@@index([bufferType])
|
||
@@map("temporal_buffers")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Unified Holographic Economic Model (UHEM)
|
||
// ============================================================================
|
||
|
||
model HolographicEconomicState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
stateHash String @unique // Hash of encoded state
|
||
cbdcFlow Json // CBDC flow data
|
||
fxMatrix Json // FX matrix data
|
||
ssuPressure Json // SSU pressure indicators
|
||
stabilityFields Json // Stability field data
|
||
encodedState Json // Full ENCODE result
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
projections EconomicProjection[]
|
||
corrections DeviationCorrection[]
|
||
mappings HolographicMapping[]
|
||
|
||
@@index([stateId])
|
||
@@index([stateHash])
|
||
@@index([timestamp])
|
||
@@map("holographic_economic_states")
|
||
}
|
||
|
||
model EconomicProjection {
|
||
id String @id @default(uuid())
|
||
projectionId String @unique
|
||
stateId String
|
||
targetReality String // Target reality layer for projection
|
||
projectionData Json // Projected economic flows
|
||
projectionMethod String // forward_projection, reverse_projection, cross_reality
|
||
accuracy Decimal? @db.Decimal(32, 12) // Projection accuracy if validated
|
||
status String @default("active") // active, validated, archived
|
||
projectedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
state HolographicEconomicState @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([projectionId])
|
||
@@index([stateId])
|
||
@@index([targetReality])
|
||
@@index([status])
|
||
@@map("economic_projections")
|
||
}
|
||
|
||
model DeviationCorrection {
|
||
id String @id @default(uuid())
|
||
correctionId String @unique
|
||
stateId String
|
||
deviationType String // non_physical, inconsistency, divergence
|
||
deviationMagnitude Decimal @db.Decimal(32, 12)
|
||
correctionApplied Json // Correction details
|
||
correctionMethod String // reverse_projection, prime_ledger_alignment
|
||
status String @default("pending") // pending, applied, verified
|
||
correctedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
state HolographicEconomicState @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([correctionId])
|
||
@@index([stateId])
|
||
@@index([deviationType])
|
||
@@index([status])
|
||
@@map("deviation_corrections")
|
||
}
|
||
|
||
model HolographicMapping {
|
||
id String @id @default(uuid())
|
||
mappingId String @unique
|
||
stateId String
|
||
sourceReality String // Source reality layer
|
||
targetReality String // Target reality layer
|
||
mappingData Json // Mapping transformation data
|
||
mappingType String // economic_flow, behavioral_dynamics, predictive_analytics
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
state HolographicEconomicState @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([mappingId])
|
||
@@index([stateId])
|
||
@@index([sourceReality])
|
||
@@index([targetReality])
|
||
@@map("holographic_mappings")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Omni-Sovereign Settlement Matrix (OSSM)
|
||
// ============================================================================
|
||
|
||
model OmniSovereignMatrix {
|
||
id String @id @default(uuid())
|
||
matrixId String @unique
|
||
matrixName String
|
||
status String @default("active") // active, suspended, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
dimensions MatrixDimension[]
|
||
coordinates SettlementCoordinate[]
|
||
layerStates RealityLayerState[]
|
||
|
||
@@index([matrixId])
|
||
@@index([status])
|
||
@@map("omni_sovereign_matrices")
|
||
}
|
||
|
||
model MatrixDimension {
|
||
id String @id @default(uuid())
|
||
dimensionId String @unique
|
||
matrixId String
|
||
dimensionType String // X_sovereign, Y_asset, Z_temporal, Omega_reality
|
||
dimensionName String
|
||
dimensionData Json // Dimension-specific data (SCBs, assets, timeframes, realities)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
matrix OmniSovereignMatrix @relation(fields: [matrixId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([dimensionId])
|
||
@@index([matrixId])
|
||
@@index([dimensionType])
|
||
@@map("matrix_dimensions")
|
||
}
|
||
|
||
model SettlementCoordinate {
|
||
id String @id @default(uuid())
|
||
coordinateId String @unique
|
||
matrixId String
|
||
sovereignIndex Int // X dimension
|
||
assetIndex Int // Y dimension
|
||
temporalIndex Int // Z dimension
|
||
realityIndex Int // Ω dimension
|
||
settlementState Json // State at this coordinate
|
||
settlementStatus String @default("pending") // pending, synchronized, conflicted
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
matrix OmniSovereignMatrix @relation(fields: [matrixId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([coordinateId])
|
||
@@index([matrixId])
|
||
@@index([sovereignIndex, assetIndex, temporalIndex, realityIndex])
|
||
@@index([settlementStatus])
|
||
@@map("settlement_coordinates")
|
||
}
|
||
|
||
model RealityLayerState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
matrixId String
|
||
realityLayer String // classical, quantum, simulated, parallel
|
||
layerState Json // MERGE result for this reality
|
||
syncStatus String @default("pending") // pending, synced, conflicted
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
matrix OmniSovereignMatrix @relation(fields: [matrixId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([stateId])
|
||
@@index([matrixId])
|
||
@@index([realityLayer])
|
||
@@index([syncStatus])
|
||
@@map("reality_layer_states")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Multiverse-Consistent FX/SSU Stability Framework
|
||
// ============================================================================
|
||
|
||
model MultiverseStabilityIndex {
|
||
id String @id @default(uuid())
|
||
indexId String @unique
|
||
realityLayer String // Which reality layer this index applies to
|
||
fxStability Decimal @db.Decimal(32, 12)
|
||
ssuInertia Decimal @db.Decimal(32, 12)
|
||
temporalSmoothing Decimal @db.Decimal(32, 12)
|
||
crossRealityDivergence Decimal @db.Decimal(32, 12)
|
||
totalStability Decimal @db.Decimal(32, 12) // Calculated stability score
|
||
status String @default("active")
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
calculations StabilityCalculation[]
|
||
divergences RealityDivergence[]
|
||
|
||
@@index([indexId])
|
||
@@index([realityLayer])
|
||
@@index([calculatedAt])
|
||
@@map("multiverse_stability_indices")
|
||
}
|
||
|
||
model RealityDivergence {
|
||
id String @id @default(uuid())
|
||
divergenceId String @unique
|
||
indexId String
|
||
sourceReality String
|
||
targetReality String
|
||
divergenceType String // fx_divergence, ssu_divergence, stability_divergence
|
||
divergenceMagnitude Decimal @db.Decimal(32, 12)
|
||
threshold Decimal @db.Decimal(32, 12) // Alert threshold
|
||
alertLevel String // info, warning, critical
|
||
status String @default("detected") // detected, resolved, ignored
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
index MultiverseStabilityIndex @relation(fields: [indexId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([divergenceId])
|
||
@@index([indexId])
|
||
@@index([sourceReality, targetReality])
|
||
@@index([alertLevel])
|
||
@@map("reality_divergences")
|
||
}
|
||
|
||
model StabilityCalculation {
|
||
id String @id @default(uuid())
|
||
calculationId String @unique
|
||
indexId String
|
||
calculationType String // fx_stability, ssu_inertia, temporal_smoothing, divergence
|
||
inputData Json // Input parameters
|
||
calculationResult Decimal @db.Decimal(32, 12)
|
||
calculationFormula Json // Formula used
|
||
status String @default("active")
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
index MultiverseStabilityIndex @relation(fields: [indexId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([calculationId])
|
||
@@index([indexId])
|
||
@@index([calculationType])
|
||
@@map("stability_calculations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XI: Quantum-Temporal Arbitration Engine (QTAE)
|
||
// ============================================================================
|
||
|
||
model QuantumTemporalArbitration {
|
||
id String @id @default(uuid())
|
||
arbitrationId String @unique
|
||
arbitrationType String // cross_chain, temporal, parallel, quantum
|
||
status String @default("pending") // pending, analyzing, resolved, failed
|
||
initiatedAt DateTime @default(now())
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contradictions ContradictionEvent[]
|
||
rollbacks ConsistencyRollback[]
|
||
decisions ArbitrationDecision[]
|
||
|
||
@@index([arbitrationId])
|
||
@@index([arbitrationType])
|
||
@@index([status])
|
||
@@map("quantum_temporal_arbitrations")
|
||
}
|
||
|
||
model ContradictionEvent {
|
||
id String @id @default(uuid())
|
||
eventId String @unique
|
||
arbitrationId String
|
||
contradictionType String // cross_chain_state, temporal_inconsistency, parallel_ledger_conflict, quantum_deviation
|
||
severity String // low, medium, high, critical
|
||
detectedAt DateTime @default(now())
|
||
eventData Json // Contradiction details
|
||
resolved Boolean @default(false)
|
||
resolutionMethod String? // rollback, adjustment, rejection
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
arbitration QuantumTemporalArbitration @relation(fields: [arbitrationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([eventId])
|
||
@@index([arbitrationId])
|
||
@@index([contradictionType])
|
||
@@index([resolved])
|
||
@@map("contradiction_events")
|
||
}
|
||
|
||
model ConsistencyRollback {
|
||
id String @id @default(uuid())
|
||
rollbackId String @unique
|
||
arbitrationId String
|
||
targetState Json // State to rollback to
|
||
rollbackReason String
|
||
rollbackScope Json // What is being rolled back
|
||
status String @default("pending") // pending, executing, completed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
arbitration QuantumTemporalArbitration @relation(fields: [arbitrationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([rollbackId])
|
||
@@index([arbitrationId])
|
||
@@index([status])
|
||
@@map("consistency_rollbacks")
|
||
}
|
||
|
||
model ArbitrationDecision {
|
||
id String @id @default(uuid())
|
||
decisionId String @unique
|
||
arbitrationId String
|
||
decisionType String // rollback, affirm_finality, partial_resolution
|
||
decisionDetails Json // Decision rationale and actions
|
||
finality Boolean @default(false) // Whether decision is final
|
||
msaNotified Boolean @default(false) // Whether MSA has been notified
|
||
msaNotificationAt DateTime?
|
||
status String @default("pending") // pending, executed, confirmed
|
||
decidedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
arbitration QuantumTemporalArbitration @relation(fields: [arbitrationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([decisionId])
|
||
@@index([arbitrationId])
|
||
@@index([decisionType])
|
||
@@index([finality])
|
||
@@map("arbitration_decisions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume X: Meta-Sovereign Governance Framework (MSGF)
|
||
// ============================================================================
|
||
|
||
model MetaSovereignCouncil {
|
||
id String @id @default(uuid())
|
||
councilId String @unique
|
||
councilType String // MSA, UMC, AESU
|
||
name String
|
||
description String @db.Text
|
||
authorityLevel String // Tier 0 - Meta-Sovereign
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
members MetaSovereignCouncilMember[]
|
||
policies MetaSovereignPolicy[]
|
||
decisions MetaSovereignDecision[]
|
||
|
||
@@index([councilId])
|
||
@@index([councilType])
|
||
@@index([status])
|
||
@@map("meta_sovereign_councils")
|
||
}
|
||
|
||
model MetaSovereignCouncilMember {
|
||
id String @default(uuid()) @id
|
||
councilId String
|
||
sovereignBankId String?
|
||
memberName String
|
||
memberRole String
|
||
votingWeight Decimal? @db.Decimal(32, 8)
|
||
status String @default("active")
|
||
appointedAt DateTime @default(now())
|
||
termEndDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
council MetaSovereignCouncil @relation(fields: [councilId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank? @relation(fields: [sovereignBankId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([councilId])
|
||
@@index([sovereignBankId])
|
||
@@map("meta_sovereign_council_members")
|
||
}
|
||
|
||
model GovernanceTier {
|
||
id String @id @default(uuid())
|
||
tierId String @unique
|
||
tierNumber Int // 0, 1, 2, 3
|
||
tierName String // Tier 0 - Meta-Sovereign, Tier 1 - Sovereign, etc.
|
||
description String @db.Text
|
||
authorityScope Json // Authority definitions
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
delegations TierDelegation[]
|
||
|
||
@@index([tierId])
|
||
@@index([tierNumber])
|
||
@@index([status])
|
||
@@map("governance_tiers")
|
||
}
|
||
|
||
model TierDelegation {
|
||
id String @id @default(uuid())
|
||
delegationId String @unique
|
||
fromTierId String
|
||
toTierId String
|
||
delegationType String // cross_border_settlement, cbdc_compliance, fx_alignment
|
||
authorityScope Json
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
fromTier GovernanceTier @relation("FromTier", fields: [fromTierId], references: [id], onDelete: Cascade)
|
||
toTier GovernanceTier @relation("ToTier", fields: [toTierId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([delegationId])
|
||
@@index([fromTierId])
|
||
@@index([toTierId])
|
||
@@index([status])
|
||
@@map("tier_delegations")
|
||
}
|
||
|
||
model MetaSovereignPolicy {
|
||
id String @id @default(uuid())
|
||
policyId String @unique
|
||
councilId String
|
||
policyType String // fx_governance, cbdc_interoperability, ssu_composition, global_liquidity
|
||
policyTitle String
|
||
policyContent Json // Policy details
|
||
enforcementLevel String // advisory, mandatory, critical
|
||
status String @default("draft") // draft, active, suspended, revoked
|
||
effectiveDate DateTime?
|
||
revokedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
council MetaSovereignCouncil @relation(fields: [councilId], references: [id], onDelete: Cascade)
|
||
enforcements PolicyEnforcement[]
|
||
|
||
@@index([policyId])
|
||
@@index([councilId])
|
||
@@index([policyType])
|
||
@@index([status])
|
||
@@map("meta_sovereign_policies")
|
||
}
|
||
|
||
model PolicyEnforcement {
|
||
id String @id @default(uuid())
|
||
enforcementId String @unique
|
||
policyId String
|
||
enforcementType String // privilege_suspension, liquidity_compression, liquidity_expansion, ssu_recalibration, fx_band_reset
|
||
targetSovereignBankId String?
|
||
enforcementData Json
|
||
status String @default("pending") // pending, active, completed, cancelled
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
policy MetaSovereignPolicy @relation(fields: [policyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([enforcementId])
|
||
@@index([policyId])
|
||
@@index([targetSovereignBankId])
|
||
@@index([status])
|
||
@@map("policy_enforcements")
|
||
}
|
||
|
||
model SovereignPrivilege {
|
||
id String @id @default(uuid())
|
||
privilegeId String @unique
|
||
sovereignBankId String
|
||
privilegeType String // settlement_access, cbdc_issuance, fx_trading, liquidity_access
|
||
status String @default("active") // active, suspended, revoked
|
||
suspensionReason String? @db.Text
|
||
suspendedAt DateTime?
|
||
restoredAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([privilegeId])
|
||
@@index([sovereignBankId])
|
||
@@index([privilegeType])
|
||
@@index([status])
|
||
@@map("sovereign_privileges")
|
||
}
|
||
|
||
model MetaSovereignDecision {
|
||
id String @id @default(uuid())
|
||
decisionId String @unique
|
||
councilId String
|
||
decisionType String // policy_approval, enforcement_order, dispute_resolution
|
||
decisionContent Json
|
||
status String @default("pending") // pending, approved, rejected, executed
|
||
approvedAt DateTime?
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
council MetaSovereignCouncil @relation(fields: [councilId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([decisionId])
|
||
@@index([councilId])
|
||
@@index([status])
|
||
@@map("meta_sovereign_decisions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume X: Universal Monetary Alignment Protocol (UMAP)
|
||
// ============================================================================
|
||
|
||
model UniversalMonetaryBaseline {
|
||
id String @id @default(uuid())
|
||
umbId String @unique
|
||
baselineName String
|
||
description String @db.Text
|
||
valuationStandard Json // Neutral valuation standards
|
||
assetTypes Json // fiat, cbdc, commodity, ssu, synthetic_planetary
|
||
status String @default("active") // active, deprecated, draft
|
||
effectiveDate DateTime @default(now())
|
||
deprecatedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
parityCalculations GlobalParityEngine[]
|
||
|
||
@@index([umbId])
|
||
@@index([status])
|
||
@@map("universal_monetary_baselines")
|
||
}
|
||
|
||
model GlobalParityEngine {
|
||
id String @id @default(uuid())
|
||
parityId String @unique
|
||
umbId String?
|
||
currencyCode String
|
||
assetType String // fiat, cbdc, commodity, ssu
|
||
fxWeight Decimal @db.Decimal(32, 12)
|
||
commodityWeight Decimal @db.Decimal(32, 12)
|
||
ssuStability Decimal @db.Decimal(32, 12)
|
||
riskPremium Decimal @db.Decimal(32, 12)
|
||
calculatedParity Decimal @db.Decimal(32, 12) // parity = fx_weight + commodity_weight + ssu_stability + risk_premium
|
||
status String @default("active")
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
umb UniversalMonetaryBaseline? @relation(fields: [umbId], references: [id], onDelete: SetNull)
|
||
contracts AlignmentContract[]
|
||
|
||
@@index([parityId])
|
||
@@index([currencyCode])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("global_parity_engines")
|
||
}
|
||
|
||
model AlignmentContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
parityId String
|
||
contractType String // re_alignment_target, fx_corridor_limit, ssu_stabilization
|
||
contractRules Json // Smart contract rules
|
||
targetValue Decimal? @db.Decimal(32, 12)
|
||
threshold Decimal? @db.Decimal(32, 12)
|
||
status String @default("active") // active, triggered, expired
|
||
triggeredAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
parity GlobalParityEngine @relation(fields: [parityId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([contractId])
|
||
@@index([parityId])
|
||
@@index([contractType])
|
||
@@index([status])
|
||
@@map("alignment_contracts")
|
||
}
|
||
|
||
model MonetaryDriftCorrection {
|
||
id String @id @default(uuid())
|
||
correctionId String @unique
|
||
currencyCode String
|
||
assetType String
|
||
driftAmount Decimal @db.Decimal(32, 12)
|
||
driftType String // market_drift, fx_drift, commodity_shock
|
||
correctionMethod String // cbdc_rebalancing, ssu_pressure_absorption, fx_cost_correction
|
||
correctionAmount Decimal @db.Decimal(32, 12)
|
||
status String @default("pending") // pending, applied, failed
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([correctionId])
|
||
@@index([currencyCode])
|
||
@@index([assetType])
|
||
@@index([status])
|
||
@@map("monetary_drift_corrections")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume X: Neural Consensus Engine (NCE)
|
||
// ============================================================================
|
||
|
||
model NeuralConsensusState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
ledgerStateHash String
|
||
neuralVote Decimal @db.Decimal(32, 12) // Confidence percentage (0-100)
|
||
scbSignals Json // SCB signal data
|
||
aiForecasts Json // AI forecast data
|
||
quantumSignatures Json // Quantum signature data
|
||
consensusResult String // approved, rejected, pending
|
||
confidenceThreshold Decimal @default(97) @db.Decimal(32, 12) // Default 97%
|
||
status String @default("pending") // pending, confirmed, rejected
|
||
confirmedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
layers NeuralLayer[]
|
||
signatures NeuralQuantumSignature[]
|
||
|
||
@@index([stateId])
|
||
@@index([ledgerStateHash])
|
||
@@index([consensusResult])
|
||
@@index([status])
|
||
@@map("neural_consensus_states")
|
||
}
|
||
|
||
model NeuralLayer {
|
||
id String @id @default(uuid())
|
||
layerId String @unique
|
||
stateId String
|
||
layerType String // input, consensus, decision
|
||
layerData Json // Layer processing data
|
||
output Json? // Layer output
|
||
status String @default("active")
|
||
processedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
state NeuralConsensusState @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([layerId])
|
||
@@index([stateId])
|
||
@@index([layerType])
|
||
@@map("neural_layers")
|
||
}
|
||
|
||
model NeuralQuantumSignature {
|
||
id String @id @default(uuid())
|
||
signatureId String @unique
|
||
stateId String
|
||
quantumKeyId String
|
||
signature String
|
||
signatureType String // pq_dilithium, pq_kyber, xmss, sphincs_plus
|
||
thresholdMet Boolean @default(false)
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
state NeuralConsensusState @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([signatureId])
|
||
@@index([stateId])
|
||
@@index([quantumKeyId])
|
||
@@index([thresholdMet])
|
||
@@map("neural_quantum_signatures")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume X: Fully Autonomous CBDC Economies (FACE)
|
||
// ============================================================================
|
||
|
||
model FaceEconomy {
|
||
id String @id @default(uuid())
|
||
economyId String @unique
|
||
sovereignBankId String
|
||
economyName String
|
||
description String @db.Text
|
||
economyType String // retail, wholesale, hybrid
|
||
status String @default("active") // active, suspended, archived
|
||
activatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
behavioralEngine FaceBehavioralEngine?
|
||
supplyContracts FaceSupplyContract[]
|
||
stabilizationContracts FaceStabilizationContract[]
|
||
incentives FaceIncentive[]
|
||
|
||
@@index([economyId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("face_economies")
|
||
}
|
||
|
||
model FaceBehavioralEngine {
|
||
id String @id @default(uuid())
|
||
engineId String @unique
|
||
economyId String @unique
|
||
engineConfig Json // AI behavioral configuration
|
||
behaviorModel String // Model type/version
|
||
status String @default("active")
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
economy FaceEconomy @relation(fields: [economyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([engineId])
|
||
@@index([economyId])
|
||
@@map("face_behavioral_engines")
|
||
}
|
||
|
||
model FaceSupplyContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
economyId String
|
||
contractType String // automatic_supply_adjustment
|
||
velocityTarget Decimal @db.Decimal(32, 12)
|
||
velocityDangerThreshold Decimal @db.Decimal(32, 12)
|
||
mintCondition Json // if velocity < target: mint_cbdc()
|
||
burnCondition Json // elif velocity > danger_threshold: burn_cbdc()
|
||
status String @default("active") // active, triggered, suspended
|
||
lastTriggeredAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
economy FaceEconomy @relation(fields: [economyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([contractId])
|
||
@@index([economyId])
|
||
@@index([status])
|
||
@@map("face_supply_contracts")
|
||
}
|
||
|
||
model FaceStabilizationContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
economyId String
|
||
contractType String // auto_stabilization
|
||
sriThreshold Decimal @db.Decimal(32, 12)
|
||
rateAdjustmentRule Json // if SRI_risk > threshold: impose_rate_adjustment()
|
||
adjustmentType String // interest_rate, liquidity_rate, fee_adjustment
|
||
status String @default("active") // active, triggered, suspended
|
||
lastTriggeredAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
economy FaceEconomy @relation(fields: [economyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([contractId])
|
||
@@index([economyId])
|
||
@@index([status])
|
||
@@map("face_stabilization_contracts")
|
||
}
|
||
|
||
model FaceIncentive {
|
||
id String @id @default(uuid())
|
||
incentiveId String @unique
|
||
economyId String
|
||
incentiveType String // reward, penalty, predictive_nudge
|
||
targetBehavior String // stabilizing_flow, velocity_control, risk_reduction
|
||
incentiveAmount Decimal @db.Decimal(32, 12)
|
||
conditions Json // Conditions for incentive application
|
||
status String @default("active") // active, applied, expired
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
economy FaceEconomy @relation(fields: [economyId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([incentiveId])
|
||
@@index([economyId])
|
||
@@index([incentiveType])
|
||
@@index([status])
|
||
@@map("face_incentives")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume X: Chrono-Sovereign Settlement Engine (CSSE)
|
||
// ============================================================================
|
||
|
||
model ChronoSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String
|
||
timeDomain String // earth, lunar, martian, relativistic
|
||
timeOffset Decimal @db.Decimal(32, 12) // Time offset in seconds
|
||
status String @default("pre_commit") // pre_commit, committed, reconciled, settled
|
||
preCommittedAt DateTime?
|
||
committedAt DateTime?
|
||
reconciledAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sourceBank SovereignBank @relation("ChronoSettlementSource", fields: [sourceBankId], references: [id], onDelete: Cascade)
|
||
destinationBank SovereignBank @relation("ChronoSettlementDestination", fields: [destinationBankId], references: [id], onDelete: Cascade)
|
||
preCommits TemporalPreCommit[]
|
||
reconciliations TemporalReconciliation[]
|
||
|
||
@@index([settlementId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@map("chrono_settlements")
|
||
}
|
||
|
||
model TemporalPreCommit {
|
||
id String @id @default(uuid())
|
||
preCommitId String @unique
|
||
settlementId String
|
||
predictedState Json // Predicted future state
|
||
sovereignSignature String
|
||
preCommitHash String // HASH(predicted_state + sovereign_signature)
|
||
status String @default("pending") // pending, verified, committed
|
||
verifiedAt DateTime?
|
||
committedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement ChronoSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([preCommitId])
|
||
@@index([settlementId])
|
||
@@index([status])
|
||
@@map("temporal_pre_commits")
|
||
}
|
||
|
||
model TemporalReconciliation {
|
||
id String @id @default(uuid())
|
||
reconciliationId String @unique
|
||
settlementId String
|
||
delayCost Decimal @db.Decimal(32, 12)
|
||
fxDrift Decimal @db.Decimal(32, 12)
|
||
commodityShockDelta Decimal @db.Decimal(32, 12)
|
||
adjustmentAmount Decimal @db.Decimal(32, 12)
|
||
reconciliationData Json
|
||
status String @default("pending") // pending, calculated, applied
|
||
calculatedAt DateTime?
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement ChronoSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reconciliationId])
|
||
@@index([settlementId])
|
||
@@index([status])
|
||
@@map("temporal_reconciliations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume X: Interdimensional Ledger Compliance (ILC) - Concept Level
|
||
// ============================================================================
|
||
|
||
model InterdimensionalLedger {
|
||
id String @id @default(uuid())
|
||
ledgerId String @unique
|
||
ledgerName String
|
||
dimension String // D0, D1, D2, D3, D4
|
||
dimensionType String // classical, dlt, quantum, simulated, parallel
|
||
description String @db.Text
|
||
ledgerState Json? // Current ledger state
|
||
status String @default("active") // active, synchronized, conflict, resolved
|
||
lastSyncAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
dimensions LedgerDimension[]
|
||
reconciliations DimensionReconciliation[]
|
||
|
||
@@index([ledgerId])
|
||
@@index([dimension])
|
||
@@index([dimensionType])
|
||
@@index([status])
|
||
@@map("interdimensional_ledgers")
|
||
}
|
||
|
||
model LedgerDimension {
|
||
id String @id @default(uuid())
|
||
dimensionId String @unique
|
||
ledgerId String
|
||
dimensionCode String // D0, D1, D2, D3, D4
|
||
dimensionName String // D0 - Classical Finance, D1 - Distributed Ledger Systems, etc.
|
||
dimensionMetadata Json // Dimension-specific metadata
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger InterdimensionalLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([dimensionId])
|
||
@@index([ledgerId])
|
||
@@index([dimensionCode])
|
||
@@map("ledger_dimensions")
|
||
}
|
||
|
||
model DimensionReconciliation {
|
||
id String @id @default(uuid())
|
||
reconciliationId String @unique
|
||
ledgerId String
|
||
dimensionStates Json // States from D0, D1, D2, D3
|
||
reconciledState Json? // Result of reconciliation
|
||
consistencyCheck Boolean @default(false) // ledger_state[D0] == reconcile(...)
|
||
metaResolution Json? // invoke_meta_resolution() if inconsistent
|
||
status String @default("pending") // pending, consistent, inconsistent, resolved
|
||
checkedAt DateTime?
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledger InterdimensionalLedger @relation(fields: [ledgerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reconciliationId])
|
||
@@index([ledgerId])
|
||
@@index([status])
|
||
@@map("dimension_reconciliations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XIV: Trans-Causal Monetary Protocol, Infinite-Layer Identity, Holographic Sovereign Anchors, Reality-Spanning Smart Contracts, and Superposition Asset Valuation
|
||
// ============================================================================
|
||
|
||
// Volume XIV: Trans-Causal Monetary Protocol (TCMP)
|
||
model TransCausalTransaction {
|
||
id String @id @default(uuid())
|
||
tcxId String @unique
|
||
presentState Json // S0 - Current state
|
||
futureProjection Json // S+ - Future state projection
|
||
pastAlignment Json // S- - Past state alignment
|
||
causalHash String // HASH(S0 + S+ + S-)
|
||
integrityWeight Decimal @db.Decimal(32, 12) // ψ - Integrity weight
|
||
causalCoherence Decimal? @db.Decimal(32, 12) // f(S0, S+, S-) coherence score
|
||
coherenceThreshold Decimal @default(0.95) @db.Decimal(32, 12)
|
||
status String @default("pending") // pending, coherent, deferred, resolved
|
||
deferredReason String? @db.Text
|
||
resolutionMapping Json? // Causal-resolution mapping if coherence fails
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
resolvedAt DateTime?
|
||
|
||
resolutions CausalResolution[]
|
||
|
||
@@index([tcxId])
|
||
@@index([causalHash])
|
||
@@index([status])
|
||
@@index([causalCoherence])
|
||
@@map("trans_causal_transactions")
|
||
}
|
||
|
||
model CausalResolution {
|
||
id String @id @default(uuid())
|
||
resolutionId String @unique
|
||
tcxId String
|
||
resolutionType String // temporal_loop, retrocausal, forward_predicted, quantum_timeline
|
||
resolutionMapping Json // Causal-resolution mapping
|
||
resolutionResult Json? // Result of resolution
|
||
status String @default("pending") // pending, applied, failed
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
transaction TransCausalTransaction @relation(fields: [tcxId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([resolutionId])
|
||
@@index([tcxId])
|
||
@@index([resolutionType])
|
||
@@index([status])
|
||
@@map("causal_resolutions")
|
||
}
|
||
|
||
// Volume XIV: Infinite-Layer Identity Engine (ILIE)
|
||
model InfiniteLayerIdentity {
|
||
id String @id @default(uuid())
|
||
identityId String @unique
|
||
sovereignBankId String? // Optional: if entity is an SCB
|
||
entityType String // scb, private_bank, digital_entity, conscious, quantum, simulated, parallel
|
||
entityId String // Reference to entity
|
||
unifiedIdentity String // I∞ = unify(I0, I1, I2, I3, I4, ...)
|
||
identityDrift Decimal @default(0) @db.Decimal(32, 12) // Measured drift
|
||
driftThreshold Decimal @default(0.01) @db.Decimal(32, 12)
|
||
status String @default("active") // active, drift_detected, corrected, suspended
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
lastCorrectionAt DateTime?
|
||
|
||
sovereignBank SovereignBank? @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
layers IdentityLayer[]
|
||
corrections IdentityCorrection[]
|
||
|
||
@@index([identityId])
|
||
@@index([sovereignBankId])
|
||
@@index([entityType])
|
||
@@index([entityId])
|
||
@@index([status])
|
||
@@map("infinite_layer_identities")
|
||
}
|
||
|
||
model IdentityLayer {
|
||
id String @id @default(uuid())
|
||
layerId String @unique
|
||
identityId String
|
||
layerNumber Int // L0, L1, L2, L3, L4, L∞
|
||
layerType String // classical, dlt, quantum, cognitive, simulated, meta
|
||
layerIdentity String // Identity at this layer
|
||
layerMetadata Json? // Layer-specific metadata
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
identity InfiniteLayerIdentity @relation(fields: [identityId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([layerId])
|
||
@@index([identityId])
|
||
@@index([layerNumber])
|
||
@@index([layerType])
|
||
@@map("identity_layers")
|
||
}
|
||
|
||
model IdentityCorrection {
|
||
id String @id @default(uuid())
|
||
correctionId String @unique
|
||
identityId String
|
||
correctionType String // drift_correction, alignment, unification
|
||
beforeState Json // State before correction
|
||
afterState Json // State after correction
|
||
correctionDetails Json? // Correction algorithm details
|
||
status String @default("pending") // pending, applied, failed
|
||
appliedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
identity InfiniteLayerIdentity @relation(fields: [identityId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([correctionId])
|
||
@@index([identityId])
|
||
@@index([status])
|
||
@@map("identity_corrections")
|
||
}
|
||
|
||
// Volume XIV: Sovereign Holographic Anchor System (SHAS)
|
||
model HolographicAnchor {
|
||
id String @id @default(uuid())
|
||
anchorId String @unique
|
||
sovereignBankId String? // Optional: if anchor is for a sovereign
|
||
sovereignId String? // Sovereign identity (alternative reference)
|
||
assetId String? // Asset identity
|
||
anchorType String // sovereign, asset, ledger_state
|
||
encodedAnchor String // H_anchor = ENCODE(...)
|
||
sovereignIdentity Json? // Sovereign identity data
|
||
ledgerState Json? // Ledger state at anchor
|
||
reflectionState Json? // Reflection state
|
||
multiverseAlignment Json? // Multiverse alignment data
|
||
integrityStatus String @default("pending") // pending, verified, failed
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank? @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
integrityChecks AnchorIntegrityCheck[]
|
||
settlements HolographicSettlement[]
|
||
|
||
@@index([anchorId])
|
||
@@index([sovereignBankId])
|
||
@@index([sovereignId])
|
||
@@index([assetId])
|
||
@@index([anchorType])
|
||
@@index([integrityStatus])
|
||
@@map("holographic_anchors")
|
||
}
|
||
|
||
model AnchorIntegrityCheck {
|
||
id String @id @default(uuid())
|
||
checkId String @unique
|
||
anchorId String
|
||
checkType String // identity_verification, settlement_grounding, divergence_protection
|
||
checkResult String // passed, failed, warning
|
||
checkDetails Json? // Detailed check results
|
||
status String @default("pending") // pending, completed
|
||
checkedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
anchor HolographicAnchor @relation(fields: [anchorId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([checkId])
|
||
@@index([anchorId])
|
||
@@index([checkType])
|
||
@@index([checkResult])
|
||
@@map("anchor_integrity_checks")
|
||
}
|
||
|
||
model HolographicSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
anchorId String
|
||
settlementType String // standard, cross_reality, multiverse
|
||
settlementData Json // Settlement details
|
||
holographicCheck Boolean @default(false) // Passed holographic-identity check
|
||
finalityStatus String @default("pending") // pending, verified, finalized
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
anchor HolographicAnchor @relation(fields: [anchorId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([anchorId])
|
||
@@index([finalityStatus])
|
||
@@map("holographic_settlements")
|
||
}
|
||
|
||
// Volume XIV: Reality-Spanning Smart Contract Kernel (RSSCK)
|
||
model RealitySpanningContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
contractHash String // Contract hash
|
||
contractCode Json // Contract code/logic
|
||
dimensions Json // Dimensions contract spans
|
||
timelines Json? // Timeline information
|
||
simulatedLayers Json? // Simulated layer data
|
||
quantumStates Json? // Quantum-entangled contract states
|
||
realityAgreement Boolean @default(false) // all_realities_agree(contract_hash)
|
||
agreementDetails Json? // Agreement status per reality
|
||
status String @default("pending") // pending, agreed, resolving, executed, failed
|
||
executionResult Json? // Execution result
|
||
ossmResolution Json? // OSSM adjudication if needed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
executions ContractExecution[]
|
||
resolutions ContractResolution[]
|
||
|
||
@@index([contractId])
|
||
@@index([contractHash])
|
||
@@index([status])
|
||
@@index([realityAgreement])
|
||
@@map("reality_spanning_contracts")
|
||
}
|
||
|
||
model ContractExecution {
|
||
id String @id @default(uuid())
|
||
executionId String @unique
|
||
contractId String
|
||
executionType String // standard, cross_dimensional, temporal, quantum_entangled
|
||
executionData Json // Execution parameters
|
||
intentProbabilities Json? // Intent probabilities (cognitive layer)
|
||
consciousnessSignatures Json? // Consciousness signatures
|
||
quantumSymmetry Json? // Quantum decision symmetry
|
||
executionResult Json? // Execution result
|
||
status String @default("pending") // pending, executing, completed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contract RealitySpanningContract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([executionId])
|
||
@@index([contractId])
|
||
@@index([status])
|
||
@@map("contract_executions")
|
||
}
|
||
|
||
model ContractResolution {
|
||
id String @id @default(uuid())
|
||
resolutionId String @unique
|
||
contractId String
|
||
resolutionType String // ossm_adjudication, reality_merge, conflict_resolution
|
||
conflictDetails Json? // Conflict information
|
||
resolutionResult Json? // Resolution result
|
||
status String @default("pending") // pending, resolved, failed
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contract RealitySpanningContract @relation(fields: [contractId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([resolutionId])
|
||
@@index([contractId])
|
||
@@index([status])
|
||
@@map("contract_resolutions")
|
||
}
|
||
|
||
// Volume XIV: Superposition-Based Asset Valuation (SBAV)
|
||
model SuperpositionAsset {
|
||
id String @id @default(uuid())
|
||
assetId String @unique
|
||
assetType String // quantum_commodity, parallel_sovereign_bond, infinite_state_reserve
|
||
assetName String
|
||
superpositionStates Json // Multiple simultaneous states
|
||
stateProbabilities Json // Probability for each state
|
||
superposedValue Decimal? @db.Decimal(32, 12) // Σ(state_value[i] * probability[i])
|
||
collapsedValue Decimal? @db.Decimal(32, 12) // Value after collapse
|
||
collapseStatus String @default("superposed") // superposed, collapsing, collapsed
|
||
collapsedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
valuations AssetValuation[]
|
||
reconciliations AssetReconciliation[]
|
||
|
||
@@index([assetId])
|
||
@@index([assetType])
|
||
@@index([collapseStatus])
|
||
@@map("superposition_assets")
|
||
}
|
||
|
||
model AssetValuation {
|
||
id String @id @default(uuid())
|
||
valuationId String @unique
|
||
assetId String
|
||
stateIndex Int? // Which state in superposition
|
||
stateValue Decimal @db.Decimal(32, 12)
|
||
probability Decimal @db.Decimal(32, 12) // probability[i]
|
||
weightedValue Decimal @db.Decimal(32, 12) // state_value[i] * probability[i]
|
||
valuationTime DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
asset SuperpositionAsset @relation(fields: [assetId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([valuationId])
|
||
@@index([assetId])
|
||
@@index([stateIndex])
|
||
@@map("asset_valuations")
|
||
}
|
||
|
||
model AssetReconciliation {
|
||
id String @id @default(uuid())
|
||
reconciliationId String @unique
|
||
assetId String
|
||
reconciliationType String // parallel_branch, quantum_state, holographic_projection
|
||
beforeState Json // State before reconciliation
|
||
afterState Json // State after reconciliation
|
||
reconciliationDetails Json? // Reconciliation algorithm
|
||
status String @default("pending") // pending, reconciled, failed
|
||
reconciledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
asset SuperpositionAsset @relation(fields: [assetId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reconciliationId])
|
||
@@index([assetId])
|
||
@@index([status])
|
||
@@map("asset_reconciliations")
|
||
}
|
||
|
||
// Volume XIV: DBIS Economic Entanglement Index (EEI)
|
||
model EconomicEntanglement {
|
||
id String @id @default(uuid())
|
||
entanglementId String @unique
|
||
measurementTime DateTime @default(now())
|
||
cohesionFactor Decimal @db.Decimal(32, 12)
|
||
divergencePressure Decimal @db.Decimal(32, 12)
|
||
quantumResonance Decimal @db.Decimal(32, 12)
|
||
eeiValue Decimal @db.Decimal(32, 12) // cohesion_factor - divergence_pressure + quantum_resonance
|
||
stabilityLevel String // low, medium, high, very_high
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
measurements EntanglementMeasurement[]
|
||
|
||
@@index([entanglementId])
|
||
@@index([measurementTime])
|
||
@@index([eeiValue])
|
||
@@index([stabilityLevel])
|
||
@@map("economic_entanglements")
|
||
}
|
||
|
||
model EntanglementMeasurement {
|
||
id String @id @default(uuid())
|
||
measurementId String @unique
|
||
entanglementId String
|
||
measurementType String // cohesion, divergence, quantum_resonance
|
||
measurementValue Decimal @db.Decimal(32, 12)
|
||
measurementDetails Json? // Measurement details
|
||
measuredAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entanglement EconomicEntanglement @relation(fields: [entanglementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([measurementId])
|
||
@@index([entanglementId])
|
||
@@index([measurementType])
|
||
@@map("entanglement_measurements")
|
||
}
|
||
|
||
// Volume XIV: Unified Pan-Reality Monetary Fabric (UPRMF)
|
||
model PanRealityMonetaryFabric {
|
||
id String @id @default(uuid())
|
||
fabricId String @unique
|
||
fabricVersion String @default("1.0")
|
||
ummcState Json? // UMMC state
|
||
omegaLsfState Json? // Ω-LSF state
|
||
hsmnState Json? // HSMN state (if exists)
|
||
tcmpState Json? // TCMP state
|
||
ilieState Json? // ILIE state
|
||
mergedState Json? // MERGE(UMMC, Ω-LSF, HSMN, TCMP, ILIE)
|
||
crossDimensionalAlignment Boolean @default(false)
|
||
temporalIntegrity Boolean @default(false)
|
||
quantumCoherence Boolean @default(false)
|
||
holographicHarmony Boolean @default(false)
|
||
sovereignContinuity Boolean @default(false)
|
||
overallStatus String @default("initializing") // initializing, aligned, coherent, operational
|
||
lastMergeAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
alignments FabricAlignment[]
|
||
integrityChecks FabricIntegrityCheck[]
|
||
|
||
@@index([fabricId])
|
||
@@index([overallStatus])
|
||
@@map("pan_reality_monetary_fabric")
|
||
}
|
||
|
||
model FabricAlignment {
|
||
id String @id @default(uuid())
|
||
alignmentId String @unique
|
||
fabricId String
|
||
alignmentType String // cross_dimensional, temporal, quantum, holographic, sovereign
|
||
alignmentStatus String // pending, aligned, misaligned, corrected
|
||
alignmentDetails Json? // Alignment details
|
||
correctedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
fabric PanRealityMonetaryFabric @relation(fields: [fabricId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([alignmentId])
|
||
@@index([fabricId])
|
||
@@index([alignmentType])
|
||
@@index([alignmentStatus])
|
||
@@map("fabric_alignments")
|
||
}
|
||
|
||
model FabricIntegrityCheck {
|
||
id String @id @default(uuid())
|
||
checkId String @unique
|
||
fabricId String
|
||
checkType String // cross_dimensional, temporal, quantum_coherence, holographic, sovereign_continuity
|
||
checkResult String // passed, failed, warning
|
||
checkDetails Json? // Detailed check results
|
||
status String @default("pending") // pending, completed
|
||
checkedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
fabric PanRealityMonetaryFabric @relation(fields: [fabricId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([checkId])
|
||
@@index([fabricId])
|
||
@@index([checkType])
|
||
@@index([checkResult])
|
||
@@map("fabric_integrity_checks")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume XIII: Hyper-Sovereign Monetary Nexus, Dimensional Arbitrage Engine, Temporal-Multiversal FX Parity, Conscious-Ledger Integration, and Singularity-Grade Liquidity Systems
|
||
// ============================================================================
|
||
|
||
// ============================================================================
|
||
// Volume XIII: Hyper-Sovereign Monetary Nexus (HSMN)
|
||
// ============================================================================
|
||
|
||
model HsmnNexusLayer {
|
||
id String @id @default(uuid())
|
||
nexusId String @unique
|
||
layerNumber Int // 0=Prime, 1=Multiversal, 2=Temporal, 3=Consciousness, 4=Quantum
|
||
layerName String
|
||
description String @db.Text
|
||
anchorValue Decimal? @db.Decimal(32, 12)
|
||
stabilityIndex Decimal? @db.Decimal(32, 12)
|
||
status String @default("active") // active, suspended, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignMappings HsmnSovereignMapping[]
|
||
realityStates HsmnRealityState[]
|
||
bindingLaws HsmnBindingLaw[]
|
||
|
||
@@index([nexusId])
|
||
@@index([layerNumber])
|
||
@@index([status])
|
||
@@map("hsmn_nexus_layers")
|
||
}
|
||
|
||
model HsmnSovereignMapping {
|
||
id String @id @default(uuid())
|
||
mappingId String @unique
|
||
nexusLayerId String
|
||
sovereignBankId String
|
||
realityBranch String? // For HS1 (Multiversal)
|
||
parallelState String? // For HS1 (Multiversal)
|
||
identityHash String
|
||
bindingStatus String @default("bound") // bound, unbound, pending
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
nexusLayer HsmnNexusLayer @relation(fields: [nexusLayerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([mappingId])
|
||
@@index([nexusLayerId])
|
||
@@index([sovereignBankId])
|
||
@@index([realityBranch])
|
||
@@index([identityHash])
|
||
@@index([status])
|
||
@@map("hsmn_sovereign_mappings")
|
||
}
|
||
|
||
model HsmnRealityState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
nexusLayerId String
|
||
sovereignBankId String
|
||
realityType String // temporal, consciousness, quantum
|
||
timeline String? // For temporal states
|
||
stateData Json // State-specific data
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
nexusLayer HsmnNexusLayer @relation(fields: [nexusLayerId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([stateId])
|
||
@@index([nexusLayerId])
|
||
@@index([sovereignBankId])
|
||
@@index([realityType])
|
||
@@index([status])
|
||
@@map("hsmn_reality_states")
|
||
}
|
||
|
||
model HsmnBindingLaw {
|
||
id String @id @default(uuid())
|
||
bindingId String @unique
|
||
sovereignBankId String
|
||
identityHash String
|
||
unified Boolean @default(false)
|
||
identityInvariant Boolean @default(false)
|
||
ledgerTruth Boolean @default(false)
|
||
temporalConsistency Boolean @default(false)
|
||
quantumCoherence Boolean @default(false)
|
||
status String @default("unbound") // bound, unbound, pending
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([bindingId])
|
||
@@index([sovereignBankId])
|
||
@@index([identityHash])
|
||
@@index([status])
|
||
@@map("hsmn_binding_laws")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XIII: Unified Dimensional Arbitrage Engine (UDAE)
|
||
// ============================================================================
|
||
|
||
model DimensionalArbitrage {
|
||
id String @id @default(uuid())
|
||
arbitrageId String @unique
|
||
dimension String
|
||
timeline String?
|
||
parallelBranch String?
|
||
quantumState String?
|
||
simulatedEconomy String?
|
||
classicalPrice Decimal @db.Decimal(32, 12)
|
||
quantumExpectedPrice Decimal @db.Decimal(32, 12)
|
||
parallelStateDivergence Decimal @db.Decimal(32, 12)
|
||
holographicProjectionAdjustment Decimal @db.Decimal(32, 12)
|
||
arbitrageDelta Decimal @db.Decimal(32, 12)
|
||
tolerance Decimal @db.Decimal(32, 12)
|
||
requiresRebalance Boolean @default(false)
|
||
status String @default("calculated") // calculated, compressed, rebalanced
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
rebalances DimensionalRebalance[]
|
||
|
||
@@index([arbitrageId])
|
||
@@index([dimension])
|
||
@@index([status])
|
||
@@index([requiresRebalance])
|
||
@@map("dimensional_arbitrage")
|
||
}
|
||
|
||
model DimensionalRebalance {
|
||
id String @id @default(uuid())
|
||
rebalanceId String @unique
|
||
arbitrageId String
|
||
adjustmentAmount Decimal @db.Decimal(32, 12)
|
||
dimension String?
|
||
timeline String?
|
||
parallelBranch String?
|
||
quantumState String?
|
||
status String @default("executed") // executed, pending, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
arbitrage DimensionalArbitrage @relation(fields: [arbitrageId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([rebalanceId])
|
||
@@index([arbitrageId])
|
||
@@index([status])
|
||
@@map("dimensional_rebalance")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XIII: Temporal-Multiversal FX Parity Law (TMFPL)
|
||
// ============================================================================
|
||
|
||
model TemporalFxParity {
|
||
id String @id @default(uuid())
|
||
parityId String @unique
|
||
currencyPair String
|
||
spotRate Decimal @db.Decimal(32, 12)
|
||
temporalSmoothing Decimal @db.Decimal(32, 12)
|
||
parallelArbitrage Decimal @db.Decimal(32, 12)
|
||
ssuAnchor Decimal @db.Decimal(32, 12)
|
||
gqlResonance Decimal @db.Decimal(32, 12)
|
||
calculatedParity Decimal @db.Decimal(32, 12)
|
||
divergence Decimal @db.Decimal(32, 12)
|
||
requiresCorrection Boolean @default(false)
|
||
status String @default("calculated") // calculated, corrected, monitoring
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
corrections TemporalCorrection[]
|
||
divergences ParityDivergence[]
|
||
|
||
@@index([parityId])
|
||
@@index([currencyPair])
|
||
@@index([status])
|
||
@@index([requiresCorrection])
|
||
@@map("temporal_fx_parity")
|
||
}
|
||
|
||
model TemporalCorrection {
|
||
id String @id @default(uuid())
|
||
correctionId String @unique
|
||
parityId String
|
||
correctionAmount Decimal @db.Decimal(32, 12)
|
||
correctedParity Decimal @db.Decimal(32, 12)
|
||
currencyPair String
|
||
status String @default("applied") // applied, pending, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
parity TemporalFxParity @relation(fields: [parityId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([correctionId])
|
||
@@index([parityId])
|
||
@@index([status])
|
||
@@map("temporal_corrections")
|
||
}
|
||
|
||
model ParityDivergence {
|
||
id String @id @default(uuid())
|
||
divergenceId String @unique
|
||
parityId String
|
||
divergenceAmount Decimal @db.Decimal(32, 12)
|
||
severity String // warning, critical
|
||
status String @default("detected") // detected, resolved, monitoring
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
parity TemporalFxParity @relation(fields: [parityId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([divergenceId])
|
||
@@index([parityId])
|
||
@@index([severity])
|
||
@@index([status])
|
||
@@map("parity_divergences")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XIII: DBIS Conscious-Ledger Integration Model (CLIM)
|
||
// ============================================================================
|
||
|
||
model ConsciousnessState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
agentId String
|
||
stateHash String
|
||
cognitiveIntent String @db.Text
|
||
transactionHistory String[] // Array of transaction IDs
|
||
sovereignBehaviorField String @db.Text
|
||
influenceLevel Decimal @db.Decimal(32, 12)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
contracts CognitiveContract[]
|
||
|
||
@@index([stateId])
|
||
@@index([agentId])
|
||
@@index([stateHash])
|
||
@@index([status])
|
||
@@map("consciousness_states")
|
||
}
|
||
|
||
model CognitiveContract {
|
||
id String @id @default(uuid())
|
||
contractId String @unique
|
||
stateId String
|
||
threshold Decimal @db.Decimal(32, 12)
|
||
action String @db.Text
|
||
parameters Json?
|
||
cognitiveAlignment Decimal @db.Decimal(32, 12)
|
||
executionStatus String @default("pending_execution") // pending_execution, executed, delayed, rejected
|
||
executedAt DateTime?
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
state ConsciousnessState @relation(fields: [stateId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([contractId])
|
||
@@index([stateId])
|
||
@@index([executionStatus])
|
||
@@index([status])
|
||
@@map("cognitive_contracts")
|
||
}
|
||
|
||
model BehavioralField {
|
||
id String @id @default(uuid())
|
||
fieldId String @unique
|
||
sovereignBankId String
|
||
fieldData Json
|
||
influenceScore Decimal @db.Decimal(32, 12)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([fieldId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("behavioral_fields")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XIII: Singularity-Grade Liquidity Engine (SGLE)
|
||
// ============================================================================
|
||
|
||
model SingularityLiquidity {
|
||
id String @id @default(uuid())
|
||
liquidityId String @unique
|
||
generationId String?
|
||
gapId String?
|
||
liquidityAmount Decimal @db.Decimal(32, 12)
|
||
generationType String // manual, auto
|
||
conservationLimit Decimal? @db.Decimal(32, 12)
|
||
withinLimits Boolean @default(true)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gap LiquidityGap? @relation(fields: [gapId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([liquidityId])
|
||
@@index([generationId])
|
||
@@index([gapId])
|
||
@@index([status])
|
||
@@map("singularity_liquidity")
|
||
}
|
||
|
||
model LiquidityProjection {
|
||
id String @id @default(uuid())
|
||
projectionId String @unique
|
||
qpuPrediction Decimal @db.Decimal(32, 12)
|
||
multiversalReserveStrength Decimal @db.Decimal(32, 12)
|
||
consciousnessAlignmentFactor Decimal @db.Decimal(32, 12)
|
||
futureLiquidity Decimal @db.Decimal(32, 12)
|
||
currentLiquidity Decimal @db.Decimal(32, 12)
|
||
liquidityGap Decimal @db.Decimal(32, 12)
|
||
timeHorizon Int // in seconds
|
||
sufficiency Boolean @default(false)
|
||
status String @default("calculated") // calculated, updated, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gaps LiquidityGap[]
|
||
|
||
@@index([projectionId])
|
||
@@index([status])
|
||
@@index([sufficiency])
|
||
@@map("liquidity_projections")
|
||
}
|
||
|
||
model LiquidityGap {
|
||
id String @id @default(uuid())
|
||
gapId String @unique
|
||
projectionId String
|
||
gapAmount Decimal @db.Decimal(32, 12)
|
||
status String @default("detected") // detected, addressed, resolved
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
projection LiquidityProjection @relation(fields: [projectionId], references: [id], onDelete: Cascade)
|
||
liquidity SingularityLiquidity?
|
||
|
||
@@index([gapId])
|
||
@@index([projectionId])
|
||
@@index([status])
|
||
@@map("liquidity_gaps")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XIII: Meta-Reality Economic Convergence Protocol (MRECP)
|
||
// ============================================================================
|
||
|
||
model RealityConvergence {
|
||
id String @id @default(uuid())
|
||
convergenceId String @unique
|
||
realityDivergence Decimal @db.Decimal(32, 12)
|
||
sovereignAlignment Decimal @db.Decimal(32, 12)
|
||
fxStability Decimal @db.Decimal(32, 12)
|
||
ssuStability Decimal @db.Decimal(32, 12)
|
||
cbdcStability Decimal @db.Decimal(32, 12)
|
||
convergence Decimal @db.Decimal(32, 12)
|
||
stable Boolean @default(false)
|
||
status String @default("calculated") // calculated, harmonized, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
harmonizations EconomicHarmonization[]
|
||
divergences RealityDivergence[]
|
||
|
||
@@index([convergenceId])
|
||
@@index([status])
|
||
@@index([stable])
|
||
@@map("reality_convergence")
|
||
}
|
||
|
||
model EconomicHarmonization {
|
||
id String @id @default(uuid())
|
||
harmonizationId String @unique
|
||
convergenceId String?
|
||
adjustmentAmount Decimal @db.Decimal(32, 12)
|
||
status String @default("applied") // applied, pending, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
convergence RealityConvergence? @relation(fields: [convergenceId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([harmonizationId])
|
||
@@index([convergenceId])
|
||
@@index([status])
|
||
@@map("economic_harmonizations")
|
||
}
|
||
|
||
model RealityDivergence {
|
||
id String @id @default(uuid())
|
||
divergenceId String @unique
|
||
convergenceId String?
|
||
realityId String
|
||
divergenceAmount Decimal @db.Decimal(32, 12)
|
||
status String @default("active") // active, minimized, resolved
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
convergence RealityConvergence? @relation(fields: [convergenceId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([divergenceId])
|
||
@@index([convergenceId])
|
||
@@index([realityId])
|
||
@@index([status])
|
||
@@map("reality_divergences")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Volume XIII: Prime-Reality Oversight Engine (PROE)
|
||
// ============================================================================
|
||
|
||
model PrimeRealityDeviation {
|
||
id String @id @default(uuid())
|
||
deviationId String @unique
|
||
realityType String // parallel, quantum, temporal, simulated
|
||
realityId String
|
||
primeRealityState Decimal @db.Decimal(32, 12)
|
||
alternateRealityState Decimal @db.Decimal(32, 12)
|
||
deviationAmount Decimal @db.Decimal(32, 12)
|
||
threshold Decimal @db.Decimal(32, 12)
|
||
exceedsThreshold Boolean @default(false)
|
||
requiresAlignment Boolean @default(false)
|
||
status String @default("detected") // detected, aligned, monitoring
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
alignments AlignmentEnforcement[]
|
||
|
||
@@index([deviationId])
|
||
@@index([realityType])
|
||
@@index([realityId])
|
||
@@index([status])
|
||
@@index([requiresAlignment])
|
||
@@map("prime_reality_deviations")
|
||
}
|
||
|
||
model AlignmentEnforcement {
|
||
id String @id @default(uuid())
|
||
alignmentId String @unique
|
||
deviationId String
|
||
adjustmentAmount Decimal @db.Decimal(32, 12)
|
||
aligned Boolean @default(false)
|
||
status String @default("enforced") // enforced, pending, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
deviation PrimeRealityDeviation @relation(fields: [deviationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([alignmentId])
|
||
@@index([deviationId])
|
||
@@index([status])
|
||
@@map("alignment_enforcements")
|
||
}
|
||
|
||
model RealityState {
|
||
id String @id @default(uuid())
|
||
realityId String @unique
|
||
realityType String // prime, parallel, quantum, temporal, simulated
|
||
stateData Json
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([realityId])
|
||
@@index([realityType])
|
||
@@index([status])
|
||
@@map("reality_states")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Special Sub-Volumes
|
||
// ============================================================================
|
||
|
||
// Sub-Volume A: Global Atomic Settlements (GAS) Network
|
||
|
||
model GasSettlement {
|
||
id String @id @default(uuid())
|
||
gasSettlementId String @unique
|
||
settlementId String? // Reference to AtomicSettlement
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String
|
||
networkType String // classical, cbdc, commodity, security, quantum, multiversal
|
||
commitmentHash String
|
||
routeId String?
|
||
routingEngine String? // sire, caso, arifx, hybrid
|
||
fxCommit String?
|
||
assetCommit String?
|
||
temporalState String?
|
||
dimensionalAlignment Decimal? @db.Decimal(32, 8)
|
||
settlementTime Int? // Milliseconds
|
||
status String @default("pending") // pending, settled, failed
|
||
allCommitsMatched Boolean @default(false)
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
commitment GasCommitment?
|
||
routingDecision GasRoutingDecision? @relation("GasSettlementRouting", fields: [routeId], references: [routeId], onDelete: SetNull)
|
||
|
||
@@index([gasSettlementId])
|
||
@@index([settlementId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([networkType])
|
||
@@index([status])
|
||
@@index([allCommitsMatched])
|
||
@@map("gas_settlements")
|
||
}
|
||
|
||
model GasCommitment {
|
||
id String @id @default(uuid())
|
||
commitmentId String @unique
|
||
gasSettlementId String? @unique
|
||
settlementId String
|
||
scbCommit String
|
||
dbisCommit String
|
||
fxCommit String?
|
||
assetCommit String?
|
||
temporalState String?
|
||
commitmentHash String
|
||
status String @default("pending") // pending, verified, failed
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gasSettlement GasSettlement? @relation(fields: [gasSettlementId], references: [gasSettlementId], onDelete: SetNull)
|
||
|
||
@@index([commitmentId])
|
||
@@index([settlementId])
|
||
@@index([gasSettlementId])
|
||
@@index([status])
|
||
@@map("gas_commitments")
|
||
}
|
||
|
||
model GasRoutingDecision {
|
||
id String @id @default(uuid())
|
||
routeId String @unique
|
||
settlementId String?
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String
|
||
networkType String // classical, cbdc, commodity, security, quantum, multiversal
|
||
routingEngine String // sire, caso, arifx, hybrid
|
||
optimalRoute Json // Calculated optimal route
|
||
cost Decimal @db.Decimal(32, 12)
|
||
latency Int // Milliseconds
|
||
dimensionalAlignment Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, applied, expired
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gasSettlements GasSettlement[] @relation("GasSettlementRouting")
|
||
|
||
@@index([routeId])
|
||
@@index([settlementId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([networkType])
|
||
@@index([routingEngine])
|
||
@@index([status])
|
||
@@map("gas_routing_decisions")
|
||
}
|
||
|
||
// Sub-Volume B: Global Reserve Unit (GRU) Integration
|
||
|
||
model GruUnit {
|
||
id String @id @default(uuid())
|
||
gruUnitId String @unique
|
||
sovereignBankId String
|
||
unitType String // M00, M0, M1
|
||
amount Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, locked, redeemed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bonds GruBond[]
|
||
triangulations GruTriangulation[]
|
||
|
||
@@index([gruUnitId])
|
||
@@index([sovereignBankId])
|
||
@@index([unitType])
|
||
@@index([status])
|
||
@@map("gru_units")
|
||
}
|
||
|
||
model GruConversion {
|
||
id String @id @default(uuid())
|
||
conversionId String @unique
|
||
sourceAmount Decimal @db.Decimal(32, 8)
|
||
sourceType String // M00, M0, M1
|
||
targetAmount Decimal @db.Decimal(32, 8)
|
||
targetType String // M00, M0, M1
|
||
conversionRate Decimal @db.Decimal(32, 12)
|
||
status String @default("completed") // completed, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([conversionId])
|
||
@@index([sourceType])
|
||
@@index([targetType])
|
||
@@index([status])
|
||
@@map("gru_conversions")
|
||
}
|
||
|
||
model GruComposition {
|
||
id String @id @default(uuid())
|
||
compositionId String @unique
|
||
m00Amount Decimal @db.Decimal(32, 8)
|
||
m0Amount Decimal @db.Decimal(32, 8)
|
||
m1Amount Decimal @db.Decimal(32, 8)
|
||
totalM00Equivalent Decimal @db.Decimal(32, 8)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([compositionId])
|
||
@@index([status])
|
||
@@map("gru_compositions")
|
||
}
|
||
|
||
model GruTriangulation {
|
||
id String @id @default(uuid())
|
||
triangulationId String @unique
|
||
gruUnitId String
|
||
gruAmount Decimal @db.Decimal(32, 8)
|
||
gruType String // M00, M0, M1
|
||
xauValue Decimal @db.Decimal(32, 8) // Value in XAU (gold)
|
||
targetValue Decimal @db.Decimal(32, 8)
|
||
targetAssetType String // fiat, commodity, cbdc, tokenized
|
||
targetCurrencyCode String?
|
||
targetCommodityType String?
|
||
triangulationRate Decimal @db.Decimal(32, 12)
|
||
status String @default("completed")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gruUnit GruUnit @relation(fields: [gruUnitId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([triangulationId])
|
||
@@index([gruUnitId])
|
||
@@index([targetAssetType])
|
||
@@index([status])
|
||
@@map("gru_triangulations")
|
||
}
|
||
|
||
model GruBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
bondType String // Li99PpOsB10, Li99PpAvB10
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
gruUnitId String
|
||
sovereignBankId String
|
||
maturityDate DateTime
|
||
interestRate Decimal @db.Decimal(32, 8)
|
||
couponRate Decimal @db.Decimal(32, 8)
|
||
finalValue Decimal? @db.Decimal(32, 8)
|
||
status String @default("active") // active, redeemed, defaulted
|
||
issuedAt DateTime @default(now())
|
||
redeemedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gruUnit GruUnit @relation(fields: [gruUnitId], references: [id], onDelete: Cascade)
|
||
coupons GruBondCoupon[]
|
||
stressTests GruBondStressTest[]
|
||
// Volume III relations
|
||
syntheticBonds SyntheticGruBond[] @relation("SyntheticGruBondToGruBond")
|
||
settlements GruBondSettlement[] @relation("GruBondSettlementToGruBond")
|
||
pricing GruBondPricing[] @relation("GruBondPricingToGruBond")
|
||
pricingHistory BondPricingHistory[] @relation("BondPricingHistoryToGruBond")
|
||
riskAssessments BondRiskAssessment[] @relation("BondRiskAssessmentToGruBond")
|
||
|
||
@@index([bondId])
|
||
@@index([bondType])
|
||
@@index([gruUnitId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("gru_bonds")
|
||
}
|
||
|
||
model GruBondCoupon {
|
||
id String @id @default(uuid())
|
||
paymentId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
paymentDate DateTime
|
||
status String @default("paid") // paid, pending, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond GruBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([paymentId])
|
||
@@index([bondId])
|
||
@@index([status])
|
||
@@map("gru_bond_coupons")
|
||
}
|
||
|
||
model GruLiquidityLoop {
|
||
id String @id @default(uuid())
|
||
loopId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
initialAmount Decimal @db.Decimal(32, 8)
|
||
targetAmount Decimal @db.Decimal(32, 8)
|
||
targetNetValue Decimal @db.Decimal(32, 8)
|
||
currentAmount Decimal? @db.Decimal(32, 8)
|
||
currentNetValue Decimal? @db.Decimal(32, 8)
|
||
finalAmount Decimal? @db.Decimal(32, 8)
|
||
finalNetValue Decimal? @db.Decimal(32, 8)
|
||
iterations Int @default(0)
|
||
targetReached Boolean @default(false)
|
||
lastTransactionId String?
|
||
status String @default("running") // running, completed, max_iterations_reached, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([loopId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@map("gru_liquidity_loops")
|
||
}
|
||
|
||
// GRU Masterbook: Index System (LiXAU, LiPMG, LiBMG1-3)
|
||
|
||
model GruIndex {
|
||
id String @id @default(uuid())
|
||
indexId String @unique
|
||
indexCode String @unique // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
indexName String
|
||
description String @db.Text
|
||
baseValue Decimal @db.Decimal(32, 12)
|
||
currentValue Decimal @db.Decimal(32, 12)
|
||
calculationMethod String // xau_based, pgm_based, bmg_weighted
|
||
weightings Json? // Weightings for composite indexes
|
||
updateFrequency String @default("real_time") // real_time, hourly, daily
|
||
status String @default("active") // active, suspended
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
priceHistory GruIndexPriceHistory[]
|
||
|
||
@@index([indexId])
|
||
@@index([indexCode])
|
||
@@index([status])
|
||
@@index([lastUpdated])
|
||
@@map("gru_indexes")
|
||
}
|
||
|
||
model GruIndexPriceHistory {
|
||
id String @id @default(uuid())
|
||
historyId String @unique
|
||
indexId String
|
||
indexCode String
|
||
indexValue Decimal @db.Decimal(32, 12)
|
||
changePercent Decimal? @db.Decimal(32, 8)
|
||
volume Decimal? @db.Decimal(32, 8)
|
||
metadata Json? // Additional calculation details
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
|
||
index GruIndex @relation(fields: [indexId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([historyId])
|
||
@@index([indexId])
|
||
@@index([indexCode])
|
||
@@index([timestamp])
|
||
@@map("gru_index_price_history")
|
||
}
|
||
|
||
// GRU Masterbook: Derivatives & Futures Market
|
||
|
||
model GruDerivative {
|
||
id String @id @default(uuid())
|
||
derivativeId String @unique
|
||
derivativeType String // spot, futures, swap, option
|
||
instrumentType String // GRU_SPOT, GRU_FUTURES, GRU_SWAP, GRU_OPTION
|
||
sovereignBankId String
|
||
counterpartyBankId String?
|
||
notionalAmount Decimal @db.Decimal(32, 8)
|
||
contractPrice Decimal @db.Decimal(32, 12)
|
||
markToMarket Decimal? @db.Decimal(32, 12)
|
||
settlementCurrency String
|
||
status String @default("active") // active, expired, settled, closed
|
||
contractDate DateTime @default(now())
|
||
expirationDate DateTime?
|
||
settlementDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
futuresContract GruFuturesContract?
|
||
swap GruSwap?
|
||
option GruOption?
|
||
|
||
@@index([derivativeId])
|
||
@@index([derivativeType])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@index([expirationDate])
|
||
@@map("gru_derivatives")
|
||
}
|
||
|
||
model GruFuturesContract {
|
||
id String @id @default(uuid())
|
||
futuresId String @unique
|
||
derivativeId String @unique
|
||
contractType String // front_month, quarterly, annual
|
||
marginClass String // GRF-A, GRF-B, GRF-C
|
||
marginRequirement Decimal @db.Decimal(32, 8)
|
||
maintenanceMargin Decimal @db.Decimal(32, 8)
|
||
initialMargin Decimal @db.Decimal(32, 8)
|
||
contractSize Decimal @db.Decimal(32, 8)
|
||
tickSize Decimal @db.Decimal(32, 12)
|
||
settlementPrice Decimal? @db.Decimal(32, 12)
|
||
lastPrice Decimal? @db.Decimal(32, 12)
|
||
openInterest Decimal? @db.Decimal(32, 8)
|
||
volume Decimal? @db.Decimal(32, 8)
|
||
deliveryDate DateTime
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
derivative GruDerivative @relation(fields: [derivativeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([futuresId])
|
||
@@index([derivativeId])
|
||
@@index([marginClass])
|
||
@@index([deliveryDate])
|
||
@@map("gru_futures_contracts")
|
||
}
|
||
|
||
model GruSwap {
|
||
id String @id @default(uuid())
|
||
swapId String @unique
|
||
derivativeId String @unique
|
||
swapType String // GRU_USD, GRU_XAU, GRU_SSU
|
||
fixedRate Decimal @db.Decimal(32, 12)
|
||
floatingRateIndex String
|
||
paymentFrequency String // daily, weekly, monthly, quarterly, annually
|
||
notionalAmount Decimal @db.Decimal(32, 8)
|
||
nextPaymentDate DateTime
|
||
maturityDate DateTime
|
||
lastResetDate DateTime?
|
||
accruedInterest Decimal? @db.Decimal(32, 8)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
derivative GruDerivative @relation(fields: [derivativeId], references: [id], onDelete: Cascade)
|
||
payments GruSwapPayment[]
|
||
|
||
@@index([swapId])
|
||
@@index([derivativeId])
|
||
@@index([swapType])
|
||
@@index([maturityDate])
|
||
@@map("gru_swaps")
|
||
}
|
||
|
||
model GruSwapPayment {
|
||
id String @id @default(uuid())
|
||
paymentId String @unique
|
||
swapId String
|
||
paymentDate DateTime
|
||
paymentAmount Decimal @db.Decimal(32, 8)
|
||
fixedLegAmount Decimal @db.Decimal(32, 8)
|
||
floatingLegAmount Decimal @db.Decimal(32, 8)
|
||
netAmount Decimal @db.Decimal(32, 8)
|
||
status String @default("pending") // pending, paid, failed
|
||
paidAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
swap GruSwap @relation(fields: [swapId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([paymentId])
|
||
@@index([swapId])
|
||
@@index([paymentDate])
|
||
@@index([status])
|
||
@@map("gru_swap_payments")
|
||
}
|
||
|
||
model GruOption {
|
||
id String @id @default(uuid())
|
||
optionId String @unique
|
||
derivativeId String @unique
|
||
optionType String // call, put
|
||
underlyingIndex String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
strikePrice Decimal @db.Decimal(32, 12)
|
||
premium Decimal @db.Decimal(32, 12)
|
||
expirationDate DateTime
|
||
exerciseType String // american, european
|
||
settlementType String // physical, cash
|
||
settlementCurrency String
|
||
quantity Decimal @db.Decimal(32, 8)
|
||
intrinsicValue Decimal? @db.Decimal(32, 12)
|
||
timeValue Decimal? @db.Decimal(32, 12)
|
||
delta Decimal? @db.Decimal(32, 12)
|
||
gamma Decimal? @db.Decimal(32, 12)
|
||
theta Decimal? @db.Decimal(32, 12)
|
||
vega Decimal? @db.Decimal(32, 12)
|
||
exercisedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
derivative GruDerivative @relation(fields: [derivativeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([optionId])
|
||
@@index([derivativeId])
|
||
@@index([underlyingIndex])
|
||
@@index([expirationDate])
|
||
@@map("gru_options")
|
||
}
|
||
|
||
model GruYieldCurve {
|
||
id String @id @default(uuid())
|
||
curveId String @unique
|
||
curveType String // sovereign, synthetic, bond_implied
|
||
curveName String
|
||
effectiveDate DateTime @default(now())
|
||
maturityPoints Json // Array of { maturity, yield }
|
||
interpolationMethod String @default("linear") // linear, cubic, spline
|
||
status String @default("active") // active, historical
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
points GruYieldCurvePoint[]
|
||
|
||
@@index([curveId])
|
||
@@index([curveType])
|
||
@@index([effectiveDate])
|
||
@@index([status])
|
||
@@map("gru_yield_curves")
|
||
}
|
||
|
||
model GruYieldCurvePoint {
|
||
id String @id @default(uuid())
|
||
pointId String @unique
|
||
curveId String
|
||
maturityMonths Int // Maturity in months
|
||
yield Decimal @db.Decimal(32, 12)
|
||
discountFactor Decimal? @db.Decimal(32, 12)
|
||
forwardRate Decimal? @db.Decimal(32, 12)
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
|
||
curve GruYieldCurve @relation(fields: [curveId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([pointId])
|
||
@@index([curveId])
|
||
@@index([maturityMonths])
|
||
@@map("gru_yield_curve_points")
|
||
}
|
||
|
||
// GRU Masterbook: Legal Framework & Issuance Standards
|
||
|
||
model GruIssuance {
|
||
id String @id @default(uuid())
|
||
issuanceId String @unique
|
||
gruUnitId String
|
||
sovereignBankId String
|
||
issuanceClass String // Class_I, Class_II, Class_III, Class_IV
|
||
issuanceType String // sovereign_grade, institutional_grade, commercial, observational
|
||
amount Decimal @db.Decimal(32, 8)
|
||
unitType String // M00, M0, M1
|
||
metalIndexLink String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
xauTriangulationAuditId String?
|
||
indexSignatureConsistency Boolean @default(false)
|
||
registrarOfficeId String
|
||
// Volume II: Supranational fields
|
||
supranationalEntityId String?
|
||
reserveClass String? // SR-1, SR-2, SR-3
|
||
regulatoryClass String? // SR-1, SR-2, SR-3, M0, M1 (from GRU Institutional Whitepaper)
|
||
eligibilityStatus String? // eligible, pending_review, ineligible
|
||
smiaCompliance Boolean @default(false) // Sovereign Monetary Instruments Act compliance
|
||
ilieCompliance Boolean @default(false) // ILIE (causality-stable sovereign identity) compliance
|
||
status String @default("pending") // pending, approved, issued, suspended, revoked
|
||
issuedAt DateTime?
|
||
approvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entity SupranationalEntity? @relation(fields: [supranationalEntityId], references: [id], onDelete: SetNull)
|
||
legalRegistrations GruLegalRegistration[]
|
||
audits GruIssuanceAudit[]
|
||
complianceRecords GruComplianceRecord[]
|
||
allocation GruAllocationRecord?
|
||
settlementPipeline GruSettlementPipeline?
|
||
|
||
@@index([issuanceId])
|
||
@@index([sovereignBankId])
|
||
@@index([issuanceClass])
|
||
@@index([status])
|
||
@@index([metalIndexLink])
|
||
@@index([supranationalEntityId])
|
||
@@index([reserveClass])
|
||
@@index([regulatoryClass])
|
||
@@map("gru_issuances")
|
||
}
|
||
|
||
model GruLegalRegistration {
|
||
id String @id @default(uuid())
|
||
registrationId String @unique
|
||
issuanceId String
|
||
registrationType String // ISIN, CUSIP, QTID
|
||
registrationCode String @unique
|
||
checkDigit String?
|
||
registrationDate DateTime @default(now())
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
issuance GruIssuance @relation(fields: [issuanceId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([registrationId])
|
||
@@index([issuanceId])
|
||
@@index([registrationType])
|
||
@@index([registrationCode])
|
||
@@map("gru_legal_registrations")
|
||
}
|
||
|
||
model GruIssuanceAudit {
|
||
id String @id @default(uuid())
|
||
auditId String @unique
|
||
issuanceId String
|
||
auditType String // xau_triangulation, index_signature, metal_link_verification
|
||
auditResult String // passed, failed, warning
|
||
auditDetails Json? // Detailed audit results
|
||
auditorId String
|
||
auditDate DateTime @default(now())
|
||
nextAuditDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
issuance GruIssuance @relation(fields: [issuanceId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([auditId])
|
||
@@index([issuanceId])
|
||
@@index([auditType])
|
||
@@index([auditResult])
|
||
@@index([auditDate])
|
||
@@map("gru_issuance_audits")
|
||
}
|
||
|
||
// GRU Masterbook: Stress Testing Models
|
||
|
||
model GruStressTest {
|
||
id String @id @default(uuid())
|
||
testId String @unique
|
||
testName String
|
||
regimeId String?
|
||
stressRegime String // metal_shock, fx_cascade, liquidity_grid_collapse, gru_loop_instability, sovereign_default_correlation, temporal, quantum, metaverse
|
||
testType String // standard, temporal, quantum, metaverse
|
||
sovereignBankId String?
|
||
parameters Json // Test-specific parameters
|
||
status String @default("running") // running, completed, failed, cancelled
|
||
startedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
regime GruStressRegime? @relation(fields: [regimeId], references: [id], onDelete: SetNull)
|
||
results GruStressTestResult[]
|
||
omegaReconciliations GruOmegaLayerReconciliation[]
|
||
metaverseTests GruMetaverseStressTest[]
|
||
|
||
@@index([testId])
|
||
@@index([stressRegime])
|
||
@@index([testType])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("gru_stress_tests")
|
||
}
|
||
|
||
model GruStressRegime {
|
||
id String @id @default(uuid())
|
||
regimeId String @unique
|
||
regimeName String
|
||
regimeType String // metal_shock, fx_cascade, liquidity_grid_collapse, gru_loop_instability, sovereign_default_correlation
|
||
description String @db.Text
|
||
parameters Json // Regime-specific parameters
|
||
severity String // low, medium, high, extreme
|
||
status String @default("active") // active, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
tests GruStressTest[]
|
||
|
||
@@index([regimeId])
|
||
@@index([regimeType])
|
||
@@index([severity])
|
||
@@map("gru_stress_regimes")
|
||
}
|
||
|
||
// GRU Masterbook: Multi-Timeline Settlement System
|
||
|
||
model GruTemporalSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
gruUnitId String?
|
||
settlementType String // classical, retro, future, omega
|
||
temporalState String // t0, t-n, t+n, tΩ
|
||
temporalOffset Int? // Offset from t0 (negative for retro, positive for future)
|
||
classicalState Json? // Classical timeline state
|
||
retroState Json? // Retrospective timeline state
|
||
futureState Json? // Future predictive state
|
||
omegaState Json? // Ω-Layer merged state
|
||
mergedState Json? // Final merged state
|
||
status String @default("pending") // pending, merged, settled, failed
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
states GruTemporalState[]
|
||
chronoFx GruChronoFx[]
|
||
|
||
@@index([settlementId])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([temporalState])
|
||
@@index([status])
|
||
@@map("gru_temporal_settlements")
|
||
}
|
||
|
||
model GruTemporalState {
|
||
id String @id @default(uuid())
|
||
stateId String @unique
|
||
settlementId String
|
||
temporalState String // t0, t-n, t+n, tΩ
|
||
temporalOffset Int? // Offset from t0
|
||
stateData Json // State data
|
||
stateHash String // Hash of state data
|
||
verified Boolean @default(false)
|
||
verifiedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
|
||
settlement GruTemporalSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([stateId])
|
||
@@index([settlementId])
|
||
@@index([temporalState])
|
||
@@index([stateHash])
|
||
@@map("gru_temporal_states")
|
||
}
|
||
|
||
model GruChronoFx {
|
||
id String @id @default(uuid())
|
||
chronoFxId String @unique
|
||
settlementId String
|
||
sourceCurrency String
|
||
targetCurrency String
|
||
baseRate Decimal @db.Decimal(32, 12)
|
||
timeDilation Decimal @db.Decimal(32, 12) // Relativistic time dilation factor
|
||
delaySeconds Int? // Transmission delay (for interplanetary)
|
||
adjustedRate Decimal @db.Decimal(32, 12)
|
||
relativityFactor Decimal? @db.Decimal(32, 12)
|
||
calculationMethod String // time_dilation, interplanetary, relativistic
|
||
status String @default("calculated") // calculated, applied, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement GruTemporalSettlement @relation(fields: [settlementId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([chronoFxId])
|
||
@@index([settlementId])
|
||
@@index([sourceCurrency, targetCurrency])
|
||
@@map("gru_chrono_fx")
|
||
}
|
||
|
||
// GRU Masterbook Volume II: Supranational Reserve Framework
|
||
|
||
model GruSupranationalReserve {
|
||
id String @id @default(uuid())
|
||
reserveId String @unique
|
||
reserveClass String // SR-1, SR-2, SR-3
|
||
reserveName String
|
||
reserveType String // global_reserve, regional_reserve, commodity_reserve
|
||
jurisdiction String? // Global, EU, AU, ASEAN, GCC, etc.
|
||
totalReserves Decimal @db.Decimal(32, 8)
|
||
allocatedReserves Decimal @db.Decimal(32, 8)
|
||
availableReserves Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, suspended, archived
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
allocations GruReserveAllocation[]
|
||
stabilizationFunds GruRegionalStabilizationFund[]
|
||
|
||
@@index([reserveId])
|
||
@@index([reserveClass])
|
||
@@index([reserveType])
|
||
@@index([jurisdiction])
|
||
@@index([status])
|
||
@@map("gru_supranational_reserves")
|
||
}
|
||
|
||
model GruReserveAllocation {
|
||
id String @id @default(uuid())
|
||
allocationId String @unique
|
||
reserveId String
|
||
sovereignBankId String
|
||
allocationQuota Decimal @db.Decimal(32, 8)
|
||
allocatedAmount Decimal @db.Decimal(32, 8)
|
||
utilizationRate Decimal? @db.Decimal(32, 8)
|
||
status String @default("active") // active, suspended, revoked
|
||
allocatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserve GruSupranationalReserve @relation(fields: [reserveId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([allocationId])
|
||
@@index([reserveId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("gru_reserve_allocations")
|
||
}
|
||
|
||
model GruRegionalStabilizationFund {
|
||
id String @id @default(uuid())
|
||
fundId String @unique
|
||
reserveId String
|
||
fundName String
|
||
region String // EU, AU, ASEAN, GCC, etc.
|
||
fundSize Decimal @db.Decimal(32, 8)
|
||
availableFunds Decimal @db.Decimal(32, 8)
|
||
utilizationRate Decimal? @db.Decimal(32, 8)
|
||
status String @default("active") // active, depleted, suspended
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reserve GruSupranationalReserve @relation(fields: [reserveId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([fundId])
|
||
@@index([reserveId])
|
||
@@index([region])
|
||
@@index([status])
|
||
@@map("gru_regional_stabilization_funds")
|
||
}
|
||
|
||
model GruSdrAlternative {
|
||
id String @id @default(uuid())
|
||
sdrId String @unique
|
||
compositionType String // GRU_BACKED_SDR
|
||
gruWeight Decimal @db.Decimal(32, 8) // 0.4 (40%)
|
||
xauWeight Decimal @db.Decimal(32, 8) // 0.3 (30%)
|
||
basketWeight Decimal @db.Decimal(32, 8) // 0.3 (30%)
|
||
basketCurrencies Json // Array of currencies and weights
|
||
baseValue Decimal @db.Decimal(32, 12)
|
||
currentValue Decimal @db.Decimal(32, 12)
|
||
status String @default("active") // active, suspended
|
||
effectiveDate DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
createdAt DateTime @default(now())
|
||
|
||
@@index([sdrId])
|
||
@@index([compositionType])
|
||
@@index([status])
|
||
@@map("gru_sdr_alternatives")
|
||
}
|
||
|
||
model GruStressTestResult {
|
||
id String @id @default(uuid())
|
||
resultId String @unique
|
||
testId String
|
||
testName String
|
||
stressRegime String
|
||
metricName String
|
||
metricValue Decimal @db.Decimal(32, 12)
|
||
threshold Decimal? @db.Decimal(32, 12)
|
||
passed Boolean?
|
||
impactLevel String? // low, medium, high, critical
|
||
details Json? // Detailed result data
|
||
timestamp DateTime @default(now())
|
||
temporalOffset Int? // For temporal tests: t-12 to t+60
|
||
createdAt DateTime @default(now())
|
||
|
||
test GruStressTest @relation(fields: [testId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([resultId])
|
||
@@index([testId])
|
||
@@index([stressRegime])
|
||
@@index([metricName])
|
||
@@index([timestamp])
|
||
@@map("gru_stress_test_results")
|
||
}
|
||
|
||
model GruMonetaryCouncil {
|
||
id String @id @default(uuid())
|
||
councilId String @unique
|
||
councilName String
|
||
authorityLevel String // DBIS, OMDN_CB, GRU_MONETARY_COUNCIL
|
||
jurisdiction String?
|
||
issuanceAuthority Boolean @default(true)
|
||
approvalRequired Boolean @default(true)
|
||
status String @default("active") // active, suspended
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([councilId])
|
||
@@index([authorityLevel])
|
||
@@index([status])
|
||
@@map("gru_monetary_councils")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS GRU Volume II: Supranational Reserve Framework
|
||
// ============================================================================
|
||
|
||
model SupranationalEntity {
|
||
id String @id @default(uuid())
|
||
entityId String @unique
|
||
entityCode String @unique // EU, AU, ASEAN, GCC, MERCOSUR, Indo-Pacific
|
||
entityName String
|
||
entityType String // regional_union, monetary_alliance, strategic_cluster
|
||
description String @db.Text
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
reservePools GruReservePool[]
|
||
reserveClasses GruSupranationalReserveClass[]
|
||
issuances GruIssuance[]
|
||
members SupranationalEntityMember[]
|
||
|
||
@@index([entityId])
|
||
@@index([entityCode])
|
||
@@index([entityType])
|
||
@@index([status])
|
||
@@map("supranational_entities")
|
||
}
|
||
|
||
model SupranationalEntityMember {
|
||
id String @id @default(uuid())
|
||
memberId String @unique
|
||
entityId String
|
||
sovereignBankId String
|
||
membershipType String // full_member, associate_member, observer
|
||
status String @default("active") // active, suspended
|
||
joinedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entity SupranationalEntity @relation(fields: [entityId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank @relation(fields: [sovereignBankId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([memberId])
|
||
@@index([entityId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("supranational_entity_members")
|
||
}
|
||
|
||
model GruSupranationalReserveClass {
|
||
id String @id @default(uuid())
|
||
reserveClassId String @unique
|
||
classType String @unique // SR-1, SR-2, SR-3
|
||
className String
|
||
description String @db.Text
|
||
roles Json // Array of roles (anchor unit, crisis stabilization, etc.)
|
||
functions Json // Array of functions (regional reserve pooling, FX corridor stabilization, etc.)
|
||
entityId String?
|
||
status String @default("active") // active, suspended
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entity SupranationalEntity? @relation(fields: [entityId], references: [id], onDelete: SetNull)
|
||
allocations GruReserveAllocation[]
|
||
|
||
@@index([reserveClassId])
|
||
@@index([classType])
|
||
@@index([entityId])
|
||
@@index([status])
|
||
@@map("gru_supranational_reserve_classes")
|
||
}
|
||
|
||
model GruReservePool {
|
||
id String @id @default(uuid())
|
||
poolId String @unique
|
||
poolType String // global, regional, strategic
|
||
poolName String
|
||
entityId String?
|
||
totalReserves Decimal @default(0) @db.Decimal(32, 8)
|
||
availableReserves Decimal @default(0) @db.Decimal(32, 8)
|
||
reservedReserves Decimal @default(0) @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
assetType String // multi_asset, gru_only, commodity_backed
|
||
status String @default("active") // active, suspended, closed
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entity SupranationalEntity? @relation(fields: [entityId], references: [id], onDelete: SetNull)
|
||
allocations GruReserveAllocation[]
|
||
withdrawals GruReserveWithdrawal[]
|
||
settlements GruSupranationalSettlement[]
|
||
certificates GruReserveCertificate[]
|
||
|
||
@@index([poolId])
|
||
@@index([poolType])
|
||
@@index([entityId])
|
||
@@index([status])
|
||
@@map("gru_reserve_pools")
|
||
}
|
||
|
||
model GruReserveAllocation {
|
||
id String @id @default(uuid())
|
||
allocationId String @unique
|
||
poolId String
|
||
reserveClassId String
|
||
sovereignBankId String?
|
||
entityId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
assetType String?
|
||
allocationType String // initial_allocation, replenishment, crisis_intervention
|
||
status String @default("pending") // pending, confirmed, failed
|
||
confirmedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GruReservePool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
||
reserveClass GruSupranationalReserveClass @relation(fields: [reserveClassId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([allocationId])
|
||
@@index([poolId])
|
||
@@index([reserveClassId])
|
||
@@index([sovereignBankId])
|
||
@@index([entityId])
|
||
@@index([status])
|
||
@@map("gru_reserve_allocations")
|
||
}
|
||
|
||
model GruReserveWithdrawal {
|
||
id String @id @default(uuid())
|
||
withdrawalId String @unique
|
||
poolId String
|
||
sovereignBankId String?
|
||
entityId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
withdrawalType String // liquidity_access, crisis_intervention, fx_stabilization
|
||
approvalStatus String @default("pending") // pending, approved, rejected, executed
|
||
approvedAt DateTime?
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GruReservePool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([withdrawalId])
|
||
@@index([poolId])
|
||
@@index([sovereignBankId])
|
||
@@index([entityId])
|
||
@@index([approvalStatus])
|
||
@@map("gru_reserve_withdrawals")
|
||
}
|
||
|
||
model GruSdrInstrument {
|
||
id String @id @default(uuid())
|
||
sdrId String @unique
|
||
sdrName String @default("SDR_GRU")
|
||
gruWeight Decimal @default(0.40) @db.Decimal(32, 8) // 40%
|
||
xauWeight Decimal @default(0.30) @db.Decimal(32, 8) // 30%
|
||
fxBasketWeight Decimal @default(0.30) @db.Decimal(32, 8) // 30%
|
||
composition Json // Detailed composition breakdown
|
||
currentValue Decimal @db.Decimal(32, 12)
|
||
valuationDate DateTime @default(now())
|
||
fxBasket Json // USD/EUR/CNY/etc. weights
|
||
status String @default("active") // active, suspended
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
valuations GruSdrValuation[]
|
||
transactions GruSdrTransaction[]
|
||
|
||
@@index([sdrId])
|
||
@@index([status])
|
||
@@index([valuationDate])
|
||
@@map("gru_sdr_instruments")
|
||
}
|
||
|
||
model GruSdrValuation {
|
||
id String @id @default(uuid())
|
||
valuationId String @unique
|
||
sdrId String
|
||
gruValue Decimal @db.Decimal(32, 12)
|
||
xauValue Decimal @db.Decimal(32, 12)
|
||
fxBasketValue Decimal @db.Decimal(32, 12)
|
||
totalValue Decimal @db.Decimal(32, 12)
|
||
valuationDate DateTime @default(now())
|
||
metadata Json? // Additional valuation details
|
||
createdAt DateTime @default(now())
|
||
|
||
sdr GruSdrInstrument @relation(fields: [sdrId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([valuationId])
|
||
@@index([sdrId])
|
||
@@index([valuationDate])
|
||
@@map("gru_sdr_valuations")
|
||
}
|
||
|
||
model GruSdrTransaction {
|
||
id String @id @default(uuid())
|
||
transactionId String @unique
|
||
sdrId String
|
||
transactionType String // conversion, allocation, redemption
|
||
amount Decimal @db.Decimal(32, 8)
|
||
sourceCurrency String?
|
||
targetCurrency String?
|
||
conversionRate Decimal? @db.Decimal(32, 12)
|
||
status String @default("pending") // pending, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sdr GruSdrInstrument @relation(fields: [sdrId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([transactionId])
|
||
@@index([sdrId])
|
||
@@index([transactionType])
|
||
@@index([status])
|
||
@@map("gru_sdr_transactions")
|
||
}
|
||
|
||
model GruReserveCertificate {
|
||
id String @id @default(uuid())
|
||
certificateId String @unique
|
||
certificateCode String @unique // GRC-XXXX-XXXX
|
||
poolId String
|
||
allocationId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
assetType String?
|
||
holderId String // sovereignBankId or entityId
|
||
holderType String // sovereign_bank, supranational_entity
|
||
status String @default("active") // active, redeemed, suspended
|
||
issuedAt DateTime @default(now())
|
||
redeemedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GruReservePool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([certificateId])
|
||
@@index([certificateCode])
|
||
@@index([poolId])
|
||
@@index([allocationId])
|
||
@@index([holderId])
|
||
@@index([status])
|
||
@@map("gru_reserve_certificates")
|
||
}
|
||
|
||
model GruReserveBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
bondCode String @unique // GRB-XXXX-XXXX
|
||
poolId String?
|
||
entityId String?
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
maturityYears Int // 5-50 years
|
||
maturityDate DateTime
|
||
interestRate Decimal @db.Decimal(32, 8)
|
||
couponRate Decimal @db.Decimal(32, 8)
|
||
couponFrequency String // quarterly, semi_annual, annual
|
||
bondType String // supranational_reserve_bond
|
||
status String @default("active") // active, matured, defaulted, redeemed
|
||
issuedAt DateTime @default(now())
|
||
redeemedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GruReservePool? @relation(fields: [poolId], references: [id], onDelete: SetNull)
|
||
coupons GruReserveBondCoupon[]
|
||
|
||
@@index([bondId])
|
||
@@index([bondCode])
|
||
@@index([poolId])
|
||
@@index([entityId])
|
||
@@index([status])
|
||
@@index([maturityDate])
|
||
@@map("gru_reserve_bonds")
|
||
}
|
||
|
||
model GruReserveBondCoupon {
|
||
id String @id @default(uuid())
|
||
couponId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
paymentDate DateTime
|
||
status String @default("pending") // pending, paid, failed
|
||
paidAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond GruReserveBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([couponId])
|
||
@@index([bondId])
|
||
@@index([paymentDate])
|
||
@@index([status])
|
||
@@map("gru_reserve_bond_coupons")
|
||
}
|
||
|
||
model GruSupranationalSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
poolId String
|
||
atomicSettlementId String?
|
||
gruIndexState Json // GRU index state snapshot
|
||
xauState Json // XAU state snapshot
|
||
regionalFxBasket Json // Regional FX basket state
|
||
omegaLayerState Json? // Ω-Layer truth state
|
||
gasConfirmation String? // GAS atomic confirmation
|
||
gqlTruthSample String? // GQL truth sampling
|
||
settlementAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
status String @default("pending") // pending, merged, confirmed, failed
|
||
mergedAt DateTime?
|
||
confirmedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pool GruReservePool @relation(fields: [poolId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([poolId])
|
||
@@index([atomicSettlementId])
|
||
@@index([status])
|
||
@@map("gru_supranational_settlements")
|
||
}
|
||
|
||
// GRU Institutional Whitepaper: Regulatory Classifications & Governance
|
||
|
||
model GruRegulatoryClassification {
|
||
id String @id @default(uuid())
|
||
classificationId String @unique
|
||
entityId String // Sovereign bank ID or supranational entity ID
|
||
entityType String // sovereign_bank, supranational_council, regional_union, institution, commercial
|
||
regulatoryClass String // SR-1, SR-2, SR-3, M0, M1
|
||
accessLevel String // global_reserve, stabilization, commodity_reserves, operational_liquidity, market_instruments
|
||
eligibilityStatus String @default("pending") // pending, eligible, ineligible, suspended
|
||
eligibilityReviewDate DateTime?
|
||
reserveAdequacy Boolean @default(false)
|
||
legalRecognition Boolean @default(false) // Legal recognition of DBIS oversight
|
||
ilieVerified Boolean @default(false) // ILIE identity verification
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entity GruSupranationalEntity? @relation(fields: [entityId], references: [id], onDelete: Cascade)
|
||
reviews GruEligibilityReview[]
|
||
|
||
@@index([classificationId])
|
||
@@index([entityId])
|
||
@@index([regulatoryClass])
|
||
@@index([eligibilityStatus])
|
||
@@index([status])
|
||
@@map("gru_regulatory_classifications")
|
||
}
|
||
|
||
model GruSupranationalEntity {
|
||
id String @id @default(uuid())
|
||
entityId String @unique
|
||
entityName String
|
||
entityType String // supranational_council, regional_union, dbis, regional_reserve_council
|
||
region String?
|
||
memberSovereigns Json? // Array of sovereign bank IDs
|
||
ilieIdentityId String? // ILIE identity reference
|
||
status String @default("active") // active, suspended, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
classifications GruRegulatoryClassification[]
|
||
applications GruIssuanceApplication[]
|
||
|
||
@@index([entityId])
|
||
@@index([entityType])
|
||
@@index([status])
|
||
@@map("gru_supranational_entities")
|
||
}
|
||
|
||
// GRU Institutional Whitepaper: Legal Framework
|
||
|
||
model GruLegalFramework {
|
||
id String @id @default(uuid())
|
||
frameworkId String @unique
|
||
frameworkType String // SMIA, DRGC, IMCP
|
||
frameworkName String
|
||
description String @db.Text
|
||
complianceRequired Boolean @default(true)
|
||
status String @default("active") // active, superseded, deprecated
|
||
effectiveDate DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
complianceRecords GruComplianceRecord[]
|
||
|
||
@@index([frameworkId])
|
||
@@index([frameworkType])
|
||
@@index([status])
|
||
@@map("gru_legal_frameworks")
|
||
}
|
||
|
||
model GruComplianceRecord {
|
||
id String @id @default(uuid())
|
||
recordId String @unique
|
||
issuanceId String?
|
||
frameworkId String
|
||
complianceType String // ISO_4217, ISO_6166, ICC_UCP_600, FATF_AML_CTF, SMIA, DRGC, IMCP
|
||
complianceStatus String @default("pending") // pending, compliant, non_compliant, exempt
|
||
verificationDate DateTime?
|
||
verifiedBy String? // System or auditor ID
|
||
details Json? // Compliance verification details
|
||
notes String? @db.Text
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
issuance GruIssuance? @relation(fields: [issuanceId], references: [issuanceId], onDelete: SetNull)
|
||
framework GruLegalFramework @relation(fields: [frameworkId], references: [frameworkId], onDelete: Cascade)
|
||
|
||
@@index([recordId])
|
||
@@index([issuanceId])
|
||
@@index([frameworkId])
|
||
@@index([complianceType])
|
||
@@index([complianceStatus])
|
||
@@map("gru_compliance_records")
|
||
}
|
||
|
||
// GRU Institutional Whitepaper: Issuance Governance
|
||
|
||
model GruIssuanceApplication {
|
||
id String @id @default(uuid())
|
||
applicationId String @unique
|
||
entityId String // Supranational entity or sovereign bank ID
|
||
entityType String // supranational_entity, sovereign_bank
|
||
requestedAmount Decimal @db.Decimal(32, 8)
|
||
requestedUnitType String // M00, M0, M1
|
||
requestedIndexLink String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
regulatoryClass String? // SR-1, SR-2, SR-3, M0, M1
|
||
status String @default("submitted") // submitted, eligibility_review, index_validation, allocation, registration, gas_settlement, omega_finality, approved, rejected
|
||
currentStep String @default("application") // application, eligibility_review, index_validation, allocation, registration, gas_settlement, omega_finality
|
||
submittedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
entity GruSupranationalEntity? @relation(fields: [entityId], references: [id], onDelete: Cascade)
|
||
eligibilityReview GruEligibilityReview?
|
||
indexValidation GruIndexValidation?
|
||
allocation GruAllocationRecord?
|
||
issuance GruIssuance?
|
||
|
||
@@index([applicationId])
|
||
@@index([entityId])
|
||
@@index([status])
|
||
@@index([currentStep])
|
||
@@map("gru_issuance_applications")
|
||
}
|
||
|
||
model GruEligibilityReview {
|
||
id String @id @default(uuid())
|
||
reviewId String @unique
|
||
applicationId String? @unique
|
||
classificationId String?
|
||
reviewType String // initial, periodic, appeal
|
||
sovereignStatus Boolean @default(false) // Sovereign or recognized supranational entity
|
||
reserveAdequacy Boolean @default(false)
|
||
legalRecognition Boolean @default(false) // Legal recognition of DBIS oversight
|
||
ilieVerification Boolean @default(false) // Identity verification via ILIE
|
||
reviewResult String @default("pending") // pending, approved, rejected, conditional
|
||
reviewNotes String? @db.Text
|
||
reviewedBy String? // System or reviewer ID
|
||
reviewedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
application GruIssuanceApplication? @relation(fields: [applicationId], references: [applicationId], onDelete: Cascade)
|
||
classification GruRegulatoryClassification? @relation(fields: [classificationId], references: [classificationId], onDelete: SetNull)
|
||
|
||
@@index([reviewId])
|
||
@@index([applicationId])
|
||
@@index([reviewResult])
|
||
@@map("gru_eligibility_reviews")
|
||
}
|
||
|
||
model GruIndexValidation {
|
||
id String @id @default(uuid())
|
||
validationId String @unique
|
||
applicationId String? @unique
|
||
indexCode String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
indexValue Decimal @db.Decimal(32, 12)
|
||
validationResult String @default("pending") // pending, valid, invalid, requires_review
|
||
validationNotes String? @db.Text
|
||
validatedBy String? // System or validator ID
|
||
validatedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
application GruIssuanceApplication? @relation(fields: [applicationId], references: [applicationId], onDelete: Cascade)
|
||
|
||
@@index([validationId])
|
||
@@index([applicationId])
|
||
@@index([indexCode])
|
||
@@map("gru_index_validations")
|
||
}
|
||
|
||
model GruAllocationRecord {
|
||
id String @id @default(uuid())
|
||
allocationId String @unique
|
||
applicationId String? @unique
|
||
issuanceId String?
|
||
allocatedAmount Decimal @db.Decimal(32, 8)
|
||
allocatedUnitType String // M00, M0, M1
|
||
allocationDate DateTime @default(now())
|
||
status String @default("allocated") // allocated, registered, settled
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
application GruIssuanceApplication? @relation(fields: [applicationId], references: [applicationId], onDelete: Cascade)
|
||
|
||
@@index([allocationId])
|
||
@@index([applicationId])
|
||
@@index([issuanceId])
|
||
@@map("gru_allocation_records")
|
||
}
|
||
|
||
// GRU Institutional Whitepaper: Settlement Pipeline
|
||
|
||
model GruSettlementPipeline {
|
||
id String @id @default(uuid())
|
||
pipelineId String @unique
|
||
issuanceId String?
|
||
applicationId String?
|
||
pipelineStage String @default("classical") // classical, quantum, omega_layer, completed
|
||
classicalState Json? // Classical settlement state
|
||
quantumState Json? // Quantum settlement state
|
||
omegaLayerState Json? // Ω-Layer finality state
|
||
gasSettlementId String? // GAS atomic network settlement ID
|
||
omegaFinalityId String? // Ω-Layer finality record ID
|
||
status String @default("pending") // pending, classical_initiated, quantum_initiated, omega_initiated, completed, failed
|
||
initiatedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
gasSettlement GruGasSettlement?
|
||
omegaFinality GruOmegaLayerFinality?
|
||
|
||
@@index([pipelineId])
|
||
@@index([issuanceId])
|
||
@@index([applicationId])
|
||
@@index([pipelineStage])
|
||
@@index([status])
|
||
@@map("gru_settlement_pipelines")
|
||
}
|
||
|
||
model GruGasSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
pipelineId String? @unique
|
||
gasTransactionId String // GAS atomic network transaction ID
|
||
atomicNetwork String // GAS atomic network identifier
|
||
settlementAmount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
atomicConfirmation String? // GAS atomic confirmation hash
|
||
status String @default("pending") // pending, atomic_confirmed, failed
|
||
confirmedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pipeline GruSettlementPipeline? @relation(fields: [pipelineId], references: [pipelineId], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([pipelineId])
|
||
@@index([gasTransactionId])
|
||
@@index([status])
|
||
@@map("gru_gas_settlements")
|
||
}
|
||
|
||
model GruOmegaLayerFinality {
|
||
id String @id @default(uuid())
|
||
finalityId String @unique
|
||
pipelineId String? @unique
|
||
omegaLayerId String // Ω-Layer identifier
|
||
mergeOperationId String? // Ω-Layer merge operation ID
|
||
finalityProof String? // Ω-Layer finality proof
|
||
causalityStable Boolean @default(false) // Causality stabilization verified
|
||
multiRealityReconciled Boolean @default(false) // Multi-reality reconciliation verified
|
||
status String @default("pending") // pending, merged, finalized, failed
|
||
mergedAt DateTime?
|
||
finalizedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
pipeline GruSettlementPipeline? @relation(fields: [pipelineId], references: [pipelineId], onDelete: Cascade)
|
||
|
||
@@index([finalityId])
|
||
@@index([pipelineId])
|
||
@@index([omegaLayerId])
|
||
@@index([status])
|
||
@@map("gru_omega_layer_finalities")
|
||
}
|
||
|
||
// GRU Institutional Whitepaper: Transparency & Disclosure
|
||
|
||
model GruTransparencyReport {
|
||
id String @id @default(uuid())
|
||
reportId String @unique
|
||
reportType String // daily_price_fixing, liquidity_report, bond_health, stress_test, omega_proof
|
||
reportDate DateTime @default(now())
|
||
reportData Json // Report-specific data structure
|
||
status String @default("generated") // generated, published, archived
|
||
publishedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([reportId])
|
||
@@index([reportType])
|
||
@@index([reportDate])
|
||
@@index([status])
|
||
@@map("gru_transparency_reports")
|
||
}
|
||
|
||
// GRU Institutional Whitepaper: International Adoption
|
||
|
||
model GruAdoption {
|
||
id String @id @default(uuid())
|
||
adoptionId String @unique
|
||
entityId String // Sovereign bank or supranational entity ID
|
||
entityType String // sovereign_bank, supranational_entity, regional_union
|
||
currentPhase String @default("alignment") // alignment, integration, expansion
|
||
alignmentStatus String @default("pending") // pending, in_progress, completed
|
||
integrationStatus String @default("pending") // pending, in_progress, completed
|
||
expansionStatus String @default("pending") // pending, in_progress, completed
|
||
regulatorySyncDate DateTime?
|
||
reserveConversionDate DateTime?
|
||
regionalPoolJoinDate DateTime?
|
||
status String @default("active") // active, completed, suspended
|
||
initiatedAt DateTime @default(now())
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([adoptionId])
|
||
@@index([entityId])
|
||
@@index([currentPhase])
|
||
@@index([status])
|
||
@@map("gru_adoptions")
|
||
}
|
||
|
||
// ============================================================================
|
||
// GRU Banking Operations Manual (Volume IV): Account Structure & Operations
|
||
// ============================================================================
|
||
|
||
// GRU Account Classes (GRA-0 through GRA-6)
|
||
model GruAccount {
|
||
id String @id @default(uuid())
|
||
accountId String @unique
|
||
accountClass String // GRA-0, GRA-1, GRA-2, GRA-3, GRA-4, GRA-5, GRA-6
|
||
entityId String // DBIS, SCB, Supranational, Bank, Enterprise ID
|
||
entityType String // dbis, scb, supranational, tier1_bank, tier2_bank, enterprise, observational
|
||
accountNumber String @unique
|
||
balance Decimal @default(0) @db.Decimal(32, 8)
|
||
availableBalance Decimal @default(0) @db.Decimal(32, 8)
|
||
reservedBalance Decimal @default(0) @db.Decimal(32, 8)
|
||
currencyCode String @default("GRU")
|
||
status String @default("active") // active, suspended, closed
|
||
openedAt DateTime @default(now())
|
||
closedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
accountClassDef GruAccountClass @relation(fields: [accountClass], references: [accountClass], onDelete: Restrict)
|
||
transactions GruAccountTransaction[]
|
||
reconciliations GruAccountReconciliation[]
|
||
|
||
@@index([accountId])
|
||
@@index([accountClass])
|
||
@@index([entityId])
|
||
@@index([accountNumber])
|
||
@@index([status])
|
||
@@map("gru_accounts")
|
||
}
|
||
|
||
model GruAccountClass {
|
||
accountClass String @id // GRA-0, GRA-1, GRA-2, GRA-3, GRA-4, GRA-5, GRA-6
|
||
className String
|
||
entityType String // dbis, scb, supranational, tier1_bank, tier2_bank, enterprise, observational
|
||
purpose String @db.Text
|
||
permissions Json // Account class permissions and restrictions
|
||
status String @default("active") // active, deprecated
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
accounts GruAccount[]
|
||
|
||
@@map("gru_account_classes")
|
||
}
|
||
|
||
model GruAccountTransaction {
|
||
id String @id @default(uuid())
|
||
transactionId String @unique
|
||
accountId String
|
||
transactionType String // spot_conversion, fx_ssu_routing, bond_purchase, bond_redemption, reserve_adjustment, metaverse_on_ramp, metaverse_off_ramp, temporal_settlement
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
referenceId String? // Reference to related transaction
|
||
status String @default("pending") // pending, completed, failed, reversed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
account GruAccount @relation(fields: [accountId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([transactionId])
|
||
@@index([accountId])
|
||
@@index([transactionType])
|
||
@@index([status])
|
||
@@map("gru_account_transactions")
|
||
}
|
||
|
||
model GruAccountReconciliation {
|
||
id String @id @default(uuid())
|
||
reconciliationId String @unique
|
||
accountId String
|
||
reconciliationDate DateTime @default(now())
|
||
openingBalance Decimal @db.Decimal(32, 8)
|
||
closingBalance Decimal @db.Decimal(32, 8)
|
||
expectedBalance Decimal @db.Decimal(32, 8)
|
||
variance Decimal? @db.Decimal(32, 8)
|
||
variancePercent Decimal? @db.Decimal(32, 8)
|
||
status String @default("pending") // pending, reconciled, variance_detected, resolved
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
account GruAccount @relation(fields: [accountId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reconciliationId])
|
||
@@index([accountId])
|
||
@@index([reconciliationDate])
|
||
@@index([status])
|
||
@@map("gru_account_reconciliations")
|
||
}
|
||
|
||
// Daily Operations Models
|
||
model GruDailyOperations {
|
||
id String @id @default(uuid())
|
||
operationId String @unique
|
||
operationDate DateTime @default(now())
|
||
operationType String // opening, closeout
|
||
ledgerNodesInitialized Boolean @default(false)
|
||
indexEngineSynced Boolean @default(false)
|
||
qekVerified Boolean @default(false)
|
||
omegaDiagnosticRun Boolean @default(false)
|
||
gasReconciled Boolean @default(false)
|
||
quantumDriftCorrected Boolean @default(false)
|
||
sovereignExposureUpdated Boolean @default(false)
|
||
complianceSnapshotGenerated Boolean @default(false)
|
||
status String @default("in_progress") // in_progress, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ledgerNodes GruLedgerNode[]
|
||
indexSyncs GruIndexSync[]
|
||
qekVerifications GruQuantumEnvelopeKey[]
|
||
omegaDiagnostics GruOmegaDiagnostic[]
|
||
closeouts GruEndOfDayCloseout[]
|
||
|
||
@@index([operationId])
|
||
@@index([operationDate])
|
||
@@index([operationType])
|
||
@@index([status])
|
||
@@map("gru_daily_operations")
|
||
}
|
||
|
||
model GruLedgerNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
operationId String
|
||
nodeType String // master, sovereign, regional
|
||
nodeStatus String @default("initializing") // initializing, synchronized, failed
|
||
lastSyncAt DateTime?
|
||
syncStatus String @default("pending") // pending, syncing, completed, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
operation GruDailyOperations @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([nodeId])
|
||
@@index([operationId])
|
||
@@index([nodeStatus])
|
||
@@map("gru_ledger_nodes")
|
||
}
|
||
|
||
model GruIndexSync {
|
||
id String @id @default(uuid())
|
||
syncId String @unique
|
||
operationId String
|
||
indexCode String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
syncStatus String @default("pending") // pending, syncing, completed, failed
|
||
lastSyncedValue Decimal? @db.Decimal(32, 12)
|
||
syncTimestamp DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
operation GruDailyOperations @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([syncId])
|
||
@@index([operationId])
|
||
@@index([indexCode])
|
||
@@index([syncStatus])
|
||
@@map("gru_index_syncs")
|
||
}
|
||
|
||
model GruQuantumEnvelopeKey {
|
||
id String @id @default(uuid())
|
||
qekId String @unique
|
||
operationId String
|
||
keyId String
|
||
verificationStatus String @default("pending") // pending, verified, failed
|
||
verificationTimestamp DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
operation GruDailyOperations @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([qekId])
|
||
@@index([operationId])
|
||
@@index([keyId])
|
||
@@index([verificationStatus])
|
||
@@map("gru_quantum_envelope_keys")
|
||
}
|
||
|
||
model GruOmegaDiagnostic {
|
||
id String @id @default(uuid())
|
||
diagnosticId String @unique
|
||
operationId String
|
||
layerId String // Ω0, Ω1, Ω2, Ω3, Ω4
|
||
diagnosticStatus String @default("pending") // pending, running, completed, failed
|
||
diagnosticResult Json? // Diagnostic results
|
||
runTimestamp DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
operation GruDailyOperations @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([diagnosticId])
|
||
@@index([operationId])
|
||
@@index([layerId])
|
||
@@index([diagnosticStatus])
|
||
@@map("gru_omega_diagnostics")
|
||
}
|
||
|
||
model GruEndOfDayCloseout {
|
||
id String @id @default(uuid())
|
||
closeoutId String @unique
|
||
operationId String
|
||
closeoutDate DateTime @default(now())
|
||
gasReconciliationStatus String @default("pending") // pending, completed, failed
|
||
quantumDriftCorrectionStatus String @default("pending") // pending, completed, failed
|
||
sovereignExposureUpdateStatus String @default("pending") // pending, completed, failed
|
||
complianceSnapshotStatus String @default("pending") // pending, completed, failed
|
||
status String @default("in_progress") // in_progress, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
operation GruDailyOperations @relation(fields: [operationId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([closeoutId])
|
||
@@index([operationId])
|
||
@@index([closeoutDate])
|
||
@@index([status])
|
||
@@map("gru_end_of_day_closeouts")
|
||
}
|
||
|
||
// Liquidity Management Models
|
||
model GruLiquidityMonitoring {
|
||
id String @id @default(uuid())
|
||
monitoringId String @unique
|
||
monitoringDate DateTime @default(now())
|
||
xauAnchorValue Decimal @db.Decimal(32, 8)
|
||
xauAnchorStability Decimal @db.Decimal(32, 8) // Stability score 0-100
|
||
stabilityStatus String @default("stable") // stable, volatile, critical
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([monitoringId])
|
||
@@index([monitoringDate])
|
||
@@index([stabilityStatus])
|
||
@@map("gru_liquidity_monitoring")
|
||
}
|
||
|
||
model GruLiquidityDemand {
|
||
id String @id @default(uuid())
|
||
demandId String @unique
|
||
demandDate DateTime @default(now())
|
||
indexCode String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
demandLevel Decimal @db.Decimal(32, 8)
|
||
demandType String // normal, elevated, critical
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([demandId])
|
||
@@index([demandDate])
|
||
@@index([indexCode])
|
||
@@map("gru_liquidity_demand")
|
||
}
|
||
|
||
model GruLiquidityPrediction {
|
||
id String @id @default(uuid())
|
||
predictionId String @unique
|
||
predictionDate DateTime @default(now())
|
||
timeHorizon String // t+1, t+7, t+30, t+90, t+180, t+365
|
||
predictedLiquidity Decimal @db.Decimal(32, 8)
|
||
confidenceLevel Decimal @db.Decimal(32, 8) // 0-100
|
||
modelVersion String
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([predictionId])
|
||
@@index([predictionDate])
|
||
@@index([timeHorizon])
|
||
@@map("gru_liquidity_predictions")
|
||
}
|
||
|
||
model GruReserveBuffer {
|
||
id String @id @default(uuid())
|
||
bufferId String @unique
|
||
reserveType String // supranational, regional, sovereign
|
||
bufferAmount Decimal @db.Decimal(32, 8)
|
||
allocatedAmount Decimal @default(0) @db.Decimal(32, 8)
|
||
availableAmount Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, depleted, replenished
|
||
lastAllocatedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([bufferId])
|
||
@@index([reserveType])
|
||
@@index([status])
|
||
@@map("gru_reserve_buffers")
|
||
}
|
||
|
||
// Risk Management Models
|
||
model GruRiskControl {
|
||
id String @id @default(uuid())
|
||
controlId String @unique
|
||
controlDate DateTime @default(now())
|
||
controlType String // daily_volatility_screening, sovereign_correlation, fx_corridor, synthetic_market_stress
|
||
controlStatus String @default("pending") // pending, passed, failed, warning
|
||
controlResult Json? // Control results and metrics
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([controlId])
|
||
@@index([controlDate])
|
||
@@index([controlType])
|
||
@@index([controlStatus])
|
||
@@map("gru_risk_controls")
|
||
}
|
||
|
||
model GruVolatilityScreening {
|
||
id String @id @default(uuid())
|
||
screeningId String @unique
|
||
screeningDate DateTime @default(now())
|
||
indexCode String // LiXAU, LiPMG, LiBMG1, LiBMG2, LiBMG3
|
||
volatilityLevel Decimal @db.Decimal(32, 8)
|
||
volatilityStatus String @default("normal") // normal, elevated, critical
|
||
threshold Decimal? @db.Decimal(32, 8)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([screeningId])
|
||
@@index([screeningDate])
|
||
@@index([indexCode])
|
||
@@index([volatilityStatus])
|
||
@@map("gru_volatility_screening")
|
||
}
|
||
|
||
model GruSovereignCorrelation {
|
||
id String @id @default(uuid())
|
||
correlationId String @unique
|
||
correlationDate DateTime @default(now())
|
||
sovereignBankId1 String
|
||
sovereignBankId2 String
|
||
correlationValue Decimal @db.Decimal(32, 8) // -1 to 1
|
||
correlationStatus String @default("normal") // normal, elevated, critical
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([correlationId])
|
||
@@index([correlationDate])
|
||
@@index([sovereignBankId1])
|
||
@@index([sovereignBankId2])
|
||
@@map("gru_sovereign_correlations")
|
||
}
|
||
|
||
model GruFxCorridor {
|
||
id String @id @default(uuid())
|
||
corridorId String @unique
|
||
monitoringDate DateTime @default(now())
|
||
currencyPair String // e.g., GRU/USD, GRU/EUR
|
||
currentRate Decimal @db.Decimal(32, 12)
|
||
upperBound Decimal @db.Decimal(32, 12)
|
||
lowerBound Decimal @db.Decimal(32, 12)
|
||
corridorStatus String @default("within") // within, upper_breach, lower_breach
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([corridorId])
|
||
@@index([monitoringDate])
|
||
@@index([currencyPair])
|
||
@@index([corridorStatus])
|
||
@@map("gru_fx_corridors")
|
||
}
|
||
|
||
model GruSyntheticMarketFlag {
|
||
id String @id @default(uuid())
|
||
flagId String @unique
|
||
flagDate DateTime @default(now())
|
||
marketType String // synthetic_derivatives, synthetic_liquidity, synthetic_reserves
|
||
stressLevel String @default("normal") // normal, elevated, critical
|
||
flagReason String @db.Text
|
||
status String @default("active") // active, resolved, false_positive
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([flagId])
|
||
@@index([flagDate])
|
||
@@index([marketType])
|
||
@@index([stressLevel])
|
||
@@index([status])
|
||
@@map("gru_synthetic_market_flags")
|
||
}
|
||
|
||
// Compliance & Reporting Models
|
||
model GruComplianceSnapshot {
|
||
id String @id @default(uuid())
|
||
snapshotId String @unique
|
||
snapshotDate DateTime @default(now())
|
||
snapshotType String // daily, monthly, annual
|
||
snapshotData Json // Compliance data snapshot
|
||
ariSubmissionStatus String @default("pending") // pending, submitted, confirmed
|
||
ariSubmissionId String?
|
||
submittedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([snapshotId])
|
||
@@index([snapshotDate])
|
||
@@index([snapshotType])
|
||
@@index([ariSubmissionStatus])
|
||
@@map("gru_compliance_snapshots")
|
||
}
|
||
|
||
// Sub-Volume E: Quantum Proxy Server (QPS)
|
||
|
||
model QuantumProxyTransaction {
|
||
id String @id @default(uuid())
|
||
proxyTransactionId String @unique
|
||
legacyTransactionId String
|
||
legacyProtocol String // SWIFT, ISO20022, ACH, SEPA, PRIVATE_BANK
|
||
quantumEnvelopeId String?
|
||
translationId String?
|
||
dbisQfsTransactionId String?
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
status String @default("pending") // pending, bridged, failed
|
||
bridgedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
envelope QuantumEnvelope? @relation(fields: [quantumEnvelopeId], references: [envelopeId], onDelete: SetNull)
|
||
translation QuantumTranslation? @relation(fields: [translationId], references: [translationId], onDelete: SetNull)
|
||
|
||
@@index([proxyTransactionId])
|
||
@@index([legacyTransactionId])
|
||
@@index([legacyProtocol])
|
||
@@index([sourceBankId])
|
||
@@index([destinationBankId])
|
||
@@index([status])
|
||
@@map("quantum_proxy_transactions")
|
||
}
|
||
|
||
model QuantumEnvelope {
|
||
id String @id @default(uuid())
|
||
envelopeId String @unique
|
||
legacyTransactionId String
|
||
legacyProtocol String
|
||
quantumHash String
|
||
causalConsistencyHash String
|
||
dimensionalHarmonizationHash String
|
||
transactionData Json
|
||
status String @default("created") // created, verified, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
proxyTransactions QuantumProxyTransaction[]
|
||
|
||
@@index([envelopeId])
|
||
@@index([legacyTransactionId])
|
||
@@index([legacyProtocol])
|
||
@@index([status])
|
||
@@map("quantum_envelopes")
|
||
}
|
||
|
||
model QuantumTranslation {
|
||
id String @id @default(uuid())
|
||
translationId String @unique
|
||
legacyProtocol String
|
||
legacyAmount Decimal @db.Decimal(32, 8)
|
||
legacyCurrency String
|
||
quantumAmount Decimal @db.Decimal(32, 8)
|
||
quantumCurrency String
|
||
fxRate Decimal @db.Decimal(32, 12)
|
||
riskScore Decimal @db.Decimal(32, 8)
|
||
protocolMapping Json
|
||
transactionData Json
|
||
status String @default("completed") // completed, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
proxyTransactions QuantumProxyTransaction[]
|
||
|
||
@@index([translationId])
|
||
@@index([legacyProtocol])
|
||
@@index([status])
|
||
@@map("quantum_translations")
|
||
}
|
||
|
||
model LegacyProtocolMapping {
|
||
id String @id @default(uuid())
|
||
mappingId String @unique
|
||
legacyProtocol String // SWIFT, ISO20022, ACH, SEPA, PRIVATE_BANK
|
||
mappingConfig Json // Protocol-specific mapping configuration
|
||
status String @default("active") // active, deprecated
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([mappingId])
|
||
@@index([legacyProtocol])
|
||
@@index([status])
|
||
@@map("legacy_protocol_mappings")
|
||
}
|
||
|
||
// Sub-Volume C: Metaverse Integration
|
||
|
||
model MetaverseNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
metaverseName String // e.g., "MetaverseDubai"
|
||
metaverseType String // sovereign, private, hybrid
|
||
settlementEndpoint String
|
||
cbdcOnRampEnabled Boolean @default(false)
|
||
cbdcOffRampEnabled Boolean @default(false)
|
||
gruOnRampEnabled Boolean @default(false)
|
||
gruOffRampEnabled Boolean @default(false)
|
||
identityLayer String // L3, L4 (ILIE identity layers)
|
||
assetTokenizationEnabled Boolean @default(false)
|
||
status String @default("active") // active, suspended
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlements MetaverseSettlement[]
|
||
identities MetaverseIdentity[]
|
||
assets MetaverseAsset[]
|
||
bridges MetaverseBridge[]
|
||
fxTransactionsSource MetaverseFxTransaction[] @relation("MetaverseFxSource")
|
||
fxTransactionsTarget MetaverseFxTransaction[] @relation("MetaverseFxTarget")
|
||
dsez DigitalSovereignEconomicZone[]
|
||
rampTransactions MetaverseRampTransaction[]
|
||
computeNodes MetaverseComputeNode[]
|
||
|
||
@@index([nodeId])
|
||
@@index([metaverseName])
|
||
@@index([status])
|
||
@@map("metaverse_nodes")
|
||
}
|
||
|
||
model MetaverseSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
metaverseNodeId String
|
||
gasSettlementId String
|
||
sourceBankId String
|
||
destinationBankId String
|
||
virtualLandId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
assetType String // virtual_land, virtual_asset, nft
|
||
status String @default("pending") // pending, settled, failed
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node MetaverseNode @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([settlementId])
|
||
@@index([metaverseNodeId])
|
||
@@index([virtualLandId])
|
||
@@index([status])
|
||
@@map("metaverse_settlements")
|
||
}
|
||
|
||
model MetaverseIdentity {
|
||
id String @id @default(uuid())
|
||
identityId String @unique
|
||
metaverseNodeId String
|
||
avatarId String
|
||
identityLayer String // L3, L4
|
||
sovereignBankId String?
|
||
identityHash String
|
||
identityData Json
|
||
status String @default("active") // active, suspended, revoked
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node MetaverseNode @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([identityId])
|
||
@@index([metaverseNodeId])
|
||
@@index([avatarId])
|
||
@@index([identityLayer])
|
||
@@map("metaverse_identities")
|
||
}
|
||
|
||
model MetaverseAsset {
|
||
id String @id @default(uuid())
|
||
assetId String @unique
|
||
metaverseNodeId String
|
||
assetType String // virtual_land, virtual_building, nft, token
|
||
assetName String
|
||
tokenId String?
|
||
ownerAvatarId String?
|
||
value Decimal? @db.Decimal(32, 8)
|
||
currencyCode String?
|
||
tokenClass String? // virtual_land, avatar_asset, business_license, event_rights, data_ownership, ai_companion
|
||
businessLicenseId String?
|
||
eventRights Json? // Event rights data
|
||
dataOwnershipTokenId String?
|
||
aiCompanionId String?
|
||
status String @default("active") // active, locked, transferred
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node MetaverseNode @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([assetId])
|
||
@@index([metaverseNodeId])
|
||
@@index([assetType])
|
||
@@index([tokenId])
|
||
@ @map("metaverse_assets")
|
||
}
|
||
|
||
model MetaverseTokenClass {
|
||
id String @id @default(uuid())
|
||
tokenClassId String @unique
|
||
tokenClass String @unique // virtual_land, avatar_asset, business_license, event_rights, data_ownership, ai_companion
|
||
className String
|
||
description String @db.Text
|
||
metadata Json?
|
||
status String @default("active") // active, deprecated
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([tokenClassId])
|
||
@@index([tokenClass])
|
||
@map("metaverse_token_classes")
|
||
}
|
||
|
||
model MetaverseFxTransaction {
|
||
id String @id @default(uuid())
|
||
fxTransactionId String @unique
|
||
sourceMetaverseNodeId String
|
||
targetMetaverseNodeId String
|
||
sourceAmount Decimal @db.Decimal(32, 8)
|
||
targetAmount Decimal @db.Decimal(32, 8)
|
||
sourceCurrency String
|
||
targetCurrency String
|
||
exchangeRate Decimal @db.Decimal(32, 12)
|
||
conversionMethod String // ssu, qmu, hmu, direct
|
||
realityType String? // classical, quantum, simulated, holographic
|
||
status String @default("completed") // completed, failed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sourceNode MetaverseNode @relation("MetaverseFxSource", fields: [sourceMetaverseNodeId], references: [id], onDelete: Cascade)
|
||
targetNode MetaverseNode @relation("MetaverseFxTarget", fields: [targetMetaverseNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([fxTransactionId])
|
||
@@index([sourceMetaverseNodeId])
|
||
@@index([targetMetaverseNodeId])
|
||
@@index([status])
|
||
@@map("metaverse_fx_transactions")
|
||
}
|
||
|
||
model MetaverseBridge {
|
||
id String @id @default(uuid())
|
||
bridgeId String @unique
|
||
metaverseNodeId String
|
||
bridgeType String // nft_commodity, virtual_securitization, hybrid
|
||
virtualAssetId String
|
||
physicalAssetId String?
|
||
nftTokenId String?
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
status String @default("active") // active, dissolved
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node MetaverseNode @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([bridgeId])
|
||
@@index([metaverseNodeId])
|
||
@@index([bridgeType])
|
||
@@index([virtualAssetId])
|
||
@@index([nftTokenId])
|
||
@@map("metaverse_bridges")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Supplement B: MetaverseDubai Integration Framework - D-SEZ Model
|
||
// ============================================================================
|
||
|
||
model DigitalSovereignEconomicZone {
|
||
id String @id @default(uuid())
|
||
dsezId String @unique
|
||
metaverseNodeId String
|
||
sovereignBankId String?
|
||
virtualCitizenshipEnabled Boolean @default(false)
|
||
digitalLandEnabled Boolean @default(false)
|
||
tokenizedFxEnabled Boolean @default(false)
|
||
liquidityFlowEnabled Boolean @default(false)
|
||
status String @default("active") // active, suspended, inactive
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node MetaverseNode @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank? @relation(fields: [sovereignBankId], references: [id], onDelete: SetNull)
|
||
rampTransactions MetaverseRampTransaction[]
|
||
consistencyChecks MetaverseConsistencyCheck[]
|
||
|
||
@@index([dsezId])
|
||
@@index([metaverseNodeId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@map("digital_sovereign_economic_zones")
|
||
}
|
||
|
||
model MetaverseRampTransaction {
|
||
id String @id @default(uuid())
|
||
rampId String @unique
|
||
dsezId String
|
||
rampType String // on_ramp, off_ramp
|
||
sourceType String // fiat, cbdc, gru, ssu, virtual_currency, tokenized_asset
|
||
targetType String // fiat, cbdc, gru, ssu, virtual_currency, tokenized_asset
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
metaverseNodeId String
|
||
sourceBankId String?
|
||
destinationBankId String?
|
||
exchangeRate Decimal? @db.Decimal(32, 12)
|
||
status String @default("pending") // pending, processing, completed, failed
|
||
validationHash String?
|
||
complianceCheck Boolean @default(false)
|
||
processedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
dsez DigitalSovereignEconomicZone @relation(fields: [dsezId], references: [id], onDelete: Cascade)
|
||
node MetaverseNode @relation(fields: [metaverseNodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([rampId])
|
||
@@index([dsezId])
|
||
@@index([metaverseNodeId])
|
||
@@index([rampType])
|
||
@@index([status])
|
||
@@index([createdAt])
|
||
@map("metaverse_ramp_transactions")
|
||
}
|
||
|
||
model MetaverseComputeNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
nodeType String // MGN, SAN, ZKN, QGN
|
||
regionId String
|
||
metaverseNodeId String?
|
||
latency Int // milliseconds
|
||
gpuCapacity Int // GPU units
|
||
networkAddress String
|
||
sixGEnabled Boolean @default(false)
|
||
zkVerificationEnabled Boolean @default(false)
|
||
holographicRenderingEnabled Boolean @default(false)
|
||
status String @default("active") // active, degraded, offline
|
||
metadata Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node MetaverseNode? @relation(fields: [metaverseNodeId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([nodeId])
|
||
@@index([nodeType])
|
||
@@index([regionId])
|
||
@@index([metaverseNodeId])
|
||
@@index([status])
|
||
@map("metaverse_compute_nodes")
|
||
}
|
||
|
||
model MetaverseConsistencyCheck {
|
||
id String @id @default(uuid())
|
||
checkId String @unique
|
||
dsezId String
|
||
mdxState Json? // MetaverseDubai state
|
||
primeState Json? // DBIS Prime state
|
||
parallelState Json? // Parallel state
|
||
mergedState Json? // Ω-Merge result
|
||
consistencyStatus String @default("pending") // pending, consistent, inconsistent
|
||
identityCoherence Boolean @default(false)
|
||
assetRealityMapping Boolean @default(false)
|
||
omegaValidation Boolean @default(false)
|
||
checkedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
dsez DigitalSovereignEconomicZone @relation(fields: [dsezId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([checkId])
|
||
@@index([dsezId])
|
||
@@index([consistencyStatus])
|
||
@@index([checkedAt])
|
||
@map("metaverse_consistency_checks")
|
||
}
|
||
|
||
// Sub-Volume D: Edge/Last-Mile GPU for Metaverse in 325 Regions over 6G
|
||
|
||
model GpuEdgeNode {
|
||
id String @id @default(uuid())
|
||
nodeId String @unique
|
||
nodeType String // MGN, QGN, ZKN, SAN
|
||
regionId String
|
||
nodeName String
|
||
gpuCapacity Int // GPU units
|
||
networkAddress String
|
||
quantumSafeTunnelingEnabled Boolean @default(false)
|
||
status String @default("active") // active, degraded, offline
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
region GpuEdgeRegion @relation(fields: [regionId], references: [regionId], onDelete: Cascade)
|
||
tasks GpuEdgeTask[]
|
||
|
||
@@index([nodeId])
|
||
@@index([nodeType])
|
||
@@index([regionId])
|
||
@@index([status])
|
||
@@map("gpu_edge_nodes")
|
||
}
|
||
|
||
model GpuEdgeRegion {
|
||
id String @id @default(uuid())
|
||
regionId String @unique
|
||
regionName String
|
||
status String @default("active") // active, inactive
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
nodes GpuEdgeNode[]
|
||
deployments GpuEdgeDeployment[]
|
||
|
||
@@index([regionId])
|
||
@@index([status])
|
||
@@map("gpu_edge_regions")
|
||
}
|
||
|
||
model GpuEdgeDeployment {
|
||
id String @id @default(uuid())
|
||
deploymentId String @unique
|
||
regionId String
|
||
nodeTypes Json // Array of node types
|
||
nodesCreated Json // Array of node IDs
|
||
status String @default("pending") // pending, completed, failed
|
||
deployedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
region GpuEdgeRegion @relation(fields: [regionId], references: [regionId], onDelete: Cascade)
|
||
|
||
@@index([deploymentId])
|
||
@@index([regionId])
|
||
@@index([status])
|
||
@@map("gpu_edge_deployments")
|
||
}
|
||
|
||
model GpuEdgeTask {
|
||
id String @id @default(uuid())
|
||
taskId String @unique
|
||
nodeId String
|
||
taskType String // metaverse_rendering, quantum_proxy, zk_validation, ai_behavioral, health_check
|
||
status String @default("pending") // pending, running, completed, failed
|
||
result Json?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
node GpuEdgeNode @relation(fields: [nodeId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([taskId])
|
||
@@index([nodeId])
|
||
@@index([taskType])
|
||
@@index([status])
|
||
@@map("gpu_edge_tasks")
|
||
}
|
||
|
||
model GpuEdgeNetwork {
|
||
id String @id @default(uuid())
|
||
routeId String @unique
|
||
sourceRegionId String
|
||
targetRegionId String
|
||
sourceNodeId String
|
||
targetNodeId String
|
||
path Json // Array of node IDs
|
||
estimatedLatency Decimal @db.Decimal(32, 8) // Milliseconds
|
||
quantumSafe Boolean @default(false)
|
||
latencyRequirement Decimal @db.Decimal(32, 8) // <1ms default
|
||
status String @default("active") // active, expired
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([routeId])
|
||
@@index([sourceRegionId])
|
||
@@index([targetRegionId])
|
||
@@index([status])
|
||
@@map("gpu_edge_networks")
|
||
}
|
||
|
||
// Sub-Volume F: System Gap Audit & Technology Completion Engine
|
||
|
||
model GapAudit {
|
||
id String @id @default(uuid())
|
||
auditId String @unique
|
||
auditScope Json // Array of system scopes
|
||
gapsFound Int @default(0)
|
||
modulesGenerated Int @default(0)
|
||
recommendationsCount Int @default(0)
|
||
status String @default("pending") // pending, running, completed, failed
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
detections GapDetection[]
|
||
recommendations SystemRecommendation[]
|
||
|
||
@@index([auditId])
|
||
@@index([status])
|
||
@@map("gap_audits")
|
||
}
|
||
|
||
model GapDetection {
|
||
id String @id @default(uuid())
|
||
detectionId String @unique
|
||
auditId String
|
||
gapType String // multiverse_settlement_layer, quantum_financial_interface, etc.
|
||
systemScope String // multiverse, temporal, quantum, cognitive, dlt, metaverse
|
||
description String @db.Text
|
||
severity String // low, medium, high, critical
|
||
status String @default("detected") // detected, resolved, ignored
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
audit GapAudit @relation(fields: [auditId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([detectionId])
|
||
@@index([auditId])
|
||
@@index([gapType])
|
||
@@index([systemScope])
|
||
@@index([severity])
|
||
@@map("gap_detections")
|
||
}
|
||
|
||
model GeneratedModule {
|
||
id String @id @default(uuid())
|
||
moduleId String @unique
|
||
gapType String
|
||
moduleType String // settlement, quantum, metaverse, fx, identity
|
||
status String @default("generated") // generated, implemented, deprecated
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([moduleId])
|
||
@@index([gapType])
|
||
@@index([moduleType])
|
||
@@index([status])
|
||
@@map("generated_modules")
|
||
}
|
||
|
||
model SystemRecommendation {
|
||
id String @id @default(uuid())
|
||
recommendationId String @unique
|
||
auditId String
|
||
recommendationType String // settlement_layer, synthetic_assets, ai_supervisory, etc.
|
||
title String
|
||
description String @db.Text
|
||
priority String // low, medium, high, critical
|
||
status String @default("pending") // pending, approved, implemented, rejected
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
audit GapAudit @relation(fields: [auditId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([recommendationId])
|
||
@@index([auditId])
|
||
@@index([recommendationType])
|
||
@@index([priority])
|
||
@@index([status])
|
||
@@map("system_recommendations")
|
||
}
|
||
|
||
model GapType {
|
||
id String @id @default(uuid())
|
||
gapTypeId String @unique
|
||
gapType String @unique
|
||
description String @db.Text
|
||
autoGenerate Boolean @default(false)
|
||
status String @default("active")
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([gapTypeId])
|
||
@@index([gapType])
|
||
@@index([status])
|
||
@@map("gap_types")
|
||
}
|
||
|
||
// ============================================================================
|
||
// DBIS Volume III: Global Bond Markets & Synthetic Liquidity Systems
|
||
// ============================================================================
|
||
|
||
// Synthetic GRU Bond Instruments
|
||
model SyntheticGruBond {
|
||
id String @id @default(uuid())
|
||
syntheticBondId String @unique
|
||
instrumentType String // sGRU-BND, sGRU-ETF, sGRU-FWD, sGRU-SWAP
|
||
bondId String? // Reference to underlying GRU bond
|
||
underlyingBonds Json? // Array of underlying bond IDs for basket/ETF
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
currentPrice Decimal? @db.Decimal(32, 12)
|
||
nav Decimal? @db.Decimal(32, 12) // For ETF
|
||
forwardPrice Decimal? @db.Decimal(32, 12) // For FWD
|
||
swapRate Decimal? @db.Decimal(32, 12) // For SWAP
|
||
sovereignBankId String
|
||
issuerId String? // Synthetic instrument issuer
|
||
maturityDate DateTime?
|
||
settlementDate DateTime? // For forward contracts
|
||
status String @default("active") // active, expired, settled, closed
|
||
issuedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond GruBond? @relation("SyntheticGruBondToGruBond", fields: [bondId], references: [bondId], onDelete: SetNull)
|
||
settlements GruBondSettlement[]
|
||
pricingHistory BondPricingHistory[]
|
||
riskAssessments BondRiskAssessment[]
|
||
|
||
@@index([syntheticBondId])
|
||
@@index([instrumentType])
|
||
@@index([bondId])
|
||
@@index([sovereignBankId])
|
||
@@index([status])
|
||
@@map("synthetic_gru_bonds")
|
||
}
|
||
|
||
// GRU Bond Market Structure
|
||
model GruBondMarket {
|
||
id String @id @default(uuid())
|
||
marketId String @unique
|
||
marketLayer String // primary, supranational, sovereign, institutional, retail
|
||
marketName String
|
||
description String @db.Text
|
||
minInvestment Decimal? @db.Decimal(32, 8)
|
||
maxInvestment Decimal? @db.Decimal(32, 8)
|
||
participantTypes Json // Array of allowed participant types
|
||
status String @default("active") // active, suspended, closed
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
participants BondMarketParticipant[]
|
||
bondListings BondMarketListing[]
|
||
|
||
@@index([marketId])
|
||
@@index([marketLayer])
|
||
@@index([status])
|
||
@@map("gru_bond_markets")
|
||
}
|
||
|
||
model BondMarketParticipant {
|
||
id String @id @default(uuid())
|
||
participantId String @unique
|
||
marketId String
|
||
sovereignBankId String?
|
||
participantType String // scb, supranational, institutional, retail, quantum_node, holographic_node
|
||
participantName String
|
||
accessLevel String // full, limited, synthetic_only
|
||
status String @default("active") // active, suspended, revoked
|
||
approvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
market GruBondMarket @relation(fields: [marketId], references: [id], onDelete: Cascade)
|
||
sovereignBank SovereignBank? @relation(fields: [sovereignBankId], references: [id], onDelete: SetNull)
|
||
|
||
@@index([participantId])
|
||
@@index([marketId])
|
||
@@index([sovereignBankId])
|
||
@@index([participantType])
|
||
@@index([status])
|
||
@@map("bond_market_participants")
|
||
}
|
||
|
||
model BondMarketListing {
|
||
id String @id @default(uuid())
|
||
listingId String @unique
|
||
marketId String
|
||
bondId String? // GRU bond ID
|
||
syntheticBondId String? // Synthetic bond ID
|
||
listingType String // primary, secondary
|
||
listingPrice Decimal? @db.Decimal(32, 12)
|
||
quantity Decimal? @db.Decimal(32, 8)
|
||
status String @default("active") // active, filled, cancelled, expired
|
||
listedAt DateTime @default(now())
|
||
filledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
market GruBondMarket @relation(fields: [marketId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([listingId])
|
||
@@index([marketId])
|
||
@@index([bondId])
|
||
@@index([syntheticBondId])
|
||
@@index([status])
|
||
@@map("bond_market_listings")
|
||
}
|
||
|
||
// GRU Bond Pricing
|
||
model GruBondPricing {
|
||
id String @id @default(uuid())
|
||
pricingId String @unique
|
||
bondId String? // GRU bond ID
|
||
syntheticBondId String? // Synthetic bond ID
|
||
pricingModel String // base, discounted_acquisition, liquidity_loop_linked
|
||
basePrice Decimal @db.Decimal(32, 12)
|
||
indexAdjustment Decimal? @db.Decimal(32, 12)
|
||
liquidityAdjustment Decimal? @db.Decimal(32, 12)
|
||
riskAdjustment Decimal? @db.Decimal(32, 12)
|
||
finalPrice Decimal @db.Decimal(32, 12)
|
||
yield Decimal? @db.Decimal(32, 12)
|
||
discountRate Decimal? @db.Decimal(32, 12)
|
||
calculationDetails Json? // Detailed calculation breakdown
|
||
calculatedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond GruBond? @relation("GruBondPricingToGruBond", fields: [bondId], references: [bondId], onDelete: SetNull)
|
||
syntheticBond SyntheticGruBond? @relation("GruBondPricingToSynthetic", fields: [syntheticBondId], references: [syntheticBondId], onDelete: SetNull)
|
||
|
||
@@index([pricingId])
|
||
@@index([bondId])
|
||
@@index([syntheticBondId])
|
||
@@index([pricingModel])
|
||
@@index([calculatedAt])
|
||
@@map("gru_bond_pricing")
|
||
}
|
||
|
||
model BondPricingHistory {
|
||
id String @id @default(uuid())
|
||
historyId String @unique
|
||
bondId String?
|
||
syntheticBondId String?
|
||
price Decimal @db.Decimal(32, 12)
|
||
yield Decimal? @db.Decimal(32, 12)
|
||
volume Decimal? @db.Decimal(32, 8)
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
|
||
bond GruBond? @relation("BondPricingHistoryToGruBond", fields: [bondId], references: [bondId], onDelete: SetNull)
|
||
syntheticBond SyntheticGruBond? @relation("BondPricingHistoryToSynthetic", fields: [syntheticBondId], references: [syntheticBondId], onDelete: SetNull)
|
||
|
||
@@index([historyId])
|
||
@@index([bondId])
|
||
@@index([syntheticBondId])
|
||
@@index([timestamp])
|
||
@@map("bond_pricing_history")
|
||
}
|
||
|
||
// Synthetic Liquidity Systems
|
||
model SyntheticLiquidityEngine {
|
||
id String @id @default(uuid())
|
||
engineId String @unique
|
||
engineType String // GSE, GLP, ID-SLG, TRLM
|
||
engineName String
|
||
description String @db.Text
|
||
totalLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
availableLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
reservedLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
commodityVector Json? // Commodity vector data
|
||
fxVector Json? // FX vector data
|
||
temporalVector Json? // Temporal/quantum vector data
|
||
status String @default("active") // active, suspended, maintenance
|
||
lastUpdated DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
liquidityOperations LiquidityOperation[]
|
||
tensorStates LiquidityTensor[]
|
||
|
||
@@index([engineId])
|
||
@@index([engineType])
|
||
@@index([status])
|
||
@@map("synthetic_liquidity_engines")
|
||
}
|
||
|
||
model LiquidityTensor {
|
||
id String @id @default(uuid())
|
||
tensorId String @unique
|
||
engineId String
|
||
commodityIndex Int // Commodity vector index
|
||
fxIndex Int // FX vector index
|
||
temporalIndex Int // Temporal/quantum vector index
|
||
liquidityValue Decimal @db.Decimal(32, 8)
|
||
metadata Json?
|
||
timestamp DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
engine SyntheticLiquidityEngine @relation(fields: [engineId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([tensorId])
|
||
@@index([engineId])
|
||
@@index([commodityIndex, fxIndex, temporalIndex])
|
||
@@index([timestamp])
|
||
@@map("liquidity_tensors")
|
||
}
|
||
|
||
model LiquidityOperation {
|
||
id String @id @default(uuid())
|
||
operationId String @unique
|
||
engineId String
|
||
operationType String // swap, contribution, withdrawal, rebalance
|
||
amount Decimal @db.Decimal(32, 8)
|
||
sourceAsset String?
|
||
targetAsset String?
|
||
status String @default("pending") // pending, completed, failed
|
||
executedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
engine SyntheticLiquidityEngine @relation(fields: [engineId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([operationId])
|
||
@@index([engineId])
|
||
@@index([operationType])
|
||
@@index([status])
|
||
@@map("liquidity_operations")
|
||
}
|
||
|
||
// Bond Settlement
|
||
model GruBondSettlement {
|
||
id String @id @default(uuid())
|
||
settlementId String @unique
|
||
bondId String?
|
||
syntheticBondId String?
|
||
transactionId String?
|
||
sourceBankId String
|
||
destinationBankId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currencyCode String
|
||
settlementStage String // issuance, qps, gas, omega_layer, prime_ledger
|
||
qpsTransactionId String? // QPS transaction reference
|
||
gasSettlementId String? // GAS settlement reference
|
||
omegaLayerHash String? // Ω-Layer finality hash
|
||
primeLedgerHash String? // DBIS Prime Ledger hash
|
||
perpetualState Json? // Perpetual state reconciliation data
|
||
status String @default("pending") // pending, qps_complete, gas_complete, omega_complete, settled, failed
|
||
qpsCompletedAt DateTime?
|
||
gasCompletedAt DateTime?
|
||
omegaCompletedAt DateTime?
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond GruBond? @relation("GruBondSettlementToGruBond", fields: [bondId], references: [bondId], onDelete: SetNull)
|
||
syntheticBond SyntheticGruBond? @relation("GruBondSettlementToSynthetic", fields: [syntheticBondId], references: [syntheticBondId], onDelete: SetNull)
|
||
pipelineSteps BondSettlementPipeline[]
|
||
|
||
@@index([settlementId])
|
||
@@index([bondId])
|
||
@@index([syntheticBondId])
|
||
@@index([transactionId])
|
||
@@index([status])
|
||
@@index([settlementStage])
|
||
@@map("gru_bond_settlements")
|
||
}
|
||
|
||
model BondSettlementPipeline {
|
||
id String @id @default(uuid())
|
||
pipelineId String @unique
|
||
settlementId String
|
||
stage String // issuance, qps, gas, omega_layer, prime_ledger
|
||
stageStatus String @default("pending") // pending, in_progress, completed, failed
|
||
stageData Json? // Stage-specific data
|
||
errorMessage String? @db.Text
|
||
startedAt DateTime?
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
settlement GruBondSettlement @relation(fields: [settlementId], references: [settlementId], onDelete: Cascade)
|
||
|
||
@@index([pipelineId])
|
||
@@index([settlementId])
|
||
@@index([stage])
|
||
@@index([stageStatus])
|
||
@@map("bond_settlement_pipelines")
|
||
}
|
||
|
||
// Supranational Bonds
|
||
model SupranationalBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
bondType String // GRB, CRB
|
||
bondName String
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
supranationalCouncilId String
|
||
reserveBacking Json // Reserve backing details
|
||
commodityIndex String? // For CRB: XAU, PGM, BMG1, BMG2, BMG3
|
||
maturityDate DateTime
|
||
couponRate Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, matured, redeemed
|
||
issuedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
coupons SupranationalBondCoupon[]
|
||
reserveVerifications ReserveVerification[]
|
||
|
||
@@index([bondId])
|
||
@@index([bondType])
|
||
@@index([supranationalCouncilId])
|
||
@@index([status])
|
||
@@map("supranational_bonds")
|
||
}
|
||
|
||
model SupranationalBondCoupon {
|
||
id String @id @default(uuid())
|
||
couponId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
paymentDate DateTime
|
||
status String @default("pending") // pending, paid, failed
|
||
paidAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond SupranationalBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([couponId])
|
||
@@index([bondId])
|
||
@@index([status])
|
||
@@map("supranational_bond_coupons")
|
||
}
|
||
|
||
model ReserveVerification {
|
||
id String @id @default(uuid())
|
||
verificationId String @unique
|
||
bondId String
|
||
verificationType String // physical_audit, certificate_verification, custodian_verification
|
||
reserveAmount Decimal @db.Decimal(32, 8)
|
||
reserveType String // gru_reserve, commodity_reserve
|
||
commodityType String? // For commodity reserves
|
||
custodianId String?
|
||
certificateHash String? // HASH256 certificate
|
||
verificationStatus String @default("pending") // pending, verified, rejected
|
||
verifiedAt DateTime?
|
||
nextVerificationDate DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond SupranationalBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([verificationId])
|
||
@@index([bondId])
|
||
@@index([verificationStatus])
|
||
@@map("reserve_verifications")
|
||
}
|
||
|
||
// Metaverse & Holographic Bonds
|
||
model AvatarLinkedBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
bondName String
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
avatarId String // Digital identity/avatar ID
|
||
metaverseNodeId String?
|
||
digitalIdentityId String
|
||
metaverseAssetPortfolio Json? // Metaverse asset portfolio backing
|
||
maturityDate DateTime
|
||
couponRate Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, matured, redeemed
|
||
issuedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
coupons AvatarBondCoupon[]
|
||
|
||
@@index([bondId])
|
||
@@index([avatarId])
|
||
@@index([digitalIdentityId])
|
||
@@index([metaverseNodeId])
|
||
@@index([status])
|
||
@@map("avatar_linked_bonds")
|
||
}
|
||
|
||
model AvatarBondCoupon {
|
||
id String @id @default(uuid())
|
||
couponId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
paymentDate DateTime
|
||
status String @default("pending") // pending, paid, failed
|
||
paidAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond AvatarLinkedBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([couponId])
|
||
@@index([bondId])
|
||
@@index([status])
|
||
@@map("avatar_bond_coupons")
|
||
}
|
||
|
||
model HolographicBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
bondName String
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
holographicEconomyId String
|
||
simulatedEconomyId String?
|
||
certificateHash String // Holographic certificate hash
|
||
holographicData Json? // 3D certificate representation data
|
||
maturityDate DateTime
|
||
couponRate Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, matured, redeemed
|
||
issuedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
coupons HolographicBondCoupon[]
|
||
|
||
@@index([bondId])
|
||
@@index([holographicEconomyId])
|
||
@@index([simulatedEconomyId])
|
||
@@index([status])
|
||
@@map("holographic_bonds")
|
||
}
|
||
|
||
model HolographicBondCoupon {
|
||
id String @id @default(uuid())
|
||
couponId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
paymentDate DateTime
|
||
status String @default("pending") // pending, paid, failed
|
||
paidAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond HolographicBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([couponId])
|
||
@@index([bondId])
|
||
@@index([status])
|
||
@@map("holographic_bond_coupons")
|
||
}
|
||
|
||
// Quantum Bond Systems
|
||
model QuantumBond {
|
||
id String @id @default(uuid())
|
||
bondId String @unique
|
||
bondName String
|
||
principalAmount Decimal @db.Decimal(32, 8)
|
||
bondType String // q_bond, timeline_synchronized
|
||
quantumState Json? // Quantum state data
|
||
truthSamplingHash String? // Quantum truth sampling hash
|
||
observerCount Int @default(0) // Double-observer mitigation
|
||
timelineStates Json? // Timeline state data (t0, t-Δ, t+Δ)
|
||
mergedState Json? // Merged state: Bond_tΩ = Merge(Bond_t0, Bond_t−Δ, Bond_t+Δ)
|
||
maturityDate DateTime
|
||
couponRate Decimal @db.Decimal(32, 8)
|
||
status String @default("active") // active, collapsed, settled, merged
|
||
issuedAt DateTime @default(now())
|
||
collapsedAt DateTime?
|
||
mergedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
coupons QuantumBondCoupon[]
|
||
timelineSyncs TimelineSynchronizedBond[]
|
||
|
||
@@index([bondId])
|
||
@@index([bondType])
|
||
@@index([status])
|
||
@@map("quantum_bonds")
|
||
}
|
||
|
||
model QuantumBondCoupon {
|
||
id String @id @default(uuid())
|
||
couponId String @unique
|
||
bondId String
|
||
couponAmount Decimal @db.Decimal(32, 8)
|
||
paymentDate DateTime
|
||
quantumSettled Boolean @default(false)
|
||
truthSamplingHash String?
|
||
status String @default("pending") // pending, quantum_settled, paid, failed
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond QuantumBond @relation(fields: [bondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([couponId])
|
||
@@index([bondId])
|
||
@@index([status])
|
||
@@map("quantum_bond_coupons")
|
||
}
|
||
|
||
model TimelineSynchronizedBond {
|
||
id String @id @default(uuid())
|
||
syncId String @unique
|
||
quantumBondId String
|
||
timelineType String // t0, t_minus_delta, t_plus_delta
|
||
timelineState Json // State data for this timeline
|
||
syncStatus String @default("pending") // pending, synced, merged
|
||
syncedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
quantumBond QuantumBond @relation(fields: [quantumBondId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([syncId])
|
||
@@index([quantumBondId])
|
||
@@index([timelineType])
|
||
@@index([syncStatus])
|
||
@@map("timeline_synchronized_bonds")
|
||
}
|
||
|
||
// Bond Risk & Oversight
|
||
model BondRiskAssessment {
|
||
id String @id @default(uuid())
|
||
assessmentId String @unique
|
||
bondId String?
|
||
syntheticBondId String?
|
||
assessmentType String // sare, ari, composite
|
||
sovereignDefaultExposure Decimal? @db.Decimal(32, 8)
|
||
fxLinkedRisk Decimal? @db.Decimal(32, 8)
|
||
metalIndexDependency Decimal? @db.Decimal(32, 8)
|
||
creditRisk Decimal? @db.Decimal(32, 8)
|
||
marketRisk Decimal? @db.Decimal(32, 8)
|
||
liquidityRisk Decimal? @db.Decimal(32, 8)
|
||
operationalRisk Decimal? @db.Decimal(32, 8)
|
||
compositeRiskScore Decimal @db.Decimal(32, 8)
|
||
riskTier String // low, medium, high, critical
|
||
sareScore Decimal? @db.Decimal(32, 8)
|
||
ariCompliance Boolean @default(true)
|
||
assessmentDetails Json? // Detailed assessment data
|
||
assessedAt DateTime @default(now())
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
bond GruBond? @relation("BondRiskAssessmentToGruBond", fields: [bondId], references: [bondId], onDelete: SetNull)
|
||
syntheticBond SyntheticGruBond? @relation("BondRiskAssessmentToSynthetic", fields: [syntheticBondId], references: [syntheticBondId], onDelete: SetNull)
|
||
complianceRecords BondComplianceRecord[]
|
||
|
||
@@index([assessmentId])
|
||
@@index([bondId])
|
||
@@index([syntheticBondId])
|
||
@@index([assessmentType])
|
||
@@index([riskTier])
|
||
@@index([assessedAt])
|
||
@@map("bond_risk_assessments")
|
||
}
|
||
|
||
model BondComplianceRecord {
|
||
id String @id @default(uuid())
|
||
recordId String @unique
|
||
assessmentId String
|
||
complianceType String // regulatory, synthetic_market_integrity, general
|
||
complianceStatus String @default("compliant") // compliant, violation, warning
|
||
violationType String?
|
||
violationDetails Json?
|
||
ariAction String? // Automated ARI action taken
|
||
resolvedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
assessment BondRiskAssessment @relation(fields: [assessmentId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([recordId])
|
||
@@index([assessmentId])
|
||
@@index([complianceStatus])
|
||
@@index([complianceType])
|
||
@@map("bond_compliance_records")
|
||
}
|
||
|
||
// Bond Market Integration
|
||
model BondMarketIntegration {
|
||
id String @id @default(uuid())
|
||
integrationId String @unique
|
||
integrationType String // commodity_exchange, sovereign_platform, metaverse_market, quantum_dlt
|
||
externalSystemId String
|
||
externalSystemName String
|
||
integrationStatus String @default("active") // active, suspended, disconnected
|
||
lastSyncAt DateTime?
|
||
syncFrequency String @default("real_time") // real_time, hourly, daily
|
||
integrationConfig Json? // Integration configuration
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@index([integrationId])
|
||
@@index([integrationType])
|
||
@@index([integrationStatus])
|
||
@@map("bond_market_integrations")
|
||
}
|
||
|
||
// ============================================================================
|
||
// Nostro/Vostro Network - DBIS Integration Layer
|
||
// ============================================================================
|
||
|
||
model NostroVostroParticipant {
|
||
id String @id @default(uuid())
|
||
participantId String @unique
|
||
name String
|
||
bic String? @unique
|
||
lei String? @unique
|
||
country String // ISO 3166-1 alpha-2
|
||
regulatoryTier String // SCB, Tier1, Tier2, PSP
|
||
sovereignBankId String? // Link to SovereignBank if applicable
|
||
status String @default("active") // active, suspended, inactive
|
||
metadata Json? // Additional participant data
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
sovereignBank SovereignBank? @relation(fields: [sovereignBankId], references: [id], onDelete: SetNull)
|
||
accounts NostroVostroAccount[]
|
||
transfers NostroVostroTransfer[] @relation("TransferFromParticipant")
|
||
transfersTo NostroVostroTransfer[] @relation("TransferToParticipant")
|
||
reconciliations NostroVostroReconciliation[]
|
||
webhookSubscriptions NostroVostroWebhookSubscription[]
|
||
|
||
@@index([participantId])
|
||
@@index([bic])
|
||
@@index([lei])
|
||
@@index([regulatoryTier])
|
||
@@index([country])
|
||
@@index([status])
|
||
@@map("nostro_vostro_participants")
|
||
}
|
||
|
||
model NostroVostroAccount {
|
||
id String @id @default(uuid())
|
||
accountId String @unique
|
||
ownerParticipantId String
|
||
counterpartyParticipantId String
|
||
ibanOrLocalAccount String? // IBAN or local account identifier
|
||
currency String // ISO 4217
|
||
accountType String // NOSTRO, VOSTRO
|
||
status String @default("ACTIVE") // ACTIVE, SUSPENDED, CLOSED
|
||
currentBalance Decimal @default(0) @db.Decimal(32, 8)
|
||
availableLiquidity Decimal @default(0) @db.Decimal(32, 8)
|
||
holdAmount Decimal @default(0) @db.Decimal(32, 8)
|
||
lastUpdatedAt DateTime @default(now())
|
||
metadata Json? // Additional account data
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
ownerParticipant NostroVostroParticipant @relation(fields: [ownerParticipantId], references: [id], onDelete: Cascade)
|
||
transfers NostroVostroTransfer[] @relation("TransferFromAccount")
|
||
transfersTo NostroVostroTransfer[] @relation("TransferToAccount")
|
||
balanceHistory NostroVostroBalanceHistory[]
|
||
|
||
@@index([accountId])
|
||
@@index([ownerParticipantId])
|
||
@@index([counterpartyParticipantId])
|
||
@@index([accountType])
|
||
@@index([currency])
|
||
@@index([status])
|
||
@@map("nostro_vostro_accounts")
|
||
}
|
||
|
||
model NostroVostroBalanceHistory {
|
||
id String @id @default(uuid())
|
||
accountId String
|
||
balance Decimal @db.Decimal(32, 8)
|
||
availableLiquidity Decimal @db.Decimal(32, 8)
|
||
holdAmount Decimal @db.Decimal(32, 8)
|
||
recordedAt DateTime @default(now())
|
||
|
||
account NostroVostroAccount @relation(fields: [accountId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([accountId])
|
||
@@index([recordedAt])
|
||
@@map("nostro_vostro_balance_history")
|
||
}
|
||
|
||
model NostroVostroTransfer {
|
||
id String @id @default(uuid())
|
||
transferId String @unique
|
||
fromAccountId String
|
||
toAccountId String
|
||
fromParticipantId String
|
||
toParticipantId String
|
||
amount Decimal @db.Decimal(32, 8)
|
||
currency String // ISO 4217
|
||
settlementAsset String @default("FIAT") // FIAT, GRU, SSU, CBDC
|
||
valueDate DateTime
|
||
fxDetails Json? // FX rate, conversion details
|
||
status String @default("PENDING") // PENDING, ACCEPTED, SETTLED, REJECTED, CANCELLED
|
||
rejectionReason String?
|
||
idempotencyKey String? @unique
|
||
reference String? // External reference
|
||
metadata Json? // Additional transfer data
|
||
settledAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
fromAccount NostroVostroAccount @relation("TransferFromAccount", fields: [fromAccountId], references: [id])
|
||
toAccount NostroVostroAccount @relation("TransferToAccount", fields: [toAccountId], references: [id])
|
||
fromParticipant NostroVostroParticipant @relation("TransferFromParticipant", fields: [fromParticipantId], references: [id])
|
||
toParticipant NostroVostroParticipant @relation("TransferToParticipant", fields: [toParticipantId], references: [id])
|
||
reconciliation NostroVostroReconciliationTransfer?
|
||
|
||
@@index([transferId])
|
||
@@index([fromAccountId])
|
||
@@index([toAccountId])
|
||
@@index([fromParticipantId])
|
||
@@index([toParticipantId])
|
||
@@index([status])
|
||
@@index([valueDate])
|
||
@@index([idempotencyKey])
|
||
@@index([settlementAsset])
|
||
@@map("nostro_vostro_transfers")
|
||
}
|
||
|
||
model NostroVostroReconciliation {
|
||
id String @id @default(uuid())
|
||
reportId String @unique
|
||
participantId String
|
||
asOfDate DateTime
|
||
openingBalance Decimal @db.Decimal(32, 8)
|
||
closingBalance Decimal @db.Decimal(32, 8)
|
||
totalDebits Decimal @default(0) @db.Decimal(32, 8)
|
||
totalCredits Decimal @default(0) @db.Decimal(32, 8)
|
||
breakCount Int @default(0)
|
||
status String @default("PENDING") // PENDING, COMPLETED, FAILED
|
||
breaks Json? // Array of reconciliation breaks
|
||
metadata Json? // Additional reconciliation data
|
||
completedAt DateTime?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
participant NostroVostroParticipant @relation(fields: [participantId], references: [id], onDelete: Cascade)
|
||
transfer NostroVostroReconciliationTransfer?
|
||
|
||
@@index([reportId])
|
||
@@index([participantId])
|
||
@@index([asOfDate])
|
||
@@index([status])
|
||
@@map("nostro_vostro_reconciliations")
|
||
}
|
||
|
||
model NostroVostroReconciliationTransfer {
|
||
id String @id @default(uuid())
|
||
reconciliationId String @unique
|
||
transferId String @unique
|
||
matched Boolean @default(false)
|
||
matchDetails Json? // Matching details
|
||
createdAt DateTime @default(now())
|
||
|
||
reconciliation NostroVostroReconciliation @relation(fields: [reconciliationId], references: [id], onDelete: Cascade)
|
||
transfer NostroVostroTransfer @relation(fields: [transferId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([reconciliationId])
|
||
@@index([transferId])
|
||
@@map("nostro_vostro_reconciliation_transfers")
|
||
}
|
||
|
||
model NostroVostroWebhookSubscription {
|
||
id String @id @default(uuid())
|
||
subscriptionId String @unique
|
||
participantId String
|
||
webhookUrl String
|
||
eventTypes String[] // Array of event types to subscribe to
|
||
secret String // Webhook signature secret
|
||
status String @default("ACTIVE") // ACTIVE, SUSPENDED, INACTIVE
|
||
lastDeliveryAt DateTime?
|
||
failureCount Int @default(0)
|
||
metadata Json? // Additional subscription data
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
participant NostroVostroParticipant @relation(fields: [participantId], references: [id], onDelete: Cascade)
|
||
events NostroVostroWebhookEvent[]
|
||
|
||
@@index([subscriptionId])
|
||
@@index([participantId])
|
||
@@index([status])
|
||
@@map("nostro_vostro_webhook_subscriptions")
|
||
}
|
||
|
||
model NostroVostroWebhookEvent {
|
||
id String @id @default(uuid())
|
||
eventId String @unique
|
||
subscriptionId String
|
||
eventType String // TRANSFER_CREATED, TRANSFER_SETTLED, ACCOUNT_UPDATED, etc.
|
||
payload Json // Event payload
|
||
status String @default("PENDING") // PENDING, DELIVERED, FAILED, RETRYING
|
||
deliveryAttempts Int @default(0)
|
||
lastAttemptAt DateTime?
|
||
deliveredAt DateTime?
|
||
errorMessage String?
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
subscription NostroVostroWebhookSubscription @relation(fields: [subscriptionId], references: [id], onDelete: Cascade)
|
||
|
||
@@index([eventId])
|
||
@@index([subscriptionId])
|
||
@@index([eventType])
|
||
@@index([status])
|
||
@@index([createdAt])
|
||
@@map("nostro_vostro_webhook_events")
|
||
}
|
||
|