@merkl/api 0.10.177 → 0.10.181

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 (128) hide show
  1. package/dist/database/api/.generated/edge.js +6 -6
  2. package/dist/database/api/.generated/index-browser.js +4 -4
  3. package/dist/database/api/.generated/index.d.ts +2 -2
  4. package/dist/database/api/.generated/index.js +6 -6
  5. package/dist/database/api/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
  6. package/dist/database/api/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  7. package/dist/database/api/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/runtime/edge-esm.js +15 -15
  10. package/dist/database/api/.generated/runtime/edge.js +16 -16
  11. package/dist/database/api/.generated/runtime/library.d.ts +23 -34
  12. package/dist/database/api/.generated/runtime/library.js +56 -56
  13. package/dist/database/api/.generated/runtime/react-native.js +23 -23
  14. package/dist/database/api/.generated/runtime/wasm.js +15 -15
  15. package/dist/database/api/.generated/wasm.js +4 -4
  16. package/dist/database/engine/.generated/edge.js +6 -6
  17. package/dist/database/engine/.generated/index-browser.js +4 -4
  18. package/dist/database/engine/.generated/index.d.ts +2 -2
  19. package/dist/database/engine/.generated/index.js +6 -6
  20. package/dist/database/engine/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
  21. package/dist/database/engine/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  22. package/dist/database/engine/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
  23. package/dist/database/engine/.generated/package.json +1 -1
  24. package/dist/database/engine/.generated/runtime/edge-esm.js +15 -15
  25. package/dist/database/engine/.generated/runtime/edge.js +16 -16
  26. package/dist/database/engine/.generated/runtime/library.d.ts +23 -34
  27. package/dist/database/engine/.generated/runtime/library.js +56 -56
  28. package/dist/database/engine/.generated/runtime/react-native.js +23 -23
  29. package/dist/database/engine/.generated/runtime/wasm.js +15 -15
  30. package/dist/database/engine/.generated/wasm.js +4 -4
  31. package/dist/src/eden/index.d.ts +348 -63
  32. package/dist/src/index.d.ts +140 -21
  33. package/dist/src/index.js +1 -1
  34. package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -2
  35. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +3 -3
  36. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
  37. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
  38. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.d.ts +1 -0
  39. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.js +12 -3
  40. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.d.ts +1 -1
  41. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.js +1 -3
  42. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +39 -0
  43. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +45 -0
  44. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
  45. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +2 -1
  46. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +25 -1
  47. package/dist/src/modules/v4/bucket/bucket.service.d.ts +5 -0
  48. package/dist/src/modules/v4/bucket/bucket.service.js +11 -0
  49. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +11 -13
  50. package/dist/src/modules/v4/campaign/campaign.controller.js +3 -3
  51. package/dist/src/modules/v4/campaign/campaign.repository.js +1 -1
  52. package/dist/src/modules/v4/chain/chain.controller.d.ts +24 -0
  53. package/dist/src/modules/v4/chain/chain.controller.js +8 -2
  54. package/dist/src/modules/v4/chain/chain.model.d.ts +4 -0
  55. package/dist/src/modules/v4/chain/chain.model.js +4 -0
  56. package/dist/src/modules/v4/chain/chain.repository.d.ts +6 -1
  57. package/dist/src/modules/v4/chain/chain.repository.js +3 -0
  58. package/dist/src/modules/v4/chain/chain.service.d.ts +6 -1
  59. package/dist/src/modules/v4/chain/chain.service.js +7 -0
  60. package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
  61. package/dist/src/modules/v4/interaction/interaction.controller.d.ts +1 -1
  62. package/dist/src/modules/v4/{position → liquidity}/implementations/AjnaPositionFetcher.d.ts +1 -1
  63. package/dist/src/modules/v4/{position → liquidity}/implementations/BadgerPositionFetcher.d.ts +1 -1
  64. package/dist/src/modules/v4/{position → liquidity}/implementations/ClammPositionFetcher.d.ts +1 -1
  65. package/dist/src/modules/v4/{position → liquidity}/implementations/DolomitePositionFetcher.d.ts +1 -1
  66. package/dist/src/modules/v4/{position → liquidity}/implementations/DolomitePositionFetcher.js +2 -2
  67. package/dist/src/modules/v4/{position → liquidity}/implementations/ERC20PositionFetcher.d.ts +1 -1
  68. package/dist/src/modules/v4/{position → liquidity}/implementations/EulerPositionFetcher.d.ts +1 -1
  69. package/dist/src/modules/v4/liquidity/index.d.ts +2 -0
  70. package/dist/src/modules/v4/liquidity/index.js +2 -0
  71. package/dist/src/modules/v4/{position/position.controller.d.ts → liquidity/liquidity.controller.d.ts} +3 -3
  72. package/dist/src/modules/v4/{position/position.controller.js → liquidity/liquidity.controller.js} +4 -4
  73. package/dist/src/modules/v4/{position/position.repository.d.ts → liquidity/liquidity.repository.d.ts} +1 -1
  74. package/dist/src/modules/v4/{position/position.repository.js → liquidity/liquidity.repository.js} +1 -1
  75. package/dist/src/modules/v4/liquidity/liquidity.service.d.ts +5 -0
  76. package/dist/src/modules/v4/{position/position.service.js → liquidity/liquidity.service.js} +2 -2
  77. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +34 -0
  78. package/dist/src/modules/v4/opportunity/opportunity.controller.js +11 -2
  79. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +8 -0
  80. package/dist/src/modules/v4/opportunity/opportunity.model.js +5 -0
  81. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +29 -1
  82. package/dist/src/modules/v4/opportunity/opportunity.repository.js +6 -0
  83. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -1
  84. package/dist/src/modules/v4/opportunity/opportunity.service.js +7 -6
  85. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +30 -1
  86. package/dist/src/modules/v4/protocol/protocol.controller.js +9 -2
  87. package/dist/src/modules/v4/protocol/protocol.model.d.ts +10 -1
  88. package/dist/src/modules/v4/protocol/protocol.model.js +9 -0
  89. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +9 -1
  90. package/dist/src/modules/v4/protocol/protocol.repository.js +4 -1
  91. package/dist/src/modules/v4/protocol/protocol.service.d.ts +11 -3
  92. package/dist/src/modules/v4/protocol/protocol.service.js +38 -32
  93. package/dist/src/modules/v4/reward/subservices/converter.js +2 -2
  94. package/dist/src/modules/v4/router.d.ts +140 -21
  95. package/dist/src/modules/v4/router.js +2 -2
  96. package/dist/src/modules/v4/token/token.controller.d.ts +38 -4
  97. package/dist/src/modules/v4/token/token.controller.js +11 -3
  98. package/dist/src/modules/v4/token/token.model.d.ts +9 -0
  99. package/dist/src/modules/v4/token/token.model.js +7 -0
  100. package/dist/src/modules/v4/token/token.repository.d.ts +14 -1
  101. package/dist/src/modules/v4/token/token.repository.js +3 -0
  102. package/dist/src/modules/v4/token/token.service.d.ts +18 -5
  103. package/dist/src/modules/v4/token/token.service.js +9 -2
  104. package/dist/src/routes/v3/blacklist.d.ts +140 -21
  105. package/dist/src/routes/v3/campaigns.d.ts +140 -21
  106. package/dist/src/routes/v3/campaignsInfo.d.ts +140 -21
  107. package/dist/src/routes/v3/multiChainPositions.d.ts +140 -21
  108. package/dist/src/routes/v3/opportunity.d.ts +140 -21
  109. package/dist/src/routes/v3/positions.d.ts +140 -21
  110. package/dist/src/routes/v3/rewards.d.ts +140 -21
  111. package/dist/src/routes/v3/updates.d.ts +140 -21
  112. package/dist/src/routes/v3/userRewards.d.ts +140 -21
  113. package/dist/src/utils/decodeCalls.js +5 -1
  114. package/dist/src/utils/encodeCalls.js +13 -1
  115. package/dist/src/utils/generateCardName.js +3 -1
  116. package/dist/src/utils/logger.d.ts +12 -6
  117. package/dist/tsconfig.package.tsbuildinfo +1 -1
  118. package/package.json +24 -24
  119. package/dist/src/modules/v4/position/index.d.ts +0 -2
  120. package/dist/src/modules/v4/position/index.js +0 -2
  121. package/dist/src/modules/v4/position/position.service.d.ts +0 -5
  122. /package/dist/src/modules/v4/{position → liquidity}/implementations/AjnaPositionFetcher.js +0 -0
  123. /package/dist/src/modules/v4/{position → liquidity}/implementations/BadgerPositionFetcher.js +0 -0
  124. /package/dist/src/modules/v4/{position → liquidity}/implementations/ClammPositionFetcher.js +0 -0
  125. /package/dist/src/modules/v4/{position → liquidity}/implementations/ERC20PositionFetcher.js +0 -0
  126. /package/dist/src/modules/v4/{position → liquidity}/implementations/EulerPositionFetcher.js +0 -0
  127. /package/dist/src/modules/v4/{position/position.model.d.ts → liquidity/liquidity.model.d.ts} +0 -0
  128. /package/dist/src/modules/v4/{position/position.model.js → liquidity/liquidity.model.js} +0 -0
@@ -495,6 +495,40 @@ declare const app: Elysia<"", false, {
495
495
  };
496
496
  };
497
497
  };
498
+ } & {
499
+ opportunities: {
500
+ ":id": {
501
+ patch: {
502
+ body: {
503
+ name?: string | undefined;
504
+ tags?: string[] | undefined;
505
+ };
506
+ params: {
507
+ id: string;
508
+ };
509
+ query: unknown;
510
+ headers: {
511
+ authorization: string;
512
+ };
513
+ response: {
514
+ 200: {
515
+ name: string;
516
+ type: import("../database/api/.generated").$Enums.CampaignType;
517
+ id: string;
518
+ status: import("../database/api/.generated").$Enums.Status;
519
+ tags: string[];
520
+ identifier: string;
521
+ chainId: number;
522
+ action: import("../database/api/.generated").$Enums.OpportunityAction;
523
+ mainProtocolId: string | null;
524
+ tvl: number;
525
+ apr: number;
526
+ dailyRewards: number;
527
+ };
528
+ };
529
+ };
530
+ };
531
+ };
498
532
  };
499
533
  } & {
500
534
  v4: {
@@ -678,19 +712,17 @@ declare const app: Elysia<"", false, {
678
712
  } & {
679
713
  "campaigns-to-process": {
680
714
  engine: {
681
- "": {
682
- post: {
683
- body: unknown;
684
- params: {};
685
- query: {
686
- chainId: number;
687
- };
688
- headers: {
689
- authorization: string;
690
- };
691
- response: {
692
- 200: string;
693
- };
715
+ post: {
716
+ body: unknown;
717
+ params: {};
718
+ query: {
719
+ chainId: number;
720
+ };
721
+ headers: {
722
+ authorization: string;
723
+ };
724
+ response: {
725
+ 200: string;
694
726
  };
695
727
  };
696
728
  };
@@ -743,7 +775,7 @@ declare const app: Elysia<"", false, {
743
775
  id: string;
744
776
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
745
777
  icon: string;
746
- } & {})[] | null;
778
+ } & {})[];
747
779
  };
748
780
  };
749
781
  };
@@ -762,6 +794,35 @@ declare const app: Elysia<"", false, {
762
794
  };
763
795
  };
764
796
  };
797
+ } & {
798
+ protocols: {
799
+ ":id": {
800
+ patch: {
801
+ body: {
802
+ url?: string | undefined;
803
+ description?: string | undefined;
804
+ icon?: string | undefined;
805
+ };
806
+ params: {
807
+ id: string;
808
+ };
809
+ query: unknown;
810
+ headers: {
811
+ authorization: string;
812
+ };
813
+ response: {
814
+ 200: {
815
+ name: string;
816
+ url: string;
817
+ description: string;
818
+ id: string;
819
+ tags: import("../database/api/.generated").$Enums.ProtocolTag[];
820
+ icon: string;
821
+ };
822
+ };
823
+ };
824
+ };
825
+ };
765
826
  };
766
827
  } & {
767
828
  v4: {
@@ -840,7 +901,7 @@ declare const app: Elysia<"", false, {
840
901
  };
841
902
  headers: unknown;
842
903
  response: {
843
- 200: {
904
+ 200: ({
844
905
  symbol: string;
845
906
  name: string | null;
846
907
  id: string;
@@ -848,11 +909,11 @@ declare const app: Elysia<"", false, {
848
909
  address: string;
849
910
  icon: string;
850
911
  decimals: number;
851
- displaySymbol: string;
852
912
  verified: boolean;
853
913
  isTest: boolean;
854
- price: number | null;
855
- }[];
914
+ } & {
915
+ price?: number | null | undefined;
916
+ })[];
856
917
  };
857
918
  };
858
919
  };
@@ -878,6 +939,40 @@ declare const app: Elysia<"", false, {
878
939
  };
879
940
  };
880
941
  };
942
+ } & {
943
+ tokens: {
944
+ ":id": {
945
+ patch: {
946
+ body: {
947
+ icon?: string | undefined;
948
+ displaySymbol?: string | undefined;
949
+ isTest?: boolean | undefined;
950
+ };
951
+ params: {
952
+ id: string;
953
+ };
954
+ query: unknown;
955
+ headers: {
956
+ authorization: string;
957
+ };
958
+ response: {
959
+ 200: {
960
+ symbol: string;
961
+ name: string | null;
962
+ id: string;
963
+ chainId: number;
964
+ address: string;
965
+ icon: string;
966
+ decimals: number;
967
+ displaySymbol: string;
968
+ verified: boolean;
969
+ isTest: boolean;
970
+ price: number | null;
971
+ };
972
+ };
973
+ };
974
+ };
975
+ };
881
976
  };
882
977
  } & {
883
978
  v4: {
@@ -1157,6 +1252,30 @@ declare const app: Elysia<"", false, {
1157
1252
  };
1158
1253
  };
1159
1254
  };
1255
+ } & {
1256
+ chains: {
1257
+ ":chainId": {
1258
+ patch: {
1259
+ body: {
1260
+ icon?: string | undefined;
1261
+ };
1262
+ params: {
1263
+ chainId: number;
1264
+ };
1265
+ query: unknown;
1266
+ headers: {
1267
+ authorization: string;
1268
+ };
1269
+ response: {
1270
+ 200: {
1271
+ name: string;
1272
+ id: number;
1273
+ icon: string;
1274
+ };
1275
+ };
1276
+ };
1277
+ };
1278
+ };
1160
1279
  };
1161
1280
  } & {
1162
1281
  v4: {
@@ -1857,7 +1976,7 @@ declare const app: Elysia<"", false, {
1857
1976
  id: string;
1858
1977
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
1859
1978
  icon: string;
1860
- } & {})[] | null;
1979
+ } & {})[];
1861
1980
  };
1862
1981
  };
1863
1982
  };
@@ -2248,7 +2367,7 @@ declare const app: Elysia<"", false, {
2248
2367
  };
2249
2368
  } & {
2250
2369
  v4: {
2251
- positions: {
2370
+ liquidity: {
2252
2371
  index: {
2253
2372
  get: {
2254
2373
  body: unknown;
@@ -2259,7 +2378,7 @@ declare const app: Elysia<"", false, {
2259
2378
  };
2260
2379
  headers: unknown;
2261
2380
  response: {
2262
- 200: any[];
2381
+ 200: import("./modules/v4/liquidity").PositionT[];
2263
2382
  };
2264
2383
  };
2265
2384
  };
package/dist/src/index.js CHANGED
@@ -24,7 +24,7 @@ const app = new Elysia({
24
24
  email: "contact@merkl.money",
25
25
  name: "Angle Labs",
26
26
  },
27
- description: "API to access data related to merkl campaigns, built and maintained by Angle Labs. This API is provided as is, without any warranty of any kind.",
27
+ description: "API to access data related to Merkl campaigns, built and maintained by Angle Labs. This API is provided as is, without any warranty of any kind.",
28
28
  license: {
29
29
  name: "UNLICENSED",
30
30
  },
@@ -341,7 +341,7 @@ export async function CLAMMDynamicData(chainId, campaigns) {
341
341
  const balance0 = BN2Number(amount0, decimalsToken0);
342
342
  const balance1 = BN2Number(amount1, decimalsToken1);
343
343
  const totalLiquidity = BN2Number(position.liquidity);
344
- const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? BN2Number(position.liquidity) ?? 0 : 0;
344
+ const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? (BN2Number(position.liquidity) ?? 0) : 0;
345
345
  almTotalLiquidity += totalLiquidity;
346
346
  almInRangeLiquidity += inRangeLiquidity;
347
347
  almBalance0 += balance0;
@@ -504,7 +504,7 @@ export async function CLAMMDynamicData(chainId, campaigns) {
504
504
  const balance0 = BN2Number(amount0, decimalsToken0);
505
505
  const balance1 = BN2Number(amount1, decimalsToken1);
506
506
  const totalLiquidity = BN2Number(position.liquidity);
507
- const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? BN2Number(position.liquidity) ?? 0 : 0;
507
+ const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? (BN2Number(position.liquidity) ?? 0) : 0;
508
508
  almTotalLiquidity += totalLiquidity;
509
509
  almInRangeLiquidity += inRangeLiquidity;
510
510
  almBalance0 += balance0;
@@ -64,7 +64,7 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
64
64
  calls: [],
65
65
  typeInfo: {},
66
66
  };
67
- typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i);
67
+ typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i, campaign);
68
68
  i += 5;
69
69
  tokenTypesByCampaign[campaign.campaignId] = typeStruct;
70
70
  callsRounds2.push(...typeStruct.calls);
@@ -124,8 +124,8 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
124
124
  const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
125
125
  tokenTypesByCampaign[campaign.campaignId] = await getTokenPricesInfo(i, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, result, campaign, pricer);
126
126
  i += callsForCampaign;
127
- const totalSupplyTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.totalSupply;
128
127
  const whitelistedSupplyTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.whitelistedSupplyTargetToken;
128
+ const totalSupplyTargetToken = whitelistedSupplyTargetToken;
129
129
  const priceTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.priceTargetToken;
130
130
  let lastEligibilityRatio = 1;
131
131
  if (!!campaign.campaignParameters.hooks?.length) {
@@ -141,7 +141,7 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
141
141
  campaign.campaignParameters.duration /
142
142
  (whitelistedSupplyTargetToken * priceTargetToken),
143
143
  totalSupplyTargetToken,
144
- tvl: totalSupplyTargetToken * priceTargetToken,
144
+ tvl: whitelistedSupplyTargetToken * priceTargetToken,
145
145
  type: tokenTypesByCampaign[campaign.campaignId].type,
146
146
  typeInfo: tokenTypesByCampaign[campaign.campaignId].typeInfo,
147
147
  priceRewardToken: priceRewardToken,
@@ -57,7 +57,8 @@ export declare enum tokenType {
57
57
  pendleYT = "pendleYT",
58
58
  pancakeswap = "pancakeswap",
59
59
  tempestStaking = "tempestStaking",
60
- holdstation = "holdstation"
60
+ holdstation = "holdstation",
61
+ staking = "staking"
61
62
  }
62
63
  export declare const tokenTypeToProtocol: {
63
64
  [key in tokenType]: {
@@ -59,6 +59,7 @@ export var tokenType;
59
59
  tokenType["pancakeswap"] = "pancakeswap";
60
60
  tokenType["tempestStaking"] = "tempestStaking";
61
61
  tokenType["holdstation"] = "holdstation";
62
+ tokenType["staking"] = "staking";
62
63
  })(tokenType || (tokenType = {}));
63
64
  export const tokenTypeToProtocol = {
64
65
  [tokenType.aave_borrowing]: { protocol: "Aave" },
@@ -139,4 +140,7 @@ export const tokenTypeToProtocol = {
139
140
  [tokenType.holdstation]: {
140
141
  protocol: "HoldStation",
141
142
  },
143
+ [tokenType.staking]: {
144
+ protocol: "Staking",
145
+ },
142
146
  };
@@ -21,6 +21,7 @@ type callKeysAura = mandatoryCallKeys & {
21
21
  pid: string;
22
22
  gaugeBalance: string;
23
23
  auraBalance: string;
24
+ vaultBalance: string;
24
25
  };
25
26
  type dataRawAura = callKeysAura & {
26
27
  poolTokensRaw: Array<string[] | BigNumber[]>;
@@ -2,6 +2,7 @@ import { decodeCall } from "../../../../../utils/decodeCalls";
2
2
  import { createCall } from "../../../../../utils/encodeCalls";
3
3
  import { generateCardName } from "../../../../../utils/generateCardName";
4
4
  import { BN2Number } from "@sdk";
5
+ import { utils } from "ethers";
5
6
  import { GenericProcessor, roundType } from "./GenericProcessor";
6
7
  export class AuraProcessor extends GenericProcessor {
7
8
  rounds = {
@@ -21,6 +22,7 @@ export class AuraProcessor extends GenericProcessor {
21
22
  { key: "poolTokensRaw", call: "getPoolTokens", target: "vault", metaData: "poolId" },
22
23
  { key: "gaugeBalance", call: "balanceOf", target: "balancerPool", metaData: "gaugeContract" },
23
24
  { key: "auraBalance", call: "balanceOf", target: "gaugeContract", metaData: "auraStaker" },
25
+ { key: "vaultBalance", call: "balanceOf", target: "balancerPool", metaData: "vault" },
24
26
  { key: "totalSupplyGauge", call: "totalSupply", target: "gaugeContract" },
25
27
  ],
26
28
  round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
@@ -43,8 +45,15 @@ export class AuraProcessor extends GenericProcessor {
43
45
  }
44
46
  }
45
47
  async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
46
- const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
47
- const totalSupplyBalancerPool = BN2Number(typeInfo.totalSupplyBalancerPool, 18);
48
+ let { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
49
+ const vaultBalance = BN2Number(typeInfo.vaultBalance, 18);
50
+ const vaultIndex = campaign.campaignParameters.blacklist
51
+ ?.map(b => utils.getAddress(b))
52
+ ?.indexOf(utils.getAddress(typeInfo.vault));
53
+ if (vaultIndex !== -1) {
54
+ blacklistedSupply -= BN2Number(decodeCall(calls, index + vaultIndex, "balanceOf"), campaign.campaignParameters.decimalsTargetToken); // The vault balance was already removed from the total supply
55
+ }
56
+ const totalSupplyBalancerPool = BN2Number(typeInfo.totalSupplyBalancerPool, 18) - vaultBalance;
48
57
  const gaugeBalance = BN2Number(typeInfo.gaugeBalance, 18);
49
58
  const auraBalance = BN2Number(typeInfo.auraBalance, 18);
50
59
  const totalSupplyGauge = BN2Number(typeInfo.totalSupplyGauge, 18);
@@ -66,7 +75,7 @@ export class AuraProcessor extends GenericProcessor {
66
75
  }
67
76
  const percentageOfSupplyInAura = (auraBalance / totalSupplyGauge) * (gaugeBalance / totalSupplyBalancerPool);
68
77
  const tvl = poolTvl * percentageOfSupplyInAura;
69
- const priceTargetToken = tvl / totalSupply;
78
+ const priceTargetToken = tvl / totalSupplyBalancerPool;
70
79
  return {
71
80
  ...typeInfo,
72
81
  totalSupplyBalancerPool,
@@ -1,5 +1,5 @@
1
1
  import type { Pricer } from "../../../../../utils/pricer";
2
- import { type Campaign, type CampaignParameters } from "@sdk";
2
+ import type { Campaign, CampaignParameters } from "@sdk";
3
3
  import type { tokenType } from "../helpers/tokenType";
4
4
  import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
5
5
  type callType = {
@@ -1,5 +1,4 @@
1
1
  import { generateCardName } from "../../../../../utils/generateCardName";
2
- import { ChainId } from "@sdk";
3
2
  import { GenericProcessor } from "./GenericProcessor";
4
3
  export class PendleProcessor extends GenericProcessor {
5
4
  rounds = {
@@ -14,8 +13,7 @@ export class PendleProcessor extends GenericProcessor {
14
13
  async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
15
14
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
16
15
  const priceTargetToken = (await pricer.get({
17
- address: typeInfo.tokenAddress,
18
- chainId: ChainId.MAINNET,
16
+ symbol: typeInfo.tokenAddress,
19
17
  })) ?? 0;
20
18
  const tvl = priceTargetToken * totalSupply;
21
19
  return {
@@ -0,0 +1,39 @@
1
+ import type { Pricer } from "../../../../../utils/pricer";
2
+ import type { Campaign, CampaignParameters } from "@sdk";
3
+ import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
4
+ import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
5
+ type callType = {
6
+ key: keyof dataRawStaking;
7
+ call: string;
8
+ target: keyof callKeysStaking;
9
+ metaData?: keyof callKeysStaking;
10
+ optional?: boolean;
11
+ };
12
+ type callKeysStaking = mandatoryCallKeys & {
13
+ stakingContract: string;
14
+ lockNFT: string;
15
+ stakingSymbol: string;
16
+ };
17
+ type dataRawStaking = callKeysStaking & {
18
+ eip712DomainName: string;
19
+ };
20
+ type dataTypeStaking = dataType & {};
21
+ export declare class StakingProcessor extends GenericProcessor<callKeysStaking, dataRawStaking, dataTypeStaking> {
22
+ rounds: {
23
+ round1: callType[];
24
+ round2: callType[];
25
+ round3: callType[];
26
+ round4: callType[];
27
+ };
28
+ processingRound1(typeInfo: dataRawStaking): void;
29
+ processingRound2(typeInfo: dataRawStaking): void;
30
+ processingRound3(typeInfo: dataRawStaking): void;
31
+ processingRound4(typeInfo: dataRawStaking): void;
32
+ processingRound5(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeStaking>;
33
+ computeRound1(type: tokenType, typeInfo: dataRawStaking): tokenTypeStruct;
34
+ computeRound2(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[]): tokenTypeStruct;
35
+ computeRound3(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[]): tokenTypeStruct;
36
+ computeRound4(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[], campaign: CampaignParameters<Campaign.ERC20>): tokenTypeStruct;
37
+ computeRound5(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<tokenTypeStruct>;
38
+ }
39
+ export {};
@@ -0,0 +1,45 @@
1
+ import { GenericProcessor } from "./GenericProcessor";
2
+ export class StakingProcessor extends GenericProcessor {
3
+ rounds = {
4
+ round1: [
5
+ { key: "lockNFT", call: "lockNFT", target: "stakingContract", optional: true },
6
+ { key: "eip712DomainName", call: "eip712DomainName", target: "stakingContract", optional: true },
7
+ ],
8
+ round2: [{ key: "stakingSymbol", call: "symbol", target: "lockNFT", optional: true }],
9
+ round3: [],
10
+ round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
11
+ };
12
+ // override computeRound1(): void {}
13
+ processingRound1(typeInfo) {
14
+ if (typeInfo.stakingContract === "0x18eeD20f71BEf84B605253C89A7576E3634134C0") {
15
+ typeInfo.stakingSymbol = "CyberStaking";
16
+ }
17
+ }
18
+ processingRound2(typeInfo) {
19
+ typeInfo.stakingSymbol = typeInfo.eip712DomainName;
20
+ }
21
+ processingRound3(typeInfo) {
22
+ super.processingRound3(typeInfo);
23
+ }
24
+ processingRound4(typeInfo) {
25
+ super.processingRound4(typeInfo);
26
+ }
27
+ async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
28
+ return super.processingRound5(index, type, typeInfo, calls, campaign, pricer);
29
+ }
30
+ computeRound1(type, typeInfo) {
31
+ return super.computeRound1(type, typeInfo);
32
+ }
33
+ computeRound2(index, type, typeInfo, calls) {
34
+ return super.computeRound2(index, type, typeInfo, calls);
35
+ }
36
+ computeRound3(index, type, typeInfo, calls) {
37
+ return super.computeRound3(index, type, typeInfo, calls);
38
+ }
39
+ computeRound4(index, type, typeInfo, calls, campaign) {
40
+ return super.computeRound4(index, type, typeInfo, calls, campaign);
41
+ }
42
+ async computeRound5(index, type, typeInfo, calls, campaign, pricer) {
43
+ return super.computeRound5(index, type, typeInfo, calls, campaign, pricer);
44
+ }
45
+ }
@@ -21,6 +21,7 @@ import { PendleYTProcessor } from "./PendleYTProcessor";
21
21
  import { RadiantProcessor } from "./RadiantProcessor";
22
22
  import { RfxProcessor } from "./RfxProcessor";
23
23
  import { SpliceProcessor } from "./SpliceProcessor";
24
+ import { StakingProcessor } from "./StakingProcessor";
24
25
  import { SturdySiloProcessor } from "./SturdySiloProcessor";
25
26
  import { TempestVaultProcessor } from "./TempestVaultProcessor";
26
27
  import { TorosProcessor } from "./TorosProcessor";
@@ -88,4 +89,5 @@ export const processorMapping = {
88
89
  [tokenType.pancakeswap]: UniswapProcessor,
89
90
  [tokenType.tempestStaking]: TempestVaultProcessor,
90
91
  [tokenType.holdstation]: HoldStationProcessor,
92
+ [tokenType.staking]: StakingProcessor,
91
93
  };
@@ -1,3 +1,4 @@
1
+ import type { Campaign, CampaignParameters } from "@sdk";
1
2
  import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
2
3
  import { type tokenTypeStruct } from "./helpers/tokenType";
3
- export declare function getTokenTypeRound1(calls: Multicall3.ResultStructOutput[], targetToken: string, index: number): tokenTypeStruct;
4
+ export declare function getTokenTypeRound1(calls: Multicall3.ResultStructOutput[], targetToken: string, index: number, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
@@ -179,7 +179,27 @@ function parseForBalancer(calls, index, targetToken, name) {
179
179
  // Not a balancer pool
180
180
  }
181
181
  }
182
- export function getTokenTypeRound1(calls, targetToken, index) {
182
+ function parseForStaking(campaign, calls, index, targetToken) {
183
+ try {
184
+ const whitelist = campaign.campaignParameters.whitelist;
185
+ console.log("whitelist", whitelist, whitelist.length);
186
+ if (whitelist.length === 1) {
187
+ const forwarders = campaign.campaignParameters.forwarders;
188
+ console.log("forwarders", forwarders);
189
+ if (forwarders.length === 1) {
190
+ if (forwarders[0].sender === whitelist[0]) {
191
+ const name = decodeCall(calls, index + 2, "name");
192
+ return generateResult(tokenType.staking, name, targetToken, { stakingContract: whitelist[0] });
193
+ }
194
+ }
195
+ }
196
+ }
197
+ catch (e) {
198
+ // No factory on this token
199
+ // console.log(e);
200
+ }
201
+ }
202
+ export function getTokenTypeRound1(calls, targetToken, index, campaign) {
183
203
  const returnValueOfCalls = calls.map(call => call.returnData);
184
204
  let result = parseForFactory(returnValueOfCalls, index, targetToken);
185
205
  if (result)
@@ -188,6 +208,10 @@ export function getTokenTypeRound1(calls, targetToken, index) {
188
208
  if (result)
189
209
  return result;
190
210
  result = parseForMetamorpho(returnValueOfCalls, index, targetToken);
211
+ if (result)
212
+ return result;
213
+ console.log("parsing for staking");
214
+ result = parseForStaking(campaign, returnValueOfCalls, index, targetToken);
191
215
  if (result)
192
216
  return result;
193
217
  let name;
@@ -0,0 +1,5 @@
1
+ import type { SaveData } from "node_modules/@google-cloud/storage/build/esm/src/file";
2
+ export declare abstract class BucketService {
3
+ private static storage;
4
+ static upload(bucketName: string, filename: string, data: SaveData, isPublic: boolean): Promise<string>;
5
+ }
@@ -0,0 +1,11 @@
1
+ import { Storage } from "@google-cloud/storage";
2
+ export class BucketService {
3
+ static storage = new Storage({ projectId: "angle-production-1" });
4
+ static async upload(bucketName, filename, data, isPublic) {
5
+ const file = await BucketService.storage.bucket(bucketName).file(filename);
6
+ await file.save(data);
7
+ if (isPublic)
8
+ await file.makePublic();
9
+ return `https://storage.googleapis.com/${bucketName}/${filename}`;
10
+ }
11
+ }
@@ -192,19 +192,17 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
192
192
  } & {
193
193
  "campaigns-to-process": {
194
194
  engine: {
195
- "": {
196
- post: {
197
- body: unknown;
198
- params: {};
199
- query: {
200
- chainId: number;
201
- };
202
- headers: {
203
- authorization: string;
204
- };
205
- response: {
206
- 200: string;
207
- };
195
+ post: {
196
+ body: unknown;
197
+ params: {};
198
+ query: {
199
+ chainId: number;
200
+ };
201
+ headers: {
202
+ authorization: string;
203
+ };
204
+ response: {
205
+ 200: string;
208
206
  };
209
207
  };
210
208
  };
@@ -26,15 +26,15 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
26
26
  throwOnUnsupportedChainId(query.chainId);
27
27
  },
28
28
  })
29
- // ─── Get Count of CampaignsToProcess ─────────────────────────────────
29
+ // ─── Get Count Of CampaignsToProcess ─────────
30
30
  .get("/count", async ({ query }) => (await CampaignService.findCampaignsToProcess(query.chainId)).length, {
31
31
  query: ChainUniqueDto,
32
32
  beforeHandle: ({ query }) => {
33
33
  throwOnUnsupportedChainId(query.chainId);
34
34
  },
35
35
  })
36
- // ─── Returns a CampaignId to Process and flags it as PROCESSING ──────-
37
- .post("/engine/", async ({ query }) => await CampaignService.pickCampaignToProcess(query.chainId), {
36
+ // ─── Marks A Campaignid As Processing ────────
37
+ .post("/engine", async ({ query }) => await CampaignService.pickCampaignToProcess(query.chainId), {
38
38
  query: ChainUniqueDto,
39
39
  beforeHandle: async ({ query, headers }) => {
40
40
  await EngineGuard({ headers });
@@ -80,7 +80,7 @@ export class CampaignRepository {
80
80
  where: { id: opportunityId },
81
81
  create: {
82
82
  id: opportunityId,
83
- Chain: { connect: { id: campaign.chainId } },
83
+ Chain: { connect: { id: campaign.computeChainId } },
84
84
  type: campaignType,
85
85
  identifier: campaign.opportunityIdentifier, // mainParameter
86
86
  name: metadata.name,