Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CREATE TYPE "SorobanWALOperation" AS ENUM ('buy', 'sell');
CREATE TYPE "SorobanWALState" AS ENUM ('PENDING', 'SUBMITTED', 'CONFIRMED', 'FAILED', 'ROLLED_BACK');

CREATE TABLE "soroban_wal_entries" (
"id" TEXT NOT NULL,
"idempotencyKey" TEXT NOT NULL,
"operation" "SorobanWALOperation" NOT NULL,
"wallet" TEXT NOT NULL,
"creatorWallet" TEXT NOT NULL,
"amount" DECIMAL(65,30) NOT NULL,
"expectedSupplyBefore" DECIMAL(65,30) NOT NULL,
"xdrPayload" TEXT NOT NULL,
"state" "SorobanWALState" NOT NULL DEFAULT 'PENDING',
"txHash" TEXT,
"submittedAt" TIMESTAMP(3),
"confirmedAt" TIMESTAMP(3),
"error" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "soroban_wal_entries_pkey" PRIMARY KEY ("id")
);

CREATE UNIQUE INDEX "soroban_wal_entries_idempotencyKey_key"
ON "soroban_wal_entries"("idempotencyKey");
CREATE UNIQUE INDEX "soroban_wal_entries_txHash_key"
ON "soroban_wal_entries"("txHash");
CREATE INDEX "soroban_wal_entries_state_createdAt_idx"
ON "soroban_wal_entries"("state", "createdAt");
33 changes: 33 additions & 0 deletions prisma/schema/soroban-wal.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
enum SorobanWALOperation {
BUY @map("buy")
SELL @map("sell")
}

enum SorobanWALState {
PENDING
SUBMITTED
CONFIRMED
FAILED
ROLLED_BACK
}

model SorobanWALEntry {
id String @id @default(cuid())
idempotencyKey String @unique
operation SorobanWALOperation
wallet String
creatorWallet String
amount Decimal
expectedSupplyBefore Decimal
xdrPayload String @db.Text
state SorobanWALState @default(PENDING)
txHash String? @unique
submittedAt DateTime?
confirmedAt DateTime?
error String? @db.Text
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@index([state, createdAt])
@@map("soroban_wal_entries")
}
Loading
Loading