@merkl/api 0.20.156 → 0.20.158
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/eden/index.d.ts +150 -143
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/ownerFinder.js +1 -0
- package/dist/src/engine/implementations/Erc20/subTypes/factories.js +4 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/metadata.d.ts +16 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/metadata.js +20 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/tvl.d.ts +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/tvl.js +53 -0
- package/dist/src/engine/implementations/Erc20/subTypes/index.d.ts +2 -1
- package/dist/src/engine/implementations/Erc20/subTypes/index.js +1 -0
- package/dist/src/index.d.ts +48 -41
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +18 -15
- package/dist/src/modules/v4/campaign/campaign.controller.js +5 -1
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +30 -26
- package/dist/src/modules/v4/campaign/campaign.test.controller.js +6 -3
- package/dist/src/modules/v4/price/price.service.js +7 -0
- package/dist/src/modules/v4/router.d.ts +48 -41
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -1476,6 +1476,19 @@ declare const eden: {
|
|
1476
1476
|
};
|
1477
1477
|
}>>;
|
1478
1478
|
};
|
1479
|
+
tvls: ((params: {
|
1480
|
+
opportunityId: string | number;
|
1481
|
+
}) => {
|
1482
|
+
put: (body: unknown, options: {
|
1483
|
+
headers: {
|
1484
|
+
authorization: string;
|
1485
|
+
};
|
1486
|
+
query?: Record<string, unknown> | undefined;
|
1487
|
+
fetch?: RequestInit | undefined;
|
1488
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1489
|
+
200: unknown[];
|
1490
|
+
}>>;
|
1491
|
+
}) & {};
|
1479
1492
|
index: {
|
1480
1493
|
get: (options: {
|
1481
1494
|
headers?: Record<string, unknown> | undefined;
|
@@ -1748,47 +1761,20 @@ declare const eden: {
|
|
1748
1761
|
}>>;
|
1749
1762
|
};
|
1750
1763
|
};
|
1751
|
-
"dry-runtvl": ((params: {
|
1752
|
-
campaignId: string | number;
|
1753
|
-
}) => {
|
1754
|
-
get: (options: {
|
1755
|
-
headers: {
|
1756
|
-
authorization: string;
|
1757
|
-
};
|
1758
|
-
query?: Record<string, unknown> | undefined;
|
1759
|
-
fetch?: RequestInit | undefined;
|
1760
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1761
|
-
200: unknown[];
|
1762
|
-
}>>;
|
1763
|
-
}) & {};
|
1764
|
-
"dry-runtvls": ((params: {
|
1765
|
-
opportunityId: string | number;
|
1766
|
-
}) => {
|
1767
|
-
get: (options: {
|
1768
|
-
headers: {
|
1769
|
-
authorization: string;
|
1770
|
-
};
|
1771
|
-
query?: Record<string, unknown> | undefined;
|
1772
|
-
fetch?: RequestInit | undefined;
|
1773
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1774
|
-
200: unknown[];
|
1775
|
-
}>>;
|
1776
|
-
}) & {};
|
1777
1764
|
"dry-run": {
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
}
|
1790
|
-
}
|
1791
|
-
tvl: {
|
1765
|
+
tvl: ((params: {
|
1766
|
+
campaignId: string | number;
|
1767
|
+
}) => {
|
1768
|
+
get: (options: {
|
1769
|
+
headers: {
|
1770
|
+
authorization: string;
|
1771
|
+
};
|
1772
|
+
query?: Record<string, unknown> | undefined;
|
1773
|
+
fetch?: RequestInit | undefined;
|
1774
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1775
|
+
200: unknown[];
|
1776
|
+
}>>;
|
1777
|
+
}) & {
|
1792
1778
|
post: (body: {
|
1793
1779
|
id?: string | undefined;
|
1794
1780
|
subType?: number | undefined;
|
@@ -1834,6 +1820,31 @@ declare const eden: {
|
|
1834
1820
|
};
|
1835
1821
|
}>>;
|
1836
1822
|
};
|
1823
|
+
tvls: ((params: {
|
1824
|
+
opportunityId: string | number;
|
1825
|
+
}) => {
|
1826
|
+
get: (options: {
|
1827
|
+
headers: {
|
1828
|
+
authorization: string;
|
1829
|
+
};
|
1830
|
+
query?: Record<string, unknown> | undefined;
|
1831
|
+
fetch?: RequestInit | undefined;
|
1832
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1833
|
+
200: unknown[];
|
1834
|
+
}>>;
|
1835
|
+
}) & {
|
1836
|
+
list: {
|
1837
|
+
post: (body: string[], options: {
|
1838
|
+
headers: {
|
1839
|
+
authorization: string;
|
1840
|
+
};
|
1841
|
+
query?: Record<string, unknown> | undefined;
|
1842
|
+
fetch?: RequestInit | undefined;
|
1843
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1844
|
+
200: unknown[];
|
1845
|
+
}>>;
|
1846
|
+
};
|
1847
|
+
};
|
1837
1848
|
metadata: {
|
1838
1849
|
post: (body: {
|
1839
1850
|
id?: string | undefined;
|
@@ -2054,17 +2065,6 @@ declare const eden: {
|
|
2054
2065
|
};
|
2055
2066
|
};
|
2056
2067
|
};
|
2057
|
-
campaignstvls: ((params: {
|
2058
|
-
opportunityId: string | number;
|
2059
|
-
}) => {
|
2060
|
-
put: (body?: unknown, options?: {
|
2061
|
-
headers?: Record<string, unknown> | undefined;
|
2062
|
-
query?: Record<string, unknown> | undefined;
|
2063
|
-
fetch?: RequestInit | undefined;
|
2064
|
-
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
2065
|
-
200: unknown[];
|
2066
|
-
}>>;
|
2067
|
-
}) & {};
|
2068
2068
|
campaignscount: {
|
2069
2069
|
"by-chains": {
|
2070
2070
|
get: (options: {
|
@@ -6840,6 +6840,24 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6840
6840
|
};
|
6841
6841
|
};
|
6842
6842
|
};
|
6843
|
+
} & {
|
6844
|
+
tvls: {
|
6845
|
+
":opportunityId": {
|
6846
|
+
put: {
|
6847
|
+
body: unknown;
|
6848
|
+
params: {
|
6849
|
+
opportunityId: string;
|
6850
|
+
};
|
6851
|
+
query: unknown;
|
6852
|
+
headers: {
|
6853
|
+
authorization: string;
|
6854
|
+
};
|
6855
|
+
response: {
|
6856
|
+
200: unknown[];
|
6857
|
+
};
|
6858
|
+
};
|
6859
|
+
};
|
6860
|
+
};
|
6843
6861
|
} & {
|
6844
6862
|
index: {
|
6845
6863
|
get: {
|
@@ -7120,21 +7138,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7120
7138
|
};
|
7121
7139
|
};
|
7122
7140
|
};
|
7123
|
-
campaignstvls: {
|
7124
|
-
":opportunityId": {
|
7125
|
-
put: {
|
7126
|
-
body: unknown;
|
7127
|
-
params: {
|
7128
|
-
opportunityId: string;
|
7129
|
-
};
|
7130
|
-
query: unknown;
|
7131
|
-
headers: unknown;
|
7132
|
-
response: {
|
7133
|
-
200: unknown[];
|
7134
|
-
};
|
7135
|
-
};
|
7136
|
-
};
|
7137
|
-
};
|
7138
7141
|
} & {
|
7139
7142
|
campaigns: {
|
7140
7143
|
index: {
|
@@ -7416,37 +7419,41 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7416
7419
|
} & {
|
7417
7420
|
v4: {
|
7418
7421
|
campaigns: {
|
7419
|
-
"dry-
|
7420
|
-
|
7421
|
-
|
7422
|
-
|
7423
|
-
|
7424
|
-
|
7425
|
-
|
7426
|
-
|
7427
|
-
|
7428
|
-
|
7429
|
-
|
7430
|
-
|
7431
|
-
|
7422
|
+
"dry-run": {
|
7423
|
+
tvl: {
|
7424
|
+
":campaignId": {
|
7425
|
+
get: {
|
7426
|
+
body: unknown;
|
7427
|
+
params: {
|
7428
|
+
campaignId: string;
|
7429
|
+
};
|
7430
|
+
query: unknown;
|
7431
|
+
headers: {
|
7432
|
+
authorization: string;
|
7433
|
+
};
|
7434
|
+
response: {
|
7435
|
+
200: unknown[];
|
7436
|
+
};
|
7432
7437
|
};
|
7433
7438
|
};
|
7434
7439
|
};
|
7435
7440
|
};
|
7436
7441
|
} & {
|
7437
|
-
"dry-
|
7438
|
-
|
7439
|
-
|
7440
|
-
|
7441
|
-
|
7442
|
-
|
7443
|
-
|
7444
|
-
|
7445
|
-
|
7446
|
-
|
7447
|
-
|
7448
|
-
|
7449
|
-
|
7442
|
+
"dry-run": {
|
7443
|
+
tvls: {
|
7444
|
+
":opportunityId": {
|
7445
|
+
get: {
|
7446
|
+
body: unknown;
|
7447
|
+
params: {
|
7448
|
+
opportunityId: string;
|
7449
|
+
};
|
7450
|
+
query: unknown;
|
7451
|
+
headers: {
|
7452
|
+
authorization: string;
|
7453
|
+
};
|
7454
|
+
response: {
|
7455
|
+
200: unknown[];
|
7456
|
+
};
|
7450
7457
|
};
|
7451
7458
|
};
|
7452
7459
|
};
|
@@ -13285,6 +13292,19 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13285
13292
|
};
|
13286
13293
|
}>>;
|
13287
13294
|
};
|
13295
|
+
tvls: ((params: {
|
13296
|
+
opportunityId: string | number;
|
13297
|
+
}) => {
|
13298
|
+
put: (body: unknown, options: {
|
13299
|
+
headers: {
|
13300
|
+
authorization: string;
|
13301
|
+
};
|
13302
|
+
query?: Record<string, unknown> | undefined;
|
13303
|
+
fetch?: RequestInit | undefined;
|
13304
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13305
|
+
200: unknown[];
|
13306
|
+
}>>;
|
13307
|
+
}) & {};
|
13288
13308
|
index: {
|
13289
13309
|
get: (options: {
|
13290
13310
|
headers?: Record<string, unknown> | undefined;
|
@@ -13557,47 +13577,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13557
13577
|
}>>;
|
13558
13578
|
};
|
13559
13579
|
};
|
13560
|
-
"dry-runtvl": ((params: {
|
13561
|
-
campaignId: string | number;
|
13562
|
-
}) => {
|
13563
|
-
get: (options: {
|
13564
|
-
headers: {
|
13565
|
-
authorization: string;
|
13566
|
-
};
|
13567
|
-
query?: Record<string, unknown> | undefined;
|
13568
|
-
fetch?: RequestInit | undefined;
|
13569
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13570
|
-
200: unknown[];
|
13571
|
-
}>>;
|
13572
|
-
}) & {};
|
13573
|
-
"dry-runtvls": ((params: {
|
13574
|
-
opportunityId: string | number;
|
13575
|
-
}) => {
|
13576
|
-
get: (options: {
|
13577
|
-
headers: {
|
13578
|
-
authorization: string;
|
13579
|
-
};
|
13580
|
-
query?: Record<string, unknown> | undefined;
|
13581
|
-
fetch?: RequestInit | undefined;
|
13582
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13583
|
-
200: unknown[];
|
13584
|
-
}>>;
|
13585
|
-
}) & {};
|
13586
13580
|
"dry-run": {
|
13587
|
-
|
13588
|
-
|
13589
|
-
|
13590
|
-
|
13591
|
-
|
13592
|
-
|
13593
|
-
|
13594
|
-
|
13595
|
-
|
13596
|
-
|
13597
|
-
|
13598
|
-
}
|
13599
|
-
}
|
13600
|
-
tvl: {
|
13581
|
+
tvl: ((params: {
|
13582
|
+
campaignId: string | number;
|
13583
|
+
}) => {
|
13584
|
+
get: (options: {
|
13585
|
+
headers: {
|
13586
|
+
authorization: string;
|
13587
|
+
};
|
13588
|
+
query?: Record<string, unknown> | undefined;
|
13589
|
+
fetch?: RequestInit | undefined;
|
13590
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13591
|
+
200: unknown[];
|
13592
|
+
}>>;
|
13593
|
+
}) & {
|
13601
13594
|
post: (body: {
|
13602
13595
|
id?: string | undefined;
|
13603
13596
|
subType?: number | undefined;
|
@@ -13643,6 +13636,31 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13643
13636
|
};
|
13644
13637
|
}>>;
|
13645
13638
|
};
|
13639
|
+
tvls: ((params: {
|
13640
|
+
opportunityId: string | number;
|
13641
|
+
}) => {
|
13642
|
+
get: (options: {
|
13643
|
+
headers: {
|
13644
|
+
authorization: string;
|
13645
|
+
};
|
13646
|
+
query?: Record<string, unknown> | undefined;
|
13647
|
+
fetch?: RequestInit | undefined;
|
13648
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13649
|
+
200: unknown[];
|
13650
|
+
}>>;
|
13651
|
+
}) & {
|
13652
|
+
list: {
|
13653
|
+
post: (body: string[], options: {
|
13654
|
+
headers: {
|
13655
|
+
authorization: string;
|
13656
|
+
};
|
13657
|
+
query?: Record<string, unknown> | undefined;
|
13658
|
+
fetch?: RequestInit | undefined;
|
13659
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13660
|
+
200: unknown[];
|
13661
|
+
}>>;
|
13662
|
+
};
|
13663
|
+
};
|
13646
13664
|
metadata: {
|
13647
13665
|
post: (body: {
|
13648
13666
|
id?: string | undefined;
|
@@ -13863,17 +13881,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13863
13881
|
};
|
13864
13882
|
};
|
13865
13883
|
};
|
13866
|
-
campaignstvls: ((params: {
|
13867
|
-
opportunityId: string | number;
|
13868
|
-
}) => {
|
13869
|
-
put: (body?: unknown, options?: {
|
13870
|
-
headers?: Record<string, unknown> | undefined;
|
13871
|
-
query?: Record<string, unknown> | undefined;
|
13872
|
-
fetch?: RequestInit | undefined;
|
13873
|
-
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
13874
|
-
200: unknown[];
|
13875
|
-
}>>;
|
13876
|
-
}) & {};
|
13877
13884
|
campaignscount: {
|
13878
13885
|
"by-chains": {
|
13879
13886
|
get: (options: {
|
@@ -4,6 +4,7 @@ const ownerAddresses = {
|
|
4
4
|
"0x42a856dbEBB97AbC1269EAB32f3bb40C15102819": Erc20SubType.satlayer,
|
5
5
|
"0x4C911bf7A008C497719CBEb1a376f1cEc9e2c1d6": Erc20SubType.hanji_liquidity_vault_token,
|
6
6
|
"0x6e9d701fB6478Ed5972a37886C2BA6C82a4cBb4C": Erc20SubType.gamma, // Gamma Bob owner
|
7
|
+
"0x14fB20565a11b15cA2065A06740A0C46F5986eD0": Erc20SubType.lendle_vaults, // Gamma Alice owner
|
7
8
|
};
|
8
9
|
export function getTypeFromOwnerAddress(address) {
|
9
10
|
if (ownerAddresses[address]) {
|
@@ -3,6 +3,8 @@ import { EulerMetadata } from "./implementations/euler/metadata";
|
|
3
3
|
import { EulerTVLBuilder } from "./implementations/euler/tvl";
|
4
4
|
import { GearboxMetadata } from "./implementations/gearbox/metadata";
|
5
5
|
import { GearboxTVLBuilder } from "./implementations/gearbox/tvl";
|
6
|
+
import { LendleMetadata } from "./implementations/lendleVaults/metadata";
|
7
|
+
import { LendleTVLBuilder } from "./implementations/lendleVaults/tvl";
|
6
8
|
import { SuperlendMetadata } from "./implementations/superlend/metadata";
|
7
9
|
import { SuperlendTVLBuilder } from "./implementations/superlend/tvl";
|
8
10
|
/**
|
@@ -17,6 +19,7 @@ const tvlMap = {
|
|
17
19
|
[Erc20SubType.superlend_lending]: new SuperlendTVLBuilder(),
|
18
20
|
[Erc20SubType.euler_borrow]: new EulerTVLBuilder(),
|
19
21
|
[Erc20SubType.euler_lend]: new EulerTVLBuilder(),
|
22
|
+
[Erc20SubType.lendle_vaults]: new LendleTVLBuilder(),
|
20
23
|
};
|
21
24
|
export const erc20SubTypeTVLBuilderFactory = (erc20Subtype) => {
|
22
25
|
if (!tvlMap[erc20Subtype]) {
|
@@ -36,6 +39,7 @@ const metadataMap = {
|
|
36
39
|
[Erc20SubType.superlend_lending]: new SuperlendMetadata(),
|
37
40
|
[Erc20SubType.euler_borrow]: new EulerMetadata(),
|
38
41
|
[Erc20SubType.euler_lend]: new EulerMetadata(),
|
42
|
+
[Erc20SubType.lendle_vaults]: new LendleMetadata(),
|
39
43
|
};
|
40
44
|
export const erc20SubTypeMetadataBuilderFactory = (erc20Subtype) => {
|
41
45
|
if (!metadataMap[erc20Subtype]) {
|
package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/metadata.d.ts
ADDED
@@ -0,0 +1,16 @@
|
|
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 LendleMetadata implements MetadataBuilder<Erc20LikeCampaignEnum> {
|
6
|
+
build(campaign: Omit<CampaignWithParams<Erc20LikeCampaignEnum>, "manualOverrides">): Promise<{
|
7
|
+
action: "LEND";
|
8
|
+
mainProtocol: ProtocolId;
|
9
|
+
name: string;
|
10
|
+
tokens: {
|
11
|
+
chainId: number;
|
12
|
+
address: any;
|
13
|
+
}[];
|
14
|
+
explorerAddress: any;
|
15
|
+
}>;
|
16
|
+
}
|
package/dist/src/engine/implementations/Erc20/subTypes/implementations/lendleVaults/metadata.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { OpportunityAction } from "@db/api";
|
2
|
+
import { ChainInteractionService, LendleVault__factory, TokenInteractionService } from "@sdk";
|
3
|
+
export class LendleMetadata {
|
4
|
+
async build(campaign) {
|
5
|
+
const { params, computeChainId } = campaign;
|
6
|
+
const { targetToken } = params;
|
7
|
+
const underlyingToken = await LendleVault__factory.connect(targetToken, ChainInteractionService(computeChainId).provider()).want();
|
8
|
+
const underlyingTokenSymbol = await TokenInteractionService(computeChainId).symbol(underlyingToken);
|
9
|
+
return {
|
10
|
+
action: OpportunityAction.LEND,
|
11
|
+
mainProtocol: "lendle",
|
12
|
+
name: `Deposit ${underlyingTokenSymbol} on Lendle vaults`,
|
13
|
+
tokens: [
|
14
|
+
{ chainId: computeChainId, address: targetToken },
|
15
|
+
{ chainId: computeChainId, address: underlyingToken },
|
16
|
+
],
|
17
|
+
explorerAddress: params.targetToken,
|
18
|
+
};
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,6 @@
|
|
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 LendleTVLBuilder implements TVLBuilder<Erc20LikeCampaignEnum> {
|
5
|
+
build(computeChainId: MerklChainId, campaigns: CampaignParameters<Erc20LikeCampaignEnum>[]): Promise<TVLData<any>>;
|
6
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { TokenService } from "@/modules/v4/token/token.service";
|
2
|
+
import { TvlType } from "@db/api";
|
3
|
+
import { ChainInteractionService, LendleVaultInterface, bigIntToNumber, } from "@sdk";
|
4
|
+
export class LendleTVLBuilder {
|
5
|
+
async build(computeChainId, campaigns) {
|
6
|
+
const tvls = [];
|
7
|
+
const calls = [];
|
8
|
+
for (const campaign of campaigns) {
|
9
|
+
const { targetToken } = campaign.campaignParameters;
|
10
|
+
calls.push({
|
11
|
+
allowFailure: true,
|
12
|
+
callData: LendleVaultInterface.encodeFunctionData("want"),
|
13
|
+
target: targetToken,
|
14
|
+
}, {
|
15
|
+
allowFailure: true,
|
16
|
+
callData: LendleVaultInterface.encodeFunctionData("getPricePerFullShare"),
|
17
|
+
target: targetToken,
|
18
|
+
}, {
|
19
|
+
allowFailure: true,
|
20
|
+
callData: LendleVaultInterface.encodeFunctionData("totalSupply"),
|
21
|
+
target: targetToken,
|
22
|
+
});
|
23
|
+
}
|
24
|
+
const result = await ChainInteractionService(computeChainId).fetchState(calls);
|
25
|
+
for (const [index, campaign] of campaigns.entries()) {
|
26
|
+
const underlyingTokenAddress = LendleVaultInterface.decodeFunctionResult("want", result[3 * index].returnData)[0];
|
27
|
+
const underlyingPerShare = LendleVaultInterface.decodeFunctionResult("getPricePerFullShare", result[3 * index + 1].returnData)[0];
|
28
|
+
const totalSupply = LendleVaultInterface.decodeFunctionResult("totalSupply", result[3 * index + 2].returnData)[0];
|
29
|
+
const underlyingToken = await TokenService.findUniqueFillOrThrow({
|
30
|
+
chainId: computeChainId,
|
31
|
+
address: underlyingTokenAddress,
|
32
|
+
});
|
33
|
+
if (!underlyingToken.decimals || !underlyingToken.price) {
|
34
|
+
throw new Error(`Missing decimals or price for token ${underlyingToken.address}`);
|
35
|
+
}
|
36
|
+
const totalAssets = bigIntToNumber(underlyingPerShare, 18) *
|
37
|
+
bigIntToNumber(totalSupply, campaign.campaignParameters.decimalsTargetToken);
|
38
|
+
const tvl = totalAssets * underlyingToken.price;
|
39
|
+
tvls.push({
|
40
|
+
campaign,
|
41
|
+
tvl,
|
42
|
+
tvlBreakdown: [
|
43
|
+
{
|
44
|
+
identifier: underlyingToken.id,
|
45
|
+
type: TvlType.TOKEN,
|
46
|
+
value: totalAssets,
|
47
|
+
},
|
48
|
+
],
|
49
|
+
});
|
50
|
+
}
|
51
|
+
return tvls;
|
52
|
+
}
|
53
|
+
}
|
package/dist/src/index.d.ts
CHANGED
@@ -1552,6 +1552,24 @@ declare const app: Elysia<"", false, {
|
|
1552
1552
|
};
|
1553
1553
|
};
|
1554
1554
|
};
|
1555
|
+
} & {
|
1556
|
+
tvls: {
|
1557
|
+
":opportunityId": {
|
1558
|
+
put: {
|
1559
|
+
body: unknown;
|
1560
|
+
params: {
|
1561
|
+
opportunityId: string;
|
1562
|
+
};
|
1563
|
+
query: unknown;
|
1564
|
+
headers: {
|
1565
|
+
authorization: string;
|
1566
|
+
};
|
1567
|
+
response: {
|
1568
|
+
200: unknown[];
|
1569
|
+
};
|
1570
|
+
};
|
1571
|
+
};
|
1572
|
+
};
|
1555
1573
|
} & {
|
1556
1574
|
index: {
|
1557
1575
|
get: {
|
@@ -1832,21 +1850,6 @@ declare const app: Elysia<"", false, {
|
|
1832
1850
|
};
|
1833
1851
|
};
|
1834
1852
|
};
|
1835
|
-
campaignstvls: {
|
1836
|
-
":opportunityId": {
|
1837
|
-
put: {
|
1838
|
-
body: unknown;
|
1839
|
-
params: {
|
1840
|
-
opportunityId: string;
|
1841
|
-
};
|
1842
|
-
query: unknown;
|
1843
|
-
headers: unknown;
|
1844
|
-
response: {
|
1845
|
-
200: unknown[];
|
1846
|
-
};
|
1847
|
-
};
|
1848
|
-
};
|
1849
|
-
};
|
1850
1853
|
} & {
|
1851
1854
|
campaigns: {
|
1852
1855
|
index: {
|
@@ -2128,37 +2131,41 @@ declare const app: Elysia<"", false, {
|
|
2128
2131
|
} & {
|
2129
2132
|
v4: {
|
2130
2133
|
campaigns: {
|
2131
|
-
"dry-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2134
|
+
"dry-run": {
|
2135
|
+
tvl: {
|
2136
|
+
":campaignId": {
|
2137
|
+
get: {
|
2138
|
+
body: unknown;
|
2139
|
+
params: {
|
2140
|
+
campaignId: string;
|
2141
|
+
};
|
2142
|
+
query: unknown;
|
2143
|
+
headers: {
|
2144
|
+
authorization: string;
|
2145
|
+
};
|
2146
|
+
response: {
|
2147
|
+
200: unknown[];
|
2148
|
+
};
|
2144
2149
|
};
|
2145
2150
|
};
|
2146
2151
|
};
|
2147
2152
|
};
|
2148
2153
|
} & {
|
2149
|
-
"dry-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2154
|
+
"dry-run": {
|
2155
|
+
tvls: {
|
2156
|
+
":opportunityId": {
|
2157
|
+
get: {
|
2158
|
+
body: unknown;
|
2159
|
+
params: {
|
2160
|
+
opportunityId: string;
|
2161
|
+
};
|
2162
|
+
query: unknown;
|
2163
|
+
headers: {
|
2164
|
+
authorization: string;
|
2165
|
+
};
|
2166
|
+
response: {
|
2167
|
+
200: unknown[];
|
2168
|
+
};
|
2162
2169
|
};
|
2163
2170
|
};
|
2164
2171
|
};
|