@merkl/api 0.14.8 → 0.14.10

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.
@@ -41,7 +41,7 @@ const extract = async () => {
41
41
  }
42
42
  catch (err) {
43
43
  console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
44
- failedBatches.push(data);
44
+ failedBatches.push([...data]);
45
45
  data.length = 0;
46
46
  }
47
47
  }
@@ -109,7 +109,7 @@ export const main = async () => {
109
109
  process.exit(1);
110
110
  }
111
111
  if (failedBatches.length === 0) {
112
- await file.delete();
112
+ // await file.delete();
113
113
  }
114
114
  };
115
115
  main();
@@ -105,7 +105,8 @@ export const main = async () => {
105
105
  log.error("rewards", `${failedBatches.length} batches failed.`);
106
106
  process.exit(1);
107
107
  }
108
- if (failedBatches.length === 0)
109
- await file.delete();
108
+ if (failedBatches.length === 0) {
109
+ // await file.delete();
110
+ }
110
111
  };
111
112
  main();
@@ -2,6 +2,7 @@ import { OpportunityAction } from "../../../../../../database/api/.generated";
2
2
  import type { CallDto } from "@sdk";
3
3
  export declare enum tokenType {
4
4
  aura = "aura",
5
+ anglesLiquid = "anglesLiquid",
5
6
  poolside = "poolside",
6
7
  balancerGauge = "balancerGauge",
7
8
  gearbox = "gearbox",
@@ -3,6 +3,7 @@ import { OpportunityAction } from "../../../../../../database/api/.generated";
3
3
  export var tokenType;
4
4
  (function (tokenType) {
5
5
  tokenType["aura"] = "aura";
6
+ tokenType["anglesLiquid"] = "anglesLiquid";
6
7
  tokenType["poolside"] = "poolside";
7
8
  tokenType["balancerGauge"] = "balancerGauge";
8
9
  tokenType["gearbox"] = "gearbox";
@@ -87,6 +88,7 @@ export var tokenType;
87
88
  })(tokenType || (tokenType = {}));
88
89
  export const tokenTypeToProtocol = {
89
90
  [tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
91
+ [tokenType.anglesLiquid]: { protocol: "Angles", action: OpportunityAction.LEND },
90
92
  [tokenType.aave_lending]: { protocol: "Aave", action: OpportunityAction.LEND },
91
93
  [tokenType.aerodrome]: { protocol: "Aerodrome V2", action: OpportunityAction.POOL },
92
94
  [tokenType.akron]: { protocol: "Akron V2", action: OpportunityAction.POOL },
@@ -0,0 +1,34 @@
1
+ import type { Pricer } from "../../../../../utils/pricer";
2
+ import { type Campaign, type 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 dataRawAnglesLiquid;
7
+ call: string;
8
+ target: keyof callKeysAnglesLiquid;
9
+ metaData?: keyof callKeysAnglesLiquid;
10
+ };
11
+ type callKeysAnglesLiquid = mandatoryCallKeys & {
12
+ poolToken: string;
13
+ totalAssets: string;
14
+ };
15
+ type dataRawAnglesLiquid = callKeysAnglesLiquid & {};
16
+ type dataTypeAnglesLiquid = dataType & {
17
+ poolToken: string;
18
+ totalAssets: string;
19
+ };
20
+ export declare class AnglesLiquidProcessor extends GenericProcessor<callKeysAnglesLiquid, dataRawAnglesLiquid, dataTypeAnglesLiquid> {
21
+ rounds: {
22
+ round1: callType[];
23
+ round2: callType[];
24
+ round3: callType[];
25
+ round4: callType[];
26
+ };
27
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawAnglesLiquid, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeAnglesLiquid>;
28
+ computeRound1(type: tokenType, typeInfo: dataRawAnglesLiquid): tokenTypeStruct;
29
+ computeRound2(index: number, type: tokenType, typeInfo: dataRawAnglesLiquid, calls: string[]): tokenTypeStruct;
30
+ computeRound3(index: number, type: tokenType, typeInfo: dataRawAnglesLiquid, calls: string[]): tokenTypeStruct;
31
+ computeRound4(index: number, type: tokenType, typeInfo: dataRawAnglesLiquid, calls: string[], campaign: CampaignParameters<Campaign.ERC20>): tokenTypeStruct;
32
+ computeRound5(index: number, type: tokenType, typeInfo: dataRawAnglesLiquid, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<tokenTypeStruct>;
33
+ }
34
+ export {};
@@ -0,0 +1,48 @@
1
+ import { generateCardName } from "../../../../../utils/generateCardName";
2
+ import { BN2Number } from "@sdk";
3
+ import { GenericProcessor } from "./GenericProcessor";
4
+ export class AnglesLiquidProcessor extends GenericProcessor {
5
+ rounds = {
6
+ round1: [],
7
+ round2: [],
8
+ round3: [],
9
+ round4: [
10
+ { key: "poolToken", call: "asset", target: "tokenAddress" },
11
+ { key: "totalAssets", call: "totalAssets", target: "tokenAddress" },
12
+ { key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
13
+ ],
14
+ };
15
+ // override computeRound1(): void {}
16
+ async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
17
+ const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
18
+ const priceUnderlying = (await pricer.get({ symbol: "S" })) ?? 0;
19
+ const tvl = priceUnderlying * BN2Number(typeInfo.totalAssets, 18);
20
+ const priceTargetToken = totalSupply ? tvl / totalSupply : 0;
21
+ return {
22
+ ...typeInfo,
23
+ tvl,
24
+ whitelistedSupplyTargetToken,
25
+ blacklistedSupply,
26
+ priceTargetToken,
27
+ totalSupply,
28
+ totalAssets: typeInfo.totalAssets,
29
+ poolToken: typeInfo.poolToken,
30
+ cardName: generateCardName(type, typeInfo, campaign),
31
+ };
32
+ }
33
+ computeRound1(type, typeInfo) {
34
+ return super.computeRound1(type, typeInfo);
35
+ }
36
+ computeRound2(index, type, typeInfo, calls) {
37
+ return super.computeRound2(index, type, typeInfo, calls);
38
+ }
39
+ computeRound3(index, type, typeInfo, calls) {
40
+ return super.computeRound3(index, type, typeInfo, calls);
41
+ }
42
+ computeRound4(index, type, typeInfo, calls, campaign) {
43
+ return super.computeRound4(index, type, typeInfo, calls, campaign);
44
+ }
45
+ async computeRound5(index, type, typeInfo, calls, campaign, pricer) {
46
+ return super.computeRound5(index, type, typeInfo, calls, campaign, pricer);
47
+ }
48
+ }
@@ -34,6 +34,7 @@ import { UniswapProcessor } from "./UniswapProcessor";
34
34
  import { VicunaProcessor } from "./VicunaProcessor";
35
35
  import { WoofiProcessor } from "./WoofiProcessor";
36
36
  import { ZkSwapThreePoolProcessor } from "./ZkSwapThreePoolProcessor";
37
+ import { AnglesLiquidProcessor } from "./anglesLiquid";
37
38
  import { CurveNPoolProcessor } from "./curveNPoolProcessor";
38
39
  import { CurveProcessor } from "./curveProcessor";
39
40
  import { StakedCurveProcessor } from "./stakedCurveProcessor";
@@ -120,4 +121,5 @@ export const processorMapping = {
120
121
  [tokenType.equalizer_gauge]: EqualizerGaugeProcessor,
121
122
  [tokenType.vicuna_borrowing]: AaveProcessor,
122
123
  [tokenType.vicuna_lending]: AaveProcessor,
124
+ [tokenType.anglesLiquid]: AnglesLiquidProcessor,
123
125
  };
@@ -18,6 +18,8 @@ function satisfiesNameConditions(name, type) {
18
18
  return lowerCaseName.includes("aura deposit vault");
19
19
  case tokenType.poolside:
20
20
  return lowerCaseName.includes("poolside");
21
+ case tokenType.anglesLiquid:
22
+ return lowerCaseName.includes("angles liquid");
21
23
  case tokenType.balancerGauge:
22
24
  return (lowerCaseName.includes("balancer") &&
23
25
  !lowerCaseName.includes("aura deposit vault") &&
@@ -189,6 +189,7 @@ export function decodeReturnValue(returnData, key, type) {
189
189
  return AuraOperatorInterface.decodeFunctionResult("staker", returnData)[0];
190
190
  case "totalAssets":
191
191
  switch (type) {
192
+ case tokenType.anglesLiquid:
192
193
  case tokenType.cian:
193
194
  return ERC4626Interface.decodeFunctionResult("totalAssets", returnData)[0];
194
195
  case tokenType.concrete:
@@ -245,6 +245,7 @@ export function createCall(target, key, type, metaData) {
245
245
  };
246
246
  case "totalAssets":
247
247
  switch (type) {
248
+ case tokenType.anglesLiquid:
248
249
  case tokenType.cian:
249
250
  return {
250
251
  allowFailure: true,
@@ -136,6 +136,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
136
136
  return `Deposit ${typeInfo.symbolAsset} into ${typeInfo.name.replace("Ether.Fi", "Veda")}`;
137
137
  case tokenType.equalizer_gauge:
138
138
  return `${displayName}`;
139
+ case tokenType.anglesLiquid:
140
+ return `Deposit into ${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken}) Vault`;
139
141
  default:
140
142
  // OVERRIDE
141
143
  switch (typeInfo.tokenAddress) {