@curvefi/api 2.66.29 → 2.66.31

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.
Files changed (81) hide show
  1. package/lib/boosting.d.ts +33 -32
  2. package/lib/boosting.js +320 -252
  3. package/lib/cached.d.ts +4 -3
  4. package/lib/cached.js +63 -19
  5. package/lib/constants/utils.d.ts +14 -1
  6. package/lib/constants/utils.js +21 -6
  7. package/lib/curve.d.ts +5 -5
  8. package/lib/curve.js +21 -38
  9. package/lib/dao.d.ts +32 -31
  10. package/lib/dao.js +420 -350
  11. package/lib/external-api.d.ts +1 -1
  12. package/lib/external-api.js +2 -2
  13. package/lib/factory/common.d.ts +2 -1
  14. package/lib/factory/common.js +1 -1
  15. package/lib/factory/deploy.d.ts +46 -45
  16. package/lib/factory/deploy.js +630 -551
  17. package/lib/factory/factory-api.d.ts +3 -2
  18. package/lib/factory/factory-api.js +22 -23
  19. package/lib/factory/factory-crypto.d.ts +1 -1
  20. package/lib/factory/factory-crypto.js +12 -15
  21. package/lib/factory/factory-tricrypto.d.ts +1 -1
  22. package/lib/factory/factory-tricrypto.js +14 -15
  23. package/lib/factory/factory-twocrypto.d.ts +1 -1
  24. package/lib/factory/factory-twocrypto.js +12 -13
  25. package/lib/factory/factory.d.ts +4 -3
  26. package/lib/factory/factory.js +21 -24
  27. package/lib/index.d.ts +413 -104
  28. package/lib/index.js +253 -257
  29. package/lib/interfaces.d.ts +2 -0
  30. package/lib/pools/PoolTemplate.d.ts +13 -12
  31. package/lib/pools/PoolTemplate.js +279 -285
  32. package/lib/pools/mixins/common.js +2 -2
  33. package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +12 -4
  34. package/lib/pools/mixins/depositBalancedAmountsMixins.js +1 -15
  35. package/lib/pools/mixins/depositMixins.d.ts +25 -5
  36. package/lib/pools/mixins/depositMixins.js +38 -76
  37. package/lib/pools/mixins/depositWrappedMixins.d.ts +10 -2
  38. package/lib/pools/mixins/depositWrappedMixins.js +17 -33
  39. package/lib/pools/mixins/poolBalancesMixin.d.ts +6 -2
  40. package/lib/pools/mixins/poolBalancesMixin.js +3 -5
  41. package/lib/pools/mixins/swapMixins.d.ts +20 -4
  42. package/lib/pools/mixins/swapMixins.js +36 -70
  43. package/lib/pools/mixins/swapWrappedMixins.d.ts +19 -4
  44. package/lib/pools/mixins/swapWrappedMixins.js +32 -60
  45. package/lib/pools/mixins/withdrawExpectedMixins.d.ts +12 -4
  46. package/lib/pools/mixins/withdrawExpectedMixins.js +6 -11
  47. package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +20 -4
  48. package/lib/pools/mixins/withdrawImbalanceMixins.js +26 -53
  49. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +10 -2
  50. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +12 -27
  51. package/lib/pools/mixins/withdrawMixins.d.ts +25 -5
  52. package/lib/pools/mixins/withdrawMixins.js +33 -67
  53. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +12 -4
  54. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +8 -13
  55. package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +25 -5
  56. package/lib/pools/mixins/withdrawOneCoinMixins.js +32 -66
  57. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +6 -2
  58. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +4 -7
  59. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +10 -2
  60. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +13 -29
  61. package/lib/pools/mixins/withdrawWrappedMixins.d.ts +10 -2
  62. package/lib/pools/mixins/withdrawWrappedMixins.js +14 -28
  63. package/lib/pools/poolConstructor.d.ts +2 -1
  64. package/lib/pools/poolConstructor.js +27 -28
  65. package/lib/pools/subClasses/corePool.d.ts +4 -1
  66. package/lib/pools/subClasses/corePool.js +5 -7
  67. package/lib/pools/subClasses/gaugePool.d.ts +5 -3
  68. package/lib/pools/subClasses/gaugePool.js +19 -18
  69. package/lib/pools/subClasses/statsPool.d.ts +2 -0
  70. package/lib/pools/subClasses/statsPool.js +22 -10
  71. package/lib/pools/subClasses/walletPool.d.ts +2 -1
  72. package/lib/pools/subClasses/walletPool.js +6 -6
  73. package/lib/pools/utils.d.ts +7 -6
  74. package/lib/pools/utils.js +316 -297
  75. package/lib/route-graph.worker.d.ts +2 -2
  76. package/lib/route-graph.worker.js +4 -6
  77. package/lib/router.d.ts +12 -11
  78. package/lib/router.js +331 -295
  79. package/lib/utils.d.ts +34 -33
  80. package/lib/utils.js +481 -435
  81. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -10,280 +10,276 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { PoolTemplate, getPool } from "./pools/index.js";
11
11
  import { getUserPoolListByLiquidity, getUserPoolListByClaimable, getUserPoolList, getUserLiquidityUSD, getUserClaimable, } from "./pools/utils.js";
12
12
  import { getBestRouteAndOutput, getArgs, swapExpected, swapRequired, swapPriceImpact, swapIsApproved, swapApproveEstimateGas, swapApprove, swapEstimateGas, swap, getSwappedAmount, } from "./router.js";
13
- import { curve as _curve } from "./curve.js";
13
+ 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
17
  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
- function init(providerType_1, providerSettings_1) {
19
- return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {}) {
20
- yield _curve.init(providerType, providerSettings, options);
21
- // @ts-ignore
22
- this.signerAddress = _curve.signerAddress;
23
- // @ts-ignore
24
- this.chainId = _curve.chainId;
25
- // @ts-ignore
26
- this.isNoRPC = _curve.isNoRPC;
27
- });
28
- }
29
- function setCustomFeeData(customFeeData) {
30
- _curve.setCustomFeeData(customFeeData);
31
- }
32
- const curve = {
33
- init,
34
- chainId: 0,
35
- signerAddress: '',
36
- setCustomFeeData,
37
- getPoolList: _curve.getPoolList,
38
- getMainPoolList: _curve.getMainPoolList,
39
- getUserPoolListByLiquidity,
40
- getUserPoolListByClaimable,
41
- getUserPoolList,
42
- getUserLiquidityUSD,
43
- getUserClaimable,
44
- PoolTemplate,
45
- getBasePools,
46
- getPool,
47
- getUsdRate,
48
- getGasPriceFromL1,
49
- getGasPriceFromL2,
50
- getGasInfoForL2,
51
- getGasPrice,
52
- getTVL,
53
- getBalances,
54
- getAllowance,
55
- hasAllowance,
56
- ensureAllowance,
57
- getCoinsData,
58
- getVolume,
59
- hasDepositAndStake,
60
- hasRouter,
61
- getCurveLiteNetworks,
62
- getNetworkConstants: _curve.getNetworkConstants,
63
- getIsLiteChain: _curve.getIsLiteChain,
64
- isNoRPC: _curve.isNoRPC,
65
- factory: {
66
- fetchPools: _curve.fetchFactoryPools,
67
- fetchNewPools: _curve.fetchNewFactoryPools,
68
- getPoolList: _curve.getFactoryPoolList,
69
- deployPlainPool: deployStablePlainPool,
70
- setOracle,
71
- deployMetaPool: deployStableMetaPool,
72
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge(poolAddress, _curve.constants.ALIASES.factory); }),
73
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain(poolAddress, salt); }),
74
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror(chainId, salt); }),
75
- getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
76
- getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
77
- getDeployedGaugeAddress: getDeployedGaugeAddress,
78
- getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
79
- getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
80
- fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedFactoryPool,
81
- gaugeImplementation: () => _curve.getGaugeImplementation("factory"),
82
- estimateGas: {
83
- deployPlainPool: deployStablePlainPoolEstimateGas,
84
- setOracle: setOracleEstimateGas,
85
- deployMetaPool: deployStableMetaPoolEstimateGas,
86
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas(poolAddress, _curve.constants.ALIASES.factory); }),
87
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas(poolAddress, salt); }),
88
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas(chainId, salt); }),
18
+ export const createCurve = () => {
19
+ const _curve = new Curve();
20
+ function init(...params) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ yield _curve.init(...params);
23
+ this.signerAddress = _curve.signerAddress;
24
+ this.chainId = _curve.chainId;
25
+ this.isNoRPC = _curve.isNoRPC;
26
+ });
27
+ }
28
+ return {
29
+ init,
30
+ chainId: 0, // until init is called
31
+ signerAddress: '',
32
+ setCustomFeeData: _curve.setCustomFeeData.bind(_curve),
33
+ getPoolList: _curve.getPoolList.bind(_curve),
34
+ getMainPoolList: _curve.getMainPoolList.bind(_curve),
35
+ getUserPoolListByLiquidity: getUserPoolListByLiquidity.bind(_curve),
36
+ getUserPoolListByClaimable: getUserPoolListByClaimable.bind(_curve),
37
+ getUserPoolList: getUserPoolList.bind(_curve),
38
+ getUserLiquidityUSD: getUserLiquidityUSD.bind(_curve),
39
+ getUserClaimable: getUserClaimable.bind(_curve),
40
+ PoolTemplate: PoolTemplate.bind(_curve),
41
+ getBasePools: getBasePools.bind(_curve),
42
+ getPool: getPool.bind(_curve),
43
+ getUsdRate: getUsdRate.bind(_curve),
44
+ getGasPriceFromL1: getGasPriceFromL1.bind(_curve),
45
+ getGasPriceFromL2: getGasPriceFromL2.bind(_curve),
46
+ getGasInfoForL2: getGasInfoForL2.bind(_curve),
47
+ getGasPrice: getGasPrice.bind(_curve),
48
+ getTVL: getTVL.bind(_curve),
49
+ getBalances: getBalances.bind(_curve),
50
+ getAllowance: getAllowance.bind(_curve),
51
+ hasAllowance: hasAllowance.bind(_curve),
52
+ ensureAllowance: ensureAllowance.bind(_curve),
53
+ getCoinsData: getCoinsData.bind(_curve),
54
+ getVolume: getVolume.bind(_curve),
55
+ hasDepositAndStake: hasDepositAndStake.bind(_curve),
56
+ hasRouter: hasRouter.bind(_curve),
57
+ getCurveLiteNetworks: getCurveLiteNetworks.bind(_curve),
58
+ getNetworkConstants: _curve.getNetworkConstants.bind(_curve),
59
+ getIsLiteChain: _curve.getIsLiteChain.bind(_curve),
60
+ isNoRPC: _curve.isNoRPC,
61
+ factory: {
62
+ fetchPools: _curve.fetchFactoryPools.bind(_curve),
63
+ fetchNewPools: _curve.fetchNewFactoryPools.bind(_curve),
64
+ getPoolList: _curve.getFactoryPoolList.bind(_curve),
65
+ deployPlainPool: deployStablePlainPool.bind(_curve),
66
+ setOracle: setOracle.bind(_curve),
67
+ deployMetaPool: deployStableMetaPool.bind(_curve),
68
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge.call(_curve, poolAddress, _curve.constants.ALIASES.factory); }),
69
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain.call(_curve, poolAddress, salt); }),
70
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror.call(_curve, chainId, salt); }),
71
+ getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress.bind(_curve),
72
+ getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress.bind(_curve),
73
+ getDeployedGaugeAddress: getDeployedGaugeAddress.bind(_curve),
74
+ getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress.bind(_curve),
75
+ getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
76
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedFactoryPool.bind(_curve),
77
+ gaugeImplementation: () => _curve.getGaugeImplementation("factory"),
78
+ estimateGas: {
79
+ deployPlainPool: deployStablePlainPoolEstimateGas.bind(_curve),
80
+ setOracle: setOracleEstimateGas.bind(_curve),
81
+ deployMetaPool: deployStableMetaPoolEstimateGas.bind(_curve),
82
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas.call(_curve, poolAddress, _curve.constants.ALIASES.factory); }),
83
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas.call(_curve, poolAddress, salt); }),
84
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas.call(_curve, chainId, salt); }),
85
+ },
89
86
  },
90
- },
91
- crvUSDFactory: {
92
- fetchPools: _curve.fetchCrvusdFactoryPools,
93
- getPoolList: _curve.getCrvusdFactoryPoolList,
94
- },
95
- EYWAFactory: {
96
- fetchPools: _curve.fetchEywaFactoryPools,
97
- getPoolList: _curve.getEywaFactoryPoolList,
98
- },
99
- stableNgFactory: {
100
- fetchPools: _curve.fetchStableNgFactoryPools,
101
- fetchNewPools: _curve.fetchNewStableNgFactoryPools,
102
- getPoolList: _curve.getStableNgFactoryPoolList,
103
- deployPlainPool: deployStableNgPlainPool,
104
- deployMetaPool: deployStableNgMetaPool,
105
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge(poolAddress, _curve.constants.ALIASES.stable_ng_factory); }),
106
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain(poolAddress, salt); }),
107
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror(chainId, salt); }),
108
- getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress,
109
- getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress,
110
- getDeployedGaugeAddress: getDeployedGaugeAddress,
111
- getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
112
- getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
113
- fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedStableNgFactoryPool,
114
- estimateGas: {
115
- deployPlainPool: deployStableNgPlainPoolEstimateGas,
116
- deployMetaPool: deployStableNgMetaPoolEstimateGas,
87
+ crvUSDFactory: {
88
+ fetchPools: _curve.fetchCrvusdFactoryPools.bind(_curve),
89
+ getPoolList: _curve.getCrvusdFactoryPoolList.bind(_curve),
117
90
  },
118
- },
119
- cryptoFactory: {
120
- fetchPools: _curve.fetchCryptoFactoryPools,
121
- fetchNewPools: _curve.fetchNewCryptoFactoryPools,
122
- getPoolList: _curve.getCryptoFactoryPoolList,
123
- deployPool: deployCryptoPool,
124
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge(poolAddress, _curve.constants.ALIASES.crypto_factory); }),
125
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain(poolAddress, salt); }),
126
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror(chainId, salt); }),
127
- getDeployedPoolAddress: getDeployedCryptoPoolAddress,
128
- getDeployedGaugeAddress: getDeployedGaugeAddress,
129
- getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
130
- getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
131
- fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedCryptoFactoryPool,
132
- gaugeImplementation: () => _curve.getGaugeImplementation("factory-crypto"),
133
- estimateGas: {
134
- deployPool: deployCryptoPoolEstimateGas,
135
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas(poolAddress, _curve.constants.ALIASES.crypto_factory); }),
136
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas(poolAddress, salt); }),
137
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas(chainId, salt); }),
91
+ EYWAFactory: {
92
+ fetchPools: _curve.fetchEywaFactoryPools.bind(_curve),
93
+ getPoolList: _curve.getEywaFactoryPoolList.bind(_curve),
138
94
  },
139
- },
140
- twocryptoFactory: {
141
- fetchPools: _curve.fetchTworyptoFactoryPools,
142
- fetchNewPools: _curve.fetchNewTwocryptoFactoryPools,
143
- getPoolList: _curve.getTworyptoFactoryPoolList,
144
- deployPool: deployTwocryptoPool,
145
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge(poolAddress, _curve.constants.ALIASES.twocrypto_factory); }),
146
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain(poolAddress, salt); }),
147
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror(chainId, salt); }),
148
- getDeployedPoolAddress: getDeployedTwocryptoPoolAddress,
149
- getDeployedGaugeAddress: getDeployedGaugeAddress,
150
- getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
151
- getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
152
- fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTwocryptoFactoryPool,
153
- gaugeImplementation: () => _curve.getGaugeImplementation("factory-twocrypto"),
154
- estimateGas: {
155
- deployPool: deployTwocryptoPoolEstimateGas, //
156
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas(poolAddress, _curve.constants.ALIASES.twocrypto_factory); }),
157
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas(poolAddress, salt); }),
158
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas(chainId, salt); }),
95
+ stableNgFactory: {
96
+ fetchPools: _curve.fetchStableNgFactoryPools.bind(_curve),
97
+ fetchNewPools: _curve.fetchNewStableNgFactoryPools.bind(_curve),
98
+ getPoolList: _curve.getStableNgFactoryPoolList.bind(_curve),
99
+ deployPlainPool: deployStableNgPlainPool.bind(_curve),
100
+ deployMetaPool: deployStableNgMetaPool.bind(_curve),
101
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge.call(_curve, poolAddress, _curve.constants.ALIASES.stable_ng_factory); }),
102
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain.call(_curve, poolAddress, salt); }),
103
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror.call(_curve, chainId, salt); }),
104
+ getDeployedPlainPoolAddress: getDeployedStablePlainPoolAddress.bind(_curve),
105
+ getDeployedMetaPoolAddress: getDeployedStableMetaPoolAddress.bind(_curve),
106
+ getDeployedGaugeAddress: getDeployedGaugeAddress.bind(_curve),
107
+ getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress.bind(_curve),
108
+ getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
109
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedStableNgFactoryPool.bind(_curve),
110
+ estimateGas: {
111
+ deployPlainPool: deployStableNgPlainPoolEstimateGas.bind(_curve),
112
+ deployMetaPool: deployStableNgMetaPoolEstimateGas.bind(_curve),
113
+ },
159
114
  },
160
- },
161
- tricryptoFactory: {
162
- fetchPools: _curve.fetchTricryptoFactoryPools,
163
- fetchNewPools: _curve.fetchNewTricryptoFactoryPools,
164
- getPoolList: _curve.getTricryptoFactoryPoolList,
165
- deployPool: deployTricryptoPool,
166
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge(poolAddress, _curve.constants.ALIASES.tricrypto_factory); }),
167
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain(poolAddress, salt); }),
168
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror(chainId, salt); }),
169
- getDeployedPoolAddress: getDeployedTricryptoPoolAddress,
170
- getDeployedGaugeAddress: getDeployedGaugeAddress,
171
- getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress,
172
- getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx,
173
- fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTricryptoFactoryPool,
174
- gaugeImplementation: () => _curve.getGaugeImplementation("factory-tricrypto"),
175
- estimateGas: {
176
- deployPool: deployTricryptoPoolEstimateGas,
177
- deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas(poolAddress, _curve.constants.ALIASES.tricrypto_factory); }),
178
- deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas(poolAddress, salt); }),
179
- deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas(chainId, salt); }),
115
+ cryptoFactory: {
116
+ fetchPools: _curve.fetchCryptoFactoryPools.bind(_curve),
117
+ fetchNewPools: _curve.fetchNewCryptoFactoryPools.bind(_curve),
118
+ getPoolList: _curve.getCryptoFactoryPoolList.bind(_curve),
119
+ deployPool: deployCryptoPool.bind(_curve),
120
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge.call(_curve, poolAddress, _curve.constants.ALIASES.crypto_factory); }),
121
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain.call(_curve, poolAddress, salt); }),
122
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror.call(_curve, chainId, salt); }),
123
+ getDeployedPoolAddress: getDeployedCryptoPoolAddress.bind(_curve),
124
+ getDeployedGaugeAddress: getDeployedGaugeAddress.bind(_curve),
125
+ getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress.bind(_curve),
126
+ getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
127
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedCryptoFactoryPool.bind(_curve),
128
+ gaugeImplementation: () => _curve.getGaugeImplementation("factory-crypto"),
129
+ estimateGas: {
130
+ deployPool: deployCryptoPoolEstimateGas,
131
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas.call(_curve, poolAddress, _curve.constants.ALIASES.crypto_factory); }),
132
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas.call(_curve, poolAddress, salt); }),
133
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas.call(_curve, chainId, salt); }),
134
+ },
180
135
  },
181
- },
182
- estimateGas: {
183
- ensureAllowance: ensureAllowanceEstimateGas,
184
- },
185
- boosting: {
186
- getCrv,
187
- getLockedAmountAndUnlockTime,
188
- getVeCrv,
189
- getVeCrvPct,
190
- calcUnlockTime,
191
- isApproved,
192
- approve,
193
- createLock,
194
- increaseAmount,
195
- increaseUnlockTime,
196
- withdrawLockedCrv,
197
- claimableFees,
198
- claimFees,
199
- claimableFeesCrvUSD,
200
- claimFeesCrvUSD,
201
- calculateVeCrv,
202
- estimateGas: {
203
- approve: approveEstimateGas,
204
- createLock: createLockEstimateGas,
205
- increaseAmount: increaseAmountEstimateGas,
206
- increaseUnlockTime: increaseUnlockTimeEstimateGas,
207
- withdrawLockedCrv: withdrawLockedCrvEstimateGas,
208
- claimFees: claimFeesEstimateGas,
209
- claimFeesCrvUSD: claimFeesCrvUSDEstimateGas,
136
+ twocryptoFactory: {
137
+ fetchPools: _curve.fetchTworyptoFactoryPools.bind(_curve),
138
+ fetchNewPools: _curve.fetchNewTwocryptoFactoryPools.bind(_curve),
139
+ getPoolList: _curve.getTworyptoFactoryPoolList.bind(_curve),
140
+ deployPool: deployTwocryptoPool.bind(_curve),
141
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge.call(_curve, poolAddress, _curve.constants.ALIASES.twocrypto_factory); }),
142
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain.call(_curve, poolAddress, salt); }),
143
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror.call(_curve, chainId, salt); }),
144
+ getDeployedPoolAddress: getDeployedTwocryptoPoolAddress.bind(_curve),
145
+ getDeployedGaugeAddress: getDeployedGaugeAddress.bind(_curve),
146
+ getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress.bind(_curve),
147
+ getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
148
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTwocryptoFactoryPool.bind(_curve),
149
+ gaugeImplementation: () => _curve.getGaugeImplementation("factory-twocrypto"),
150
+ estimateGas: {
151
+ deployPool: deployTwocryptoPoolEstimateGas, //
152
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas.call(_curve, poolAddress, _curve.constants.ALIASES.twocrypto_factory); }),
153
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas.call(_curve, poolAddress, salt); }),
154
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas.call(_curve, chainId, salt); }),
155
+ },
210
156
  },
211
- sidechain: {
212
- lastEthBlock,
213
- getAnycallBalance,
214
- topUpAnycall,
215
- lastBlockSent,
216
- blockToSend,
217
- sendBlockhash,
218
- submitProof,
157
+ tricryptoFactory: {
158
+ fetchPools: _curve.fetchTricryptoFactoryPools.bind(_curve),
159
+ fetchNewPools: _curve.fetchNewTricryptoFactoryPools.bind(_curve),
160
+ getPoolList: _curve.getTricryptoFactoryPoolList.bind(_curve),
161
+ deployPool: deployTricryptoPool.bind(_curve),
162
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGauge.call(_curve, poolAddress, _curve.constants.ALIASES.tricrypto_factory); }),
163
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechain.call(_curve, poolAddress, salt); }),
164
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirror.call(_curve, chainId, salt); }),
165
+ getDeployedPoolAddress: getDeployedTricryptoPoolAddress.bind(_curve),
166
+ getDeployedGaugeAddress: getDeployedGaugeAddress.bind(_curve),
167
+ getDeployedGaugeMirrorAddress: getDeployedGaugeMirrorAddress.bind(_curve),
168
+ getDeployedGaugeMirrorAddressByTx: getDeployedGaugeMirrorAddressByTx.bind(_curve),
169
+ fetchRecentlyDeployedPool: _curve.fetchRecentlyDeployedTricryptoFactoryPool.bind(_curve),
170
+ gaugeImplementation: () => _curve.getGaugeImplementation("factory-tricrypto"),
219
171
  estimateGas: {
220
- topUpAnycall: topUpAnycallEstimateGas,
221
- sendBlockhash: sendBlockhashEstimateGas,
222
- submitProof: submitProofEstimateGas,
172
+ deployPool: deployTricryptoPoolEstimateGas.bind(_curve),
173
+ deployGauge: (poolAddress) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeEstimateGas.call(_curve, poolAddress, _curve.constants.ALIASES.tricrypto_factory); }),
174
+ deployGaugeSidechain: (poolAddress, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeSidechainEstimateGas.call(_curve, poolAddress, salt); }),
175
+ deployGaugeMirror: (chainId, salt) => __awaiter(void 0, void 0, void 0, function* () { return deployGaugeMirrorEstimateGas.call(_curve, chainId, salt); }),
223
176
  },
224
177
  },
225
- },
226
- router: {
227
- getBestRouteAndOutput,
228
- getArgs,
229
- expected: swapExpected,
230
- required: swapRequired,
231
- priceImpact: swapPriceImpact,
232
- isApproved: swapIsApproved,
233
- approve: swapApprove,
234
- swap,
235
- getSwappedAmount,
236
178
  estimateGas: {
237
- approve: swapApproveEstimateGas,
238
- swap: swapEstimateGas,
179
+ ensureAllowance: ensureAllowanceEstimateGas.bind(_curve),
239
180
  },
240
- },
241
- dao: {
242
- // --- CRV lock ---
243
- // View methods
244
- crvSupplyStats,
245
- userCrv,
246
- userVeCrv,
247
- crvLockIsApproved,
248
- calcCrvUnlockTime,
249
- claimableFees: daoClaimableFees,
250
- // Transaction methods
251
- crvLockApprove,
252
- createCrvLock,
253
- increaseCrvLockedAmount,
254
- increaseCrvUnlockTime,
255
- withdrawLockedCrv: daoWithdrawLockedCrv,
256
- claimFees: daoClaimFees,
257
- // --- Gauge voting ---
258
- // View methods
259
- getVotingGaugeList,
260
- userGaugeVotes,
261
- voteForGaugeNextTime,
262
- // Transaction methods
263
- voteForGauge,
264
- // --- Proposal voting ---
265
- // View methods
266
- getProposalList,
267
- getProposal,
268
- userProposalVotes,
269
- // Transaction methods
270
- voteForProposal,
271
- executeVote,
272
- isCanVoteExecute,
273
- estimateGas: {
181
+ boosting: {
182
+ getCrv: getCrv.bind(_curve),
183
+ getLockedAmountAndUnlockTime: getLockedAmountAndUnlockTime.bind(_curve),
184
+ getVeCrv: getVeCrv.bind(_curve),
185
+ getVeCrvPct: getVeCrvPct.bind(_curve),
186
+ calcUnlockTime: calcUnlockTime.bind(_curve),
187
+ isApproved: isApproved.bind(_curve),
188
+ approve: approve.bind(_curve),
189
+ createLock: createLock.bind(_curve),
190
+ increaseAmount: increaseAmount.bind(_curve),
191
+ increaseUnlockTime: increaseUnlockTime.bind(_curve),
192
+ withdrawLockedCrv: withdrawLockedCrv.bind(_curve),
193
+ claimableFees: claimableFees.bind(_curve),
194
+ claimFees: claimFees.bind(_curve),
195
+ claimableFeesCrvUSD: claimableFeesCrvUSD.bind(_curve),
196
+ claimFeesCrvUSD: claimFeesCrvUSD.bind(_curve),
197
+ calculateVeCrv, estimateGas: {
198
+ approve: approveEstimateGas.bind(_curve),
199
+ createLock: createLockEstimateGas.bind(_curve),
200
+ increaseAmount: increaseAmountEstimateGas.bind(_curve),
201
+ increaseUnlockTime: increaseUnlockTimeEstimateGas.bind(_curve),
202
+ withdrawLockedCrv: withdrawLockedCrvEstimateGas.bind(_curve),
203
+ claimFees: claimFeesEstimateGas.bind(_curve),
204
+ claimFeesCrvUSD: claimFeesCrvUSDEstimateGas.bind(_curve),
205
+ },
206
+ sidechain: {
207
+ lastEthBlock: lastEthBlock.bind(_curve),
208
+ getAnycallBalance: getAnycallBalance.bind(_curve),
209
+ topUpAnycall: topUpAnycall.bind(_curve),
210
+ lastBlockSent: lastBlockSent.bind(_curve),
211
+ blockToSend: blockToSend.bind(_curve),
212
+ sendBlockhash: sendBlockhash.bind(_curve),
213
+ submitProof: submitProof.bind(_curve),
214
+ estimateGas: {
215
+ topUpAnycall: topUpAnycallEstimateGas.bind(_curve),
216
+ sendBlockhash: sendBlockhashEstimateGas.bind(_curve),
217
+ submitProof: submitProofEstimateGas.bind(_curve),
218
+ },
219
+ },
220
+ },
221
+ router: {
222
+ getBestRouteAndOutput: getBestRouteAndOutput.bind(_curve),
223
+ getArgs: getArgs.bind(_curve),
224
+ expected: swapExpected.bind(_curve),
225
+ required: swapRequired.bind(_curve),
226
+ priceImpact: swapPriceImpact.bind(_curve),
227
+ isApproved: swapIsApproved.bind(_curve),
228
+ approve: swapApprove.bind(_curve),
229
+ swap: swap.bind(_curve),
230
+ getSwappedAmount: getSwappedAmount.bind(_curve),
231
+ estimateGas: {
232
+ approve: swapApproveEstimateGas.bind(_curve),
233
+ swap: swapEstimateGas.bind(_curve),
234
+ },
235
+ },
236
+ dao: {
274
237
  // --- CRV lock ---
275
- crvLockApprove: crvLockApproveEstimateGas,
276
- createCrvLock: createCrvLockEstimateGas,
277
- increaseCrvLockedAmount: increaseCrvLockedAmountEstimateGas,
278
- increaseCrvUnlockTime: increaseCrvUnlockTimeEstimateGas,
279
- withdrawLockedCrv: daoWithdrawLockedCrvEstimateGas,
280
- claimFees: daoClaimFeesEstimateGas,
238
+ // View methods
239
+ crvSupplyStats: crvSupplyStats.bind(_curve),
240
+ userCrv: userCrv.bind(_curve),
241
+ userVeCrv: userVeCrv.bind(_curve),
242
+ crvLockIsApproved: crvLockIsApproved.bind(_curve),
243
+ calcCrvUnlockTime: calcCrvUnlockTime.bind(_curve),
244
+ claimableFees: daoClaimableFees.bind(_curve),
245
+ // Transaction methods
246
+ crvLockApprove: crvLockApprove.bind(_curve),
247
+ createCrvLock: createCrvLock.bind(_curve),
248
+ increaseCrvLockedAmount: increaseCrvLockedAmount.bind(_curve),
249
+ increaseCrvUnlockTime: increaseCrvUnlockTime.bind(_curve),
250
+ withdrawLockedCrv: daoWithdrawLockedCrv.bind(_curve),
251
+ claimFees: daoClaimFees.bind(_curve),
281
252
  // --- Gauge voting ---
282
- voteForGauge: voteForGaugeEstimateGas,
253
+ // View methods
254
+ getVotingGaugeList: getVotingGaugeList.bind(_curve),
255
+ userGaugeVotes: userGaugeVotes.bind(_curve),
256
+ voteForGaugeNextTime: voteForGaugeNextTime.bind(_curve),
257
+ // Transaction methods
258
+ voteForGauge: voteForGauge.bind(_curve),
283
259
  // --- Proposal voting ---
284
- voteForProposal: voteForProposalEstimateGas,
285
- executeVote: executeVoteEstimateGas,
260
+ // View methods
261
+ getProposalList: getProposalList.bind(_curve),
262
+ getProposal: getProposal.bind(_curve),
263
+ userProposalVotes: userProposalVotes.bind(_curve),
264
+ // Transaction methods
265
+ voteForProposal: voteForProposal.bind(_curve),
266
+ executeVote: executeVote.bind(_curve),
267
+ isCanVoteExecute: isCanVoteExecute.bind(_curve),
268
+ estimateGas: {
269
+ // --- CRV lock ---
270
+ crvLockApprove: crvLockApproveEstimateGas.bind(_curve),
271
+ createCrvLock: createCrvLockEstimateGas.bind(_curve),
272
+ increaseCrvLockedAmount: increaseCrvLockedAmountEstimateGas.bind(_curve),
273
+ increaseCrvUnlockTime: increaseCrvUnlockTimeEstimateGas.bind(_curve),
274
+ withdrawLockedCrv: daoWithdrawLockedCrvEstimateGas.bind(_curve),
275
+ claimFees: daoClaimFeesEstimateGas.bind(_curve),
276
+ // --- Gauge voting ---
277
+ voteForGauge: voteForGaugeEstimateGas.bind(_curve),
278
+ // --- Proposal voting ---
279
+ voteForProposal: voteForProposalEstimateGas.bind(_curve),
280
+ executeVote: executeVoteEstimateGas.bind(_curve),
281
+ },
286
282
  },
287
- },
283
+ };
288
284
  };
289
- export default curve;
285
+ export default createCurve();
@@ -1,5 +1,6 @@
1
1
  import { Contract, ethers } from "ethers";
2
2
  import { Contract as MulticallContract, Provider as MulticallProvider } from "@curvefi/ethcall";
3
+ import { BigNumberish, Numeric } from "ethers";
3
4
  export interface IDict<T> {
4
5
  [index: string]: T;
5
6
  }
@@ -119,6 +120,7 @@ export interface ICurve {
119
120
  };
120
121
  constants: INetworkConstants;
121
122
  setContract: (address: string | undefined, abi: any) => void;
123
+ formatUnits(value: BigNumberish, unit?: string | Numeric): string;
122
124
  }
123
125
  export interface ICoinFromPoolDataApi {
124
126
  address: string;