@merkl/api 0.17.10 → 0.17.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/implementations/MetamorphoProcessor.d.ts +4 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/MetamorphoProcessor.js +11 -7
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +1 -0
- package/dist/src/utils/decodeCalls.js +1 -0
- package/dist/src/utils/encodeCalls.js +1 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/MetamorphoProcessor.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
-
import type
|
2
|
+
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
3
|
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
|
4
4
|
import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
|
5
5
|
type callType = {
|
@@ -11,6 +11,8 @@ type callType = {
|
|
11
11
|
type callKeysMetamorpho = mandatoryCallKeys & {
|
12
12
|
underlying: string;
|
13
13
|
symbolUnderlyingToken: string;
|
14
|
+
decimalsUnderlyingToken: string;
|
15
|
+
totalAssets: string;
|
14
16
|
};
|
15
17
|
type dataRawMetamorpho = callKeysMetamorpho & {};
|
16
18
|
type dataTypeMetamorpho = dataType & {
|
@@ -25,7 +27,7 @@ export declare class MetamorphoProcessor extends GenericProcessor<callKeysMetamo
|
|
25
27
|
round3: callType[];
|
26
28
|
round4: callType[];
|
27
29
|
};
|
28
|
-
processingRound5(_index: number, type: tokenType, typeInfo: dataRawMetamorpho, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>,
|
30
|
+
processingRound5(_index: number, type: tokenType, typeInfo: dataRawMetamorpho, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeMetamorpho>;
|
29
31
|
computeRound3(index: number, type: tokenType, typeInfo: dataRawMetamorpho, calls: string[]): tokenTypeStruct;
|
30
32
|
}
|
31
33
|
export {};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/implementations/MetamorphoProcessor.js
CHANGED
@@ -1,25 +1,29 @@
|
|
1
1
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
2
3
|
import { GenericProcessor } from "../GenericProcessor";
|
3
|
-
import { fetchMetamorphoTvl } from "../helpers/metamorphoTvl";
|
4
4
|
export class MetamorphoProcessor extends GenericProcessor {
|
5
5
|
rounds = {
|
6
6
|
round1: [{ key: "underlying", call: "underlying", target: "tokenAddress" }],
|
7
7
|
round2: [{ key: "symbolUnderlyingToken", call: "symbol", target: "underlying" }],
|
8
|
-
round3: [
|
9
|
-
|
8
|
+
round3: [
|
9
|
+
{ key: "decimalsUnderlyingToken", call: "decimals", target: "underlying" },
|
10
|
+
{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
|
11
|
+
],
|
12
|
+
round4: [{ key: "totalAssets", call: "totalAssets", target: "tokenAddress" }],
|
10
13
|
};
|
11
14
|
// override computeRound1(): void {}
|
12
|
-
async processingRound5(_index, type, typeInfo, _calls, campaign,
|
15
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
13
16
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
14
|
-
const
|
15
|
-
const
|
17
|
+
const totalAssets = BN2Number(typeInfo.totalAssets, Number(typeInfo.decimalsUnderlyingToken));
|
18
|
+
const underlyingTokenPrice = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
|
19
|
+
const tvl = Number(totalAssets) * underlyingTokenPrice;
|
16
20
|
return {
|
17
21
|
...typeInfo,
|
18
22
|
totalSupply,
|
19
23
|
tvl,
|
20
24
|
whitelistedSupplyTargetToken,
|
21
25
|
blacklistedSupply,
|
22
|
-
priceTargetToken,
|
26
|
+
priceTargetToken: underlyingTokenPrice,
|
23
27
|
cardName: generateCardName(type, typeInfo, campaign),
|
24
28
|
};
|
25
29
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
1
2
|
// import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
2
3
|
import { CampaignRepository } from "../campaign/campaign.repository";
|
3
4
|
import { CampaignService } from "../campaign/campaign.service";
|
@@ -200,6 +200,7 @@ export function decodeReturnValue(returnData, key, type) {
|
|
200
200
|
case tokenType.anglesLiquid:
|
201
201
|
case tokenType.cian:
|
202
202
|
case tokenType.rfx_slv:
|
203
|
+
case tokenType.metamorpho:
|
203
204
|
return ERC4626Interface.decodeFunctionResult("totalAssets", returnData)[0];
|
204
205
|
case tokenType.concrete:
|
205
206
|
return ERC4626Interface.decodeFunctionResult("totalAssets", returnData)[0];
|
@@ -270,6 +270,7 @@ export function createCall(target, key, type, metaData) {
|
|
270
270
|
case tokenType.anglesLiquid:
|
271
271
|
case tokenType.cian:
|
272
272
|
case tokenType.rfx_slv:
|
273
|
+
case tokenType.metamorpho:
|
273
274
|
return {
|
274
275
|
allowFailure: true,
|
275
276
|
callData: ERC4626Interface.encodeFunctionData("totalAssets"),
|