@continuumdao/ctm-mpc-defi 0.2.34 → 0.2.35
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/agent/catalog.cjs +712 -44
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +1630 -244
- package/dist/agent/catalog.js +678 -45
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aave-v4/SKILL.md +19 -4
- package/dist/agent/skills/aerodrome/SKILL.md +2 -2
- package/dist/agent/skills/compound-v3/SKILL.md +2 -2
- package/dist/agent/skills/curve-dao/SKILL.md +14 -0
- package/dist/agent/skills/ethena/SKILL.md +3 -1
- package/dist/agent/skills/euler-v2/SKILL.md +1 -1
- package/dist/agent/skills/gmx/SKILL.md +1 -1
- package/dist/agent/skills/hyperliquid/SKILL.md +7 -5
- package/dist/agent/skills/lido/SKILL.md +3 -0
- package/dist/agent/skills/maple-syrup/SKILL.md +35 -3
- package/dist/agent/skills/morpho/SKILL.md +1 -1
- package/dist/agent/skills/sky/SKILL.md +2 -0
- package/dist/agent/skills/yield-compare/SKILL.md +78 -0
- package/dist/index.cjs +129 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +129 -27
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +170 -0
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.d.ts +59 -1
- package/dist/protocols/evm/aave-v4/index.js +164 -1
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +1308 -901
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +69 -2
- package/dist/protocols/evm/aerodrome/index.js +1217 -807
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/compound-v3/index.cjs +82 -6
- package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
- package/dist/protocols/evm/compound-v3/index.d.ts +89 -1
- package/dist/protocols/evm/compound-v3/index.js +80 -7
- package/dist/protocols/evm/compound-v3/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +447 -18
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +108 -1
- package/dist/protocols/evm/curve-dao/index.js +440 -19
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/ethena/index.cjs +89 -0
- package/dist/protocols/evm/ethena/index.cjs.map +1 -1
- package/dist/protocols/evm/ethena/index.d.ts +17 -1
- package/dist/protocols/evm/ethena/index.js +89 -2
- package/dist/protocols/evm/ethena/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +29 -0
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +21 -1
- package/dist/protocols/evm/euler-v2/index.js +29 -1
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +83 -1
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.d.ts +22 -2
- package/dist/protocols/evm/gmx/index.js +80 -2
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +67 -11
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.d.ts +39 -2
- package/dist/protocols/evm/hyperliquid/index.js +64 -12
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.cjs +13 -0
- package/dist/protocols/evm/lido/index.cjs.map +1 -1
- package/dist/protocols/evm/lido/index.d.ts +9 -1
- package/dist/protocols/evm/lido/index.js +13 -1
- package/dist/protocols/evm/lido/index.js.map +1 -1
- package/dist/protocols/evm/maple/index.cjs +129 -1
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.d.ts +45 -1
- package/dist/protocols/evm/maple/index.js +124 -3
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +34 -7
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +23 -1
- package/dist/protocols/evm/morpho/index.js +34 -8
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/sky/index.cjs +52 -0
- package/dist/protocols/evm/sky/index.cjs.map +1 -1
- package/dist/protocols/evm/sky/index.d.ts +16 -1
- package/dist/protocols/evm/sky/index.js +50 -1
- package/dist/protocols/evm/sky/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -199,6 +199,113 @@ declare function formatCurvePriceImpact(percent0to100: number | null | undefined
|
|
|
199
199
|
*/
|
|
200
200
|
declare function formatMinOutAtUserSlippage(quoteOutDecimal: string, userSlippagePercentInput: string, tokenOutSymbol: string): string;
|
|
201
201
|
|
|
202
|
+
declare const CURVE_IMPORTANT_POOL_CAP = 100;
|
|
203
|
+
type CurveImportantPoolCoin = {
|
|
204
|
+
address: string;
|
|
205
|
+
symbol: string;
|
|
206
|
+
decimals: number;
|
|
207
|
+
};
|
|
208
|
+
type CurveImportantPoolRow = {
|
|
209
|
+
id: string;
|
|
210
|
+
address: string;
|
|
211
|
+
name: string;
|
|
212
|
+
coins: CurveImportantPoolCoin[];
|
|
213
|
+
tvlUsd: number;
|
|
214
|
+
baseApy: string | null;
|
|
215
|
+
gaugeCrvApy: string | null;
|
|
216
|
+
gaugeAddress: string | null;
|
|
217
|
+
};
|
|
218
|
+
declare function curveDaoFetchImportantPools(args: {
|
|
219
|
+
chainId: number;
|
|
220
|
+
query?: string;
|
|
221
|
+
}): Promise<{
|
|
222
|
+
chainId: number;
|
|
223
|
+
pools: CurveImportantPoolRow[];
|
|
224
|
+
notes: string;
|
|
225
|
+
}>;
|
|
226
|
+
declare function curveDaoFetchLpYields(args: {
|
|
227
|
+
chainId: number;
|
|
228
|
+
query?: string;
|
|
229
|
+
pool?: string;
|
|
230
|
+
}): Promise<{
|
|
231
|
+
chainId: number;
|
|
232
|
+
pools: CurveImportantPoolRow[];
|
|
233
|
+
notes: string;
|
|
234
|
+
}>;
|
|
235
|
+
|
|
236
|
+
declare function curveDaoQuoteAddLiquidity(args: {
|
|
237
|
+
chainId: number;
|
|
238
|
+
rpcUrl: string;
|
|
239
|
+
pool: string;
|
|
240
|
+
amountsHuman: string[];
|
|
241
|
+
stakeInGauge?: boolean;
|
|
242
|
+
}): Promise<{
|
|
243
|
+
pool: `0x${string}`;
|
|
244
|
+
poolId: string;
|
|
245
|
+
name: string;
|
|
246
|
+
coins: string[];
|
|
247
|
+
amountsHuman: string[];
|
|
248
|
+
expectedLp: string;
|
|
249
|
+
gauge: string | null;
|
|
250
|
+
stakeInGauge: boolean;
|
|
251
|
+
baseApy: string | null;
|
|
252
|
+
gaugeCrvApy: string | null;
|
|
253
|
+
notes: string;
|
|
254
|
+
}>;
|
|
255
|
+
declare function curveDaoQuoteRemoveLiquidity(args: {
|
|
256
|
+
chainId: number;
|
|
257
|
+
rpcUrl: string;
|
|
258
|
+
pool: string;
|
|
259
|
+
lpAmountHuman: string;
|
|
260
|
+
}): Promise<{
|
|
261
|
+
pool: `0x${string}`;
|
|
262
|
+
poolId: string;
|
|
263
|
+
coins: string[];
|
|
264
|
+
lpAmountHuman: string;
|
|
265
|
+
expectedAmounts: string[];
|
|
266
|
+
notes: string;
|
|
267
|
+
}>;
|
|
268
|
+
declare function buildEvmMultisignBodyCurveAddLiquidity(args: {
|
|
269
|
+
keyGen: KeyGenSubsetForPermit;
|
|
270
|
+
chainId: number;
|
|
271
|
+
rpcUrl: string;
|
|
272
|
+
chainDetail: EvmChainDetail;
|
|
273
|
+
useCustomGas: boolean;
|
|
274
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
275
|
+
executorAddress: Address;
|
|
276
|
+
purposeText: string;
|
|
277
|
+
pool: string;
|
|
278
|
+
amountsHuman: string[];
|
|
279
|
+
slippagePercent: number;
|
|
280
|
+
stakeInGauge?: boolean;
|
|
281
|
+
}): Promise<MultisignBuildResult>;
|
|
282
|
+
declare function buildEvmMultisignBodyCurveRemoveLiquidity(args: {
|
|
283
|
+
keyGen: KeyGenSubsetForPermit;
|
|
284
|
+
chainId: number;
|
|
285
|
+
rpcUrl: string;
|
|
286
|
+
chainDetail: EvmChainDetail;
|
|
287
|
+
useCustomGas: boolean;
|
|
288
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
289
|
+
executorAddress: Address;
|
|
290
|
+
purposeText: string;
|
|
291
|
+
pool: string;
|
|
292
|
+
lpAmountHuman: string;
|
|
293
|
+
slippagePercent: number;
|
|
294
|
+
}): Promise<MultisignBuildResult>;
|
|
295
|
+
declare function buildEvmMultisignBodyCurveGaugeDeposit(args: {
|
|
296
|
+
keyGen: KeyGenSubsetForPermit;
|
|
297
|
+
chainId: number;
|
|
298
|
+
rpcUrl: string;
|
|
299
|
+
chainDetail: EvmChainDetail;
|
|
300
|
+
useCustomGas: boolean;
|
|
301
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
302
|
+
executorAddress: Address;
|
|
303
|
+
purposeText: string;
|
|
304
|
+
pool: string;
|
|
305
|
+
lpAmountHuman: string;
|
|
306
|
+
withdraw?: boolean;
|
|
307
|
+
}): Promise<MultisignBuildResult>;
|
|
308
|
+
|
|
202
309
|
declare const CURVE_DAO_PROTOCOL_ID = "curve-dao";
|
|
203
310
|
declare const curveDaoProtocolModule: ProtocolModule;
|
|
204
311
|
|
|
@@ -208,4 +315,4 @@ declare const curveDao: {
|
|
|
208
315
|
loadSession: typeof loadFullCurveSessionForRpc;
|
|
209
316
|
};
|
|
210
317
|
|
|
211
|
-
export { CURVE_DAO_PROTOCOL_ID, CURVE_NATIVE_PLACEHOLDER, CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS, type CurveCoinDataRow, type CurveDaoQuoteResult, type CurveDestToken, type CurveFullSession, type CurveSessionSnapshot, addNativeWethBridge, bfsCurveSwapDestinations, buildCurveDaoPurposePrefill, buildCurveLiquidityGraphFromApi, buildEvmMultisignBodyCurveDaoBatch, computeCurveExecutionSlippagePercent, curveDao, curveDaoProtocolModule, curveDaoQuote, curveProbeInAmountString, fetchAllCurvePools, fetchCurveCoinsDataForRpc, formatCurveExchangeLine, formatCurvePriceImpact, formatMinOutAtUserSlippage, isCurveApiChainSupported, isCurveApiChainSupported as isCurveDaoChainSupported, isCurveDaoErc20ApproveEvmSignRequest, isCurveDaoSwapEvmSignRequest, isCurveTokenKeySwappable, loadCurveSessionSnapshotForRpc, loadFullCurveSessionForRpc, normalizeCurveRouterAmountString, resolveCurveDaoRouterGasUnitsFromSignRequest, swappableCurveGraphNodeKeys, toCurveRouterTokenId, toCurveTokenKey };
|
|
318
|
+
export { CURVE_DAO_PROTOCOL_ID, CURVE_IMPORTANT_POOL_CAP, CURVE_NATIVE_PLACEHOLDER, CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS, type CurveCoinDataRow, type CurveDaoQuoteResult, type CurveDestToken, type CurveFullSession, type CurveImportantPoolCoin, type CurveImportantPoolRow, type CurveSessionSnapshot, addNativeWethBridge, bfsCurveSwapDestinations, buildCurveDaoPurposePrefill, buildCurveLiquidityGraphFromApi, buildEvmMultisignBodyCurveAddLiquidity, buildEvmMultisignBodyCurveDaoBatch, buildEvmMultisignBodyCurveGaugeDeposit, buildEvmMultisignBodyCurveRemoveLiquidity, computeCurveExecutionSlippagePercent, curveDao, curveDaoFetchImportantPools, curveDaoFetchLpYields, curveDaoProtocolModule, curveDaoQuote, curveDaoQuoteAddLiquidity, curveDaoQuoteRemoveLiquidity, curveProbeInAmountString, fetchAllCurvePools, fetchCurveCoinsDataForRpc, formatCurveExchangeLine, formatCurvePriceImpact, formatMinOutAtUserSlippage, isCurveApiChainSupported, isCurveApiChainSupported as isCurveDaoChainSupported, isCurveDaoErc20ApproveEvmSignRequest, isCurveDaoSwapEvmSignRequest, isCurveTokenKeySwappable, loadCurveSessionSnapshotForRpc, loadFullCurveSessionForRpc, normalizeCurveRouterAmountString, resolveCurveDaoRouterGasUnitsFromSignRequest, swappableCurveGraphNodeKeys, toCurveRouterTokenId, toCurveTokenKey };
|
|
@@ -467,25 +467,25 @@ async function buildEvmMultisignBatch(args) {
|
|
|
467
467
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
468
468
|
rpcUrls: { default: { http: [rpcUrl] } }
|
|
469
469
|
});
|
|
470
|
-
const
|
|
470
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: http(rpcUrl) });
|
|
471
471
|
const feeParams = await fetchChainFeeParams(rpcUrl, chainId);
|
|
472
472
|
const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559;
|
|
473
|
-
const latestBaseFeeWei = !legacy ? (await
|
|
473
|
+
const latestBaseFeeWei = !legacy ? (await publicClient2.getBlock({ blockTag: "latest" })).baseFeePerGas ?? 0n : 0n;
|
|
474
474
|
const gasLimitConfig = useCustomGas && chainDetail?.gasLimit != null ? Number(chainDetail.gasLimit) : void 0;
|
|
475
475
|
const chainGasLimitRouter = chainDetail?.gasLimit != null && Number.isFinite(Number(chainDetail.gasLimit)) && Number(chainDetail.gasLimit) > 0 ? Number(chainDetail.gasLimit) : void 0;
|
|
476
476
|
const gasFeeMultiplier = useCustomGas && chainDetail?.gasMultiplier != null ? Number(chainDetail.gasMultiplier) : void 0;
|
|
477
477
|
const executor = getAddress(executorAddress);
|
|
478
|
-
const baseNonce = await
|
|
478
|
+
const baseNonce = await publicClient2.getTransactionCount({ address: executor, blockTag: "pending" });
|
|
479
479
|
const legs = [];
|
|
480
480
|
for (let i = 0; i < steps.length; i++) {
|
|
481
481
|
const step = steps[i];
|
|
482
482
|
const currentNonce = baseNonce + i;
|
|
483
483
|
let estimatedGas;
|
|
484
484
|
if (args.estimateGasForStep) {
|
|
485
|
-
estimatedGas = await args.estimateGasForStep({ step, index: i, publicClient, executor });
|
|
485
|
+
estimatedGas = await args.estimateGasForStep({ step, index: i, publicClient: publicClient2, executor });
|
|
486
486
|
} else {
|
|
487
487
|
try {
|
|
488
|
-
estimatedGas = await
|
|
488
|
+
estimatedGas = await publicClient2.estimateGas({
|
|
489
489
|
to: step.to,
|
|
490
490
|
data: step.data,
|
|
491
491
|
value: step.value,
|
|
@@ -497,7 +497,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
497
497
|
}
|
|
498
498
|
let gasLimitI;
|
|
499
499
|
if (args.resolveGasLimit) {
|
|
500
|
-
gasLimitI = await args.resolveGasLimit({ step, index: i, estimatedGas, publicClient });
|
|
500
|
+
gasLimitI = await args.resolveGasLimit({ step, index: i, estimatedGas, publicClient: publicClient2 });
|
|
501
501
|
} else if (step.routerSwap) {
|
|
502
502
|
gasLimitI = routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimitRouter);
|
|
503
503
|
} else {
|
|
@@ -507,7 +507,7 @@ async function buildEvmMultisignBatch(args) {
|
|
|
507
507
|
let feeSnapshot;
|
|
508
508
|
let serialized;
|
|
509
509
|
if (legacy) {
|
|
510
|
-
let gasPriceWei = await
|
|
510
|
+
let gasPriceWei = await publicClient2.getGasPrice();
|
|
511
511
|
if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {
|
|
512
512
|
gasPriceWei = gasPriceWei * BigInt(100 + gasFeeMultiplier) / 100n;
|
|
513
513
|
}
|
|
@@ -658,37 +658,37 @@ async function buildEvmMultisignBodyCurveDaoBatch(args) {
|
|
|
658
658
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
659
659
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
660
660
|
});
|
|
661
|
-
const
|
|
662
|
-
const
|
|
661
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: http(args.rpcUrl) });
|
|
662
|
+
const erc20AllowanceAbi2 = parseAbi([
|
|
663
663
|
"function allowance(address owner, address spender) view returns (uint256)",
|
|
664
664
|
"function decimals() view returns (uint8)"
|
|
665
665
|
]);
|
|
666
|
-
const
|
|
666
|
+
const erc20ApproveAbi2 = parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]);
|
|
667
667
|
const steps = [];
|
|
668
668
|
if (!isNativeIn) {
|
|
669
|
-
const decimalsN = await
|
|
669
|
+
const decimalsN = await publicClient2.readContract({
|
|
670
670
|
address: tokenIn,
|
|
671
|
-
abi:
|
|
671
|
+
abi: erc20AllowanceAbi2,
|
|
672
672
|
functionName: "decimals"
|
|
673
673
|
});
|
|
674
674
|
const amountWei = parseUnits(args.amountHuman, Number(decimalsN));
|
|
675
|
-
const currentAllowance = await
|
|
675
|
+
const currentAllowance = await publicClient2.readContract({
|
|
676
676
|
address: tokenIn,
|
|
677
|
-
abi:
|
|
677
|
+
abi: erc20AllowanceAbi2,
|
|
678
678
|
functionName: "allowance",
|
|
679
679
|
args: [executor, routerAddr]
|
|
680
680
|
});
|
|
681
681
|
if (currentAllowance < amountWei) {
|
|
682
682
|
if (currentAllowance > 0n) {
|
|
683
683
|
const dataReset = encodeFunctionData({
|
|
684
|
-
abi:
|
|
684
|
+
abi: erc20ApproveAbi2,
|
|
685
685
|
functionName: "approve",
|
|
686
686
|
args: [routerAddr, 0n]
|
|
687
687
|
});
|
|
688
688
|
steps.push({ to: tokenIn, data: dataReset, value: 0n, kind: "approve", fallbackGas: 80000n });
|
|
689
689
|
}
|
|
690
690
|
const dataApprove = encodeFunctionData({
|
|
691
|
-
abi:
|
|
691
|
+
abi: erc20ApproveAbi2,
|
|
692
692
|
functionName: "approve",
|
|
693
693
|
args: [routerAddr, amountWei]
|
|
694
694
|
});
|
|
@@ -798,8 +798,8 @@ async function resolveTokenInDecimals(args) {
|
|
|
798
798
|
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
799
799
|
rpcUrls: { default: { http: [args.rpcUrl] } }
|
|
800
800
|
});
|
|
801
|
-
const
|
|
802
|
-
const decimalsN = await
|
|
801
|
+
const publicClient2 = createPublicClient({ chain: ch, transport: http(args.rpcUrl) });
|
|
802
|
+
const decimalsN = await publicClient2.readContract({
|
|
803
803
|
address: addr,
|
|
804
804
|
abi: erc20DecimalsAbi,
|
|
805
805
|
functionName: "decimals"
|
|
@@ -948,6 +948,411 @@ function formatMinOutAtUserSlippage(quoteOutDecimal, userSlippagePercentInput, t
|
|
|
948
948
|
return `${t} ${sOut}`.trim();
|
|
949
949
|
}
|
|
950
950
|
|
|
951
|
+
// src/protocols/evm/curve-dao/importantPools.ts
|
|
952
|
+
var CURVE_IMPORTANT_POOL_CAP = 100;
|
|
953
|
+
var CURVE_API_BASE = "https://api.curve.finance/api/getPools";
|
|
954
|
+
var CHAIN_SLUG = {
|
|
955
|
+
1: "ethereum",
|
|
956
|
+
10: "optimism",
|
|
957
|
+
56: "bsc",
|
|
958
|
+
100: "xdai",
|
|
959
|
+
137: "polygon",
|
|
960
|
+
146: "sonic",
|
|
961
|
+
250: "fantom",
|
|
962
|
+
324: "zksync",
|
|
963
|
+
8453: "base",
|
|
964
|
+
42161: "arbitrum",
|
|
965
|
+
43114: "avalanche",
|
|
966
|
+
42220: "celo",
|
|
967
|
+
1313161554: "aurora"
|
|
968
|
+
};
|
|
969
|
+
var REGISTRIES = [
|
|
970
|
+
"main",
|
|
971
|
+
"crypto",
|
|
972
|
+
"factory",
|
|
973
|
+
"factory-crypto",
|
|
974
|
+
"factory-crvusd",
|
|
975
|
+
"factory-stable-ng",
|
|
976
|
+
"factory-twocrypto",
|
|
977
|
+
"factory-tricrypto"
|
|
978
|
+
];
|
|
979
|
+
function formatApy(n) {
|
|
980
|
+
if (typeof n === "number" && Number.isFinite(n) && n >= 0) return `${n.toFixed(2)}%`;
|
|
981
|
+
if (Array.isArray(n) && typeof n[0] === "number" && Number.isFinite(n[0])) return `${n[0].toFixed(2)}%`;
|
|
982
|
+
return null;
|
|
983
|
+
}
|
|
984
|
+
function pickApy(pool, keys) {
|
|
985
|
+
for (const k of keys) {
|
|
986
|
+
const label = formatApy(pool[k]);
|
|
987
|
+
if (label) return label;
|
|
988
|
+
}
|
|
989
|
+
return null;
|
|
990
|
+
}
|
|
991
|
+
function mapPool(raw) {
|
|
992
|
+
const address = String(raw.address ?? raw.id ?? "").trim();
|
|
993
|
+
if (!address) return null;
|
|
994
|
+
const tvl = Number(raw.usdTotal ?? raw.tvl ?? raw.usd_total ?? 0);
|
|
995
|
+
if (!Number.isFinite(tvl) || tvl <= 0) return null;
|
|
996
|
+
const coinsRaw = raw.coins ?? raw.underlyingCoins ?? [];
|
|
997
|
+
const coins = coinsRaw.map((c) => ({
|
|
998
|
+
address: String(c.address ?? c.addr ?? "").trim(),
|
|
999
|
+
symbol: String(c.symbol ?? c.coinsymbol ?? "").trim() || "TOKEN",
|
|
1000
|
+
decimals: Number(c.decimals ?? 18) || 18
|
|
1001
|
+
})).filter((c) => c.address);
|
|
1002
|
+
if (!coins.length) return null;
|
|
1003
|
+
const gauge = String(raw.gaugeAddress ?? raw.gauge ?? "").trim();
|
|
1004
|
+
return {
|
|
1005
|
+
id: String(raw.id ?? address),
|
|
1006
|
+
address,
|
|
1007
|
+
name: String(raw.name ?? raw.poolName ?? coins.map((c) => c.symbol).join("/")),
|
|
1008
|
+
coins,
|
|
1009
|
+
tvlUsd: tvl,
|
|
1010
|
+
baseApy: pickApy(raw, ["latestDailyApy", "latestWeeklyApy", "baseApy", "apy"]),
|
|
1011
|
+
gaugeCrvApy: pickApy(raw, ["gaugeCrvApy", "gauge_crv_apy", "crvApy"]),
|
|
1012
|
+
gaugeAddress: gauge || null
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
async function fetchRegistry(slug, registry) {
|
|
1016
|
+
try {
|
|
1017
|
+
const res = await fetch(`${CURVE_API_BASE}/${slug}/${registry}`, { cache: "no-store" });
|
|
1018
|
+
if (!res.ok) return [];
|
|
1019
|
+
const j = await res.json();
|
|
1020
|
+
return j.data?.poolData ?? j.poolData ?? [];
|
|
1021
|
+
} catch {
|
|
1022
|
+
return [];
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
async function curveDaoFetchImportantPools(args) {
|
|
1026
|
+
if (!isCurveApiChainSupported(args.chainId)) {
|
|
1027
|
+
return { chainId: args.chainId, pools: [], notes: `Curve is not supported on chain ${args.chainId}.` };
|
|
1028
|
+
}
|
|
1029
|
+
const slug = CHAIN_SLUG[args.chainId];
|
|
1030
|
+
if (!slug) {
|
|
1031
|
+
return { chainId: args.chainId, pools: [], notes: `No official Curve API slug for chain ${args.chainId}.` };
|
|
1032
|
+
}
|
|
1033
|
+
const pages = await Promise.all(REGISTRIES.map((r) => fetchRegistry(slug, r)));
|
|
1034
|
+
const byAddr = /* @__PURE__ */ new Map();
|
|
1035
|
+
for (const raw of pages.flat()) {
|
|
1036
|
+
const row = mapPool(raw);
|
|
1037
|
+
if (!row) continue;
|
|
1038
|
+
const key = row.address.toLowerCase();
|
|
1039
|
+
const prev = byAddr.get(key);
|
|
1040
|
+
if (!prev || row.tvlUsd > prev.tvlUsd) byAddr.set(key, row);
|
|
1041
|
+
}
|
|
1042
|
+
let pools = [...byAddr.values()].sort((a, b) => b.tvlUsd - a.tvlUsd);
|
|
1043
|
+
const q = (args.query ?? "").trim().toLowerCase();
|
|
1044
|
+
if (q) {
|
|
1045
|
+
pools = pools.filter(
|
|
1046
|
+
(p) => [p.name, p.address, p.id, ...p.coins.map((c) => c.symbol)].join(" ").toLowerCase().includes(q)
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
pools = pools.slice(0, CURVE_IMPORTANT_POOL_CAP);
|
|
1050
|
+
return {
|
|
1051
|
+
chainId: args.chainId,
|
|
1052
|
+
pools,
|
|
1053
|
+
notes: `Official api.curve.fi catalog, TVL-ranked, hard cap ${CURVE_IMPORTANT_POOL_CAP}. Dead/zero-TVL dropped. Do not call fetchAllCurvePools or invent a list-all-pools tool. gauge_crv_apy requires staking LP in the gauge.`
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
async function curveDaoFetchLpYields(args) {
|
|
1057
|
+
const { pools, notes } = await curveDaoFetchImportantPools({ chainId: args.chainId, query: args.query });
|
|
1058
|
+
const poolFilter = (args.pool ?? "").trim().toLowerCase();
|
|
1059
|
+
const filtered = poolFilter ? pools.filter((p) => p.address.toLowerCase() === poolFilter || p.id.toLowerCase() === poolFilter) : pools;
|
|
1060
|
+
return { chainId: args.chainId, pools: filtered, notes };
|
|
1061
|
+
}
|
|
1062
|
+
var erc20ApproveAbi = parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]);
|
|
1063
|
+
var erc20AllowanceAbi = parseAbi([
|
|
1064
|
+
"function allowance(address owner, address spender) view returns (uint256)",
|
|
1065
|
+
"function decimals() view returns (uint8)"
|
|
1066
|
+
]);
|
|
1067
|
+
var gaugeAbi = parseAbi(["function deposit(uint256 value)", "function withdraw(uint256 value)"]);
|
|
1068
|
+
function findCurvePool(curve, poolRef) {
|
|
1069
|
+
const want = poolRef.trim().toLowerCase();
|
|
1070
|
+
const ids = [];
|
|
1071
|
+
try {
|
|
1072
|
+
ids.push(...curve.getPoolList?.() ?? []);
|
|
1073
|
+
} catch {
|
|
1074
|
+
}
|
|
1075
|
+
for (const id of ids) {
|
|
1076
|
+
try {
|
|
1077
|
+
const p = curve.getPool(id);
|
|
1078
|
+
if (!p) continue;
|
|
1079
|
+
if (String(p.id ?? "").toLowerCase() === want) return p;
|
|
1080
|
+
if (String(p.address ?? "").toLowerCase() === want) return p;
|
|
1081
|
+
} catch {
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
throw new Error(
|
|
1085
|
+
`Curve pool ${poolRef} is not in the loaded session. Copy address/id from ctm_curve_dao_fetch_important_pools.`
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
function addLiquidityAbi(n, ng) {
|
|
1089
|
+
if (ng) return parseAbi(["function add_liquidity(uint256[] amounts, uint256 min_mint_amount)"]);
|
|
1090
|
+
if (n === 2) return parseAbi(["function add_liquidity(uint256[2] amounts, uint256 min_mint_amount)"]);
|
|
1091
|
+
if (n === 3) return parseAbi(["function add_liquidity(uint256[3] amounts, uint256 min_mint_amount)"]);
|
|
1092
|
+
if (n === 4) return parseAbi(["function add_liquidity(uint256[4] amounts, uint256 min_mint_amount)"]);
|
|
1093
|
+
return parseAbi(["function add_liquidity(uint256[] amounts, uint256 min_mint_amount)"]);
|
|
1094
|
+
}
|
|
1095
|
+
function removeLiquidityAbi(n, ng) {
|
|
1096
|
+
if (ng) return parseAbi(["function remove_liquidity(uint256 amount, uint256[] min_amounts)"]);
|
|
1097
|
+
if (n === 2) return parseAbi(["function remove_liquidity(uint256 amount, uint256[2] min_amounts)"]);
|
|
1098
|
+
if (n === 3) return parseAbi(["function remove_liquidity(uint256 amount, uint256[3] min_amounts)"]);
|
|
1099
|
+
if (n === 4) return parseAbi(["function remove_liquidity(uint256 amount, uint256[4] min_amounts)"]);
|
|
1100
|
+
return parseAbi(["function remove_liquidity(uint256 amount, uint256[] min_amounts)"]);
|
|
1101
|
+
}
|
|
1102
|
+
function applySlippage(expected, slipPercent) {
|
|
1103
|
+
const bps = BigInt(Math.round((1 - slipPercent / 100) * 1e4));
|
|
1104
|
+
return expected * bps / 10000n;
|
|
1105
|
+
}
|
|
1106
|
+
function publicClient(rpcUrl, chainId) {
|
|
1107
|
+
const ch = defineChain({
|
|
1108
|
+
id: chainId,
|
|
1109
|
+
name: "CurveLp",
|
|
1110
|
+
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
1111
|
+
rpcUrls: { default: { http: [rpcUrl] } }
|
|
1112
|
+
});
|
|
1113
|
+
return createPublicClient({ chain: ch, transport: http(rpcUrl) });
|
|
1114
|
+
}
|
|
1115
|
+
function isNativeCoin(addr) {
|
|
1116
|
+
return addr.trim().toLowerCase() === CURVE_NATIVE_PLACEHOLDER.toLowerCase();
|
|
1117
|
+
}
|
|
1118
|
+
async function curveDaoQuoteAddLiquidity(args) {
|
|
1119
|
+
const session = await loadFullCurveSessionForRpc(args.rpcUrl);
|
|
1120
|
+
const pool = findCurvePool(session.curve, args.pool);
|
|
1121
|
+
const coins = pool.underlyingCoins ?? pool.wrappedCoins ?? [];
|
|
1122
|
+
if (args.amountsHuman.length !== coins.length) {
|
|
1123
|
+
throw new Error(`Expected ${coins.length} amounts (coins: ${coins.join(", ")}).`);
|
|
1124
|
+
}
|
|
1125
|
+
const expected = await pool.depositExpected(args.amountsHuman);
|
|
1126
|
+
const catalog = await curveDaoFetchImportantPools({ chainId: args.chainId, query: args.pool });
|
|
1127
|
+
const meta = catalog.pools.find(
|
|
1128
|
+
(p) => p.address.toLowerCase() === String(pool.address).toLowerCase() || p.id.toLowerCase() === String(pool.id).toLowerCase()
|
|
1129
|
+
);
|
|
1130
|
+
const gauge = String(pool.gauge?.address ?? meta?.gaugeAddress ?? "");
|
|
1131
|
+
return {
|
|
1132
|
+
pool: getAddress(pool.address),
|
|
1133
|
+
poolId: String(pool.id),
|
|
1134
|
+
name: String(pool.name ?? pool.fullName ?? ""),
|
|
1135
|
+
coins,
|
|
1136
|
+
amountsHuman: args.amountsHuman,
|
|
1137
|
+
expectedLp: expected,
|
|
1138
|
+
gauge: gauge || null,
|
|
1139
|
+
stakeInGauge: Boolean(args.stakeInGauge && gauge),
|
|
1140
|
+
baseApy: meta?.baseApy ?? null,
|
|
1141
|
+
gaugeCrvApy: meta?.gaugeCrvApy ?? null,
|
|
1142
|
+
notes: meta?.gaugeCrvApy ? "gauge_crv_apy requires staking the LP token in the gauge (stakeInGauge or ctm_curve_dao_build_gauge_deposit_multisign)." : "Fee APY only unless this pool advertises gauge_crv_apy."
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
async function curveDaoQuoteRemoveLiquidity(args) {
|
|
1146
|
+
const session = await loadFullCurveSessionForRpc(args.rpcUrl);
|
|
1147
|
+
const pool = findCurvePool(session.curve, args.pool);
|
|
1148
|
+
const coins = pool.underlyingCoins ?? pool.wrappedCoins ?? [];
|
|
1149
|
+
const expected = await pool.withdrawExpected(args.lpAmountHuman);
|
|
1150
|
+
return {
|
|
1151
|
+
pool: getAddress(pool.address),
|
|
1152
|
+
poolId: String(pool.id),
|
|
1153
|
+
coins,
|
|
1154
|
+
lpAmountHuman: args.lpAmountHuman,
|
|
1155
|
+
expectedAmounts: expected,
|
|
1156
|
+
notes: "Balanced remove. Gauge must be unstaked first if LP is in the gauge."
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
async function pushApproves(args) {
|
|
1160
|
+
for (const { token, amount, spender } of args.tokens) {
|
|
1161
|
+
if (amount <= 0n || isNativeCoin(token)) continue;
|
|
1162
|
+
const current = await args.client.readContract({ address: token, abi: erc20AllowanceAbi, functionName: "allowance", args: [args.owner, spender] }).catch(() => 0n);
|
|
1163
|
+
if (current >= amount) continue;
|
|
1164
|
+
if (current > 0n) {
|
|
1165
|
+
args.steps.push({
|
|
1166
|
+
to: token,
|
|
1167
|
+
data: encodeFunctionData({ abi: erc20ApproveAbi, functionName: "approve", args: [spender, 0n] }),
|
|
1168
|
+
value: 0n
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
args.steps.push({
|
|
1172
|
+
to: token,
|
|
1173
|
+
data: encodeFunctionData({ abi: erc20ApproveAbi, functionName: "approve", args: [spender, amount] }),
|
|
1174
|
+
value: 0n
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
async function buildEvmMultisignBodyCurveAddLiquidity(args) {
|
|
1179
|
+
const slip = args.slippagePercent;
|
|
1180
|
+
if (!Number.isFinite(slip) || slip <= 0 || slip >= 100) {
|
|
1181
|
+
throw new Error("Slippage must be between 0 and 100 (exclusive).");
|
|
1182
|
+
}
|
|
1183
|
+
const session = await loadFullCurveSessionForRpc(args.rpcUrl);
|
|
1184
|
+
const pool = findCurvePool(session.curve, args.pool);
|
|
1185
|
+
const coins = pool.underlyingCoinAddresses ?? pool.wrappedCoinAddresses ?? [];
|
|
1186
|
+
const decimals = pool.underlyingDecimals ?? pool.wrappedDecimals ?? coins.map(() => 18);
|
|
1187
|
+
if (args.amountsHuman.length !== coins.length) {
|
|
1188
|
+
throw new Error(`Expected ${coins.length} amounts.`);
|
|
1189
|
+
}
|
|
1190
|
+
const amounts = args.amountsHuman.map((h, i) => parseUnits(h.trim() || "0", decimals[i] ?? 18));
|
|
1191
|
+
const expectedHuman = await pool.depositExpected(args.amountsHuman);
|
|
1192
|
+
const expectedLp = parseUnits(expectedHuman, 18);
|
|
1193
|
+
const minMint = applySlippage(expectedLp, slip);
|
|
1194
|
+
const ng = Boolean(pool.isNg);
|
|
1195
|
+
const abi = addLiquidityAbi(coins.length, ng);
|
|
1196
|
+
const amountsArg = ng ? amounts : amounts;
|
|
1197
|
+
const data = encodeFunctionData({
|
|
1198
|
+
abi,
|
|
1199
|
+
functionName: "add_liquidity",
|
|
1200
|
+
args: [amountsArg, minMint]
|
|
1201
|
+
});
|
|
1202
|
+
const poolAddr = getAddress(pool.address);
|
|
1203
|
+
const executor = getAddress(args.executorAddress);
|
|
1204
|
+
const client = publicClient(args.rpcUrl, args.chainId);
|
|
1205
|
+
const steps = [];
|
|
1206
|
+
await pushApproves({
|
|
1207
|
+
client,
|
|
1208
|
+
steps,
|
|
1209
|
+
owner: executor,
|
|
1210
|
+
tokens: coins.map((c, i) => ({
|
|
1211
|
+
token: isNativeCoin(c) ? CURVE_NATIVE_PLACEHOLDER : getAddress(c),
|
|
1212
|
+
amount: amounts[i],
|
|
1213
|
+
spender: poolAddr
|
|
1214
|
+
}))
|
|
1215
|
+
});
|
|
1216
|
+
const value = coins.reduce((acc, c, i) => isNativeCoin(c) ? acc + amounts[i] : acc, 0n);
|
|
1217
|
+
steps.push({ to: poolAddr, data, value });
|
|
1218
|
+
if (args.stakeInGauge) {
|
|
1219
|
+
const gaugeAddr = String(pool.gauge?.address ?? "").trim();
|
|
1220
|
+
if (!gaugeAddr || gaugeAddr.toLowerCase() === "0x0000000000000000000000000000000000000000") {
|
|
1221
|
+
throw new Error("This pool has no gauge. Fee APY only \u2014 omit stakeInGauge.");
|
|
1222
|
+
}
|
|
1223
|
+
const lp = getAddress(pool.lpToken || pool.address);
|
|
1224
|
+
await pushApproves({
|
|
1225
|
+
client,
|
|
1226
|
+
steps,
|
|
1227
|
+
owner: executor,
|
|
1228
|
+
tokens: [{ token: lp, amount: expectedLp, spender: getAddress(gaugeAddr) }]
|
|
1229
|
+
});
|
|
1230
|
+
steps.push({
|
|
1231
|
+
to: getAddress(gaugeAddr),
|
|
1232
|
+
data: encodeFunctionData({ abi: gaugeAbi, functionName: "deposit", args: [expectedLp] }),
|
|
1233
|
+
value: 0n
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
return finishCurveLpBatch({
|
|
1237
|
+
args,
|
|
1238
|
+
executor,
|
|
1239
|
+
steps,
|
|
1240
|
+
purposeSuffix: args.stakeInGauge ? "Curve LP: approve + add_liquidity + gauge.deposit" : "Curve LP: approve + add_liquidity",
|
|
1241
|
+
evmType: "curve_dao_add_liquidity"
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
async function buildEvmMultisignBodyCurveRemoveLiquidity(args) {
|
|
1245
|
+
const slip = args.slippagePercent;
|
|
1246
|
+
if (!Number.isFinite(slip) || slip <= 0 || slip >= 100) {
|
|
1247
|
+
throw new Error("Slippage must be between 0 and 100 (exclusive).");
|
|
1248
|
+
}
|
|
1249
|
+
const session = await loadFullCurveSessionForRpc(args.rpcUrl);
|
|
1250
|
+
const pool = findCurvePool(session.curve, args.pool);
|
|
1251
|
+
const coins = pool.underlyingCoinAddresses ?? pool.wrappedCoinAddresses ?? [];
|
|
1252
|
+
const expected = await pool.withdrawExpected(args.lpAmountHuman);
|
|
1253
|
+
const decimals = pool.underlyingDecimals ?? pool.wrappedDecimals ?? coins.map(() => 18);
|
|
1254
|
+
const minAmounts = expected.map((h, i) => applySlippage(parseUnits(h || "0", decimals[i] ?? 18), slip));
|
|
1255
|
+
const lpAmount = parseUnits(args.lpAmountHuman, 18);
|
|
1256
|
+
const ng = Boolean(pool.isNg);
|
|
1257
|
+
const abi = removeLiquidityAbi(coins.length, ng);
|
|
1258
|
+
const minArg = ng ? minAmounts : minAmounts;
|
|
1259
|
+
const data = encodeFunctionData({
|
|
1260
|
+
abi,
|
|
1261
|
+
functionName: "remove_liquidity",
|
|
1262
|
+
args: [lpAmount, minArg]
|
|
1263
|
+
});
|
|
1264
|
+
const poolAddr = getAddress(pool.address);
|
|
1265
|
+
const lp = getAddress(pool.lpToken || pool.address);
|
|
1266
|
+
const executor = getAddress(args.executorAddress);
|
|
1267
|
+
const client = publicClient(args.rpcUrl, args.chainId);
|
|
1268
|
+
const steps = [];
|
|
1269
|
+
await pushApproves({
|
|
1270
|
+
client,
|
|
1271
|
+
steps,
|
|
1272
|
+
owner: executor,
|
|
1273
|
+
tokens: [{ token: lp, amount: lpAmount, spender: poolAddr }]
|
|
1274
|
+
});
|
|
1275
|
+
steps.push({ to: poolAddr, data, value: 0n });
|
|
1276
|
+
return finishCurveLpBatch({
|
|
1277
|
+
args,
|
|
1278
|
+
executor,
|
|
1279
|
+
steps,
|
|
1280
|
+
purposeSuffix: "Curve LP: approve + remove_liquidity",
|
|
1281
|
+
evmType: "curve_dao_remove_liquidity"
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
async function buildEvmMultisignBodyCurveGaugeDeposit(args) {
|
|
1285
|
+
const session = await loadFullCurveSessionForRpc(args.rpcUrl);
|
|
1286
|
+
const pool = findCurvePool(session.curve, args.pool);
|
|
1287
|
+
const gaugeAddr = String(pool.gauge?.address ?? "").trim();
|
|
1288
|
+
if (!gaugeAddr || gaugeAddr.toLowerCase() === "0x0000000000000000000000000000000000000000") {
|
|
1289
|
+
throw new Error("This pool has no gauge.");
|
|
1290
|
+
}
|
|
1291
|
+
const lpAmount = parseUnits(args.lpAmountHuman, 18);
|
|
1292
|
+
const executor = getAddress(args.executorAddress);
|
|
1293
|
+
const lp = getAddress(pool.lpToken || pool.address);
|
|
1294
|
+
const client = publicClient(args.rpcUrl, args.chainId);
|
|
1295
|
+
const steps = [];
|
|
1296
|
+
if (!args.withdraw) {
|
|
1297
|
+
await pushApproves({
|
|
1298
|
+
client,
|
|
1299
|
+
steps,
|
|
1300
|
+
owner: executor,
|
|
1301
|
+
tokens: [{ token: lp, amount: lpAmount, spender: getAddress(gaugeAddr) }]
|
|
1302
|
+
});
|
|
1303
|
+
steps.push({
|
|
1304
|
+
to: getAddress(gaugeAddr),
|
|
1305
|
+
data: encodeFunctionData({ abi: gaugeAbi, functionName: "deposit", args: [lpAmount] }),
|
|
1306
|
+
value: 0n
|
|
1307
|
+
});
|
|
1308
|
+
} else {
|
|
1309
|
+
steps.push({
|
|
1310
|
+
to: getAddress(gaugeAddr),
|
|
1311
|
+
data: encodeFunctionData({ abi: gaugeAbi, functionName: "withdraw", args: [lpAmount] }),
|
|
1312
|
+
value: 0n
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
return finishCurveLpBatch({
|
|
1316
|
+
args,
|
|
1317
|
+
executor,
|
|
1318
|
+
steps,
|
|
1319
|
+
purposeSuffix: args.withdraw ? "Curve LP: gauge.withdraw" : "Curve LP: approve + gauge.deposit",
|
|
1320
|
+
evmType: args.withdraw ? "curve_dao_gauge_withdraw" : "curve_dao_gauge_deposit"
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
function finishCurveLpBatch(opts) {
|
|
1324
|
+
const first = opts.steps[0];
|
|
1325
|
+
if (!first) throw new Error("No Curve LP transaction steps.");
|
|
1326
|
+
const firstDataNo0x = first.data.startsWith("0x") ? first.data.slice(2) : first.data;
|
|
1327
|
+
const payableValueWei = opts.steps.reduce((a, s) => a + (s.value ?? 0n), 0n);
|
|
1328
|
+
return buildEvmMultisignBatch({
|
|
1329
|
+
context: {
|
|
1330
|
+
chainCategory: "evm",
|
|
1331
|
+
keyGen: opts.args.keyGen,
|
|
1332
|
+
purposeText: opts.args.purposeText,
|
|
1333
|
+
chainId: opts.args.chainId,
|
|
1334
|
+
rpcUrl: opts.args.rpcUrl,
|
|
1335
|
+
executorAddress: opts.executor,
|
|
1336
|
+
chainDetail: opts.args.chainDetail,
|
|
1337
|
+
useCustomGas: opts.args.useCustomGas,
|
|
1338
|
+
customGasChainDetails: opts.args.customGasChainDetails
|
|
1339
|
+
},
|
|
1340
|
+
steps: opts.steps,
|
|
1341
|
+
purposeSuffix: opts.purposeSuffix,
|
|
1342
|
+
firstMsgRawNo0x: firstDataNo0x,
|
|
1343
|
+
destinationAddress: first.to,
|
|
1344
|
+
payableValueWei: payableValueWei > 0n ? payableValueWei : void 0,
|
|
1345
|
+
buildBatchMeta: ({ step }) => ({
|
|
1346
|
+
signatureText: JSON.stringify({
|
|
1347
|
+
kind: "CurveDao",
|
|
1348
|
+
name: opts.evmType,
|
|
1349
|
+
to: step.to
|
|
1350
|
+
}),
|
|
1351
|
+
evm: { type: opts.evmType, version: 1, chainId: String(opts.args.chainId) }
|
|
1352
|
+
})
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
|
|
951
1356
|
// src/protocols/evm/curve-dao/index.ts
|
|
952
1357
|
var CURVE_DAO_PROTOCOL_ID = "curve-dao";
|
|
953
1358
|
var curveDaoProtocolModule = {
|
|
@@ -987,6 +1392,22 @@ var curveDaoProtocolModule = {
|
|
|
987
1392
|
amountHuman: { type: "string", required: true, description: "Human-readable input amount" },
|
|
988
1393
|
slippagePercent: { type: "number", required: true, description: "Slippage percent (0\u2013100 exclusive)" }
|
|
989
1394
|
}
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
id: "curve-dao.add-liquidity",
|
|
1398
|
+
protocolId: CURVE_DAO_PROTOCOL_ID,
|
|
1399
|
+
chainCategory: "evm",
|
|
1400
|
+
description: "Add liquidity to an important Curve pool (optional gauge stake)",
|
|
1401
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1402
|
+
params: {}
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
id: "curve-dao.remove-liquidity",
|
|
1406
|
+
protocolId: CURVE_DAO_PROTOCOL_ID,
|
|
1407
|
+
chainCategory: "evm",
|
|
1408
|
+
description: "Remove liquidity from an important Curve pool",
|
|
1409
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
1410
|
+
params: {}
|
|
990
1411
|
}
|
|
991
1412
|
]
|
|
992
1413
|
};
|
|
@@ -997,6 +1418,6 @@ var curveDao = {
|
|
|
997
1418
|
loadSession: loadFullCurveSessionForRpc
|
|
998
1419
|
};
|
|
999
1420
|
|
|
1000
|
-
export { CURVE_DAO_PROTOCOL_ID, CURVE_NATIVE_PLACEHOLDER, CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS, addNativeWethBridge, bfsCurveSwapDestinations, buildCurveDaoPurposePrefill, buildCurveLiquidityGraphFromApi, buildEvmMultisignBodyCurveDaoBatch, computeCurveExecutionSlippagePercent, curveDao, curveDaoProtocolModule, curveDaoQuote, curveProbeInAmountString, fetchAllCurvePools, fetchCurveCoinsDataForRpc, formatCurveExchangeLine, formatCurvePriceImpact, formatMinOutAtUserSlippage, isCurveApiChainSupported, isCurveApiChainSupported as isCurveDaoChainSupported, isCurveDaoErc20ApproveEvmSignRequest, isCurveDaoSwapEvmSignRequest, isCurveTokenKeySwappable, loadCurveSessionSnapshotForRpc, loadFullCurveSessionForRpc, normalizeCurveRouterAmountString, resolveCurveDaoRouterGasUnitsFromSignRequest, swappableCurveGraphNodeKeys, toCurveRouterTokenId, toCurveTokenKey };
|
|
1421
|
+
export { CURVE_DAO_PROTOCOL_ID, CURVE_IMPORTANT_POOL_CAP, CURVE_NATIVE_PLACEHOLDER, CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS, addNativeWethBridge, bfsCurveSwapDestinations, buildCurveDaoPurposePrefill, buildCurveLiquidityGraphFromApi, buildEvmMultisignBodyCurveAddLiquidity, buildEvmMultisignBodyCurveDaoBatch, buildEvmMultisignBodyCurveGaugeDeposit, buildEvmMultisignBodyCurveRemoveLiquidity, computeCurveExecutionSlippagePercent, curveDao, curveDaoFetchImportantPools, curveDaoFetchLpYields, curveDaoProtocolModule, curveDaoQuote, curveDaoQuoteAddLiquidity, curveDaoQuoteRemoveLiquidity, curveProbeInAmountString, fetchAllCurvePools, fetchCurveCoinsDataForRpc, formatCurveExchangeLine, formatCurvePriceImpact, formatMinOutAtUserSlippage, isCurveApiChainSupported, isCurveApiChainSupported as isCurveDaoChainSupported, isCurveDaoErc20ApproveEvmSignRequest, isCurveDaoSwapEvmSignRequest, isCurveTokenKeySwappable, loadCurveSessionSnapshotForRpc, loadFullCurveSessionForRpc, normalizeCurveRouterAmountString, resolveCurveDaoRouterGasUnitsFromSignRequest, swappableCurveGraphNodeKeys, toCurveRouterTokenId, toCurveTokenKey };
|
|
1001
1422
|
//# sourceMappingURL=index.js.map
|
|
1002
1423
|
//# sourceMappingURL=index.js.map
|