@merkl/api 0.10.381 → 0.10.382
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/processor/GearboxProcessor.d.ts +5 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/GearboxProcessor.js +18 -5
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -7,6 +7,7 @@ type callType = {
|
|
7
7
|
call: string;
|
8
8
|
target: keyof callKeysGearbox;
|
9
9
|
metaData?: keyof callKeysGearbox;
|
10
|
+
optional?: boolean;
|
10
11
|
};
|
11
12
|
type callKeysGearbox = mandatoryCallKeys & {
|
12
13
|
stakingToken: string;
|
@@ -18,7 +19,9 @@ type callKeysGearbox = mandatoryCallKeys & {
|
|
18
19
|
decimalsUnderlyingToken: string;
|
19
20
|
symbolUnderlyingToken: string;
|
20
21
|
};
|
21
|
-
type dataRawGearbox = callKeysGearbox & {
|
22
|
+
type dataRawGearbox = callKeysGearbox & {
|
23
|
+
isTrade: boolean;
|
24
|
+
};
|
22
25
|
type dataTypeGearbox = dataType & {
|
23
26
|
stakingToken: string;
|
24
27
|
balanceStakingToken: number;
|
@@ -35,6 +38,7 @@ export declare class GearboxProcessor extends GenericProcessor<callKeysGearbox,
|
|
35
38
|
round3: callType[];
|
36
39
|
round4: callType[];
|
37
40
|
};
|
41
|
+
processingRound2(typeInfo: dataRawGearbox): Promise<void>;
|
38
42
|
processingRound5(_index: number, type: tokenType, typeInfo: dataRawGearbox, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeGearbox>;
|
39
43
|
}
|
40
44
|
export {};
|
@@ -3,7 +3,7 @@ import { BN2Number } from "@sdk";
|
|
3
3
|
import { GenericProcessor } from "./GenericProcessor";
|
4
4
|
export class GearboxProcessor extends GenericProcessor {
|
5
5
|
rounds = {
|
6
|
-
round1: [{ key: "stakingToken", call: "stakingToken", target: "tokenAddress" }],
|
6
|
+
round1: [{ key: "stakingToken", call: "stakingToken", target: "tokenAddress", optional: true }],
|
7
7
|
round2: [
|
8
8
|
{ key: "balanceStakingToken", call: "balanceOf", target: "stakingToken", metaData: "tokenAddress" },
|
9
9
|
{ key: "totalSupplyStakingToken", call: "totalSupply", target: "stakingToken" },
|
@@ -17,15 +17,28 @@ export class GearboxProcessor extends GenericProcessor {
|
|
17
17
|
],
|
18
18
|
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
19
19
|
};
|
20
|
+
async processingRound2(typeInfo) {
|
21
|
+
typeInfo.stakingToken = typeInfo.stakingToken ?? typeInfo.tokenAddress;
|
22
|
+
typeInfo.isTrade = typeInfo.stakingToken === typeInfo.tokenAddress;
|
23
|
+
}
|
20
24
|
// override computeRound1(): void {}
|
21
25
|
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
22
26
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
23
27
|
const totalAssets = BN2Number(typeInfo.totalAssets, Number(typeInfo.decimalsUnderlyingToken));
|
24
|
-
const balanceStakingToken = BN2Number(typeInfo.balanceStakingToken, Number(typeInfo.decimalsStakingToken));
|
25
|
-
const totalSupplyStakingToken = BN2Number(typeInfo.totalSupplyStakingToken, Number(typeInfo.decimalsStakingToken));
|
26
|
-
const percentageOfSupplyUnderlyingPoolTokens = balanceStakingToken / totalSupplyStakingToken;
|
27
28
|
const underlyingTokenPrice = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
|
28
|
-
|
29
|
+
let tvl = 0;
|
30
|
+
let balanceStakingToken = 0;
|
31
|
+
let totalSupplyStakingToken = 0;
|
32
|
+
let percentageOfSupplyUnderlyingPoolTokens = 0;
|
33
|
+
if (!typeInfo.isTrade) {
|
34
|
+
balanceStakingToken = BN2Number(typeInfo.balanceStakingToken, Number(typeInfo.decimalsStakingToken));
|
35
|
+
totalSupplyStakingToken = BN2Number(typeInfo.totalSupplyStakingToken, Number(typeInfo.decimalsStakingToken));
|
36
|
+
percentageOfSupplyUnderlyingPoolTokens = balanceStakingToken / totalSupplyStakingToken;
|
37
|
+
tvl = underlyingTokenPrice * Number(totalAssets) * percentageOfSupplyUnderlyingPoolTokens;
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
tvl = Number(totalAssets) * underlyingTokenPrice;
|
41
|
+
}
|
29
42
|
const priceTargetToken = tvl / totalSupply;
|
30
43
|
return {
|
31
44
|
...typeInfo,
|
@@ -21,7 +21,7 @@ function satisfiesNameConditions(name, type) {
|
|
21
21
|
case tokenType.balancerGauge:
|
22
22
|
return lowerCaseName.includes("balancer") && !lowerCaseName.includes("aura deposit vault");
|
23
23
|
case tokenType.gearbox:
|
24
|
-
return lowerCaseName.includes("farming of");
|
24
|
+
return lowerCaseName.includes("farming of") || lowerCaseName.startsWith("trade");
|
25
25
|
case tokenType.euler_borrow:
|
26
26
|
return lowerCaseName.startsWith("debt token of evk vault");
|
27
27
|
case tokenType.euler_lend:
|