@curvefi/api 2.66.24 → 2.66.26
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.d.ts +1 -0
- package/lib/boosting.js +23 -1
- package/lib/constants/coins/index.d.ts +2 -1
- package/lib/constants/coins/index.js +2 -1
- package/lib/constants/network_constants.js +2 -4
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/package.json +1 -1
package/lib/boosting.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const approveEstimateGas: (amount: number | string) => Promise<nu
|
|
|
14
14
|
export declare const approve: (amount: number | string) => Promise<string[]>;
|
|
15
15
|
export declare const createLockEstimateGas: (amount: number | string, days: number) => Promise<number>;
|
|
16
16
|
export declare const calcUnlockTime: (days: number, start?: number) => number;
|
|
17
|
+
export declare const calculateVeCrv: (amount: number | string, unlockTimestamp: number) => number;
|
|
17
18
|
export declare const createLock: (amount: number | string, days: number) => Promise<string>;
|
|
18
19
|
export declare const increaseAmountEstimateGas: (amount: number | string) => Promise<number>;
|
|
19
20
|
export declare const increaseAmount: (amount: number | string) => Promise<string>;
|
package/lib/boosting.js
CHANGED
|
@@ -8,11 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { Contract } from "ethers";
|
|
11
|
+
import BigNumber from "bignumber.js";
|
|
11
12
|
import { curve } from "./curve.js";
|
|
12
13
|
import feeDistributorViewABI from "./constants/abis/fee_distributor_view.json" with { type: 'json' };
|
|
13
14
|
import feeDistributorCrvUSDViewABI from "./constants/abis/fee_distributor_crvusd_view.json" with { type: 'json' };
|
|
14
15
|
import { _getBalances, _prepareAddresses, DIGas, ensureAllowance, ensureAllowanceEstimateGas, hasAllowance, mulBy1_3, smartNumber, } from "./utils.js";
|
|
15
|
-
import { _ensureAllowance, toBN, toStringFromBN, parseUnits } from './utils.js';
|
|
16
|
+
import { _ensureAllowance, toBN, toStringFromBN, parseUnits, BN } from './utils.js';
|
|
16
17
|
import { _generateBoostingProof } from './external-api.js';
|
|
17
18
|
export const getCrv = (...addresses) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
19
|
addresses = _prepareAddresses(addresses);
|
|
@@ -91,6 +92,27 @@ export const calcUnlockTime = (days, start = Date.now()) => {
|
|
|
91
92
|
const unlockTime = now + (86400 * days);
|
|
92
93
|
return Math.floor(unlockTime / week) * week * 1000;
|
|
93
94
|
};
|
|
95
|
+
export const calculateVeCrv = (amount, unlockTimestamp) => {
|
|
96
|
+
const WEEK_SECONDS = BN(7 * 86400);
|
|
97
|
+
const MAX_TIME_SECONDS = BN(4 * 365 * 86400);
|
|
98
|
+
const nowBN = BN(Math.floor(Date.now() / 1000));
|
|
99
|
+
const unlockBN = BN(unlockTimestamp);
|
|
100
|
+
const unlockRounded = unlockBN
|
|
101
|
+
.div(WEEK_SECONDS)
|
|
102
|
+
.integerValue(BigNumber.ROUND_FLOOR)
|
|
103
|
+
.times(WEEK_SECONDS);
|
|
104
|
+
let duration = unlockRounded.minus(nowBN);
|
|
105
|
+
if (duration.isNegative()) {
|
|
106
|
+
duration = BN(0);
|
|
107
|
+
}
|
|
108
|
+
else if (duration.gt(MAX_TIME_SECONDS)) {
|
|
109
|
+
duration = MAX_TIME_SECONDS;
|
|
110
|
+
}
|
|
111
|
+
const veCrvBN = BN(amount)
|
|
112
|
+
.times(duration)
|
|
113
|
+
.div(MAX_TIME_SECONDS);
|
|
114
|
+
return veCrvBN.toNumber();
|
|
115
|
+
};
|
|
94
116
|
export const createLock = (amount, days) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
117
|
const _amount = parseUnits(amount);
|
|
96
118
|
const unlockTime = Math.floor(Date.now() / 1000) + (86400 * days);
|
|
@@ -15,4 +15,5 @@ import { COINS_BSC } from "./bsc.js";
|
|
|
15
15
|
import { COINS_FRAXTAL } from "./fraxtal.js";
|
|
16
16
|
import { COINS_XLAYER } from "./xlayer.js";
|
|
17
17
|
import { COINS_MANTLE } from "./mantle.js";
|
|
18
|
-
|
|
18
|
+
import { COINS_SONIC } from "./sonic.js";
|
|
19
|
+
export { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum, COINS_POLYGON, aTokensPolygon, COINS_FANTOM, cTokensFantom, aTokensFantom, COINS_AVALANCHE, aTokensAvalanche, COINS_ARBITRUM, COINS_OPTIMISM, COINS_XDAI, COINS_MOONBEAM, COINS_AURORA, COINS_KAVA, COINS_CELO, COINS_ZKSYNC, COINS_BASE, COINS_BSC, COINS_FRAXTAL, COINS_XLAYER, COINS_MANTLE, COINS_SONIC, };
|
|
@@ -15,4 +15,5 @@ import { COINS_BSC } from "./bsc.js";
|
|
|
15
15
|
import { COINS_FRAXTAL } from "./fraxtal.js";
|
|
16
16
|
import { COINS_XLAYER } from "./xlayer.js";
|
|
17
17
|
import { COINS_MANTLE } from "./mantle.js";
|
|
18
|
-
|
|
18
|
+
import { COINS_SONIC } from "./sonic.js";
|
|
19
|
+
export { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum, COINS_POLYGON, aTokensPolygon, COINS_FANTOM, cTokensFantom, aTokensFantom, COINS_AVALANCHE, aTokensAvalanche, COINS_ARBITRUM, COINS_OPTIMISM, COINS_XDAI, COINS_MOONBEAM, COINS_AURORA, COINS_KAVA, COINS_CELO, COINS_ZKSYNC, COINS_BASE, COINS_BSC, COINS_FRAXTAL, COINS_XLAYER, COINS_MANTLE, COINS_SONIC, };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { lowerCaseValues } from "./utils.js";
|
|
2
|
-
import { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, POOLS_DATA_BSC, POOLS_DATA_FRAXTAL, POOLS_DATA_XLAYER, POOLS_DATA_MANTLE, } from './pools/index.js';
|
|
3
|
-
import { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum, COINS_OPTIMISM, COINS_POLYGON, aTokensPolygon, COINS_FANTOM, cTokensFantom, aTokensFantom, COINS_AVALANCHE, aTokensAvalanche, COINS_ARBITRUM, COINS_XDAI, COINS_MOONBEAM, COINS_AURORA, COINS_KAVA, COINS_CELO, COINS_ZKSYNC, COINS_BASE, COINS_BSC, COINS_FRAXTAL, COINS_XLAYER, COINS_MANTLE, } from "./coins/index.js";
|
|
4
|
-
import { POOLS_DATA_SONIC } from "./pools/sonic";
|
|
5
|
-
import { COINS_SONIC } from "./coins/sonic";
|
|
2
|
+
import { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, POOLS_DATA_BSC, POOLS_DATA_FRAXTAL, POOLS_DATA_XLAYER, POOLS_DATA_MANTLE, POOLS_DATA_SONIC, } from './pools/index.js';
|
|
3
|
+
import { COINS_ETHEREUM, cTokensEthereum, yTokensEthereum, ycTokensEthereum, aTokensEthereum, COINS_OPTIMISM, COINS_POLYGON, aTokensPolygon, COINS_FANTOM, cTokensFantom, aTokensFantom, COINS_AVALANCHE, aTokensAvalanche, COINS_ARBITRUM, COINS_XDAI, COINS_MOONBEAM, COINS_AURORA, COINS_KAVA, COINS_CELO, COINS_ZKSYNC, COINS_BASE, COINS_BSC, COINS_FRAXTAL, COINS_XLAYER, COINS_MANTLE, COINS_SONIC, } from "./coins/index.js";
|
|
6
4
|
const ALIASES_ETHEREUM = lowerCaseValues({
|
|
7
5
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52", // <--- CHANGE
|
|
8
6
|
"minter": '0xd061D61a4d941c39E5453435B6345Dc261C2fcE0', // <--- RECOVERED
|
|
@@ -16,4 +16,5 @@ import { POOLS_DATA_BSC } from "./bsc.js";
|
|
|
16
16
|
import { POOLS_DATA_FRAXTAL } from "./fraxtal.js";
|
|
17
17
|
import { POOLS_DATA_XLAYER } from "./xlayer.js";
|
|
18
18
|
import { POOLS_DATA_MANTLE } from "./mantle.js";
|
|
19
|
-
|
|
19
|
+
import { POOLS_DATA_SONIC } from "./sonic.js";
|
|
20
|
+
export { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, POOLS_DATA_BSC, POOLS_DATA_FRAXTAL, POOLS_DATA_XLAYER, POOLS_DATA_MANTLE, POOLS_DATA_SONIC, };
|
|
@@ -16,4 +16,5 @@ import { POOLS_DATA_BSC } from "./bsc.js";
|
|
|
16
16
|
import { POOLS_DATA_FRAXTAL } from "./fraxtal.js";
|
|
17
17
|
import { POOLS_DATA_XLAYER } from "./xlayer.js";
|
|
18
18
|
import { POOLS_DATA_MANTLE } from "./mantle.js";
|
|
19
|
-
|
|
19
|
+
import { POOLS_DATA_SONIC } from "./sonic.js";
|
|
20
|
+
export { POOLS_DATA_ETHEREUM, LLAMMAS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, POOLS_DATA_AURORA, POOLS_DATA_KAVA, POOLS_DATA_CELO, POOLS_DATA_ZKSYNC, POOLS_DATA_BASE, POOLS_DATA_BSC, POOLS_DATA_FRAXTAL, POOLS_DATA_XLAYER, POOLS_DATA_MANTLE, POOLS_DATA_SONIC, };
|
package/lib/index.d.ts
CHANGED
|
@@ -208,6 +208,7 @@ declare const curve: {
|
|
|
208
208
|
claimFees: (address?: string) => Promise<string>;
|
|
209
209
|
claimableFeesCrvUSD: (address?: string) => Promise<string>;
|
|
210
210
|
claimFeesCrvUSD: (address?: string) => Promise<string>;
|
|
211
|
+
calculateVeCrv: (amount: number | string, unlockTimestamp: number) => number;
|
|
211
212
|
estimateGas: {
|
|
212
213
|
approve: (amount: number | string) => Promise<number | number[]>;
|
|
213
214
|
createLock: (amount: number | string, days: number) => Promise<number>;
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ 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
13
|
import { curve as _curve } from "./curve.js";
|
|
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, } from "./boosting.js";
|
|
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";
|
|
@@ -198,6 +198,7 @@ const curve = {
|
|
|
198
198
|
claimFees,
|
|
199
199
|
claimableFeesCrvUSD,
|
|
200
200
|
claimFeesCrvUSD,
|
|
201
|
+
calculateVeCrv,
|
|
201
202
|
estimateGas: {
|
|
202
203
|
approve: approveEstimateGas,
|
|
203
204
|
createLock: createLockEstimateGas,
|