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
13 changes: 13 additions & 0 deletions server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,19 @@ model RiskScore {
@@index([walletAddress, computedAt])
}

model FeePayer {
id String @id @default(uuid())
publicKey String @unique
isPaused Boolean @default(false)
lastUsedAt DateTime?
balance Decimal? @db.Decimal(20, 7)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

@@index([isPaused])
@@index([lastUsedAt])
}
Comment on lines +306 to +317
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if a migration file exists for the FeePayer model
fd -t f 'migration.sql' server/prisma/migrations --exec grep -l 'FeePayer' {} \; 2>/dev/null || echo "No migration found for FeePayer"

# List all migration directories to see what migrations exist
echo "Existing migrations:"
ls -la server/prisma/migrations/ 2>/dev/null || echo "No migrations directory found"

Repository: anonfedora/stellovault

Length of output: 699


🏁 Script executed:

#!/bin/bash
# Check the content of all migration files to see if any creates FeePayer table
echo "=== Checking migration file contents ==="
for dir in server/prisma/migrations/*/; do
  echo "
=== Migration: $(basename "$dir") ==="
  if [ -f "$dir/migration.sql" ]; then
    cat "$dir/migration.sql" | head -50
  else
    echo "No migration.sql found"
  fi
done

Repository: anonfedora/stellovault

Length of output: 4622


🏁 Script executed:

#!/bin/bash
# Verify the FeePayer model exists in the current schema
echo "=== Checking schema.prisma for FeePayer model ==="
grep -n "model FeePayer" server/prisma/schema.prisma

Repository: anonfedora/stellovault

Length of output: 136


🏁 Script executed:

#!/bin/bash
# Verify that FeePayer is actually used in the codebase
echo "=== Checking for FeePayer usage in fee-payer.service.ts ==="
grep -n "feePayer" server/src/services/fee-payer.service.ts 2>/dev/null | head -20

echo "
=== Checking for FeePayer usage in rebalancing.service.ts ==="
grep -n "feePayer" server/src/services/rebalancing.service.ts 2>/dev/null | head -20

echo "
=== All files referencing feePayer in codebase ==="
rg "feePayer" --type ts --type js -l 2>/dev/null || echo "None found"

Repository: anonfedora/stellovault

Length of output: 1653


A Prisma migration for the FeePayer model is required.

The FeePayer model was added to schema.prisma but no corresponding migration exists. The services actively query this table: fee-payer.service.ts calls prisma.feePayer.findFirst(), prisma.feePayer.update(), and prisma.feePayer.findMany(), while rebalancing.service.ts also calls prisma.feePayer.findMany().

Without the migration, these queries will fail at runtime with a "table does not exist" error, breaking fee payer selection and rebalancing logic.

Generate the migration with npx prisma migrate dev --name add_fee_payer and ensure it's applied before deployment.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@server/prisma/schema.prisma` around lines 306 - 317, Add and apply a Prisma
migration for the new FeePayer model so the DB table exists before services
query it: run the migration command (npx prisma migrate dev --name
add_fee_payer) to generate the migration for the FeePayer model (fields: id,
publicKey, isPaused, lastUsedAt, balance, createdAt, updatedAt and indexes on
isPaused and lastUsedAt), confirm the migration is applied to your environment,
and include the generated migration in the repo/CI so calls from
fee-payer.service.ts (prisma.feePayer.findFirst, update, findMany) and
rebalancing.service.ts (prisma.feePayer.findMany) will not fail at runtime.


// ─────────────────────────────────────────────
// Enums
// ─────────────────────────────────────────────
Expand Down
10 changes: 10 additions & 0 deletions server/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export const env = {
feePayer: {
publicKey: process.env.FEE_PAYER_PUBLIC || "",
secretKey: process.env.FEE_PAYER_SECRET || "",
minBalance: parseFloat(process.env.FEE_PAYER_MIN_BALANCE || "50"),
},

treasury: {
secretKey: process.env.TREASURY_SECRET || "",
},

vault: {
address: process.env.VAULT_ADDR || "http://127.0.0.1:8200",
token: process.env.VAULT_TOKEN || "",
},

jwt: {
Expand Down
5 changes: 5 additions & 0 deletions server/src/generated/prisma/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ export type GovernanceAuditLog = Prisma.GovernanceAuditLogModel
*
*/
export type RiskScore = Prisma.RiskScoreModel
/**
* Model FeePayer
*
*/
export type FeePayer = Prisma.FeePayerModel
5 changes: 5 additions & 0 deletions server/src/generated/prisma/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ export type GovernanceAuditLog = Prisma.GovernanceAuditLogModel
*
*/
export type RiskScore = Prisma.RiskScoreModel
/**
* Model FeePayer
*
*/
export type FeePayer = Prisma.FeePayerModel
54 changes: 54 additions & 0 deletions server/src/generated/prisma/commonInputTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,33 @@ export type EnumGovernanceStatusWithAggregatesFilter<$PrismaModel = never> = {
_max?: Prisma.NestedEnumGovernanceStatusFilter<$PrismaModel>
}

export type DecimalNullableFilter<$PrismaModel = never> = {
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
not?: Prisma.NestedDecimalNullableFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
}

export type DecimalNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
not?: Prisma.NestedDecimalNullableWithAggregatesFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_avg?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
_sum?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
_min?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
_max?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
}

export type NestedStringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
Expand Down Expand Up @@ -716,4 +743,31 @@ export type NestedEnumGovernanceStatusWithAggregatesFilter<$PrismaModel = never>
_max?: Prisma.NestedEnumGovernanceStatusFilter<$PrismaModel>
}

export type NestedDecimalNullableFilter<$PrismaModel = never> = {
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
not?: Prisma.NestedDecimalNullableFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
}

export type NestedDecimalNullableWithAggregatesFilter<$PrismaModel = never> = {
equals?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel> | null
in?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
notIn?: runtime.Decimal[] | runtime.DecimalJsLike[] | number[] | string[] | Prisma.ListDecimalFieldRefInput<$PrismaModel> | null
lt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
lte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gt?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
gte?: runtime.Decimal | runtime.DecimalJsLike | number | string | Prisma.DecimalFieldRefInput<$PrismaModel>
not?: Prisma.NestedDecimalNullableWithAggregatesFilter<$PrismaModel> | runtime.Decimal | runtime.DecimalJsLike | number | string | null
_count?: Prisma.NestedIntNullableFilter<$PrismaModel>
_avg?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
_sum?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
_min?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
_max?: Prisma.NestedDecimalNullableFilter<$PrismaModel>
}


18 changes: 14 additions & 4 deletions server/src/generated/prisma/internal/class.ts

Large diffs are not rendered by default.

93 changes: 91 additions & 2 deletions server/src/generated/prisma/internal/prismaNamespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ export const ModelName = {
GovernanceProposal: 'GovernanceProposal',
GovernanceVote: 'GovernanceVote',
GovernanceAuditLog: 'GovernanceAuditLog',
RiskScore: 'RiskScore'
RiskScore: 'RiskScore',
FeePayer: 'FeePayer'
} as const

export type ModelName = (typeof ModelName)[keyof typeof ModelName]
Expand All @@ -417,7 +418,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
omit: GlobalOmitOptions
}
meta: {
modelProps: "user" | "wallet" | "session" | "walletChallenge" | "escrow" | "collateral" | "loan" | "repayment" | "investment" | "oracleEvent" | "oracle" | "oracleRateLimit" | "oracleConfirmation" | "dispute" | "governanceProposal" | "governanceVote" | "governanceAuditLog" | "riskScore"
modelProps: "user" | "wallet" | "session" | "walletChallenge" | "escrow" | "collateral" | "loan" | "repayment" | "investment" | "oracleEvent" | "oracle" | "oracleRateLimit" | "oracleConfirmation" | "dispute" | "governanceProposal" | "governanceVote" | "governanceAuditLog" | "riskScore" | "feePayer"
txIsolationLevel: TransactionIsolationLevel
}
model: {
Expand Down Expand Up @@ -1753,6 +1754,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
}
}
}
FeePayer: {
payload: Prisma.$FeePayerPayload<ExtArgs>
fields: Prisma.FeePayerFieldRefs
operations: {
findUnique: {
args: Prisma.FeePayerFindUniqueArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload> | null
}
findUniqueOrThrow: {
args: Prisma.FeePayerFindUniqueOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>
}
findFirst: {
args: Prisma.FeePayerFindFirstArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload> | null
}
findFirstOrThrow: {
args: Prisma.FeePayerFindFirstOrThrowArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>
}
findMany: {
args: Prisma.FeePayerFindManyArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>[]
}
create: {
args: Prisma.FeePayerCreateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>
}
createMany: {
args: Prisma.FeePayerCreateManyArgs<ExtArgs>
result: BatchPayload
}
createManyAndReturn: {
args: Prisma.FeePayerCreateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>[]
}
delete: {
args: Prisma.FeePayerDeleteArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>
}
update: {
args: Prisma.FeePayerUpdateArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>
}
deleteMany: {
args: Prisma.FeePayerDeleteManyArgs<ExtArgs>
result: BatchPayload
}
updateMany: {
args: Prisma.FeePayerUpdateManyArgs<ExtArgs>
result: BatchPayload
}
updateManyAndReturn: {
args: Prisma.FeePayerUpdateManyAndReturnArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>[]
}
upsert: {
args: Prisma.FeePayerUpsertArgs<ExtArgs>
result: runtime.Types.Utils.PayloadToResult<Prisma.$FeePayerPayload>
}
aggregate: {
args: Prisma.FeePayerAggregateArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.AggregateFeePayer>
}
groupBy: {
args: Prisma.FeePayerGroupByArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.FeePayerGroupByOutputType>[]
}
count: {
args: Prisma.FeePayerCountArgs<ExtArgs>
result: runtime.Types.Utils.Optional<Prisma.FeePayerCountAggregateOutputType> | number
}
}
}
}
} & {
other: {
Expand Down Expand Up @@ -2027,6 +2102,19 @@ export const RiskScoreScalarFieldEnum = {
export type RiskScoreScalarFieldEnum = (typeof RiskScoreScalarFieldEnum)[keyof typeof RiskScoreScalarFieldEnum]


export const FeePayerScalarFieldEnum = {
id: 'id',
publicKey: 'publicKey',
isPaused: 'isPaused',
lastUsedAt: 'lastUsedAt',
balance: 'balance',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const

export type FeePayerScalarFieldEnum = (typeof FeePayerScalarFieldEnum)[keyof typeof FeePayerScalarFieldEnum]


export const SortOrder = {
asc: 'asc',
desc: 'desc'
Expand Down Expand Up @@ -2374,6 +2462,7 @@ export type GlobalOmitConfig = {
governanceVote?: Prisma.GovernanceVoteOmit
governanceAuditLog?: Prisma.GovernanceAuditLogOmit
riskScore?: Prisma.RiskScoreOmit
feePayer?: Prisma.FeePayerOmit
}

/* Types for Logging */
Expand Down
16 changes: 15 additions & 1 deletion server/src/generated/prisma/internal/prismaNamespaceBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const ModelName = {
GovernanceProposal: 'GovernanceProposal',
GovernanceVote: 'GovernanceVote',
GovernanceAuditLog: 'GovernanceAuditLog',
RiskScore: 'RiskScore'
RiskScore: 'RiskScore',
FeePayer: 'FeePayer'
} as const

export type ModelName = (typeof ModelName)[keyof typeof ModelName]
Expand Down Expand Up @@ -322,6 +323,19 @@ export const RiskScoreScalarFieldEnum = {
export type RiskScoreScalarFieldEnum = (typeof RiskScoreScalarFieldEnum)[keyof typeof RiskScoreScalarFieldEnum]


export const FeePayerScalarFieldEnum = {
id: 'id',
publicKey: 'publicKey',
isPaused: 'isPaused',
lastUsedAt: 'lastUsedAt',
balance: 'balance',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const

export type FeePayerScalarFieldEnum = (typeof FeePayerScalarFieldEnum)[keyof typeof FeePayerScalarFieldEnum]


export const SortOrder = {
asc: 'asc',
desc: 'desc'
Expand Down
1 change: 1 addition & 0 deletions server/src/generated/prisma/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export type * from './models/GovernanceProposal'
export type * from './models/GovernanceVote'
export type * from './models/GovernanceAuditLog'
export type * from './models/RiskScore'
export type * from './models/FeePayer'
export type * from './commonInputTypes'
Loading
Loading