@merkl/api 0.14.9 → 0.14.11
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.
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AnglesLiquid.d.ts +34 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AnglesLiquid.js +48 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/UniswapProcessor.js +3 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +2 -0
- package/dist/src/utils/decodeCalls.js +1 -0
- package/dist/src/utils/encodeCalls.js +1 -0
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/src/utils/pricer.js +13 -5
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -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
|
+
}
|
@@ -47,6 +47,9 @@ export class UniswapProcessor extends GenericProcessor {
|
|
47
47
|
if (priceToken0 !== 0 && priceToken1 !== 0) {
|
48
48
|
tvl = priceToken0 * balanceToken0 + priceToken1 * balanceToken1;
|
49
49
|
}
|
50
|
+
else if (campaign.campaignParameters.symbolRewardToken.toLowerCase().startsWith("if-")) {
|
51
|
+
tvl = (2 * balanceToken0 * balanceToken1) / (balanceToken0 + balanceToken1);
|
52
|
+
}
|
50
53
|
const priceTargetToken = tvl / totalSupply;
|
51
54
|
return {
|
52
55
|
...typeInfo,
|
@@ -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:
|
@@ -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) {
|
package/dist/src/utils/pricer.js
CHANGED
@@ -28,13 +28,21 @@ export class Pricer {
|
|
28
28
|
this.extraPricesData = extraPricesData;
|
29
29
|
}
|
30
30
|
static async load() {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
try {
|
32
|
+
const { prices, extraPricesData } = await Redis.get("Prices");
|
33
|
+
const pricer = new Pricer(prices ?? {}, extraPricesData ?? []);
|
34
|
+
if (!prices) {
|
35
|
+
log.error("Pricer", "prices not found in cache when instanciating class");
|
36
|
+
await pricer.update();
|
37
|
+
}
|
38
|
+
return pricer;
|
39
|
+
}
|
40
|
+
catch (e) {
|
41
|
+
log.error("Pricer", "Failed to load prices from cache");
|
42
|
+
const pricer = new Pricer({}, []);
|
35
43
|
await pricer.update();
|
44
|
+
return pricer;
|
36
45
|
}
|
37
|
-
return pricer;
|
38
46
|
}
|
39
47
|
getArray() {
|
40
48
|
return Object.keys(this.prices)
|