@merkl/api 0.21.28 → 0.21.29

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/package.json CHANGED
@@ -112,5 +112,5 @@
112
112
  "registry": "https://registry.npmjs.org/"
113
113
  },
114
114
  "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447",
115
- "version": "v0.21.28"
115
+ "version": "v0.21.29"
116
116
  }
@@ -1,17 +0,0 @@
1
- import type { MetadataBuilder } from "@/engine/metadata/interface";
2
- import type { CampaignWithParams } from "@/modules/v4/campaign/campaign.model";
3
- import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
4
- import type { Erc20LikeCampaignEnum } from "../..";
5
- export declare class DlendMetadata implements MetadataBuilder<Erc20LikeCampaignEnum> {
6
- build(campaign: Omit<CampaignWithParams<Erc20LikeCampaignEnum>, "manualOverrides">, _opportunityIdentifier: string): Promise<{
7
- action: "LEND" | "BORROW";
8
- mainProtocol: ProtocolId;
9
- name: string;
10
- tokens: {
11
- chainId: number;
12
- address: any;
13
- }[];
14
- depositUrl: string;
15
- explorerAddress: any;
16
- }>;
17
- }
@@ -1,29 +0,0 @@
1
- import { TokenService } from "@/modules/v4/token/token.service";
2
- import { OpportunityAction } from "@db/api";
3
- import { Aave__factory, ChainInteractionService, TokenInteractionService } from "@sdk";
4
- export class DlendMetadata {
5
- async build(campaign, _opportunityIdentifier) {
6
- const { params, computeChainId } = campaign;
7
- const { targetToken } = params;
8
- const targetTokenInfo = await TokenService.fetchOnChain({
9
- chainId: computeChainId,
10
- address: targetToken,
11
- });
12
- const underlyingToken = await Aave__factory.connect(targetToken, ChainInteractionService(computeChainId).provider()).UNDERLYING_ASSET_ADDRESS();
13
- const underlyingTokenSymbol = await TokenInteractionService(computeChainId).symbol(underlyingToken);
14
- const action = targetTokenInfo?.name?.toLowerCase().includes("debt")
15
- ? OpportunityAction.BORROW
16
- : OpportunityAction.LEND;
17
- return {
18
- action,
19
- mainProtocol: "dlend",
20
- name: `${action === OpportunityAction.BORROW ? "Borrow" : "Supply"} ${underlyingTokenSymbol} on dTrinity dLend`,
21
- tokens: [
22
- { chainId: computeChainId, address: targetToken },
23
- { chainId: computeChainId, address: underlyingToken },
24
- ],
25
- depositUrl: `https://app.dtrinity.org/dlend/reserve-overview/?underlyingAsset=${underlyingToken}`,
26
- explorerAddress: params.targetToken,
27
- };
28
- }
29
- }
@@ -1,17 +0,0 @@
1
- import type { MetadataBuilder } from "@/engine/metadata/interface";
2
- import type { CampaignWithParams } from "@/modules/v4/campaign/campaign.model";
3
- import type { ProtocolId } from "@/modules/v4/protocol/protocol.model";
4
- import type { Erc20LikeCampaignEnum } from "../..";
5
- export declare class SuperlendMetadata implements MetadataBuilder<Erc20LikeCampaignEnum> {
6
- build(campaign: Omit<CampaignWithParams<Erc20LikeCampaignEnum>, "manualOverrides">, _opportunityIdentifier: string): Promise<{
7
- action: "LEND" | "BORROW";
8
- mainProtocol: ProtocolId;
9
- name: string;
10
- tokens: {
11
- chainId: number;
12
- address: any;
13
- }[];
14
- depositUrl: string;
15
- explorerAddress: any;
16
- }>;
17
- }
@@ -1,6 +0,0 @@
1
- import type { Erc20LikeCampaignEnum } from "@/engine/implementations/Erc20/subTypes";
2
- import type { TVLBuilder, TVLData } from "@/engine/tvl/interface";
3
- import { type CampaignParameters, type MerklChainId } from "@sdk";
4
- export declare class SuperlendTVLBuilder implements TVLBuilder<Erc20LikeCampaignEnum> {
5
- build(computeChainId: MerklChainId, campaigns: CampaignParameters<Erc20LikeCampaignEnum>[]): Promise<TVLData<any>>;
6
- }
@@ -1,51 +0,0 @@
1
- import { TokenService } from "@/modules/v4/token/token.service";
2
- import { TvlType } from "@db/api";
3
- import { AaveInterface, ChainInteractionService, ERC20Interface, bigIntToNumber, } from "@sdk";
4
- export class SuperlendTVLBuilder {
5
- async build(computeChainId, campaigns) {
6
- const tvls = [];
7
- const firstRound = await ChainInteractionService(computeChainId).fetchAndDecodeObject(campaigns.flatMap(campaign => {
8
- const { campaignId, campaignParameters } = campaign;
9
- const { targetToken } = campaignParameters;
10
- return [
11
- {
12
- callData: AaveInterface.encodeFunctionData("UNDERLYING_ASSET_ADDRESS"),
13
- target: targetToken,
14
- key: `${campaignId}_underlyingToken`,
15
- decoder: (data) => AaveInterface.decodeFunctionResult("UNDERLYING_ASSET_ADDRESS", data)[0],
16
- },
17
- {
18
- callData: ERC20Interface.encodeFunctionData("totalSupply"),
19
- target: targetToken,
20
- key: `${campaignId}_totalSupply`,
21
- decoder: (data) => BigInt(ERC20Interface.decodeFunctionResult("totalSupply", data)[0].toString()),
22
- },
23
- ];
24
- }));
25
- for (const campaign of campaigns) {
26
- const { campaignId } = campaign;
27
- const underlyingTokenAddress = firstRound[`${campaignId}_underlyingToken`];
28
- const totalSupply = firstRound[`${campaignId}_totalSupply`];
29
- // We don't fetch token data everytime, we use the database and the associated service
30
- const underlyingToken = await TokenService.findUniqueFillOrThrow({
31
- chainId: computeChainId,
32
- address: underlyingTokenAddress,
33
- });
34
- if (!underlyingToken.decimals || !underlyingToken.price) {
35
- throw new Error(`Missing decimals or price for token ${underlyingToken.address}`);
36
- }
37
- tvls.push({
38
- campaign,
39
- tvl: bigIntToNumber(totalSupply, underlyingToken.decimals) * underlyingToken.price,
40
- tvlBreakdown: [
41
- {
42
- identifier: underlyingToken.id,
43
- type: TvlType.TOKEN,
44
- value: bigIntToNumber(totalSupply, underlyingToken.decimals),
45
- },
46
- ],
47
- });
48
- }
49
- return tvls;
50
- }
51
- }