@merkl/api 0.10.166 → 0.10.167

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.
@@ -52,7 +52,8 @@ export declare enum tokenType {
52
52
  pendle = "pendle",
53
53
  maverickBoostedPosition = "maverickBoostedPosition",
54
54
  zkSwapThreePool = "zkSwapThreePool",
55
- maha = "maha"
55
+ maha = "maha",
56
+ tempest = "tempest"
56
57
  }
57
58
  export declare const tokenTypeToProtocol: {
58
59
  [key in tokenType]: {
@@ -54,6 +54,7 @@ export var tokenType;
54
54
  tokenType["maverickBoostedPosition"] = "maverickBoostedPosition";
55
55
  tokenType["zkSwapThreePool"] = "zkSwapThreePool";
56
56
  tokenType["maha"] = "maha";
57
+ tokenType["tempest"] = "tempest";
57
58
  })(tokenType || (tokenType = {}));
58
59
  export const tokenTypeToProtocol = {
59
60
  [tokenType.aave_borrowing]: { protocol: "Aave" },
@@ -119,4 +120,7 @@ export const tokenTypeToProtocol = {
119
120
  [tokenType.maha]: {
120
121
  protocol: "Maha",
121
122
  },
123
+ [tokenType.tempest]: {
124
+ protocol: "Tempest",
125
+ },
122
126
  };
@@ -0,0 +1,50 @@
1
+ import type { Pricer } from "../../../../../utils/pricer";
2
+ import { type Campaign, type CampaignParameters } from "@sdk";
3
+ import type { tokenType } from "../helpers/tokenType";
4
+ import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
5
+ type callType = {
6
+ key: keyof dataRawTempest;
7
+ call: string;
8
+ target: keyof callKeysTempest;
9
+ metaData?: keyof callKeysTempest;
10
+ };
11
+ type callKeysTempest = mandatoryCallKeys & {
12
+ addressToken0: string;
13
+ addressToken1: string;
14
+ addressesReturnData: string;
15
+ };
16
+ type dataRawTempest = callKeysTempest & {
17
+ addressToken0: string;
18
+ addressToken1: string;
19
+ addressesReturnData: {
20
+ [key: string]: string | number;
21
+ };
22
+ amount0Idle: string;
23
+ amount0Invested: string;
24
+ amount1Idle: string;
25
+ amount1Invested: string;
26
+ decimalsToken0: string;
27
+ decimalsToken1: string;
28
+ positionsReturnData: {
29
+ [key: string]: string | number;
30
+ };
31
+ symbolToken0: string;
32
+ symbolToken1: string;
33
+ };
34
+ type dataTypeTempest = dataType & {
35
+ addressToken0: string;
36
+ addressToken1: string;
37
+ symbolToken0: string;
38
+ symbolToken1: string;
39
+ };
40
+ export declare class TempestVaultProcessor extends GenericProcessor<callKeysTempest, dataRawTempest, dataTypeTempest> {
41
+ rounds: {
42
+ round1: callType[];
43
+ round2: callType[];
44
+ round3: callType[];
45
+ round4: callType[];
46
+ };
47
+ processingRound2(typeInfo: dataRawTempest): void;
48
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawTempest, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeTempest>;
49
+ }
50
+ export {};
@@ -0,0 +1,48 @@
1
+ import { generateCardName } from "../../../../../utils/generateCardName";
2
+ import { BN2Number } from "@sdk";
3
+ import { GenericProcessor } from "./GenericProcessor";
4
+ export class TempestVaultProcessor extends GenericProcessor {
5
+ rounds = {
6
+ round1: [
7
+ { key: "addressesReturnData", call: "getTokenAddresses", target: "tokenAddress" },
8
+ { key: "positionsReturnData", call: "getPositions", target: "tokenAddress" },
9
+ ],
10
+ round2: [
11
+ { key: "symbolToken0", call: "symbol", target: "addressToken0" },
12
+ { key: "symbolToken1", call: "symbol", target: "addressToken1" },
13
+ { key: "decimalsToken0", call: "decimals", target: "addressToken0" },
14
+ { key: "decimalsToken1", call: "decimals", target: "addressToken1" },
15
+ ],
16
+ round3: [],
17
+ round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
18
+ };
19
+ processingRound2(typeInfo) {
20
+ typeInfo.addressToken0 = typeInfo.addressesReturnData[0];
21
+ typeInfo.addressToken1 = typeInfo.addressesReturnData[1];
22
+ typeInfo.amount0Invested = typeInfo.positionsReturnData[0];
23
+ typeInfo.amount1Invested = typeInfo.positionsReturnData[1];
24
+ typeInfo.amount0Idle = typeInfo.positionsReturnData[2];
25
+ typeInfo.amount1Idle = typeInfo.positionsReturnData[3];
26
+ }
27
+ async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
28
+ const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
29
+ const decimalsToken0 = Number(typeInfo.decimalsToken0);
30
+ const decimalsToken1 = Number(typeInfo.decimalsToken1);
31
+ const amount0 = BN2Number(typeInfo.amount0Idle, decimalsToken0) + BN2Number(typeInfo.amount0Invested, decimalsToken0);
32
+ const amount1 = BN2Number(typeInfo.amount1Idle, decimalsToken1) + BN2Number(typeInfo.amount1Invested, decimalsToken1);
33
+ const tokenAPRice = (await pricer.get({ symbol: typeInfo.symbolToken0 })) ?? 0;
34
+ const tokenBPrice = (await pricer.get({ symbol: typeInfo.symbolToken1 })) ?? 0;
35
+ const tvl = tokenAPRice * amount0 + tokenBPrice * amount1;
36
+ const priceTargetToken = tvl / totalSupply;
37
+ const { addressesReturnData, positionsReturnData, ...rest } = typeInfo;
38
+ return {
39
+ ...rest,
40
+ blacklistedSupply,
41
+ cardName: generateCardName(type, typeInfo, campaign),
42
+ priceTargetToken: priceTargetToken,
43
+ totalSupply,
44
+ tvl,
45
+ whitelistedSupplyTargetToken,
46
+ };
47
+ }
48
+ }
@@ -20,6 +20,7 @@ import { RadiantProcessor } from "./RadiantProcessor";
20
20
  import { RfxProcessor } from "./RfxProcessor";
21
21
  import { SpliceProcessor } from "./SpliceProcessor";
22
22
  import { SturdySiloProcessor } from "./SturdySiloProcessor";
23
+ import { TempestVaultProcessor } from "./TempestVaultProcessor";
23
24
  import { TorosProcessor } from "./TorosProcessor";
24
25
  import { UniswapProcessor } from "./UniswapProcessor";
25
26
  import { WoofiProcessor } from "./WoofiProcessor";
@@ -80,4 +81,5 @@ export const processorMapping = {
80
81
  [tokenType.maverickBoostedPosition]: MaverickBPProcessor,
81
82
  [tokenType.zkSwapThreePool]: ZkSwapThreePoolProcessor,
82
83
  [tokenType.maha]: StakedCurveProcessor,
84
+ [tokenType.tempest]: TempestVaultProcessor,
83
85
  };
@@ -90,6 +90,8 @@ function satisfiesNameConditions(name, type) {
90
90
  return lowerCaseName.includes("zf");
91
91
  case tokenType.maha:
92
92
  return lowerCaseName.includes("staked") && lowerCaseName.includes("maha");
93
+ case tokenType.tempest:
94
+ return lowerCaseName.startsWith("ts");
93
95
  default:
94
96
  return false;
95
97
  }
@@ -1,4 +1,4 @@
1
- import { AaveInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CompoundInterface, CurveInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, RadiantInterface, RfxInterface, SturdyInterface, TorosInterface, UniswapV2PoolInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
1
+ import { AaveInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CompoundInterface, CurveInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, RadiantInterface, RfxInterface, SturdyInterface, SymetricAmbientStrategyInterface, TorosInterface, UniswapV2PoolInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
2
2
  import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
3
3
  export function decodeCall(calls, index, key, type) {
4
4
  const returnData = calls[index];
@@ -174,6 +174,10 @@ export function decodeCall(calls, index, key, type) {
174
174
  return ZFStableSwapThreePoolInterface.decodeFunctionResult("coins", returnData)[0];
175
175
  case "minter":
176
176
  return ZFStableLPINterface.decodeFunctionResult("minter", returnData)[0];
177
+ case "getTokenAddresses":
178
+ return SymetricAmbientStrategyInterface.decodeFunctionResult("getTokenAddresses", returnData)[0];
179
+ case "getPositions":
180
+ return SymetricAmbientStrategyInterface.decodeFunctionResult("getPositions", returnData);
177
181
  default:
178
182
  throw new Error(`Key not recognized for ${key}`);
179
183
  }
@@ -1,5 +1,5 @@
1
1
  import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
2
- import { AaveInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CompoundInterface, CurveInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, RadiantInterface, RfxDatastoreInterface, SturdyInterface, TorosInterface, UniswapV2PoolInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
2
+ import { AaveInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CompoundInterface, CurveInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, RadiantInterface, RfxDatastoreInterface, SturdyInterface, SymetricAmbientStrategyInterface, TorosInterface, UniswapV2PoolInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
3
3
  import { fluidInterface } from "src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1";
4
4
  export function createCall(target, key, type, metaData) {
5
5
  switch (key) {
@@ -260,6 +260,18 @@ export function createCall(target, key, type, metaData) {
260
260
  callData: ZFStableLPINterface.encodeFunctionData("minter"),
261
261
  target: target,
262
262
  };
263
+ case "getTokenAddresses":
264
+ return {
265
+ allowFailure: true,
266
+ callData: SymetricAmbientStrategyInterface.encodeFunctionData("getTokenAddresses"),
267
+ target: target,
268
+ };
269
+ case "getPositions":
270
+ return {
271
+ allowFailure: true,
272
+ callData: SymetricAmbientStrategyInterface.encodeFunctionData("getPositions"),
273
+ target: target,
274
+ };
263
275
  default:
264
276
  throw new Error(`Unknown key ${key}`);
265
277
  }