@merkl/api 0.20.175 → 0.20.177
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/jobs/reward-breakdowns.js +23 -13
- package/dist/src/modules/v4/campaign/campaign.repository.js +3 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +78 -3
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +85 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -78,18 +78,28 @@ const transform = (rewardBreakdowns) => {
|
|
78
78
|
return transformedBreakdowns;
|
79
79
|
};
|
80
80
|
// ─── Load ────────────────────────────────────────────────────────────────────
|
81
|
-
const load = async (rewardBreakdowns) => {
|
81
|
+
const load = async (rewardBreakdowns, skipSubCampaignReasons = false) => {
|
82
82
|
const count = (await apiDbClient.rewardBreakdown.createMany({
|
83
|
-
data: rewardBreakdowns.map(breakdown =>
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
83
|
+
data: rewardBreakdowns.map(breakdown => {
|
84
|
+
// Trying to parse subcampaign reasons only when skipSubCampaignReasons is false because priority is having the breakdowns in the DB
|
85
|
+
if (!skipSubCampaignReasons && breakdown.reason.includes("~")) {
|
86
|
+
// subcampaign reason will have the form <protocol>_<campaignId>_<reason> outputted by the processor>
|
87
|
+
const subcampaignReason = breakdown.reason.split("~")[breakdown.reason.split("~").length - 1];
|
88
|
+
breakdown.reason = subcampaignReason.split("_").slice(2).join("_");
|
89
|
+
breakdown.subCampaignId = subcampaignReason.split("_")[1];
|
90
|
+
}
|
91
|
+
return {
|
92
|
+
id: breakdown.id,
|
93
|
+
protocolId: breakdown.protocolId,
|
94
|
+
reason: breakdown.reason,
|
95
|
+
amount: breakdown.amount,
|
96
|
+
claimed: breakdown.claimed,
|
97
|
+
pending: breakdown.pending,
|
98
|
+
rewardId: breakdown.rewardId,
|
99
|
+
campaignId: breakdown.campaignId,
|
100
|
+
subCampaignId: breakdown.subCampaignId ?? undefined,
|
101
|
+
};
|
102
|
+
}),
|
93
103
|
skipDuplicates: true,
|
94
104
|
})).count;
|
95
105
|
log.info(`Successfully inserted ${rewardBreakdowns.length} reward breakdown(s).`);
|
@@ -106,7 +116,7 @@ const retry = async (batches) => {
|
|
106
116
|
const secondHalf = currentBatch;
|
107
117
|
// Process first half
|
108
118
|
try {
|
109
|
-
inserted += await load(firstHalf);
|
119
|
+
inserted += await load(firstHalf, true);
|
110
120
|
}
|
111
121
|
catch (err) {
|
112
122
|
log.error(JSON.stringify(firstHalf), err);
|
@@ -117,7 +127,7 @@ const retry = async (batches) => {
|
|
117
127
|
}
|
118
128
|
// Process second half
|
119
129
|
try {
|
120
|
-
inserted += await load(secondHalf);
|
130
|
+
inserted += await load(secondHalf, true);
|
121
131
|
}
|
122
132
|
catch (err) {
|
123
133
|
log.error(JSON.stringify(secondHalf), err);
|
@@ -203,6 +203,9 @@ export class CampaignRepository {
|
|
203
203
|
throw new CannotUpdateOpportunityLastCreatedAt(campaign.campaignId, campaign.distributionChainId, campaign.type);
|
204
204
|
}
|
205
205
|
}
|
206
|
+
if (!!campaign.parentCampaignId || !!campaign.rootCampaignId) {
|
207
|
+
log.info(`inserting subcampaign ${campaign.campaignId}. Parent: ${campaign.parentCampaignId}, Root: ${campaign.rootCampaignId}`);
|
208
|
+
}
|
206
209
|
const data = {
|
207
210
|
id: campaign.id,
|
208
211
|
amount: campaign.amount,
|
@@ -12,7 +12,8 @@ export declare enum program {
|
|
12
12
|
Etherlink = "Etherlink",
|
13
13
|
Angles = "Angles",
|
14
14
|
Ronin = "Ronin",
|
15
|
-
TAC = "TAC"
|
15
|
+
TAC = "TAC",
|
16
|
+
HypuurFi = "HypuurFi"
|
16
17
|
}
|
17
18
|
export declare enum roninCampaigns {
|
18
19
|
Katana_WETH_RON_Ronin = "Katana WETH-RON Ronin 0x90f31f1907a4d1443a6aacdc91ac2312f91bafa7",
|
@@ -538,7 +539,10 @@ export declare enum tacCampaigns {
|
|
538
539
|
TAC_Supply_tacUSN = "TAC Supply tacUSN 0x7895A046b26CC07272B022a0C9BAFC046E6F6396",
|
539
540
|
TAC_Supply_TACyUSD = "TAC Supply TACyUSD 0x2799dE2E1e769fA58dd3787F70BcD839AF3a1F39",
|
540
541
|
TAC_Supply_tacETH9s = "TAC Supply tacETH9s 0xDe7CFf032D453Ce6B0a796043E75d380Df258812",
|
541
|
-
TAC_Supply_ylSolvBTCtac = "TAC Supply ylSolvBTC.tac 0x34d16e4fB8757A88D986f9EfE2484F0badBF22C1"
|
542
|
+
TAC_Supply_ylSolvBTCtac = "TAC Supply ylSolvBTC.tac 0x34d16e4fB8757A88D986f9EfE2484F0badBF22C1",
|
543
|
+
TAC_Supply_xUpUSDC = "TAC Supply xUpUSDC 0x396A3f77EE1faf5A3C46e878bA7b7a2dcbe55517",
|
544
|
+
TAC_Supply_ylbfBTCtac = "TAC Supply ylbfBTC.tac 0x0d1862e73a1430A5FD3245B47859c1BEcD6f3A1D",
|
545
|
+
TAC_Supply_uTAC = "TAC Supply uTAC++ 0xAF87B90E8a3035905697E07Bb813d2d59D2b0951"
|
542
546
|
}
|
543
547
|
declare const AnglesInterfaceCampaigns: {
|
544
548
|
"0x15E96CDecA34B9DE1B31586c1206206aDb92E69D": {
|
@@ -1130,6 +1134,32 @@ declare const EtherlinkInterfaceCampaigns: {
|
|
1130
1134
|
url: string;
|
1131
1135
|
};
|
1132
1136
|
};
|
1137
|
+
declare const HypuurFiCampaignsInterface: {
|
1138
|
+
"mock program with referral": {
|
1139
|
+
campaignType: any;
|
1140
|
+
computeChainId: any;
|
1141
|
+
hooks: {
|
1142
|
+
hookType: any;
|
1143
|
+
key: string;
|
1144
|
+
chainId: any;
|
1145
|
+
contractAddress: string;
|
1146
|
+
contractState: any;
|
1147
|
+
boostForReferrer: any;
|
1148
|
+
valueForBoostForReferrer: number;
|
1149
|
+
boostForInvited: any;
|
1150
|
+
valueForBoostForInvited: number;
|
1151
|
+
defaultBoost: any;
|
1152
|
+
maximumBoostReferrer: number;
|
1153
|
+
maximumBoostInvited: number;
|
1154
|
+
cumulativeBoost: boolean;
|
1155
|
+
}[];
|
1156
|
+
targetToken: string;
|
1157
|
+
whitelist: never[];
|
1158
|
+
blacklist: never[];
|
1159
|
+
url: string;
|
1160
|
+
forwarders: never[];
|
1161
|
+
};
|
1162
|
+
};
|
1133
1163
|
declare const SwapxInterfaceCampaigns: {
|
1134
1164
|
[key in swapxCampaigns]: partialConfig;
|
1135
1165
|
};
|
@@ -1518,8 +1548,53 @@ declare const TACInterfaceCampaigns: {
|
|
1518
1548
|
targetTokenPricing: boolean;
|
1519
1549
|
apr: string;
|
1520
1550
|
};
|
1551
|
+
"TAC Supply xUpUSDC 0x396A3f77EE1faf5A3C46e878bA7b7a2dcbe55517": {
|
1552
|
+
campaignType: any;
|
1553
|
+
computeChainId: any;
|
1554
|
+
distributionChainId: any;
|
1555
|
+
targetToken: string;
|
1556
|
+
rewardToken: string;
|
1557
|
+
creator: string;
|
1558
|
+
hooks: never[];
|
1559
|
+
whitelist: never[];
|
1560
|
+
blacklist: never[];
|
1561
|
+
forwarders: never[];
|
1562
|
+
rewardTokenPricing: boolean;
|
1563
|
+
targetTokenPricing: boolean;
|
1564
|
+
apr: string;
|
1565
|
+
};
|
1566
|
+
"TAC Supply ylbfBTC.tac 0x0d1862e73a1430A5FD3245B47859c1BEcD6f3A1D": {
|
1567
|
+
campaignType: any;
|
1568
|
+
computeChainId: any;
|
1569
|
+
distributionChainId: any;
|
1570
|
+
targetToken: string;
|
1571
|
+
rewardToken: string;
|
1572
|
+
creator: string;
|
1573
|
+
hooks: never[];
|
1574
|
+
whitelist: never[];
|
1575
|
+
blacklist: never[];
|
1576
|
+
forwarders: never[];
|
1577
|
+
rewardTokenPricing: boolean;
|
1578
|
+
targetTokenPricing: boolean;
|
1579
|
+
apr: string;
|
1580
|
+
};
|
1581
|
+
"TAC Supply uTAC++ 0xAF87B90E8a3035905697E07Bb813d2d59D2b0951": {
|
1582
|
+
campaignType: any;
|
1583
|
+
computeChainId: any;
|
1584
|
+
distributionChainId: any;
|
1585
|
+
targetToken: string;
|
1586
|
+
rewardToken: string;
|
1587
|
+
creator: string;
|
1588
|
+
hooks: never[];
|
1589
|
+
whitelist: never[];
|
1590
|
+
blacklist: never[];
|
1591
|
+
forwarders: never[];
|
1592
|
+
rewardTokenPricing: boolean;
|
1593
|
+
targetTokenPricing: boolean;
|
1594
|
+
apr: string;
|
1595
|
+
};
|
1521
1596
|
};
|
1522
1597
|
export declare const MerklInterfaceCampaigns: {
|
1523
|
-
[key in program]: typeof PufferInterfaceCampaigns | typeof ZkSyncInterfaceCampaigns | typeof ModeInterfaceCampaigns | typeof VicunaInterfaceCampaigns | typeof SonicmarketInterfaceCampaigns | typeof ReserveInterfaceCampaigns | typeof BeetsInterfaceCampaigns | typeof CeloInterfaceCampaigns | typeof EtherlinkInterfaceCampaigns | typeof SwapxInterfaceCampaigns | typeof AnglesInterfaceCampaigns | typeof RoninInterfaceCampaigns | typeof TACInterfaceCampaigns;
|
1598
|
+
[key in program]: typeof PufferInterfaceCampaigns | typeof ZkSyncInterfaceCampaigns | typeof ModeInterfaceCampaigns | typeof VicunaInterfaceCampaigns | typeof SonicmarketInterfaceCampaigns | typeof ReserveInterfaceCampaigns | typeof BeetsInterfaceCampaigns | typeof CeloInterfaceCampaigns | typeof EtherlinkInterfaceCampaigns | typeof SwapxInterfaceCampaigns | typeof AnglesInterfaceCampaigns | typeof RoninInterfaceCampaigns | typeof TACInterfaceCampaigns | typeof HypuurFiCampaignsInterface;
|
1524
1599
|
};
|
1525
1600
|
export {};
|
@@ -16,6 +16,7 @@ export var program;
|
|
16
16
|
program["Angles"] = "Angles";
|
17
17
|
program["Ronin"] = "Ronin";
|
18
18
|
program["TAC"] = "TAC";
|
19
|
+
program["HypuurFi"] = "HypuurFi";
|
19
20
|
})(program || (program = {}));
|
20
21
|
export var roninCampaigns;
|
21
22
|
(function (roninCampaigns) {
|
@@ -615,6 +616,9 @@ export var tacCampaigns;
|
|
615
616
|
tacCampaigns["TAC_Supply_TACyUSD"] = "TAC Supply TACyUSD 0x2799dE2E1e769fA58dd3787F70BcD839AF3a1F39";
|
616
617
|
tacCampaigns["TAC_Supply_tacETH9s"] = "TAC Supply tacETH9s 0xDe7CFf032D453Ce6B0a796043E75d380Df258812";
|
617
618
|
tacCampaigns["TAC_Supply_ylSolvBTCtac"] = "TAC Supply ylSolvBTC.tac 0x34d16e4fB8757A88D986f9EfE2484F0badBF22C1";
|
619
|
+
tacCampaigns["TAC_Supply_xUpUSDC"] = "TAC Supply xUpUSDC 0x396A3f77EE1faf5A3C46e878bA7b7a2dcbe55517";
|
620
|
+
tacCampaigns["TAC_Supply_ylbfBTCtac"] = "TAC Supply ylbfBTC.tac 0x0d1862e73a1430A5FD3245B47859c1BEcD6f3A1D";
|
621
|
+
tacCampaigns["TAC_Supply_uTAC"] = "TAC Supply uTAC++ 0xAF87B90E8a3035905697E07Bb813d2d59D2b0951";
|
618
622
|
})(tacCampaigns || (tacCampaigns = {}));
|
619
623
|
const AnglesInterfaceCampaigns = {
|
620
624
|
[anglesCampaigns.Angles_supply_in_angles_liquid]: {
|
@@ -995,6 +999,38 @@ const EtherlinkInterfaceCampaigns = {
|
|
995
999
|
url: "https://app.hanji.io/trade/0xbb6b01d94e3f6ebae8647cb56d544f57928ab758",
|
996
1000
|
},
|
997
1001
|
};
|
1002
|
+
var HypuurFiCampaigns;
|
1003
|
+
(function (HypuurFiCampaigns) {
|
1004
|
+
HypuurFiCampaigns["test"] = "mock program with referral";
|
1005
|
+
})(HypuurFiCampaigns || (HypuurFiCampaigns = {}));
|
1006
|
+
const HypuurFiCampaignsInterface = {
|
1007
|
+
[HypuurFiCampaigns.test]: {
|
1008
|
+
campaignType: Campaign.ERC20,
|
1009
|
+
computeChainId: ChainId.HYPEREVM,
|
1010
|
+
hooks: [
|
1011
|
+
{
|
1012
|
+
hookType: HOOK.REFERRALPROGRAM,
|
1013
|
+
key: "test-0",
|
1014
|
+
chainId: ChainId.HYPEREVM,
|
1015
|
+
contractAddress: "0xD696E6b94cE79Fe9AAC288C0Fc761643219510B6",
|
1016
|
+
contractState: contractStateBoost.SYNCHRONIZED,
|
1017
|
+
boostForReferrer: boostingReferralFunction.PROPORTIONAL,
|
1018
|
+
valueForBoostForReferrer: 50000000,
|
1019
|
+
boostForInvited: boostingReferralFunction.PROPORTIONAL,
|
1020
|
+
valueForBoostForInvited: 50000000,
|
1021
|
+
defaultBoost: defaultReferralBoost.SCORE,
|
1022
|
+
maximumBoostReferrer: 0,
|
1023
|
+
maximumBoostInvited: 50000000,
|
1024
|
+
cumulativeBoost: false,
|
1025
|
+
},
|
1026
|
+
],
|
1027
|
+
targetToken: "0xfCA0802cb10b3b134a91e07f03965f63eF4B23eA",
|
1028
|
+
whitelist: [],
|
1029
|
+
blacklist: [],
|
1030
|
+
url: "",
|
1031
|
+
forwarders: [],
|
1032
|
+
},
|
1033
|
+
};
|
998
1034
|
const SwapxInterfaceCampaigns = {
|
999
1035
|
[swapxCampaigns.Swapx_beS_OS_beS_gauge_Swapx]: {
|
1000
1036
|
campaignType: Campaign.CLAMM,
|
@@ -6126,6 +6162,9 @@ const tacUSNMultiplier = 2.5;
|
|
6126
6162
|
const tacyUSDMultiplier = 2.5;
|
6127
6163
|
const tacETH9sMultiplier = 1.75;
|
6128
6164
|
const tacylSolvBTCMultiplier = 1.5;
|
6165
|
+
const tacxUpUSDCMultiplier = 2.5;
|
6166
|
+
const tacylbfBTCMultiplier = 1.5;
|
6167
|
+
const tacuTACMultiplier = 2.5;
|
6129
6168
|
const TACInterfaceCampaigns = {
|
6130
6169
|
[tacCampaigns.TAC_Supply_TACETH]: {
|
6131
6170
|
campaignType: Campaign.ERC20_FIX_APR,
|
@@ -6487,6 +6526,51 @@ const TACInterfaceCampaigns = {
|
|
6487
6526
|
targetTokenPricing: true,
|
6488
6527
|
apr: ((BaseTACREWARDS * tacylSolvBTCMultiplier * 365) / DAILYREWARDSINDOLLAR).toFixed(2).toString(),
|
6489
6528
|
},
|
6529
|
+
[tacCampaigns.TAC_Supply_xUpUSDC]: {
|
6530
|
+
campaignType: Campaign.ERC20_FIX_APR,
|
6531
|
+
computeChainId: ChainId.MAINNET,
|
6532
|
+
distributionChainId: ChainId.GNOSIS,
|
6533
|
+
targetToken: "0x396A3f77EE1faf5A3C46e878bA7b7a2dcbe55517",
|
6534
|
+
rewardToken: "0xf2401de511DC0D1ad4762588722f5B0574A56b60",
|
6535
|
+
creator: "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701",
|
6536
|
+
hooks: [],
|
6537
|
+
whitelist: [],
|
6538
|
+
blacklist: [],
|
6539
|
+
forwarders: [],
|
6540
|
+
rewardTokenPricing: false,
|
6541
|
+
targetTokenPricing: true,
|
6542
|
+
apr: ((BaseTACREWARDS * tacxUpUSDCMultiplier * 365) / DAILYREWARDSINDOLLAR).toFixed(2).toString(),
|
6543
|
+
},
|
6544
|
+
[tacCampaigns.TAC_Supply_ylbfBTCtac]: {
|
6545
|
+
campaignType: Campaign.ERC20_FIX_APR,
|
6546
|
+
computeChainId: ChainId.MAINNET,
|
6547
|
+
distributionChainId: ChainId.GNOSIS,
|
6548
|
+
targetToken: "0x0d1862e73a1430A5FD3245B47859c1BEcD6f3A1D",
|
6549
|
+
rewardToken: "0xf2401de511DC0D1ad4762588722f5B0574A56b60",
|
6550
|
+
creator: "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701",
|
6551
|
+
hooks: [],
|
6552
|
+
whitelist: [],
|
6553
|
+
blacklist: [],
|
6554
|
+
forwarders: [],
|
6555
|
+
rewardTokenPricing: false,
|
6556
|
+
targetTokenPricing: true,
|
6557
|
+
apr: ((BaseTACREWARDS * tacylbfBTCMultiplier * 365) / DAILYREWARDSINDOLLAR).toFixed(2).toString(),
|
6558
|
+
},
|
6559
|
+
[tacCampaigns.TAC_Supply_uTAC]: {
|
6560
|
+
campaignType: Campaign.ERC20_FIX_APR,
|
6561
|
+
computeChainId: ChainId.MAINNET,
|
6562
|
+
distributionChainId: ChainId.GNOSIS,
|
6563
|
+
targetToken: "0xAF87B90E8a3035905697E07Bb813d2d59D2b0951",
|
6564
|
+
rewardToken: "0xf2401de511DC0D1ad4762588722f5B0574A56b60",
|
6565
|
+
creator: "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701",
|
6566
|
+
hooks: [],
|
6567
|
+
whitelist: [],
|
6568
|
+
blacklist: [],
|
6569
|
+
forwarders: [],
|
6570
|
+
rewardTokenPricing: false,
|
6571
|
+
targetTokenPricing: true,
|
6572
|
+
apr: ((BaseTACREWARDS * tacuTACMultiplier * 365) / DAILYREWARDSINDOLLAR).toFixed(2).toString(),
|
6573
|
+
},
|
6490
6574
|
};
|
6491
6575
|
export const MerklInterfaceCampaigns = {
|
6492
6576
|
[program.Puffer]: PufferInterfaceCampaigns,
|
@@ -6502,4 +6586,5 @@ export const MerklInterfaceCampaigns = {
|
|
6502
6586
|
[program.Angles]: AnglesInterfaceCampaigns,
|
6503
6587
|
[program.Ronin]: RoninInterfaceCampaigns,
|
6504
6588
|
[program.TAC]: TACInterfaceCampaigns,
|
6589
|
+
[program.HypuurFi]: HypuurFiCampaignsInterface,
|
6505
6590
|
};
|