@merkl/api 0.19.29 → 0.19.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/api/.generated/edge.js +2 -2
- package/dist/database/api/.generated/index.js +2 -2
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +4 -4
- package/dist/src/modules/v4/merklRoot/merklRoot.service.d.ts +2 -8
- package/dist/src/modules/v4/merklRoot/merklRoot.service.js +13 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -664,8 +664,8 @@ const config = {
|
|
664
664
|
}
|
665
665
|
}
|
666
666
|
},
|
667
|
-
"inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"linux-arm64-openssl-1.1.x\", \"linux-musl-arm64-openssl-3.0.x\"]\n output = \".generated/\"\n previewFeatures = [\"fullTextSearchPostgres\", \"relationJoins\"]\n}\n\ngenerator drizzle {\n provider = \"drizzle-prisma-generator\"\n output = \".generated/drizzle/\" // Where to put generated Drizle tables\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_API_URL\")\n}\n\nmodel Campaign {\n id String @id\n ComputeChain Chain @relation(\"compute\", fields: [computeChainId], references: [id])\n computeChainId Int\n DistributionChain Chain @relation(\"distribution\", fields: [distributionChainId], references: [id])\n distributionChainId Int\n campaignId String\n type String\n // distributionType DistributionType @default(DUTCH_AUCTION)\n subType Int?\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n startTimestamp BigInt\n endTimestamp BigInt\n params Json\n RewardBreakdown RewardBreakdown[]\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n Creator User @relation(fields: [creatorAddress], references: [address])\n creatorAddress String @db.Char(42)\n // Should probably be a 1 to 1 relation if we do not want to keep historic records\n CampaignStatus CampaignStatus[]\n CampaignEngineValues CampaignComputedValue[]\n UserComputedValue UserComputedValue[]\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n manualOverrides CampaignManualOverride[] @default([])\n\n createdAt DateTime @default(now())\n\n @@unique([distributionChainId, campaignId])\n @@index([opportunityId], type: Hash)\n}\n\n// SubTable of Campaigns that should be here as soon as the campaign is processed\nmodel CampaignStatus {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n computedUntil BigInt\n processingStarted BigInt\n status RunStatus @default(SUCCESS)\n error String @default(\"\")\n details Json @default(\"{}\")\n}\n\n// SubTable of Campaigns that will contain values populated by the Engine when it's running\nmodel CampaignComputedValue {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n averageBoost Float? // Average boost in case of boosting hook\n totalDistributedInUSD Float? // Used in case there is a distribution cap\n forfeitingBoost Float? // In case some rewards are forfeited, resulting boost for remaining users\n}\n\nmodel UserComputedValue {\n id Int @id @default(autoincrement())\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n address String @db.Char(42)\n User User? @relation(fields: [address], references: [address])\n reason String\n boost Float?\n\n @@unique([campaignId, address, reason])\n}\n\nmodel Chain {\n id Int @id\n name String\n icon String\n // liveCampaigns Int @default(0)\n // dailyRewards Float @default(0)\n Explorer Explorer[]\n Campaigns Campaign[] @relation(\"compute\")\n Distribution Campaign[] @relation(\"distribution\")\n Token Token[]\n Opportunity Opportunity[]\n MerklRoot MerklRoot[]\n Blacklist Blacklist[]\n Dump Dump[]\n}\n\nmodel Explorer {\n id String @id\n type ExplorerType\n Chain Chain @relation(fields: [chainId], references: [id])\n url String\n chainId Int\n\n @@unique([type, chainId])\n}\n\nmodel Opportunity {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id]) // compute\n chainId Int // compute\n type String\n identifier String // eg. 0xUniswapPool - formerly mainParameter\n name String\n depositUrl String?\n status Status\n action OpportunityAction\n Tokens Token[]\n Campaigns Campaign[]\n Protocols Protocol[]\n MainProtocol Protocol? @relation(name: \"main\", fields: [mainProtocolId], references: [id])\n mainProtocolId String?\n tvl Float @default(0)\n TvlRecords TVLRecord[]\n apr Float @default(0)\n AprRecords AprRecord[]\n dailyRewards Float @default(0)\n DailyRewardsRecords DailyRewardsRecord[]\n tags String[] @default([])\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n // manualOverrides OpportunityManualOverride[] @default([])\n\n @@unique([chainId, type, identifier])\n}\n\nmodel Protocol {\n id String @id\n tags String[] @default([])\n name String\n description String @default(\"\")\n url String\n icon String\n // liveCampaigns Int @default(0)\n // totalDailyRewards Float @default(0)\n MainOpportunities Opportunity[] @relation(name: \"main\")\n Opportunities Opportunity[]\n RewardBreakdown RewardBreakdown[]\n}\n\nmodel Token {\n id String @id()\n name String?\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n address String @db.Char(42)\n decimals Int\n symbol String\n displaySymbol String @default(\"\")\n icon String\n verified Boolean @default(false)\n isTest Boolean @default(false)\n isPoint Boolean @default(false)\n isNative Boolean @default(false)\n price Float?\n Opportunity Opportunity[]\n Campaigns Campaign[]\n Reward Reward[]\n DumpTo Dump[] @relation(\"to\")\n DumpFrom Dump[] @relation(\"from\")\n\n @@unique([chainId, address])\n @@index([chainId], type: Hash)\n @@index([symbol, address])\n}\n\nmodel AprRecord {\n id String @id\n timestamp BigInt\n cumulated Float\n AprBreakdown AprBreakdown[]\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel AprBreakdown {\n id Int @id @default(autoincrement())\n identifier String\n type AprType\n value Float\n AprRecord AprRecord @relation(fields: [aprRecordId], references: [id])\n aprRecordId String\n\n @@index([aprRecordId], type: Hash)\n}\n\nmodel TVLRecord {\n id String @id\n timestamp BigInt\n total Float\n TvlBreakdown TVLBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel TVLBreakdown {\n id Int @id @default(autoincrement())\n identifier String\n type TvlType\n value Float\n\n TvlRecord TVLRecord @relation(fields: [tvlRecordId], references: [id])\n tvlRecordId String\n\n @@index([tvlRecordId], type: Hash)\n}\n\nmodel DailyRewardsRecord {\n id String @id\n timestamp BigInt\n total Float\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel DailyRewardsBreakdown {\n id Int @id @default(autoincrement())\n value Float\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n DailyRewardsRecord DailyRewardsRecord @relation(fields: [dailyRewardsRecordId], references: [id])\n dailyRewardsRecordId String\n\n @@index([dailyRewardsRecordId], type: Hash)\n}\n\nmodel User {\n address String @id @db.Char(42)\n Rewards Reward[]\n Blacklist Blacklist[]\n CampaignsCreated Campaign[]\n UserComputedValue UserComputedValue[]\n tags String[]\n\n Creator Creator? @relation(fields: [creatorId], references: [id])\n creatorId String?\n}\n\nmodel Creator {\n id String @id\n icon String?\n name String\n Users User[]\n}\n\nmodel Reward {\n id String @id\n MerklRoot MerklRoot @relation(fields: [root], references: [root])\n root String\n User User @relation(fields: [recipient], references: [address])\n recipient String @db.Char(42)\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String @default(\"0\")\n claimed String @default(\"0\")\n pending String @default(\"0\")\n proofs String[]\n Breakdown RewardBreakdown[]\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([root, recipient, rewardTokenId])\n @@index([root], type: Hash)\n @@index([recipient, rewardTokenId])\n}\n\nmodel RewardBreakdown {\n id BigInt @id @default(autoincrement())\n Protocol Protocol? @relation(fields: [protocolId], references: [id])\n protocolId String?\n reason String\n amount String\n claimed String\n pending String\n Reward Reward @relation(fields: [rewardId], references: [id], onDelete: Cascade)\n rewardId String\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([rewardId, campaignId, reason])\n @@index([rewardId], type: Hash)\n @@index([campaignId], type: Hash)\n}\n\nmodel MerklRoot {\n root String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n epoch Int\n timestamp BigInt\n Rewards Reward[]\n\n @@index([chainId, root])\n}\n\nmodel PriceSource {\n id Int @id @default(autoincrement())\n symbol String @unique() // Price Id\n method PriceSourceMethod\n args Json?\n}\n\n// priceId -> number\n\nmodel Blacklist {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n poolAddress String @db.Char(42)\n User User @relation(fields: [userAddress], references: [address])\n userAddress String @db.Char(42)\n arrestTimestamp BigInt\n arrestDetails Json\n\n @@unique([chainId, userAddress, poolAddress])\n @@index([userAddress], type: Hash)\n}\n\nmodel Dump {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n FromToken Token @relation(name: \"from\", fields: [fromTokenId], references: [id])\n fromTokenId String\n ToToken Token @relation(name: \"to\", fields: [toTokenId], references: [id])\n toTokenId String\n multisig String @db.Char(42)\n recipient String @db.Char(42)\n amountIn String @default(\"0\")\n amountOut String @default(\"0\")\n datetime DateTime\n timestamp Int\n\n @@unique([chainId, fromTokenId, toTokenId, timestamp])\n}\n\nmodel Logged {\n id String @id\n chainId Int\n type LoggedEntityType @default(UNKNOWN)\n address String? @db.Char(42)\n fetchAtBlock Int\n caughtFromAddress String @db.Char(42)\n entityData Json\n\n @@unique([chainId, address])\n}\n\n// enums\n\nenum LoggedEntityType {\n UNKNOWN\n EULER_VAULT\n UNISWAP_V4\n COMPOUND_v2\n}\n\nenum RunStatus {\n PROCESSING\n SUCCESS\n FAILED\n SKIPPED\n}\n\nenum OpportunityAction {\n POOL\n HOLD\n DROP\n LEND\n BORROW\n LONG\n SHORT\n SWAP\n INVALID\n}\n\nenum Status {\n NONE // This would mean that no campaigns was ever created for this opportunity\n PAST\n LIVE\n SOON\n}\n\nenum ExplorerType {\n ETHERSCAN\n BLOCKSCOUT\n}\n\nenum AprType {\n CAMPAIGN\n TOKEN\n PROTOCOL\n}\n\nenum TvlType {\n TOKEN\n PROTOCOL\n}\n\nenum PriceSourceMethod {\n COINGECKO\n CONSTANT\n EQUAL_TO\n ERC4626\n DEXSCREENER\n INDEXCOOP\n DEFILLAMA\n}\n\nenum CampaignManualOverride {\n opportunityId\n creatorAddress\n}\n\nenum OpportunityManualOverride {\n identifier\n name\n depositUrl\n action\n mainProtocolId\n}\n\nenum DistributionType {\n DUTCH_AUCTION\n FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE // The fix reward value will lie in params.apr\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE\n FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT\n}\n",
|
668
|
-
"inlineSchemaHash": "
|
667
|
+
"inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"linux-arm64-openssl-1.1.x\", \"linux-musl-arm64-openssl-3.0.x\"]\n output = \".generated/\"\n previewFeatures = [\"fullTextSearchPostgres\", \"relationJoins\"]\n}\n\ngenerator drizzle {\n provider = \"drizzle-prisma-generator\"\n output = \".generated/drizzle/\" // Where to put generated Drizle tables\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_API_URL\")\n}\n\nmodel Campaign {\n id String @id\n ComputeChain Chain @relation(\"compute\", fields: [computeChainId], references: [id])\n computeChainId Int\n DistributionChain Chain @relation(\"distribution\", fields: [distributionChainId], references: [id])\n distributionChainId Int\n campaignId String\n type String\n // distributionType DistributionType @default(DUTCH_AUCTION)\n subType Int?\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n startTimestamp BigInt\n endTimestamp BigInt\n params Json\n RewardBreakdown RewardBreakdown[]\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n Creator User @relation(fields: [creatorAddress], references: [address])\n creatorAddress String @db.Char(42)\n // Should probably be a 1 to 1 relation if we do not want to keep historic records\n CampaignStatus CampaignStatus[]\n CampaignEngineValues CampaignComputedValue[]\n UserComputedValue UserComputedValue[]\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n manualOverrides CampaignManualOverride[] @default([])\n\n createdAt DateTime @default(now())\n\n @@unique([distributionChainId, campaignId])\n @@index([opportunityId], type: Hash)\n}\n\n// SubTable of Campaigns that should be here as soon as the campaign is processed\nmodel CampaignStatus {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n computedUntil BigInt\n processingStarted BigInt\n status RunStatus @default(SUCCESS)\n error String @default(\"\")\n details Json @default(\"{}\")\n}\n\n// SubTable of Campaigns that will contain values populated by the Engine when it's running\nmodel CampaignComputedValue {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n averageBoost Float? // Average boost in case of boosting hook\n totalDistributedInUSD Float? // Used in case there is a distribution cap\n forfeitingBoost Float? // In case some rewards are forfeited, resulting boost for remaining users\n}\n\nmodel UserComputedValue {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n address String @db.Char(42)\n User User? @relation(fields: [address], references: [address])\n reason String\n boost Float?\n\n @@unique([campaignId, address, reason])\n}\n\nmodel Chain {\n id Int @id\n name String\n icon String\n // liveCampaigns Int @default(0)\n // dailyRewards Float @default(0)\n Explorer Explorer[]\n Campaigns Campaign[] @relation(\"compute\")\n Distribution Campaign[] @relation(\"distribution\")\n Token Token[]\n Opportunity Opportunity[]\n MerklRoot MerklRoot[]\n Blacklist Blacklist[]\n Dump Dump[]\n}\n\nmodel Explorer {\n id String @id\n type ExplorerType\n Chain Chain @relation(fields: [chainId], references: [id])\n url String\n chainId Int\n\n @@unique([type, chainId])\n}\n\nmodel Opportunity {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id]) // compute\n chainId Int // compute\n type String\n identifier String // eg. 0xUniswapPool - formerly mainParameter\n name String\n depositUrl String?\n status Status\n action OpportunityAction\n Tokens Token[]\n Campaigns Campaign[]\n Protocols Protocol[]\n MainProtocol Protocol? @relation(name: \"main\", fields: [mainProtocolId], references: [id])\n mainProtocolId String?\n tvl Float @default(0)\n TvlRecords TVLRecord[]\n apr Float @default(0)\n AprRecords AprRecord[]\n dailyRewards Float @default(0)\n DailyRewardsRecords DailyRewardsRecord[]\n tags String[] @default([])\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n // manualOverrides OpportunityManualOverride[] @default([])\n\n @@unique([chainId, type, identifier])\n}\n\nmodel Protocol {\n id String @id\n tags String[] @default([])\n name String\n description String @default(\"\")\n url String\n icon String\n // liveCampaigns Int @default(0)\n // totalDailyRewards Float @default(0)\n MainOpportunities Opportunity[] @relation(name: \"main\")\n Opportunities Opportunity[]\n RewardBreakdown RewardBreakdown[]\n}\n\nmodel Token {\n id String @id()\n name String?\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n address String @db.Char(42)\n decimals Int\n symbol String\n displaySymbol String @default(\"\")\n icon String\n verified Boolean @default(false)\n isTest Boolean @default(false)\n isPoint Boolean @default(false)\n isNative Boolean @default(false)\n price Float?\n Opportunity Opportunity[]\n Campaigns Campaign[]\n Reward Reward[]\n DumpTo Dump[] @relation(\"to\")\n DumpFrom Dump[] @relation(\"from\")\n\n @@unique([chainId, address])\n @@index([chainId], type: Hash)\n @@index([symbol, address])\n}\n\nmodel AprRecord {\n id String @id\n timestamp BigInt\n cumulated Float\n AprBreakdown AprBreakdown[]\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel AprBreakdown {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n identifier String\n type AprType\n value Float\n AprRecord AprRecord @relation(fields: [aprRecordId], references: [id])\n aprRecordId String\n\n @@index([aprRecordId], type: Hash)\n}\n\nmodel TVLRecord {\n id String @id\n timestamp BigInt\n total Float\n TvlBreakdown TVLBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel TVLBreakdown {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n identifier String\n type TvlType\n value Float\n\n TvlRecord TVLRecord @relation(fields: [tvlRecordId], references: [id])\n tvlRecordId String\n\n @@index([tvlRecordId], type: Hash)\n}\n\nmodel DailyRewardsRecord {\n id String @id\n timestamp BigInt\n total Float\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel DailyRewardsBreakdown {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n value Float\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n DailyRewardsRecord DailyRewardsRecord @relation(fields: [dailyRewardsRecordId], references: [id])\n dailyRewardsRecordId String\n\n @@index([dailyRewardsRecordId], type: Hash)\n}\n\nmodel User {\n address String @id @db.Char(42)\n Rewards Reward[]\n Blacklist Blacklist[]\n CampaignsCreated Campaign[]\n UserComputedValue UserComputedValue[]\n tags String[]\n\n Creator Creator? @relation(fields: [creatorId], references: [id])\n creatorId String?\n}\n\nmodel Creator {\n id String @id\n icon String?\n name String\n Users User[]\n}\n\nmodel Reward {\n id String @id\n MerklRoot MerklRoot @relation(fields: [root], references: [root])\n root String\n User User @relation(fields: [recipient], references: [address])\n recipient String @db.Char(42)\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String @default(\"0\")\n claimed String @default(\"0\")\n pending String @default(\"0\")\n proofs String[]\n Breakdown RewardBreakdown[]\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([root, recipient, rewardTokenId])\n @@index([root], type: Hash)\n @@index([recipient, rewardTokenId])\n}\n\nmodel RewardBreakdown {\n id BigInt @id @default(autoincrement())\n Protocol Protocol? @relation(fields: [protocolId], references: [id])\n protocolId String?\n reason String\n amount String\n claimed String\n pending String\n Reward Reward @relation(fields: [rewardId], references: [id], onDelete: Cascade)\n rewardId String\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([rewardId, campaignId, reason])\n @@index([rewardId], type: Hash)\n @@index([campaignId], type: Hash)\n}\n\nmodel MerklRoot {\n root String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n epoch Int\n timestamp BigInt\n Rewards Reward[]\n\n @@index([chainId, root])\n}\n\nmodel PriceSource {\n id Int @id @default(autoincrement())\n symbol String @unique() // Price Id\n method PriceSourceMethod\n args Json?\n}\n\n// priceId -> number\n\nmodel Blacklist {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n poolAddress String @db.Char(42)\n User User @relation(fields: [userAddress], references: [address])\n userAddress String @db.Char(42)\n arrestTimestamp BigInt\n arrestDetails Json\n\n @@unique([chainId, userAddress, poolAddress])\n @@index([userAddress], type: Hash)\n}\n\nmodel Dump {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n FromToken Token @relation(name: \"from\", fields: [fromTokenId], references: [id])\n fromTokenId String\n ToToken Token @relation(name: \"to\", fields: [toTokenId], references: [id])\n toTokenId String\n multisig String @db.Char(42)\n recipient String @db.Char(42)\n amountIn String @default(\"0\")\n amountOut String @default(\"0\")\n datetime DateTime\n timestamp Int\n\n @@unique([chainId, fromTokenId, toTokenId, timestamp])\n}\n\nmodel Logged {\n id String @id\n chainId Int\n type LoggedEntityType @default(UNKNOWN)\n address String? @db.Char(42)\n fetchAtBlock Int\n caughtFromAddress String @db.Char(42)\n entityData Json\n\n @@unique([chainId, address])\n}\n\n// enums\n\nenum LoggedEntityType {\n UNKNOWN\n EULER_VAULT\n UNISWAP_V4\n COMPOUND_v2\n}\n\nenum RunStatus {\n PROCESSING\n SUCCESS\n FAILED\n SKIPPED\n}\n\nenum OpportunityAction {\n POOL\n HOLD\n DROP\n LEND\n BORROW\n LONG\n SHORT\n SWAP\n INVALID\n}\n\nenum Status {\n NONE // This would mean that no campaigns was ever created for this opportunity\n PAST\n LIVE\n SOON\n}\n\nenum ExplorerType {\n ETHERSCAN\n BLOCKSCOUT\n}\n\nenum AprType {\n CAMPAIGN\n TOKEN\n PROTOCOL\n}\n\nenum TvlType {\n TOKEN\n PROTOCOL\n}\n\nenum PriceSourceMethod {\n COINGECKO\n CONSTANT\n EQUAL_TO\n ERC4626\n DEXSCREENER\n INDEXCOOP\n DEFILLAMA\n}\n\nenum CampaignManualOverride {\n opportunityId\n creatorAddress\n}\n\nenum OpportunityManualOverride {\n identifier\n name\n depositUrl\n action\n mainProtocolId\n}\n\nenum DistributionType {\n DUTCH_AUCTION\n FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE // The fix reward value will lie in params.apr\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE\n FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT\n}\n",
|
668
|
+
"inlineSchemaHash": "4e125a0c0d9c7fb82c4ae9768673e1373ffa32d3456db1b0c2c3530bcc4178e3",
|
669
669
|
"copyEngine": true
|
670
670
|
}
|
671
671
|
config.dirname = '/'
|
@@ -665,8 +665,8 @@ const config = {
|
|
665
665
|
}
|
666
666
|
}
|
667
667
|
},
|
668
|
-
"inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"linux-arm64-openssl-1.1.x\", \"linux-musl-arm64-openssl-3.0.x\"]\n output = \".generated/\"\n previewFeatures = [\"fullTextSearchPostgres\", \"relationJoins\"]\n}\n\ngenerator drizzle {\n provider = \"drizzle-prisma-generator\"\n output = \".generated/drizzle/\" // Where to put generated Drizle tables\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_API_URL\")\n}\n\nmodel Campaign {\n id String @id\n ComputeChain Chain @relation(\"compute\", fields: [computeChainId], references: [id])\n computeChainId Int\n DistributionChain Chain @relation(\"distribution\", fields: [distributionChainId], references: [id])\n distributionChainId Int\n campaignId String\n type String\n // distributionType DistributionType @default(DUTCH_AUCTION)\n subType Int?\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n startTimestamp BigInt\n endTimestamp BigInt\n params Json\n RewardBreakdown RewardBreakdown[]\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n Creator User @relation(fields: [creatorAddress], references: [address])\n creatorAddress String @db.Char(42)\n // Should probably be a 1 to 1 relation if we do not want to keep historic records\n CampaignStatus CampaignStatus[]\n CampaignEngineValues CampaignComputedValue[]\n UserComputedValue UserComputedValue[]\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n manualOverrides CampaignManualOverride[] @default([])\n\n createdAt DateTime @default(now())\n\n @@unique([distributionChainId, campaignId])\n @@index([opportunityId], type: Hash)\n}\n\n// SubTable of Campaigns that should be here as soon as the campaign is processed\nmodel CampaignStatus {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n computedUntil BigInt\n processingStarted BigInt\n status RunStatus @default(SUCCESS)\n error String @default(\"\")\n details Json @default(\"{}\")\n}\n\n// SubTable of Campaigns that will contain values populated by the Engine when it's running\nmodel CampaignComputedValue {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n averageBoost Float? // Average boost in case of boosting hook\n totalDistributedInUSD Float? // Used in case there is a distribution cap\n forfeitingBoost Float? // In case some rewards are forfeited, resulting boost for remaining users\n}\n\nmodel UserComputedValue {\n id Int @id @default(autoincrement())\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n address String @db.Char(42)\n User User? @relation(fields: [address], references: [address])\n reason String\n boost Float?\n\n @@unique([campaignId, address, reason])\n}\n\nmodel Chain {\n id Int @id\n name String\n icon String\n // liveCampaigns Int @default(0)\n // dailyRewards Float @default(0)\n Explorer Explorer[]\n Campaigns Campaign[] @relation(\"compute\")\n Distribution Campaign[] @relation(\"distribution\")\n Token Token[]\n Opportunity Opportunity[]\n MerklRoot MerklRoot[]\n Blacklist Blacklist[]\n Dump Dump[]\n}\n\nmodel Explorer {\n id String @id\n type ExplorerType\n Chain Chain @relation(fields: [chainId], references: [id])\n url String\n chainId Int\n\n @@unique([type, chainId])\n}\n\nmodel Opportunity {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id]) // compute\n chainId Int // compute\n type String\n identifier String // eg. 0xUniswapPool - formerly mainParameter\n name String\n depositUrl String?\n status Status\n action OpportunityAction\n Tokens Token[]\n Campaigns Campaign[]\n Protocols Protocol[]\n MainProtocol Protocol? @relation(name: \"main\", fields: [mainProtocolId], references: [id])\n mainProtocolId String?\n tvl Float @default(0)\n TvlRecords TVLRecord[]\n apr Float @default(0)\n AprRecords AprRecord[]\n dailyRewards Float @default(0)\n DailyRewardsRecords DailyRewardsRecord[]\n tags String[] @default([])\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n // manualOverrides OpportunityManualOverride[] @default([])\n\n @@unique([chainId, type, identifier])\n}\n\nmodel Protocol {\n id String @id\n tags String[] @default([])\n name String\n description String @default(\"\")\n url String\n icon String\n // liveCampaigns Int @default(0)\n // totalDailyRewards Float @default(0)\n MainOpportunities Opportunity[] @relation(name: \"main\")\n Opportunities Opportunity[]\n RewardBreakdown RewardBreakdown[]\n}\n\nmodel Token {\n id String @id()\n name String?\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n address String @db.Char(42)\n decimals Int\n symbol String\n displaySymbol String @default(\"\")\n icon String\n verified Boolean @default(false)\n isTest Boolean @default(false)\n isPoint Boolean @default(false)\n isNative Boolean @default(false)\n price Float?\n Opportunity Opportunity[]\n Campaigns Campaign[]\n Reward Reward[]\n DumpTo Dump[] @relation(\"to\")\n DumpFrom Dump[] @relation(\"from\")\n\n @@unique([chainId, address])\n @@index([chainId], type: Hash)\n @@index([symbol, address])\n}\n\nmodel AprRecord {\n id String @id\n timestamp BigInt\n cumulated Float\n AprBreakdown AprBreakdown[]\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel AprBreakdown {\n id Int @id @default(autoincrement())\n identifier String\n type AprType\n value Float\n AprRecord AprRecord @relation(fields: [aprRecordId], references: [id])\n aprRecordId String\n\n @@index([aprRecordId], type: Hash)\n}\n\nmodel TVLRecord {\n id String @id\n timestamp BigInt\n total Float\n TvlBreakdown TVLBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel TVLBreakdown {\n id Int @id @default(autoincrement())\n identifier String\n type TvlType\n value Float\n\n TvlRecord TVLRecord @relation(fields: [tvlRecordId], references: [id])\n tvlRecordId String\n\n @@index([tvlRecordId], type: Hash)\n}\n\nmodel DailyRewardsRecord {\n id String @id\n timestamp BigInt\n total Float\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel DailyRewardsBreakdown {\n id Int @id @default(autoincrement())\n value Float\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n DailyRewardsRecord DailyRewardsRecord @relation(fields: [dailyRewardsRecordId], references: [id])\n dailyRewardsRecordId String\n\n @@index([dailyRewardsRecordId], type: Hash)\n}\n\nmodel User {\n address String @id @db.Char(42)\n Rewards Reward[]\n Blacklist Blacklist[]\n CampaignsCreated Campaign[]\n UserComputedValue UserComputedValue[]\n tags String[]\n\n Creator Creator? @relation(fields: [creatorId], references: [id])\n creatorId String?\n}\n\nmodel Creator {\n id String @id\n icon String?\n name String\n Users User[]\n}\n\nmodel Reward {\n id String @id\n MerklRoot MerklRoot @relation(fields: [root], references: [root])\n root String\n User User @relation(fields: [recipient], references: [address])\n recipient String @db.Char(42)\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String @default(\"0\")\n claimed String @default(\"0\")\n pending String @default(\"0\")\n proofs String[]\n Breakdown RewardBreakdown[]\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([root, recipient, rewardTokenId])\n @@index([root], type: Hash)\n @@index([recipient, rewardTokenId])\n}\n\nmodel RewardBreakdown {\n id BigInt @id @default(autoincrement())\n Protocol Protocol? @relation(fields: [protocolId], references: [id])\n protocolId String?\n reason String\n amount String\n claimed String\n pending String\n Reward Reward @relation(fields: [rewardId], references: [id], onDelete: Cascade)\n rewardId String\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([rewardId, campaignId, reason])\n @@index([rewardId], type: Hash)\n @@index([campaignId], type: Hash)\n}\n\nmodel MerklRoot {\n root String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n epoch Int\n timestamp BigInt\n Rewards Reward[]\n\n @@index([chainId, root])\n}\n\nmodel PriceSource {\n id Int @id @default(autoincrement())\n symbol String @unique() // Price Id\n method PriceSourceMethod\n args Json?\n}\n\n// priceId -> number\n\nmodel Blacklist {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n poolAddress String @db.Char(42)\n User User @relation(fields: [userAddress], references: [address])\n userAddress String @db.Char(42)\n arrestTimestamp BigInt\n arrestDetails Json\n\n @@unique([chainId, userAddress, poolAddress])\n @@index([userAddress], type: Hash)\n}\n\nmodel Dump {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n FromToken Token @relation(name: \"from\", fields: [fromTokenId], references: [id])\n fromTokenId String\n ToToken Token @relation(name: \"to\", fields: [toTokenId], references: [id])\n toTokenId String\n multisig String @db.Char(42)\n recipient String @db.Char(42)\n amountIn String @default(\"0\")\n amountOut String @default(\"0\")\n datetime DateTime\n timestamp Int\n\n @@unique([chainId, fromTokenId, toTokenId, timestamp])\n}\n\nmodel Logged {\n id String @id\n chainId Int\n type LoggedEntityType @default(UNKNOWN)\n address String? @db.Char(42)\n fetchAtBlock Int\n caughtFromAddress String @db.Char(42)\n entityData Json\n\n @@unique([chainId, address])\n}\n\n// enums\n\nenum LoggedEntityType {\n UNKNOWN\n EULER_VAULT\n UNISWAP_V4\n COMPOUND_v2\n}\n\nenum RunStatus {\n PROCESSING\n SUCCESS\n FAILED\n SKIPPED\n}\n\nenum OpportunityAction {\n POOL\n HOLD\n DROP\n LEND\n BORROW\n LONG\n SHORT\n SWAP\n INVALID\n}\n\nenum Status {\n NONE // This would mean that no campaigns was ever created for this opportunity\n PAST\n LIVE\n SOON\n}\n\nenum ExplorerType {\n ETHERSCAN\n BLOCKSCOUT\n}\n\nenum AprType {\n CAMPAIGN\n TOKEN\n PROTOCOL\n}\n\nenum TvlType {\n TOKEN\n PROTOCOL\n}\n\nenum PriceSourceMethod {\n COINGECKO\n CONSTANT\n EQUAL_TO\n ERC4626\n DEXSCREENER\n INDEXCOOP\n DEFILLAMA\n}\n\nenum CampaignManualOverride {\n opportunityId\n creatorAddress\n}\n\nenum OpportunityManualOverride {\n identifier\n name\n depositUrl\n action\n mainProtocolId\n}\n\nenum DistributionType {\n DUTCH_AUCTION\n FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE // The fix reward value will lie in params.apr\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE\n FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT\n}\n",
|
669
|
-
"inlineSchemaHash": "
|
668
|
+
"inlineSchema": "generator client {\n provider = \"prisma-client-js\"\n binaryTargets = [\"native\", \"linux-arm64-openssl-1.1.x\", \"linux-musl-arm64-openssl-3.0.x\"]\n output = \".generated/\"\n previewFeatures = [\"fullTextSearchPostgres\", \"relationJoins\"]\n}\n\ngenerator drizzle {\n provider = \"drizzle-prisma-generator\"\n output = \".generated/drizzle/\" // Where to put generated Drizle tables\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_API_URL\")\n}\n\nmodel Campaign {\n id String @id\n ComputeChain Chain @relation(\"compute\", fields: [computeChainId], references: [id])\n computeChainId Int\n DistributionChain Chain @relation(\"distribution\", fields: [distributionChainId], references: [id])\n distributionChainId Int\n campaignId String\n type String\n // distributionType DistributionType @default(DUTCH_AUCTION)\n subType Int?\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n startTimestamp BigInt\n endTimestamp BigInt\n params Json\n RewardBreakdown RewardBreakdown[]\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n Creator User @relation(fields: [creatorAddress], references: [address])\n creatorAddress String @db.Char(42)\n // Should probably be a 1 to 1 relation if we do not want to keep historic records\n CampaignStatus CampaignStatus[]\n CampaignEngineValues CampaignComputedValue[]\n UserComputedValue UserComputedValue[]\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n manualOverrides CampaignManualOverride[] @default([])\n\n createdAt DateTime @default(now())\n\n @@unique([distributionChainId, campaignId])\n @@index([opportunityId], type: Hash)\n}\n\n// SubTable of Campaigns that should be here as soon as the campaign is processed\nmodel CampaignStatus {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n computedUntil BigInt\n processingStarted BigInt\n status RunStatus @default(SUCCESS)\n error String @default(\"\")\n details Json @default(\"{}\")\n}\n\n// SubTable of Campaigns that will contain values populated by the Engine when it's running\nmodel CampaignComputedValue {\n campaignId String @id\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n averageBoost Float? // Average boost in case of boosting hook\n totalDistributedInUSD Float? // Used in case there is a distribution cap\n forfeitingBoost Float? // In case some rewards are forfeited, resulting boost for remaining users\n}\n\nmodel UserComputedValue {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n address String @db.Char(42)\n User User? @relation(fields: [address], references: [address])\n reason String\n boost Float?\n\n @@unique([campaignId, address, reason])\n}\n\nmodel Chain {\n id Int @id\n name String\n icon String\n // liveCampaigns Int @default(0)\n // dailyRewards Float @default(0)\n Explorer Explorer[]\n Campaigns Campaign[] @relation(\"compute\")\n Distribution Campaign[] @relation(\"distribution\")\n Token Token[]\n Opportunity Opportunity[]\n MerklRoot MerklRoot[]\n Blacklist Blacklist[]\n Dump Dump[]\n}\n\nmodel Explorer {\n id String @id\n type ExplorerType\n Chain Chain @relation(fields: [chainId], references: [id])\n url String\n chainId Int\n\n @@unique([type, chainId])\n}\n\nmodel Opportunity {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id]) // compute\n chainId Int // compute\n type String\n identifier String // eg. 0xUniswapPool - formerly mainParameter\n name String\n depositUrl String?\n status Status\n action OpportunityAction\n Tokens Token[]\n Campaigns Campaign[]\n Protocols Protocol[]\n MainProtocol Protocol? @relation(name: \"main\", fields: [mainProtocolId], references: [id])\n mainProtocolId String?\n tvl Float @default(0)\n TvlRecords TVLRecord[]\n apr Float @default(0)\n AprRecords AprRecord[]\n dailyRewards Float @default(0)\n DailyRewardsRecords DailyRewardsRecord[]\n tags String[] @default([])\n\n // Fields should be automatically parsable and overriden periodically UNLESS\n // they are manually overridden, in which case they should be kept as is\n // manualOverrides OpportunityManualOverride[] @default([])\n\n @@unique([chainId, type, identifier])\n}\n\nmodel Protocol {\n id String @id\n tags String[] @default([])\n name String\n description String @default(\"\")\n url String\n icon String\n // liveCampaigns Int @default(0)\n // totalDailyRewards Float @default(0)\n MainOpportunities Opportunity[] @relation(name: \"main\")\n Opportunities Opportunity[]\n RewardBreakdown RewardBreakdown[]\n}\n\nmodel Token {\n id String @id()\n name String?\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n address String @db.Char(42)\n decimals Int\n symbol String\n displaySymbol String @default(\"\")\n icon String\n verified Boolean @default(false)\n isTest Boolean @default(false)\n isPoint Boolean @default(false)\n isNative Boolean @default(false)\n price Float?\n Opportunity Opportunity[]\n Campaigns Campaign[]\n Reward Reward[]\n DumpTo Dump[] @relation(\"to\")\n DumpFrom Dump[] @relation(\"from\")\n\n @@unique([chainId, address])\n @@index([chainId], type: Hash)\n @@index([symbol, address])\n}\n\nmodel AprRecord {\n id String @id\n timestamp BigInt\n cumulated Float\n AprBreakdown AprBreakdown[]\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel AprBreakdown {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n identifier String\n type AprType\n value Float\n AprRecord AprRecord @relation(fields: [aprRecordId], references: [id])\n aprRecordId String\n\n @@index([aprRecordId], type: Hash)\n}\n\nmodel TVLRecord {\n id String @id\n timestamp BigInt\n total Float\n TvlBreakdown TVLBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel TVLBreakdown {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n identifier String\n type TvlType\n value Float\n\n TvlRecord TVLRecord @relation(fields: [tvlRecordId], references: [id])\n tvlRecordId String\n\n @@index([tvlRecordId], type: Hash)\n}\n\nmodel DailyRewardsRecord {\n id String @id\n timestamp BigInt\n total Float\n DailyRewardsBreakdown DailyRewardsBreakdown[]\n\n Opportunity Opportunity @relation(fields: [opportunityId], references: [id])\n opportunityId String\n\n @@unique([opportunityId, timestamp])\n @@index([opportunityId, timestamp(sort: Desc)])\n}\n\nmodel DailyRewardsBreakdown {\n id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids\n value Float\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n DailyRewardsRecord DailyRewardsRecord @relation(fields: [dailyRewardsRecordId], references: [id])\n dailyRewardsRecordId String\n\n @@index([dailyRewardsRecordId], type: Hash)\n}\n\nmodel User {\n address String @id @db.Char(42)\n Rewards Reward[]\n Blacklist Blacklist[]\n CampaignsCreated Campaign[]\n UserComputedValue UserComputedValue[]\n tags String[]\n\n Creator Creator? @relation(fields: [creatorId], references: [id])\n creatorId String?\n}\n\nmodel Creator {\n id String @id\n icon String?\n name String\n Users User[]\n}\n\nmodel Reward {\n id String @id\n MerklRoot MerklRoot @relation(fields: [root], references: [root])\n root String\n User User @relation(fields: [recipient], references: [address])\n recipient String @db.Char(42)\n RewardToken Token @relation(fields: [rewardTokenId], references: [id])\n rewardTokenId String\n amount String @default(\"0\")\n claimed String @default(\"0\")\n pending String @default(\"0\")\n proofs String[]\n Breakdown RewardBreakdown[]\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([root, recipient, rewardTokenId])\n @@index([root], type: Hash)\n @@index([recipient, rewardTokenId])\n}\n\nmodel RewardBreakdown {\n id BigInt @id @default(autoincrement())\n Protocol Protocol? @relation(fields: [protocolId], references: [id])\n protocolId String?\n reason String\n amount String\n claimed String\n pending String\n Reward Reward @relation(fields: [rewardId], references: [id], onDelete: Cascade)\n rewardId String\n campaignId String\n Campaign Campaign @relation(fields: [campaignId], references: [id])\n // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));\n\n @@unique([rewardId, campaignId, reason])\n @@index([rewardId], type: Hash)\n @@index([campaignId], type: Hash)\n}\n\nmodel MerklRoot {\n root String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n epoch Int\n timestamp BigInt\n Rewards Reward[]\n\n @@index([chainId, root])\n}\n\nmodel PriceSource {\n id Int @id @default(autoincrement())\n symbol String @unique() // Price Id\n method PriceSourceMethod\n args Json?\n}\n\n// priceId -> number\n\nmodel Blacklist {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n poolAddress String @db.Char(42)\n User User @relation(fields: [userAddress], references: [address])\n userAddress String @db.Char(42)\n arrestTimestamp BigInt\n arrestDetails Json\n\n @@unique([chainId, userAddress, poolAddress])\n @@index([userAddress], type: Hash)\n}\n\nmodel Dump {\n id String @id\n Chain Chain @relation(fields: [chainId], references: [id])\n chainId Int\n FromToken Token @relation(name: \"from\", fields: [fromTokenId], references: [id])\n fromTokenId String\n ToToken Token @relation(name: \"to\", fields: [toTokenId], references: [id])\n toTokenId String\n multisig String @db.Char(42)\n recipient String @db.Char(42)\n amountIn String @default(\"0\")\n amountOut String @default(\"0\")\n datetime DateTime\n timestamp Int\n\n @@unique([chainId, fromTokenId, toTokenId, timestamp])\n}\n\nmodel Logged {\n id String @id\n chainId Int\n type LoggedEntityType @default(UNKNOWN)\n address String? @db.Char(42)\n fetchAtBlock Int\n caughtFromAddress String @db.Char(42)\n entityData Json\n\n @@unique([chainId, address])\n}\n\n// enums\n\nenum LoggedEntityType {\n UNKNOWN\n EULER_VAULT\n UNISWAP_V4\n COMPOUND_v2\n}\n\nenum RunStatus {\n PROCESSING\n SUCCESS\n FAILED\n SKIPPED\n}\n\nenum OpportunityAction {\n POOL\n HOLD\n DROP\n LEND\n BORROW\n LONG\n SHORT\n SWAP\n INVALID\n}\n\nenum Status {\n NONE // This would mean that no campaigns was ever created for this opportunity\n PAST\n LIVE\n SOON\n}\n\nenum ExplorerType {\n ETHERSCAN\n BLOCKSCOUT\n}\n\nenum AprType {\n CAMPAIGN\n TOKEN\n PROTOCOL\n}\n\nenum TvlType {\n TOKEN\n PROTOCOL\n}\n\nenum PriceSourceMethod {\n COINGECKO\n CONSTANT\n EQUAL_TO\n ERC4626\n DEXSCREENER\n INDEXCOOP\n DEFILLAMA\n}\n\nenum CampaignManualOverride {\n opportunityId\n creatorAddress\n}\n\nenum OpportunityManualOverride {\n identifier\n name\n depositUrl\n action\n mainProtocolId\n}\n\nenum DistributionType {\n DUTCH_AUCTION\n FIX_REWARD_VALUE_PER_LIQUIDITY_VALUE // The fix reward value will lie in params.apr\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_VALUE\n FIX_REWARD_VALUE_PER_LIQUIDITY_AMOUNT\n FIX_REWARD_AMOUNT_PER_LIQUIDITY_AMOUNT\n}\n",
|
669
|
+
"inlineSchemaHash": "4e125a0c0d9c7fb82c4ae9768673e1373ffa32d3456db1b0c2c3530bcc4178e3",
|
670
670
|
"copyEngine": true
|
671
671
|
}
|
672
672
|
|
@@ -73,7 +73,7 @@ model CampaignComputedValue {
|
|
73
73
|
}
|
74
74
|
|
75
75
|
model UserComputedValue {
|
76
|
-
id Int @id @default(autoincrement())
|
76
|
+
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
77
77
|
campaignId String
|
78
78
|
Campaign Campaign @relation(fields: [campaignId], references: [id])
|
79
79
|
address String @db.Char(42)
|
@@ -193,7 +193,7 @@ model AprRecord {
|
|
193
193
|
}
|
194
194
|
|
195
195
|
model AprBreakdown {
|
196
|
-
id Int @id @default(autoincrement())
|
196
|
+
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
197
197
|
identifier String
|
198
198
|
type AprType
|
199
199
|
value Float
|
@@ -217,7 +217,7 @@ model TVLRecord {
|
|
217
217
|
}
|
218
218
|
|
219
219
|
model TVLBreakdown {
|
220
|
-
id Int @id @default(autoincrement())
|
220
|
+
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
221
221
|
identifier String
|
222
222
|
type TvlType
|
223
223
|
value Float
|
@@ -242,7 +242,7 @@ model DailyRewardsRecord {
|
|
242
242
|
}
|
243
243
|
|
244
244
|
model DailyRewardsBreakdown {
|
245
|
-
id Int @id @default(autoincrement())
|
245
|
+
id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
|
246
246
|
value Float
|
247
247
|
campaignId String
|
248
248
|
Campaign Campaign @relation(fields: [campaignId], references: [id])
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type
|
1
|
+
import { type ChainId } from "@sdk";
|
2
2
|
import type { CreateRootModel, RootByTimestampModel } from "./merklRoot.model";
|
3
3
|
export declare class MerklRootService {
|
4
4
|
static firstRoot(chainId: ChainId): Promise<{
|
@@ -18,13 +18,7 @@ export declare class MerklRootService {
|
|
18
18
|
* @param chainId to fetch roots for
|
19
19
|
* @returns object with live and last tree roots
|
20
20
|
*/
|
21
|
-
static fetch(chainId: ChainId): Promise<
|
22
|
-
live: any;
|
23
|
-
tree: any;
|
24
|
-
lastTree: any;
|
25
|
-
endOfDisputePeriod: any;
|
26
|
-
disputer: any;
|
27
|
-
}>;
|
21
|
+
static fetch(chainId: ChainId): Promise<any>;
|
28
22
|
/**
|
29
23
|
* Fetch all roots for the provided chains
|
30
24
|
* @param chainIds to fetch roots for
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { log } from "@/utils/logger";
|
2
|
+
import { NETWORK_LABELS, withTimeout } from "@sdk";
|
1
3
|
import { CacheService } from "../cache";
|
2
4
|
import { TTLPresets } from "../cache/cache.model";
|
3
5
|
import { ChainService } from "../chain/chain.service";
|
@@ -15,7 +17,17 @@ export class MerklRootService {
|
|
15
17
|
* @returns object with live and last tree roots
|
16
18
|
*/
|
17
19
|
static async fetch(chainId) {
|
18
|
-
|
20
|
+
try {
|
21
|
+
return await withTimeout(CacheService.wrap(TTLPresets.MIN_1, MerklRootRepository.fetch, chainId), 5_000);
|
22
|
+
}
|
23
|
+
catch (e) {
|
24
|
+
if (e.message === "Timed out after 3000ms") {
|
25
|
+
const errorMessage = `fetching Merkle Root for chain ${NETWORK_LABELS[chainId]} timed out`;
|
26
|
+
log.warn(errorMessage);
|
27
|
+
throw new Error(errorMessage);
|
28
|
+
}
|
29
|
+
throw e;
|
30
|
+
}
|
19
31
|
}
|
20
32
|
/**
|
21
33
|
* Fetch all roots for the provided chains
|