@merkl/api 0.19.30 → 0.19.32
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/engine/dynamicData/factory.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +3 -3
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +12 -8
- package/dist/src/engine/opportunityMetadata/factory.js +1 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +9 -7
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +5 -3
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +7 -1
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +3 -0
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +19 -10
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -50,5 +50,6 @@ const map = {
|
|
50
50
|
[Campaign.M0]: new DefaultDynamicData(), // TODO
|
51
51
|
[Campaign.MORPHOSUPPLY]: new DefaultDynamicData(), // TODO
|
52
52
|
[Campaign.SYNCSWAP_VAULT]: new DefaultDynamicData(), // TODO
|
53
|
+
[Campaign.MAVERICK_BP]: new DefaultDynamicData(), // TODO
|
53
54
|
};
|
54
55
|
export const dynamicDataBuilderFactory = (campaignType) => map[campaignType];
|
@@ -77,9 +77,9 @@ export declare class GenericProcessor<Input extends callKeys, DataRaw extends da
|
|
77
77
|
processingRound3(_typeInfo: DataRaw): void;
|
78
78
|
processingRound4(_typeInfo: DataRaw): void;
|
79
79
|
handleWhiteListBlacklistRound5(typeInfo: DataRaw, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>): {
|
80
|
-
whitelistedSupplyTargetToken:
|
80
|
+
whitelistedSupplyTargetToken: any;
|
81
81
|
totalSupply: any;
|
82
|
-
blacklistedSupply:
|
82
|
+
blacklistedSupply: any;
|
83
83
|
};
|
84
84
|
processingRound5(_index: number, type: tokenType, typeInfo: DataRaw, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<Output>;
|
85
85
|
computeRound1(type: tokenType, typeInfo: DataRaw): tokenTypeStruct;
|
@@ -89,7 +89,7 @@ export declare class GenericProcessor<Input extends callKeys, DataRaw extends da
|
|
89
89
|
computeRound5(index: number, type: tokenType, typeInfo: DataRaw, calls: string[], campaign: CampaignParameters<ERC20SupportedCampaignType>, pricer: Pricer): Promise<tokenTypeStruct>;
|
90
90
|
generateWhitelistCall(type: tokenType, typeInfo: DataRaw, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>): CallDto[];
|
91
91
|
generateBlackListCall(type: tokenType, typeInfo: DataRaw, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>): CallDto[];
|
92
|
-
decodeListedSupply(index: number,
|
92
|
+
decodeListedSupply(index: number, list: string[], calls: string[]): string;
|
93
93
|
decodeRound(round: callType[], index: number, calls: string[], type: tokenType, data: DataRaw): void;
|
94
94
|
decodePreviousRound(round: Round, calls: string[], data: DataRaw, type: tokenType, index: number): void;
|
95
95
|
decodePreviousStakingRound(round: Round, calls: string[], data: DataRaw, type: tokenType, index: number): void;
|
@@ -42,10 +42,14 @@ export class GenericProcessor {
|
|
42
42
|
processingRound3(_typeInfo) { }
|
43
43
|
processingRound4(_typeInfo) { }
|
44
44
|
handleWhiteListBlacklistRound5(typeInfo, campaign) {
|
45
|
+
const blacklistedSupplyBN = BigInt(typeInfo.blacklistedSupply);
|
46
|
+
const totalSupplyBN = BigInt(typeInfo.totalSupply);
|
45
47
|
const totalSupply = BN2Number(typeInfo.totalSupply, campaign.campaignParameters.decimalsTargetToken);
|
46
|
-
const whitelistedSupply =
|
47
|
-
const blacklistedSupply =
|
48
|
-
let whitelistedSupplyTargetToken = whitelistedSupply
|
48
|
+
const whitelistedSupply = BN2Number(typeInfo.whitelistedSupply, campaign.campaignParameters.decimalsTargetToken);
|
49
|
+
const blacklistedSupply = BN2Number(typeInfo.blacklistedSupply, campaign.campaignParameters.decimalsTargetToken);
|
50
|
+
let whitelistedSupplyTargetToken = whitelistedSupply
|
51
|
+
? whitelistedSupply
|
52
|
+
: BN2Number(totalSupplyBN - blacklistedSupplyBN, campaign.campaignParameters.decimalsTargetToken);
|
49
53
|
whitelistedSupplyTargetToken = whitelistedSupplyTargetToken ? whitelistedSupplyTargetToken : 0.00001;
|
50
54
|
return {
|
51
55
|
whitelistedSupplyTargetToken,
|
@@ -162,9 +166,9 @@ export class GenericProcessor {
|
|
162
166
|
};
|
163
167
|
}
|
164
168
|
async computeRound5(index, type, typeInfo, calls, campaign, pricer) {
|
165
|
-
typeInfo.whitelistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.
|
169
|
+
typeInfo.whitelistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.whitelist, calls);
|
166
170
|
index = index + campaign.campaignParameters.whitelist.length;
|
167
|
-
typeInfo.blacklistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.
|
171
|
+
typeInfo.blacklistedSupply = this.decodeListedSupply(index, campaign.campaignParameters.blacklist, calls);
|
168
172
|
index = index + campaign.campaignParameters.blacklist.length;
|
169
173
|
this.decodePreviousRound(Round.four, calls, typeInfo, type, index);
|
170
174
|
if (typeInfo.isStaking === "true") {
|
@@ -210,13 +214,13 @@ export class GenericProcessor {
|
|
210
214
|
}
|
211
215
|
return blacklistedLiquidityCalls;
|
212
216
|
}
|
213
|
-
decodeListedSupply(index,
|
217
|
+
decodeListedSupply(index, list, calls) {
|
214
218
|
if (list.length === 0) {
|
215
219
|
return "0";
|
216
220
|
}
|
217
|
-
let listedSupply =
|
221
|
+
let listedSupply = 0n;
|
218
222
|
for (const _ of list) {
|
219
|
-
listedSupply +=
|
223
|
+
listedSupply += BigInt(decodeCall(calls, index++, "balanceOf"));
|
220
224
|
}
|
221
225
|
return listedSupply.toString();
|
222
226
|
}
|
@@ -53,5 +53,6 @@ const map = {
|
|
53
53
|
[Campaign.ENCOMPASSING]: new EncompassingMetadata(),
|
54
54
|
[Campaign.EVENT_BASED]: new EventBasedMetadata(),
|
55
55
|
[Campaign.ERC20REBASEFIXAPR]: new Erc20Metadata(),
|
56
|
+
[Campaign.MAVERICK_BP]: new DefaultMetadata(), // TODO
|
56
57
|
};
|
57
58
|
export const metadataBuilderFactory = (campaignType) => map[campaignType];
|
@@ -76,13 +76,15 @@ export class ClammMetadata {
|
|
76
76
|
mainProtocolId = "stryke";
|
77
77
|
else if (mainProtocolId?.includes("quickswap"))
|
78
78
|
mainProtocolId = "quickswap";
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
mainProtocolId
|
79
|
+
if (!!mainProtocolId) {
|
80
|
+
// Make sure the protocol exist in the correct type
|
81
|
+
const protocol = (await ProtocolService.findMany({ id: mainProtocolId }))?.[0];
|
82
|
+
if (!!protocol) {
|
83
|
+
mainProtocolId = protocol?.id;
|
84
|
+
}
|
85
|
+
if (mainProtocolId === "unknown") {
|
86
|
+
mainProtocolId = undefined;
|
87
|
+
}
|
86
88
|
}
|
87
89
|
if (!mainProtocolId || !protocolIdList.includes(mainProtocolId))
|
88
90
|
log.warn(`protocol not found for ${AMM[params.amm]}`);
|
@@ -22,9 +22,11 @@ export class Erc20Metadata {
|
|
22
22
|
action = dynamicData?.typeInfo?.action ?? action;
|
23
23
|
name = dynamicData?.typeInfo?.cardName;
|
24
24
|
mainProtocolId = dynamicData?.typeInfo?.protocol?.toLowerCase().replace(" ", "");
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if (!!mainProtocolId) {
|
26
|
+
const protocol = (await ProtocolService.findMany({ id: mainProtocolId }))?.[0];
|
27
|
+
if (!!protocol) {
|
28
|
+
mainProtocolId = protocol?.id;
|
29
|
+
}
|
28
30
|
}
|
29
31
|
// Case of lending protocols and receipt tokens
|
30
32
|
if (!!dynamicData && !!dynamicData.typeInfo?.underlying) {
|
@@ -152,10 +152,14 @@ export class OpportunityRepository {
|
|
152
152
|
newOpp.action = "LEND";
|
153
153
|
}
|
154
154
|
const toDisconnect = {
|
155
|
+
mainProtocol: "",
|
155
156
|
protocols: [],
|
156
157
|
tokens: [],
|
157
158
|
};
|
158
159
|
if (!!previousOpportunity) {
|
160
|
+
if (previousOpportunity.mainProtocolId !== newOpp.mainProtocol) {
|
161
|
+
toDisconnect.mainProtocol = previousOpportunity.mainProtocolId ?? "";
|
162
|
+
}
|
159
163
|
for (const protocol of previousOpportunity.Protocols) {
|
160
164
|
if (!newOpp.protocols || !newOpp.protocols.includes(protocol.id)) {
|
161
165
|
toDisconnect.protocols.push(protocol.id);
|
@@ -203,7 +207,9 @@ export class OpportunityRepository {
|
|
203
207
|
status: newOpp.status,
|
204
208
|
type: newOpp.type,
|
205
209
|
Chain: { connect: { id: newOpp.chainId } },
|
206
|
-
MainProtocol: !!newOpp.mainProtocol
|
210
|
+
MainProtocol: !!newOpp.mainProtocol
|
211
|
+
? { connect: { id: newOpp.mainProtocol } }
|
212
|
+
: { disconnect: { id: toDisconnect.mainProtocol } },
|
207
213
|
Protocols: {
|
208
214
|
connect: (newOpp.protocols ?? []).map((protocol) => {
|
209
215
|
return { id: protocol };
|
@@ -805,6 +805,7 @@ declare const EtherlinkInterfaceCampaigns: {
|
|
805
805
|
maximumBoostInvited: number;
|
806
806
|
cumulativeBoost: boolean;
|
807
807
|
}[];
|
808
|
+
url: string;
|
808
809
|
};
|
809
810
|
"Hanji WETH/USDC Etherlink 0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb": {
|
810
811
|
campaignType: any;
|
@@ -842,6 +843,7 @@ declare const EtherlinkInterfaceCampaigns: {
|
|
842
843
|
maximumBoostInvited: number;
|
843
844
|
cumulativeBoost: boolean;
|
844
845
|
}[];
|
846
|
+
url: string;
|
845
847
|
};
|
846
848
|
"Hanji WBTC/USDC Etherlink 0xbb6b01d94e3f6ebae8647cb56d544f57928ab758": {
|
847
849
|
campaignType: any;
|
@@ -879,6 +881,7 @@ declare const EtherlinkInterfaceCampaigns: {
|
|
879
881
|
maximumBoostInvited: number;
|
880
882
|
cumulativeBoost: boolean;
|
881
883
|
}[];
|
884
|
+
url: string;
|
882
885
|
};
|
883
886
|
};
|
884
887
|
declare const SwapxInterfaceCampaigns: {
|
@@ -42,7 +42,7 @@ export var etherlinkCampaigns;
|
|
42
42
|
})(etherlinkCampaigns || (etherlinkCampaigns = {}));
|
43
43
|
const etherlinkReferralProgram = {
|
44
44
|
hookType: HOOK.REFERRALPROGRAM,
|
45
|
-
key: "
|
45
|
+
key: "apple-farm",
|
46
46
|
chainId: ChainId.ETHERLINK,
|
47
47
|
contractAddress: "0xF39CC381B91f36238c77f42B9fF4D45376F80E5b",
|
48
48
|
contractState: contractStateBoost.SYNCHRONIZED,
|
@@ -57,8 +57,14 @@ const etherlinkReferralProgram = {
|
|
57
57
|
};
|
58
58
|
const blacklistEtherlink = [
|
59
59
|
"0x8872642881C7C3f4124f3215a0D12CDf807EEB01",
|
60
|
-
"0xA237E96Abc3180AF377EcF22aE590C02991f9b1F",
|
61
60
|
"0x50D760f3a8630e620BC0D29E8031E8a37dEB4751",
|
61
|
+
"0xA237E96Abc3180AF377EcF22aE590C02991f9b1F",
|
62
|
+
"0x851CAD3E0b90C2535725eCeFcCDfeeb7996B9414",
|
63
|
+
"0x931ef6d9ea6FfFfd73D5F7CE35664BAD76cBc784",
|
64
|
+
"0xf663c334Ae22e9A086193A52918f873154Bdf2d4",
|
65
|
+
"0x6c1b204185A55E9DaA0bF026720Fe94458ddd89F",
|
66
|
+
"0x56A8b583276278513Eb78c3d132a80c1e81B9405",
|
67
|
+
"0x6a2f09Bc9E6b82b38FCa096792B94f36FAd657Ac",
|
62
68
|
];
|
63
69
|
export var swapxCampaigns;
|
64
70
|
(function (swapxCampaigns) {
|
@@ -555,7 +561,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
555
561
|
targetToken: "0x79052Ab3C166D4899a1e0DD033aC3b379AF0B1fD",
|
556
562
|
whitelist: [],
|
557
563
|
blacklist: blacklistEtherlink,
|
558
|
-
url: "
|
564
|
+
url: "https://www.uranium.io/",
|
559
565
|
forwarders: [],
|
560
566
|
},
|
561
567
|
[etherlinkCampaigns.Hanji_HJLP]: {
|
@@ -593,8 +599,8 @@ const EtherlinkInterfaceCampaigns = {
|
|
593
599
|
forwarders: [],
|
594
600
|
isOutOfRangeIncentivized: false,
|
595
601
|
weightFees: 6000,
|
596
|
-
weightToken0:
|
597
|
-
weightToken1:
|
602
|
+
weightToken0: 2000,
|
603
|
+
weightToken1: 2000,
|
598
604
|
},
|
599
605
|
[etherlinkCampaigns.Iguana_XTZ_USDC]: {
|
600
606
|
campaignType: Campaign.CLAMM,
|
@@ -634,13 +640,13 @@ const EtherlinkInterfaceCampaigns = {
|
|
634
640
|
chainId: ChainId.ETHERLINK,
|
635
641
|
contractAddress: "0xF39CC381B91f36238c77f42B9fF4D45376F80E5b",
|
636
642
|
contractState: contractStateBoost.SYNCHRONIZED,
|
637
|
-
boostForReferrer: boostingReferralFunction.
|
638
|
-
valueForBoostForReferrer:
|
639
|
-
boostForInvited: boostingReferralFunction.
|
640
|
-
valueForBoostForInvited:
|
643
|
+
boostForReferrer: boostingReferralFunction.PROPORTIONAL,
|
644
|
+
valueForBoostForReferrer: 50000000,
|
645
|
+
boostForInvited: boostingReferralFunction.PROPORTIONAL,
|
646
|
+
valueForBoostForInvited: 50000000,
|
641
647
|
defaultBoost: defaultReferralBoost.SCORE,
|
642
648
|
maximumBoostReferrer: 0,
|
643
|
-
maximumBoostInvited:
|
649
|
+
maximumBoostInvited: 50000000,
|
644
650
|
cumulativeBoost: false,
|
645
651
|
},
|
646
652
|
],
|
@@ -678,6 +684,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
678
684
|
blacklist: blacklistEtherlink,
|
679
685
|
forwarders: [],
|
680
686
|
hooks: [etherlinkReferralProgram],
|
687
|
+
url: "https://app.hanji.io/trade/0xd0bc067cf877f7b76ceb331891331d9e6acda1a7",
|
681
688
|
},
|
682
689
|
[etherlinkCampaigns.Hanji_WETH_USDC]: {
|
683
690
|
campaignType: Campaign.EVENT_BASED,
|
@@ -707,6 +714,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
707
714
|
blacklist: blacklistEtherlink,
|
708
715
|
forwarders: [],
|
709
716
|
hooks: [etherlinkReferralProgram],
|
717
|
+
url: "https://app.hanji.io/trade/0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb",
|
710
718
|
},
|
711
719
|
[etherlinkCampaigns.Hanji_WBTC_USDC]: {
|
712
720
|
campaignType: Campaign.EVENT_BASED,
|
@@ -736,6 +744,7 @@ const EtherlinkInterfaceCampaigns = {
|
|
736
744
|
blacklist: blacklistEtherlink,
|
737
745
|
forwarders: [],
|
738
746
|
hooks: [etherlinkReferralProgram],
|
747
|
+
url: "https://app.hanji.io/trade/0xbb6b01d94e3f6ebae8647cb56d544f57928ab758",
|
739
748
|
},
|
740
749
|
};
|
741
750
|
const SwapxInterfaceCampaigns = {
|