@merkl/api 0.10.266 → 0.10.268
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/entities/opportunity.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/VestDynamicData.js +2 -2
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.service.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +8 -6
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -446,7 +446,7 @@ export const extractOpportunities = {
|
|
446
446
|
const opportunity = {
|
447
447
|
id: `${Campaign.VEST}_${campaign.mainParameter}`,
|
448
448
|
platform: "Vest supply",
|
449
|
-
name: ["
|
449
|
+
name: ["Supply USDC.e on Vest"].join(" "),
|
450
450
|
chainId: !computeChainId ? chainId : computeChainId,
|
451
451
|
distributionChainId: chainId,
|
452
452
|
tvl,
|
@@ -24,7 +24,7 @@ export async function VestDynamicData(_chainId, campaigns) {
|
|
24
24
|
for (const campaign of campaigns) {
|
25
25
|
let totalSupply;
|
26
26
|
try {
|
27
|
-
totalSupply = ERC20Interface.decodeFunctionResult("balanceOf", result[i++])[0];
|
27
|
+
totalSupply = BN2Number(ERC20Interface.decodeFunctionResult("balanceOf", result[i++])[0], 6);
|
28
28
|
}
|
29
29
|
catch {
|
30
30
|
log.warn(`Error getting totalSupply for campaign ${campaign.campaignId}`);
|
@@ -38,7 +38,7 @@ export async function VestDynamicData(_chainId, campaigns) {
|
|
38
38
|
const priceTargetToken = (await pricer.get({
|
39
39
|
address: VEST_TOKEN,
|
40
40
|
chainId: campaign.computeChainId,
|
41
|
-
symbol:
|
41
|
+
symbol: "USDC.e",
|
42
42
|
})) ?? 0;
|
43
43
|
const tvl = totalSupply * priceTargetToken;
|
44
44
|
dynamicData.push({
|
@@ -36,6 +36,7 @@ export declare const campaignTypeToEnumMap: {
|
|
36
36
|
readonly EIGENLAYER: any;
|
37
37
|
readonly VEST: any;
|
38
38
|
readonly ION: any;
|
39
|
+
readonly ERC20TRANSFERS: any;
|
39
40
|
};
|
40
41
|
export type ConvertedCampaignType<C extends CampaignType> = (typeof campaignTypeToEnumMap)[C];
|
41
42
|
export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
@@ -23,6 +23,7 @@ export const campaignTypeToEnumMap = {
|
|
23
23
|
EIGENLAYER: CampaignTypeEnum.EIGENLAYER,
|
24
24
|
VEST: CampaignTypeEnum.VEST,
|
25
25
|
ION: CampaignTypeEnum.ION,
|
26
|
+
ERC20TRANSFERS: CampaignTypeEnum.ERC20TRANSFERS,
|
26
27
|
};
|
27
28
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
28
29
|
export const CampaignUniqueDto = t.Object({
|
@@ -15,7 +15,7 @@ export class CampaignService {
|
|
15
15
|
}
|
16
16
|
static async create(campaign) {
|
17
17
|
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
18
|
-
await OpportunityService.createFromCampaign(campaign);
|
18
|
+
await OpportunityService.createFromCampaign(campaign);
|
19
19
|
return await CampaignRepository.upsert({ id, ...campaign });
|
20
20
|
}
|
21
21
|
static async createMany(campaigns) {
|
@@ -25,7 +25,7 @@ export class CampaignService {
|
|
25
25
|
const id = CampaignService.hashId({ distributionChain: campaign.chainId, campaignId: campaign.campaignId });
|
26
26
|
campaign.computeChainId = campaign.computeChainId === 0 ? campaign.chainId : campaign.computeChainId;
|
27
27
|
try {
|
28
|
-
await OpportunityService.createFromCampaign(campaign
|
28
|
+
await OpportunityService.createFromCampaign(campaign);
|
29
29
|
campaignsToInsert.push({ id, ...campaign });
|
30
30
|
}
|
31
31
|
catch (err) {
|
@@ -25,7 +25,7 @@ export class OpportunityRepository {
|
|
25
25
|
DailyRewardsBreakdown: {
|
26
26
|
where: {
|
27
27
|
Campaign: {
|
28
|
-
RewardToken: { isTest:
|
28
|
+
RewardToken: withTest ? undefined : { isTest: false },
|
29
29
|
},
|
30
30
|
},
|
31
31
|
include: {
|
@@ -132,7 +132,9 @@ export class OpportunityRepository {
|
|
132
132
|
Chain: true,
|
133
133
|
MainProtocol: true,
|
134
134
|
Protocols: true,
|
135
|
-
Tokens:
|
135
|
+
Tokens: {
|
136
|
+
where: !withTest ? { isTest: false } : undefined,
|
137
|
+
},
|
136
138
|
},
|
137
139
|
where: { id },
|
138
140
|
});
|
@@ -140,7 +142,7 @@ export class OpportunityRepository {
|
|
140
142
|
static async findUniqueOrThrowWithCampaigns(id, withTest) {
|
141
143
|
const b = await apiDbClient.opportunity.findUniqueOrThrow({
|
142
144
|
include: {
|
143
|
-
...OpportunityRepository.#getRecordInclusion(),
|
145
|
+
...OpportunityRepository.#getRecordInclusion(withTest),
|
144
146
|
Chain: {
|
145
147
|
include: {
|
146
148
|
Explorer: true,
|
@@ -247,18 +249,18 @@ export class OpportunityRepository {
|
|
247
249
|
const { page: _page, items: _items } = query;
|
248
250
|
const page = _page ? _page : 0;
|
249
251
|
const items = _items ? _items : 20;
|
250
|
-
const
|
252
|
+
const withTest = query.test ?? false;
|
251
253
|
const args = OpportunityRepository.#transformQueryToPrismaFilters(query);
|
252
254
|
return await apiDbClient.opportunity.findMany({
|
253
255
|
take: items,
|
254
256
|
skip: page * items,
|
255
257
|
include: {
|
256
|
-
...OpportunityRepository.#getRecordInclusion(
|
258
|
+
...OpportunityRepository.#getRecordInclusion(withTest),
|
257
259
|
MainProtocol: true,
|
258
260
|
Chain: true,
|
259
261
|
Protocols: true,
|
260
262
|
Tokens: {
|
261
|
-
where: !
|
263
|
+
where: !withTest ? { isTest: false } : undefined,
|
262
264
|
},
|
263
265
|
},
|
264
266
|
...args,
|