@merkl/api 0.10.246 → 0.10.248
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.js +4 -0
- package/dist/src/eden/index.d.ts +6 -0
- package/dist/src/entities/opportunity.js +8 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicData.js +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/getTVL.d.ts +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/getTVL.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AssetProcessor.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +4 -0
- package/dist/src/modules/v4/opportunity/subservices/getErc20Metadata.service.js +12 -1
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +7 -2
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.repository.js +7 -2
- package/dist/src/modules/v4/reward/reward.service.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.service.js +4 -4
- package/dist/src/modules/v4/router.d.ts +2 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -0
- package/dist/src/modules/v4/user/user.controller.js +2 -2
- package/dist/src/modules/v4/user/user.model.d.ts +2 -0
- package/dist/src/modules/v4/user/user.model.js +2 -0
- package/dist/src/utils/decodeCalls.js +10 -0
- package/dist/src/utils/encodeCalls.js +10 -0
- package/dist/src/utils/generateCardName.js +4 -2
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -119,6 +119,10 @@ export const campaignsCacheUpdater = new Elysia().get("/v3/update", async ({ que
|
|
119
119
|
identifier: mainParameter,
|
120
120
|
type: CampaignService.getTypeFromV3(+type),
|
121
121
|
});
|
122
|
+
// @TO_REMOVE - 17 is the VEST campaign type, needs to be removed when updating SDK with VEST
|
123
|
+
if (type === "17") {
|
124
|
+
continue;
|
125
|
+
}
|
122
126
|
await OpportunityRepository.updateRecords(opportunityId, apr, tvl, dailyRewards);
|
123
127
|
}
|
124
128
|
await OpportunityService.updateMetadata(chainId);
|
package/dist/src/eden/index.d.ts
CHANGED
@@ -1436,6 +1436,7 @@ declare const eden: {
|
|
1436
1436
|
get: (options: {
|
1437
1437
|
headers?: Record<string, unknown> | undefined;
|
1438
1438
|
query: {
|
1439
|
+
test?: boolean | undefined;
|
1439
1440
|
chainIds?: number[] | undefined;
|
1440
1441
|
reloadChainId?: number | undefined;
|
1441
1442
|
};
|
@@ -1541,6 +1542,7 @@ declare const eden: {
|
|
1541
1542
|
get: (options: {
|
1542
1543
|
headers?: Record<string, unknown> | undefined;
|
1543
1544
|
query: {
|
1545
|
+
test?: boolean | undefined;
|
1544
1546
|
reloadChainId?: number | undefined;
|
1545
1547
|
chainId: number[];
|
1546
1548
|
};
|
@@ -4564,6 +4566,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4564
4566
|
address: string;
|
4565
4567
|
};
|
4566
4568
|
query: {
|
4569
|
+
test?: boolean | undefined;
|
4567
4570
|
chainIds?: number[] | undefined;
|
4568
4571
|
reloadChainId?: number | undefined;
|
4569
4572
|
};
|
@@ -4680,6 +4683,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4680
4683
|
address: string;
|
4681
4684
|
};
|
4682
4685
|
query: {
|
4686
|
+
test?: boolean | undefined;
|
4683
4687
|
reloadChainId?: number | undefined;
|
4684
4688
|
chainId: number[];
|
4685
4689
|
};
|
@@ -7624,6 +7628,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7624
7628
|
get: (options: {
|
7625
7629
|
headers?: Record<string, unknown> | undefined;
|
7626
7630
|
query: {
|
7631
|
+
test?: boolean | undefined;
|
7627
7632
|
chainIds?: number[] | undefined;
|
7628
7633
|
reloadChainId?: number | undefined;
|
7629
7634
|
};
|
@@ -7729,6 +7734,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7729
7734
|
get: (options: {
|
7730
7735
|
headers?: Record<string, unknown> | undefined;
|
7731
7736
|
query: {
|
7737
|
+
test?: boolean | undefined;
|
7732
7738
|
reloadChainId?: number | undefined;
|
7733
7739
|
chainId: number[];
|
7734
7740
|
};
|
@@ -194,6 +194,7 @@ export const extractOpportunities = {
|
|
194
194
|
[Campaign.ERC20]: (campaign, campaigns, prices) => {
|
195
195
|
const { chainId, tvl, campaignParameters: params, typeInfo, computeChainId, mainParameter } = campaign;
|
196
196
|
const { active, all } = campaigns;
|
197
|
+
// DEPRECATED!!!!
|
197
198
|
const map = {
|
198
199
|
actions: {
|
199
200
|
pool: [
|
@@ -212,6 +213,10 @@ export const extractOpportunities = {
|
|
212
213
|
"pancakeswap",
|
213
214
|
"tempest",
|
214
215
|
"cross_curve",
|
216
|
+
"zkswap",
|
217
|
+
"maverickBoostedPosition",
|
218
|
+
"zkSwapThreePool",
|
219
|
+
"syncswap",
|
215
220
|
],
|
216
221
|
borrow: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
|
217
222
|
lend: [
|
@@ -229,6 +234,9 @@ export const extractOpportunities = {
|
|
229
234
|
"euler_lend",
|
230
235
|
"layerbank",
|
231
236
|
"zerolend_lending",
|
237
|
+
"venus",
|
238
|
+
"reactor_fusion",
|
239
|
+
"woofi",
|
232
240
|
],
|
233
241
|
},
|
234
242
|
icons: {
|
package/dist/src/index.d.ts
CHANGED
@@ -1824,6 +1824,7 @@ declare const app: Elysia<"", false, {
|
|
1824
1824
|
address: string;
|
1825
1825
|
};
|
1826
1826
|
query: {
|
1827
|
+
test?: boolean | undefined;
|
1827
1828
|
chainIds?: number[] | undefined;
|
1828
1829
|
reloadChainId?: number | undefined;
|
1829
1830
|
};
|
@@ -1940,6 +1941,7 @@ declare const app: Elysia<"", false, {
|
|
1940
1941
|
address: string;
|
1941
1942
|
};
|
1942
1943
|
query: {
|
1944
|
+
test?: boolean | undefined;
|
1943
1945
|
reloadChainId?: number | undefined;
|
1944
1946
|
chainId: number[];
|
1945
1947
|
};
|
@@ -3,6 +3,7 @@ import { BN2Number, BalancerPoolInterface, ERC20Interface, EnzymeInterface, Fact
|
|
3
3
|
import { batchMulticallCallWithRetry } from "../../../utils/generic";
|
4
4
|
import { Pricer } from "../../../utils/pricer";
|
5
5
|
import { getLastEligibilityRatio } from "../utils/getLastEligibilityRatio";
|
6
|
+
import { getTVL } from "./ERC20SubTypes/helpers/getTVL";
|
6
7
|
import { tokenType } from "./ERC20SubTypes/helpers/tokenType";
|
7
8
|
import { getTokenPricesInfo } from "./ERC20SubTypes/subtypesPrices";
|
8
9
|
import { getTokenTypeRound1 } from "./ERC20SubTypes/subtypesRound1";
|
@@ -146,7 +147,7 @@ export async function ERC20DynamicData(chainId, campaigns) {
|
|
146
147
|
campaign.campaignParameters.duration /
|
147
148
|
(whitelistedSupplyTargetToken * priceTargetToken),
|
148
149
|
totalSupplyTargetToken,
|
149
|
-
tvl: whitelistedSupplyTargetToken
|
150
|
+
tvl: getTVL(tokenTypesByCampaign[campaign.campaignId].typeInfo.type, totalSupplyTargetToken, whitelistedSupplyTargetToken, priceTargetToken),
|
150
151
|
type: tokenTypesByCampaign[campaign.campaignId].type,
|
151
152
|
typeInfo: tokenTypesByCampaign[campaign.campaignId].typeInfo,
|
152
153
|
priceRewardToken: priceRewardToken,
|
@@ -61,7 +61,9 @@ export declare enum tokenType {
|
|
61
61
|
staking = "staking",
|
62
62
|
noLinkVault = "noLinkVault",
|
63
63
|
cpmmGamma = "cpmmGamma",
|
64
|
-
crosscurve = "crosscurve"
|
64
|
+
crosscurve = "crosscurve",
|
65
|
+
venus = "venus",
|
66
|
+
reactor_fusion = "reactor_fusion"
|
65
67
|
}
|
66
68
|
export declare const tokenTypeToProtocol: {
|
67
69
|
[key in tokenType]: {
|
@@ -63,6 +63,8 @@ export var tokenType;
|
|
63
63
|
tokenType["noLinkVault"] = "noLinkVault";
|
64
64
|
tokenType["cpmmGamma"] = "cpmmGamma";
|
65
65
|
tokenType["crosscurve"] = "crosscurve";
|
66
|
+
tokenType["venus"] = "venus";
|
67
|
+
tokenType["reactor_fusion"] = "reactor_fusion";
|
66
68
|
})(tokenType || (tokenType = {}));
|
67
69
|
export const tokenTypeToProtocol = {
|
68
70
|
[tokenType.aave_borrowing]: { protocol: "Aave" },
|
@@ -98,6 +100,7 @@ export const tokenTypeToProtocol = {
|
|
98
100
|
[tokenType.ra]: { protocol: "Ra" },
|
99
101
|
[tokenType.radiant_borrow]: { protocol: "Radiant" },
|
100
102
|
[tokenType.radiant_lend]: { protocol: "Radiant" },
|
103
|
+
[tokenType.reactor_fusion]: { protocol: "Reactor Fusion" },
|
101
104
|
[tokenType.silostaking]: { protocol: "Silo Staking", symbolUnderlyingToken: "SEI" },
|
102
105
|
[tokenType.splice]: { protocol: "Splice" },
|
103
106
|
[tokenType.sturdy_aggregator]: { protocol: "Sturdy" },
|
@@ -106,6 +109,7 @@ export const tokenTypeToProtocol = {
|
|
106
109
|
[tokenType.toros]: { protocol: "Toros" },
|
107
110
|
[tokenType.uniswapv2]: { protocol: "Uniswap V2" },
|
108
111
|
[tokenType.velodrome]: { protocol: "Velodrome V2" },
|
112
|
+
[tokenType.venus]: { protocol: "Venus" },
|
109
113
|
[tokenType.unknown]: { protocol: "Unknown" },
|
110
114
|
[tokenType.yei_borrowing]: { protocol: "Yei Finance" },
|
111
115
|
[tokenType.yei_lending]: { protocol: "Yei Finance" },
|
@@ -24,8 +24,8 @@ export class AssetProcessor extends GenericProcessor {
|
|
24
24
|
}
|
25
25
|
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
26
26
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
27
|
-
let exchangeRate = BN2Number(typeInfo.exchangeRate
|
28
|
-
if (type === tokenType.moonwell) {
|
27
|
+
let exchangeRate = BN2Number(typeInfo.exchangeRate);
|
28
|
+
if (type === tokenType.moonwell || type === tokenType.venus) {
|
29
29
|
exchangeRate =
|
30
30
|
exchangeRate /
|
31
31
|
10 ** (Number(typeInfo.decimalsUnderlyingToken) - campaign.campaignParameters.decimalsTargetToken);
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js
CHANGED
@@ -50,8 +50,8 @@ export class MaverickBPProcessor extends GenericProcessor {
|
|
50
50
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
51
51
|
const decimalsTokenA = Number(typeInfo.decimalsTokenA);
|
52
52
|
const decimalsTokenB = Number(typeInfo.decimalsTokenB);
|
53
|
-
const amountA = BN2Number(typeInfo.amountA,
|
54
|
-
const amountB = BN2Number(typeInfo.amountB,
|
53
|
+
const amountA = BN2Number(typeInfo.amountA, 18);
|
54
|
+
const amountB = BN2Number(typeInfo.amountB, 18);
|
55
55
|
const tokenAPRice = (await pricer.get({ symbol: typeInfo.symbolTokenA })) ?? 0;
|
56
56
|
const tokenBPrice = (await pricer.get({ symbol: typeInfo.symbolTokenB })) ?? 0;
|
57
57
|
const tvl = tokenAPRice * amountA + tokenBPrice * amountB;
|
@@ -33,6 +33,10 @@ function satisfiesNameConditions(name, type) {
|
|
33
33
|
return lowerCaseName.includes("radiant variable debt");
|
34
34
|
case tokenType.ionic:
|
35
35
|
return lowerCaseName.includes("ionic");
|
36
|
+
case tokenType.venus:
|
37
|
+
return lowerCaseName.startsWith("venus");
|
38
|
+
case tokenType.reactor_fusion:
|
39
|
+
return lowerCaseName.startsWith("reactorfusion");
|
36
40
|
case tokenType.rfx:
|
37
41
|
return lowerCaseName.includes("rfx");
|
38
42
|
case tokenType.layerbank:
|
@@ -28,8 +28,15 @@ export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount,
|
|
28
28
|
"dragonswap",
|
29
29
|
"poolside",
|
30
30
|
"koi",
|
31
|
+
"pancakeswap",
|
32
|
+
"tempest",
|
33
|
+
"cross_curve",
|
34
|
+
"zkswap",
|
35
|
+
"maverickBoostedPosition",
|
36
|
+
"zkSwapThreePool",
|
37
|
+
"syncswap",
|
31
38
|
],
|
32
|
-
BORROW: ["radiant_borrow", "aave_borrowing", "euler_borrow"],
|
39
|
+
BORROW: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
|
33
40
|
LEND: [
|
34
41
|
"gearbox",
|
35
42
|
"compound",
|
@@ -44,6 +51,10 @@ export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount,
|
|
44
51
|
"silostaking",
|
45
52
|
"euler_lend",
|
46
53
|
"layerbank",
|
54
|
+
"zerolend_lending",
|
55
|
+
"venus",
|
56
|
+
"woofi",
|
57
|
+
"reactor_fusion",
|
47
58
|
],
|
48
59
|
},
|
49
60
|
};
|
@@ -5,7 +5,7 @@ import type { Resource } from "../prisma";
|
|
5
5
|
* @see {@link Resource}
|
6
6
|
*/
|
7
7
|
export type Protocol = Resource<"Protocol">;
|
8
|
-
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "
|
8
|
+
declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer"];
|
9
9
|
export type ProtocolId = (typeof protocolTypes)[number];
|
10
10
|
export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
|
11
11
|
id: import("@sinclair/typebox").TString;
|
@@ -39,6 +39,10 @@ const protocolTypes = [
|
|
39
39
|
"dragonswap",
|
40
40
|
"poolside",
|
41
41
|
"koi",
|
42
|
+
"syncswap-v3",
|
43
|
+
"neptune",
|
44
|
+
"zkSwapThreePool",
|
45
|
+
"syncswap",
|
42
46
|
// ─── LP Lending ──────────────────────────────────────────────────────
|
43
47
|
"radiant",
|
44
48
|
"aave",
|
@@ -58,9 +62,10 @@ const protocolTypes = [
|
|
58
62
|
"ajna",
|
59
63
|
"layerbank",
|
60
64
|
"ion",
|
65
|
+
"venus",
|
66
|
+
"woofi",
|
67
|
+
"reactor_fusion",
|
61
68
|
"eigenlayer",
|
62
|
-
"syncswap-v3",
|
63
|
-
"neptune",
|
64
69
|
];
|
65
70
|
// ─── DTOs ────────────────────────────────────────────────────────────────────
|
66
71
|
export const ProtocolResourceDto = t.Object({
|
@@ -4,7 +4,7 @@ import type { BreakdownForCampaignsRaw, CampaignIdModel, CampaignIdWithoutPageMo
|
|
4
4
|
export declare abstract class RewardRepository {
|
5
5
|
static createManyReward(rewards: CreateManyRewardModel): Promise<Prisma.BatchPayload>;
|
6
6
|
static createManyBreakdown(data: CreateManyBreakdownModel): Promise<Prisma.BatchPayload>;
|
7
|
-
static getByRecipient(recipient: string, roots: string[], withToken: boolean, chainFilter?: ChainId[]): Promise<({
|
7
|
+
static getByRecipient(recipient: string, roots: string[], withToken: boolean, withTestTokens: boolean, chainFilter?: ChainId[]): Promise<({
|
8
8
|
RewardToken: {
|
9
9
|
symbol: string;
|
10
10
|
name: string | null;
|
@@ -52,14 +52,19 @@ export class RewardRepository {
|
|
52
52
|
data: breakdownsToCreate,
|
53
53
|
});
|
54
54
|
}
|
55
|
-
static async getByRecipient(recipient, roots, withToken, chainFilter) {
|
55
|
+
static async getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter) {
|
56
56
|
return await apiDbClient.reward.findMany({
|
57
57
|
where: {
|
58
58
|
root: {
|
59
59
|
in: roots,
|
60
60
|
},
|
61
61
|
recipient,
|
62
|
-
|
62
|
+
RewardToken: !!chainFilter?.length || !withTestTokens
|
63
|
+
? {
|
64
|
+
chainId: !!chainFilter?.length ? { in: chainFilter } : undefined,
|
65
|
+
isTest: withTestTokens ? undefined : false,
|
66
|
+
}
|
67
|
+
: undefined,
|
63
68
|
},
|
64
69
|
include: {
|
65
70
|
Breakdown: {
|
@@ -158,7 +158,7 @@ export declare abstract class RewardService {
|
|
158
158
|
proofs: string[];
|
159
159
|
}[];
|
160
160
|
static createManyBreakdown(data: CreateManyBreakdownModel): Promise<import("../../../../database/api/.generated").Prisma.BatchPayload | undefined>;
|
161
|
-
static getByRecipient(recipient: string, roots: string[], withToken?: boolean, chainFilter?: ChainId[]): Promise<({
|
161
|
+
static getByRecipient(recipient: string, roots: string[], withToken?: boolean, withTestTokens?: boolean, chainFilter?: ChainId[]): Promise<({
|
162
162
|
RewardToken: {
|
163
163
|
symbol: string;
|
164
164
|
name: string | null;
|
@@ -543,7 +543,7 @@ export declare abstract class RewardService {
|
|
543
543
|
root: string;
|
544
544
|
proofs: string[];
|
545
545
|
})[]>;
|
546
|
-
static getUserRewardsByChain(user: string, withToken: boolean, chainFilter?: ChainId[], connectedChainId?: MerklChainId | null): Promise<{
|
546
|
+
static getUserRewardsByChain(user: string, withToken: boolean, chainFilter?: ChainId[], connectedChainId?: MerklChainId | null, withTestTokens?: boolean): Promise<{
|
547
547
|
chain: Chain;
|
548
548
|
rewards: Awaited<ReturnType<(typeof RewardService)["format"]>>;
|
549
549
|
}[]>;
|
@@ -83,8 +83,8 @@ export class RewardService {
|
|
83
83
|
log.error(`createManyBreakdown - error creating many breakdowns for campaigns ${foundCampaigns.join(", ")}`, e);
|
84
84
|
}
|
85
85
|
}
|
86
|
-
static async getByRecipient(recipient, roots, withToken = false, chainFilter) {
|
87
|
-
return RewardRepository.getByRecipient(recipient, roots, withToken, chainFilter);
|
86
|
+
static async getByRecipient(recipient, roots, withToken = false, withTestTokens = false, chainFilter) {
|
87
|
+
return RewardRepository.getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter);
|
88
88
|
}
|
89
89
|
/**
|
90
90
|
* Groups a breakdown array by their corresponding opportunities
|
@@ -172,7 +172,7 @@ export class RewardService {
|
|
172
172
|
}
|
173
173
|
return rewards;
|
174
174
|
}
|
175
|
-
static async getUserRewardsByChain(user, withToken, chainFilter = [], connectedChainId = null) {
|
175
|
+
static async getUserRewardsByChain(user, withToken, chainFilter = [], connectedChainId = null, withTestTokens = false) {
|
176
176
|
const chains = await ChainService.findMany();
|
177
177
|
let chainIds = !chainFilter || !chainFilter.length
|
178
178
|
? chains.map(({ id }) => id)
|
@@ -190,7 +190,7 @@ export class RewardService {
|
|
190
190
|
.filter(({ status }) => status === "fulfilled")
|
191
191
|
.map(x => x.value);
|
192
192
|
/** Load rewards from api DB */
|
193
|
-
const rewards = (await RewardService.getByRecipient(user, merkleRoots.map(({ live }) => live), withToken)).filter(reward => chainIds.includes(reward.RewardToken.chainId));
|
193
|
+
const rewards = (await RewardService.getByRecipient(user, merkleRoots.map(({ live }) => live), withToken, withTestTokens)).filter(reward => chainIds.includes(reward.RewardToken.chainId));
|
194
194
|
const promises = [];
|
195
195
|
for (const [index, chainId] of chainIds.entries()) {
|
196
196
|
const chain = chains.find(chain => chain.id === chainId);
|
@@ -1702,6 +1702,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1702
1702
|
address: string;
|
1703
1703
|
};
|
1704
1704
|
query: {
|
1705
|
+
test?: boolean | undefined;
|
1705
1706
|
chainIds?: number[] | undefined;
|
1706
1707
|
reloadChainId?: number | undefined;
|
1707
1708
|
};
|
@@ -1818,6 +1819,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1818
1819
|
address: string;
|
1819
1820
|
};
|
1820
1821
|
query: {
|
1822
|
+
test?: boolean | undefined;
|
1821
1823
|
reloadChainId?: number | undefined;
|
1822
1824
|
chainId: number[];
|
1823
1825
|
};
|
@@ -83,6 +83,7 @@ export declare const UserController: Elysia<"/users", false, {
|
|
83
83
|
address: string;
|
84
84
|
};
|
85
85
|
query: {
|
86
|
+
test?: boolean | undefined;
|
86
87
|
chainIds?: number[] | undefined;
|
87
88
|
reloadChainId?: number | undefined;
|
88
89
|
};
|
@@ -199,6 +200,7 @@ export declare const UserController: Elysia<"/users", false, {
|
|
199
200
|
address: string;
|
200
201
|
};
|
201
202
|
query: {
|
203
|
+
test?: boolean | undefined;
|
202
204
|
reloadChainId?: number | undefined;
|
203
205
|
chainId: number[];
|
204
206
|
};
|
@@ -18,7 +18,7 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
18
18
|
})
|
19
19
|
// ─── Get User's Rewards With Breakdown And Details for our FE ────────
|
20
20
|
.get("/:address/rewards/breakdowns", async ({ params, query }) => {
|
21
|
-
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null);
|
21
|
+
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null, !!query.test ? query.test : false);
|
22
22
|
return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
|
23
23
|
}, {
|
24
24
|
params: UserUniqueDto,
|
@@ -35,7 +35,7 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
35
35
|
})
|
36
36
|
// ─── Get User's Rewards With Breakdown ──────────────────────────────
|
37
37
|
.get("/:address/rewards", async ({ params, query }) => {
|
38
|
-
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId, !!query.reloadChainId ? query.reloadChainId : null);
|
38
|
+
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId, !!query.reloadChainId ? query.reloadChainId : null, !!query.test ? query.test : false);
|
39
39
|
return RewardService.removeOpportunityFromRewardBreakdown(rewardsByChain);
|
40
40
|
}, {
|
41
41
|
params: UserUniqueDto,
|
@@ -8,6 +8,7 @@ export type User = Resource<"User">;
|
|
8
8
|
export declare const UserRewardRouteDto: import("@sinclair/typebox").TObject<{
|
9
9
|
chainId: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>;
|
10
10
|
reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
11
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
11
12
|
}>;
|
12
13
|
export declare const UserRewardsResourceDto: import("@sinclair/typebox").TObject<{
|
13
14
|
chain: import("@sinclair/typebox").TObject<{
|
@@ -45,6 +46,7 @@ export declare const UserUniqueDto: import("@sinclair/typebox").TObject<{
|
|
45
46
|
export declare const OptionalChainIdDto: import("@sinclair/typebox").TObject<{
|
46
47
|
chainIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>>;
|
47
48
|
reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
49
|
+
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
48
50
|
}>;
|
49
51
|
export declare const UserDto: import("@sinclair/typebox").TObject<{
|
50
52
|
address: import("@sinclair/typebox").TString;
|
@@ -9,6 +9,7 @@ export const UserRewardRouteDto = t.Object({
|
|
9
9
|
reloadChainId: t.Optional(t.Numeric({
|
10
10
|
description: "An optional chainId to bypass the cache and check if there was very recently a claim on this chain",
|
11
11
|
})),
|
12
|
+
test: t.Optional(t.Boolean({ description: "Include test token rewards" })),
|
12
13
|
}, {
|
13
14
|
description: "A required comma separated list of chain ids.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
|
14
15
|
});
|
@@ -47,6 +48,7 @@ export const OptionalChainIdDto = t.Object({
|
|
47
48
|
.Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
|
48
49
|
.Encode(value => [...value])),
|
49
50
|
reloadChainId: t.Optional(t.Numeric()),
|
51
|
+
test: t.Optional(t.Boolean({ description: "Include test token rewards" })),
|
50
52
|
});
|
51
53
|
export const UserDto = t.Object({
|
52
54
|
address: t.String(),
|
@@ -77,7 +77,15 @@ export function decodeCall(calls, index, key, type) {
|
|
77
77
|
case tokenType.moonwell:
|
78
78
|
return MoonwellInterface.decodeFunctionResult("underlying", returnData)[0];
|
79
79
|
case tokenType.ionic:
|
80
|
+
case tokenType.venus:
|
80
81
|
return IonicInterface.decodeFunctionResult("underlying", returnData)[0];
|
82
|
+
case tokenType.reactor_fusion:
|
83
|
+
try {
|
84
|
+
return IonicInterface.decodeFunctionResult("underlying", returnData)[0];
|
85
|
+
}
|
86
|
+
catch (e) {
|
87
|
+
return "0x000000000000000000000000000000000000800A";
|
88
|
+
}
|
81
89
|
case tokenType.layerbank:
|
82
90
|
return LayerBankInterface.decodeFunctionResult("underlying", returnData)[0];
|
83
91
|
case tokenType.holdstation:
|
@@ -102,6 +110,8 @@ export function decodeCall(calls, index, key, type) {
|
|
102
110
|
case tokenType.ionic:
|
103
111
|
return IonicInterface.decodeFunctionResult("exchangeRateCurrent", returnData)[0];
|
104
112
|
case tokenType.moonwell:
|
113
|
+
case tokenType.venus:
|
114
|
+
case tokenType.reactor_fusion:
|
105
115
|
return MoonwellInterface.decodeFunctionResult("exchangeRateStored", returnData)[0];
|
106
116
|
default:
|
107
117
|
throw new Error(`Need tokenType for this key ${key}`);
|
@@ -51,6 +51,8 @@ export function createCall(target, key, type, metaData) {
|
|
51
51
|
case tokenType.ionic:
|
52
52
|
return { allowFailure: true, callData: IonicInterface.encodeFunctionData("exchangeRateCurrent"), target };
|
53
53
|
case tokenType.moonwell:
|
54
|
+
case tokenType.venus:
|
55
|
+
case tokenType.reactor_fusion:
|
54
56
|
return { allowFailure: true, callData: MoonwellInterface.encodeFunctionData("exchangeRateStored"), target };
|
55
57
|
case tokenType.layerbank:
|
56
58
|
return { allowFailure: true, callData: LayerBankInterface.encodeFunctionData("exchangeRate"), target };
|
@@ -101,6 +103,8 @@ export function createCall(target, key, type, metaData) {
|
|
101
103
|
case tokenType.aura:
|
102
104
|
return { allowFailure: true, callData: AuraInterface.encodeFunctionData("asset"), target };
|
103
105
|
case tokenType.ionic:
|
106
|
+
case tokenType.venus:
|
107
|
+
case tokenType.reactor_fusion:
|
104
108
|
return { allowFailure: true, callData: IonicInterface.encodeFunctionData("underlying"), target };
|
105
109
|
case tokenType.layerbank:
|
106
110
|
return { allowFailure: true, callData: LayerBankInterface.encodeFunctionData("underlying"), target };
|
@@ -340,6 +344,12 @@ export function createCall(target, key, type, metaData) {
|
|
340
344
|
callData: CPMMGammaPoolMainInterface.encodeFunctionData("getLatestCFMMBalances"),
|
341
345
|
target: target,
|
342
346
|
};
|
347
|
+
case "getReserves":
|
348
|
+
return {
|
349
|
+
allowFailure: true,
|
350
|
+
callData: UniswapV2PoolInterface.encodeFunctionData("getReserves"),
|
351
|
+
target: target,
|
352
|
+
};
|
343
353
|
default:
|
344
354
|
throw new Error(`Unknown key ${key}`);
|
345
355
|
}
|
@@ -59,6 +59,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
|
|
59
59
|
case tokenType.ironclad_lending:
|
60
60
|
case tokenType.zerolend_lending:
|
61
61
|
case tokenType.fraxlend:
|
62
|
+
case tokenType.venus:
|
63
|
+
case tokenType.reactor_fusion:
|
62
64
|
case tokenType.euler_lend:
|
63
65
|
return `Supply ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
|
64
66
|
case tokenType.metamorpho:
|
@@ -87,9 +89,9 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
|
|
87
89
|
case tokenType.woofi:
|
88
90
|
return `Supercharge ${typeInfo.symbolUnderlying} on ${typeInfo.protocol}`;
|
89
91
|
case tokenType.maverickBoostedPosition:
|
90
|
-
return `
|
92
|
+
return `Maverick Boosted Position ${campaign.campaignParameters.symbolTargetToken}`;
|
91
93
|
case tokenType.zkSwapThreePool:
|
92
|
-
return
|
94
|
+
return `${typeInfo.protocol} ${typeInfo.symbolToken0}/${typeInfo.symbolToken1}/${typeInfo.symbolToken2}`;
|
93
95
|
case tokenType.maha:
|
94
96
|
return `Stake ${typeInfo.symbolToken0}/${typeInfo.symbolToken1} LP on ${typeInfo.protocol}`;
|
95
97
|
case tokenType.tempest:
|