@merkl/api 0.19.6 → 0.19.7

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 (49) hide show
  1. package/dist/src/eden/index.d.ts +70 -0
  2. package/dist/src/factories/opportunityMetadata/implementations/EventBased.d.ts +1 -1
  3. package/dist/src/factories/opportunityMetadata/implementations/EventBased.js +2 -2
  4. package/dist/src/index.d.ts +14 -0
  5. package/dist/src/libs/campaigns/campaignTypes/AjnaDynamicData.js +7 -7
  6. package/dist/src/libs/campaigns/campaignTypes/AmbientDynamicData.js +7 -5
  7. package/dist/src/libs/campaigns/campaignTypes/BadgerDynamicData.js +8 -5
  8. package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +7 -5
  9. package/dist/src/libs/campaigns/campaignTypes/CompoundDynamicData.js +8 -5
  10. package/dist/src/libs/campaigns/campaignTypes/DolomiteDynamicData.js +9 -6
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +9 -6
  12. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +2 -0
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/BunniV2Processor.d.ts +45 -0
  15. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/BunniV2Processor.js +87 -0
  16. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/processorMapping.js +2 -0
  17. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +2 -0
  18. package/dist/src/libs/campaigns/campaignTypes/EigenLayerDynamicData.js +9 -6
  19. package/dist/src/libs/campaigns/campaignTypes/EventBasedDynamicData.js +2 -1
  20. package/dist/src/libs/campaigns/campaignTypes/HyperdriveDynamicData.js +9 -6
  21. package/dist/src/libs/campaigns/campaignTypes/MORPHODynamicData.js +8 -5
  22. package/dist/src/libs/campaigns/campaignTypes/RadiantDynamicData.js +8 -5
  23. package/dist/src/libs/campaigns/campaignTypes/SILODynamicData.js +8 -5
  24. package/dist/src/libs/campaigns/campaignTypes/UniswapV4DynamicData.js +7 -5
  25. package/dist/src/libs/campaigns/campaignTypes/VestDynamicData.js +8 -5
  26. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +5 -0
  27. package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
  28. package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
  29. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +4 -0
  30. package/dist/src/modules/v4/campaign/campaign.repository.js +2 -1
  31. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +8 -0
  32. package/dist/src/modules/v4/opportunity/opportunity.converter.js +2 -2
  33. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -0
  34. package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -0
  35. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +1 -1
  36. package/dist/src/modules/v4/opportunity/opportunity.repository.js +14 -10
  37. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +2 -2
  38. package/dist/src/modules/v4/opportunity/opportunity.service.js +4 -4
  39. package/dist/src/modules/v4/router.d.ts +14 -0
  40. package/dist/src/modules/v4/token/token.controller.d.ts +1 -0
  41. package/dist/src/modules/v4/token/token.model.d.ts +1 -0
  42. package/dist/src/modules/v4/token/token.model.js +1 -0
  43. package/dist/src/modules/v4/token/token.service.d.ts +3 -1
  44. package/dist/src/modules/v4/token/token.service.js +18 -0
  45. package/dist/src/utils/decodeCalls.js +7 -1
  46. package/dist/src/utils/encodeCalls.js +19 -1
  47. package/dist/src/utils/generateCardName.js +2 -0
  48. package/dist/tsconfig.package.tsbuildinfo +1 -1
  49. package/package.json +2 -2
@@ -267,6 +267,7 @@ declare const app: Elysia<"", false, {
267
267
  chainId?: string | undefined;
268
268
  mainProtocolId?: string | undefined;
269
269
  campaigns?: boolean | undefined;
270
+ point?: boolean | undefined;
270
271
  test?: boolean | undefined;
271
272
  rewardTokenSymbol?: string | undefined;
272
273
  order?: string | undefined;
@@ -461,6 +462,7 @@ declare const app: Elysia<"", false, {
461
462
  chainId?: string | undefined;
462
463
  mainProtocolId?: string | undefined;
463
464
  campaigns?: boolean | undefined;
465
+ point?: boolean | undefined;
464
466
  test?: boolean | undefined;
465
467
  rewardTokenSymbol?: string | undefined;
466
468
  order?: string | undefined;
@@ -482,6 +484,7 @@ declare const app: Elysia<"", false, {
482
484
  id: string;
483
485
  };
484
486
  query: {
487
+ point?: boolean | undefined;
485
488
  test?: boolean | undefined;
486
489
  };
487
490
  headers: unknown;
@@ -605,6 +608,7 @@ declare const app: Elysia<"", false, {
605
608
  chainId?: number | undefined;
606
609
  creatorId?: string | undefined;
607
610
  mainParameter?: string | undefined;
611
+ point?: boolean | undefined;
608
612
  tokenAddress?: string | undefined;
609
613
  test?: boolean | undefined;
610
614
  createdAfter?: number | undefined;
@@ -773,6 +777,7 @@ declare const app: Elysia<"", false, {
773
777
  id: string;
774
778
  };
775
779
  query: {
780
+ point?: boolean | undefined;
776
781
  test?: boolean | undefined;
777
782
  };
778
783
  headers: unknown;
@@ -950,6 +955,7 @@ declare const app: Elysia<"", false, {
950
955
  chainId?: string | undefined;
951
956
  mainProtocolId?: string | undefined;
952
957
  campaigns?: boolean | undefined;
958
+ point?: boolean | undefined;
953
959
  test?: boolean | undefined;
954
960
  rewardTokenSymbol?: string | undefined;
955
961
  order?: string | undefined;
@@ -990,6 +996,7 @@ declare const app: Elysia<"", false, {
990
996
  chainId?: string | undefined;
991
997
  mainProtocolId?: string | undefined;
992
998
  campaigns?: boolean | undefined;
999
+ point?: boolean | undefined;
993
1000
  test?: boolean | undefined;
994
1001
  rewardTokenSymbol?: string | undefined;
995
1002
  order?: string | undefined;
@@ -1031,6 +1038,7 @@ declare const app: Elysia<"", false, {
1031
1038
  chainId?: string | undefined;
1032
1039
  mainProtocolId?: string | undefined;
1033
1040
  campaigns?: boolean | undefined;
1041
+ point?: boolean | undefined;
1034
1042
  test?: boolean | undefined;
1035
1043
  rewardTokenSymbol?: string | undefined;
1036
1044
  order?: string | undefined;
@@ -1257,6 +1265,7 @@ declare const app: Elysia<"", false, {
1257
1265
  chainId?: number | undefined;
1258
1266
  creatorId?: string | undefined;
1259
1267
  mainParameter?: string | undefined;
1268
+ point?: boolean | undefined;
1260
1269
  tokenAddress?: string | undefined;
1261
1270
  test?: boolean | undefined;
1262
1271
  createdAfter?: number | undefined;
@@ -1443,6 +1452,7 @@ declare const app: Elysia<"", false, {
1443
1452
  chainId?: number | undefined;
1444
1453
  creatorId?: string | undefined;
1445
1454
  mainParameter?: string | undefined;
1455
+ point?: boolean | undefined;
1446
1456
  tokenAddress?: string | undefined;
1447
1457
  test?: boolean | undefined;
1448
1458
  createdAfter?: number | undefined;
@@ -1478,6 +1488,7 @@ declare const app: Elysia<"", false, {
1478
1488
  chainId?: number | undefined;
1479
1489
  creatorId?: string | undefined;
1480
1490
  mainParameter?: string | undefined;
1491
+ point?: boolean | undefined;
1481
1492
  tokenAddress?: string | undefined;
1482
1493
  test?: boolean | undefined;
1483
1494
  createdAfter?: number | undefined;
@@ -1516,6 +1527,7 @@ declare const app: Elysia<"", false, {
1516
1527
  chainId?: number | undefined;
1517
1528
  creatorId?: string | undefined;
1518
1529
  mainParameter?: string | undefined;
1530
+ point?: boolean | undefined;
1519
1531
  tokenAddress?: string | undefined;
1520
1532
  test?: boolean | undefined;
1521
1533
  createdAfter?: number | undefined;
@@ -1632,6 +1644,7 @@ declare const app: Elysia<"", false, {
1632
1644
  chainId?: number | undefined;
1633
1645
  creatorId?: string | undefined;
1634
1646
  mainParameter?: string | undefined;
1647
+ point?: boolean | undefined;
1635
1648
  tokenAddress?: string | undefined;
1636
1649
  test?: boolean | undefined;
1637
1650
  createdAfter?: number | undefined;
@@ -2043,6 +2056,7 @@ declare const app: Elysia<"", false, {
2043
2056
  displaySymbol?: string | undefined;
2044
2057
  verified?: boolean | undefined;
2045
2058
  isTest?: boolean | undefined;
2059
+ isPoint?: boolean | undefined;
2046
2060
  };
2047
2061
  params: {
2048
2062
  id: string;
@@ -1,12 +1,11 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
1
2
  import { batchMulticallCallWithRetry } from "@/utils/generic";
2
3
  import { providers } from "@/utils/providers";
3
4
  import { AjnaSubCampaignType, BN2Number, ERC20Pool__factory, NETWORK_LABELS, PoolInfoUtilsInterface, YEAR, } from "@sdk";
4
5
  import { POOL_INFO_UTILS } from "@sdk";
5
6
  import axios from "axios";
6
7
  import { log } from "../../../utils/logger";
7
- import { Pricer } from "../../../utils/pricer";
8
8
  export async function AjnaDynamicData(chainId, campaigns) {
9
- const pricer = await Pricer.load();
10
9
  const calls = [];
11
10
  for (const campaign of campaigns) {
12
11
  if (campaign.campaignParameters.subCampaignType === AjnaSubCampaignType.lend) {
@@ -80,11 +79,12 @@ export async function AjnaDynamicData(chainId, campaigns) {
80
79
  }
81
80
  }
82
81
  totalComputedTargetToken -= blacklistedSupply;
83
- const priceRewardToken = (await pricer.get({
84
- address: campaign.rewardToken,
85
- chainId,
86
- symbol: campaign.campaignParameters.symbolRewardToken,
87
- })) ?? 0;
82
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
83
+ // (await pricer.get({
84
+ // address: campaign.rewardToken,
85
+ // chainId,
86
+ // symbol: campaign.campaignParameters.symbolRewardToken,
87
+ // })) ?? 0;
88
88
  dynamicData.push({
89
89
  ...campaign,
90
90
  apr: (priceRewardToken *
@@ -1,3 +1,4 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
1
2
  import { AmbientAddresses, AmbientLens, BN2Number, EAprBreakdownType, NETWORK_LABELS, YEAR, } from "@sdk";
2
3
  import moment from "moment";
3
4
  import { log } from "../../../utils/logger";
@@ -153,11 +154,12 @@ export async function AmbientDynamicData(chainId, campaigns) {
153
154
  const aprBreakdowns = [];
154
155
  let priceRewardToken = 0;
155
156
  if (isLive && c.campaignParameters.symbolRewardToken !== "aglaMerkl") {
156
- priceRewardToken = (await pricer.get({
157
- address: c.rewardToken,
158
- chainId: chainId,
159
- symbol: c.campaignParameters.symbolRewardToken,
160
- }));
157
+ // priceRewardToken = (await pricer.get({
158
+ // address: c.rewardToken,
159
+ // chainId: chainId,
160
+ // symbol: c.campaignParameters.symbolRewardToken,
161
+ // })) as number;
162
+ priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
161
163
  /** Yearly rewards in $ */
162
164
  const yearlyToken0Rewards = (propToken0 * priceRewardToken * amount * YEAR) / (endTimestamp - startTimestamp);
163
165
  const yearlyToken1Rewards = (propToken1 * priceRewardToken * amount * YEAR) / (endTimestamp - startTimestamp);
@@ -2,6 +2,7 @@ import { BN2Number, SortedCdpsInterface, YEAR, } from "@sdk";
2
2
  import { log } from "../../../utils/logger";
3
3
  import { Pricer } from "../../../utils/pricer";
4
4
  import { CDPMANAGER_ADDRESS, EBTC_ADDRESS, SORTEDCDPS_ADDRESS } from "@/constants";
5
+ import { TokenService } from "@/modules/v4/token/token.service";
5
6
  import { batchMulticallCallWithRetry } from "@/utils/generic";
6
7
  import { CdpManagerInterface } from "../../../../libs/sdk/src/merkl/interface";
7
8
  export async function BadgerDynamicData(chainId, campaigns) {
@@ -58,11 +59,13 @@ export async function BadgerDynamicData(chainId, campaigns) {
58
59
  blacklistSupply += BN2Number(cdpBlacklistedSupply, campaign.campaignParameters.decimalsTargetToken);
59
60
  }
60
61
  const totalSupplyTargetToken = BN2Number(CdpManagerInterface.decodeFunctionResult("getSystemDebt", result[0])[0], campaign.campaignParameters.decimalsTargetToken) - blacklistSupply;
61
- const priceRewardToken = (await pricer.get({
62
- address: campaign.rewardToken,
63
- chainId,
64
- symbol: campaign.campaignParameters.symbolRewardToken,
65
- })) ?? 0;
62
+ // const priceRewardToken =
63
+ // (await pricer.get({
64
+ // address: campaign.rewardToken,
65
+ // chainId,
66
+ // symbol: campaign.campaignParameters.symbolRewardToken,
67
+ // })) ?? 0;
68
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
66
69
  const priceTargetToken = (await pricer.get({
67
70
  address: EBTC_ADDRESS,
68
71
  chainId,
@@ -1,5 +1,6 @@
1
1
  import { nftPositionByIdsQuery, positionMultipleOwnersQuery } from "@/libs/positions/clamm/thegraph";
2
2
  import { fetchFarmedPositions } from "@/libs/positions/clamm/thegraph/fetchFarmedPositions";
3
+ import { TokenService } from "@/modules/v4/token/token.service";
3
4
  import { A51Factory__factory, ALM, ALMMapping, AMM, AMMAlgorithm, AMMAlgorithmMapping, BN2Number, DecodeLiquidity, EAprBreakdownType, ERC20Interface, Forwarder, JonesDoubleRewardTracker__factory, Liquidity, NETWORK_LABELS, NitroInterface, PoolInterface, PoolState, PriorityAMM, SqrtPrice, almName, ammName, getAmountsForLiquidity, getTickAtSqrtRatio, isBlacklisted, isWhitelisted, merklSubgraphAMMEndpoints, shortenAddress, spNFTInterface, withTimeout, } from "@sdk";
4
5
  import axios from "axios";
5
6
  import { BigNumber, utils } from "ethers";
@@ -586,11 +587,12 @@ export async function CLAMMDynamicData(chainId, campaigns) {
586
587
  const distributionForwarders = almDetails.map(x => ({ ...x }));
587
588
  let priceRewardToken = 0;
588
589
  if (isLive && c.campaignParameters.symbolRewardToken !== "aglaMerkl") {
589
- priceRewardToken = (await pricer.get({
590
- address: c.rewardToken,
591
- chainId: chainId,
592
- symbol: c.campaignParameters.symbolRewardToken,
593
- }));
590
+ // priceRewardToken = (await pricer.get({
591
+ // address: c.rewardToken,
592
+ // chainId: chainId,
593
+ // symbol: c.campaignParameters.symbolRewardToken,
594
+ // })) as number;
595
+ priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
594
596
  /**
595
597
  * Handle whitelisted/blacklisted addresses to compute APR
596
598
  */
@@ -1,3 +1,4 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
1
2
  import { BN2Number, CTokenInterface, ChainInteractionService, CompFork, CompoundSubCampaignType, ERC20Interface, IonicERC20_INTERFACE, LayerBankERC20Interface, NULL_ADDRESS, YEAR, } from "@sdk";
2
3
  import { log } from "../../../utils/logger";
3
4
  import { Pricer } from "../../../utils/pricer";
@@ -109,11 +110,13 @@ export async function CompoundDynamicData(_chainId, campaigns) {
109
110
  totalSupplyTargetToken = 0.0000001;
110
111
  }
111
112
  }
112
- const priceRewardToken = (await pricer.get({
113
- address: campaign.rewardToken,
114
- chainId: campaign.chainId,
115
- symbol: campaign.campaignParameters.symbolRewardToken,
116
- })) ?? 0;
113
+ // const priceRewardToken =
114
+ // (await pricer.get({
115
+ // address: campaign.rewardToken,
116
+ // chainId: campaign.chainId,
117
+ // symbol: campaign.campaignParameters.symbolRewardToken,
118
+ // })) ?? 0;
119
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
117
120
  const priceTargetToken = (await pricer.get({
118
121
  address: campaign.campaignParameters.underlyingToken,
119
122
  chainId: campaign.computeChainId,
@@ -1,7 +1,8 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
2
+ import { Pricer } from "@/utils/pricer";
1
3
  import { BN2Number, DolomiteSubCampaignType, YEAR, } from "@sdk";
2
4
  import axios from "axios";
3
5
  import { log } from "../../../utils/logger";
4
- import { Pricer } from "../../../utils/pricer";
5
6
  export async function DolomiteDynamicData(chainId, campaigns) {
6
7
  const pricer = await Pricer.load();
7
8
  const calls = [];
@@ -24,11 +25,13 @@ export async function DolomiteDynamicData(chainId, campaigns) {
24
25
  : campaign.campaignSubType === DolomiteSubCampaignType.supply
25
26
  ? Number.parseFloat(tokenData.supplyLiquidity)
26
27
  : Number.parseFloat(tokenData.supplyLiquidity) - Number.parseFloat(tokenData.borrowLiquidity);
27
- const priceRewardToken = (await pricer.get({
28
- address: campaign.rewardToken,
29
- chainId,
30
- symbol: campaign.campaignParameters.symbolRewardToken,
31
- })) ?? 0;
28
+ // const priceRewardToken =
29
+ // (await pricer.get({
30
+ // address: campaign.rewardToken,
31
+ // chainId,
32
+ // symbol: campaign.campaignParameters.symbolRewardToken,
33
+ // })) ?? 0;
34
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
32
35
  const priceTargetToken = (await pricer.get({
33
36
  address: tokenData.id,
34
37
  chainId,
@@ -1,9 +1,10 @@
1
1
  import { merklChainDataWithCache } from "@/libs/merklChainData";
2
2
  import { ComputedValueService } from "@/modules/v4/computedValue";
3
3
  import { TokenRepository } from "@/modules/v4/token/token.repository";
4
+ import { TokenService } from "@/modules/v4/token/token.service";
4
5
  import { log } from "@/utils/logger";
6
+ import { Pricer } from "@/utils/pricer";
5
7
  import { BN2Number, BalancerPoolInterface, BalancerV3StablePoolInterface, ChainInteractionService, ERC20Interface, EnzymeInterface, FactoryInterface, LayerBankERC20Interface, MetamorphoInterface, YEAR, getEnv, } from "@sdk";
6
- import { Pricer } from "../../../utils/pricer";
7
8
  import { tokenType } from "./ERC20SubTypes/helpers/tokenType";
8
9
  import { getTokenPricesInfo } from "./ERC20SubTypes/subtypesPrices";
9
10
  import { getTokenTypeRound1 } from "./ERC20SubTypes/subtypesRound1";
@@ -113,11 +114,13 @@ export async function ERC20DynamicData(chainId, campaigns) {
113
114
  let i = 0;
114
115
  const dynamicData = [];
115
116
  for (const campaign of campaigns) {
116
- const priceRewardToken = (await pricer.get({
117
- address: campaign.rewardToken,
118
- chainId,
119
- symbol: campaign.campaignParameters.symbolRewardToken,
120
- })) ?? 0;
117
+ // const priceRewardToken =
118
+ // (await pricer.get({
119
+ // address: campaign.rewardToken,
120
+ // chainId,
121
+ // symbol: campaign.campaignParameters.symbolRewardToken,
122
+ // })) ?? 0;
123
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
121
124
  // Get the data from the final round and process it to get the price of the target token and some extra info
122
125
  const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
123
126
  tokenTypesByCampaign[campaign.campaignId] = await getTokenPricesInfo(i, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, result, campaign, pricer);
@@ -90,7 +90,8 @@ export declare enum tokenType {
90
90
  katana = "katana",
91
91
  balancerV3 = "balancerV3",
92
92
  hanji_liquidity_vault_token = "hanji_liquidity_vault_token",
93
- xU308 = "xU308"
93
+ xU308 = "xU308",
94
+ bunniV2 = "bunniV2"
94
95
  }
95
96
  export declare const tokenTypeToProtocol: {
96
97
  [key in tokenType]: {
@@ -92,6 +92,7 @@ export var tokenType;
92
92
  tokenType["balancerV3"] = "balancerV3";
93
93
  tokenType["hanji_liquidity_vault_token"] = "hanji_liquidity_vault_token";
94
94
  tokenType["xU308"] = "xU308";
95
+ tokenType["bunniV2"] = "bunniV2";
95
96
  })(tokenType || (tokenType = {}));
96
97
  export const tokenTypeToProtocol = {
97
98
  [tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
@@ -184,4 +185,5 @@ export const tokenTypeToProtocol = {
184
185
  [tokenType.balancerV3]: { protocol: "Balancer", action: OpportunityAction.POOL },
185
186
  [tokenType.hanji_liquidity_vault_token]: { protocol: "Hanji", action: OpportunityAction.POOL },
186
187
  [tokenType.xU308]: { protocol: "Uranium", action: OpportunityAction.HOLD },
188
+ [tokenType.bunniV2]: { protocol: "Bunni V2", action: OpportunityAction.HOLD },
187
189
  };
@@ -0,0 +1,45 @@
1
+ import type { Pricer } from "@/utils/pricer";
2
+ import { type Campaign, type CampaignParameters, type UniswapV4PoolKey } from "@sdk";
3
+ import type { PoolStateStructOutput } from "libs/sdk/src/generated/BunniV2Hub";
4
+ import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
5
+ import type { tokenType } from "../helpers/tokenType";
6
+ type callType = {
7
+ key: keyof dataRawBunniV2;
8
+ call: string;
9
+ target: keyof callKeysBunniV2;
10
+ metaData?: keyof callKeysBunniV2;
11
+ };
12
+ type callKeysBunniV2 = mandatoryCallKeys & {
13
+ decimalsToken0: string;
14
+ decimalsToken1: string;
15
+ hub: string;
16
+ poolId: string;
17
+ poolKey: string;
18
+ poolState: string;
19
+ symbolToken0: string;
20
+ symbolToken1: string;
21
+ token0: string;
22
+ token1: string;
23
+ totalSupply: string;
24
+ };
25
+ type dataRawBunniV2 = callKeysBunniV2 & {
26
+ poolId: string;
27
+ poolKey: UniswapV4PoolKey;
28
+ poolState: PoolStateStructOutput;
29
+ };
30
+ type dataTypeBunniV2 = dataType & {
31
+ poolId: string;
32
+ balance0: string;
33
+ balance1: string;
34
+ };
35
+ export declare class BunniV2Processor extends GenericProcessor<callKeysBunniV2, dataRawBunniV2, dataTypeBunniV2> {
36
+ rounds: {
37
+ round1: callType[];
38
+ round2: callType[];
39
+ round3: callType[];
40
+ round4: callType[];
41
+ };
42
+ processingRound2(typeInfo: dataRawBunniV2): void;
43
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawBunniV2, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeBunniV2>;
44
+ }
45
+ export {};
@@ -0,0 +1,87 @@
1
+ import { generateCardName } from "@/utils/generateCardName";
2
+ import { BN2Number, computeUniswapV4PoolId } from "@sdk";
3
+ import { GenericProcessor } from "../GenericProcessor";
4
+ export class BunniV2Processor extends GenericProcessor {
5
+ rounds = {
6
+ round1: [
7
+ {
8
+ key: "hub",
9
+ call: "hub",
10
+ target: "tokenAddress",
11
+ },
12
+ {
13
+ key: "poolKey",
14
+ call: "poolKey",
15
+ target: "tokenAddress",
16
+ },
17
+ {
18
+ key: "token0",
19
+ call: "token0",
20
+ target: "tokenAddress",
21
+ },
22
+ {
23
+ key: "token1",
24
+ call: "token1",
25
+ target: "tokenAddress",
26
+ },
27
+ ],
28
+ round2: [
29
+ {
30
+ key: "poolState",
31
+ call: "poolState",
32
+ target: "hub",
33
+ metaData: "poolId",
34
+ },
35
+ ],
36
+ round3: [
37
+ {
38
+ key: "decimalsToken0",
39
+ call: "decimals",
40
+ target: "token0",
41
+ },
42
+ {
43
+ key: "symbolToken0",
44
+ call: "symbol",
45
+ target: "token0",
46
+ },
47
+ {
48
+ key: "decimalsToken1",
49
+ call: "decimals",
50
+ target: "token1",
51
+ },
52
+ {
53
+ key: "symbolToken1",
54
+ call: "symbol",
55
+ target: "token1",
56
+ },
57
+ ],
58
+ round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
59
+ };
60
+ processingRound2(typeInfo) {
61
+ typeInfo.poolId = computeUniswapV4PoolId(typeInfo.poolKey);
62
+ }
63
+ async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
64
+ const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
65
+ const decimalsToken0 = Number(typeInfo.decimalsToken0);
66
+ const decimalsToken1 = Number(typeInfo.decimalsToken1);
67
+ const amount0 = BN2Number(typeInfo.poolState.rawBalance0, decimalsToken0) +
68
+ BN2Number(typeInfo.poolState.reserve0, decimalsToken0);
69
+ const amount1 = BN2Number(typeInfo.poolState.rawBalance1, decimalsToken0) +
70
+ BN2Number(typeInfo.poolState.reserve1, decimalsToken1);
71
+ const token0PRice = (await pricer.get({ symbol: typeInfo.symbolToken0 })) ?? 0;
72
+ const token1Price = (await pricer.get({ symbol: typeInfo.symbolToken1 })) ?? 0;
73
+ const tvl = token0PRice * amount0 + token1Price * amount1;
74
+ const priceTargetToken = tvl / totalSupply;
75
+ return {
76
+ ...typeInfo,
77
+ balance0: amount0.toString(),
78
+ balance1: amount1.toString(),
79
+ blacklistedSupply,
80
+ cardName: generateCardName(type, typeInfo, campaign),
81
+ priceTargetToken: priceTargetToken,
82
+ totalSupply,
83
+ tvl,
84
+ whitelistedSupplyTargetToken,
85
+ };
86
+ }
87
+ }
@@ -8,6 +8,7 @@ import { BalancerGaugeProcessor } from "./BalancerGaugeProcessor";
8
8
  import { BalancerPoolProcessor } from "./BalancerPoolProcessor";
9
9
  import { BalancerV3PoolProcessor } from "./BalancerV3PoolProcessor";
10
10
  import { BeefyProcessor } from "./BeefyProcessor";
11
+ import { BunniV2Processor } from "./BunniV2Processor";
11
12
  import { CompoundProcessor } from "./CompoundProcessor";
12
13
  import { ERC4626Processor } from "./ERC4626Processor";
13
14
  import { EnzymeProcessor } from "./EnzymeProcessor";
@@ -134,4 +135,5 @@ export const processorMapping = {
134
135
  [tokenType.balancerV3]: BalancerV3PoolProcessor,
135
136
  [tokenType.hanji_liquidity_vault_token]: HanjiVaultProcessor,
136
137
  [tokenType.xU308]: xU308Processor,
138
+ [tokenType.bunniV2]: BunniV2Processor,
137
139
  };
@@ -149,6 +149,8 @@ function satisfiesNameConditions(name, type) {
149
149
  return lowerCaseName.includes("spectra") && lowerCaseName.includes("curve");
150
150
  case tokenType.spectra_yt:
151
151
  return lowerCaseName.includes("yield") && lowerCaseName.includes("token");
152
+ case tokenType.bunniV2:
153
+ return lowerCaseName.includes("bunni");
152
154
  default:
153
155
  return false;
154
156
  }
@@ -1,6 +1,7 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
2
+ import { Pricer } from "@/utils/pricer";
1
3
  import { BN2Number, ChainInteractionService, EigenLayerStrategyInterface, EigenLayerStrategy__factory, YEAR, } from "@sdk";
2
4
  import { log } from "../../../utils/logger";
3
- import { Pricer } from "../../../utils/pricer";
4
5
  export async function EigenLayerDynamicData(_chainId, campaigns) {
5
6
  const pricer = await Pricer.load();
6
7
  const calls = [];
@@ -36,11 +37,13 @@ export async function EigenLayerDynamicData(_chainId, campaigns) {
36
37
  log.warn(`Error getting totalSupply for campaign ${campaign.campaignId} and strategy ${campaign.campaignParameters.strategy}`);
37
38
  totalSupplyStrategy = 0.0000001;
38
39
  }
39
- const priceRewardToken = (await pricer.get({
40
- address: campaign.rewardToken,
41
- chainId: campaign.chainId,
42
- symbol: campaign.campaignParameters.symbolRewardToken,
43
- })) ?? 0;
40
+ // const priceRewardToken =
41
+ // (await pricer.get({
42
+ // address: campaign.rewardToken,
43
+ // chainId: campaign.chainId,
44
+ // symbol: campaign.campaignParameters.symbolRewardToken,
45
+ // })) ?? 0;
46
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
44
47
  const priceTargetToken = (await pricer.get({
45
48
  address: campaign.campaignParameters.underlyingToken,
46
49
  chainId: campaign.computeChainId,
@@ -1,4 +1,5 @@
1
1
  import { BucketService } from "@/modules/v4/bucket/bucket.service";
2
+ import { TokenService } from "@/modules/v4/token/token.service";
2
3
  import { engineDbClient } from "@db";
3
4
  import { BN2Number, ChainInteractionService, NETWORK_LABELS, } from "@sdk";
4
5
  import moment from "moment";
@@ -79,7 +80,7 @@ export async function EventBasedDynamicData(chainId, campaigns) {
79
80
  const endTimestamp = BN2Number(c.endTimestamp, 0);
80
81
  const isLive = moment().unix() > startTimestamp && moment().unix() < endTimestamp;
81
82
  let distributionMeanAPR = 0;
82
- const priceRewardToken = 1;
83
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
83
84
  if (isLive) {
84
85
  /** Yearly rewards in $ */
85
86
  const fixRewardRate = multiplier * priceRewardToken;
@@ -1,5 +1,6 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
2
+ import { Pricer } from "@/utils/pricer";
1
3
  import { BN2Number, ETH_ADDRESS, HyperDriveSubCampaignType, HyperdriveTargetInterface, YEAR, } from "@sdk";
2
- import { Pricer } from "../../../utils/pricer";
3
4
  export async function HyperdriveDynamicData(chainId, campaigns) {
4
5
  const pricer = await Pricer.load();
5
6
  const calls = [];
@@ -26,11 +27,13 @@ export async function HyperdriveDynamicData(chainId, campaigns) {
26
27
  try {
27
28
  const poolInfo = HyperdriveTargetInterface.decodeFunctionResult("getPoolInfo", result[i])[0];
28
29
  const poolConfig = HyperdriveTargetInterface.decodeFunctionResult("getPoolConfig", result[i + 1])[0];
29
- const priceRewardToken = (await pricer.get({
30
- address: campaign.rewardToken,
31
- chainId,
32
- symbol: campaign.campaignParameters.symbolRewardToken,
33
- })) ?? 0;
30
+ // const priceRewardToken =
31
+ // (await pricer.get({
32
+ // address: campaign.rewardToken,
33
+ // chainId,
34
+ // symbol: campaign.campaignParameters.symbolRewardToken,
35
+ // })) ?? 0;
36
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
34
37
  const lpSupply = BN2Number(poolInfo.lpTotalSupply, 18);
35
38
  const longSupply = BN2Number(poolInfo.longsOutstanding, 18);
36
39
  const shortSupply = BN2Number(poolInfo.shortsOutstanding, 18);
@@ -1,3 +1,4 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
1
2
  import { BN2Number, MetamorphoInterface, MorphoSubCampaignType, YEAR, } from "@sdk";
2
3
  import { Pricer } from "../../../utils/pricer";
3
4
  const axios = require("axios");
@@ -30,11 +31,13 @@ export async function MORPHODynamicData(chainId, campaigns) {
30
31
  const dynamicData = [];
31
32
  let index = 0;
32
33
  for (const campaign of campaigns) {
33
- const priceRewardToken = (await pricer.get({
34
- address: campaign.rewardToken,
35
- chainId,
36
- symbol: campaign.campaignParameters.symbolRewardToken,
37
- })) ?? 0;
34
+ // const priceRewardToken =
35
+ // (await pricer.get({
36
+ // address: campaign.rewardToken,
37
+ // chainId,
38
+ // symbol: campaign.campaignParameters.symbolRewardToken,
39
+ // })) ?? 0;
40
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
38
41
  let tvl = 0;
39
42
  let totalSupplyTargetToken = 0;
40
43
  if (campaign.campaignSubType === MorphoSubCampaignType.META) {
@@ -1,4 +1,5 @@
1
1
  import { ComputedValueService } from "@/modules/v4/computedValue";
2
+ import { TokenService } from "@/modules/v4/token/token.service";
2
3
  import { engineDbClient } from "@db";
3
4
  import { BN2Number, ERC20Interface, NULL_ADDRESS, RadiantInterface, RadiantPoolInterface, YEAR, } from "@sdk";
4
5
  import { Contract } from "ethers";
@@ -70,11 +71,13 @@ export async function RadiantDynamicData(chainId, campaigns) {
70
71
  break;
71
72
  }
72
73
  }
73
- const priceRewardToken = (await pricer.get({
74
- address: campaign.rewardToken,
75
- chainId,
76
- symbol: campaign.campaignParameters.symbolRewardToken,
77
- })) ?? 0;
74
+ // const priceRewardToken =
75
+ // (await pricer.get({
76
+ // address: campaign.rewardToken,
77
+ // chainId,
78
+ // symbol: campaign.campaignParameters.symbolRewardToken,
79
+ // })) ?? 0;
80
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
78
81
  let priceDecimals = 8;
79
82
  let rizRegistry = "";
80
83
  try {
@@ -1,3 +1,4 @@
1
+ import { TokenService } from "@/modules/v4/token/token.service";
1
2
  import { BN2Number, ERC20Interface, Forwarder, YEAR, } from "@sdk";
2
3
  import { utils } from "ethers";
3
4
  import { batchMulticallCallWithRetry } from "../../../utils/generic";
@@ -58,11 +59,13 @@ export async function SILODynamicData(chainId, campaigns) {
58
59
  let j = 0;
59
60
  const dynamicData = [];
60
61
  for (const campaign of campaigns) {
61
- const priceRewardToken = (await pricer.get({
62
- address: campaign.rewardToken,
63
- chainId,
64
- symbol: campaign.campaignParameters.symbolRewardToken,
65
- })) ?? 0;
62
+ // const priceRewardToken =
63
+ // (await pricer.get({
64
+ // address: campaign.rewardToken,
65
+ // chainId,
66
+ // symbol: campaign.campaignParameters.symbolRewardToken,
67
+ // })) ?? 0;
68
+ const priceRewardToken = await TokenService.getRewardTokenPrice(campaign);
66
69
  const priceTargetToken = (await pricer.get({
67
70
  address: campaign.campaignParameters.targetToken,
68
71
  chainId,