@merkl/api 0.20.65 → 0.20.67
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 +2 -0
- package/dist/src/engine/dynamicData/implementations/Erc20.js +42 -80
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +18 -18
- package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +30 -33
- package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.d.ts +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/helpers/factoryFinder.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/helpers/hardcoded.d.ts +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/helpers/hardcoded.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/helpers/ownerFinder.d.ts +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/helpers/ownerFinder.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/{constants.d.ts → helpers/tokenType.d.ts} +6 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.d.ts +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.js +5 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.js +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.js +7 -6
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +5 -4
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +4 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +4 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.js +3 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.js +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.js +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.d.ts +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.js +4 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +5 -4
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.d.ts +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +6 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.js +6 -5
- package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.d.ts +1 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.js +1 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TemplateProcessor.d.ts +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TemplateProcessor.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.js +3 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.js +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.js +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +7 -7
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.d.ts +2 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +6 -5
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.d.ts +2 -1
- package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.js +3 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/processorMapping.d.ts +6 -0
- package/dist/src/engine/erc20SubTypeProcessors/{factory.js → implementations/processorMapping.js} +48 -49
- package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +4 -3
- package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.d.ts +2 -2
- package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.js +4 -3
- package/dist/src/engine/erc20SubTypeProcessors/subtypesPrices.d.ts +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesPrices.js +24 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.d.ts +3 -17
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.js +62 -52
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound2.d.ts +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound2.js +22 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound3.d.ts +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound3.js +22 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound4.d.ts +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound4.js +22 -0
- package/dist/src/engine/opportunityMetadata/factory.js +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/CompoundV3.js +4 -1
- package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.js +1 -1
- package/dist/src/utils/decodeCalls.d.ts +1 -1
- package/dist/src/utils/decodeCalls.js +1 -1
- package/dist/src/utils/encodeCalls.d.ts +2 -2
- package/dist/src/utils/encodeCalls.js +15 -15
- package/dist/src/utils/generateCardName.d.ts +3 -4
- package/dist/src/utils/generateCardName.js +3 -3
- package/dist/src/utils/generateIcons.d.ts +3 -0
- package/dist/src/utils/generateIcons.js +65 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/engine/erc20SubTypeProcessors/factory.d.ts +0 -6
- /package/dist/src/engine/erc20SubTypeProcessors/{constants.js → helpers/tokenType.js} +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
import { decodeCall, decodeReturnValue } from "@/utils/decodeCalls";
|
2
|
-
import { tokenType } from "./constants";
|
3
|
-
import { erc20ProcessorFactory } from "./factory";
|
4
2
|
import { enzymeFundValueCalculatorRouterMapping, getTypeFromFactoryAddress } from "./helpers/factoryFinder";
|
5
3
|
import { getTypeFromAddressChain } from "./helpers/hardcoded";
|
6
4
|
import { getTypeFromOwnerAddress } from "./helpers/ownerFinder";
|
5
|
+
import { tokenType } from "./helpers/tokenType";
|
6
|
+
import { processorMapping } from "./implementations/processorMapping";
|
7
7
|
function satisfiesNameConditions(name, type) {
|
8
8
|
const lowerCaseName = name.toLowerCase();
|
9
9
|
switch (type) {
|
@@ -165,168 +165,178 @@ function satisfiesNameConditions(name, type) {
|
|
165
165
|
return false;
|
166
166
|
}
|
167
167
|
}
|
168
|
-
function generateResult(type, name,
|
169
|
-
const
|
168
|
+
function generateResult(type, name, targetToken, typeInfo, campaign) {
|
169
|
+
const ProcessorClass = processorMapping[type];
|
170
|
+
if (!ProcessorClass) {
|
171
|
+
throw new Error(`Processor not found for key: ${type}`);
|
172
|
+
}
|
173
|
+
const processorObject = new ProcessorClass();
|
174
|
+
if (campaign)
|
175
|
+
typeInfo = { ...typeInfo, ...parseForStaking(campaign) };
|
176
|
+
typeInfo = {
|
177
|
+
...typeInfo,
|
170
178
|
name: name,
|
171
|
-
tokenAddress:
|
179
|
+
tokenAddress: targetToken,
|
172
180
|
totalSupply: 0,
|
173
181
|
blacklistedSupply: 0,
|
174
|
-
whitelistedSupply: 0,
|
175
|
-
...parseForStaking(campaign),
|
176
|
-
...(data ?? {}),
|
177
182
|
};
|
178
|
-
return
|
183
|
+
return processorObject.computeRound1(type, typeInfo);
|
179
184
|
}
|
180
|
-
function processNamingConditions(type, name, campaign) {
|
185
|
+
function processNamingConditions(type, name, targetToken, campaign) {
|
181
186
|
if (satisfiesNameConditions(name, type)) {
|
182
|
-
return generateResult(type, name, campaign);
|
187
|
+
return generateResult(type, name, targetToken, {}, campaign);
|
183
188
|
}
|
184
189
|
}
|
185
|
-
function processNamingConditionsInOrder(types, name, campaign) {
|
190
|
+
function processNamingConditionsInOrder(types, name, targetToken, campaign) {
|
186
191
|
for (const type of types) {
|
187
|
-
const result = processNamingConditions(type, name, campaign);
|
192
|
+
const result = processNamingConditions(type, name, targetToken, campaign);
|
188
193
|
if (result)
|
189
194
|
return result;
|
190
195
|
}
|
191
196
|
}
|
192
|
-
function parseForFactory(calls, campaign) {
|
197
|
+
function parseForFactory(calls, targetToken, campaign) {
|
193
198
|
try {
|
194
199
|
const factory = decodeReturnValue(calls.factory, "factory");
|
195
200
|
const name = decodeReturnValue(calls.name, "name");
|
196
201
|
const type = getTypeFromFactoryAddress(factory);
|
197
202
|
if (type !== tokenType.unknown)
|
198
|
-
return generateResult(type, name,
|
203
|
+
return generateResult(type, name, targetToken, { factory }, campaign);
|
199
204
|
}
|
200
205
|
catch (e) {
|
201
206
|
// No factory on this token
|
202
207
|
// console.log(e);
|
203
208
|
}
|
204
209
|
}
|
205
|
-
function parseForOwner(calls,
|
210
|
+
function parseForOwner(calls, targetToken) {
|
206
211
|
try {
|
207
212
|
const owner = decodeReturnValue(calls.owner, "owner");
|
208
213
|
const name = decodeReturnValue(calls.name, "name");
|
209
214
|
const type = getTypeFromOwnerAddress(owner);
|
210
215
|
if (type !== tokenType.unknown)
|
211
|
-
return generateResult(type, name,
|
216
|
+
return generateResult(type, name, targetToken, { owner: owner });
|
212
217
|
}
|
213
218
|
catch (e) {
|
214
219
|
// No factory on this token
|
215
220
|
// console.log(e);
|
216
221
|
}
|
217
222
|
}
|
218
|
-
function parseForEnzyme(calls,
|
223
|
+
function parseForEnzyme(calls, targetToken) {
|
219
224
|
// Enzyme check
|
220
225
|
try {
|
221
226
|
const dispatcher = decodeReturnValue(calls.creator, "getCreator");
|
222
227
|
const name = decodeReturnValue(calls.name, "name");
|
223
228
|
const type = getTypeFromFactoryAddress(dispatcher);
|
224
229
|
const fundValueCalculator = enzymeFundValueCalculatorRouterMapping[dispatcher];
|
230
|
+
const typeInfo = {
|
231
|
+
fundValueCalculator,
|
232
|
+
dispatcher,
|
233
|
+
};
|
225
234
|
if (type === tokenType.enzyme) {
|
226
|
-
return generateResult(type, name,
|
227
|
-
fundValueCalculator,
|
228
|
-
dispatcher,
|
229
|
-
});
|
235
|
+
return generateResult(type, name, targetToken, typeInfo);
|
230
236
|
}
|
231
237
|
}
|
232
238
|
catch (e) {
|
233
239
|
// No factory on this token
|
234
240
|
}
|
235
241
|
}
|
236
|
-
function parseForMetamorpho(calls,
|
242
|
+
function parseForMetamorpho(calls, targetToken) {
|
237
243
|
// MetaMorpho check
|
238
244
|
try {
|
239
245
|
decodeReturnValue(calls.metamorpho, "MORPHO");
|
240
246
|
const name = decodeReturnValue(calls.name, "name");
|
241
|
-
return generateResult(tokenType.metamorpho, name,
|
247
|
+
return generateResult(tokenType.metamorpho, name, targetToken, {});
|
242
248
|
}
|
243
249
|
catch (e) {
|
244
250
|
// Not a metamorpho token
|
245
251
|
}
|
246
252
|
}
|
247
|
-
function parseForBalancer(calls,
|
253
|
+
function parseForBalancer(calls, targetToken, name) {
|
248
254
|
// Check for balancer pools
|
249
255
|
try {
|
250
256
|
decodeReturnValue(calls.poolId, "getPoolId");
|
251
|
-
return generateResult(tokenType.balancerPool, name,
|
257
|
+
return generateResult(tokenType.balancerPool, name, targetToken, {});
|
252
258
|
}
|
253
259
|
catch (e) {
|
254
260
|
// Not a balancer pool
|
255
261
|
}
|
256
262
|
try {
|
257
263
|
decodeReturnValue(calls.vault, "getVault");
|
258
|
-
return generateResult(tokenType.balancerV3, name,
|
264
|
+
return generateResult(tokenType.balancerV3, name, targetToken, {});
|
259
265
|
}
|
260
266
|
catch (e) {
|
261
267
|
// Not a balancer v3 pool
|
262
268
|
}
|
263
269
|
}
|
264
|
-
function checkAgainstHardcoded(calls,
|
270
|
+
function checkAgainstHardcoded(calls, chainId, targetToken) {
|
265
271
|
// Check for balancer pools
|
266
272
|
try {
|
267
273
|
const name = decodeReturnValue(calls.name, "name");
|
268
|
-
const type = getTypeFromAddressChain(
|
274
|
+
const type = getTypeFromAddressChain(chainId, targetToken);
|
269
275
|
if (type !== tokenType.unknown)
|
270
|
-
return generateResult(type, name,
|
276
|
+
return generateResult(type, name, targetToken, {});
|
271
277
|
}
|
272
278
|
catch (e) {
|
273
279
|
// Not a hardcoded address
|
274
280
|
}
|
275
281
|
}
|
276
|
-
|
282
|
+
function parseForStaking(campaign) {
|
277
283
|
try {
|
278
284
|
const whitelist = campaign.campaignParameters.whitelist;
|
279
285
|
if (whitelist.length === 1) {
|
280
286
|
const forwarders = campaign.campaignParameters.forwarders;
|
281
287
|
if (forwarders.length === 1) {
|
282
288
|
if (forwarders[0].sender === whitelist[0]) {
|
283
|
-
return { isStaking: true, stakingContract: whitelist[0] };
|
289
|
+
return { isStaking: "true", stakingContract: whitelist[0] };
|
284
290
|
}
|
285
291
|
}
|
286
292
|
}
|
287
293
|
}
|
288
|
-
catch {
|
289
|
-
|
294
|
+
catch (e) {
|
295
|
+
// No factory on this token
|
296
|
+
// console.log(e);
|
297
|
+
}
|
298
|
+
return { isStaking: "false" };
|
290
299
|
}
|
291
|
-
export function getTokenTypeRound1(
|
300
|
+
export function getTokenTypeRound1(calls, targetToken, index, campaign) {
|
301
|
+
const returnValueOfCalls = calls.map(call => call.returnData);
|
292
302
|
const returnValue = {
|
293
|
-
factory:
|
294
|
-
metamorpho:
|
295
|
-
name:
|
296
|
-
poolId:
|
297
|
-
creator:
|
298
|
-
owner:
|
299
|
-
vault:
|
303
|
+
factory: returnValueOfCalls[index],
|
304
|
+
metamorpho: returnValueOfCalls[index + 1],
|
305
|
+
name: returnValueOfCalls[index + 2],
|
306
|
+
poolId: returnValueOfCalls[index + 3],
|
307
|
+
creator: returnValueOfCalls[index + 4],
|
308
|
+
owner: returnValueOfCalls[index + 5],
|
309
|
+
vault: returnValueOfCalls[index + 6],
|
300
310
|
};
|
301
|
-
let result = parseForFactory(returnValue, campaign);
|
311
|
+
let result = parseForFactory(returnValue, targetToken, campaign);
|
302
312
|
if (result)
|
303
313
|
return result;
|
304
|
-
result = parseForOwner(returnValue,
|
314
|
+
result = parseForOwner(returnValue, targetToken);
|
305
315
|
if (result)
|
306
316
|
return result;
|
307
|
-
result = checkAgainstHardcoded(returnValue, campaign);
|
317
|
+
result = checkAgainstHardcoded(returnValue, campaign.computeChainId, targetToken);
|
308
318
|
if (result)
|
309
319
|
return result;
|
310
|
-
result = parseForEnzyme(returnValue,
|
320
|
+
result = parseForEnzyme(returnValue, targetToken);
|
311
321
|
if (result)
|
312
322
|
return result;
|
313
|
-
result = parseForMetamorpho(returnValue,
|
323
|
+
result = parseForMetamorpho(returnValue, targetToken);
|
314
324
|
if (result)
|
315
325
|
return result;
|
316
326
|
let name;
|
317
327
|
try {
|
318
|
-
name = decodeCall(
|
328
|
+
name = decodeCall(returnValueOfCalls, index + 2, "name");
|
319
329
|
}
|
320
330
|
catch {
|
321
|
-
return generateResult(tokenType.unknown, "Unknown", campaign);
|
331
|
+
return generateResult(tokenType.unknown, "Unknown", targetToken, {}, campaign);
|
322
332
|
}
|
323
|
-
result = parseForBalancer(returnValue,
|
333
|
+
result = parseForBalancer(returnValue, targetToken, name);
|
324
334
|
if (result)
|
325
335
|
return result;
|
326
336
|
// Order matters
|
327
337
|
const ordered_token_Type = Object.values(tokenType).filter(value => typeof value === "string");
|
328
|
-
result = processNamingConditionsInOrder(ordered_token_Type, name, campaign);
|
338
|
+
result = processNamingConditionsInOrder(ordered_token_Type, name, targetToken, campaign);
|
329
339
|
if (result)
|
330
340
|
return result;
|
331
|
-
return generateResult(tokenType.unknown, name, campaign);
|
341
|
+
return generateResult(tokenType.unknown, name, targetToken, {}, campaign);
|
332
342
|
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import type { CampaignParameters, ResultDto } from "@sdk";
|
2
|
+
import type { ERC20SupportedCampaignType } from "../dynamicData/implementations/Erc20";
|
3
|
+
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
4
|
+
export declare function getTokenTypeRound2(index: number, type: tokenType, typeInfo: any, calls: ResultDto[], campaign?: CampaignParameters<ERC20SupportedCampaignType>): tokenTypeStruct;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { processorMapping } from "./implementations/processorMapping";
|
2
|
+
export function getTokenTypeRound2(index, type, typeInfo, calls, campaign) {
|
3
|
+
try {
|
4
|
+
const returnValueOfCalls = calls.map(call => call.returnData);
|
5
|
+
const ProcessorClass = processorMapping[type];
|
6
|
+
if (!ProcessorClass) {
|
7
|
+
throw new Error(`Processor not found for key: ${type}`);
|
8
|
+
}
|
9
|
+
const processorObject = new ProcessorClass();
|
10
|
+
return processorObject.computeRound2(index, type, typeInfo, returnValueOfCalls, campaign);
|
11
|
+
}
|
12
|
+
catch (error) {
|
13
|
+
console.error(error);
|
14
|
+
return {
|
15
|
+
type: type,
|
16
|
+
calls: [],
|
17
|
+
typeInfo: {
|
18
|
+
...typeInfo,
|
19
|
+
},
|
20
|
+
};
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { processorMapping } from "./implementations/processorMapping";
|
2
|
+
export function getTokenTypeRound3(index, type, typeInfo, calls) {
|
3
|
+
try {
|
4
|
+
const ProcessorClass = processorMapping[type];
|
5
|
+
const returnValueOfCalls = calls.map(call => call.returnData);
|
6
|
+
if (!ProcessorClass) {
|
7
|
+
throw new Error(`Processor not found for key: ${type}`);
|
8
|
+
}
|
9
|
+
const processorObject = new ProcessorClass();
|
10
|
+
return processorObject.computeRound3(index, type, typeInfo, returnValueOfCalls);
|
11
|
+
}
|
12
|
+
catch (error) {
|
13
|
+
console.error(error);
|
14
|
+
return {
|
15
|
+
type: type,
|
16
|
+
calls: [],
|
17
|
+
typeInfo: {
|
18
|
+
...typeInfo,
|
19
|
+
},
|
20
|
+
};
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import type { Campaign, CampaignParameters, ResultDto } from "@sdk";
|
2
|
+
import type { tokenType, tokenTypeStruct } from "./helpers/tokenType";
|
3
|
+
export declare function getTokenTypeRound4(index: number, type: tokenType, typeInfo: any, calls: ResultDto[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>): tokenTypeStruct;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { processorMapping } from "./implementations/processorMapping";
|
2
|
+
export function getTokenTypeRound4(index, type, typeInfo, calls, campaign) {
|
3
|
+
try {
|
4
|
+
const ProcessorClass = processorMapping[type];
|
5
|
+
const returnValueOfCalls = calls.map(call => call.returnData);
|
6
|
+
if (!ProcessorClass) {
|
7
|
+
throw new Error(`Processor not found for key: ${type}`);
|
8
|
+
}
|
9
|
+
const processorObject = new ProcessorClass();
|
10
|
+
return processorObject.computeRound4(index, type, typeInfo, returnValueOfCalls, campaign);
|
11
|
+
}
|
12
|
+
catch (error) {
|
13
|
+
console.error(error);
|
14
|
+
return {
|
15
|
+
type: type,
|
16
|
+
calls: [],
|
17
|
+
typeInfo: {
|
18
|
+
...typeInfo,
|
19
|
+
},
|
20
|
+
};
|
21
|
+
}
|
22
|
+
}
|
@@ -61,5 +61,7 @@ const map = {
|
|
61
61
|
[Campaign.ERC6909FIXAPR]: new DefaultMetadata(), // TODO
|
62
62
|
[Campaign.ERC1155]: new DefaultMetadata(), // TODO
|
63
63
|
[Campaign.ERC1155FIXAPR]: new DefaultMetadata(), // TODO
|
64
|
+
[Campaign.ERC721]: new DefaultMetadata(), // TODO
|
65
|
+
[Campaign.ERC721FIXAPR]: new DefaultMetadata(), // TODO
|
64
66
|
};
|
65
67
|
export const metadataBuilderFactory = (campaignType) => map[campaignType];
|
@@ -11,7 +11,10 @@ export class CompoundV3Metadata {
|
|
11
11
|
: `Borrow ${symbolUnderlyingToken} on`,
|
12
12
|
"Compound V3",
|
13
13
|
].join(" "),
|
14
|
-
tokens: [
|
14
|
+
tokens: [
|
15
|
+
{ chainId: computeChainId, address: params.underlyingToken },
|
16
|
+
{ chainId: computeChainId, address: params.targetToken },
|
17
|
+
],
|
15
18
|
mainProtocol: "compound",
|
16
19
|
depositUrl: undefined, // TODO, shall depend on compFork
|
17
20
|
};
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { tokenType } from "@/engine/erc20SubTypeProcessors/
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
2
|
export declare function decodeCall(calls: string[], index: number, key: string, type?: tokenType): any;
|
3
3
|
export declare function decodeReturnValue(returnData: string, key: string, type?: tokenType): any;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { tokenType } from "@/engine/erc20SubTypeProcessors/
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
2
|
import { AaveInterface, AccountantWithRateProvidersInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerV3StablePoolInterface, BalancerVaultInterface, BeefyInterface, BunniV2HubInterface, BunniV2TokenInterface, CPMMGammaPoolMainInterface, CompoundInterface, CurveInterface, CurveLPTokenInterface, CurveStableSwapNGInterface, DefutureVaultInterface, ERC20Interface, ERC4626Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, HourglassERC20TBTInterface, HourglassVedaLockDepositorV2Interface, IonicInterface, LPManagerHelperInterface, LPManagerInterface, LayerBankERC20Interface, LayerBankInterface, LendleInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, PendleYTInterface, RadiantInterface, RfxInterface, RswEthStrategyInterface, SpectraYTInterface, SturdyInterface, SymetricAmbientStrategyInterface, SyncSwapClassicPoolInterface, TorosInterface, UniswapV2PoolInterface, UniswapV3PoolInterface, VePufferInterface, ZFStableLPINterface, ZFStableSwapThreePoolInterface, } from "@sdk";
|
3
3
|
import { BigNumber } from "ethers";
|
4
4
|
export function decodeCall(calls, index, key, type) {
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { tokenType } from "@/engine/erc20SubTypeProcessors/
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
2
|
import { type CallDto } from "@sdk";
|
3
|
-
export declare function createCall(target: string, key: string, type?: tokenType,
|
3
|
+
export declare function createCall(target: string, key: string, type?: tokenType, metaData?: any): CallDto;
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import { tokenType } from "@/engine/erc20SubTypeProcessors/
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
2
|
import { AaveInterface, AccountantWithRateProvidersInterface, AuraInterface, AuraOperatorInterface, BalancerGaugeInterface, BalancerPoolInterface, BalancerV3StablePoolInterface, BalancerVaultInterface, BeefyInterface, BunniV2HubInterface, BunniV2TokenInterface, CPMMGammaPoolMainInterface, CompoundInterface, CurveInterface, CurveLPTokenInterface, CurveStableSwapNGInterface, DefutureVaultInterface, ERC20Interface, ERC4626Interface, EnzymeInterface, EulerInterface, FactoryInterface, FluidInterface, FraxlendInterface, GearboxVaultInterface, HourglassERC20TBTInterface, HourglassVedaLockDepositorV2Interface, IonicInterface, LPManagerHelperInterface, LPManagerInterface, LayerBankInterface, LendleInterface, MaverickBPLensInterface, MetamorphoInterface, MoonwellInterface, OneInchStakingInterface, PendleInterface, PendleYTInterface, RadiantInterface, RfxDatastoreInterface, RswEthStrategyInterface, SpectraYTInterface, SturdyInterface, SymetricAmbientStrategyInterface, SyncSwapClassicPoolInterface, TorosInterface, UniswapV2PoolInterface, UniswapV3PoolInterface, VePufferInterface, ZFStableLPINterface, } from "@sdk";
|
3
|
-
export function createCall(target, key, type,
|
3
|
+
export function createCall(target, key, type, metaData) {
|
4
4
|
switch (key) {
|
5
5
|
case "sqrtPriceX96":
|
6
6
|
return { allowFailure: true, callData: UniswapV3PoolInterface.encodeFunctionData("slot0"), target };
|
7
7
|
case "tokens":
|
8
|
-
return { allowFailure: true, callData: LPManagerInterface.encodeFunctionData("tokens", [
|
8
|
+
return { allowFailure: true, callData: LPManagerInterface.encodeFunctionData("tokens", [metaData]), target };
|
9
9
|
case "getTokensCount":
|
10
10
|
return { allowFailure: true, callData: LPManagerInterface.encodeFunctionData("getTokensCount"), target };
|
11
11
|
case "getTotalValue":
|
12
12
|
return {
|
13
13
|
allowFailure: true,
|
14
|
-
callData: LPManagerHelperInterface.encodeFunctionData("getTotalValue", [
|
14
|
+
callData: LPManagerHelperInterface.encodeFunctionData("getTotalValue", [metaData]),
|
15
15
|
target,
|
16
16
|
};
|
17
17
|
case "SY":
|
@@ -38,13 +38,13 @@ export function createCall(target, key, type, callArgs) {
|
|
38
38
|
case "coin2":
|
39
39
|
return { allowFailure: true, callData: CurveInterface.encodeFunctionData("coins", [2]), target };
|
40
40
|
case "coins":
|
41
|
-
return { allowFailure: true, callData: CurveInterface.encodeFunctionData("coins", [
|
41
|
+
return { allowFailure: true, callData: CurveInterface.encodeFunctionData("coins", [metaData]), target };
|
42
42
|
case "N_COINS":
|
43
43
|
return { allowFailure: true, callData: CurveStableSwapNGInterface.encodeFunctionData("N_COINS"), target };
|
44
44
|
case "balances":
|
45
45
|
return {
|
46
46
|
allowFailure: true,
|
47
|
-
callData: CurveStableSwapNGInterface.encodeFunctionData("balances", [
|
47
|
+
callData: CurveStableSwapNGInterface.encodeFunctionData("balances", [metaData]),
|
48
48
|
target,
|
49
49
|
};
|
50
50
|
case "operator":
|
@@ -81,14 +81,14 @@ export function createCall(target, key, type, callArgs) {
|
|
81
81
|
case "shortToken": {
|
82
82
|
return {
|
83
83
|
allowFailure: true,
|
84
|
-
callData: RfxDatastoreInterface.encodeFunctionData("getAddress", [
|
84
|
+
callData: RfxDatastoreInterface.encodeFunctionData("getAddress", [metaData]),
|
85
85
|
target,
|
86
86
|
};
|
87
87
|
}
|
88
88
|
case "longToken": {
|
89
89
|
return {
|
90
90
|
allowFailure: true,
|
91
|
-
callData: RfxDatastoreInterface.encodeFunctionData("getAddress", [
|
91
|
+
callData: RfxDatastoreInterface.encodeFunctionData("getAddress", [metaData]),
|
92
92
|
target,
|
93
93
|
};
|
94
94
|
}
|
@@ -183,7 +183,7 @@ export function createCall(target, key, type, callArgs) {
|
|
183
183
|
case "calcNetShareValue":
|
184
184
|
return {
|
185
185
|
allowFailure: true,
|
186
|
-
callData: EnzymeInterface.encodeFunctionData("calcNetShareValue", [
|
186
|
+
callData: EnzymeInterface.encodeFunctionData("calcNetShareValue", [metaData]),
|
187
187
|
target,
|
188
188
|
};
|
189
189
|
case "getPricePerFullShare":
|
@@ -237,7 +237,7 @@ export function createCall(target, key, type, callArgs) {
|
|
237
237
|
case "balanceOf":
|
238
238
|
return {
|
239
239
|
allowFailure: true,
|
240
|
-
callData: ERC20Interface.encodeFunctionData("balanceOf", [
|
240
|
+
callData: ERC20Interface.encodeFunctionData("balanceOf", [metaData]),
|
241
241
|
target,
|
242
242
|
};
|
243
243
|
case "getPoolId":
|
@@ -255,7 +255,7 @@ export function createCall(target, key, type, callArgs) {
|
|
255
255
|
case "poolInfo":
|
256
256
|
return {
|
257
257
|
allowFailure: true,
|
258
|
-
callData: AuraOperatorInterface.encodeFunctionData("poolInfo", [
|
258
|
+
callData: AuraOperatorInterface.encodeFunctionData("poolInfo", [metaData]),
|
259
259
|
target,
|
260
260
|
};
|
261
261
|
case "staker":
|
@@ -263,13 +263,13 @@ export function createCall(target, key, type, callArgs) {
|
|
263
263
|
case "getPoolTokens":
|
264
264
|
return {
|
265
265
|
allowFailure: true,
|
266
|
-
callData: BalancerVaultInterface.encodeFunctionData("getPoolTokens", [
|
266
|
+
callData: BalancerVaultInterface.encodeFunctionData("getPoolTokens", [metaData]),
|
267
267
|
target,
|
268
268
|
};
|
269
269
|
case "convertToAssets":
|
270
270
|
return {
|
271
271
|
allowFailure: true,
|
272
|
-
callData: FluidInterface.encodeFunctionData("convertToAssets", [
|
272
|
+
callData: FluidInterface.encodeFunctionData("convertToAssets", [metaData]),
|
273
273
|
target,
|
274
274
|
};
|
275
275
|
case "tokenPrice":
|
@@ -339,7 +339,7 @@ export function createCall(target, key, type, callArgs) {
|
|
339
339
|
case "boostedPositionInformation":
|
340
340
|
return {
|
341
341
|
allowFailure: true,
|
342
|
-
callData: MaverickBPLensInterface.encodeFunctionData("boostedPositionInformation", [
|
342
|
+
callData: MaverickBPLensInterface.encodeFunctionData("boostedPositionInformation", [metaData]),
|
343
343
|
target: target,
|
344
344
|
};
|
345
345
|
case "minter":
|
@@ -488,7 +488,7 @@ export function createCall(target, key, type, callArgs) {
|
|
488
488
|
case "poolState":
|
489
489
|
return {
|
490
490
|
allowFailure: true,
|
491
|
-
callData: BunniV2HubInterface.encodeFunctionData("poolState", [
|
491
|
+
callData: BunniV2HubInterface.encodeFunctionData("poolState", [metaData]),
|
492
492
|
target: target,
|
493
493
|
};
|
494
494
|
default:
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import {
|
3
|
-
import type { CampaignParameters } from "@sdk";
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
4
3
|
export declare const stakingContractToStakingSymbol: {
|
5
4
|
[key: string]: string;
|
6
5
|
};
|
7
|
-
export declare function generateCardName(type: tokenType,
|
6
|
+
export declare function generateCardName(type: tokenType, typeInfo: any, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>, symbols?: string[], displayName?: string): string;
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import { tokenType } from "@/engine/erc20SubTypeProcessors/
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
2
|
import { capitalize } from "lodash";
|
3
3
|
export const stakingContractToStakingSymbol = {
|
4
4
|
"0x18eeD20f71BEf84B605253C89A7576E3634134C0": "CyberStaking",
|
5
5
|
"0x68754d29f2e97B837Cb622ccfF325adAC27E9977": "Karak",
|
6
6
|
"0xcd28cF8f7755f03967D27E128B38022B63919836": "Llamalend",
|
7
7
|
};
|
8
|
-
export function generateCardName(type,
|
9
|
-
if (isStaking) {
|
8
|
+
export function generateCardName(type, typeInfo, campaign, symbols = [""], displayName) {
|
9
|
+
if (typeInfo.isStaking === "true") {
|
10
10
|
if (typeInfo.stakingName !== undefined) {
|
11
11
|
typeInfo.stakingSymbol = typeInfo.stakingName.includes("Deposit")
|
12
12
|
? typeInfo.stakingName.replace("Deposit", "").trim()
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
|
+
import type { Campaign, CampaignParameters } from "@sdk";
|
3
|
+
export declare function generateIcons(type: tokenType, typeInfo: any, campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.ERC20LOGPROCESSOR> | CampaignParameters<Campaign.ERC20REBASELOGPROCESSOR> | CampaignParameters<Campaign.EULER>, symbols?: string[]): string[];
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
|
2
|
+
import { OpportunityAction } from "@db/api";
|
3
|
+
export function generateIcons(type, typeInfo, campaign, symbols = [""]) {
|
4
|
+
const action = typeInfo.action ? typeInfo.action : "HOLD";
|
5
|
+
switch (action) {
|
6
|
+
case OpportunityAction.POOL:
|
7
|
+
switch (type) {
|
8
|
+
case tokenType.vicuna: {
|
9
|
+
const parsedName = typeInfo.name.split(" ").pop();
|
10
|
+
return parsedName.split("-");
|
11
|
+
}
|
12
|
+
case tokenType.balancerGauge:
|
13
|
+
case tokenType.balancerPool:
|
14
|
+
case tokenType.aura:
|
15
|
+
return Object.values(typeInfo.poolTokens ?? {})
|
16
|
+
.map(tkn => tkn?.symbol)
|
17
|
+
.filter(tkn => tkn && !tkn.includes("/"));
|
18
|
+
case tokenType.curve:
|
19
|
+
case tokenType.curve_2:
|
20
|
+
case tokenType.hanji_liquidity_vault_token:
|
21
|
+
case tokenType.crosscurve: {
|
22
|
+
const icons = [];
|
23
|
+
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
24
|
+
if (typeInfo[`symbolToken${i}`])
|
25
|
+
icons.push(typeInfo[`symbolToken${i}`]);
|
26
|
+
}
|
27
|
+
return icons;
|
28
|
+
}
|
29
|
+
case tokenType.rfx_slv:
|
30
|
+
return [typeInfo.symbolAsset];
|
31
|
+
case tokenType.rfx:
|
32
|
+
return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
|
33
|
+
case tokenType.maverickBoostedPosition:
|
34
|
+
return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
|
35
|
+
default:
|
36
|
+
return [typeInfo.symbolToken0, typeInfo.symbolToken1];
|
37
|
+
}
|
38
|
+
case OpportunityAction.LEND:
|
39
|
+
switch (type) {
|
40
|
+
case tokenType.compound:
|
41
|
+
return [typeInfo.symbolBaseToken];
|
42
|
+
default:
|
43
|
+
return [typeInfo.symbolUnderlyingToken];
|
44
|
+
}
|
45
|
+
case OpportunityAction.BORROW:
|
46
|
+
return [typeInfo.symbolUnderlyingToken];
|
47
|
+
case OpportunityAction.HOLD:
|
48
|
+
switch (type) {
|
49
|
+
case tokenType.toros:
|
50
|
+
case tokenType.enzyme:
|
51
|
+
return [typeInfo.symbolUnderlyingToken];
|
52
|
+
case tokenType.pendleYT: {
|
53
|
+
let symbol = campaign.campaignParameters.symbolTargetToken;
|
54
|
+
symbol = symbol.split("-").slice(0, 2).join("-");
|
55
|
+
return [symbol];
|
56
|
+
}
|
57
|
+
case tokenType.pendle:
|
58
|
+
return [typeInfo.symbolUnderlyingToken];
|
59
|
+
default:
|
60
|
+
return [campaign.campaignParameters.symbolTargetToken];
|
61
|
+
}
|
62
|
+
default:
|
63
|
+
return [];
|
64
|
+
}
|
65
|
+
}
|