@merkl/api 0.10.262 → 0.10.263

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  import type { Pricer } from "../../../../../utils/pricer";
2
2
  import { type Campaign, type CampaignParameters } from "@sdk";
3
- import type { tokenType } from "../helpers/tokenType";
3
+ import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
4
4
  import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
5
5
  type callType = {
6
6
  key: keyof dataRawUni;
@@ -37,6 +37,8 @@ export declare class UniswapProcessor extends GenericProcessor<callKeysUni, data
37
37
  round3: callType[];
38
38
  round4: callType[];
39
39
  };
40
+ processingRound2(typeInfo: dataRawUni): void;
41
+ computeRound3(index: number, type: tokenType, typeInfo: dataRawUni, calls: string[]): tokenTypeStruct;
40
42
  processingRound5(_index: number, type: tokenType, typeInfo: dataRawUni, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeUni>;
41
43
  }
42
44
  export {};
@@ -1,4 +1,5 @@
1
1
  import { generateCardName } from "../../../../../utils/generateCardName";
2
+ import { log } from "../../../../../utils/logger";
2
3
  import { BN2Number } from "@sdk";
3
4
  import { GenericProcessor } from "./GenericProcessor";
4
5
  export class UniswapProcessor extends GenericProcessor {
@@ -18,6 +19,21 @@ export class UniswapProcessor extends GenericProcessor {
18
19
  round3: [],
19
20
  round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
20
21
  };
22
+ processingRound2(typeInfo) {
23
+ if (typeInfo.tokenAddress === "0x45856bD6Bb9f076F4C558A4D5932c6c8d832b0d0") {
24
+ log.local("Processing round 2 for UniswapProcessor on classic pools");
25
+ this.rounds.round2[4] = { key: "balanceToken0", call: "reserve0", target: "tokenAddress" };
26
+ this.rounds.round2[5] = { key: "balanceToken1", call: "reserve1", target: "tokenAddress" };
27
+ }
28
+ }
29
+ computeRound3(index, type, typeInfo, calls) {
30
+ if (typeInfo.tokenAddress === "0x45856bD6Bb9f076F4C558A4D5932c6c8d832b0d0") {
31
+ log.local("Computing round 3 for UniswapProcessor on classic pools");
32
+ this.rounds.round2[4] = { key: "balanceToken0", call: "reserve0", target: "tokenAddress" };
33
+ this.rounds.round2[5] = { key: "balanceToken1", call: "reserve1", target: "tokenAddress" };
34
+ }
35
+ return super.computeRound3(index, type, typeInfo, calls);
36
+ }
21
37
  async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
22
38
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
23
39
  const decimalsToken0 = Number(typeInfo.decimalsToken0);
@@ -1,4 +1,5 @@
1
1
  import { AaveInterface, AccountantWithRateProvidersInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CPMMGammaPoolMainInterface, CompoundInterface, CurveInterface, CurveStableSwapNGInterface, DefutureVaultInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, PendleYTInterface, RadiantInterface, RfxInterface, RswEthStrategyInterface, SturdyInterface, SymetricAmbientStrategyInterface, TorosInterface, UniswapV2PoolInterface, VePufferInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
2
+ import { SyncSwapClassicPoolInterface } from "libs/sdk/src/merkl/interface";
2
3
  import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
3
4
  export function decodeCall(calls, index, key, type) {
4
5
  const returnData = calls[index];
@@ -229,6 +230,10 @@ export function decodeCall(calls, index, key, type) {
229
230
  ];
230
231
  case "tokenBalances":
231
232
  return CPMMGammaPoolMainInterface.decodeFunctionResult("getLatestCFMMBalances", returnData)[0];
233
+ case "reserve0":
234
+ return SyncSwapClassicPoolInterface.decodeFunctionResult("reserve0", returnData)[0];
235
+ case "reserve1":
236
+ return SyncSwapClassicPoolInterface.decodeFunctionResult("reserve1", returnData)[0];
232
237
  default:
233
238
  throw new Error(`Key not recognized for ${key}`);
234
239
  }
@@ -1,5 +1,6 @@
1
1
  import { tokenType } from "../libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType";
2
2
  import { AaveInterface, AccountantWithRateProvidersInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerVaultInterface, BeefyInterface, CPMMGammaPoolMainInterface, CompoundInterface, CurveInterface, CurveStableSwapNGInterface, DefutureVaultInterface, ERC20Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, IonicInterface, LayerBankInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, PendleYTInterface, RadiantInterface, RfxDatastoreInterface, RswEthStrategyInterface, SturdyInterface, SymetricAmbientStrategyInterface, TorosInterface, UniswapV2PoolInterface, VePufferInterface, ZFStableLPINterface, } from "@sdk";
3
+ import { SyncSwapClassicPoolInterface } from "libs/sdk/src/merkl/interface";
3
4
  export function createCall(target, key, type, metaData) {
4
5
  switch (key) {
5
6
  case "SY":
@@ -350,6 +351,18 @@ export function createCall(target, key, type, metaData) {
350
351
  callData: UniswapV2PoolInterface.encodeFunctionData("getReserves"),
351
352
  target: target,
352
353
  };
354
+ case "reserve0":
355
+ return {
356
+ allowFailure: true,
357
+ callData: SyncSwapClassicPoolInterface.encodeFunctionData("reserve0"),
358
+ target: target,
359
+ };
360
+ case "reserve1":
361
+ return {
362
+ allowFailure: true,
363
+ callData: SyncSwapClassicPoolInterface.encodeFunctionData("reserve1"),
364
+ target: target,
365
+ };
353
366
  default:
354
367
  throw new Error(`Unknown key ${key}`);
355
368
  }