@curvefi/api 2.56.1 → 2.56.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.
|
@@ -35,9 +35,13 @@ export declare const tricryptoDeployImplementations: {
|
|
|
35
35
|
implementationIdx: number;
|
|
36
36
|
};
|
|
37
37
|
324: {
|
|
38
|
+
amm_native_transfers_disabled: string;
|
|
39
|
+
amm_native_transfers_enabled: string;
|
|
38
40
|
implementationIdx: number;
|
|
39
41
|
};
|
|
40
42
|
1284: {
|
|
43
|
+
amm_native_transfers_disabled: string;
|
|
44
|
+
amm_native_transfers_enabled: string;
|
|
41
45
|
implementationIdx: number;
|
|
42
46
|
};
|
|
43
47
|
2222: {
|
|
@@ -1,73 +1,77 @@
|
|
|
1
1
|
export var tricryptoDeployImplementations = {
|
|
2
2
|
1: {
|
|
3
|
-
amm_native_transfers_disabled: '0x0000000000000000000000000000000000000000',
|
|
4
|
-
amm_native_transfers_enabled: '0x66442B0C5260B92cAa9c234ECf2408CBf6b19a6f',
|
|
3
|
+
amm_native_transfers_disabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
|
|
4
|
+
amm_native_transfers_enabled: '0x66442B0C5260B92cAa9c234ECf2408CBf6b19a6f'.toLowerCase(),
|
|
5
5
|
implementationIdx: 0,
|
|
6
6
|
},
|
|
7
7
|
10: {
|
|
8
|
-
amm_native_transfers_disabled: '0x0458ea5F4CD00E873264Be2031Ceb8f9d9b3116c',
|
|
9
|
-
amm_native_transfers_enabled: '0x1FE2a06c8bd81AE65FD1C5036451890b37976369',
|
|
8
|
+
amm_native_transfers_disabled: '0x0458ea5F4CD00E873264Be2031Ceb8f9d9b3116c'.toLowerCase(),
|
|
9
|
+
amm_native_transfers_enabled: '0x1FE2a06c8bd81AE65FD1C5036451890b37976369'.toLowerCase(),
|
|
10
10
|
implementationIdx: 1,
|
|
11
11
|
},
|
|
12
12
|
56: {
|
|
13
|
-
amm_native_transfers_disabled: '0x6A8cbed756804B16E05E741eDaBd5cB544AE21bf',
|
|
14
|
-
amm_native_transfers_enabled: '0xBff334F8D5912AC5c4f2c590A2396d1C5d990123',
|
|
13
|
+
amm_native_transfers_disabled: '0x6A8cbed756804B16E05E741eDaBd5cB544AE21bf'.toLowerCase(),
|
|
14
|
+
amm_native_transfers_enabled: '0xBff334F8D5912AC5c4f2c590A2396d1C5d990123'.toLowerCase(),
|
|
15
15
|
implementationIdx: 1,
|
|
16
16
|
},
|
|
17
17
|
100: {
|
|
18
|
-
amm_native_transfers_disabled: '0x3f445D38E820c010a7A6E33c5F80cBEBE6930f61',
|
|
19
|
-
amm_native_transfers_enabled: '0xa54f3c1dfa5f7dbf2564829d14b3b74a65d26ae2',
|
|
18
|
+
amm_native_transfers_disabled: '0x3f445D38E820c010a7A6E33c5F80cBEBE6930f61'.toLowerCase(),
|
|
19
|
+
amm_native_transfers_enabled: '0xa54f3c1dfa5f7dbf2564829d14b3b74a65d26ae2'.toLowerCase(),
|
|
20
20
|
implementationIdx: 1,
|
|
21
21
|
},
|
|
22
22
|
137: {
|
|
23
|
-
amm_native_transfers_disabled: '0x3d6cB2F6DcF47CDd9C13E4e3beAe9af041d8796a',
|
|
24
|
-
amm_native_transfers_enabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf',
|
|
23
|
+
amm_native_transfers_disabled: '0x3d6cB2F6DcF47CDd9C13E4e3beAe9af041d8796a'.toLowerCase(),
|
|
24
|
+
amm_native_transfers_enabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf'.toLowerCase(),
|
|
25
25
|
implementationIdx: 1,
|
|
26
26
|
},
|
|
27
27
|
250: {
|
|
28
|
-
amm_native_transfers_disabled: '0xd125E7a0cEddF89c6473412d85835450897be6Dc',
|
|
29
|
-
amm_native_transfers_enabled: '0x76303e4fDcA0AbF28aB3ee42Ce086E6503431F1D',
|
|
28
|
+
amm_native_transfers_disabled: '0xd125E7a0cEddF89c6473412d85835450897be6Dc'.toLowerCase(),
|
|
29
|
+
amm_native_transfers_enabled: '0x76303e4fDcA0AbF28aB3ee42Ce086E6503431F1D'.toLowerCase(),
|
|
30
30
|
implementationIdx: 1,
|
|
31
31
|
},
|
|
32
32
|
252: {
|
|
33
|
-
amm_native_transfers_disabled: '0x1A83348F9cCFD3Fe1A8C0adBa580Ac4e267Fe495',
|
|
34
|
-
amm_native_transfers_enabled: '0xd3b17f862956464ae4403ccf829ce69199856e1e',
|
|
33
|
+
amm_native_transfers_disabled: '0x1A83348F9cCFD3Fe1A8C0adBa580Ac4e267Fe495'.toLowerCase(),
|
|
34
|
+
amm_native_transfers_enabled: '0xd3b17f862956464ae4403ccf829ce69199856e1e'.toLowerCase(),
|
|
35
35
|
implementationIdx: 1,
|
|
36
36
|
},
|
|
37
37
|
324: {
|
|
38
|
+
amm_native_transfers_disabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
|
|
39
|
+
amm_native_transfers_enabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
|
|
38
40
|
implementationIdx: 0,
|
|
39
41
|
},
|
|
40
42
|
1284: {
|
|
43
|
+
amm_native_transfers_disabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
|
|
44
|
+
amm_native_transfers_enabled: '0x0000000000000000000000000000000000000000'.toLowerCase(),
|
|
41
45
|
implementationIdx: 0,
|
|
42
46
|
},
|
|
43
47
|
2222: {
|
|
44
|
-
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf',
|
|
45
|
-
amm_native_transfers_enabled: '0xFAbC421e3368D158d802684A217a83c083c94CeB',
|
|
48
|
+
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf'.toLowerCase(),
|
|
49
|
+
amm_native_transfers_enabled: '0xFAbC421e3368D158d802684A217a83c083c94CeB'.toLowerCase(),
|
|
46
50
|
implementationIdx: 1,
|
|
47
51
|
},
|
|
48
52
|
8453: {
|
|
49
|
-
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf',
|
|
50
|
-
amm_native_transfers_enabled: '0xa274c88e09fDF1798a7517096557e6c1bEa1f65A',
|
|
53
|
+
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf'.toLowerCase(),
|
|
54
|
+
amm_native_transfers_enabled: '0xa274c88e09fDF1798a7517096557e6c1bEa1f65A'.toLowerCase(),
|
|
51
55
|
implementationIdx: 1,
|
|
52
56
|
},
|
|
53
57
|
42161: {
|
|
54
|
-
amm_native_transfers_disabled: '0x1f7C86AffE5bCF7a1D74a8c8E2ef9E03BF31c1BD',
|
|
55
|
-
amm_native_transfers_enabled: '0xd7E72f3615aa65b92A4DBdC211E296a35512988B',
|
|
58
|
+
amm_native_transfers_disabled: '0x1f7C86AffE5bCF7a1D74a8c8E2ef9E03BF31c1BD'.toLowerCase(),
|
|
59
|
+
amm_native_transfers_enabled: '0xd7E72f3615aa65b92A4DBdC211E296a35512988B'.toLowerCase(),
|
|
56
60
|
implementationIdx: 1,
|
|
57
61
|
},
|
|
58
62
|
42220: {
|
|
59
|
-
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf',
|
|
60
|
-
amm_native_transfers_enabled: '0xFAbC421e3368D158d802684A217a83c083c94CeB',
|
|
63
|
+
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf'.toLowerCase(),
|
|
64
|
+
amm_native_transfers_enabled: '0xFAbC421e3368D158d802684A217a83c083c94CeB'.toLowerCase(),
|
|
61
65
|
implementationIdx: 1,
|
|
62
66
|
},
|
|
63
67
|
43114: {
|
|
64
|
-
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf',
|
|
65
|
-
amm_native_transfers_enabled: '0xFAbC421e3368D158d802684A217a83c083c94CeB',
|
|
68
|
+
amm_native_transfers_disabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf'.toLowerCase(),
|
|
69
|
+
amm_native_transfers_enabled: '0xFAbC421e3368D158d802684A217a83c083c94CeB'.toLowerCase(),
|
|
66
70
|
implementationIdx: 1,
|
|
67
71
|
},
|
|
68
72
|
1313161554: {
|
|
69
|
-
amm_native_transfers_disabled: '0x3d6cB2F6DcF47CDd9C13E4e3beAe9af041d8796a',
|
|
70
|
-
amm_native_transfers_enabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf',
|
|
73
|
+
amm_native_transfers_disabled: '0x3d6cB2F6DcF47CDd9C13E4e3beAe9af041d8796a'.toLowerCase(),
|
|
74
|
+
amm_native_transfers_enabled: '0x0c59d36b23f809f8b6C7cb4c8C590a0AC103baEf'.toLowerCase(),
|
|
71
75
|
implementationIdx: 1,
|
|
72
76
|
},
|
|
73
77
|
};
|
|
@@ -59,12 +59,14 @@ import factoryGaugeABI from "../constants/abis/gauge_factory.json" assert { type
|
|
|
59
59
|
import gaugeChildABI from "../constants/abis/gauge_child.json" assert { type: 'json' };
|
|
60
60
|
import ERC20ABI from "../constants/abis/ERC20.json" assert { type: 'json' };
|
|
61
61
|
import cryptoFactorySwapABI from "../constants/abis/factory-crypto/factory-crypto-pool-2.json" assert { type: 'json' };
|
|
62
|
+
import twocryptoFactorySwapABI from "../constants/abis/factory-twocrypto/factory-twocrypto-pool.json" assert { type: 'json' };
|
|
62
63
|
import tricryptoFactorySwapABI from "../constants/abis/factory-tricrypto/factory-tricrypto-pool.json" assert { type: 'json' };
|
|
63
64
|
import { FACTORY_CONSTANTS } from "./constants.js";
|
|
64
65
|
import { CRYPTO_FACTORY_CONSTANTS } from "./constants-crypto.js";
|
|
65
66
|
import { getPoolIdByAddress, setFactoryZapContracts } from "./common.js";
|
|
66
67
|
import { _getPoolsFromApi } from "../external-api.js";
|
|
67
68
|
import { assetTypeNameHandler, getPoolName, isStableNgPool } from "../utils.js";
|
|
69
|
+
import { tricryptoDeployImplementations } from "../constants/tricryptoDeployImplementations";
|
|
68
70
|
export var lowerCasePoolDataAddresses = function (poolsData) {
|
|
69
71
|
var _a;
|
|
70
72
|
for (var _i = 0, poolsData_1 = poolsData; _i < poolsData_1.length; _i++) {
|
|
@@ -95,6 +97,11 @@ function setFactorySwapContracts(rawPoolList, factoryType) {
|
|
|
95
97
|
_this.setContract(pool.address, cryptoFactorySwapABI);
|
|
96
98
|
});
|
|
97
99
|
}
|
|
100
|
+
else if (factoryType === "factory-twocrypto") {
|
|
101
|
+
rawPoolList.forEach(function (pool) {
|
|
102
|
+
_this.setContract(pool.address, twocryptoFactorySwapABI);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
98
105
|
else if (factoryType === "factory-tricrypto") {
|
|
99
106
|
rawPoolList.forEach(function (pool) {
|
|
100
107
|
_this.setContract(pool.address, tricryptoFactorySwapABI);
|
|
@@ -132,6 +139,14 @@ function setFactoryCoinsContracts(rawPoolList) {
|
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
141
|
}
|
|
142
|
+
var getSwapAbiByFactoryType = function (factoryType) {
|
|
143
|
+
var map = {
|
|
144
|
+
"factory-crypto": cryptoFactorySwapABI,
|
|
145
|
+
"factory-twocrypto": twocryptoFactorySwapABI,
|
|
146
|
+
"facroty-tricrypto": tricryptoFactorySwapABI,
|
|
147
|
+
};
|
|
148
|
+
return map[factoryType];
|
|
149
|
+
};
|
|
135
150
|
export function getFactoryPoolsDataFromApi(factoryType) {
|
|
136
151
|
return __awaiter(this, void 0, void 0, function () {
|
|
137
152
|
var network, isCrypto, rawPoolList, _a, mainAddresses, FACTORY_POOLS_DATA;
|
|
@@ -168,13 +183,45 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
168
183
|
var coinDecimals = pool.coins.map(function (c) { return Number(c.decimals); });
|
|
169
184
|
if (isCrypto) {
|
|
170
185
|
var wrappedCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.symbol ? nativeToken.wrappedSymbol : c.symbol; });
|
|
171
|
-
var underlyingCoinNames = pool.coins.map(function (c) {
|
|
172
|
-
|
|
173
|
-
|
|
186
|
+
var underlyingCoinNames = pool.coins.map(function (c) {
|
|
187
|
+
if (factoryType === 'factory-twocrypto') {
|
|
188
|
+
return c.symbol;
|
|
189
|
+
}
|
|
190
|
+
else if (factoryType === 'factory-tricrypto') {
|
|
191
|
+
var isETHEnabled = pool.implementationAddress === tricryptoDeployImplementations[curve.chainId].amm_native_transfers_enabled;
|
|
192
|
+
if (isETHEnabled) {
|
|
193
|
+
return c.symbol;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return c.symbol === nativeToken.wrappedSymbol ? nativeToken.symbol : c.symbol;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return c.symbol === nativeToken.wrappedSymbol ? nativeToken.symbol : c.symbol;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
var underlyingCoinAddresses = coinAddresses.map(function (addr) {
|
|
204
|
+
if (factoryType === 'factory-twocrypto') {
|
|
205
|
+
return addr;
|
|
206
|
+
}
|
|
207
|
+
else if (factoryType === 'factory-tricrypto') {
|
|
208
|
+
var isETHEnabled = pool.implementationAddress === tricryptoDeployImplementations[curve.chainId].amm_native_transfers_enabled;
|
|
209
|
+
if (isETHEnabled) {
|
|
210
|
+
return addr;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
return addr === nativeToken.wrappedAddress ? nativeToken.address : addr;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return addr === nativeToken.wrappedAddress ? nativeToken.address : addr;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
var isPlain = underlyingCoinNames.toString() === wrappedCoinNames.toString();
|
|
174
221
|
var lpTokenBasePoolIdDict = CRYPTO_FACTORY_CONSTANTS[_this.chainId].lpTokenBasePoolIdDict;
|
|
175
222
|
var basePoolIdZapDict = CRYPTO_FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
|
|
176
223
|
var basePoolId = lpTokenBasePoolIdDict[coinAddresses[1]];
|
|
177
|
-
if (factoryType !== "factory-tricrypto" && basePoolId) { // isMeta
|
|
224
|
+
if (factoryType !== "factory-tricrypto" && factoryType !== "factory-twocrypto" && basePoolId) { // isMeta
|
|
178
225
|
var allPoolsData = __assign(__assign({}, _this.constants.POOLS_DATA), FACTORY_POOLS_DATA);
|
|
179
226
|
var basePoolCoinNames = __spreadArray([], allPoolsData[basePoolId].underlying_coins, true);
|
|
180
227
|
var basePoolCoinAddresses = __spreadArray([], allPoolsData[basePoolId].underlying_coin_addresses, true);
|
|
@@ -224,7 +271,7 @@ export function getFactoryPoolsDataFromApi(factoryType) {
|
|
|
224
271
|
wrapped_coin_addresses: coinAddresses,
|
|
225
272
|
underlying_decimals: coinDecimals,
|
|
226
273
|
wrapped_decimals: coinDecimals,
|
|
227
|
-
swap_abi: factoryType
|
|
274
|
+
swap_abi: getSwapAbiByFactoryType(factoryType),
|
|
228
275
|
gauge_abi: _this.chainId === 1 ? factoryGaugeABI : gaugeChildABI,
|
|
229
276
|
in_api: true,
|
|
230
277
|
is_stable_ng: false,
|
|
@@ -192,8 +192,7 @@ function setTwocryptoFactoryCoinsContracts(coinAddresses) {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
function getTwocryptoFactoryUnderlyingCoinAddresses(coinAddresses) {
|
|
195
|
-
|
|
196
|
-
return __spreadArray([], coinAddresses.map(function (coins) { return coins.map(function (c) { return c === _this.constants.NATIVE_TOKEN.wrappedAddress ? _this.constants.NATIVE_TOKEN.address : c; }); }), true);
|
|
195
|
+
return __spreadArray([], coinAddresses.map(function (coins) { return coins.map(function (c) { return c; }); }), true);
|
|
197
196
|
}
|
|
198
197
|
function getExistingCoinAddressNameDict() {
|
|
199
198
|
var dict = {};
|