@merkl/api 0.21.36 → 0.21.38
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 +1758 -1351
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/factoryFinder.js +1 -0
- package/dist/src/engine/implementations/Erc20/subTypes/detect.js +108 -97
- package/dist/src/engine/implementations/Erc20/subTypes/factories.js +8 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/aave/metadata.d.ts +1 -1
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/metadata.d.ts +17 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/metadata.js +38 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/tvl.d.ts +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/pino/tvl.js +83 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/metadata.d.ts +30 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/metadata.js +65 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/tvl.d.ts +6 -0
- package/dist/src/engine/implementations/Erc20/subTypes/implementations/uniswapV2/tvl.js +94 -0
- package/dist/src/engine/implementations/Erc20/subTypes/index.d.ts +2 -1
- package/dist/src/engine/implementations/Erc20/subTypes/index.js +1 -0
- package/dist/src/engine/implementations/JsonAirdrop/metadata.d.ts +2 -2
- package/dist/src/index.d.ts +545 -396
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +5 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +41 -2
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +385 -240
- package/dist/src/modules/v4/campaign/campaign.test.controller.js +41 -15
- package/dist/src/modules/v4/creator/creator.controller.d.ts +157 -153
- package/dist/src/modules/v4/creator/creator.controller.js +11 -11
- package/dist/src/modules/v4/creator/creator.model.d.ts +2 -2
- package/dist/src/modules/v4/creator/creator.model.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +3 -3
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/reward/reward.repository.js +1 -1
- package/dist/src/modules/v4/router.d.ts +545 -396
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -0,0 +1,94 @@
|
|
1
|
+
import { TokenService } from "@/modules/v4/token/token.service";
|
2
|
+
import { TvlType } from "@db/api";
|
3
|
+
import { ChainInteractionService, ERC20Interface, UniswapV2PoolInterface, bigIntToNumber, } from "@sdk";
|
4
|
+
export class UniswapV2TVLBuilder {
|
5
|
+
async build(computeChainId, campaigns) {
|
6
|
+
const tvls = [];
|
7
|
+
const firstRound = await ChainInteractionService(computeChainId).fetchAndDecodeObject(campaigns.flatMap(campaign => {
|
8
|
+
const { campaignId, campaignParameters } = campaign;
|
9
|
+
const { targetToken } = campaignParameters;
|
10
|
+
return [
|
11
|
+
{
|
12
|
+
callData: UniswapV2PoolInterface.encodeFunctionData("token0"),
|
13
|
+
target: targetToken,
|
14
|
+
key: `${campaignId}_token0`,
|
15
|
+
decoder: (data) => {
|
16
|
+
return UniswapV2PoolInterface.decodeFunctionResult("token0", data)[0];
|
17
|
+
},
|
18
|
+
},
|
19
|
+
{
|
20
|
+
callData: UniswapV2PoolInterface.encodeFunctionData("token1"),
|
21
|
+
target: targetToken,
|
22
|
+
key: `${campaignId}_token1`,
|
23
|
+
decoder: (data) => {
|
24
|
+
return UniswapV2PoolInterface.decodeFunctionResult("token1", data)[0];
|
25
|
+
},
|
26
|
+
},
|
27
|
+
];
|
28
|
+
}));
|
29
|
+
const secondRound = await ChainInteractionService(computeChainId).fetchAndDecodeObject(campaigns.flatMap(campaign => {
|
30
|
+
const { campaignId, campaignParameters } = campaign;
|
31
|
+
const { targetToken } = campaignParameters;
|
32
|
+
const token0Address = firstRound[`${campaignId}_token0`];
|
33
|
+
const token1Address = firstRound[`${campaignId}_token1`];
|
34
|
+
return [
|
35
|
+
{
|
36
|
+
callData: ERC20Interface.encodeFunctionData("balanceOf", [targetToken]),
|
37
|
+
target: token0Address,
|
38
|
+
key: `${campaignId}_token0`,
|
39
|
+
decoder: (data) => {
|
40
|
+
return ERC20Interface.decodeFunctionResult("balanceOf", data)[0];
|
41
|
+
},
|
42
|
+
},
|
43
|
+
{
|
44
|
+
callData: ERC20Interface.encodeFunctionData("balanceOf", [targetToken]),
|
45
|
+
target: token1Address,
|
46
|
+
key: `${campaignId}_token1`,
|
47
|
+
decoder: (data) => {
|
48
|
+
return ERC20Interface.decodeFunctionResult("balanceOf", data)[0];
|
49
|
+
},
|
50
|
+
},
|
51
|
+
];
|
52
|
+
}));
|
53
|
+
for (const campaign of campaigns) {
|
54
|
+
const { campaignId } = campaign;
|
55
|
+
const token0Address = firstRound[`${campaignId}_token0`];
|
56
|
+
const token1Address = firstRound[`${campaignId}_token1`];
|
57
|
+
const reserve0 = secondRound[`${campaignId}_token0`];
|
58
|
+
const reserve1 = secondRound[`${campaignId}_token1`];
|
59
|
+
// We don't fetch token data everytime, we use the database and the associated service
|
60
|
+
const token0 = await TokenService.findUniqueFillOrThrow({
|
61
|
+
chainId: computeChainId,
|
62
|
+
address: token0Address,
|
63
|
+
});
|
64
|
+
const token1 = await TokenService.findUniqueFillOrThrow({
|
65
|
+
chainId: computeChainId,
|
66
|
+
address: token1Address,
|
67
|
+
});
|
68
|
+
if (!token0.decimals || !token0.price) {
|
69
|
+
throw new Error(`Missing decimals or price for token ${token0.address}`);
|
70
|
+
}
|
71
|
+
if (!token1.decimals || !token1.price) {
|
72
|
+
throw new Error(`Missing decimals or price for token ${token1.address}`);
|
73
|
+
}
|
74
|
+
tvls.push({
|
75
|
+
campaign,
|
76
|
+
tvl: bigIntToNumber(reserve0, token0.decimals) * token0.price +
|
77
|
+
bigIntToNumber(reserve1, token1.decimals) * token1.price,
|
78
|
+
tvlBreakdown: [
|
79
|
+
{
|
80
|
+
identifier: token0.id,
|
81
|
+
type: TvlType.TOKEN,
|
82
|
+
value: bigIntToNumber(reserve0, token0.decimals),
|
83
|
+
},
|
84
|
+
{
|
85
|
+
identifier: token1.id,
|
86
|
+
type: TvlType.TOKEN,
|
87
|
+
value: bigIntToNumber(reserve1, token1.decimals),
|
88
|
+
},
|
89
|
+
],
|
90
|
+
});
|
91
|
+
}
|
92
|
+
return tvls;
|
93
|
+
}
|
94
|
+
}
|
@@ -10,13 +10,13 @@ export declare class JsonAirdropMetadata implements MetadataBuilder<campaignType
|
|
10
10
|
chainId: number;
|
11
11
|
address: string;
|
12
12
|
}[];
|
13
|
-
mainProtocol: "splice" | "reserve" | "morpho" | "quickswap" | "euler" | "uniswap" | "ambient" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "lnd" | "dlend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "sake" | "sonicmarket" | "stability" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "termmax" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "punchswap" | "satlayer" | "puffer" | undefined;
|
13
|
+
mainProtocol: "splice" | "reserve" | "morpho" | "quickswap" | "euler" | "uniswap" | "ambient" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "pinto" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "lnd" | "dlend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "sake" | "sonicmarket" | "stability" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "termmax" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "punchswap" | "satlayer" | "puffer" | undefined;
|
14
14
|
depositUrl?: undefined;
|
15
15
|
} | {
|
16
16
|
action: "DROP";
|
17
17
|
name: string;
|
18
18
|
tokens: never[];
|
19
|
-
mainProtocol: "splice" | "reserve" | "morpho" | "quickswap" | "euler" | "uniswap" | "ambient" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "lnd" | "dlend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "sake" | "sonicmarket" | "stability" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "termmax" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "punchswap" | "satlayer" | "puffer" | undefined;
|
19
|
+
mainProtocol: "splice" | "reserve" | "morpho" | "quickswap" | "euler" | "uniswap" | "ambient" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "ramses" | "retro" | "stryke" | "sushi-swap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "pinto" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "lnd" | "dlend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "iguana" | "xlend" | "sake" | "sonicmarket" | "stability" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "termmax" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "punchswap" | "satlayer" | "puffer" | undefined;
|
20
20
|
depositUrl: any;
|
21
21
|
}>;
|
22
22
|
static generateUrl(_computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): any;
|