@merkl/api 0.10.310 → 0.10.311
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 +2 -1
- package/dist/src/eden/index.d.ts +132 -0
- package/dist/src/index.d.ts +52 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +52 -0
- package/dist/src/modules/v4/programPayload/programPayload.controller.js +20 -15
- package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +1 -0
- package/dist/src/modules/v4/programPayload/programPayload.service.d.ts +5 -1
- package/dist/src/modules/v4/programPayload/programPayload.service.js +15 -0
- package/dist/src/modules/v4/reward/reward.service.js +20 -31
- package/dist/src/modules/v4/router.d.ts +52 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
| @@ -594,8 +594,8 @@ const config = { | |
| 594 594 | 
             
                  }
         | 
| 595 595 | 
             
                }
         | 
| 596 596 | 
             
              },
         | 
| 597 | 
            -
              "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\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                  CampaignType\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\n  @@unique([distributionChainId, campaignId])\n  @@index([opportunityId], type: Hash)\n}\n\nmodel Chain {\n  id           Int           @id\n  name         String\n  icon         String\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                CampaignType\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  @@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  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  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  tags             String[]\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\n  @@unique([root, recipient, rewardTokenId])\n  @@index([root], type: Hash)\n  @@index([recipient, rewardTokenId])\n}\n\nmodel RewardBreakdown {\n  id             Int       @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  auxiliaryData1 String?\n  auxiliaryData2 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\n  @@unique([rewardId, campaignId, reason])\n  @@index([rewardId], type: Hash)\n  @@index([campaignId], type: Hash)\n  @@index([amount(sort: Desc)])\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 CampaignStatus {\n  campaignId        String    @id\n  Campaign          Campaign  @relation(fields: [campaignId], references: [id])\n  computedUntil     BigInt    @default(0)\n  processingStarted BigInt    @default(0)\n  status            RunStatus @default(SUCCESS)\n  error             String    @default(\"\")\n  details           Json      @default(\"{}\")\n}\n\n// enums\n\nenum RunStatus {\n  PROCESSING\n  SUCCESS\n  FAILED\n  SKIPPED\n}\n\nenum CampaignType {\n  INVALID\n  ERC20\n  CLAMM\n  ERC20_SNAPSHOT\n  JSON_AIRDROP\n  SILO\n  RADIANT\n  MORPHO\n  DOLOMITE\n  BADGER\n  COMPOUND\n  AJNA\n  EULER\n  UNISWAP_V4\n  ION\n  EIGENLAYER\n  ERC20TRANSFERS\n  ERC20LOGPROCESSOR\n  ERC20REBASELOGPROCESSOR\n  VEST\n}\n\nenum OpportunityAction {\n  POOL\n  HOLD\n  DROP\n  LEND\n  BORROW\n  INVALID\n}\n\nenum Status {\n  NONE\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",
         | 
| 598 | 
            -
              "inlineSchemaHash": " | 
| 597 | 
            +
              "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\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                  CampaignType\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\n  @@unique([distributionChainId, campaignId])\n  @@index([opportunityId], type: Hash)\n}\n\nmodel Chain {\n  id           Int           @id\n  name         String\n  icon         String\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                CampaignType\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  @@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  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  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  tags             String[]\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             Int       @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  auxiliaryData1 String?\n  auxiliaryData2 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 CampaignStatus {\n  campaignId        String    @id\n  Campaign          Campaign  @relation(fields: [campaignId], references: [id])\n  computedUntil     BigInt    @default(0)\n  processingStarted BigInt    @default(0)\n  status            RunStatus @default(SUCCESS)\n  error             String    @default(\"\")\n  details           Json      @default(\"{}\")\n}\n\n// enums\n\nenum RunStatus {\n  PROCESSING\n  SUCCESS\n  FAILED\n  SKIPPED\n}\n\nenum CampaignType {\n  INVALID\n  ERC20\n  CLAMM\n  ERC20_SNAPSHOT\n  JSON_AIRDROP\n  SILO\n  RADIANT\n  MORPHO\n  DOLOMITE\n  BADGER\n  COMPOUND\n  AJNA\n  EULER\n  UNISWAP_V4\n  ION\n  EIGENLAYER\n  ERC20TRANSFERS\n  ERC20LOGPROCESSOR\n  ERC20REBASELOGPROCESSOR\n  VEST\n}\n\nenum OpportunityAction {\n  POOL\n  HOLD\n  DROP\n  LEND\n  BORROW\n  INVALID\n}\n\nenum Status {\n  NONE\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",
         | 
| 598 | 
            +
              "inlineSchemaHash": "5c873a3a97326d2d26442609b1e3ada0699280c893bd83a1517ae67e90c229eb",
         | 
| 599 599 | 
             
              "copyEngine": true
         | 
| 600 600 | 
             
            }
         | 
| 601 601 | 
             
            config.dirname = '/'
         | 
| @@ -595,8 +595,8 @@ const config = { | |
| 595 595 | 
             
                  }
         | 
| 596 596 | 
             
                }
         | 
| 597 597 | 
             
              },
         | 
| 598 | 
            -
              "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\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                  CampaignType\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\n  @@unique([distributionChainId, campaignId])\n  @@index([opportunityId], type: Hash)\n}\n\nmodel Chain {\n  id           Int           @id\n  name         String\n  icon         String\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                CampaignType\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  @@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  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  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  tags             String[]\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\n  @@unique([root, recipient, rewardTokenId])\n  @@index([root], type: Hash)\n  @@index([recipient, rewardTokenId])\n}\n\nmodel RewardBreakdown {\n  id             Int       @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  auxiliaryData1 String?\n  auxiliaryData2 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\n  @@unique([rewardId, campaignId, reason])\n  @@index([rewardId], type: Hash)\n  @@index([campaignId], type: Hash)\n  @@index([amount(sort: Desc)])\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 CampaignStatus {\n  campaignId        String    @id\n  Campaign          Campaign  @relation(fields: [campaignId], references: [id])\n  computedUntil     BigInt    @default(0)\n  processingStarted BigInt    @default(0)\n  status            RunStatus @default(SUCCESS)\n  error             String    @default(\"\")\n  details           Json      @default(\"{}\")\n}\n\n// enums\n\nenum RunStatus {\n  PROCESSING\n  SUCCESS\n  FAILED\n  SKIPPED\n}\n\nenum CampaignType {\n  INVALID\n  ERC20\n  CLAMM\n  ERC20_SNAPSHOT\n  JSON_AIRDROP\n  SILO\n  RADIANT\n  MORPHO\n  DOLOMITE\n  BADGER\n  COMPOUND\n  AJNA\n  EULER\n  UNISWAP_V4\n  ION\n  EIGENLAYER\n  ERC20TRANSFERS\n  ERC20LOGPROCESSOR\n  ERC20REBASELOGPROCESSOR\n  VEST\n}\n\nenum OpportunityAction {\n  POOL\n  HOLD\n  DROP\n  LEND\n  BORROW\n  INVALID\n}\n\nenum Status {\n  NONE\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",
         | 
| 599 | 
            -
              "inlineSchemaHash": " | 
| 598 | 
            +
              "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\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                  CampaignType\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\n  @@unique([distributionChainId, campaignId])\n  @@index([opportunityId], type: Hash)\n}\n\nmodel Chain {\n  id           Int           @id\n  name         String\n  icon         String\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                CampaignType\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  @@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  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  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  tags             String[]\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             Int       @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  auxiliaryData1 String?\n  auxiliaryData2 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 CampaignStatus {\n  campaignId        String    @id\n  Campaign          Campaign  @relation(fields: [campaignId], references: [id])\n  computedUntil     BigInt    @default(0)\n  processingStarted BigInt    @default(0)\n  status            RunStatus @default(SUCCESS)\n  error             String    @default(\"\")\n  details           Json      @default(\"{}\")\n}\n\n// enums\n\nenum RunStatus {\n  PROCESSING\n  SUCCESS\n  FAILED\n  SKIPPED\n}\n\nenum CampaignType {\n  INVALID\n  ERC20\n  CLAMM\n  ERC20_SNAPSHOT\n  JSON_AIRDROP\n  SILO\n  RADIANT\n  MORPHO\n  DOLOMITE\n  BADGER\n  COMPOUND\n  AJNA\n  EULER\n  UNISWAP_V4\n  ION\n  EIGENLAYER\n  ERC20TRANSFERS\n  ERC20LOGPROCESSOR\n  ERC20REBASELOGPROCESSOR\n  VEST\n}\n\nenum OpportunityAction {\n  POOL\n  HOLD\n  DROP\n  LEND\n  BORROW\n  INVALID\n}\n\nenum Status {\n  NONE\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",
         | 
| 599 | 
            +
              "inlineSchemaHash": "5c873a3a97326d2d26442609b1e3ada0699280c893bd83a1517ae67e90c229eb",
         | 
| 600 600 | 
             
              "copyEngine": true
         | 
| 601 601 | 
             
            }
         | 
| 602 602 |  | 
| @@ -217,6 +217,7 @@ model Reward { | |
| 217 217 | 
             
              pending       String            @default("0")
         | 
| 218 218 | 
             
              proofs        String[]
         | 
| 219 219 | 
             
              Breakdown     RewardBreakdown[]
         | 
| 220 | 
            +
              // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));
         | 
| 220 221 |  | 
| 221 222 | 
             
              @@unique([root, recipient, rewardTokenId])
         | 
| 222 223 | 
             
              @@index([root], type: Hash)
         | 
| @@ -237,11 +238,11 @@ model RewardBreakdown { | |
| 237 238 | 
             
              rewardId       String
         | 
| 238 239 | 
             
              campaignId     String
         | 
| 239 240 | 
             
              Campaign       Campaign  @relation(fields: [campaignId], references: [id])
         | 
| 241 | 
            +
              // Hidden index on ((CAST(amount AS INTEGER) + CAST(pending AS INTEGER)));
         | 
| 240 242 |  | 
| 241 243 | 
             
              @@unique([rewardId, campaignId, reason])
         | 
| 242 244 | 
             
              @@index([rewardId], type: Hash)
         | 
| 243 245 | 
             
              @@index([campaignId], type: Hash)
         | 
| 244 | 
            -
              @@index([amount(sort: Desc)])
         | 
| 245 246 | 
             
            }
         | 
| 246 247 |  | 
| 247 248 | 
             
            model MerklRoot {
         | 
    
        package/dist/src/eden/index.d.ts
    CHANGED
    
    | @@ -2250,6 +2250,26 @@ declare const eden: { | |
| 2250 2250 | 
             
                                200: any;
         | 
| 2251 2251 | 
             
                            }>>;
         | 
| 2252 2252 | 
             
                        };
         | 
| 2253 | 
            +
                        campaignData: {
         | 
| 2254 | 
            +
                            get: (options: {
         | 
| 2255 | 
            +
                                headers?: Record<string, unknown> | undefined;
         | 
| 2256 | 
            +
                                query: {
         | 
| 2257 | 
            +
                                    creator: string;
         | 
| 2258 | 
            +
                                    startTimestamp: number;
         | 
| 2259 | 
            +
                                    endTimestamp: number;
         | 
| 2260 | 
            +
                                    campaign: string;
         | 
| 2261 | 
            +
                                    distributionChainId: number;
         | 
| 2262 | 
            +
                                    amount: string;
         | 
| 2263 | 
            +
                                    rewardToken: string;
         | 
| 2264 | 
            +
                                    program: string;
         | 
| 2265 | 
            +
                                };
         | 
| 2266 | 
            +
                                fetch?: RequestInit | undefined;
         | 
| 2267 | 
            +
                            }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
         | 
| 2268 | 
            +
                                200: {
         | 
| 2269 | 
            +
                                    args: any;
         | 
| 2270 | 
            +
                                };
         | 
| 2271 | 
            +
                            }>>;
         | 
| 2272 | 
            +
                        };
         | 
| 2253 2273 | 
             
                        program: {
         | 
| 2254 2274 | 
             
                            get: (options: {
         | 
| 2255 2275 | 
             
                                headers?: Record<string, unknown> | undefined;
         | 
| @@ -2267,6 +2287,26 @@ declare const eden: { | |
| 2267 2287 | 
             
                                [x: string]: any;
         | 
| 2268 2288 | 
             
                                200: any;
         | 
| 2269 2289 | 
             
                            }>>;
         | 
| 2290 | 
            +
                            withAmounts: {
         | 
| 2291 | 
            +
                                post: (body: {
         | 
| 2292 | 
            +
                                    [x: string]: string;
         | 
| 2293 | 
            +
                                }, options: {
         | 
| 2294 | 
            +
                                    headers?: Record<string, unknown> | undefined;
         | 
| 2295 | 
            +
                                    query: {
         | 
| 2296 | 
            +
                                        amount?: string | undefined;
         | 
| 2297 | 
            +
                                        creator: string;
         | 
| 2298 | 
            +
                                        startTimestamp: number;
         | 
| 2299 | 
            +
                                        endTimestamp: number;
         | 
| 2300 | 
            +
                                        distributionChainId: number;
         | 
| 2301 | 
            +
                                        rewardToken: string;
         | 
| 2302 | 
            +
                                        program: string;
         | 
| 2303 | 
            +
                                    };
         | 
| 2304 | 
            +
                                    fetch?: RequestInit | undefined;
         | 
| 2305 | 
            +
                                }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
         | 
| 2306 | 
            +
                                    [x: string]: any;
         | 
| 2307 | 
            +
                                    200: any;
         | 
| 2308 | 
            +
                                }>>;
         | 
| 2309 | 
            +
                            };
         | 
| 2270 2310 | 
             
                        };
         | 
| 2271 2311 | 
             
                    };
         | 
| 2272 2312 | 
             
                    boosts: {
         | 
| @@ -5677,6 +5717,31 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa | |
| 5677 5717 | 
             
                            };
         | 
| 5678 5718 | 
             
                        };
         | 
| 5679 5719 | 
             
                    };
         | 
| 5720 | 
            +
                } & {
         | 
| 5721 | 
            +
                    "program-payload": {
         | 
| 5722 | 
            +
                        campaignData: {
         | 
| 5723 | 
            +
                            get: {
         | 
| 5724 | 
            +
                                body: unknown;
         | 
| 5725 | 
            +
                                params: {};
         | 
| 5726 | 
            +
                                query: {
         | 
| 5727 | 
            +
                                    creator: string;
         | 
| 5728 | 
            +
                                    startTimestamp: number;
         | 
| 5729 | 
            +
                                    endTimestamp: number;
         | 
| 5730 | 
            +
                                    campaign: string;
         | 
| 5731 | 
            +
                                    distributionChainId: number;
         | 
| 5732 | 
            +
                                    amount: string;
         | 
| 5733 | 
            +
                                    rewardToken: string;
         | 
| 5734 | 
            +
                                    program: string;
         | 
| 5735 | 
            +
                                };
         | 
| 5736 | 
            +
                                headers: unknown;
         | 
| 5737 | 
            +
                                response: {
         | 
| 5738 | 
            +
                                    200: {
         | 
| 5739 | 
            +
                                        args: any;
         | 
| 5740 | 
            +
                                    };
         | 
| 5741 | 
            +
                                };
         | 
| 5742 | 
            +
                            };
         | 
| 5743 | 
            +
                        };
         | 
| 5744 | 
            +
                    };
         | 
| 5680 5745 | 
             
                } & {
         | 
| 5681 5746 | 
             
                    "program-payload": {
         | 
| 5682 5747 | 
             
                        program: {
         | 
| @@ -5700,6 +5765,33 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa | |
| 5700 5765 | 
             
                            };
         | 
| 5701 5766 | 
             
                        };
         | 
| 5702 5767 | 
             
                    };
         | 
| 5768 | 
            +
                } & {
         | 
| 5769 | 
            +
                    "program-payload": {
         | 
| 5770 | 
            +
                        program: {
         | 
| 5771 | 
            +
                            withAmounts: {
         | 
| 5772 | 
            +
                                post: {
         | 
| 5773 | 
            +
                                    body: {
         | 
| 5774 | 
            +
                                        [x: string]: string;
         | 
| 5775 | 
            +
                                    };
         | 
| 5776 | 
            +
                                    params: {};
         | 
| 5777 | 
            +
                                    query: {
         | 
| 5778 | 
            +
                                        amount?: string | undefined;
         | 
| 5779 | 
            +
                                        creator: string;
         | 
| 5780 | 
            +
                                        startTimestamp: number;
         | 
| 5781 | 
            +
                                        endTimestamp: number;
         | 
| 5782 | 
            +
                                        distributionChainId: number;
         | 
| 5783 | 
            +
                                        rewardToken: string;
         | 
| 5784 | 
            +
                                        program: string;
         | 
| 5785 | 
            +
                                    };
         | 
| 5786 | 
            +
                                    headers: unknown;
         | 
| 5787 | 
            +
                                    response: {
         | 
| 5788 | 
            +
                                        [x: string]: any;
         | 
| 5789 | 
            +
                                        200: any;
         | 
| 5790 | 
            +
                                    };
         | 
| 5791 | 
            +
                                };
         | 
| 5792 | 
            +
                            };
         | 
| 5793 | 
            +
                        };
         | 
| 5794 | 
            +
                    };
         | 
| 5703 5795 | 
             
                };
         | 
| 5704 5796 | 
             
            } & {
         | 
| 5705 5797 | 
             
                v4: {
         | 
| @@ -8735,6 +8827,26 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa | |
| 8735 8827 | 
             
                                200: any;
         | 
| 8736 8828 | 
             
                            }>>;
         | 
| 8737 8829 | 
             
                        };
         | 
| 8830 | 
            +
                        campaignData: {
         | 
| 8831 | 
            +
                            get: (options: {
         | 
| 8832 | 
            +
                                headers?: Record<string, unknown> | undefined;
         | 
| 8833 | 
            +
                                query: {
         | 
| 8834 | 
            +
                                    creator: string;
         | 
| 8835 | 
            +
                                    startTimestamp: number;
         | 
| 8836 | 
            +
                                    endTimestamp: number;
         | 
| 8837 | 
            +
                                    campaign: string;
         | 
| 8838 | 
            +
                                    distributionChainId: number;
         | 
| 8839 | 
            +
                                    amount: string;
         | 
| 8840 | 
            +
                                    rewardToken: string;
         | 
| 8841 | 
            +
                                    program: string;
         | 
| 8842 | 
            +
                                };
         | 
| 8843 | 
            +
                                fetch?: RequestInit | undefined;
         | 
| 8844 | 
            +
                            }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
         | 
| 8845 | 
            +
                                200: {
         | 
| 8846 | 
            +
                                    args: any;
         | 
| 8847 | 
            +
                                };
         | 
| 8848 | 
            +
                            }>>;
         | 
| 8849 | 
            +
                        };
         | 
| 8738 8850 | 
             
                        program: {
         | 
| 8739 8851 | 
             
                            get: (options: {
         | 
| 8740 8852 | 
             
                                headers?: Record<string, unknown> | undefined;
         | 
| @@ -8752,6 +8864,26 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa | |
| 8752 8864 | 
             
                                [x: string]: any;
         | 
| 8753 8865 | 
             
                                200: any;
         | 
| 8754 8866 | 
             
                            }>>;
         | 
| 8867 | 
            +
                            withAmounts: {
         | 
| 8868 | 
            +
                                post: (body: {
         | 
| 8869 | 
            +
                                    [x: string]: string;
         | 
| 8870 | 
            +
                                }, options: {
         | 
| 8871 | 
            +
                                    headers?: Record<string, unknown> | undefined;
         | 
| 8872 | 
            +
                                    query: {
         | 
| 8873 | 
            +
                                        amount?: string | undefined;
         | 
| 8874 | 
            +
                                        creator: string;
         | 
| 8875 | 
            +
                                        startTimestamp: number;
         | 
| 8876 | 
            +
                                        endTimestamp: number;
         | 
| 8877 | 
            +
                                        distributionChainId: number;
         | 
| 8878 | 
            +
                                        rewardToken: string;
         | 
| 8879 | 
            +
                                        program: string;
         | 
| 8880 | 
            +
                                    };
         | 
| 8881 | 
            +
                                    fetch?: RequestInit | undefined;
         | 
| 8882 | 
            +
                                }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
         | 
| 8883 | 
            +
                                    [x: string]: any;
         | 
| 8884 | 
            +
                                    200: any;
         | 
| 8885 | 
            +
                                }>>;
         | 
| 8886 | 
            +
                            };
         | 
| 8755 8887 | 
             
                        };
         | 
| 8756 8888 | 
             
                    };
         | 
| 8757 8889 | 
             
                    boosts: {
         | 
    
        package/dist/src/index.d.ts
    CHANGED
    
    | @@ -2804,6 +2804,31 @@ declare const app: Elysia<"", false, { | |
| 2804 2804 | 
             
                            };
         | 
| 2805 2805 | 
             
                        };
         | 
| 2806 2806 | 
             
                    };
         | 
| 2807 | 
            +
                } & {
         | 
| 2808 | 
            +
                    "program-payload": {
         | 
| 2809 | 
            +
                        campaignData: {
         | 
| 2810 | 
            +
                            get: {
         | 
| 2811 | 
            +
                                body: unknown;
         | 
| 2812 | 
            +
                                params: {};
         | 
| 2813 | 
            +
                                query: {
         | 
| 2814 | 
            +
                                    creator: string;
         | 
| 2815 | 
            +
                                    startTimestamp: number;
         | 
| 2816 | 
            +
                                    endTimestamp: number;
         | 
| 2817 | 
            +
                                    campaign: string;
         | 
| 2818 | 
            +
                                    distributionChainId: number;
         | 
| 2819 | 
            +
                                    amount: string;
         | 
| 2820 | 
            +
                                    rewardToken: string;
         | 
| 2821 | 
            +
                                    program: string;
         | 
| 2822 | 
            +
                                };
         | 
| 2823 | 
            +
                                headers: unknown;
         | 
| 2824 | 
            +
                                response: {
         | 
| 2825 | 
            +
                                    200: {
         | 
| 2826 | 
            +
                                        args: any;
         | 
| 2827 | 
            +
                                    };
         | 
| 2828 | 
            +
                                };
         | 
| 2829 | 
            +
                            };
         | 
| 2830 | 
            +
                        };
         | 
| 2831 | 
            +
                    };
         | 
| 2807 2832 | 
             
                } & {
         | 
| 2808 2833 | 
             
                    "program-payload": {
         | 
| 2809 2834 | 
             
                        program: {
         | 
| @@ -2827,6 +2852,33 @@ declare const app: Elysia<"", false, { | |
| 2827 2852 | 
             
                            };
         | 
| 2828 2853 | 
             
                        };
         | 
| 2829 2854 | 
             
                    };
         | 
| 2855 | 
            +
                } & {
         | 
| 2856 | 
            +
                    "program-payload": {
         | 
| 2857 | 
            +
                        program: {
         | 
| 2858 | 
            +
                            withAmounts: {
         | 
| 2859 | 
            +
                                post: {
         | 
| 2860 | 
            +
                                    body: {
         | 
| 2861 | 
            +
                                        [x: string]: string;
         | 
| 2862 | 
            +
                                    };
         | 
| 2863 | 
            +
                                    params: {};
         | 
| 2864 | 
            +
                                    query: {
         | 
| 2865 | 
            +
                                        amount?: string | undefined;
         | 
| 2866 | 
            +
                                        creator: string;
         | 
| 2867 | 
            +
                                        startTimestamp: number;
         | 
| 2868 | 
            +
                                        endTimestamp: number;
         | 
| 2869 | 
            +
                                        distributionChainId: number;
         | 
| 2870 | 
            +
                                        rewardToken: string;
         | 
| 2871 | 
            +
                                        program: string;
         | 
| 2872 | 
            +
                                    };
         | 
| 2873 | 
            +
                                    headers: unknown;
         | 
| 2874 | 
            +
                                    response: {
         | 
| 2875 | 
            +
                                        [x: string]: any;
         | 
| 2876 | 
            +
                                        200: any;
         | 
| 2877 | 
            +
                                    };
         | 
| 2878 | 
            +
                                };
         | 
| 2879 | 
            +
                            };
         | 
| 2880 | 
            +
                        };
         | 
| 2881 | 
            +
                    };
         | 
| 2830 2882 | 
             
                };
         | 
| 2831 2883 | 
             
            } & {
         | 
| 2832 2884 | 
             
                v4: {
         | 
| @@ -59,6 +59,31 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false, | |
| 59 59 | 
             
                        };
         | 
| 60 60 | 
             
                    };
         | 
| 61 61 | 
             
                };
         | 
| 62 | 
            +
            } & {
         | 
| 63 | 
            +
                "program-payload": {
         | 
| 64 | 
            +
                    campaignData: {
         | 
| 65 | 
            +
                        get: {
         | 
| 66 | 
            +
                            body: unknown;
         | 
| 67 | 
            +
                            params: {};
         | 
| 68 | 
            +
                            query: {
         | 
| 69 | 
            +
                                creator: string;
         | 
| 70 | 
            +
                                startTimestamp: number;
         | 
| 71 | 
            +
                                endTimestamp: number;
         | 
| 72 | 
            +
                                campaign: string;
         | 
| 73 | 
            +
                                distributionChainId: number;
         | 
| 74 | 
            +
                                amount: string;
         | 
| 75 | 
            +
                                rewardToken: string;
         | 
| 76 | 
            +
                                program: string;
         | 
| 77 | 
            +
                            };
         | 
| 78 | 
            +
                            headers: unknown;
         | 
| 79 | 
            +
                            response: {
         | 
| 80 | 
            +
                                200: {
         | 
| 81 | 
            +
                                    args: any;
         | 
| 82 | 
            +
                                };
         | 
| 83 | 
            +
                            };
         | 
| 84 | 
            +
                        };
         | 
| 85 | 
            +
                    };
         | 
| 86 | 
            +
                };
         | 
| 62 87 | 
             
            } & {
         | 
| 63 88 | 
             
                "program-payload": {
         | 
| 64 89 | 
             
                    program: {
         | 
| @@ -82,6 +107,33 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false, | |
| 82 107 | 
             
                        };
         | 
| 83 108 | 
             
                    };
         | 
| 84 109 | 
             
                };
         | 
| 110 | 
            +
            } & {
         | 
| 111 | 
            +
                "program-payload": {
         | 
| 112 | 
            +
                    program: {
         | 
| 113 | 
            +
                        withAmounts: {
         | 
| 114 | 
            +
                            post: {
         | 
| 115 | 
            +
                                body: {
         | 
| 116 | 
            +
                                    [x: string]: string;
         | 
| 117 | 
            +
                                };
         | 
| 118 | 
            +
                                params: {};
         | 
| 119 | 
            +
                                query: {
         | 
| 120 | 
            +
                                    amount?: string | undefined;
         | 
| 121 | 
            +
                                    creator: string;
         | 
| 122 | 
            +
                                    startTimestamp: number;
         | 
| 123 | 
            +
                                    endTimestamp: number;
         | 
| 124 | 
            +
                                    distributionChainId: number;
         | 
| 125 | 
            +
                                    rewardToken: string;
         | 
| 126 | 
            +
                                    program: string;
         | 
| 127 | 
            +
                                };
         | 
| 128 | 
            +
                                headers: unknown;
         | 
| 129 | 
            +
                                response: {
         | 
| 130 | 
            +
                                    [x: string]: any;
         | 
| 131 | 
            +
                                    200: any;
         | 
| 132 | 
            +
                                };
         | 
| 133 | 
            +
                            };
         | 
| 134 | 
            +
                        };
         | 
| 135 | 
            +
                    };
         | 
| 136 | 
            +
                };
         | 
| 85 137 | 
             
            }, {
         | 
| 86 138 | 
             
                derive: {};
         | 
| 87 139 | 
             
                resolve: {};
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            // import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
         | 
| 2 2 | 
             
            import Elysia from "elysia";
         | 
| 3 3 | 
             
            import { throwOnUnsupportedChainId } from "src/utils/throw";
         | 
| 4 | 
            -
            import { CampaignPayloadInputDto, ProgramPayloadInputDto } from "./programPayload.model";
         | 
| 4 | 
            +
            import { CampaignAmountsInputDto, CampaignPayloadInputDto, ProgramPayloadInputDto } from "./programPayload.model";
         | 
| 5 5 | 
             
            import { ProgramPayloadService } from "./programPayload.service";
         | 
| 6 6 | 
             
            // ─── ProgramPaylod Controller ───────────────────────────────────────────────────────
         | 
| 7 7 | 
             
            export const ProgramPayloadController = new Elysia({ prefix: "/program-payload", detail: { tags: ["ProgramPayload"] } })
         | 
| @@ -25,6 +25,16 @@ export const ProgramPayloadController = new Elysia({ prefix: "/program-payload", | |
| 25 25 | 
             
                    // BackOfficeGuard({ headers });
         | 
| 26 26 | 
             
                    throwOnUnsupportedChainId(query.distributionChainId);
         | 
| 27 27 | 
             
                },
         | 
| 28 | 
            +
            })
         | 
| 29 | 
            +
                .get("/campaignData", async ({ query }) => {
         | 
| 30 | 
            +
                return ProgramPayloadService.buildCampaignData(query);
         | 
| 31 | 
            +
            }, {
         | 
| 32 | 
            +
                query: CampaignPayloadInputDto,
         | 
| 33 | 
            +
                // headers: AuthorizationHeadersDto,
         | 
| 34 | 
            +
                beforeHandle: ({ query, headers }) => {
         | 
| 35 | 
            +
                    // BackOfficeGuard({ headers });
         | 
| 36 | 
            +
                    throwOnUnsupportedChainId(query.distributionChainId);
         | 
| 37 | 
            +
                },
         | 
| 28 38 | 
             
            })
         | 
| 29 39 | 
             
                .get("/program", async ({ query }) => {
         | 
| 30 40 | 
             
                return ProgramPayloadService.buildProgramPayload(query);
         | 
| @@ -35,18 +45,13 @@ export const ProgramPayloadController = new Elysia({ prefix: "/program-payload", | |
| 35 45 | 
             
                    // BackOfficeGuard({ headers });
         | 
| 36 46 | 
             
                    throwOnUnsupportedChainId(query.distributionChainId);
         | 
| 37 47 | 
             
                },
         | 
| 48 | 
            +
            })
         | 
| 49 | 
            +
                .post("/program/withAmounts", async ({ query, body }) => {
         | 
| 50 | 
            +
                return ProgramPayloadService.buildProgramPayloadWithAmounts(query, body);
         | 
| 51 | 
            +
            }, {
         | 
| 52 | 
            +
                query: ProgramPayloadInputDto,
         | 
| 53 | 
            +
                body: CampaignAmountsInputDto,
         | 
| 54 | 
            +
                beforeHandle: ({ query }) => {
         | 
| 55 | 
            +
                    throwOnUnsupportedChainId(query.distributionChainId);
         | 
| 56 | 
            +
                },
         | 
| 38 57 | 
             
            });
         | 
| 39 | 
            -
            // TO DO FIX
         | 
| 40 | 
            -
            // .get(
         | 
| 41 | 
            -
            //   "/program/withAmounts",
         | 
| 42 | 
            -
            //   async ({ query, body }) => {
         | 
| 43 | 
            -
            //     return ProgramPayloadService.buildProgramPayloadWithAmounts(query, body);
         | 
| 44 | 
            -
            //   },
         | 
| 45 | 
            -
            //   {
         | 
| 46 | 
            -
            //     query: ProgramPayloadInputDto,
         | 
| 47 | 
            -
            //     body: CampaignAmountsInputDto,
         | 
| 48 | 
            -
            //     beforeHandle: ({ query }) => {
         | 
| 49 | 
            -
            //       throwOnUnsupportedChainId(query.distributionChainId);
         | 
| 50 | 
            -
            //     },
         | 
| 51 | 
            -
            //   }
         | 
| 52 | 
            -
            // )
         | 
| @@ -21,6 +21,7 @@ export declare const ProgramPayloadInputDto: import("@sinclair/typebox").TObject | |
| 21 21 | 
             
            export declare const CampaignAmountsInputDto: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>;
         | 
| 22 22 | 
             
            export type CampaignPayloadInputModel = typeof CampaignPayloadInputDto.static;
         | 
| 23 23 | 
             
            export type ProgramPayloadInputModel = typeof ProgramPayloadInputDto.static;
         | 
| 24 | 
            +
            export type CampaignAmountsInputModel = typeof CampaignAmountsInputDto.static;
         | 
| 24 25 | 
             
            export type partialConfigERC20 = {
         | 
| 25 26 | 
             
                computeChainId?: MerklChainId;
         | 
| 26 27 | 
             
                hooks?: (HookParameters<HOOK> | string)[];
         | 
| @@ -1,8 +1,12 @@ | |
| 1 1 | 
             
            import { type Campaign, type campaignConfig } from "@sdk";
         | 
| 2 | 
            -
            import { type CampaignPayloadInputModel, type ProgramPayloadInputModel } from "./programPayload.model";
         | 
| 2 | 
            +
            import { type CampaignAmountsInputModel, type CampaignPayloadInputModel, type ProgramPayloadInputModel } from "./programPayload.model";
         | 
| 3 3 | 
             
            export declare class ProgramPayloadService {
         | 
| 4 4 | 
             
                static buildConfig(query: CampaignPayloadInputModel): campaignConfig<Campaign>;
         | 
| 5 5 | 
             
                /** building payload for a single campaign */
         | 
| 6 | 
            +
                static buildCampaignData(query: CampaignPayloadInputModel): {
         | 
| 7 | 
            +
                    args: any;
         | 
| 8 | 
            +
                };
         | 
| 6 9 | 
             
                static buildPayload(query: CampaignPayloadInputModel, initialCampaignPayload?: null): any;
         | 
| 7 10 | 
             
                static buildProgramPayload(query: ProgramPayloadInputModel): any;
         | 
| 11 | 
            +
                static buildProgramPayloadWithAmounts(query: ProgramPayloadInputModel, body: CampaignAmountsInputModel): any;
         | 
| 8 12 | 
             
            }
         | 
| @@ -31,6 +31,11 @@ export class ProgramPayloadService { | |
| 31 31 | 
             
                    };
         | 
| 32 32 | 
             
                }
         | 
| 33 33 | 
             
                /** building payload for a single campaign */
         | 
| 34 | 
            +
                static buildCampaignData(query) {
         | 
| 35 | 
            +
                    const distributionChainId = query.distributionChainId ? query.distributionChainId : ChainId.MAINNET;
         | 
| 36 | 
            +
                    const args = buildCampaignPayload(ProgramPayloadService.buildConfig(query), distributionChainId).args;
         | 
| 37 | 
            +
                    return { args };
         | 
| 38 | 
            +
                }
         | 
| 34 39 | 
             
                static buildPayload(query, initialCampaignPayload = null) {
         | 
| 35 40 | 
             
                    const rewardToken = query.rewardToken;
         | 
| 36 41 | 
             
                    const distributionChainId = query.distributionChainId ? query.distributionChainId : ChainId.MAINNET;
         | 
| @@ -93,4 +98,14 @@ export class ProgramPayloadService { | |
| 93 98 | 
             
                    }
         | 
| 94 99 | 
             
                    return campaignPayloads;
         | 
| 95 100 | 
             
                }
         | 
| 101 | 
            +
                static buildProgramPayloadWithAmounts(query, body) {
         | 
| 102 | 
            +
                    let campaignPayloads = null;
         | 
| 103 | 
            +
                    for (const [campaign, amount] of Object.entries(body)) {
         | 
| 104 | 
            +
                        if (Object.keys(MerklInterfaceCampaigns[query.program]).includes(campaign)) {
         | 
| 105 | 
            +
                            const queryCampaign = { ...query, campaign, amount: amount };
         | 
| 106 | 
            +
                            campaignPayloads = ProgramPayloadService.buildPayload(queryCampaign, campaignPayloads);
         | 
| 107 | 
            +
                        }
         | 
| 108 | 
            +
                    }
         | 
| 109 | 
            +
                    return campaignPayloads;
         | 
| 110 | 
            +
                }
         | 
| 96 111 | 
             
            }
         | 
| @@ -167,6 +167,7 @@ export class RewardService { | |
| 167 167 | 
             
                                if (!lastTreeRewardsBreakdown)
         | 
| 168 168 | 
             
                                    continue;
         | 
| 169 169 | 
             
                                breakdown.claimed = lastTreeRewardsBreakdown.amount;
         | 
| 170 | 
            +
                                await RewardRepository.updateClaimed(user, TokenService.hashId(reward.RewardToken), breakdown.campaignId, breakdown.reason, breakdown.amount);
         | 
| 170 171 | 
             
                            }
         | 
| 171 172 | 
             
                        }
         | 
| 172 173 | 
             
                    }
         | 
| @@ -247,7 +248,8 @@ export class RewardService { | |
| 247 248 | 
             
                        }
         | 
| 248 249 | 
             
                        rewardUniques[rewardId].pending = (BigInt(rewardUniques[rewardId].pending) +
         | 
| 249 250 | 
             
                            BigInt(pending) -
         | 
| 250 | 
            -
                            BigInt(previousPending ?? "0")) | 
| 251 | 
            +
                            BigInt(previousPending ?? "0")) // Store the delta
         | 
| 252 | 
            +
                            .toString();
         | 
| 251 253 | 
             
                    };
         | 
| 252 254 | 
             
                    const breakdownUniques = await data.data.map(({ recipient, reason }) => {
         | 
| 253 255 | 
             
                        const rewardId = RewardService.hashId(data.root, recipient, rewardTokenId);
         | 
| @@ -255,45 +257,32 @@ export class RewardService { | |
| 255 257 | 
             
                    });
         | 
| 256 258 | 
             
                    const breakdownToUpdate = [];
         | 
| 257 259 | 
             
                    const breakdownToCreate = [];
         | 
| 258 | 
            -
                     | 
| 259 | 
            -
                    const exists = await RewardRepository.findManyBreakdownUniques(breakdownUniques);
         | 
| 260 | 
            -
                    console.log(exists);
         | 
| 260 | 
            +
                    const breakdownExists = await RewardRepository.findManyBreakdownUniques(breakdownUniques);
         | 
| 261 261 | 
             
                    for (const [pointIndex, point] of data.data.entries()) {
         | 
| 262 | 
            -
                        updateRewardUniques(point.recipient, point.pending,  | 
| 263 | 
            -
                         | 
| 264 | 
            -
                        if (!!exists[pointIndex]) {
         | 
| 262 | 
            +
                        updateRewardUniques(point.recipient, point.pending, breakdownExists[pointIndex]?.pending);
         | 
| 263 | 
            +
                        if (!!breakdownExists[pointIndex]) {
         | 
| 265 264 | 
             
                            breakdownToUpdate.push(point);
         | 
| 266 265 | 
             
                        }
         | 
| 267 266 | 
             
                        else {
         | 
| 268 267 | 
             
                            breakdownToCreate.push(point);
         | 
| 269 268 | 
             
                        }
         | 
| 270 269 | 
             
                    }
         | 
| 271 | 
            -
                     | 
| 272 | 
            -
                     | 
| 273 | 
            -
             | 
| 274 | 
            -
             | 
| 275 | 
            -
             | 
| 276 | 
            -
                             | 
| 277 | 
            -
             | 
| 278 | 
            -
                                 | 
| 279 | 
            -
             | 
| 280 | 
            -
             | 
| 281 | 
            -
             | 
| 282 | 
            -
             | 
| 283 | 
            -
                                        pending: (BigInt(exists[pointIndex].pending) + BigInt(point.pending)).toString(),
         | 
| 284 | 
            -
                                    });
         | 
| 285 | 
            -
                                }
         | 
| 286 | 
            -
                                else {
         | 
| 287 | 
            -
                                    toCreate.push(point);
         | 
| 288 | 
            -
                                }
         | 
| 289 | 
            -
                            }
         | 
| 290 | 
            -
                            await RewardRepository.updateRewardPendings(rewardTokenId, data.root, toUpdate);
         | 
| 291 | 
            -
                            await RewardRepository.createRewardPendings(rewardTokenId, data.root, toCreate);
         | 
| 270 | 
            +
                    const toUpdate = [];
         | 
| 271 | 
            +
                    const toCreate = [];
         | 
| 272 | 
            +
                    const exists = await RewardRepository.findManyRewardUniques(Object.keys(rewardUniques));
         | 
| 273 | 
            +
                    for (const [pointIndex, point] of Object.values(rewardUniques).entries()) {
         | 
| 274 | 
            +
                        if (!!exists[pointIndex]) {
         | 
| 275 | 
            +
                            toUpdate.push({
         | 
| 276 | 
            +
                                ...point,
         | 
| 277 | 
            +
                                pending: (BigInt(exists[pointIndex].pending) + BigInt(point.pending)).toString(), // Store the delta
         | 
| 278 | 
            +
                            });
         | 
| 279 | 
            +
                        }
         | 
| 280 | 
            +
                        else {
         | 
| 281 | 
            +
                            toCreate.push(point);
         | 
| 292 282 | 
             
                        }
         | 
| 293 283 | 
             
                    }
         | 
| 294 | 
            -
                     | 
| 295 | 
            -
             | 
| 296 | 
            -
                    }
         | 
| 284 | 
            +
                    await RewardRepository.updateRewardPendings(rewardTokenId, data.root, toUpdate);
         | 
| 285 | 
            +
                    await RewardRepository.createRewardPendings(rewardTokenId, data.root, toCreate);
         | 
| 297 286 | 
             
                    await RewardRepository.updateBreakdownPendings(rewardTokenId, data.root, campaignId, breakdownToUpdate);
         | 
| 298 287 | 
             
                    await RewardRepository.createBreakdownPendings(rewardTokenId, data.root, campaignId, breakdownToCreate);
         | 
| 299 288 | 
             
                    return { created: breakdownToCreate.length, updated: breakdownToUpdate.length };
         |