@merkl/api 0.10.180 → 0.10.182
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +58 -12
- package/dist/src/index.d.ts +24 -4
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.js +12 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.js +1 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +39 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +45 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +25 -1
- package/dist/src/modules/v4/claims/claims.controller.d.ts +40 -0
- package/dist/src/modules/v4/claims/claims.controller.js +13 -0
- package/dist/src/modules/v4/claims/claims.model.d.ts +9 -0
- package/dist/src/modules/v4/claims/claims.model.js +1 -0
- package/dist/src/modules/v4/claims/claims.repository.d.ts +5 -0
- package/dist/src/modules/v4/claims/claims.repository.js +39 -0
- package/dist/src/modules/v4/claims/claims.service.d.ts +8 -0
- package/dist/src/modules/v4/claims/claims.service.js +31 -0
- package/dist/src/modules/v4/claims/index.d.ts +3 -0
- package/dist/src/modules/v4/claims/index.js +3 -0
- package/dist/src/modules/v4/router.d.ts +24 -4
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/src/modules/v4/token/token.controller.d.ts +4 -4
- package/dist/src/modules/v4/token/token.service.d.ts +4 -4
- package/dist/src/modules/v4/token/token.service.js +2 -2
- package/dist/src/modules/v4/user/user.model.d.ts +1 -0
- package/dist/src/routes/v3/blacklist.d.ts +24 -4
- package/dist/src/routes/v3/campaigns.d.ts +24 -4
- package/dist/src/routes/v3/campaignsInfo.d.ts +24 -4
- package/dist/src/routes/v3/multiChainPositions.d.ts +24 -4
- package/dist/src/routes/v3/opportunity.d.ts +24 -4
- package/dist/src/routes/v3/positions.d.ts +24 -4
- package/dist/src/routes/v3/rewards.d.ts +24 -4
- package/dist/src/routes/v3/updates.d.ts +24 -4
- package/dist/src/routes/v3/userRewards.d.ts +24 -4
- package/dist/src/utils/decodeCalls.js +5 -1
- package/dist/src/utils/encodeCalls.js +13 -1
- package/dist/src/utils/generateCardName.js +3 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -788,7 +788,7 @@ declare const eden: {
|
|
788
788
|
};
|
789
789
|
fetch?: RequestInit | undefined;
|
790
790
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
791
|
-
200: {
|
791
|
+
200: ({
|
792
792
|
symbol: string;
|
793
793
|
name: string | null;
|
794
794
|
id: string;
|
@@ -796,11 +796,11 @@ declare const eden: {
|
|
796
796
|
address: string;
|
797
797
|
icon: string;
|
798
798
|
decimals: number;
|
799
|
-
displaySymbol: string;
|
800
799
|
verified: boolean;
|
801
800
|
isTest: boolean;
|
802
|
-
|
803
|
-
|
801
|
+
} & {
|
802
|
+
price?: number | null | undefined;
|
803
|
+
})[];
|
804
804
|
}>>;
|
805
805
|
};
|
806
806
|
count: {
|
@@ -1914,6 +1914,19 @@ declare const eden: {
|
|
1914
1914
|
}>>;
|
1915
1915
|
};
|
1916
1916
|
};
|
1917
|
+
claims: ((params: {
|
1918
|
+
address: string | number;
|
1919
|
+
}) => {
|
1920
|
+
get: (options?: {
|
1921
|
+
headers?: Record<string, unknown> | undefined;
|
1922
|
+
query?: Record<string, unknown> | undefined;
|
1923
|
+
fetch?: RequestInit | undefined;
|
1924
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1925
|
+
200: (import("../modules/v4/claims").ClaimModel & {
|
1926
|
+
token: import("../modules/v4").Token["model"];
|
1927
|
+
})[];
|
1928
|
+
}>>;
|
1929
|
+
}) & {};
|
1917
1930
|
};
|
1918
1931
|
};
|
1919
1932
|
type Api = typeof eden;
|
@@ -2826,7 +2839,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2826
2839
|
};
|
2827
2840
|
headers: unknown;
|
2828
2841
|
response: {
|
2829
|
-
200: {
|
2842
|
+
200: ({
|
2830
2843
|
symbol: string;
|
2831
2844
|
name: string | null;
|
2832
2845
|
id: string;
|
@@ -2834,11 +2847,11 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2834
2847
|
address: string;
|
2835
2848
|
icon: string;
|
2836
2849
|
decimals: number;
|
2837
|
-
displaySymbol: string;
|
2838
2850
|
verified: boolean;
|
2839
2851
|
isTest: boolean;
|
2840
|
-
|
2841
|
-
|
2852
|
+
} & {
|
2853
|
+
price?: number | null | undefined;
|
2854
|
+
})[];
|
2842
2855
|
};
|
2843
2856
|
};
|
2844
2857
|
};
|
@@ -4309,6 +4322,26 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4309
4322
|
};
|
4310
4323
|
};
|
4311
4324
|
};
|
4325
|
+
} & {
|
4326
|
+
v4: {
|
4327
|
+
claims: {
|
4328
|
+
":address": {
|
4329
|
+
get: {
|
4330
|
+
body: unknown;
|
4331
|
+
params: {
|
4332
|
+
address: string;
|
4333
|
+
};
|
4334
|
+
query: unknown;
|
4335
|
+
headers: unknown;
|
4336
|
+
response: {
|
4337
|
+
200: (import("../modules/v4/claims").ClaimModel & {
|
4338
|
+
token: import("../modules/v4").Token["model"];
|
4339
|
+
})[];
|
4340
|
+
};
|
4341
|
+
};
|
4342
|
+
};
|
4343
|
+
};
|
4344
|
+
};
|
4312
4345
|
}, {
|
4313
4346
|
derive: {};
|
4314
4347
|
resolve: {};
|
@@ -5105,7 +5138,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
5105
5138
|
};
|
5106
5139
|
fetch?: RequestInit | undefined;
|
5107
5140
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
5108
|
-
200: {
|
5141
|
+
200: ({
|
5109
5142
|
symbol: string;
|
5110
5143
|
name: string | null;
|
5111
5144
|
id: string;
|
@@ -5113,11 +5146,11 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
5113
5146
|
address: string;
|
5114
5147
|
icon: string;
|
5115
5148
|
decimals: number;
|
5116
|
-
displaySymbol: string;
|
5117
5149
|
verified: boolean;
|
5118
5150
|
isTest: boolean;
|
5119
|
-
|
5120
|
-
|
5151
|
+
} & {
|
5152
|
+
price?: number | null | undefined;
|
5153
|
+
})[];
|
5121
5154
|
}>>;
|
5122
5155
|
};
|
5123
5156
|
count: {
|
@@ -6231,6 +6264,19 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6231
6264
|
}>>;
|
6232
6265
|
};
|
6233
6266
|
};
|
6267
|
+
claims: ((params: {
|
6268
|
+
address: string | number;
|
6269
|
+
}) => {
|
6270
|
+
get: (options?: {
|
6271
|
+
headers?: Record<string, unknown> | undefined;
|
6272
|
+
query?: Record<string, unknown> | undefined;
|
6273
|
+
fetch?: RequestInit | undefined;
|
6274
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6275
|
+
200: (import("../modules/v4/claims").ClaimModel & {
|
6276
|
+
token: import("../modules/v4").Token["model"];
|
6277
|
+
})[];
|
6278
|
+
}>>;
|
6279
|
+
}) & {};
|
6234
6280
|
};
|
6235
6281
|
};
|
6236
6282
|
export type Opportunity = FromPromise<Api["v4"]["opportunities"]["index"]["get"]>;
|
package/dist/src/index.d.ts
CHANGED
@@ -901,7 +901,7 @@ declare const app: Elysia<"", false, {
|
|
901
901
|
};
|
902
902
|
headers: unknown;
|
903
903
|
response: {
|
904
|
-
200: {
|
904
|
+
200: ({
|
905
905
|
symbol: string;
|
906
906
|
name: string | null;
|
907
907
|
id: string;
|
@@ -909,11 +909,11 @@ declare const app: Elysia<"", false, {
|
|
909
909
|
address: string;
|
910
910
|
icon: string;
|
911
911
|
decimals: number;
|
912
|
-
displaySymbol: string;
|
913
912
|
verified: boolean;
|
914
913
|
isTest: boolean;
|
915
|
-
|
916
|
-
|
914
|
+
} & {
|
915
|
+
price?: number | null | undefined;
|
916
|
+
})[];
|
917
917
|
};
|
918
918
|
};
|
919
919
|
};
|
@@ -2384,6 +2384,26 @@ declare const app: Elysia<"", false, {
|
|
2384
2384
|
};
|
2385
2385
|
};
|
2386
2386
|
};
|
2387
|
+
} & {
|
2388
|
+
v4: {
|
2389
|
+
claims: {
|
2390
|
+
":address": {
|
2391
|
+
get: {
|
2392
|
+
body: unknown;
|
2393
|
+
params: {
|
2394
|
+
address: string;
|
2395
|
+
};
|
2396
|
+
query: unknown;
|
2397
|
+
headers: unknown;
|
2398
|
+
response: {
|
2399
|
+
200: (import("./modules/v4/claims").ClaimModel & {
|
2400
|
+
token: import("./modules/v4").Token["model"];
|
2401
|
+
})[];
|
2402
|
+
};
|
2403
|
+
};
|
2404
|
+
};
|
2405
|
+
};
|
2406
|
+
};
|
2387
2407
|
}, {
|
2388
2408
|
derive: {};
|
2389
2409
|
resolve: {};
|
@@ -64,7 +64,7 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
|
|
64
64
|
calls: [],
|
65
65
|
typeInfo: {},
|
66
66
|
};
|
67
|
-
typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i);
|
67
|
+
typeStruct = getTokenTypeRound1(resultRound1, campaign.campaignParameters.targetToken, i, campaign);
|
68
68
|
i += 5;
|
69
69
|
tokenTypesByCampaign[campaign.campaignId] = typeStruct;
|
70
70
|
callsRounds2.push(...typeStruct.calls);
|
@@ -124,8 +124,8 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
|
|
124
124
|
const callsForCampaign = tokenTypesByCampaign[campaign.campaignId].calls.length;
|
125
125
|
tokenTypesByCampaign[campaign.campaignId] = await getTokenPricesInfo(i, tokenTypesByCampaign[campaign.campaignId].type, tokenTypesByCampaign[campaign.campaignId].typeInfo, result, campaign, pricer);
|
126
126
|
i += callsForCampaign;
|
127
|
-
const totalSupplyTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.totalSupply;
|
128
127
|
const whitelistedSupplyTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.whitelistedSupplyTargetToken;
|
128
|
+
const totalSupplyTargetToken = whitelistedSupplyTargetToken;
|
129
129
|
const priceTargetToken = tokenTypesByCampaign[campaign.campaignId].typeInfo.priceTargetToken;
|
130
130
|
let lastEligibilityRatio = 1;
|
131
131
|
if (!!campaign.campaignParameters.hooks?.length) {
|
@@ -141,7 +141,7 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
|
|
141
141
|
campaign.campaignParameters.duration /
|
142
142
|
(whitelistedSupplyTargetToken * priceTargetToken),
|
143
143
|
totalSupplyTargetToken,
|
144
|
-
tvl:
|
144
|
+
tvl: whitelistedSupplyTargetToken * priceTargetToken,
|
145
145
|
type: tokenTypesByCampaign[campaign.campaignId].type,
|
146
146
|
typeInfo: tokenTypesByCampaign[campaign.campaignId].typeInfo,
|
147
147
|
priceRewardToken: priceRewardToken,
|
@@ -57,7 +57,8 @@ export declare enum tokenType {
|
|
57
57
|
pendleYT = "pendleYT",
|
58
58
|
pancakeswap = "pancakeswap",
|
59
59
|
tempestStaking = "tempestStaking",
|
60
|
-
holdstation = "holdstation"
|
60
|
+
holdstation = "holdstation",
|
61
|
+
staking = "staking"
|
61
62
|
}
|
62
63
|
export declare const tokenTypeToProtocol: {
|
63
64
|
[key in tokenType]: {
|
@@ -59,6 +59,7 @@ export var tokenType;
|
|
59
59
|
tokenType["pancakeswap"] = "pancakeswap";
|
60
60
|
tokenType["tempestStaking"] = "tempestStaking";
|
61
61
|
tokenType["holdstation"] = "holdstation";
|
62
|
+
tokenType["staking"] = "staking";
|
62
63
|
})(tokenType || (tokenType = {}));
|
63
64
|
export const tokenTypeToProtocol = {
|
64
65
|
[tokenType.aave_borrowing]: { protocol: "Aave" },
|
@@ -139,4 +140,7 @@ export const tokenTypeToProtocol = {
|
|
139
140
|
[tokenType.holdstation]: {
|
140
141
|
protocol: "HoldStation",
|
141
142
|
},
|
143
|
+
[tokenType.staking]: {
|
144
|
+
protocol: "Staking",
|
145
|
+
},
|
142
146
|
};
|
@@ -2,6 +2,7 @@ import { decodeCall } from "../../../../../utils/decodeCalls";
|
|
2
2
|
import { createCall } from "../../../../../utils/encodeCalls";
|
3
3
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
4
4
|
import { BN2Number } from "@sdk";
|
5
|
+
import { utils } from "ethers";
|
5
6
|
import { GenericProcessor, roundType } from "./GenericProcessor";
|
6
7
|
export class AuraProcessor extends GenericProcessor {
|
7
8
|
rounds = {
|
@@ -21,6 +22,7 @@ export class AuraProcessor extends GenericProcessor {
|
|
21
22
|
{ key: "poolTokensRaw", call: "getPoolTokens", target: "vault", metaData: "poolId" },
|
22
23
|
{ key: "gaugeBalance", call: "balanceOf", target: "balancerPool", metaData: "gaugeContract" },
|
23
24
|
{ key: "auraBalance", call: "balanceOf", target: "gaugeContract", metaData: "auraStaker" },
|
25
|
+
{ key: "vaultBalance", call: "balanceOf", target: "balancerPool", metaData: "vault" },
|
24
26
|
{ key: "totalSupplyGauge", call: "totalSupply", target: "gaugeContract" },
|
25
27
|
],
|
26
28
|
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
@@ -43,8 +45,15 @@ export class AuraProcessor extends GenericProcessor {
|
|
43
45
|
}
|
44
46
|
}
|
45
47
|
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
46
|
-
|
47
|
-
const
|
48
|
+
let { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
49
|
+
const vaultBalance = BN2Number(typeInfo.vaultBalance, 18);
|
50
|
+
const vaultIndex = campaign.campaignParameters.blacklist
|
51
|
+
?.map(b => utils.getAddress(b))
|
52
|
+
?.indexOf(utils.getAddress(typeInfo.vault));
|
53
|
+
if (vaultIndex !== -1) {
|
54
|
+
blacklistedSupply -= BN2Number(decodeCall(calls, index + vaultIndex, "balanceOf"), campaign.campaignParameters.decimalsTargetToken); // The vault balance was already removed from the total supply
|
55
|
+
}
|
56
|
+
const totalSupplyBalancerPool = BN2Number(typeInfo.totalSupplyBalancerPool, 18) - vaultBalance;
|
48
57
|
const gaugeBalance = BN2Number(typeInfo.gaugeBalance, 18);
|
49
58
|
const auraBalance = BN2Number(typeInfo.auraBalance, 18);
|
50
59
|
const totalSupplyGauge = BN2Number(typeInfo.totalSupplyGauge, 18);
|
@@ -66,7 +75,7 @@ export class AuraProcessor extends GenericProcessor {
|
|
66
75
|
}
|
67
76
|
const percentageOfSupplyInAura = (auraBalance / totalSupplyGauge) * (gaugeBalance / totalSupplyBalancerPool);
|
68
77
|
const tvl = poolTvl * percentageOfSupplyInAura;
|
69
|
-
const priceTargetToken = tvl /
|
78
|
+
const priceTargetToken = tvl / totalSupplyBalancerPool;
|
70
79
|
return {
|
71
80
|
...typeInfo,
|
72
81
|
totalSupplyBalancerPool,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
-
import {
|
2
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
3
3
|
import type { tokenType } from "../helpers/tokenType";
|
4
4
|
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
5
|
type callType = {
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
-
import { ChainId } from "@sdk";
|
3
2
|
import { GenericProcessor } from "./GenericProcessor";
|
4
3
|
export class PendleProcessor extends GenericProcessor {
|
5
4
|
rounds = {
|
@@ -14,8 +13,7 @@ export class PendleProcessor extends GenericProcessor {
|
|
14
13
|
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
15
14
|
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
16
15
|
const priceTargetToken = (await pricer.get({
|
17
|
-
|
18
|
-
chainId: ChainId.MAINNET,
|
16
|
+
symbol: typeInfo.tokenAddress,
|
19
17
|
})) ?? 0;
|
20
18
|
const tvl = priceTargetToken * totalSupply;
|
21
19
|
return {
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
3
|
+
import type { tokenType, tokenTypeStruct } from "../helpers/tokenType";
|
4
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
|
+
type callType = {
|
6
|
+
key: keyof dataRawStaking;
|
7
|
+
call: string;
|
8
|
+
target: keyof callKeysStaking;
|
9
|
+
metaData?: keyof callKeysStaking;
|
10
|
+
optional?: boolean;
|
11
|
+
};
|
12
|
+
type callKeysStaking = mandatoryCallKeys & {
|
13
|
+
stakingContract: string;
|
14
|
+
lockNFT: string;
|
15
|
+
stakingSymbol: string;
|
16
|
+
};
|
17
|
+
type dataRawStaking = callKeysStaking & {
|
18
|
+
eip712DomainName: string;
|
19
|
+
};
|
20
|
+
type dataTypeStaking = dataType & {};
|
21
|
+
export declare class StakingProcessor extends GenericProcessor<callKeysStaking, dataRawStaking, dataTypeStaking> {
|
22
|
+
rounds: {
|
23
|
+
round1: callType[];
|
24
|
+
round2: callType[];
|
25
|
+
round3: callType[];
|
26
|
+
round4: callType[];
|
27
|
+
};
|
28
|
+
processingRound1(typeInfo: dataRawStaking): void;
|
29
|
+
processingRound2(typeInfo: dataRawStaking): void;
|
30
|
+
processingRound3(typeInfo: dataRawStaking): void;
|
31
|
+
processingRound4(typeInfo: dataRawStaking): void;
|
32
|
+
processingRound5(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeStaking>;
|
33
|
+
computeRound1(type: tokenType, typeInfo: dataRawStaking): tokenTypeStruct;
|
34
|
+
computeRound2(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[]): tokenTypeStruct;
|
35
|
+
computeRound3(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[]): tokenTypeStruct;
|
36
|
+
computeRound4(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[], campaign: CampaignParameters<Campaign.ERC20>): tokenTypeStruct;
|
37
|
+
computeRound5(index: number, type: tokenType, typeInfo: dataRawStaking, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<tokenTypeStruct>;
|
38
|
+
}
|
39
|
+
export {};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { GenericProcessor } from "./GenericProcessor";
|
2
|
+
export class StakingProcessor extends GenericProcessor {
|
3
|
+
rounds = {
|
4
|
+
round1: [
|
5
|
+
{ key: "lockNFT", call: "lockNFT", target: "stakingContract", optional: true },
|
6
|
+
{ key: "eip712DomainName", call: "eip712DomainName", target: "stakingContract", optional: true },
|
7
|
+
],
|
8
|
+
round2: [{ key: "stakingSymbol", call: "symbol", target: "lockNFT", optional: true }],
|
9
|
+
round3: [],
|
10
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
11
|
+
};
|
12
|
+
// override computeRound1(): void {}
|
13
|
+
processingRound1(typeInfo) {
|
14
|
+
if (typeInfo.stakingContract === "0x18eeD20f71BEf84B605253C89A7576E3634134C0") {
|
15
|
+
typeInfo.stakingSymbol = "CyberStaking";
|
16
|
+
}
|
17
|
+
}
|
18
|
+
processingRound2(typeInfo) {
|
19
|
+
typeInfo.stakingSymbol = typeInfo.eip712DomainName;
|
20
|
+
}
|
21
|
+
processingRound3(typeInfo) {
|
22
|
+
super.processingRound3(typeInfo);
|
23
|
+
}
|
24
|
+
processingRound4(typeInfo) {
|
25
|
+
super.processingRound4(typeInfo);
|
26
|
+
}
|
27
|
+
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
28
|
+
return super.processingRound5(index, type, typeInfo, calls, campaign, pricer);
|
29
|
+
}
|
30
|
+
computeRound1(type, typeInfo) {
|
31
|
+
return super.computeRound1(type, typeInfo);
|
32
|
+
}
|
33
|
+
computeRound2(index, type, typeInfo, calls) {
|
34
|
+
return super.computeRound2(index, type, typeInfo, calls);
|
35
|
+
}
|
36
|
+
computeRound3(index, type, typeInfo, calls) {
|
37
|
+
return super.computeRound3(index, type, typeInfo, calls);
|
38
|
+
}
|
39
|
+
computeRound4(index, type, typeInfo, calls, campaign) {
|
40
|
+
return super.computeRound4(index, type, typeInfo, calls, campaign);
|
41
|
+
}
|
42
|
+
async computeRound5(index, type, typeInfo, calls, campaign, pricer) {
|
43
|
+
return super.computeRound5(index, type, typeInfo, calls, campaign, pricer);
|
44
|
+
}
|
45
|
+
}
|
@@ -21,6 +21,7 @@ import { PendleYTProcessor } from "./PendleYTProcessor";
|
|
21
21
|
import { RadiantProcessor } from "./RadiantProcessor";
|
22
22
|
import { RfxProcessor } from "./RfxProcessor";
|
23
23
|
import { SpliceProcessor } from "./SpliceProcessor";
|
24
|
+
import { StakingProcessor } from "./StakingProcessor";
|
24
25
|
import { SturdySiloProcessor } from "./SturdySiloProcessor";
|
25
26
|
import { TempestVaultProcessor } from "./TempestVaultProcessor";
|
26
27
|
import { TorosProcessor } from "./TorosProcessor";
|
@@ -88,4 +89,5 @@ export const processorMapping = {
|
|
88
89
|
[tokenType.pancakeswap]: UniswapProcessor,
|
89
90
|
[tokenType.tempestStaking]: TempestVaultProcessor,
|
90
91
|
[tokenType.holdstation]: HoldStationProcessor,
|
92
|
+
[tokenType.staking]: StakingProcessor,
|
91
93
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
1
2
|
import type { Multicall3 } from "libs/sdk/src/generated/Multicall";
|
2
3
|
import { type tokenTypeStruct } from "./helpers/tokenType";
|
3
|
-
export declare function getTokenTypeRound1(calls: Multicall3.ResultStructOutput[], targetToken: string, index: number): tokenTypeStruct;
|
4
|
+
export declare function getTokenTypeRound1(calls: Multicall3.ResultStructOutput[], targetToken: string, index: number, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
|
@@ -179,7 +179,27 @@ function parseForBalancer(calls, index, targetToken, name) {
|
|
179
179
|
// Not a balancer pool
|
180
180
|
}
|
181
181
|
}
|
182
|
-
|
182
|
+
function parseForStaking(campaign, calls, index, targetToken) {
|
183
|
+
try {
|
184
|
+
const whitelist = campaign.campaignParameters.whitelist;
|
185
|
+
console.log("whitelist", whitelist, whitelist.length);
|
186
|
+
if (whitelist.length === 1) {
|
187
|
+
const forwarders = campaign.campaignParameters.forwarders;
|
188
|
+
console.log("forwarders", forwarders);
|
189
|
+
if (forwarders.length === 1) {
|
190
|
+
if (forwarders[0].sender === whitelist[0]) {
|
191
|
+
const name = decodeCall(calls, index + 2, "name");
|
192
|
+
return generateResult(tokenType.staking, name, targetToken, { stakingContract: whitelist[0] });
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
}
|
197
|
+
catch (e) {
|
198
|
+
// No factory on this token
|
199
|
+
// console.log(e);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
export function getTokenTypeRound1(calls, targetToken, index, campaign) {
|
183
203
|
const returnValueOfCalls = calls.map(call => call.returnData);
|
184
204
|
let result = parseForFactory(returnValueOfCalls, index, targetToken);
|
185
205
|
if (result)
|
@@ -188,6 +208,10 @@ export function getTokenTypeRound1(calls, targetToken, index) {
|
|
188
208
|
if (result)
|
189
209
|
return result;
|
190
210
|
result = parseForMetamorpho(returnValueOfCalls, index, targetToken);
|
211
|
+
if (result)
|
212
|
+
return result;
|
213
|
+
console.log("parsing for staking");
|
214
|
+
result = parseForStaking(campaign, returnValueOfCalls, index, targetToken);
|
191
215
|
if (result)
|
192
216
|
return result;
|
193
217
|
let name;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import Elysia from "elysia";
|
2
|
+
export declare const ClaimController: Elysia<"/claims", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
macroFn: {};
|
14
|
+
}, {
|
15
|
+
claims: {
|
16
|
+
":address": {
|
17
|
+
get: {
|
18
|
+
body: unknown;
|
19
|
+
params: {
|
20
|
+
address: string;
|
21
|
+
};
|
22
|
+
query: unknown;
|
23
|
+
headers: unknown;
|
24
|
+
response: {
|
25
|
+
200: (import("./claims.model").ClaimModel & {
|
26
|
+
token: import("..").Token["model"];
|
27
|
+
})[];
|
28
|
+
};
|
29
|
+
};
|
30
|
+
};
|
31
|
+
};
|
32
|
+
}, {
|
33
|
+
derive: {};
|
34
|
+
resolve: {};
|
35
|
+
schema: {};
|
36
|
+
}, {
|
37
|
+
derive: {};
|
38
|
+
resolve: {};
|
39
|
+
schema: {};
|
40
|
+
}>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { throwOnInvalidRequiredAddress } from "../../../utils/throw";
|
2
|
+
import Elysia from "elysia";
|
3
|
+
import { UserUniqueDto } from "../user";
|
4
|
+
import { ClaimService } from "./claims.service";
|
5
|
+
// ─── Claim Controller ───────────────────────────────────────────────────────
|
6
|
+
export const ClaimController = new Elysia({ prefix: "/claims", detail: { tags: ["Claims"] } })
|
7
|
+
// ─── Get Historical Claims ────────────────────────────────────────────
|
8
|
+
.get("/:address", async ({ params }) => await ClaimService.getHistoricalClaims(params), {
|
9
|
+
params: UserUniqueDto,
|
10
|
+
beforeHandle: ({ params }) => {
|
11
|
+
params.address = throwOnInvalidRequiredAddress(params.address);
|
12
|
+
},
|
13
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { merklSubgraphClaimsEndpoints } from "@sdk";
|
2
|
+
import request, { gql } from "graphql-request";
|
3
|
+
export class ClaimRepository {
|
4
|
+
static async fetch(chainId, address) {
|
5
|
+
try {
|
6
|
+
return (await request(merklSubgraphClaimsEndpoints[chainId],
|
7
|
+
// Request is limited to first 100 by default so needs to be sorted
|
8
|
+
gql `query MerklClaims($user: String) {
|
9
|
+
merklClaims(where: {user: $user }, orderBy: timestamp, orderDirection: desc) {
|
10
|
+
timestamp
|
11
|
+
token
|
12
|
+
user
|
13
|
+
amount
|
14
|
+
rawAmount
|
15
|
+
root
|
16
|
+
id
|
17
|
+
txHash
|
18
|
+
}
|
19
|
+
}
|
20
|
+
`, { user: address?.toLowerCase() })).merklClaims;
|
21
|
+
}
|
22
|
+
catch {
|
23
|
+
return (await request(merklSubgraphClaimsEndpoints[chainId],
|
24
|
+
// Request is limited to first 100 by default so needs to be sorted
|
25
|
+
gql `query MerklClaims($user: String) {
|
26
|
+
merklClaims(where: {user: $user }, orderBy: timestamp, orderDirection: desc) {
|
27
|
+
timestamp
|
28
|
+
token
|
29
|
+
user
|
30
|
+
amount
|
31
|
+
rawAmount
|
32
|
+
root
|
33
|
+
id
|
34
|
+
}
|
35
|
+
}
|
36
|
+
`, { user: address?.toLowerCase() })).merklClaims;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { Token } from "../token";
|
2
|
+
import type { UserUniqueModel } from "../user";
|
3
|
+
import type { ClaimModel } from "./claims.model";
|
4
|
+
export declare abstract class ClaimService {
|
5
|
+
static getHistoricalClaims(params: UserUniqueModel): Promise<(ClaimModel & {
|
6
|
+
token: Token["model"];
|
7
|
+
})[]>;
|
8
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { MerklRootService } from "../merklRoot";
|
2
|
+
import { RewardService } from "../reward";
|
3
|
+
import { ClaimRepository } from "./claims.repository";
|
4
|
+
export class ClaimService {
|
5
|
+
// ─── Get Historical Claims ─────────────────────────────────────────────────
|
6
|
+
static async getHistoricalClaims(params) {
|
7
|
+
const roots = (await MerklRootService.fetchAll()).map(r => r.live);
|
8
|
+
const rewards = await RewardService.getByRecipient(params.address, roots, true);
|
9
|
+
const chainIds = [];
|
10
|
+
for (const reward of rewards) {
|
11
|
+
if (!chainIds.includes(reward.RewardToken.chainId)) {
|
12
|
+
chainIds.push(reward.RewardToken.chainId);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
const tokens = rewards.reduce((acc, reward) => {
|
16
|
+
acc[reward.RewardToken.address.toLowerCase()] = reward.RewardToken;
|
17
|
+
return acc;
|
18
|
+
}, {});
|
19
|
+
const promises = await Promise.allSettled(chainIds.map(chainId => ClaimRepository.fetch(chainId, params.address)));
|
20
|
+
const claims = await promises
|
21
|
+
.filter(p => p.status === "fulfilled")
|
22
|
+
.flatMap(p => p.value)
|
23
|
+
.map(claim => {
|
24
|
+
return {
|
25
|
+
...claim,
|
26
|
+
token: tokens[claim.token.toLowerCase()],
|
27
|
+
};
|
28
|
+
});
|
29
|
+
return claims.sort((a, b) => Number(b.timestamp) - Number(a.timestamp));
|
30
|
+
}
|
31
|
+
}
|