@curvefi/api 2.68.12 → 2.68.13

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/README.md CHANGED
@@ -1919,8 +1919,24 @@ import curve from "@curvefi/api";
1919
1919
  "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
1920
1920
  ];
1921
1921
 
1922
- // Deploy pool
1923
-
1922
+ // Get only UI-available implementations
1923
+ const implementations = curve.twocryptoFactory.getImplementations(true);
1924
+ // [
1925
+ // {
1926
+ // index: 0,
1927
+ // address: '0x934791f7F391727db92BFF94cd789c4623d14c52',
1928
+ // description: '',
1929
+ // availableInUI: true
1930
+ // },
1931
+ // {
1932
+ // index: '110205523814837221872401067839670671012439480455633721548677383351514213591649',
1933
+ // address: '0xD1FAeCA80d6FDd1DF4CBcCe4b2551b6Ee63Ae3D6',
1934
+ // description: 'TwoCrypto (50% DAO fee) — for FX / regular pairs (where donations may stream from within Curve protocol)',
1935
+ // availableInUI: true
1936
+ // }
1937
+ // ]
1938
+
1939
+ // Deploy pool with default implementation (implementations[0].index === 0)
1924
1940
  const deployPoolTx = await curve.twocryptoFactory.deployPool(
1925
1941
  "Test crypto pool",
1926
1942
  "TCP",
@@ -1935,6 +1951,23 @@ import curve from "@curvefi/api";
1935
1951
  600,
1936
1952
  1500
1937
1953
  );
1954
+
1955
+ // OR deploy with FX implementation with 50% DAO fee (implementations[1])
1956
+ // const deployPoolTx = await curve.twocryptoFactory.deployPool(
1957
+ // "Test crypto pool",
1958
+ // "TCP",
1959
+ // coins,
1960
+ // 400000,
1961
+ // 0.0000725,
1962
+ // 0.25,
1963
+ // 0.45,
1964
+ // 0.000002,
1965
+ // 0.00023,
1966
+ // 0.000146,
1967
+ // 600,
1968
+ // 1500,
1969
+ // implementations[1].index
1970
+ // );
1938
1971
  // {
1939
1972
  // hash: '0x406900448e537f2fd5c833a4f62a81305b9567e71f870772e10c72271bd78c37',
1940
1973
  // type: 0,
@@ -0,0 +1,25 @@
1
+ /**
2
+ * TwoCrypto pool implementation configurations https://docs.curve.finance/deployments/implementations/#cryptoswap-ng
3
+ */
4
+ export type TwoCryptoImplementationIndex = number | string;
5
+ /**
6
+ * TwoCrypto implementation indices
7
+ */
8
+ export declare enum TwoCryptoImplementation {
9
+ DEFAULT = 0,
10
+ YB_POOLS_0_PERCENT = "110827960954786879070795645317684308345156454977361180728234664032152099907574",
11
+ FX_25_PERCENT = "13710427451595223911029771732871636196811780523916976014878790826087297352222",
12
+ FX_REGULAR_50_PERCENT = "110205523814837221872401067839670671012439480455633721548677383351514213591649",
13
+ SETTABLE_ADMIN_FEE = "6789"
14
+ }
15
+ /**
16
+ * Implementation metadata
17
+ */
18
+ export interface TwoCryptoImplementationInfo {
19
+ index: TwoCryptoImplementationIndex;
20
+ address: string;
21
+ description: string;
22
+ availableInUI: boolean;
23
+ }
24
+ export declare const TWOCRYPTO_IMPLEMENTATIONS: TwoCryptoImplementationInfo[];
25
+ export declare function getTwoCryptoImplementations(uiOnly?: boolean): TwoCryptoImplementationInfo[];
@@ -0,0 +1,49 @@
1
+ /**
2
+ * TwoCrypto pool implementation configurations https://docs.curve.finance/deployments/implementations/#cryptoswap-ng
3
+ */
4
+ /**
5
+ * TwoCrypto implementation indices
6
+ */
7
+ export var TwoCryptoImplementation;
8
+ (function (TwoCryptoImplementation) {
9
+ TwoCryptoImplementation[TwoCryptoImplementation["DEFAULT"] = 0] = "DEFAULT";
10
+ TwoCryptoImplementation["YB_POOLS_0_PERCENT"] = "110827960954786879070795645317684308345156454977361180728234664032152099907574";
11
+ TwoCryptoImplementation["FX_25_PERCENT"] = "13710427451595223911029771732871636196811780523916976014878790826087297352222";
12
+ TwoCryptoImplementation["FX_REGULAR_50_PERCENT"] = "110205523814837221872401067839670671012439480455633721548677383351514213591649";
13
+ TwoCryptoImplementation["SETTABLE_ADMIN_FEE"] = "6789";
14
+ })(TwoCryptoImplementation || (TwoCryptoImplementation = {}));
15
+ export const TWOCRYPTO_IMPLEMENTATIONS = [
16
+ {
17
+ index: TwoCryptoImplementation.DEFAULT,
18
+ address: "0x934791f7F391727db92BFF94cd789c4623d14c52",
19
+ description: "",
20
+ availableInUI: true,
21
+ },
22
+ {
23
+ index: TwoCryptoImplementation.YB_POOLS_0_PERCENT,
24
+ address: "0x82c251317ede0514302EEE1aD48f838a7A6EcE2F",
25
+ description: "TwoCrypto (0% DAO fee) — for yb pools",
26
+ availableInUI: false,
27
+ },
28
+ {
29
+ index: TwoCryptoImplementation.FX_25_PERCENT,
30
+ address: "0x3B0df55A2c64Ac7A3ada784eEA0898F0FD3cF17e",
31
+ description: "TwoCrypto (25% DAO fee) — for FX where the asset issuer will be the main source of LP and donations",
32
+ availableInUI: false,
33
+ },
34
+ {
35
+ index: TwoCryptoImplementation.FX_REGULAR_50_PERCENT,
36
+ address: "0xD1FAeCA80d6FDd1DF4CBcCe4b2551b6Ee63Ae3D6",
37
+ description: "TwoCrypto (50% DAO fee) — for FX / regular pairs (where donations may stream from within Curve protocol)",
38
+ availableInUI: true,
39
+ },
40
+ {
41
+ index: TwoCryptoImplementation.SETTABLE_ADMIN_FEE,
42
+ address: "0xeC1045809e383811Cc74B3D25219e1607A5f32dC",
43
+ description: "Alternative implementation with settable admin fee for two/tricrypto (default admin fee remains at 50%)",
44
+ availableInUI: false,
45
+ },
46
+ ];
47
+ export function getTwoCryptoImplementations(uiOnly = false) {
48
+ return uiOnly ? TWOCRYPTO_IMPLEMENTATIONS.filter((impl) => impl.availableInUI) : TWOCRYPTO_IMPLEMENTATIONS;
49
+ }
@@ -1,5 +1,6 @@
1
1
  import { ethers } from "ethers";
2
2
  import { Curve } from "../curve.js";
3
+ import { TwoCryptoImplementation } from "../constants/twoCryptoImplementations.js";
3
4
  export declare function deployStablePlainPoolEstimateGas(this: Curve, name: string, symbol: string, coins: string[], A: number | string, fee: number | string, // %
4
5
  assetType: 0 | 1 | 2 | 3, // 0 = USD, 1 = ETH, 2 = BTC, 3 = Other
5
6
  implementationIdx: 0 | 1 | 2 | 3 | 4 | 5, emaTime?: number, // seconds
@@ -45,11 +46,11 @@ export declare function getDeployedCryptoPoolAddress(this: Curve, tx: ethers.Con
45
46
  export declare function deployTwocryptoPoolEstimateGas(this: Curve, name: string, symbol: string, coins: string[], A: number | string, gamma: number | string, midFee: number | string, // %
46
47
  outFee: number | string, // %
47
48
  allowedExtraProfit: number | string, feeGamma: number | string, adjustmentStep: number | string, maHalfTime: number, // Seconds
48
- initialPrice: number | string): Promise<number>;
49
+ initialPrice: number | string, implementationIdx?: TwoCryptoImplementation): Promise<number>;
49
50
  export declare function deployTwocryptoPool(this: Curve, name: string, symbol: string, coins: string[], A: number | string, gamma: number | string, midFee: number | string, // %
50
51
  outFee: number | string, // %
51
52
  allowedExtraProfit: number | string, feeGamma: number | string, adjustmentStep: number | string, maHalfTime: number, // Seconds
52
- initialPrice: number | string): Promise<ethers.ContractTransactionResponse>;
53
+ initialPrice: number | string, implementationIdx?: TwoCryptoImplementation): Promise<ethers.ContractTransactionResponse>;
53
54
  export declare function getDeployedTwocryptoPoolAddress(this: Curve, tx: ethers.ContractTransactionResponse): Promise<string>;
54
55
  export declare function deployTricryptoPoolEstimateGas(this: Curve, name: string, symbol: string, coins: string[], A: number | string, gamma: number | string, midFee: number | string, // %
55
56
  outFee: number | string, // %
@@ -13,6 +13,7 @@ import { getPool } from "../pools/index.js";
13
13
  import { BN, DIGas, getPoolIdBySwapAddress, mulBy1_3, parseUnits, smartNumber } from '../utils.js';
14
14
  import CurveLpTokenV5ABI from "../constants/abis/curve_lp_token_v5.json" with { type: "json" };
15
15
  import Plain2ETHOracleABIABI from "../constants/abis/factory-v2/Plain2ETHOracle.json" with { type: "json" };
16
+ import { TwoCryptoImplementation } from "../constants/twoCryptoImplementations.js";
16
17
  // ------- STABLE PLAIN POOLS -------
17
18
  function _deployStablePlainPool(name, symbol, coins, A, fee, // %
18
19
  assetType, // 0 = USD, 1 = ETH, 2 = BTC, 3 = Other
@@ -389,7 +390,7 @@ export function getDeployedCryptoPoolAddress(tx) {
389
390
  function _deployTwocryptoPool(name, symbol, coins, A, gamma, midFee, // %
390
391
  outFee, // %
391
392
  allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, // Seconds
392
- initialPrice, estimateGas) {
393
+ initialPrice, implementationIdx, estimateGas) {
393
394
  return __awaiter(this, void 0, void 0, function* () {
394
395
  if (name.length > 32)
395
396
  throw Error("Max name length = 32");
@@ -447,28 +448,28 @@ initialPrice, estimateGas) {
447
448
  const _maHalfTime = parseUnits(maHalfTime, 0);
448
449
  const _initialPrice = parseUnits(initialPrice);
449
450
  const contract = this.contracts[this.constants.ALIASES.twocrypto_factory].contract;
450
- const gas = yield contract.deploy_pool.estimateGas(name, symbol, coins, 0, _A, _gamma, _midFee, _outFee, _feeGamma, _allowedExtraProfit, _adjustmentStep, _maHalfTime, _initialPrice, this.constantOptions);
451
+ const gas = yield contract.deploy_pool.estimateGas(name, symbol, coins, implementationIdx, _A, _gamma, _midFee, _outFee, _feeGamma, _allowedExtraProfit, _adjustmentStep, _maHalfTime, _initialPrice, this.constantOptions);
451
452
  if (estimateGas)
452
453
  return smartNumber(gas);
453
454
  const gasLimit = mulBy1_3(DIGas(gas));
454
455
  yield this.updateFeeData();
455
- return yield contract.deploy_pool(name, symbol, coins, 0, _A, _gamma, _midFee, _outFee, _feeGamma, _allowedExtraProfit, _adjustmentStep, _maHalfTime, _initialPrice, Object.assign(Object.assign({}, this.options), { gasLimit }));
456
+ return yield contract.deploy_pool(name, symbol, coins, implementationIdx, _A, _gamma, _midFee, _outFee, _feeGamma, _allowedExtraProfit, _adjustmentStep, _maHalfTime, _initialPrice, Object.assign(Object.assign({}, this.options), { gasLimit }));
456
457
  });
457
458
  }
458
- export function deployTwocryptoPoolEstimateGas(name, symbol, coins, A, gamma, midFee, // %
459
- outFee, // %
460
- allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, // Seconds
461
- initialPrice) {
462
- return __awaiter(this, void 0, void 0, function* () {
463
- return yield _deployTwocryptoPool.call(this, name, symbol, coins, A, gamma, midFee, outFee, allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, initialPrice, true);
459
+ export function deployTwocryptoPoolEstimateGas(name_1, symbol_1, coins_1, A_1, gamma_1, midFee_1, outFee_1, allowedExtraProfit_1, feeGamma_1, adjustmentStep_1, maHalfTime_1, initialPrice_1) {
460
+ return __awaiter(this, arguments, void 0, function* (name, symbol, coins, A, gamma, midFee, // %
461
+ outFee, // %
462
+ allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, // Seconds
463
+ initialPrice, implementationIdx = TwoCryptoImplementation.DEFAULT) {
464
+ return yield _deployTwocryptoPool.call(this, name, symbol, coins, A, gamma, midFee, outFee, allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, initialPrice, implementationIdx, true);
464
465
  });
465
466
  }
466
- export function deployTwocryptoPool(name, symbol, coins, A, gamma, midFee, // %
467
- outFee, // %
468
- allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, // Seconds
469
- initialPrice) {
470
- return __awaiter(this, void 0, void 0, function* () {
471
- return yield _deployTwocryptoPool.call(this, name, symbol, coins, A, gamma, midFee, outFee, allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, initialPrice, false);
467
+ export function deployTwocryptoPool(name_1, symbol_1, coins_1, A_1, gamma_1, midFee_1, outFee_1, allowedExtraProfit_1, feeGamma_1, adjustmentStep_1, maHalfTime_1, initialPrice_1) {
468
+ return __awaiter(this, arguments, void 0, function* (name, symbol, coins, A, gamma, midFee, // %
469
+ outFee, // %
470
+ allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, // Seconds
471
+ initialPrice, implementationIdx = TwoCryptoImplementation.DEFAULT) {
472
+ return yield _deployTwocryptoPool.call(this, name, symbol, coins, A, gamma, midFee, outFee, allowedExtraProfit, feeGamma, adjustmentStep, maHalfTime, initialPrice, implementationIdx, false);
472
473
  });
473
474
  }
474
475
  export function getDeployedTwocryptoPoolAddress(tx) {
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ethers } from "ethers";
2
2
  import { PoolTemplate } from "./pools/index.js";
3
3
  import { deployCryptoPoolEstimateGas, deployTwocryptoPoolEstimateGas } from './factory/deploy.js';
4
+ import { getTwoCryptoImplementations } from './constants/twoCryptoImplementations.js';
4
5
  export declare const createCurve: () => {
5
6
  init: (this: ReturnType<typeof createCurve>, providerType: "JsonRpc" | "Web3" | "Infura" | "Alchemy" | "NoRPC", providerSettings: "NoRPC" | {
6
7
  url?: string;
@@ -145,7 +146,7 @@ export declare const createCurve: () => {
145
146
  fetchPools: (useApi?: boolean) => Promise<void>;
146
147
  fetchNewPools: () => Promise<string[]>;
147
148
  getPoolList: () => string[];
148
- deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: number, initialPrice: string | number) => Promise<ethers.ContractTransactionResponse>;
149
+ deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: number, initialPrice: string | number, implementationIdx?: import("./constants/twoCryptoImplementations.js").TwoCryptoImplementation | undefined) => Promise<ethers.ContractTransactionResponse>;
149
150
  deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
150
151
  deployGaugeSidechain: (poolAddress: string, salt: string) => Promise<ethers.ContractTransactionResponse>;
151
152
  deployGaugeMirror: (chainId: number, salt: string) => Promise<ethers.ContractTransactionResponse>;
@@ -155,6 +156,7 @@ export declare const createCurve: () => {
155
156
  getDeployedGaugeMirrorAddressByTx: (tx: ethers.ContractTransactionResponse) => Promise<string>;
156
157
  fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
157
158
  gaugeImplementation: () => string;
159
+ getImplementations: typeof getTwoCryptoImplementations;
158
160
  estimateGas: {
159
161
  deployPool: typeof deployTwocryptoPoolEstimateGas;
160
162
  deployGauge: (poolAddress: string) => Promise<number>;
@@ -454,7 +456,7 @@ declare const _default: {
454
456
  fetchPools: (useApi?: boolean) => Promise<void>;
455
457
  fetchNewPools: () => Promise<string[]>;
456
458
  getPoolList: () => string[];
457
- deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: number, initialPrice: string | number) => Promise<ethers.ContractTransactionResponse>;
459
+ deployPool: (name: string, symbol: string, coins: string[], A: string | number, gamma: string | number, midFee: string | number, outFee: string | number, allowedExtraProfit: string | number, feeGamma: string | number, adjustmentStep: string | number, maHalfTime: number, initialPrice: string | number, implementationIdx?: import("./constants/twoCryptoImplementations.js").TwoCryptoImplementation | undefined) => Promise<ethers.ContractTransactionResponse>;
458
460
  deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
459
461
  deployGaugeSidechain: (poolAddress: string, salt: string) => Promise<ethers.ContractTransactionResponse>;
460
462
  deployGaugeMirror: (chainId: number, salt: string) => Promise<ethers.ContractTransactionResponse>;
@@ -464,6 +466,7 @@ declare const _default: {
464
466
  getDeployedGaugeMirrorAddressByTx: (tx: ethers.ContractTransactionResponse) => Promise<string>;
465
467
  fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
466
468
  gaugeImplementation: () => string;
469
+ getImplementations: typeof getTwoCryptoImplementations;
467
470
  estimateGas: {
468
471
  deployPool: typeof deployTwocryptoPoolEstimateGas;
469
472
  deployGauge: (poolAddress: string) => Promise<number>;
package/lib/index.js CHANGED
@@ -14,6 +14,7 @@ import { Curve } from "./curve.js";
14
14
  import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, lastEthBlock, getAnycallBalance, topUpAnycall, topUpAnycallEstimateGas, lastBlockSent, blockToSend, sendBlockhash, sendBlockhashEstimateGas, submitProof, submitProofEstimateGas, claimFeesCrvUSDEstimateGas, claimableFeesCrvUSD, claimFeesCrvUSD, calculateVeCrv, } from "./boosting.js";
15
15
  import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL1, getGasPriceFromL2, getGasInfoForL2, getTVL, getCoinsData, getVolume, hasDepositAndStake, hasRouter, getBasePools, getGasPrice, getCurveLiteNetworks, } from "./utils.js";
16
16
  import { deployStablePlainPool, deployStablePlainPoolEstimateGas, getDeployedStablePlainPoolAddress, setOracle, setOracleEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, getDeployedStableMetaPoolAddress, deployCryptoPool, deployCryptoPoolEstimateGas, getDeployedCryptoPoolAddress, deployTricryptoPool, deployTricryptoPoolEstimateGas, getDeployedTricryptoPoolAddress, deployGauge, deployGaugeEstimateGas, getDeployedGaugeAddress, deployGaugeSidechain, deployGaugeSidechainEstimateGas, deployGaugeMirror, deployGaugeMirrorEstimateGas, getDeployedGaugeMirrorAddress, getDeployedGaugeMirrorAddressByTx, deployStableNgPlainPool, deployStableNgPlainPoolEstimateGas, deployStableNgMetaPool, deployStableNgMetaPoolEstimateGas, deployTwocryptoPool, deployTwocryptoPoolEstimateGas, getDeployedTwocryptoPoolAddress, } from './factory/deploy.js';
17
+ import { getTwoCryptoImplementations } from './constants/twoCryptoImplementations.js';
17
18
  import { crvSupplyStats, userCrv, userVeCrv, crvLockIsApproved, crvLockApproveEstimateGas, crvLockApprove, calcCrvUnlockTime, createCrvLockEstimateGas, createCrvLock, increaseCrvLockedAmountEstimateGas, increaseCrvLockedAmount, increaseCrvUnlockTimeEstimateGas, increaseCrvUnlockTime, withdrawLockedCrvEstimateGas as daoWithdrawLockedCrvEstimateGas, withdrawLockedCrv as daoWithdrawLockedCrv, claimableFees as daoClaimableFees, claimFeesEstimateGas as daoClaimFeesEstimateGas, claimFees as daoClaimFees, getVotingGaugeList, userGaugeVotes, voteForGaugeNextTime, voteForGaugeEstimateGas, voteForGauge, getProposalList, getProposal, userProposalVotes, voteForProposalEstimateGas, voteForProposal, executeVote, executeVoteEstimateGas, isCanVoteExecute, } from "./dao.js";
18
19
  export const createCurve = () => {
19
20
  const _curve = new Curve();
@@ -147,6 +148,7 @@ export const createCurve = () => {
147
148
  getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
148
149
  fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTwocryptoFactoryPool.bind(_curve),
149
150
  gaugeImplementation: () => _curve.getGaugeImplementation("factory-twocrypto"),
151
+ getImplementations: getTwoCryptoImplementations,
150
152
  estimateGas: {
151
153
  deployPool: deployTwocryptoPoolEstimateGas, //
152
154
  deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas.call(_curve, poolAddress, _curve.constants.ALIASES.twocrypto_factory); }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.68.12",
3
+ "version": "2.68.13",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",