@merkl/api 0.20.83 → 0.20.85

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.
@@ -3,6 +3,7 @@ const ownerAddresses = {
3
3
  "0xbF7E49483881C76487b0989CD7d9A8239B20CA41": tokenType.curve_2,
4
4
  "0x42a856dbEBB97AbC1269EAB32f3bb40C15102819": tokenType.satlayer,
5
5
  "0x4C911bf7A008C497719CBEb1a376f1cEc9e2c1d6": tokenType.hanji_liquidity_vault_token,
6
+ "0x6e9d701fB6478Ed5972a37886C2BA6C82a4cBb4C": tokenType.gamma, // Gamma Bob owner
6
7
  };
7
8
  export function getTypeFromOwnerAddress(address) {
8
9
  if (ownerAddresses[address]) {
@@ -99,7 +99,8 @@ export declare enum tokenType {
99
99
  beraborrow_gauge = "beraborrow_gauge",
100
100
  curve_gauge = "curve_gauge",
101
101
  sake_borrowing = "sake_borrowing",
102
- sake_lending = "sake_lending"
102
+ sake_lending = "sake_lending",
103
+ gamma = "gamma"
103
104
  }
104
105
  export declare const tokenTypeToProtocolAndAction: Record<tokenType, {
105
106
  protocol: ProtocolId | undefined;
@@ -100,6 +100,7 @@ export var tokenType;
100
100
  tokenType["curve_gauge"] = "curve_gauge";
101
101
  tokenType["sake_borrowing"] = "sake_borrowing";
102
102
  tokenType["sake_lending"] = "sake_lending";
103
+ tokenType["gamma"] = "gamma";
103
104
  })(tokenType || (tokenType = {}));
104
105
  export const tokenTypeToProtocolAndAction = {
105
106
  [tokenType.aave_borrowing]: { protocol: "aave", action: OpportunityAction.BORROW },
@@ -224,4 +225,8 @@ export const tokenTypeToProtocolAndAction = {
224
225
  protocol: "sake",
225
226
  action: OpportunityAction.LEND,
226
227
  },
228
+ [tokenType.gamma]: {
229
+ protocol: "gamma",
230
+ action: OpportunityAction.POOL,
231
+ },
227
232
  };
@@ -0,0 +1,30 @@
1
+ import type { Pricer } from "@/utils/pricer";
2
+ import { type Campaign, type CampaignParameters } from "@sdk";
3
+ import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
4
+ import type { tokenType } from "../helpers/tokenType";
5
+ type callType = {
6
+ key: keyof dataRawGamma;
7
+ call: string;
8
+ target: keyof callKeysGamma;
9
+ metaData?: any;
10
+ };
11
+ type callKeysGamma = mandatoryCallKeys & {
12
+ tokenPrice: string;
13
+ name: string;
14
+ };
15
+ type dataRawGamma = callKeysGamma & {
16
+ underlyingProtocol: string;
17
+ };
18
+ type dataTypeGamma = dataType & {
19
+ tokenPrice: string;
20
+ };
21
+ export declare class GammaALMProcessor extends GenericProcessor<callKeysGamma, dataRawGamma, dataTypeGamma> {
22
+ rounds: {
23
+ round1: callType[];
24
+ round2: callType[];
25
+ round3: callType[];
26
+ round4: callType[];
27
+ };
28
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawGamma, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, _pricer: Pricer): Promise<dataTypeGamma>;
29
+ }
30
+ export {};
@@ -0,0 +1,52 @@
1
+ import { generateCardName } from "@/utils/generateCardName";
2
+ import { withTimeout } from "@sdk";
3
+ import axios from "axios";
4
+ import { GenericProcessor } from "../GenericProcessor";
5
+ async function getVaultInfo(targetVaultAddress, chainId) {
6
+ let data = [];
7
+ try {
8
+ data = await withTimeout((async () => {
9
+ data = (await axios.get(`https://api.gamma.xyz/frontend/hypervisors/allDataSummary?chain=${chainId}`))
10
+ .data;
11
+ return data;
12
+ })(), 5000);
13
+ }
14
+ catch (e) {
15
+ return null;
16
+ }
17
+ for (const item of data) {
18
+ if (item.address.toLowerCase() === targetVaultAddress.toLowerCase()) {
19
+ return {
20
+ tvl: Number(item.tvlUSD),
21
+ protocol: item.protocol,
22
+ };
23
+ }
24
+ }
25
+ return null;
26
+ }
27
+ export class GammaALMProcessor extends GenericProcessor {
28
+ rounds = {
29
+ round1: [],
30
+ round2: [],
31
+ round3: [],
32
+ round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
33
+ };
34
+ async processingRound5(_index, type, typeInfo, _calls, campaign, _pricer) {
35
+ const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
36
+ const vaultInfo = await getVaultInfo(campaign.campaignParameters.targetToken, campaign.computeChainId);
37
+ const tvl = !!vaultInfo ? vaultInfo.tvl : 0;
38
+ const protocol = !!vaultInfo ? vaultInfo.protocol : "";
39
+ const priceTargetToken = tvl / totalSupply;
40
+ typeInfo.underlyingProtocol = protocol;
41
+ return {
42
+ ...typeInfo,
43
+ totalSupply,
44
+ tvl,
45
+ whitelistedSupplyTargetToken,
46
+ blacklistedSupply,
47
+ priceTargetToken,
48
+ cardName: generateCardName(type, typeInfo, campaign),
49
+ tokensDisplay: [{ symbol: campaign.campaignParameters.symbolTargetToken, address: typeInfo.tokenAddress }],
50
+ };
51
+ }
52
+ }
@@ -18,6 +18,7 @@ import { EulerBorrowProcessor } from "./EulerBorrowProcessor";
18
18
  import { EulerLendProcessor } from "./EulerLendProcessor";
19
19
  import { FluidProcessor } from "./FluidProcessor";
20
20
  import { FraxProcessor } from "./FraxProcessor";
21
+ import { GammaALMProcessor } from "./GammaALMProcessor";
21
22
  import { GammaProcessor } from "./GammaProcessor";
22
23
  import { GearboxProcessor } from "./GearboxProcessor";
23
24
  import { HanjiVaultProcessor } from "./HanjiVaultProcessor";
@@ -144,4 +145,5 @@ export const processorMapping = {
144
145
  [tokenType.curve_gauge]: StakedCurveProcessor,
145
146
  [tokenType.sake_borrowing]: AaveProcessor,
146
147
  [tokenType.sake_lending]: AaveProcessor,
148
+ [tokenType.gamma]: GammaALMProcessor,
147
149
  };
@@ -689,6 +689,7 @@ export declare abstract class OpportunityRepository {
689
689
  * 1. Opportunities with status LIVE
690
690
  * 2. Opportunities with non-test campaigns that have endTimestamp > now
691
691
  *
692
+ * @dev Excludes test campaigns
692
693
  */
693
694
  static findLiveWithCampaigns(chainId: MerklChainId, take?: number): Promise<({
694
695
  Chain: {
@@ -339,6 +339,7 @@ export class OpportunityRepository {
339
339
  * 1. Opportunities with status LIVE
340
340
  * 2. Opportunities with non-test campaigns that have endTimestamp > now
341
341
  *
342
+ * @dev Excludes test campaigns
342
343
  */
343
344
  static async findLiveWithCampaigns(chainId, take) {
344
345
  const now = moment().unix();
@@ -355,6 +356,9 @@ export class OpportunityRepository {
355
356
  },
356
357
  take: take ? take : undefined,
357
358
  orderBy: { endTimestamp: "desc" },
359
+ where: {
360
+ RewardToken: { isTest: false },
361
+ },
358
362
  },
359
363
  MainProtocol: true,
360
364
  Chain: { include: { Explorer: true } },
@@ -184,6 +184,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
184
184
  return "Provide Liquidity on Hanji Vault";
185
185
  case tokenType.bunniV2:
186
186
  return `Provide Liquidity on Bunni V2 ${typeInfo.symbolToken0}-${typeInfo.symbolToken1}`;
187
+ case tokenType.gamma:
188
+ return `Provide liquidity to Gamma ${capitalize(typeInfo.protocol)} ${campaign.campaignParameters.symbolTargetToken} vault`;
187
189
  default:
188
190
  // OVERRIDE
189
191
  switch (typeInfo.tokenAddress) {