@curvefi/api 2.31.0 → 2.32.0
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/lib/boosting.js +137 -402
- package/lib/constants/abis/stable_calc.json +151 -0
- package/lib/constants/abis/wbeth/swap.json +1086 -0
- package/lib/constants/aliases.d.ts +11 -11
- package/lib/constants/aliases.js +23 -15
- package/lib/constants/coins/arbitrum.js +6 -9
- package/lib/constants/coins/aurora.js +6 -9
- package/lib/constants/coins/avalanche.js +7 -10
- package/lib/constants/coins/celo.js +6 -9
- package/lib/constants/coins/ethereum.js +10 -13
- package/lib/constants/coins/fantom.js +8 -11
- package/lib/constants/coins/kava.js +6 -9
- package/lib/constants/coins/moonbeam.js +6 -9
- package/lib/constants/coins/optimism.js +6 -9
- package/lib/constants/coins/polygon.js +7 -10
- package/lib/constants/coins/xdai.js +6 -9
- package/lib/constants/pools/arbitrum.d.ts +2 -4
- package/lib/constants/pools/arbitrum.js +22 -28
- package/lib/constants/pools/aurora.d.ts +2 -4
- package/lib/constants/pools/aurora.js +6 -12
- package/lib/constants/pools/avalanche.d.ts +2 -4
- package/lib/constants/pools/avalanche.js +21 -27
- package/lib/constants/pools/celo.d.ts +2 -4
- package/lib/constants/pools/celo.js +2 -5
- package/lib/constants/pools/ethereum.js +272 -253
- package/lib/constants/pools/fantom.d.ts +2 -4
- package/lib/constants/pools/fantom.js +28 -34
- package/lib/constants/pools/index.d.ts +11 -11
- package/lib/constants/pools/index.js +12 -25
- package/lib/constants/pools/kava.d.ts +2 -4
- package/lib/constants/pools/kava.js +2 -5
- package/lib/constants/pools/moonbeam.d.ts +2 -4
- package/lib/constants/pools/moonbeam.js +6 -12
- package/lib/constants/pools/optimism.d.ts +2 -4
- package/lib/constants/pools/optimism.js +9 -15
- package/lib/constants/pools/polygon.d.ts +2 -4
- package/lib/constants/pools/polygon.js +22 -28
- package/lib/constants/pools/xdai.d.ts +2 -4
- package/lib/constants/pools/xdai.js +24 -30
- package/lib/constants/utils.d.ts +1 -1
- package/lib/constants/utils.js +20 -29
- package/lib/curve.d.ts +9 -7
- package/lib/curve.js +399 -615
- package/lib/external-api.d.ts +1 -1
- package/lib/external-api.js +47 -140
- package/lib/factory/common.js +6 -10
- package/lib/factory/constants-crypto.js +48 -54
- package/lib/factory/constants.js +274 -280
- package/lib/factory/deploy.d.ts +8 -8
- package/lib/factory/deploy.js +177 -347
- package/lib/factory/factory-api.js +195 -278
- package/lib/factory/factory-crypto.js +170 -323
- package/lib/factory/factory.js +195 -350
- package/lib/index.d.ts +24 -25
- package/lib/index.js +87 -143
- package/lib/interfaces.d.ts +6 -11
- package/lib/interfaces.js +1 -2
- package/lib/pools/PoolTemplate.js +1478 -2931
- package/lib/pools/index.d.ts +2 -2
- package/lib/pools/index.js +3 -7
- package/lib/pools/mixins/common.d.ts +3 -4
- package/lib/pools/mixins/common.js +23 -112
- package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +1 -1
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +50 -139
- package/lib/pools/mixins/depositMixins.d.ts +1 -1
- package/lib/pools/mixins/depositMixins.js +144 -417
- package/lib/pools/mixins/depositWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/depositWrappedMixins.js +72 -227
- package/lib/pools/mixins/poolBalancesMixin.d.ts +1 -1
- package/lib/pools/mixins/poolBalancesMixin.js +25 -105
- package/lib/pools/mixins/swapMixins.d.ts +1 -1
- package/lib/pools/mixins/swapMixins.js +127 -353
- package/lib/pools/mixins/swapWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/swapWrappedMixins.js +90 -276
- package/lib/pools/mixins/withdrawExpectedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawExpectedMixins.js +26 -110
- package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawImbalanceMixins.js +99 -321
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +53 -192
- package/lib/pools/mixins/withdrawMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawMixins.js +123 -390
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +17 -92
- package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinMixins.js +124 -390
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +9 -66
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +55 -190
- package/lib/pools/mixins/withdrawWrappedMixins.d.ts +1 -1
- package/lib/pools/mixins/withdrawWrappedMixins.js +52 -191
- package/lib/pools/poolConstructor.d.ts +1 -1
- package/lib/pools/poolConstructor.js +77 -101
- package/lib/pools/utils.js +299 -500
- package/lib/router.d.ts +2 -2
- package/lib/router.js +221 -689
- package/lib/utils.d.ts +9 -9
- package/lib/utils.js +377 -731
- package/package.json +9 -8
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ethers } from "ethers";
|
|
2
|
-
import {
|
|
3
|
-
import { PoolTemplate } from "./pools";
|
|
1
|
+
import { ethers, Networkish } from "ethers";
|
|
2
|
+
import { PoolTemplate } from "./pools/index.js";
|
|
4
3
|
declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy', providerSettings: {
|
|
5
4
|
url?: string;
|
|
6
5
|
privateKey?: string;
|
|
7
6
|
} | {
|
|
8
|
-
externalProvider: ethers.
|
|
7
|
+
externalProvider: ethers.Eip1193Provider;
|
|
9
8
|
} | {
|
|
10
9
|
network?: Networkish;
|
|
11
10
|
apiKey?: string;
|
|
@@ -39,8 +38,8 @@ declare const curve: {
|
|
|
39
38
|
PoolTemplate: typeof PoolTemplate;
|
|
40
39
|
getPool: (poolId: string) => PoolTemplate;
|
|
41
40
|
getUsdRate: (coin: string) => Promise<number>;
|
|
42
|
-
getTVL: (network?: import("./interfaces").INetworkName | import("./interfaces").IChainId) => Promise<number>;
|
|
43
|
-
getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<string[] | import("./interfaces").IDict<string[]>>;
|
|
41
|
+
getTVL: (network?: import("./interfaces.js").INetworkName | import("./interfaces.js").IChainId) => Promise<number>;
|
|
42
|
+
getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<string[] | import("./interfaces.js").IDict<string[]>>;
|
|
44
43
|
getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
|
|
45
44
|
hasAllowance: (coins: string[], amounts: (string | number)[], address: string, spender: string) => Promise<boolean>;
|
|
46
45
|
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean) => Promise<string[]>;
|
|
@@ -49,7 +48,7 @@ declare const curve: {
|
|
|
49
48
|
symbol: string;
|
|
50
49
|
decimals: number;
|
|
51
50
|
}[]>;
|
|
52
|
-
getVolume: (network?: import("./interfaces").INetworkName | import("./interfaces").IChainId) => Promise<{
|
|
51
|
+
getVolume: (network?: import("./interfaces.js").INetworkName | import("./interfaces.js").IChainId) => Promise<{
|
|
53
52
|
totalVolume: number;
|
|
54
53
|
cryptoVolume: number;
|
|
55
54
|
cryptoShare: number;
|
|
@@ -58,12 +57,12 @@ declare const curve: {
|
|
|
58
57
|
fetchPools: (useApi?: boolean) => Promise<void>;
|
|
59
58
|
fetchNewPools: () => Promise<string[]>;
|
|
60
59
|
getPoolList: () => string[];
|
|
61
|
-
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.
|
|
62
|
-
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<ethers.
|
|
63
|
-
deployGauge: (poolAddress: string) => Promise<ethers.
|
|
64
|
-
getDeployedPlainPoolAddress: (tx: ethers.
|
|
65
|
-
getDeployedMetaPoolAddress: (tx: ethers.
|
|
66
|
-
getDeployedGaugeAddress: (tx: ethers.
|
|
60
|
+
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<ethers.ContractTransactionResponse>;
|
|
61
|
+
deployMetaPool: (basePool: string, name: string, symbol: string, coin: string, A: string | number, fee: string | number, implementationIdx: 0 | 1) => Promise<ethers.ContractTransactionResponse>;
|
|
62
|
+
deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
63
|
+
getDeployedPlainPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
64
|
+
getDeployedMetaPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
65
|
+
getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
67
66
|
fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
|
|
68
67
|
estimateGas: {
|
|
69
68
|
deployPlainPool: (name: string, symbol: string, coins: string[], A: string | number, fee: string | number, assetType: 0 | 1 | 2 | 3, implementationIdx: 0 | 1 | 2 | 3) => Promise<number>;
|
|
@@ -75,11 +74,11 @@ declare const curve: {
|
|
|
75
74
|
fetchPools: (useApi?: boolean) => Promise<void>;
|
|
76
75
|
fetchNewPools: () => Promise<string[]>;
|
|
77
76
|
getPoolList: () => string[];
|
|
78
|
-
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: string | number, initialPrice: string | number) => Promise<ethers.
|
|
79
|
-
deployGauge: (poolAddress: string) => Promise<ethers.
|
|
80
|
-
getDeployed: (tx: ethers.
|
|
81
|
-
getDeployedPoolAddress: (tx: ethers.
|
|
82
|
-
getDeployedGaugeAddress: (tx: ethers.
|
|
77
|
+
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: string | number, initialPrice: string | number) => Promise<ethers.ContractTransactionResponse>;
|
|
78
|
+
deployGauge: (poolAddress: string) => Promise<ethers.ContractTransactionResponse>;
|
|
79
|
+
getDeployed: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
80
|
+
getDeployedPoolAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
81
|
+
getDeployedGaugeAddress: (tx: ethers.ContractTransactionResponse) => Promise<string>;
|
|
83
82
|
fetchRecentlyDeployedPool: (poolAddress: string) => Promise<string>;
|
|
84
83
|
estimateGas: {
|
|
85
84
|
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: string | number, initialPrice: string | number) => Promise<number>;
|
|
@@ -90,16 +89,16 @@ declare const curve: {
|
|
|
90
89
|
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean) => Promise<number>;
|
|
91
90
|
};
|
|
92
91
|
boosting: {
|
|
93
|
-
getCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").IDict<string>>;
|
|
94
|
-
getLockedAmountAndUnlockTime: (...addresses: string[] | string[][]) => Promise<import("./interfaces").IDict<{
|
|
92
|
+
getCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces.js").IDict<string>>;
|
|
93
|
+
getLockedAmountAndUnlockTime: (...addresses: string[] | string[][]) => Promise<import("./interfaces.js").IDict<{
|
|
95
94
|
lockedAmount: string;
|
|
96
95
|
unlockTime: number;
|
|
97
96
|
}> | {
|
|
98
97
|
lockedAmount: string;
|
|
99
98
|
unlockTime: number;
|
|
100
99
|
}>;
|
|
101
|
-
getVeCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").IDict<string>>;
|
|
102
|
-
getVeCrvPct: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").IDict<string>>;
|
|
100
|
+
getVeCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces.js").IDict<string>>;
|
|
101
|
+
getVeCrvPct: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces.js").IDict<string>>;
|
|
103
102
|
calcUnlockTime: (days: number, start?: number) => number;
|
|
104
103
|
isApproved: (amount: string | number) => Promise<boolean>;
|
|
105
104
|
approve: (amount: string | number) => Promise<string[]>;
|
|
@@ -120,15 +119,15 @@ declare const curve: {
|
|
|
120
119
|
};
|
|
121
120
|
router: {
|
|
122
121
|
getBestRouteAndOutput: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<{
|
|
123
|
-
route: import("./interfaces").IRoute;
|
|
122
|
+
route: import("./interfaces.js").IRoute;
|
|
124
123
|
output: string;
|
|
125
124
|
}>;
|
|
126
125
|
expected: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<string>;
|
|
127
126
|
priceImpact: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<number>;
|
|
128
127
|
isApproved: (inputCoin: string, amount: string | number) => Promise<boolean>;
|
|
129
128
|
approve: (inputCoin: string, amount: string | number) => Promise<string[]>;
|
|
130
|
-
swap: (inputCoin: string, outputCoin: string, amount: string | number, slippage?: number) => Promise<ethers.
|
|
131
|
-
getSwappedAmount: (tx: ethers.
|
|
129
|
+
swap: (inputCoin: string, outputCoin: string, amount: string | number, slippage?: number) => Promise<ethers.ContractTransactionResponse>;
|
|
130
|
+
getSwappedAmount: (tx: ethers.ContractTransactionResponse, outputCoin: string) => Promise<string>;
|
|
132
131
|
estimateGas: {
|
|
133
132
|
approve: (inputCoin: string, amount: string | number) => Promise<number>;
|
|
134
133
|
swap: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<number>;
|
package/lib/index.js
CHANGED
|
@@ -1,167 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var pools_1 = require("./pools");
|
|
40
|
-
var utils_1 = require("./pools/utils");
|
|
41
|
-
var router_1 = require("./router");
|
|
42
|
-
var curve_1 = require("./curve");
|
|
43
|
-
var boosting_1 = require("./boosting");
|
|
44
|
-
var utils_2 = require("./utils");
|
|
45
|
-
var deploy_1 = require("./factory/deploy");
|
|
46
|
-
function init(providerType, providerSettings, options) {
|
|
47
|
-
if (options === void 0) { options = {}; }
|
|
48
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
-
return __generator(this, function (_a) {
|
|
50
|
-
switch (_a.label) {
|
|
51
|
-
case 0: return [4 /*yield*/, curve_1.curve.init(providerType, providerSettings, options)];
|
|
52
|
-
case 1:
|
|
53
|
-
_a.sent();
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
this.signerAddress = curve_1.curve.signerAddress;
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
this.chainId = curve_1.curve.chainId;
|
|
58
|
-
return [2 /*return*/];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
1
|
+
import { PoolTemplate, getPool } from "./pools/index.js";
|
|
2
|
+
import { getUserPoolListByLiquidity, getUserPoolListByClaimable, getUserPoolList, getUserLiquidityUSD, getUserClaimable, } from "./pools/utils.js";
|
|
3
|
+
import { getBestRouteAndOutput, swapExpected, swapPriceImpact, swapIsApproved, swapApproveEstimateGas, swapApprove, swapEstimateGas, swap, getSwappedAmount, } from "./router.js";
|
|
4
|
+
import { curve as _curve } from "./curve.js";
|
|
5
|
+
import { getCrv, getLockedAmountAndUnlockTime, getVeCrv, getVeCrvPct, calcUnlockTime, createLockEstimateGas, createLock, isApproved, approveEstimateGas, approve, increaseAmountEstimateGas, increaseAmount, increaseUnlockTimeEstimateGas, increaseUnlockTime, withdrawLockedCrvEstimateGas, withdrawLockedCrv, claimableFees, claimFeesEstimateGas, claimFees, } from "./boosting.js";
|
|
6
|
+
import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getTVL, getCoinsData, getVolume, } from "./utils.js";
|
|
7
|
+
import { deployStablePlainPool, deployStablePlainPoolEstimateGas, deployStableMetaPool, deployStableMetaPoolEstimateGas, deployCryptoPool, deployCryptoPoolEstimateGas, deployGauge, deployGaugeEstimateGas, getDeployedStablePlainPoolAddress, getDeployedStableMetaPoolAddress, getDeployedCryptoPoolAddress, getDeployedGaugeAddress, } from './factory/deploy.js';
|
|
8
|
+
async function init(providerType, providerSettings, options = {}) {
|
|
9
|
+
await _curve.init(providerType, providerSettings, options);
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
this.signerAddress = _curve.signerAddress;
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
this.chainId = _curve.chainId;
|
|
62
14
|
}
|
|
63
15
|
function setCustomFeeData(customFeeData) {
|
|
64
|
-
|
|
16
|
+
_curve.setCustomFeeData(customFeeData);
|
|
65
17
|
}
|
|
66
|
-
|
|
67
|
-
init
|
|
18
|
+
const curve = {
|
|
19
|
+
init,
|
|
68
20
|
chainId: 0,
|
|
69
21
|
signerAddress: '',
|
|
70
|
-
setCustomFeeData
|
|
71
|
-
getPoolList:
|
|
72
|
-
getUserPoolListByLiquidity
|
|
73
|
-
getUserPoolListByClaimable
|
|
74
|
-
getUserPoolList
|
|
75
|
-
getUserLiquidityUSD
|
|
76
|
-
getUserClaimable
|
|
77
|
-
PoolTemplate
|
|
78
|
-
getPool
|
|
79
|
-
getUsdRate
|
|
80
|
-
getTVL
|
|
81
|
-
getBalances
|
|
82
|
-
getAllowance
|
|
83
|
-
hasAllowance
|
|
84
|
-
ensureAllowance
|
|
85
|
-
getCoinsData
|
|
86
|
-
getVolume
|
|
22
|
+
setCustomFeeData,
|
|
23
|
+
getPoolList: _curve.getPoolList,
|
|
24
|
+
getUserPoolListByLiquidity,
|
|
25
|
+
getUserPoolListByClaimable,
|
|
26
|
+
getUserPoolList,
|
|
27
|
+
getUserLiquidityUSD,
|
|
28
|
+
getUserClaimable,
|
|
29
|
+
PoolTemplate,
|
|
30
|
+
getPool,
|
|
31
|
+
getUsdRate,
|
|
32
|
+
getTVL,
|
|
33
|
+
getBalances,
|
|
34
|
+
getAllowance,
|
|
35
|
+
hasAllowance,
|
|
36
|
+
ensureAllowance,
|
|
37
|
+
getCoinsData,
|
|
38
|
+
getVolume,
|
|
87
39
|
factory: {
|
|
88
|
-
fetchPools:
|
|
89
|
-
fetchNewPools:
|
|
90
|
-
getPoolList:
|
|
91
|
-
deployPlainPool:
|
|
92
|
-
deployMetaPool:
|
|
93
|
-
deployGauge:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
getDeployedGaugeAddress: deploy_1.getDeployedGaugeAddress,
|
|
99
|
-
fetchRecentlyDeployedPool: curve_1.curve.fetchRecentlyDeployedFactoryPool,
|
|
40
|
+
fetchPools: _curve.fetchFactoryPools,
|
|
41
|
+
fetchNewPools: _curve.fetchNewFactoryPools,
|
|
42
|
+
getPoolList: _curve.getFactoryPoolList,
|
|
43
|
+
deployPlainPool: deployStablePlainPool,
|
|
44
|
+
deployMetaPool: deployStableMetaPool,
|
|
45
|
+
deployGauge: async (poolAddress) => deployGauge(poolAddress, false),
|
|
46
|
+
getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
|
|
47
|
+
getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
|
|
48
|
+
getDeployedGaugeAddress: getDeployedGaugeAddress,
|
|
49
|
+
fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedFactoryPool,
|
|
100
50
|
estimateGas: {
|
|
101
|
-
deployPlainPool:
|
|
102
|
-
deployMetaPool:
|
|
103
|
-
deployGauge:
|
|
104
|
-
return [2 /*return*/, (0, deploy_1.deployGaugeEstimateGas)(poolAddress, false)];
|
|
105
|
-
}); }); },
|
|
51
|
+
deployPlainPool: deployStablePlainPoolEstimateGas,
|
|
52
|
+
deployMetaPool: deployStableMetaPoolEstimateGas,
|
|
53
|
+
deployGauge: async (poolAddress) => deployGaugeEstimateGas(poolAddress, false),
|
|
106
54
|
},
|
|
107
55
|
},
|
|
108
56
|
cryptoFactory: {
|
|
109
|
-
fetchPools:
|
|
110
|
-
fetchNewPools:
|
|
111
|
-
getPoolList:
|
|
112
|
-
deployPool:
|
|
113
|
-
deployGauge:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
getDeployedGaugeAddress: deploy_1.getDeployedGaugeAddress,
|
|
119
|
-
fetchRecentlyDeployedPool: curve_1.curve.fetchRecentlyDeployedCryptoFactoryPool,
|
|
57
|
+
fetchPools: _curve.fetchCryptoFactoryPools,
|
|
58
|
+
fetchNewPools: _curve.fetchNewCryptoFactoryPools,
|
|
59
|
+
getPoolList: _curve.getCryptoFactoryPoolList,
|
|
60
|
+
deployPool: deployCryptoPool,
|
|
61
|
+
deployGauge: async (poolAddress) => deployGauge(poolAddress, true),
|
|
62
|
+
getDeployed: getDeployedStablePlainPoolAddress,
|
|
63
|
+
getDeployedPoolAddress: getDeployedCryptoPoolAddress,
|
|
64
|
+
getDeployedGaugeAddress: getDeployedGaugeAddress,
|
|
65
|
+
fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedCryptoFactoryPool,
|
|
120
66
|
estimateGas: {
|
|
121
|
-
deployPool:
|
|
122
|
-
deployGauge:
|
|
123
|
-
return [2 /*return*/, (0, deploy_1.deployGaugeEstimateGas)(poolAddress, true)];
|
|
124
|
-
}); }); },
|
|
67
|
+
deployPool: deployCryptoPoolEstimateGas,
|
|
68
|
+
deployGauge: async (poolAddress) => deployGaugeEstimateGas(poolAddress, true),
|
|
125
69
|
},
|
|
126
70
|
},
|
|
127
71
|
estimateGas: {
|
|
128
|
-
ensureAllowance:
|
|
72
|
+
ensureAllowance: ensureAllowanceEstimateGas,
|
|
129
73
|
},
|
|
130
74
|
boosting: {
|
|
131
|
-
getCrv
|
|
132
|
-
getLockedAmountAndUnlockTime
|
|
133
|
-
getVeCrv
|
|
134
|
-
getVeCrvPct
|
|
135
|
-
calcUnlockTime
|
|
136
|
-
isApproved
|
|
137
|
-
approve
|
|
138
|
-
createLock
|
|
139
|
-
increaseAmount
|
|
140
|
-
increaseUnlockTime
|
|
141
|
-
withdrawLockedCrv
|
|
142
|
-
claimableFees
|
|
143
|
-
claimFees
|
|
75
|
+
getCrv,
|
|
76
|
+
getLockedAmountAndUnlockTime,
|
|
77
|
+
getVeCrv,
|
|
78
|
+
getVeCrvPct,
|
|
79
|
+
calcUnlockTime,
|
|
80
|
+
isApproved,
|
|
81
|
+
approve,
|
|
82
|
+
createLock,
|
|
83
|
+
increaseAmount,
|
|
84
|
+
increaseUnlockTime,
|
|
85
|
+
withdrawLockedCrv,
|
|
86
|
+
claimableFees,
|
|
87
|
+
claimFees,
|
|
144
88
|
estimateGas: {
|
|
145
|
-
approve:
|
|
146
|
-
createLock:
|
|
147
|
-
increaseAmount:
|
|
148
|
-
increaseUnlockTime:
|
|
149
|
-
withdrawLockedCrv:
|
|
150
|
-
claimFees:
|
|
89
|
+
approve: approveEstimateGas,
|
|
90
|
+
createLock: createLockEstimateGas,
|
|
91
|
+
increaseAmount: increaseAmountEstimateGas,
|
|
92
|
+
increaseUnlockTime: increaseUnlockTimeEstimateGas,
|
|
93
|
+
withdrawLockedCrv: withdrawLockedCrvEstimateGas,
|
|
94
|
+
claimFees: claimFeesEstimateGas,
|
|
151
95
|
},
|
|
152
96
|
},
|
|
153
97
|
router: {
|
|
154
|
-
getBestRouteAndOutput
|
|
155
|
-
expected:
|
|
156
|
-
priceImpact:
|
|
157
|
-
isApproved:
|
|
158
|
-
approve:
|
|
159
|
-
swap
|
|
160
|
-
getSwappedAmount
|
|
98
|
+
getBestRouteAndOutput,
|
|
99
|
+
expected: swapExpected,
|
|
100
|
+
priceImpact: swapPriceImpact,
|
|
101
|
+
isApproved: swapIsApproved,
|
|
102
|
+
approve: swapApprove,
|
|
103
|
+
swap,
|
|
104
|
+
getSwappedAmount,
|
|
161
105
|
estimateGas: {
|
|
162
|
-
approve:
|
|
163
|
-
swap:
|
|
106
|
+
approve: swapApproveEstimateGas,
|
|
107
|
+
swap: swapEstimateGas,
|
|
164
108
|
},
|
|
165
109
|
},
|
|
166
110
|
};
|
|
167
|
-
|
|
111
|
+
export default curve;
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface IPoolData {
|
|
|
40
40
|
in_api?: boolean;
|
|
41
41
|
}
|
|
42
42
|
export interface ICurve {
|
|
43
|
-
provider: ethers.
|
|
43
|
+
provider: ethers.BrowserProvider | ethers.JsonRpcProvider;
|
|
44
44
|
multicallProvider: MulticallProvider;
|
|
45
45
|
signer: ethers.Signer | null;
|
|
46
46
|
signerAddress: string;
|
|
@@ -60,9 +60,9 @@ export interface ICurve {
|
|
|
60
60
|
gasLimit: number;
|
|
61
61
|
};
|
|
62
62
|
options: {
|
|
63
|
-
gasPrice?: number |
|
|
64
|
-
maxFeePerGas?: number |
|
|
65
|
-
maxPriorityFeePerGas?: number |
|
|
63
|
+
gasPrice?: number | bigint;
|
|
64
|
+
maxFeePerGas?: number | bigint;
|
|
65
|
+
maxPriorityFeePerGas?: number | bigint;
|
|
66
66
|
};
|
|
67
67
|
constants: {
|
|
68
68
|
NATIVE_TOKEN: {
|
|
@@ -100,7 +100,7 @@ export interface IRewardFromApi {
|
|
|
100
100
|
tokenPrice: number;
|
|
101
101
|
name: string;
|
|
102
102
|
symbol: string;
|
|
103
|
-
decimals: number;
|
|
103
|
+
decimals: number | string;
|
|
104
104
|
apy: number;
|
|
105
105
|
}
|
|
106
106
|
export interface IPoolDataFromApi {
|
|
@@ -142,14 +142,9 @@ export interface IRouteStep {
|
|
|
142
142
|
swapAddress: string;
|
|
143
143
|
}
|
|
144
144
|
export type IRoute = IRouteStep[];
|
|
145
|
-
export interface IRouteTvl {
|
|
146
|
-
route: IRoute;
|
|
147
|
-
minTvl: number;
|
|
148
|
-
totalTvl: number;
|
|
149
|
-
}
|
|
150
145
|
export interface IRouteOutputAndCost {
|
|
151
146
|
route: IRoute;
|
|
152
|
-
_output:
|
|
147
|
+
_output: bigint;
|
|
153
148
|
outputUsd: number;
|
|
154
149
|
txCostUsd: number;
|
|
155
150
|
}
|
package/lib/interfaces.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|