@merkl/api 0.19.14 → 0.19.16
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/eden/index.d.ts +656 -279
- package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.d.ts +3 -1
- package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.js +4 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.d.ts +51 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +102 -0
- package/dist/src/engine/erc20SubTypeProcessors/implementations/processorMapping.js +3 -0
- package/dist/src/engine/erc20SubTypeProcessors/subtypesRound1.js +4 -0
- package/dist/src/engine/opportunityMetadata/factory.js +1 -1
- package/dist/src/engine/opportunityMetadata/implementations/Ajna.d.ts +3 -1
- package/dist/src/engine/opportunityMetadata/implementations/Ajna.js +6 -0
- package/dist/src/engine/opportunityMetadata/implementations/{Ambiant.d.ts → Ambient.d.ts} +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/{Ambiant.js → Ambient.js} +5 -1
- package/dist/src/engine/opportunityMetadata/implementations/Badger.d.ts +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Badger.js +5 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.d.ts +27 -0
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +145 -1
- package/dist/src/engine/opportunityMetadata/implementations/Compound.d.ts +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Compound.js +4 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.d.ts +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +4 -0
- package/dist/src/engine/opportunityMetadata/implementations/Euler.d.ts +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Euler.js +4 -0
- package/dist/src/engine/opportunityMetadata/implementations/EventBased.d.ts +3 -0
- package/dist/src/engine/opportunityMetadata/implementations/EventBased.js +4 -0
- package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.d.ts +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.js +5 -0
- package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.d.ts +8 -0
- package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.js +4 -0
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.d.ts +2 -0
- package/dist/src/engine/opportunityMetadata/implementations/Morpho.js +17 -1
- package/dist/src/index.d.ts +169 -0
- package/dist/src/jobs/set-dungeon-keeper.js +8 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +169 -0
- package/dist/src/modules/v4/campaign/campaign.controller.js +62 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +2 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +5 -4
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +16 -25
- package/dist/src/modules/v4/opportunity/opportunity.service.js +34 -34
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +3 -15
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -36
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +0 -1
- package/dist/src/modules/v4/router.d.ts +169 -0
- package/dist/src/utils/decodeCalls.js +9 -1
- package/dist/src/utils/encodeCalls.js +9 -1
- package/dist/src/utils/generateCardName.js +3 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -91,7 +91,9 @@ export declare enum tokenType {
|
|
91
91
|
balancerV3 = "balancerV3",
|
92
92
|
hanji_liquidity_vault_token = "hanji_liquidity_vault_token",
|
93
93
|
xU308 = "xU308",
|
94
|
-
bunniV2 = "bunniV2"
|
94
|
+
bunniV2 = "bunniV2",
|
95
|
+
beratrax_vault = "beratrax_vault",
|
96
|
+
beraborrow_gauge = "beraborrow_gauge"
|
95
97
|
}
|
96
98
|
export declare const tokenTypeToProtocol: {
|
97
99
|
[key in tokenType]: {
|
@@ -93,6 +93,8 @@ export var tokenType;
|
|
93
93
|
tokenType["hanji_liquidity_vault_token"] = "hanji_liquidity_vault_token";
|
94
94
|
tokenType["xU308"] = "xU308";
|
95
95
|
tokenType["bunniV2"] = "bunniV2";
|
96
|
+
tokenType["beratrax_vault"] = "beratrax_vault";
|
97
|
+
tokenType["beraborrow_gauge"] = "beraborrow_gauge";
|
96
98
|
})(tokenType || (tokenType = {}));
|
97
99
|
export const tokenTypeToProtocol = {
|
98
100
|
[tokenType.aave_borrowing]: { protocol: "Aave", action: OpportunityAction.BORROW },
|
@@ -186,4 +188,6 @@ export const tokenTypeToProtocol = {
|
|
186
188
|
[tokenType.hanji_liquidity_vault_token]: { protocol: "Hanji", action: OpportunityAction.POOL },
|
187
189
|
[tokenType.xU308]: { protocol: "Uranium", action: OpportunityAction.HOLD },
|
188
190
|
[tokenType.bunniV2]: { protocol: "Bunni V2", action: OpportunityAction.HOLD },
|
191
|
+
[tokenType.beratrax_vault]: { protocol: "Beratrax", action: OpportunityAction.POOL },
|
192
|
+
[tokenType.beraborrow_gauge]: { protocol: "Beraborrow", action: OpportunityAction.POOL },
|
189
193
|
};
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import type { Pricer } from "@/utils/pricer";
|
2
|
+
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import type { BigNumber } from "ethers";
|
4
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "../GenericProcessor";
|
5
|
+
import { tokenType, type tokenTypeStruct } from "../helpers/tokenType";
|
6
|
+
type callType = {
|
7
|
+
key: keyof dataRawBG;
|
8
|
+
call: string;
|
9
|
+
target: keyof callKeysBG;
|
10
|
+
metaData?: keyof callKeysBG;
|
11
|
+
};
|
12
|
+
type callKeysBG = mandatoryCallKeys & {
|
13
|
+
gyroscopeToken: string;
|
14
|
+
balanceUnderlyingPoolTokens: string;
|
15
|
+
totalSupplyUnderlyingPoolTokens: string;
|
16
|
+
poolId: string;
|
17
|
+
vault: string;
|
18
|
+
vaultBalance: string;
|
19
|
+
};
|
20
|
+
type dataRawBG = callKeysBG & {
|
21
|
+
poolTokensRaw: Array<string[] | BigNumber[]>;
|
22
|
+
poolTokens: Array<{
|
23
|
+
token: string;
|
24
|
+
balance: string;
|
25
|
+
}>;
|
26
|
+
};
|
27
|
+
type dataTypeBG = dataType & {
|
28
|
+
gyroscopeToken: string;
|
29
|
+
balanceUnderlyingPoolTokens: string;
|
30
|
+
totalSupplyUnderlyingPoolTokens: string;
|
31
|
+
poolId: string;
|
32
|
+
vault: string;
|
33
|
+
poolTokensRaw: Array<string[] | BigNumber[]>;
|
34
|
+
poolTokens: Array<{
|
35
|
+
token: string;
|
36
|
+
balance: string;
|
37
|
+
}>;
|
38
|
+
vaultBalance: string;
|
39
|
+
};
|
40
|
+
export declare class BEXRewardGaugeProcessor extends GenericProcessor<callKeysBG, dataRawBG, dataTypeBG> {
|
41
|
+
rounds: {
|
42
|
+
round1: callType[];
|
43
|
+
round2: callType[];
|
44
|
+
round3: callType[];
|
45
|
+
round4: callType[];
|
46
|
+
};
|
47
|
+
processingRound4(typeInfo: dataRawBG): void;
|
48
|
+
processingRound5(index: number, type: tokenType, typeInfo: dataRawBG, calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeBG>;
|
49
|
+
computeRound4(index: number, type: tokenType, typeInfo: dataRawBG, calls: string[], campaign: CampaignParameters<Campaign.ERC20>): tokenTypeStruct;
|
50
|
+
}
|
51
|
+
export {};
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { decodeCall } from "@/utils/decodeCalls";
|
2
|
+
import { createCall } from "@/utils/encodeCalls";
|
3
|
+
import { generateCardName } from "@/utils/generateCardName";
|
4
|
+
import { BN2Number } from "@sdk";
|
5
|
+
import { GenericProcessor, Round } from "../GenericProcessor";
|
6
|
+
import { tokenType } from "../helpers/tokenType";
|
7
|
+
export class BEXRewardGaugeProcessor extends GenericProcessor {
|
8
|
+
rounds = {
|
9
|
+
round1: [{ key: "gyroscopeToken", call: "lp_token", target: "tokenAddress" }],
|
10
|
+
round2: [
|
11
|
+
{ key: "balanceUnderlyingPoolTokens", call: "totalAssets", target: "tokenAddress" },
|
12
|
+
{ key: "totalSupplyUnderlyingPoolTokens", call: "totalSupply", target: "gyroscopeToken" },
|
13
|
+
{ key: "poolId", call: "getPoolId", target: "gyroscopeToken" },
|
14
|
+
{ key: "vault", call: "getVault", target: "gyroscopeToken" },
|
15
|
+
],
|
16
|
+
round3: [
|
17
|
+
{ key: "poolTokensRaw", call: "getPoolTokens", target: "vault", metaData: "poolId" },
|
18
|
+
{ key: "vaultBalance", call: "balanceOf", target: "gyroscopeToken", metaData: "vault" },
|
19
|
+
],
|
20
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
21
|
+
};
|
22
|
+
// override computeRound1(): void {}
|
23
|
+
processingRound4(typeInfo) {
|
24
|
+
const tokens = typeInfo.poolTokensRaw[0];
|
25
|
+
const balances = typeInfo.poolTokensRaw[1];
|
26
|
+
let i = 0;
|
27
|
+
const poolTokens = [];
|
28
|
+
for (const token of tokens) {
|
29
|
+
poolTokens.push({
|
30
|
+
token: token,
|
31
|
+
balance: balances[i].toString(),
|
32
|
+
});
|
33
|
+
i++;
|
34
|
+
typeInfo.poolTokens = poolTokens;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
|
38
|
+
const poolTokensinfo = {};
|
39
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
40
|
+
let tvlUnderlyingPool = 0;
|
41
|
+
const symbols = [];
|
42
|
+
let indexUpdated = index + this.rounds.round4.length;
|
43
|
+
for (const poolToken of typeInfo.poolTokens) {
|
44
|
+
const symbol = decodeCall(calls, indexUpdated++, "symbol");
|
45
|
+
const decimals = decodeCall(calls, indexUpdated++, "decimals");
|
46
|
+
poolTokensinfo[poolToken.token] = {
|
47
|
+
symbol: symbol,
|
48
|
+
decimals: decimals,
|
49
|
+
amountInPool: BN2Number(poolToken.balance, decimals),
|
50
|
+
price: (await pricer.get({ symbol: symbol })) ?? 0,
|
51
|
+
};
|
52
|
+
tvlUnderlyingPool += poolTokensinfo[poolToken.token].price * poolTokensinfo[poolToken.token].amountInPool;
|
53
|
+
symbols.push(symbol);
|
54
|
+
}
|
55
|
+
let adjustedPoolTotalSupply = BN2Number(typeInfo.totalSupplyUnderlyingPoolTokens, 18) - BN2Number(typeInfo.vaultBalance, 18);
|
56
|
+
if (type === tokenType.beratrax_vault) {
|
57
|
+
// Weird edge case where the total supply is 80k higher than it should be because they minted stuff on an EOA
|
58
|
+
adjustedPoolTotalSupply -= 35724494.54 + 82793;
|
59
|
+
}
|
60
|
+
let percentageOfSupplyUnderlyingPoolTokens = 1;
|
61
|
+
if (adjustedPoolTotalSupply > 0) {
|
62
|
+
percentageOfSupplyUnderlyingPoolTokens =
|
63
|
+
BN2Number(typeInfo.balanceUnderlyingPoolTokens, 18) / adjustedPoolTotalSupply;
|
64
|
+
}
|
65
|
+
const tvl = tvlUnderlyingPool * percentageOfSupplyUnderlyingPoolTokens;
|
66
|
+
const priceTargetToken = tvl / totalSupply;
|
67
|
+
// If one of the symbols in the symbol list contains 2 of the other symbols of the list, remove it
|
68
|
+
// It's a weird edge case that happens with the BEX pools
|
69
|
+
const symbolToRemove = symbols.find(symbol => symbols.filter(s => symbol.includes(s)).length > 1);
|
70
|
+
if (symbolToRemove) {
|
71
|
+
symbols.splice(symbols.indexOf(symbolToRemove), 1);
|
72
|
+
}
|
73
|
+
return {
|
74
|
+
...typeInfo,
|
75
|
+
totalSupply: totalSupply,
|
76
|
+
poolTokens: poolTokensinfo,
|
77
|
+
tvl: tvl,
|
78
|
+
whitelistedSupplyTargetToken,
|
79
|
+
blacklistedSupply,
|
80
|
+
priceTargetToken: priceTargetToken,
|
81
|
+
cardName: generateCardName(type, typeInfo, campaign, symbols),
|
82
|
+
};
|
83
|
+
}
|
84
|
+
computeRound4(index, type, typeInfo, calls, campaign) {
|
85
|
+
// This is to enforce type checking
|
86
|
+
const blacklistedLiquidityCalls = this.generateBlackListCall(type, typeInfo, campaign);
|
87
|
+
this.decodePreviousRound(Round.three, calls, typeInfo, type, index);
|
88
|
+
this.processingRound4(typeInfo);
|
89
|
+
const poolCalls = [createCall(typeInfo.tokenAddress, "totalSupply")];
|
90
|
+
for (const poolToken of typeInfo.poolTokens) {
|
91
|
+
poolCalls.push(createCall(poolToken.token, "symbol"));
|
92
|
+
poolCalls.push(createCall(poolToken.token, "decimals"));
|
93
|
+
}
|
94
|
+
return {
|
95
|
+
type: type,
|
96
|
+
calls: blacklistedLiquidityCalls.concat(poolCalls),
|
97
|
+
typeInfo: {
|
98
|
+
...typeInfo,
|
99
|
+
},
|
100
|
+
};
|
101
|
+
}
|
102
|
+
}
|
@@ -4,6 +4,7 @@ import { AaveProcessor } from "./AaveProcessor";
|
|
4
4
|
import { AnglesLiquidProcessor } from "./AnglesLiquid";
|
5
5
|
import { AssetProcessor } from "./AssetProcessor";
|
6
6
|
import { AuraProcessor } from "./AuraProcessor";
|
7
|
+
import { BEXRewardGaugeProcessor } from "./BEXRewardGaugeProcessor";
|
7
8
|
import { BalancerGaugeProcessor } from "./BalancerGaugeProcessor";
|
8
9
|
import { BalancerPoolProcessor } from "./BalancerPoolProcessor";
|
9
10
|
import { BalancerV3PoolProcessor } from "./BalancerV3PoolProcessor";
|
@@ -136,4 +137,6 @@ export const processorMapping = {
|
|
136
137
|
[tokenType.hanji_liquidity_vault_token]: HanjiVaultProcessor,
|
137
138
|
[tokenType.xU308]: xU308Processor,
|
138
139
|
[tokenType.bunniV2]: BunniV2Processor,
|
140
|
+
[tokenType.beraborrow_gauge]: BEXRewardGaugeProcessor,
|
141
|
+
[tokenType.beratrax_vault]: BEXRewardGaugeProcessor,
|
139
142
|
};
|
@@ -25,6 +25,10 @@ function satisfiesNameConditions(name, type) {
|
|
25
25
|
return (lowerCaseName.includes("balancer") &&
|
26
26
|
!lowerCaseName.includes("aura deposit vault") &&
|
27
27
|
!lowerCaseName.startsWith("vifi"));
|
28
|
+
case tokenType.beraborrow_gauge:
|
29
|
+
return lowerCaseName.includes("beraborrow") && lowerCaseName.includes("bpt");
|
30
|
+
case tokenType.beratrax_vault:
|
31
|
+
return lowerCaseName.startsWith("beratrax vault");
|
28
32
|
case tokenType.gearbox:
|
29
33
|
return lowerCaseName.includes("farming of") || lowerCaseName.startsWith("trade");
|
30
34
|
case tokenType.euler_borrow:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Campaign } from "@sdk";
|
2
2
|
import { AjnaMetadata } from "./implementations/Ajna";
|
3
|
-
import { AmbientMetadata } from "./implementations/
|
3
|
+
import { AmbientMetadata } from "./implementations/Ambient";
|
4
4
|
import { BadgerMetadata } from "./implementations/Badger";
|
5
5
|
import { ClammMetadata } from "./implementations/Clamm";
|
6
6
|
import { CompoundMetadata } from "./implementations/Compound";
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type
|
1
|
+
import { type Campaign as CampaignEnum, type CampaignParameters, type ChainId } from "@sdk";
|
2
2
|
import type { MetadataBuilder } from "../interface";
|
3
3
|
type campaignType = CampaignEnum.AJNA;
|
4
4
|
export declare class AjnaMetadata implements MetadataBuilder<campaignType> {
|
@@ -10,6 +10,8 @@ export declare class AjnaMetadata implements MetadataBuilder<campaignType> {
|
|
10
10
|
address: any;
|
11
11
|
}[];
|
12
12
|
mainProtocol: string;
|
13
|
+
depositUrl: string;
|
13
14
|
}>;
|
15
|
+
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
14
16
|
}
|
15
17
|
export {};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { TokenService } from "@/modules/v4/token/token.service";
|
2
2
|
import { OpportunityAction } from "@db/api";
|
3
|
+
import { NETWORK_LABELS } from "@sdk";
|
3
4
|
export class AjnaMetadata {
|
4
5
|
async build(computeChainId, params, subType) {
|
5
6
|
try {
|
@@ -29,6 +30,7 @@ export class AjnaMetadata {
|
|
29
30
|
{ chainId: computeChainId, address: quote.address },
|
30
31
|
],
|
31
32
|
mainProtocol: "ajna",
|
33
|
+
depositUrl: AjnaMetadata.generateUrl(computeChainId, params),
|
32
34
|
};
|
33
35
|
}
|
34
36
|
catch (_err) {
|
@@ -46,7 +48,11 @@ export class AjnaMetadata {
|
|
46
48
|
{ chainId: computeChainId, address: params.quoteToken },
|
47
49
|
],
|
48
50
|
mainProtocol: "ajna",
|
51
|
+
depositUrl: AjnaMetadata.generateUrl(computeChainId, params),
|
49
52
|
};
|
50
53
|
}
|
51
54
|
}
|
55
|
+
static generateUrl(computeChainId, params) {
|
56
|
+
return `https://ajnafi.com/${NETWORK_LABELS[computeChainId].toLowerCase()}/pools/${params.poolId}`;
|
57
|
+
}
|
52
58
|
}
|
@@ -10,6 +10,8 @@ export declare class AmbientMetadata implements MetadataBuilder<campaignType> {
|
|
10
10
|
address: any;
|
11
11
|
}[];
|
12
12
|
mainProtocol: string;
|
13
|
+
depositUrl: string;
|
13
14
|
}>;
|
15
|
+
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
14
16
|
}
|
15
17
|
export {};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { OpportunityAction } from "@db/api";
|
2
|
-
import { almName, } from "@sdk";
|
2
|
+
import { NETWORK_LABELS, almName, } from "@sdk";
|
3
3
|
import { getAddress } from "viem";
|
4
4
|
export class AmbientMetadata {
|
5
5
|
async build(computeChainId, params, _subType) {
|
@@ -26,6 +26,10 @@ export class AmbientMetadata {
|
|
26
26
|
{ chainId: computeChainId, address: params.quoteToken },
|
27
27
|
],
|
28
28
|
mainProtocol: "ambient",
|
29
|
+
depositUrl: AmbientMetadata.generateUrl(computeChainId, params),
|
29
30
|
};
|
30
31
|
}
|
32
|
+
static generateUrl(computeChainId, params) {
|
33
|
+
return `https://ambient.finance/trade/market/chain=0x${NETWORK_LABELS[computeChainId].toString()}&tokenA=${params.baseToken}&tokenB=${params.quoteToken}`;
|
34
|
+
}
|
31
35
|
}
|
@@ -10,6 +10,8 @@ export declare class BadgerMetadata implements MetadataBuilder<campaignType> {
|
|
10
10
|
address: any;
|
11
11
|
}[];
|
12
12
|
mainProtocol: string;
|
13
|
+
depositUrl: string;
|
13
14
|
}>;
|
15
|
+
static generateUrl(_computeChainId: ChainId, _params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
14
16
|
}
|
15
17
|
export {};
|
@@ -11,6 +11,7 @@ export class BadgerMetadata {
|
|
11
11
|
name: `Borrow ${token.symbol}`,
|
12
12
|
tokens: [{ chainId: computeChainId, address: token?.address }],
|
13
13
|
mainProtocol: "badger",
|
14
|
+
depositUrl: BadgerMetadata.generateUrl(computeChainId, params),
|
14
15
|
};
|
15
16
|
}
|
16
17
|
catch {
|
@@ -19,7 +20,11 @@ export class BadgerMetadata {
|
|
19
20
|
name: `Borrow ${params.symbolTargetToken}`,
|
20
21
|
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
21
22
|
mainProtocol: "badger",
|
23
|
+
depositUrl: BadgerMetadata.generateUrl(computeChainId, params),
|
22
24
|
};
|
23
25
|
}
|
24
26
|
}
|
27
|
+
static generateUrl(_computeChainId, _params) {
|
28
|
+
return "https://www.ebtc.finance/dapp/borrow";
|
29
|
+
}
|
25
30
|
}
|
@@ -1,6 +1,31 @@
|
|
1
1
|
import { type Campaign as CampaignEnum, type CampaignParameters, ChainId } from "@sdk";
|
2
2
|
import type { MetadataBuilder } from "../interface";
|
3
3
|
type campaignType = CampaignEnum.CLAMM;
|
4
|
+
export declare const uniswapV3OkuChains: {
|
5
|
+
[ChainId.BLAST]: string;
|
6
|
+
[ChainId.SCROLL]: string;
|
7
|
+
[ChainId.LINEA]: string;
|
8
|
+
[ChainId.MANTLE]: string;
|
9
|
+
[ChainId.ZKSYNC]: string;
|
10
|
+
[ChainId.GNOSIS]: string;
|
11
|
+
[ChainId.BASE]: string;
|
12
|
+
[ChainId.BSC]: string;
|
13
|
+
[ChainId.MANTA]: string;
|
14
|
+
[ChainId.ROOTSTOCK]: string;
|
15
|
+
[ChainId.TAIKO]: string;
|
16
|
+
[ChainId.MOONBEAM]: string;
|
17
|
+
[ChainId.POLYGONZKEVM]: string;
|
18
|
+
[ChainId.BOB]: string;
|
19
|
+
[ChainId.SONIC]: string;
|
20
|
+
[ChainId.LISK]: string;
|
21
|
+
[ChainId.CORN]: string;
|
22
|
+
};
|
23
|
+
export declare const pancakeswapChains: {
|
24
|
+
[C in ChainId]?: string;
|
25
|
+
};
|
26
|
+
export declare const sushiswapv3Chains: {
|
27
|
+
[C in ChainId]?: string;
|
28
|
+
};
|
4
29
|
export declare class ClammMetadata implements MetadataBuilder<campaignType> {
|
5
30
|
build(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): Promise<{
|
6
31
|
name: string;
|
@@ -10,6 +35,8 @@ export declare class ClammMetadata implements MetadataBuilder<campaignType> {
|
|
10
35
|
address: any;
|
11
36
|
}[];
|
12
37
|
mainProtocol: string | undefined;
|
38
|
+
depositUrl: string | undefined;
|
13
39
|
}>;
|
40
|
+
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string | undefined;
|
14
41
|
}
|
15
42
|
export {};
|
@@ -1,7 +1,35 @@
|
|
1
1
|
import { camelToKebabCase } from "@/utils/caseChanges";
|
2
2
|
import { OpportunityAction } from "@db/api";
|
3
|
-
import { AMM, ChainId, almName, ammName, } from "@sdk";
|
3
|
+
import { AMM, ChainId, NETWORK_LABELS, almName, ammName, } from "@sdk";
|
4
4
|
import { getAddress } from "viem";
|
5
|
+
export const uniswapV3OkuChains = {
|
6
|
+
[ChainId.BLAST]: "blast",
|
7
|
+
[ChainId.SCROLL]: "scroll",
|
8
|
+
[ChainId.LINEA]: "linea",
|
9
|
+
[ChainId.MANTLE]: "mantle",
|
10
|
+
[ChainId.ZKSYNC]: "zksync",
|
11
|
+
[ChainId.GNOSIS]: "gnosis",
|
12
|
+
[ChainId.BASE]: "base",
|
13
|
+
[ChainId.BSC]: "bsc",
|
14
|
+
[ChainId.MANTA]: "manta",
|
15
|
+
[ChainId.ROOTSTOCK]: "rootstock",
|
16
|
+
[ChainId.TAIKO]: "taiko",
|
17
|
+
[ChainId.MOONBEAM]: "moonbeam",
|
18
|
+
[ChainId.POLYGONZKEVM]: "polygon-zkevm",
|
19
|
+
[ChainId.BOB]: "bob",
|
20
|
+
// [ChainId.WORLDCHAIN]: "world-chain",
|
21
|
+
[ChainId.SONIC]: "sonic",
|
22
|
+
[ChainId.LISK]: "lisk",
|
23
|
+
[ChainId.CORN]: "corn",
|
24
|
+
};
|
25
|
+
export const pancakeswapChains = {
|
26
|
+
[ChainId.MAINNET]: "eth",
|
27
|
+
[ChainId.ARBITRUM]: "arb",
|
28
|
+
[ChainId.POLYGONZKEVM]: "polygon-zkevm",
|
29
|
+
};
|
30
|
+
export const sushiswapv3Chains = {
|
31
|
+
[ChainId.SKALE]: "skale-europa",
|
32
|
+
};
|
5
33
|
export class ClammMetadata {
|
6
34
|
async build(computeChainId, params) {
|
7
35
|
let platform = ammName(params.amm);
|
@@ -45,6 +73,122 @@ export class ClammMetadata {
|
|
45
73
|
{ chainId: computeChainId, address: params.token1 },
|
46
74
|
],
|
47
75
|
mainProtocol: AMM[params.amm] ? camelToKebabCase(AMM[params.amm]) : undefined,
|
76
|
+
depositUrl: ClammMetadata.generateUrl(computeChainId, params),
|
48
77
|
};
|
49
78
|
}
|
79
|
+
static generateUrl(computeChainId, params) {
|
80
|
+
switch (params.amm) {
|
81
|
+
case AMM.UniswapV3: {
|
82
|
+
const availableOnOku = Object.keys(uniswapV3OkuChains).includes(computeChainId?.toString());
|
83
|
+
if (availableOnOku) {
|
84
|
+
return `https://oku.trade/app/${uniswapV3OkuChains[computeChainId]}/liquidity/${params.poolAddress} `;
|
85
|
+
}
|
86
|
+
return `https://app.uniswap.org/explore/pools/${computeChainId === ChainId.MAINNET
|
87
|
+
? "ethereum/"
|
88
|
+
: `${NETWORK_LABELS[computeChainId]?.toLowerCase().replaceAll(" ", "")}/`}${params?.poolAddress?.toLowerCase()}`;
|
89
|
+
}
|
90
|
+
case AMM.PancakeSwapV3: {
|
91
|
+
return `https://pancakeswap.finance/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}/${Number(params.poolFee) * 10000}?chain=${pancakeswapChains[computeChainId] ?? NETWORK_LABELS[computeChainId]?.replaceAll(" ", "")}`;
|
92
|
+
}
|
93
|
+
case AMM.Sonex: {
|
94
|
+
return `https://app.sonex.so/explore/pools/${params.poolAddress?.toLowerCase()}`;
|
95
|
+
}
|
96
|
+
case AMM.KYO: {
|
97
|
+
return `https://app.kyo.finance/liquidity/${params.poolAddress?.toLowerCase()}`;
|
98
|
+
}
|
99
|
+
case AMM.SushiSwapV3: {
|
100
|
+
return `https://www.sushi.com/${sushiswapv3Chains[computeChainId] ?? NETWORK_LABELS[computeChainId]?.toLowerCase()?.replaceAll(" ", "")}/pool/v3/${params.poolAddress?.toLowerCase()}`;
|
101
|
+
}
|
102
|
+
case AMM.Retro: {
|
103
|
+
return "https://retro.finance/liquidity/managev3";
|
104
|
+
}
|
105
|
+
case AMM.Camelot: {
|
106
|
+
return `https://app.camelot.exchange/liquidity?type=v3&token1=${params.token0?.toLowerCase()}&token2=${params.token1?.toLowerCase()}`;
|
107
|
+
}
|
108
|
+
case AMM.BaseSwap: {
|
109
|
+
return `https://${computeChainId === ChainId.MODE ? "swapmode" : "baseswap"}.fi/addV3?currencyIdA=${params.token0}¤cyIdB=${params.token1}&feeAmount=${Number(params.poolFee) * 10000}`;
|
110
|
+
}
|
111
|
+
case AMM.Horiza: {
|
112
|
+
return "https:/app.horiza.io/liquidity";
|
113
|
+
}
|
114
|
+
case AMM.QuickswapAlgebra: {
|
115
|
+
return `https://quickswap.exchange/pools?currency0=${params.token0}¤cy1=${params.token1}`;
|
116
|
+
}
|
117
|
+
case AMM.QuickswapUni: {
|
118
|
+
return `https://quickswap.exchange/pools?currency0=${params.token0}¤cy1=${params.token1}`;
|
119
|
+
}
|
120
|
+
case AMM.QuickswapAlgebraV1_2: {
|
121
|
+
return `https://quickswap.exchange/pools?currency0=${params.token0}¤cy1=${params.token1}`;
|
122
|
+
}
|
123
|
+
case AMM.Swapr: {
|
124
|
+
return "https://v3.swapr.eth.limo/#/swap";
|
125
|
+
}
|
126
|
+
case AMM.ZERO: {
|
127
|
+
return "https://v3.swapr.eth.limo/#/swap";
|
128
|
+
}
|
129
|
+
case AMM.Crust: {
|
130
|
+
return "https://app.crust.finance/liquidity";
|
131
|
+
}
|
132
|
+
case AMM.Thruster: {
|
133
|
+
return "https://app.thruster.finance/add";
|
134
|
+
}
|
135
|
+
case AMM.Kim: {
|
136
|
+
return "https://app.kim.exchange/positions";
|
137
|
+
}
|
138
|
+
case AMM.Stryke: {
|
139
|
+
return "https://www.stryke.xyz/en/dashboard";
|
140
|
+
}
|
141
|
+
case AMM.StrykePCS: {
|
142
|
+
return `https://pancakeswap.stryke.xyz/${params.symbolToken0}-${params.symbolToken1}?mode=LP`;
|
143
|
+
}
|
144
|
+
case AMM.StrykeSushi: {
|
145
|
+
return `https://sushiswap.stryke.xyz/${params.symbolToken0}-${params.symbolToken1}?mode=LP`;
|
146
|
+
}
|
147
|
+
case AMM.ARTHSWAP: {
|
148
|
+
return "https://app.arthswap.org/#/pools";
|
149
|
+
}
|
150
|
+
case AMM.Fenix: {
|
151
|
+
return "https://www.fenixfinance.io/";
|
152
|
+
}
|
153
|
+
case AMM.Ramses: {
|
154
|
+
return "https://app.ramses.exchange/swap";
|
155
|
+
}
|
156
|
+
case AMM.Voltage: {
|
157
|
+
return `https://app.voltage.finance/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}?version=v3&feeAmount=${Number(params.poolFee) * 10000}`;
|
158
|
+
}
|
159
|
+
case AMM.Izumi: {
|
160
|
+
return `https://${computeChainId === ChainId.ROOTSTOCK ? "woodswap.org" : "izumi.finance"}/trade/add-liquidity/?token0=${params.token0}&token1=${params.token1}&chainId=${computeChainId}&fee=${Number(params.poolFee) * 10000}`;
|
161
|
+
}
|
162
|
+
case AMM.KOI: {
|
163
|
+
return `https://dapp.koi.finance/pool/v3/new/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}`;
|
164
|
+
}
|
165
|
+
case AMM.SupswapV3: {
|
166
|
+
return `https://supswap.xyz/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}/${Number.parseInt(params.poolFee) * 10000}`;
|
167
|
+
}
|
168
|
+
case AMM.zkSwap: {
|
169
|
+
return `https://www.zkswap.finance/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}/2000?chain=${computeChainId}`;
|
170
|
+
}
|
171
|
+
case AMM.SyncswapV3: {
|
172
|
+
return "https://www.syncswap.xyz/pools";
|
173
|
+
}
|
174
|
+
case AMM.Neptune: {
|
175
|
+
return "https://app.nep.finance/add/";
|
176
|
+
}
|
177
|
+
case AMM.SwapX: {
|
178
|
+
return "https://swapx.fi/earn";
|
179
|
+
}
|
180
|
+
case AMM.Velodrome: {
|
181
|
+
return "https://app.velodrome.finance/";
|
182
|
+
}
|
183
|
+
case AMM.AERODROME: {
|
184
|
+
return "https://app.aerodrome.finance/";
|
185
|
+
}
|
186
|
+
case AMM.ThirdTrade: {
|
187
|
+
return "https://app.thirdtrade.xyz/";
|
188
|
+
}
|
189
|
+
case AMM.Katana: {
|
190
|
+
return "https://app.roninchain.com/liquidity";
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
50
194
|
}
|
@@ -11,6 +11,8 @@ export declare class CompoundMetadata implements MetadataBuilder<campaignType> {
|
|
11
11
|
address: any;
|
12
12
|
}[];
|
13
13
|
mainProtocol: ProtocolId;
|
14
|
+
depositUrl: string;
|
14
15
|
}>;
|
16
|
+
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
15
17
|
}
|
16
18
|
export {};
|
@@ -15,6 +15,10 @@ export class CompoundMetadata {
|
|
15
15
|
{ chainId: computeChainId, address: params.targetToken },
|
16
16
|
],
|
17
17
|
mainProtocol: CompFork[params.compFork].toLowerCase(),
|
18
|
+
depositUrl: CompoundMetadata.generateUrl(computeChainId, params),
|
18
19
|
};
|
19
20
|
}
|
21
|
+
static generateUrl(_computeChainId, params) {
|
22
|
+
return `https://www.compound.blue/${params.targetToken.toLowerCase()}}`;
|
23
|
+
}
|
20
24
|
}
|
@@ -10,6 +10,8 @@ export declare class Erc20Metadata implements MetadataBuilder<campaignType> {
|
|
10
10
|
address: any;
|
11
11
|
}[];
|
12
12
|
mainProtocol: any;
|
13
|
+
depositUrl: any;
|
13
14
|
}>;
|
15
|
+
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): any;
|
14
16
|
}
|
15
17
|
export {};
|
@@ -10,6 +10,8 @@ export declare class EulerMetadata implements MetadataBuilder<campaignType> {
|
|
10
10
|
}[];
|
11
11
|
action: "LEND" | "BORROW";
|
12
12
|
mainProtocol: string;
|
13
|
+
depositUrl: string;
|
13
14
|
}>;
|
15
|
+
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
14
16
|
}
|
15
17
|
export {};
|
@@ -29,6 +29,10 @@ export class EulerMetadata {
|
|
29
29
|
],
|
30
30
|
action: [OpportunityAction.LEND, OpportunityAction.BORROW, OpportunityAction.BORROW][subType],
|
31
31
|
mainProtocol: "euler",
|
32
|
+
depositUrl: EulerMetadata.generateUrl(computeChainId, params),
|
32
33
|
};
|
33
34
|
}
|
35
|
+
static generateUrl(_computeChainId, params) {
|
36
|
+
return `https://app.euler.finance/vault/${params.evkAddress}`;
|
37
|
+
}
|
34
38
|
}
|
@@ -10,11 +10,14 @@ export declare class EventBasedMetadata implements MetadataBuilder<campaignType>
|
|
10
10
|
address: any;
|
11
11
|
}[];
|
12
12
|
mainProtocol: string;
|
13
|
+
depositUrl: any;
|
13
14
|
} | {
|
14
15
|
action: string;
|
15
16
|
name: string;
|
16
17
|
tokens: never[];
|
17
18
|
mainProtocol: undefined;
|
19
|
+
depositUrl?: undefined;
|
18
20
|
}>;
|
21
|
+
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): any;
|
19
22
|
}
|
20
23
|
export {};
|
@@ -31,6 +31,7 @@ export class EventBasedMetadata {
|
|
31
31
|
name,
|
32
32
|
tokens,
|
33
33
|
mainProtocol: mainProtocolId.toLowerCase(),
|
34
|
+
depositUrl: EventBasedMetadata.generateUrl(computeChainId, params),
|
34
35
|
};
|
35
36
|
}
|
36
37
|
catch {
|
@@ -42,4 +43,7 @@ export class EventBasedMetadata {
|
|
42
43
|
};
|
43
44
|
}
|
44
45
|
}
|
46
|
+
static generateUrl(_computeChainId, params) {
|
47
|
+
return params.url;
|
48
|
+
}
|
45
49
|
}
|
@@ -10,6 +10,8 @@ export declare class HyperdriveMetadata implements MetadataBuilder<campaignType>
|
|
10
10
|
address: any;
|
11
11
|
}[];
|
12
12
|
mainProtocol: string;
|
13
|
+
depositUrl: string;
|
13
14
|
}>;
|
15
|
+
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"], subType: CampaignParameters<campaignType>["campaignSubType"]): string;
|
14
16
|
}
|
15
17
|
export {};
|
@@ -16,6 +16,11 @@ export class HyperdriveMetadata {
|
|
16
16
|
name: [subtypeData.name, params.symbolTargetToken].join(" "),
|
17
17
|
tokens: [{ chainId: computeChainId, address: params.targetToken }],
|
18
18
|
mainProtocol: "hyperdrive",
|
19
|
+
depositUrl: HyperdriveMetadata.generateUrl(computeChainId, params, subType),
|
19
20
|
};
|
20
21
|
}
|
22
|
+
static generateUrl(computeChainId, params, subType) {
|
23
|
+
const campaignType = subType === 0 ? "lp" : subType === 1 ? "long" : "short";
|
24
|
+
return `https://app.hyperdrive.box/market/${computeChainId}/${params.targetToken}?position=${campaignType}`;
|
25
|
+
}
|
21
26
|
}
|