@curvefi/api 2.52.5 → 2.53.1

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.
@@ -1,5 +1,5 @@
1
1
  import memoize from "memoizee";
2
- import { IExtendedPoolDataFromApi, ISubgraphPoolData, IDict, INetworkName, IPoolType } from "./interfaces";
2
+ import { IExtendedPoolDataFromApi, ISubgraphPoolData, IDict, INetworkName, IPoolType, IGaugesDataFromApi, IDaoProposal, IDaoProposalListItem } from "./interfaces";
3
3
  export declare const _getPoolsFromApi: ((network: INetworkName, poolType: IPoolType) => Promise<IExtendedPoolDataFromApi>) & memoize.Memoized<(network: INetworkName, poolType: IPoolType) => Promise<IExtendedPoolDataFromApi>>;
4
4
  export declare const _getAllPoolsFromApi: (network: INetworkName) => Promise<IExtendedPoolDataFromApi[]>;
5
5
  export declare const _getSubgraphData: ((network: INetworkName) => Promise<{
@@ -35,15 +35,7 @@ export declare const _getFactoryAPYsAndVolumes: ((network: string) => Promise<{
35
35
  apy: number;
36
36
  volume: number;
37
37
  }[]>>;
38
- export declare const _getAllGauges: (() => Promise<IDict<{
39
- gauge: string;
40
- is_killed?: boolean;
41
- gaugeStatus?: Record<string, boolean> | null;
42
- }>>) & memoize.Memoized<() => Promise<IDict<{
43
- gauge: string;
44
- is_killed?: boolean;
45
- gaugeStatus?: Record<string, boolean> | null;
46
- }>>>;
38
+ export declare const _getAllGauges: (() => Promise<IDict<IGaugesDataFromApi>>) & memoize.Memoized<() => Promise<IDict<IGaugesDataFromApi>>>;
47
39
  export declare const _getHiddenPools: (() => Promise<IDict<string[]>>) & memoize.Memoized<() => Promise<IDict<string[]>>>;
48
40
  export declare const _generateBoostingProof: ((block: number, address: string) => Promise<{
49
41
  block_header_rlp: string;
@@ -52,3 +44,5 @@ export declare const _generateBoostingProof: ((block: number, address: string) =
52
44
  block_header_rlp: string;
53
45
  proof_rlp: string;
54
46
  }>>;
47
+ export declare const _getDaoProposalList: (() => Promise<IDaoProposalListItem[]>) & memoize.Memoized<() => Promise<IDaoProposalListItem[]>>;
48
+ export declare const _getDaoProposal: ((type: "PARAMETER" | "OWNERSHIP", id: number) => Promise<IDaoProposal>) & memoize.Memoized<(type: "PARAMETER" | "OWNERSHIP", id: number) => Promise<IDaoProposal>>;
@@ -186,3 +186,36 @@ export var _generateBoostingProof = memoize(function (block, address) { return _
186
186
  promise: true,
187
187
  maxAge: 5 * 60 * 1000, // 5m
188
188
  });
189
+ // --- DAO ---
190
+ export var _getDaoProposalList = memoize(function () { return __awaiter(void 0, void 0, void 0, function () {
191
+ var url, response;
192
+ return __generator(this, function (_a) {
193
+ switch (_a.label) {
194
+ case 0:
195
+ url = "https://api-py.llama.airforce/curve/v1/dao/proposals";
196
+ return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
197
+ case 1:
198
+ response = _a.sent();
199
+ return [2 /*return*/, response.data.proposals];
200
+ }
201
+ });
202
+ }); }, {
203
+ promise: true,
204
+ maxAge: 5 * 60 * 1000, // 5m
205
+ });
206
+ export var _getDaoProposal = memoize(function (type, id) { return __awaiter(void 0, void 0, void 0, function () {
207
+ var url, response;
208
+ return __generator(this, function (_a) {
209
+ switch (_a.label) {
210
+ case 0:
211
+ url = "https://api-py.llama.airforce/curve/v1/dao/proposals/".concat(type.toLowerCase(), "/").concat(id);
212
+ return [4 /*yield*/, axios.get(url, { validateStatus: function () { return true; } })];
213
+ case 1:
214
+ response = _a.sent();
215
+ return [2 /*return*/, response.data];
216
+ }
217
+ });
218
+ }); }, {
219
+ promise: true,
220
+ maxAge: 5 * 60 * 1000, // 5m
221
+ });
@@ -11,6 +11,7 @@ import MetaSbtc2ABI from "../constants/abis/factory-v2/MetaSbtc2.json" assert {
11
11
  import MetaSbtc2BalancesABI from "../constants/abis/factory-v2/MetaSbtc2Balance.json" assert { type: 'json' };
12
12
  import MetaUSDGeistABI from "../constants/abis/factory-v2/MetaUSDGeist.json" assert { type: 'json' };
13
13
  import Plain2BasicABI from "../constants/abis/factory-v2/Plain2Basic.json" assert { type: 'json' };
14
+ import Plain2BasicWithRatesABI from "../constants/abis/factory-v2/Plain2BasicWithRates.json" assert { type: 'json' };
14
15
  import Plain2BalancesABI from "../constants/abis/factory-v2/Plain2Balances.json" assert { type: 'json' };
15
16
  import Plain2ETHABI from "../constants/abis/factory-v2/Plain2ETH.json" assert { type: 'json' };
16
17
  import Plain2ETHOracleABI from "../constants/abis/factory-v2/Plain2ETHOracle.json" assert { type: 'json' };
@@ -63,7 +64,7 @@ export var implementationABIDictEthereum = lowerCaseKeys({
63
64
  // !!! crvUSD Factory !!!
64
65
  "0x67fe41A94e779CcFa22cff02cc2957DC9C0e4286": Plain2BasicABI,
65
66
  "0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a": Plain2BalancesABI,
66
- "0x36Dc03C0e12a1C241306a6A8F327Fe28bA2Be5b0": Plain2BasicABI,
67
+ "0x36Dc03C0e12a1C241306a6A8F327Fe28bA2Be5b0": Plain2BasicWithRatesABI,
67
68
  // !!! crvUSD Factory !!!
68
69
  "0x9B52F13DF69D79Ec5aAB6D1aCe3157d29B409cC3": Plain3BasicABI,
69
70
  "0x50b085f2e5958C4A87baf93A8AB79F6bec068494": Plain3BalancesABI,
@@ -203,6 +203,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
203
203
  gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
204
204
  deposit_abi: basePoolZap.ABI,
205
205
  in_api: true,
206
+ is_stable_ng: false,
206
207
  };
207
208
  }
208
209
  else {
@@ -226,6 +227,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
226
227
  swap_abi: factoryType === "factory-tricrypto" ? tricryptoFactorySwapABI : cryptoFactorySwapABI,
227
228
  gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
228
229
  in_api: true,
230
+ is_stable_ng: false,
229
231
  };
230
232
  }
231
233
  }
@@ -261,6 +263,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
261
263
  gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
262
264
  deposit_abi: basePoolZap.ABI,
263
265
  in_api: true,
266
+ is_stable_ng: factoryType === 'factory-stable-ng',
264
267
  };
265
268
  }
266
269
  else {
@@ -285,6 +288,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
285
288
  swap_abi: implementationABIDict[pool.implementationAddress],
286
289
  gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
287
290
  in_api: true,
291
+ is_stable_ng: factoryType === 'factory-stable-ng',
288
292
  };
289
293
  }
290
294
  });
@@ -414,6 +414,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
414
414
  wrapped_decimals: __spreadArray([], coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }), true),
415
415
  swap_abi: swapABIs[i],
416
416
  gauge_abi: this_1.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
417
+ is_stable_ng: factoryAddress === curve.constants.ALIASES.stable_ng_factory,
417
418
  };
418
419
  }
419
420
  else {
@@ -448,6 +449,7 @@ export function getFactoryPoolData(fromIdx, swapAddress, factoryAddress) {
448
449
  swap_abi: swapABIs[i],
449
450
  gauge_abi: this_1.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
450
451
  deposit_abi: basePoolZap.ABI,
452
+ is_stable_ng: factoryAddress === curve.constants.ALIASES.stable_ng_factory,
451
453
  };
452
454
  }
453
455
  };
package/lib/index.d.ts CHANGED
@@ -227,5 +227,52 @@ declare const curve: {
227
227
  swap: (inputCoin: string, outputCoin: string, amount: string | number) => Promise<number | number[]>;
228
228
  };
229
229
  };
230
+ dao: {
231
+ crvSupplyStats: () => Promise<{
232
+ circulating: string;
233
+ locked: string;
234
+ total: string;
235
+ veCrv: string;
236
+ averageLockTime: string;
237
+ }>;
238
+ userCrv: (address?: string) => Promise<string>;
239
+ userVeCrv: (address?: string) => Promise<{
240
+ veCrv: string;
241
+ veCrvPct: string;
242
+ lockedCrv: string;
243
+ unlockTime: number;
244
+ }>;
245
+ crvLockIsApproved: (amount: string | number) => Promise<boolean>;
246
+ calcCrvUnlockTime: (days: string | number, start?: string | number) => number;
247
+ claimableFees: (address?: string) => Promise<string>;
248
+ crvLockApprove: (amount: string | number) => Promise<string[]>;
249
+ createCrvLock: (amount: string | number, days: string | number) => Promise<string>;
250
+ increaseCrvLockedAmount: (amount: string | number) => Promise<string>;
251
+ increaseCrvUnlockTime: (days: string | number) => Promise<string>;
252
+ withdrawLockedCrv: () => Promise<string>;
253
+ claimFees: (address?: string) => Promise<string>;
254
+ getVotingGaugeList: () => Promise<import("./interfaces.js").IVotingGauge[]>;
255
+ userGaugeVotes: (address?: string) => Promise<{
256
+ gauges: import("./interfaces.js").IGaugeUserVote[];
257
+ powerUsed: string;
258
+ veCrvUsed: string;
259
+ }>;
260
+ voteForGaugeNextTime: (gauge: string) => Promise<number>;
261
+ voteForGauge: (gauge: string, power: string | number) => Promise<string>;
262
+ getProposalList: () => Promise<import("./interfaces.js").IDaoProposalListItem[]>;
263
+ getProposal: (type: "PARAMETER" | "OWNERSHIP", id: number) => Promise<import("./interfaces.js").IDaoProposal>;
264
+ userProposalVotes: (address?: string) => Promise<import("./interfaces.js").IDaoProposalUserListItem[]>;
265
+ voteForProposal: (type: "PARAMETER" | "OWNERSHIP", id: number, support: boolean) => Promise<string>;
266
+ estimateGas: {
267
+ crvLockApprove: (amount: string | number) => Promise<number | number[]>;
268
+ createCrvLock: (amount: string | number, days: string | number) => Promise<number | number[]>;
269
+ increaseCrvLockedAmount: (amount: string | number) => Promise<number | number[]>;
270
+ increaseCrvUnlockTime: (days: string | number) => Promise<number | number[]>;
271
+ withdrawLockedCrv: () => Promise<number | number[]>;
272
+ claimFees: (address?: string) => Promise<number | number[]>;
273
+ voteForGauge: (gauge: string, power: string | number) => Promise<number | number[]>;
274
+ voteForProposal: (type: "PARAMETER" | "OWNERSHIP", id: number, support: boolean) => Promise<number | number[]>;
275
+ };
276
+ };
230
277
  };
231
278
  export default curve;
package/lib/index.js CHANGED
@@ -41,6 +41,7 @@ import { curve as _curve } from "./curve.js";
41
41
  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, } from "./boosting.js";
42
42
  import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL1, getGasPriceFromL2, getTVL, getCoinsData, getVolume, hasDepositAndStake, hasRouter, } from "./utils.js";
43
43
  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, } from './factory/deploy.js';
44
+ 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, } from "./dao.js";
44
45
  function init(providerType, providerSettings, options) {
45
46
  if (options === void 0) { options = {}; }
46
47
  return __awaiter(this, void 0, void 0, function () {
@@ -280,5 +281,49 @@ var curve = {
280
281
  swap: swapEstimateGas,
281
282
  },
282
283
  },
284
+ dao: {
285
+ // --- CRV lock ---
286
+ // View methods
287
+ crvSupplyStats: crvSupplyStats,
288
+ userCrv: userCrv,
289
+ userVeCrv: userVeCrv,
290
+ crvLockIsApproved: crvLockIsApproved,
291
+ calcCrvUnlockTime: calcCrvUnlockTime,
292
+ claimableFees: daoClaimableFees,
293
+ // Transaction methods
294
+ crvLockApprove: crvLockApprove,
295
+ createCrvLock: createCrvLock,
296
+ increaseCrvLockedAmount: increaseCrvLockedAmount,
297
+ increaseCrvUnlockTime: increaseCrvUnlockTime,
298
+ withdrawLockedCrv: daoWithdrawLockedCrv,
299
+ claimFees: daoClaimFees,
300
+ // --- Gauge voting ---
301
+ // View methods
302
+ getVotingGaugeList: getVotingGaugeList,
303
+ userGaugeVotes: userGaugeVotes,
304
+ voteForGaugeNextTime: voteForGaugeNextTime,
305
+ // Transaction methods
306
+ voteForGauge: voteForGauge,
307
+ // --- Proposal voting ---
308
+ // View methods
309
+ getProposalList: getProposalList,
310
+ getProposal: getProposal,
311
+ userProposalVotes: userProposalVotes,
312
+ // Transaction methods
313
+ voteForProposal: voteForProposal,
314
+ estimateGas: {
315
+ // --- CRV lock ---
316
+ crvLockApprove: crvLockApproveEstimateGas,
317
+ createCrvLock: createCrvLockEstimateGas,
318
+ increaseCrvLockedAmount: increaseCrvLockedAmountEstimateGas,
319
+ increaseCrvUnlockTime: increaseCrvUnlockTimeEstimateGas,
320
+ withdrawLockedCrv: daoWithdrawLockedCrvEstimateGas,
321
+ claimFees: daoClaimFeesEstimateGas,
322
+ // --- Gauge voting ---
323
+ voteForGauge: voteForGaugeEstimateGas,
324
+ // --- Proposal voting ---
325
+ voteForProposal: voteForProposalEstimateGas,
326
+ },
327
+ },
283
328
  };
284
329
  export default curve;
@@ -28,6 +28,7 @@ export interface IPoolData {
28
28
  is_fake?: boolean;
29
29
  is_factory?: boolean;
30
30
  is_llamma?: boolean;
31
+ is_stable_ng?: boolean;
31
32
  base_pool?: string;
32
33
  meta_coin_idx?: number;
33
34
  underlying_coins: string[];
@@ -180,3 +181,69 @@ export interface IProfit {
180
181
  symbol: string;
181
182
  price: number;
182
183
  }
184
+ export interface IGaugesDataFromApi {
185
+ gauge: string;
186
+ swap: string;
187
+ swap_token: string;
188
+ shortName: string;
189
+ gauge_controller: {
190
+ gauge_relative_weight: string;
191
+ get_gauge_weight: string;
192
+ };
193
+ poolUrls: {
194
+ swap: string[];
195
+ };
196
+ is_killed?: boolean;
197
+ hasNoCrv?: boolean;
198
+ gaugeStatus?: Record<string, boolean> | null;
199
+ }
200
+ export interface IVotingGauge {
201
+ poolUrl: string;
202
+ network: string;
203
+ gaugeAddress: string;
204
+ poolAddress: string;
205
+ lpTokenAddress: string;
206
+ poolName: string;
207
+ totalVeCrv: string;
208
+ relativeWeight: string;
209
+ isKilled: boolean;
210
+ }
211
+ export interface IGaugeUserVote {
212
+ userPower: string;
213
+ userVeCrv: string;
214
+ userFutureVeCrv: string;
215
+ expired: boolean;
216
+ gaugeData: IVotingGauge;
217
+ }
218
+ export interface IDaoProposalListItem {
219
+ voteId: number;
220
+ voteType: "PARAMETER" | "OWNERSHIP";
221
+ creator: string;
222
+ startDate: number;
223
+ snapshotBlock: number;
224
+ ipfsMetadata: string;
225
+ metadata: string;
226
+ votesFor: string;
227
+ votesAgainst: string;
228
+ voteCount: number;
229
+ supportRequired: string;
230
+ minAcceptQuorum: string;
231
+ totalSupply: string;
232
+ executed: boolean;
233
+ }
234
+ export interface IDaoProposalUserListItem extends IDaoProposalListItem {
235
+ userVote: "yes" | "no" | "even";
236
+ }
237
+ export interface IDaoProposalVote {
238
+ tx: string;
239
+ voteId: number;
240
+ voter: string;
241
+ supports: boolean;
242
+ stake: number;
243
+ }
244
+ export interface IDaoProposal extends IDaoProposalListItem {
245
+ tx: string;
246
+ creatorVotingPower: number;
247
+ script: string;
248
+ votes: IDaoProposalVote[];
249
+ }
@@ -20,6 +20,7 @@ export declare class PoolTemplate {
20
20
  isFake: boolean;
21
21
  isFactory: boolean;
22
22
  isMetaFactory: boolean;
23
+ isStableNg: boolean;
23
24
  isLlamma: boolean;
24
25
  basePool: string;
25
26
  metaCoinIdx: number;
@@ -103,6 +104,7 @@ export declare class PoolTemplate {
103
104
  private statsTotalLiquidity;
104
105
  private statsVolume;
105
106
  private statsBaseApy;
107
+ private _calcTokenApy;
106
108
  private statsTokenApy;
107
109
  private statsRewardsApy;
108
110
  private _pureCalcLpTokenAmount;
@@ -139,8 +141,11 @@ export declare class PoolTemplate {
139
141
  claimableCrv(address?: string): Promise<string>;
140
142
  claimCrvEstimateGas(): Promise<number | number[]>;
141
143
  claimCrv(): Promise<string>;
142
- boost: (address?: string) => Promise<string>;
144
+ userBoost: (address?: string) => Promise<string>;
145
+ private _userFutureBoostAndWorkingSupply;
146
+ userFutureBoost: (address?: string) => Promise<string>;
143
147
  userCrvApy: (address?: string) => Promise<number>;
148
+ userFutureCrvApy: (address?: string) => Promise<number>;
144
149
  maxBoostedStake: (...addresses: string[]) => Promise<IDict<string> | string>;
145
150
  rewardTokens: ((useApi?: any) => Promise<{
146
151
  token: string;
@@ -254,6 +259,7 @@ export declare class PoolTemplate {
254
259
  private _getCoinIdx;
255
260
  private _getRates;
256
261
  private _balances;
262
+ private _stored_rates;
257
263
  private _underlyingPrices;
258
264
  private _wrappedPrices;
259
265
  }