@merkl/api 0.20.61 → 0.20.63

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.
Files changed (25) hide show
  1. package/dist/src/eden/index.d.ts +25 -0
  2. package/dist/src/engine/dynamicData/factory.js +3 -2
  3. package/dist/src/engine/dynamicData/implementations/Clamm.js +58 -61
  4. package/dist/src/engine/dynamicData/implementations/CompoundV3.d.ts +7 -0
  5. package/dist/src/engine/dynamicData/implementations/CompoundV3.js +69 -0
  6. package/dist/src/engine/opportunityMetadata/factory.js +3 -2
  7. package/dist/src/engine/opportunityMetadata/implementations/CompoundV3.d.ts +17 -0
  8. package/dist/src/engine/opportunityMetadata/implementations/CompoundV3.js +19 -0
  9. package/dist/src/index.d.ts +5 -0
  10. package/dist/src/jobs/update-analytics.d.ts +1 -0
  11. package/dist/src/jobs/update-analytics.js +21 -0
  12. package/dist/src/jobs/update-rpc-calls-cache.js +2 -1
  13. package/dist/src/modules/v4/campaign/campaign.controller.js +5 -3
  14. package/dist/src/modules/v4/opportunity/opportunity.controller.js +1 -0
  15. package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +5 -0
  16. package/dist/src/modules/v4/programPayload/programPayload.model.d.ts +15 -2
  17. package/dist/src/modules/v4/programPayload/programPayload.model.js +2 -0
  18. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +64 -3
  19. package/dist/src/modules/v4/programPayload/programPayload.repository.js +81 -13
  20. package/dist/src/modules/v4/programPayload/programPayload.service.js +5 -0
  21. package/dist/src/modules/v4/reward/reward.controller.js +5 -3
  22. package/dist/src/modules/v4/router.d.ts +5 -0
  23. package/dist/src/modules/v4/token/token.service.js +1 -2
  24. package/dist/tsconfig.package.tsbuildinfo +1 -1
  25. package/package.json +2 -1
@@ -0,0 +1,21 @@
1
+ import { CacheService } from "@/modules/v4/cache";
2
+ import { TTLPresets } from "@/modules/v4/cache/cache.model";
3
+ import { RewardService } from "@/modules/v4/reward";
4
+ import { log } from "@/utils/logger";
5
+ const main = async () => {
6
+ const today = new Date();
7
+ const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;
8
+ const promises = [
9
+ CacheService.set(TTLPresets.DAY_1, RewardService.getTotalDistributed, firstDayOfMonth).then(() => log.info("Total Distributed cache updated successfully")),
10
+ CacheService.set(TTLPresets.DAY_1, RewardService.getTotalDistributedByChains, firstDayOfMonth).then(() => log.info("Total Distributed by Chains cache updated successfully")),
11
+ CacheService.set(TTLPresets.DAY_1, RewardService.getTotalDistributedByType, firstDayOfMonth).then(() => log.info("Total Distributed by Type cache updated successfully")),
12
+ CacheService.set(TTLPresets.DAY_1, RewardService.getTotalDistributedByOpportunities, firstDayOfMonth).then(() => log.info("Total Distributed by Opportunities cache updated successfully")),
13
+ ];
14
+ await Promise.all(promises);
15
+ };
16
+ main()
17
+ .then(() => process.exit(0))
18
+ .catch(err => {
19
+ console.error(err);
20
+ process.exit(1);
21
+ });
@@ -3,7 +3,8 @@ import { TTLPresets } from "@/modules/v4/cache/cache.model";
3
3
  import { ChainService } from "@/modules/v4/chain/chain.service";
4
4
  import { MerklRootRepository } from "@/modules/v4/merklRoot/merklRoot.repository";
5
5
  import { OpportunityService } from "@/modules/v4/opportunity";
6
- import { NETWORK_LABELS, log } from "@sdk";
6
+ import { log } from "@/utils/logger";
7
+ import { NETWORK_LABELS } from "@sdk";
7
8
  const main = async () => {
8
9
  try {
9
10
  const chains = await ChainService.getSupportedIds();
@@ -5,6 +5,8 @@ import { ChainUniqueDto } from "@/modules/v4/chain/chain.model";
5
5
  import { Campaign } from "@sdk";
6
6
  import Elysia, { t } from "elysia";
7
7
  import { throwOnUnsupportedChainId } from "src/utils/throw";
8
+ import { CacheService } from "../cache";
9
+ import { TTLPresets } from "../cache/cache.model";
8
10
  import { DynamicDataService } from "../dynamicData/dynamicData.service";
9
11
  import { OpportunityConvertorService } from "../opportunity/opportunity.converter";
10
12
  import { CampaignResourceDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
@@ -149,6 +151,6 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
149
151
  beforeHandle: BackOfficeGuard,
150
152
  detail: { hide: true },
151
153
  })
152
- .get("count/by-chains", async ({ query }) => await CampaignService.countByChains(query))
153
- .get("/count/by-types", async ({ query }) => await CampaignService.countByType(query))
154
- .get("/count/by-protocols", async ({ query }) => await CampaignService.countByProtocol(query));
154
+ .get("count/by-chains", async ({ query }) => await CacheService.wrap(TTLPresets.DAY_1, CampaignService.countByChains, query))
155
+ .get("/count/by-types", async ({ query }) => await CacheService.wrap(TTLPresets.DAY_1, CampaignService.countByType, query))
156
+ .get("/count/by-protocols", async ({ query }) => await CacheService.wrap(TTLPresets.DAY_1, CampaignService.countByProtocol, query));
@@ -33,6 +33,7 @@ export const OpportunityController = new Elysia({
33
33
  params: OpportunityUniqueDto,
34
34
  body: OpportunityDeleteOverrideDto,
35
35
  beforeHandle: BackOfficeGuard,
36
+ detail: { hide: true },
36
37
  })
37
38
  // ─── Tries to reparse An Opportunity ─────────────────────────────────
38
39
  .post("/:id", async ({ params }) => {
@@ -18,6 +18,7 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
18
18
  body: unknown;
19
19
  params: {};
20
20
  query: {
21
+ apr?: number | undefined;
21
22
  creator: string;
22
23
  campaign: string;
23
24
  distributionChainId: number;
@@ -50,6 +51,7 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
50
51
  body: unknown;
51
52
  params: {};
52
53
  query: {
54
+ apr?: number | undefined;
53
55
  creator: string;
54
56
  campaign: string;
55
57
  distributionChainId: number;
@@ -94,6 +96,7 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
94
96
  body: unknown;
95
97
  params: {};
96
98
  query: {
99
+ apr?: number | undefined;
97
100
  creator: string;
98
101
  campaign: string;
99
102
  distributionChainId: number;
@@ -120,6 +123,7 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
120
123
  params: {};
121
124
  query: {
122
125
  amount?: string | undefined;
126
+ apr?: number | undefined;
123
127
  creator: string;
124
128
  distributionChainId: number;
125
129
  startTimestamp: number;
@@ -154,6 +158,7 @@ export declare const ProgramPayloadController: Elysia<"/program-payload", false,
154
158
  params: {};
155
159
  query: {
156
160
  amount?: string | undefined;
161
+ apr?: number | undefined;
157
162
  creator: string;
158
163
  distributionChainId: number;
159
164
  startTimestamp: number;
@@ -1,4 +1,4 @@
1
- import type { Campaign, CompFork, CompoundSubCampaignType, Forwarder, ForwarderParameters, HOOK, HookParameters, MerklChainId, MorphoSubCampaignType } from "@sdk";
1
+ import type { Campaign, CompFork, CompoundSubCampaignType, CompoundV3SubCampaignType, Forwarder, ForwarderParameters, HOOK, HookParameters, MerklChainId, MorphoSubCampaignType } from "@sdk";
2
2
  export declare const CampaignPayloadInputDto: import("@sinclair/typebox").TObject<{
3
3
  campaign: import("@sinclair/typebox").TString;
4
4
  program: import("@sinclair/typebox").TString;
@@ -8,6 +8,7 @@ export declare const CampaignPayloadInputDto: import("@sinclair/typebox").TObjec
8
8
  startTimestamp: import("@sinclair/typebox").TNumber;
9
9
  endTimestamp: import("@sinclair/typebox").TNumber;
10
10
  amount: import("@sinclair/typebox").TString;
11
+ apr: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
11
12
  }>;
12
13
  export declare const CampaignDataDto: import("@sinclair/typebox").TObject<{
13
14
  campaignType: import("@sinclair/typebox").TNumber;
@@ -62,6 +63,7 @@ export declare const ProgramPayloadInputDto: import("@sinclair/typebox").TObject
62
63
  startTimestamp: import("@sinclair/typebox").TNumber;
63
64
  endTimestamp: import("@sinclair/typebox").TNumber;
64
65
  amount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
66
+ apr: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
65
67
  }>;
66
68
  export declare const CampaignAmountsInputDto: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>;
67
69
  export type CampaignPayloadInputModel = typeof CampaignPayloadInputDto.static;
@@ -150,6 +152,17 @@ export type partialConfigERC20 = {
150
152
  blacklist: string[];
151
153
  url?: string;
152
154
  forwarders: ForwarderParameters<Forwarder>[];
155
+ apr?: number;
156
+ };
157
+ export type partialConfigCompoundV3 = {
158
+ computeChainId?: MerklChainId;
159
+ hooks?: (HookParameters<HOOK> | string)[];
160
+ campaignType: Campaign;
161
+ targetToken: string;
162
+ whitelist: string[];
163
+ blacklist: string[];
164
+ url?: string;
165
+ subCampaignType: CompoundV3SubCampaignType;
153
166
  };
154
167
  export type partialConfigMorpho = {
155
168
  computeChainId?: MerklChainId;
@@ -197,7 +210,7 @@ export type partialConfigAirdrop = {
197
210
  hooks?: (HookParameters<HOOK> | string)[];
198
211
  campaignType: Campaign;
199
212
  };
200
- export type partialConfig = partialConfigERC20 | partialConfigMorpho | partialConfigCLAMM | partialConfigIonic | partialConfigAirdrop;
213
+ export type partialConfig = partialConfigERC20 | partialConfigMorpho | partialConfigCLAMM | partialConfigIonic | partialConfigCompoundV3 | partialConfigAirdrop;
201
214
  export declare const safeTemplate: {
202
215
  version: string;
203
216
  chainId: string;
@@ -9,6 +9,7 @@ export const CampaignPayloadInputDto = t.Object({
9
9
  startTimestamp: t.Numeric({ description: "Start timestamp for the campaign" }),
10
10
  endTimestamp: t.Numeric({ description: "End timestamp for the campaign" }),
11
11
  amount: t.String({ description: "Amount of the reward token to be distributed" }),
12
+ apr: t.Optional(t.Numeric({ description: "APR for the campaign (Fixed APR campaigns)" })),
12
13
  });
13
14
  export const CampaignDataDto = t.Object({
14
15
  campaignType: t.Numeric({ description: "Type of the campaign 1 : ERC20, 2: CLAMM , ..." }),
@@ -63,6 +64,7 @@ export const ProgramPayloadInputDto = t.Object({
63
64
  startTimestamp: t.Numeric({ description: "Start timestamp for the campaign" }),
64
65
  endTimestamp: t.Numeric({ description: "End timestamp for the campaign" }),
65
66
  amount: t.Optional(t.String({ description: "Amount of the reward token to be distributed" })),
67
+ apr: t.Optional(t.Numeric({ description: "APR for the campaign (Fixed APR campaigns)" })),
66
68
  });
67
69
  export const CampaignAmountsInputDto = t.Record(t.String(), t.String());
68
70
  // ---- Template below ----
@@ -11,13 +11,15 @@ export declare enum program {
11
11
  Swapx = "Swapx",
12
12
  Etherlink = "Etherlink",
13
13
  Angles = "Angles",
14
- Ronin = "Ronin"
14
+ Ronin = "Ronin",
15
+ TAC = "TAC"
15
16
  }
16
17
  export declare enum roninCampaigns {
17
18
  Katana_WETH_RON_Ronin = "Katana WETH-RON Ronin 0x90f31f1907a4d1443a6aacdc91ac2312f91bafa7",
18
19
  Katana_AXS_RON_Ronin = "Katana AXS-RON Ronin 0x3230b903e8a5d6e46b5a5028470dd33e7b673722",
19
20
  Katana_USDC_RON_Ronin = "Katana USDC-RON Ronin 0x392d372f2a51610e9ac5b741379d5631ca9a1c7f",
20
- Katana_LRON_RON_Ronin = "Katana LRON-RON Ronin 0x0fbe1a7f0f006a4a4d817b2aa922889612758ce8"
21
+ Katana_LRON_RON_Ronin = "Katana LRON-RON Ronin 0x0fbe1a7f0f006a4a4d817b2aa922889612758ce8",
22
+ Supply_WETH_Compound_Ronin = "Supply WETH Compound Ronin 0x4006ed4097ee51c09a04c3b0951d28ccf19e6dfe"
21
23
  }
22
24
  export declare enum anglesCampaigns {
23
25
  Angles_supply_in_angles_liquid = "0x15E96CDecA34B9DE1B31586c1206206aDb92E69D",
@@ -475,7 +477,22 @@ declare const RoninInterfaceCampaigns: {
475
477
  weightToken0: number;
476
478
  weightToken1: number;
477
479
  };
480
+ "Supply WETH Compound Ronin 0x4006ed4097ee51c09a04c3b0951d28ccf19e6dfe": {
481
+ campaignType: any;
482
+ computeChainId: any;
483
+ hooks: never[];
484
+ targetToken: string;
485
+ whitelist: never[];
486
+ blacklist: never[];
487
+ url: string;
488
+ subCampaignType: any;
489
+ };
478
490
  };
491
+ export declare enum tacCampaigns {
492
+ TAC_Supply_TACETH = "TAC Supply tacETH 0x294eecec65A0142e84AEdfD8eB2FBEA8c9a9fbad",
493
+ TAC_Supply_TACBTC = "TAC Supply tacBTC 0x6Bf340dB729d82af1F6443A0Ea0d79647b1c3DDf",
494
+ TAC_Supply_TACUSD = "TAC Supply tacUSD 0x699e04F98dE2Fc395a7dcBf36B48EC837A976490"
495
+ }
479
496
  declare const AnglesInterfaceCampaigns: {
480
497
  "0x15E96CDecA34B9DE1B31586c1206206aDb92E69D": {
481
498
  campaignType: any;
@@ -1034,7 +1051,51 @@ declare const ZkSyncInterfaceCampaigns: {
1034
1051
  declare const PufferInterfaceCampaigns: {
1035
1052
  [key in pufferCampaigns]: partialConfig;
1036
1053
  };
1054
+ declare const TACInterfaceCampaigns: {
1055
+ "TAC Supply tacETH 0x294eecec65A0142e84AEdfD8eB2FBEA8c9a9fbad": {
1056
+ campaignType: any;
1057
+ computeChainId: any;
1058
+ distributionChainId: any;
1059
+ targetToken: string;
1060
+ rewardToken: string;
1061
+ hooks: never[];
1062
+ whitelist: never[];
1063
+ blacklist: never[];
1064
+ forwarders: never[];
1065
+ rewardTokenPricing: boolean;
1066
+ targetTokenPricing: boolean;
1067
+ apr: number;
1068
+ };
1069
+ "TAC Supply tacBTC 0x6Bf340dB729d82af1F6443A0Ea0d79647b1c3DDf": {
1070
+ campaignType: any;
1071
+ computeChainId: any;
1072
+ distributionChainId: any;
1073
+ targetToken: string;
1074
+ rewardToken: string;
1075
+ hooks: never[];
1076
+ whitelist: never[];
1077
+ blacklist: never[];
1078
+ forwarders: never[];
1079
+ rewardTokenPricing: boolean;
1080
+ targetTokenPricing: boolean;
1081
+ apr: number;
1082
+ };
1083
+ "TAC Supply tacUSD 0x699e04F98dE2Fc395a7dcBf36B48EC837A976490": {
1084
+ campaignType: any;
1085
+ computeChainId: any;
1086
+ distributionChainId: any;
1087
+ targetToken: string;
1088
+ rewardToken: string;
1089
+ hooks: never[];
1090
+ whitelist: never[];
1091
+ blacklist: never[];
1092
+ forwarders: never[];
1093
+ rewardTokenPricing: boolean;
1094
+ targetTokenPricing: boolean;
1095
+ apr: number;
1096
+ };
1097
+ };
1037
1098
  export declare const MerklInterfaceCampaigns: {
1038
- [key in program]: typeof PufferInterfaceCampaigns | typeof ZkSyncInterfaceCampaigns | typeof ModeInterfaceCampaigns | typeof VicunaInterfaceCampaigns | typeof SonicmarketInterfaceCampaigns | typeof ReserveInterfaceCampaigns | typeof BeetsInterfaceCampaigns | typeof CeloInterfaceCampaigns | typeof EtherlinkInterfaceCampaigns | typeof SwapxInterfaceCampaigns | typeof AnglesInterfaceCampaigns | typeof RoninInterfaceCampaigns;
1099
+ [key in program]: typeof PufferInterfaceCampaigns | typeof ZkSyncInterfaceCampaigns | typeof ModeInterfaceCampaigns | typeof VicunaInterfaceCampaigns | typeof SonicmarketInterfaceCampaigns | typeof ReserveInterfaceCampaigns | typeof BeetsInterfaceCampaigns | typeof CeloInterfaceCampaigns | typeof EtherlinkInterfaceCampaigns | typeof SwapxInterfaceCampaigns | typeof AnglesInterfaceCampaigns | typeof RoninInterfaceCampaigns | typeof TACInterfaceCampaigns;
1039
1100
  };
1040
1101
  export {};
@@ -1,4 +1,4 @@
1
- import { BalanceCallType, Campaign, ChainId, CompFork, CompoundSubCampaignType, ComputeScoreMethod, Forwarder, HOOK, MorphoSubCampaignType, StandardType, boostingFunction, boostingReferralFunction, contractStateBoost, defaultBoost, defaultReferralBoost, selectionRaffleMethod, } from "@sdk";
1
+ import { BalanceCallType, Campaign, ChainId, CompFork, CompoundSubCampaignType, CompoundV3SubCampaignType, ComputeScoreMethod, Forwarder, HOOK, MorphoSubCampaignType, StandardType, boostingFunction, boostingReferralFunction, contractStateBoost, defaultBoost, defaultReferralBoost, selectionRaffleMethod, } from "@sdk";
2
2
  import { id } from "ethers/lib/utils";
3
3
  export var program;
4
4
  (function (program) {
@@ -14,6 +14,7 @@ export var program;
14
14
  program["Etherlink"] = "Etherlink";
15
15
  program["Angles"] = "Angles";
16
16
  program["Ronin"] = "Ronin";
17
+ program["TAC"] = "TAC";
17
18
  })(program || (program = {}));
18
19
  export var roninCampaigns;
19
20
  (function (roninCampaigns) {
@@ -21,6 +22,7 @@ export var roninCampaigns;
21
22
  roninCampaigns["Katana_AXS_RON_Ronin"] = "Katana AXS-RON Ronin 0x3230b903e8a5d6e46b5a5028470dd33e7b673722";
22
23
  roninCampaigns["Katana_USDC_RON_Ronin"] = "Katana USDC-RON Ronin 0x392d372f2a51610e9ac5b741379d5631ca9a1c7f";
23
24
  roninCampaigns["Katana_LRON_RON_Ronin"] = "Katana LRON-RON Ronin 0x0fbe1a7f0f006a4a4d817b2aa922889612758ce8";
25
+ roninCampaigns["Supply_WETH_Compound_Ronin"] = "Supply WETH Compound Ronin 0x4006ed4097ee51c09a04c3b0951d28ccf19e6dfe";
24
26
  })(roninCampaigns || (roninCampaigns = {}));
25
27
  export var anglesCampaigns;
26
28
  (function (anglesCampaigns) {
@@ -501,9 +503,9 @@ const RoninInterfaceCampaigns = {
501
503
  url: "https://app.roninchain.com/liquidity/v3/0x90f31f1907a4d1443a6aacdc91ac2312f91bafa7",
502
504
  forwarders: [],
503
505
  isOutOfRangeIncentivized: false,
504
- weightFees: 2000,
505
- weightToken0: 4000,
506
- weightToken1: 4000,
506
+ weightFees: 1500,
507
+ weightToken0: 1500,
508
+ weightToken1: 7000,
507
509
  },
508
510
  [roninCampaigns.Katana_AXS_RON_Ronin]: {
509
511
  campaignType: Campaign.CLAMM,
@@ -515,9 +517,9 @@ const RoninInterfaceCampaigns = {
515
517
  url: "https://app.roninchain.com/liquidity/v3/0x3230b903e8a5d6e46b5a5028470dd33e7b673722",
516
518
  forwarders: [],
517
519
  isOutOfRangeIncentivized: false,
518
- weightFees: 2000,
519
- weightToken0: 4000,
520
- weightToken1: 4000,
520
+ weightFees: 1000,
521
+ weightToken0: 3500,
522
+ weightToken1: 5500,
521
523
  },
522
524
  [roninCampaigns.Katana_USDC_RON_Ronin]: {
523
525
  campaignType: Campaign.CLAMM,
@@ -529,9 +531,9 @@ const RoninInterfaceCampaigns = {
529
531
  url: "https://app.roninchain.com/liquidity/v3/0x392d372f2a51610e9ac5b741379d5631ca9a1c7f",
530
532
  forwarders: [],
531
533
  isOutOfRangeIncentivized: false,
532
- weightFees: 2000,
533
- weightToken0: 4000,
534
- weightToken1: 4000,
534
+ weightFees: 1000,
535
+ weightToken0: 2500,
536
+ weightToken1: 6500,
535
537
  },
536
538
  [roninCampaigns.Katana_LRON_RON_Ronin]: {
537
539
  campaignType: Campaign.CLAMM,
@@ -543,11 +545,27 @@ const RoninInterfaceCampaigns = {
543
545
  url: "https://app.roninchain.com/liquidity/v3/0x0fbe1a7f0f006a4a4d817b2aa922889612758ce8",
544
546
  forwarders: [],
545
547
  isOutOfRangeIncentivized: false,
546
- weightFees: 2000,
547
- weightToken0: 4000,
548
- weightToken1: 4000,
548
+ weightFees: 1000,
549
+ weightToken0: 4500,
550
+ weightToken1: 4500,
551
+ },
552
+ [roninCampaigns.Supply_WETH_Compound_Ronin]: {
553
+ campaignType: Campaign.COMPOUND_V3,
554
+ computeChainId: ChainId.RONIN,
555
+ hooks: [],
556
+ targetToken: "0x4006eD4097Ee51c09A04c3B0951D28CCf19e6DFE",
557
+ whitelist: [],
558
+ blacklist: [],
559
+ url: "",
560
+ subCampaignType: CompoundV3SubCampaignType.SUPPLY,
549
561
  },
550
562
  };
563
+ export var tacCampaigns;
564
+ (function (tacCampaigns) {
565
+ tacCampaigns["TAC_Supply_TACETH"] = "TAC Supply tacETH 0x294eecec65A0142e84AEdfD8eB2FBEA8c9a9fbad";
566
+ tacCampaigns["TAC_Supply_TACBTC"] = "TAC Supply tacBTC 0x6Bf340dB729d82af1F6443A0Ea0d79647b1c3DDf";
567
+ tacCampaigns["TAC_Supply_TACUSD"] = "TAC Supply tacUSD 0x699e04F98dE2Fc395a7dcBf36B48EC837A976490";
568
+ })(tacCampaigns || (tacCampaigns = {}));
551
569
  const AnglesInterfaceCampaigns = {
552
570
  [anglesCampaigns.Angles_supply_in_angles_liquid]: {
553
571
  campaignType: Campaign.ERC20_FIX_APR,
@@ -5584,6 +5602,55 @@ const PufferInterfaceCampaigns = {
5584
5602
  forwarders: [],
5585
5603
  },
5586
5604
  };
5605
+ const BaseTACREWARDS = 3.4;
5606
+ const DAILYREWARDSINDOLLAR = 1000;
5607
+ const tacBTCMultiplier = 3;
5608
+ const tacETHMultiplier = 3.5;
5609
+ const tacUSDMultiplier = 5;
5610
+ const TACInterfaceCampaigns = {
5611
+ [tacCampaigns.TAC_Supply_TACETH]: {
5612
+ campaignType: Campaign.ERC20_FIX_APR,
5613
+ computeChainId: ChainId.MAINNET,
5614
+ distributionChainId: ChainId.GNOSIS,
5615
+ targetToken: "0x294eecec65A0142e84AEdfD8eB2FBEA8c9a9fbad",
5616
+ rewardToken: "0xf2401de511DC0D1ad4762588722f5B0574A56b60",
5617
+ hooks: [],
5618
+ whitelist: [],
5619
+ blacklist: [],
5620
+ forwarders: [],
5621
+ rewardTokenPricing: false,
5622
+ targetTokenPricing: true,
5623
+ apr: (BaseTACREWARDS * tacETHMultiplier * 365 * 100) / DAILYREWARDSINDOLLAR,
5624
+ },
5625
+ [tacCampaigns.TAC_Supply_TACBTC]: {
5626
+ campaignType: Campaign.ERC20_FIX_APR,
5627
+ computeChainId: ChainId.MAINNET,
5628
+ distributionChainId: ChainId.GNOSIS,
5629
+ targetToken: "0x6Bf340dB729d82af1F6443A0Ea0d79647b1c3DDf",
5630
+ rewardToken: "0xf2401de511DC0D1ad4762588722f5B0574A56b60",
5631
+ hooks: [],
5632
+ whitelist: [],
5633
+ blacklist: [],
5634
+ forwarders: [],
5635
+ rewardTokenPricing: false,
5636
+ targetTokenPricing: true,
5637
+ apr: (BaseTACREWARDS * tacBTCMultiplier * 365 * 100) / DAILYREWARDSINDOLLAR,
5638
+ },
5639
+ [tacCampaigns.TAC_Supply_TACUSD]: {
5640
+ campaignType: Campaign.ERC20_FIX_APR,
5641
+ computeChainId: ChainId.MAINNET,
5642
+ distributionChainId: ChainId.GNOSIS,
5643
+ targetToken: "0x699e04F98dE2Fc395a7dcBf36B48EC837A976490",
5644
+ rewardToken: "0xf2401de511DC0D1ad4762588722f5B0574A56b60",
5645
+ hooks: [],
5646
+ whitelist: [],
5647
+ blacklist: [],
5648
+ forwarders: [],
5649
+ rewardTokenPricing: false,
5650
+ targetTokenPricing: true,
5651
+ apr: (BaseTACREWARDS * tacUSDMultiplier * 365 * 100) / DAILYREWARDSINDOLLAR,
5652
+ },
5653
+ };
5587
5654
  export const MerklInterfaceCampaigns = {
5588
5655
  [program.Puffer]: PufferInterfaceCampaigns,
5589
5656
  [program.ZkSync]: ZkSyncInterfaceCampaigns,
@@ -5597,4 +5664,5 @@ export const MerklInterfaceCampaigns = {
5597
5664
  [program.Etherlink]: EtherlinkInterfaceCampaigns,
5598
5665
  [program.Angles]: AnglesInterfaceCampaigns,
5599
5666
  [program.Ronin]: RoninInterfaceCampaigns,
5667
+ [program.TAC]: TACInterfaceCampaigns,
5600
5668
  };
@@ -23,6 +23,7 @@ export class ProgramPayloadService {
23
23
  const creator = query.creator;
24
24
  const amount = query.amount;
25
25
  const program = query.program;
26
+ const apr = query.apr;
26
27
  if (!(program in MerklInterfaceCampaigns)) {
27
28
  throw new Error(`Program ${program} not found`);
28
29
  }
@@ -31,6 +32,10 @@ export class ProgramPayloadService {
31
32
  throw new Error(`Campaign ${campaign} not found`);
32
33
  }
33
34
  const config = programInterface[campaign];
35
+ if (apr && "apr" in config) {
36
+ // override the apr if in query params
37
+ config.apr = apr;
38
+ }
34
39
  return {
35
40
  ...config,
36
41
  amount: amount,
@@ -6,6 +6,8 @@ import { TokenService } from "@/modules/v4/token/token.service";
6
6
  import bigintToString from "@/utils/bigintToString";
7
7
  import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "@/utils/throw";
8
8
  import Elysia, { t } from "elysia";
9
+ import { CacheService } from "../cache";
10
+ import { TTLPresets } from "../cache/cache.model";
9
11
  import { CampaignIdDto, CampaignIdWithoutPageDto, CampaignRewardsDto, CreateManyBreakdownDto, CreateManyRewardDto, RegisterClaimsDto, TokenIdDto, } from "./reward.model";
10
12
  import { RewardService } from "./reward.service";
11
13
  // ─── Rewards Controller ──────────────────────────────────────────────────────
@@ -131,6 +133,6 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
131
133
  })
132
134
  .get("/total/distributed", async ({ query }) => await RewardService.getTotalDistributed(query.since.getTime() / 1000))
133
135
  .get("/total/distributed/by-opportunities", async ({ query }) => JSON.stringify(bigintToString(Array.from((await RewardService.getTotalDistributedByOpportunities(query.since.getTime() / 1000)).entries()))))
134
- .get("/total/distributed/by-chains", async ({ query }) => await RewardService.getTotalDistributedByChains(query.since.getTime() / 1000))
135
- .get("/total/distributed/by-types", async ({ query }) => await RewardService.getTotalDistributedByType(query.since.getTime() / 1000))
136
- .get("/total/distributed/by-protocols", async ({ query }) => await RewardService.getTotalDistributedByProtocol(query.since.getTime() / 1000));
136
+ .get("/total/distributed/by-chains", async ({ query }) => await CacheService.wrap(TTLPresets.DAY_1, RewardService.getTotalDistributedByChains, query.since.getTime() / 1000))
137
+ .get("/total/distributed/by-types", async ({ query }) => await CacheService.wrap(TTLPresets.DAY_1, RewardService.getTotalDistributedByType, query.since.getTime() / 1000))
138
+ .get("/total/distributed/by-protocols", async ({ query }) => await CacheService.wrap(TTLPresets.DAY_1, RewardService.getTotalDistributedByProtocol, query.since.getTime() / 1000));
@@ -4299,6 +4299,7 @@ export declare const v4: Elysia<"/v4", false, {
4299
4299
  body: unknown;
4300
4300
  params: {};
4301
4301
  query: {
4302
+ apr?: number | undefined;
4302
4303
  creator: string;
4303
4304
  campaign: string;
4304
4305
  distributionChainId: number;
@@ -4331,6 +4332,7 @@ export declare const v4: Elysia<"/v4", false, {
4331
4332
  body: unknown;
4332
4333
  params: {};
4333
4334
  query: {
4335
+ apr?: number | undefined;
4334
4336
  creator: string;
4335
4337
  campaign: string;
4336
4338
  distributionChainId: number;
@@ -4375,6 +4377,7 @@ export declare const v4: Elysia<"/v4", false, {
4375
4377
  body: unknown;
4376
4378
  params: {};
4377
4379
  query: {
4380
+ apr?: number | undefined;
4378
4381
  creator: string;
4379
4382
  campaign: string;
4380
4383
  distributionChainId: number;
@@ -4401,6 +4404,7 @@ export declare const v4: Elysia<"/v4", false, {
4401
4404
  params: {};
4402
4405
  query: {
4403
4406
  amount?: string | undefined;
4407
+ apr?: number | undefined;
4404
4408
  creator: string;
4405
4409
  distributionChainId: number;
4406
4410
  startTimestamp: number;
@@ -4435,6 +4439,7 @@ export declare const v4: Elysia<"/v4", false, {
4435
4439
  params: {};
4436
4440
  query: {
4437
4441
  amount?: string | undefined;
4442
+ apr?: number | undefined;
4438
4443
  creator: string;
4439
4444
  distributionChainId: number;
4440
4445
  startTimestamp: number;
@@ -297,8 +297,7 @@ export class TokenService {
297
297
  });
298
298
  }
299
299
  catch (err) {
300
- console.error("Failed to create price source.");
301
- console.error(err);
300
+ log.error("Failed to create price source.", err);
302
301
  }
303
302
  }
304
303
  return await TokenService.update(token.id, {