@curvefi/api 2.63.0 → 2.63.2
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 +247 -645
- package/lib/constants/L2Networks.js +1 -1
- package/lib/constants/aliases.js +19 -19
- package/lib/constants/coins/arbitrum.js +5 -5
- package/lib/constants/coins/aurora.js +5 -5
- package/lib/constants/coins/avalanche.js +6 -6
- package/lib/constants/coins/base.js +5 -5
- package/lib/constants/coins/bsc.js +5 -5
- package/lib/constants/coins/celo.js +5 -5
- package/lib/constants/coins/ethereum.js +9 -9
- package/lib/constants/coins/fantom.js +7 -7
- package/lib/constants/coins/fraxtal.js +5 -5
- package/lib/constants/coins/kava.js +5 -5
- package/lib/constants/coins/mantle.js +5 -5
- package/lib/constants/coins/moonbeam.js +5 -5
- package/lib/constants/coins/optimism.js +5 -5
- package/lib/constants/coins/polygon.js +6 -6
- package/lib/constants/coins/xdai.js +5 -5
- package/lib/constants/coins/xlayer.js +5 -5
- package/lib/constants/coins/zksync.js +5 -5
- package/lib/constants/pools/arbitrum.js +1 -1
- package/lib/constants/pools/aurora.js +1 -1
- package/lib/constants/pools/avalanche.js +1 -1
- package/lib/constants/pools/base.js +1 -1
- package/lib/constants/pools/bsc.js +1 -1
- package/lib/constants/pools/celo.js +1 -1
- package/lib/constants/pools/ethereum.js +2 -2
- package/lib/constants/pools/fantom.js +1 -1
- package/lib/constants/pools/fraxtal.js +1 -1
- package/lib/constants/pools/kava.js +1 -1
- package/lib/constants/pools/mantle.js +1 -1
- package/lib/constants/pools/moonbeam.js +1 -1
- package/lib/constants/pools/optimism.js +1 -1
- package/lib/constants/pools/polygon.js +1 -1
- package/lib/constants/pools/xdai.js +1 -1
- package/lib/constants/pools/xlayer.js +1 -1
- package/lib/constants/pools/zksync.js +1 -1
- package/lib/constants/tricryptoDeployImplementations.js +1 -1
- package/lib/constants/utils.js +18 -19
- package/lib/constants/volumeNetworks.js +1 -1
- package/lib/curve.d.ts +10 -6
- package/lib/curve.js +534 -909
- package/lib/dao.js +351 -705
- package/lib/external-api.js +127 -256
- package/lib/factory/common.js +4 -4
- package/lib/factory/constants-crypto.js +33 -33
- package/lib/factory/constants.js +34 -34
- package/lib/factory/deploy.js +542 -907
- package/lib/factory/factory-api.js +205 -269
- package/lib/factory/factory-crypto.js +202 -342
- package/lib/factory/factory-tricrypto.js +164 -286
- package/lib/factory/factory-twocrypto.js +151 -269
- package/lib/factory/factory.js +245 -385
- package/lib/index.js +109 -198
- package/lib/interfaces.d.ts +46 -6
- package/lib/pools/PoolTemplate.js +1774 -3027
- package/lib/pools/gaugePool.js +112 -251
- package/lib/pools/mixins/common.js +22 -93
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +52 -118
- package/lib/pools/mixins/depositMixins.js +160 -386
- package/lib/pools/mixins/depositWrappedMixins.js +79 -205
- package/lib/pools/mixins/poolBalancesMixin.js +24 -87
- package/lib/pools/mixins/swapMixins.js +139 -324
- package/lib/pools/mixins/swapWrappedMixins.js +111 -265
- package/lib/pools/mixins/withdrawExpectedMixins.js +27 -91
- package/lib/pools/mixins/withdrawImbalanceMixins.js +111 -293
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +58 -169
- package/lib/pools/mixins/withdrawMixins.js +139 -359
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +20 -75
- package/lib/pools/mixins/withdrawOneCoinMixins.js +140 -360
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +10 -51
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +60 -167
- package/lib/pools/mixins/withdrawWrappedMixins.js +57 -167
- package/lib/pools/poolConstructor.js +11 -31
- package/lib/pools/utils.js +301 -469
- package/lib/route-finder.worker.d.ts +9 -0
- package/lib/route-finder.worker.js +112 -0
- package/lib/route-graph.worker.d.ts +11 -0
- package/lib/route-graph.worker.js +334 -0
- package/lib/router.js +323 -912
- package/lib/utils.d.ts +8 -7
- package/lib/utils.js +540 -927
- package/package.json +3 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { lowerCasePoolDataAddresses } from "../utils.js";
|
|
2
|
-
export
|
|
2
|
+
export const POOLS_DATA_MANTLE = lowerCasePoolDataAddresses({});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { lowerCasePoolDataAddresses } from "../utils.js";
|
|
2
2
|
import tripoolSwapABI from '../abis/3pool-optimism/swap.json' assert { type: 'json' };
|
|
3
3
|
import gaugeChildABI from '../abis/gauge_child.json' assert { type: 'json' };
|
|
4
|
-
export
|
|
4
|
+
export const POOLS_DATA_MOONBEAM = lowerCasePoolDataAddresses({
|
|
5
5
|
'3pool': {
|
|
6
6
|
name: "3pool",
|
|
7
7
|
full_name: "3pool",
|
|
@@ -2,7 +2,7 @@ import { lowerCasePoolDataAddresses } from "../utils.js";
|
|
|
2
2
|
import tripoolSwapABI from '../abis/3pool-optimism/swap.json' assert { type: 'json' };
|
|
3
3
|
import wstETHSwapABI from '../abis/wsteth/swap.json' assert { type: 'json' };
|
|
4
4
|
import gaugeChildABI from '../abis/gauge_child.json' assert { type: 'json' };
|
|
5
|
-
export
|
|
5
|
+
export const POOLS_DATA_OPTIMISM = lowerCasePoolDataAddresses({
|
|
6
6
|
'3pool': {
|
|
7
7
|
name: "3pool",
|
|
8
8
|
full_name: "3pool",
|
|
@@ -6,7 +6,7 @@ import atricrypto3Zap from '../abis/atricrypto3/zap.json' assert { type: 'json'
|
|
|
6
6
|
import eurtusdSwap from '../abis/eurtusd/swap.json' assert { type: 'json' };
|
|
7
7
|
import eurtusdZap from '../abis/eurtusd/deposit.json' assert { type: 'json' };
|
|
8
8
|
import gaugeChildABI from '../abis/gauge_child.json' assert { type: 'json' };
|
|
9
|
-
export
|
|
9
|
+
export const POOLS_DATA_POLYGON = lowerCasePoolDataAddresses({
|
|
10
10
|
aave: {
|
|
11
11
|
name: "aave",
|
|
12
12
|
full_name: "aave",
|
|
@@ -9,7 +9,7 @@ import eureDepositABI from "../abis/eureusd/zap.json" assert { type: 'json' };
|
|
|
9
9
|
import gaugeRewardsOnlyABI from '../abis/gauge_rewards_only.json' assert { type: 'json' };
|
|
10
10
|
import gaugeChildABI from '../abis/gauge_child.json' assert { type: 'json' };
|
|
11
11
|
import streamerABI from '../abis/streamer.json' assert { type: 'json' };
|
|
12
|
-
export
|
|
12
|
+
export const POOLS_DATA_XDAI = lowerCasePoolDataAddresses({
|
|
13
13
|
'3pool': {
|
|
14
14
|
name: "3pool",
|
|
15
15
|
full_name: "3pool",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { lowerCasePoolDataAddresses } from "../utils.js";
|
|
2
|
-
export
|
|
2
|
+
export const POOLS_DATA_XLAYER = lowerCasePoolDataAddresses({});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { lowerCasePoolDataAddresses } from "../utils.js";
|
|
2
|
-
export
|
|
2
|
+
export const POOLS_DATA_ZKSYNC = lowerCasePoolDataAddresses({});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const tricryptoDeployImplementations = {
|
|
2
2
|
1: {
|
|
3
3
|
amm_native_transfers_disabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
|
|
4
4
|
amm_native_transfers_enabled: '0x66442B0C5260B92cAa9c234ECf2408CBf6b19a6f'.toLowerCase(),
|
package/lib/constants/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { curve } from "../curve.js";
|
|
2
|
-
export
|
|
3
|
-
for (
|
|
2
|
+
export const lowerCasePoolDataAddresses = (poolsData) => {
|
|
3
|
+
for (const poolId in poolsData) {
|
|
4
4
|
if (!Object.prototype.hasOwnProperty.call(poolsData, poolId))
|
|
5
5
|
continue;
|
|
6
|
-
|
|
6
|
+
const poolData = poolsData[poolId];
|
|
7
7
|
poolData.swap_address = poolData.swap_address.toLowerCase();
|
|
8
8
|
poolData.token_address = poolData.token_address.toLowerCase();
|
|
9
9
|
poolData.gauge_address = poolData.gauge_address.toLowerCase();
|
|
@@ -13,45 +13,44 @@ export var lowerCasePoolDataAddresses = function (poolsData) {
|
|
|
13
13
|
poolData.sCurveRewards_address = poolData.sCurveRewards_address.toLowerCase();
|
|
14
14
|
if (poolData.reward_contract)
|
|
15
15
|
poolData.reward_contract = poolData.reward_contract.toLowerCase();
|
|
16
|
-
poolData.underlying_coin_addresses = poolData.underlying_coin_addresses.map(
|
|
17
|
-
poolData.wrapped_coin_addresses = poolData.wrapped_coin_addresses.map(
|
|
16
|
+
poolData.underlying_coin_addresses = poolData.underlying_coin_addresses.map((a) => a.toLowerCase());
|
|
17
|
+
poolData.wrapped_coin_addresses = poolData.wrapped_coin_addresses.map((a) => a.toLowerCase());
|
|
18
18
|
}
|
|
19
19
|
return poolsData;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
for (
|
|
21
|
+
export const extractDecimals = (poolsData) => {
|
|
22
|
+
const DECIMALS = {};
|
|
23
|
+
for (const poolId in poolsData) {
|
|
24
24
|
if (!Object.prototype.hasOwnProperty.call(poolsData, poolId))
|
|
25
25
|
continue;
|
|
26
|
-
|
|
26
|
+
const poolData = poolsData[poolId];
|
|
27
27
|
// LP token
|
|
28
28
|
DECIMALS[poolData.token_address] = 18;
|
|
29
29
|
// Underlying coins
|
|
30
|
-
for (
|
|
30
|
+
for (let i = 0; i < poolData.underlying_coin_addresses.length; i++) {
|
|
31
31
|
DECIMALS[poolData.underlying_coin_addresses[i]] = poolData.underlying_decimals[i];
|
|
32
32
|
}
|
|
33
33
|
// Wrapped coins
|
|
34
|
-
for (
|
|
34
|
+
for (let i = 0; i < poolData.wrapped_coin_addresses.length; i++) {
|
|
35
35
|
DECIMALS[poolData.wrapped_coin_addresses[i]] = poolData.wrapped_decimals[i];
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
return DECIMALS;
|
|
39
39
|
};
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
for (
|
|
43
|
-
var poolData = _a[_i];
|
|
40
|
+
export const extractGauges = (poolsData) => {
|
|
41
|
+
const GAUGES = [];
|
|
42
|
+
for (const poolData of Object.values(poolsData)) {
|
|
44
43
|
if (poolData.gauge_address === curve.constants.ZERO_ADDRESS)
|
|
45
44
|
continue;
|
|
46
45
|
GAUGES.push(poolData.gauge_address);
|
|
47
46
|
}
|
|
48
47
|
return GAUGES;
|
|
49
48
|
};
|
|
50
|
-
export
|
|
49
|
+
export const lowerCaseValues = (dict) => {
|
|
51
50
|
// @ts-ignore
|
|
52
|
-
return Object.fromEntries(Object.entries(dict).map(
|
|
51
|
+
return Object.fromEntries(Object.entries(dict).map((entry) => [entry[0], entry[1].toLowerCase()]));
|
|
53
52
|
};
|
|
54
|
-
export
|
|
53
|
+
export const lowerCaseKeys = (dict) => {
|
|
55
54
|
// @ts-ignore
|
|
56
|
-
return Object.fromEntries(Object.entries(dict).map(
|
|
55
|
+
return Object.fromEntries(Object.entries(dict).map((entry) => [entry[0].toLowerCase(), entry[1]]));
|
|
57
56
|
};
|
package/lib/curve.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ethers, Contract, Networkish, BigNumberish, Numeric } from "ethers";
|
|
1
|
+
import { ethers, Contract, Networkish, BigNumberish, Numeric, BrowserProvider, JsonRpcProvider, Signer } from "ethers";
|
|
2
2
|
import { Provider as MulticallProvider, Contract as MulticallContract } from "@curvefi/ethcall";
|
|
3
|
-
import { IPoolData, IDict, ICurve, INetworkName, IChainId, IFactoryPoolType } from "./interfaces";
|
|
3
|
+
import { IPoolData, IDict, ICurve, INetworkName, IChainId, IFactoryPoolType, Abi } from "./interfaces";
|
|
4
|
+
export declare const memoizedContract: () => (address: string, abi: any, provider: BrowserProvider | JsonRpcProvider | Signer) => Contract;
|
|
5
|
+
export declare const memoizedMulticallContract: () => (address: string, abi: any) => MulticallContract;
|
|
4
6
|
export declare const NATIVE_TOKENS: {
|
|
5
7
|
[index: number]: {
|
|
6
8
|
symbol: string;
|
|
@@ -12,6 +14,11 @@ export declare const NATIVE_TOKENS: {
|
|
|
12
14
|
export declare const NETWORK_CONSTANTS: {
|
|
13
15
|
[index: number]: any;
|
|
14
16
|
};
|
|
17
|
+
export type ContractItem = {
|
|
18
|
+
contract: Contract;
|
|
19
|
+
multicallContract: MulticallContract;
|
|
20
|
+
abi: Abi;
|
|
21
|
+
};
|
|
15
22
|
declare class Curve implements ICurve {
|
|
16
23
|
provider: ethers.BrowserProvider | ethers.JsonRpcProvider;
|
|
17
24
|
multicallProvider: MulticallProvider;
|
|
@@ -19,10 +26,7 @@ declare class Curve implements ICurve {
|
|
|
19
26
|
signerAddress: string;
|
|
20
27
|
chainId: IChainId;
|
|
21
28
|
contracts: {
|
|
22
|
-
[index: string]:
|
|
23
|
-
contract: Contract;
|
|
24
|
-
multicallContract: MulticallContract;
|
|
25
|
-
};
|
|
29
|
+
[index: string]: ContractItem;
|
|
26
30
|
};
|
|
27
31
|
feeData: {
|
|
28
32
|
gasPrice?: number;
|