@merkl/api 0.20.145 → 0.20.147
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.
@@ -6,12 +6,13 @@ export class EulerTVLBuilder {
|
|
6
6
|
const tvls = [];
|
7
7
|
const calls = [];
|
8
8
|
for (const campaign of campaigns) {
|
9
|
-
const {
|
9
|
+
const { campaignParameters, campaignId } = campaign;
|
10
|
+
const { evkAddress, subCampaignType } = campaignParameters;
|
10
11
|
if (subCampaignType === EulerSubCampaignType.LEND) {
|
11
12
|
calls.push({
|
12
13
|
callData: EulerEVKInterface.encodeFunctionData("totalAssets"),
|
13
14
|
target: evkAddress,
|
14
|
-
key:
|
15
|
+
key: `totalUnderlying_${campaignId}`,
|
15
16
|
decoder: (data) => BigInt(EulerEVKInterface.decodeFunctionResult("totalAssets", data)[0].toString()),
|
16
17
|
});
|
17
18
|
}
|
@@ -19,14 +20,15 @@ export class EulerTVLBuilder {
|
|
19
20
|
calls.push({
|
20
21
|
callData: EulerEVKInterface.encodeFunctionData("totalBorrows"),
|
21
22
|
target: evkAddress,
|
22
|
-
key:
|
23
|
+
key: `totalUnderlying_${campaignId}`,
|
23
24
|
decoder: (data) => BigInt(EulerEVKInterface.decodeFunctionResult("totalBorrows", data)[0].toString()),
|
24
25
|
});
|
25
26
|
}
|
26
27
|
}
|
27
28
|
const result = await ChainInteractionService(computeChainId).fetchAndDecodeObject(calls);
|
28
29
|
for (const [_, campaign] of campaigns.entries()) {
|
29
|
-
const
|
30
|
+
const { campaignId } = campaign;
|
31
|
+
const totalAssets = result[`totalUnderlying_${campaignId}`];
|
30
32
|
const underlylingTokenAddress = campaign.campaignParameters.addressAsset;
|
31
33
|
const underlyingToken = await TokenService.findUniqueFillOrThrow({
|
32
34
|
chainId: computeChainId,
|
@@ -128,7 +128,6 @@ export class DynamicDataService {
|
|
128
128
|
});
|
129
129
|
}
|
130
130
|
// 2.b.3 APR is obtained from daily rewards and tvl following the distribution type
|
131
|
-
// TODO: switch on distribution type - dailyRewards can be in token amount
|
132
131
|
let aprCampaignValue;
|
133
132
|
if (rewardToken.isPoint) {
|
134
133
|
aprCampaignValue = campaignDailyValue / record.tvl;
|