@curvefi/api 1.25.0 → 2.0.0
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/README.md +775 -589
- package/docs/v1/README.md +916 -0
- package/lib/boosting.d.ts +12 -12
- package/lib/boosting.js +23 -23
- package/lib/constants/abis/{json/2pool → 2pool}/swap.json +0 -0
- package/lib/constants/abis/{json/3pool → 3pool}/swap.json +0 -0
- package/lib/constants/abis/{json/4pool → 4pool}/swap.json +0 -0
- package/lib/constants/abis/{json/ERC20.json → ERC20.json} +0 -0
- package/lib/constants/abis/{json/aave → aave}/rewards.json +0 -0
- package/lib/constants/abis/{json/aave → aave}/swap.json +0 -0
- package/lib/constants/abis/{json/address_provider.json → address_provider.json} +0 -0
- package/lib/constants/abis/{json/ankreth → ankreth}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/ankreth → ankreth}/swap.json +0 -0
- package/lib/constants/abis/{json/atricrypto3 → atricrypto3}/swap.json +0 -0
- package/lib/constants/abis/{json/atricrypto3 → atricrypto3}/zap.json +0 -0
- package/lib/constants/abis/{json/bbtc → bbtc}/deposit.json +0 -0
- package/lib/constants/abis/{json/bbtc → bbtc}/swap.json +0 -0
- package/lib/constants/abis/{json/busd → busd}/deposit.json +0 -0
- package/lib/constants/abis/{json/busd → busd}/swap.json +0 -0
- package/lib/constants/abis/{json/cERC20.json → cERC20.json} +0 -0
- package/lib/constants/abis/{json/compound → compound}/deposit.json +0 -0
- package/lib/constants/abis/{json/compound → compound}/swap.json +0 -0
- package/lib/constants/abis/{json/crveth → crveth}/swap.json +0 -0
- package/lib/constants/abis/{json/deposit_and_stake.json → deposit_and_stake.json} +0 -0
- package/lib/constants/abis/{json/dusd → dusd}/deposit.json +0 -0
- package/lib/constants/abis/{json/dusd → dusd}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/dusd → dusd}/swap.json +0 -0
- package/lib/constants/abis/{json/eurs → eurs}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/eurs → eurs}/swap.json +0 -0
- package/lib/constants/abis/{json/eursusd → eursusd}/swap.json +0 -0
- package/lib/constants/abis/{json/eurt → eurt}/swap.json +0 -0
- package/lib/constants/abis/{json/eurtusd → eurtusd}/deposit.json +0 -0
- package/lib/constants/abis/{json/eurtusd → eurtusd}/swap.json +0 -0
- package/lib/constants/abis/{json/factory-crypto → factory-crypto}/factory-crypto-pool-2.json +0 -0
- package/lib/constants/abis/{json/factory-crypto.json → factory-crypto.json} +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/DepositZapMetaBtcPolygon.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/DepositZapMetaUsdPolygon.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTC.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTCBalances.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTCBalancesRen.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTCRen.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaUSD.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaUSDBalances.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2Balances.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2Basic.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2ETH.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2Optimized.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3Balances.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3Basic.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3ETH.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3Optimized.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4Balances.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4Basic.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4ETH.json +0 -0
- package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4Optimized.json +0 -0
- package/lib/constants/abis/{json/factory.json → factory.json} +0 -0
- package/lib/constants/abis/{json/factoryPools → factoryPools}/deposit.json +0 -0
- package/lib/constants/abis/{json/factoryPools → factoryPools}/rewards.json +0 -0
- package/lib/constants/abis/{json/factoryPools → factoryPools}/swap.json +0 -0
- package/lib/constants/abis/{json/gauge.json → gauge.json} +0 -0
- package/lib/constants/abis/{json/gauge_factory.json → gauge_factory.json} +0 -0
- package/lib/constants/abis/{json/gauge_rewards_only.json → gauge_rewards_only.json} +0 -0
- package/lib/constants/abis/{json/gauge_synthetix.json → gauge_synthetix.json} +0 -0
- package/lib/constants/abis/{json/gauge_v2.json → gauge_v2.json} +0 -0
- package/lib/constants/abis/{json/gauge_v3.json → gauge_v3.json} +0 -0
- package/lib/constants/abis/{json/gauge_v4.json → gauge_v4.json} +0 -0
- package/lib/constants/abis/{json/gauge_v5.json → gauge_v5.json} +0 -0
- package/lib/constants/abis/{json/gaugecontroller.json → gaugecontroller.json} +0 -0
- package/lib/constants/abis/{json/gusd → gusd}/deposit.json +0 -0
- package/lib/constants/abis/{json/gusd → gusd}/swap.json +0 -0
- package/lib/constants/abis/{json/hbtc → hbtc}/swap.json +0 -0
- package/lib/constants/abis/{json/husd → husd}/deposit.json +0 -0
- package/lib/constants/abis/{json/husd → husd}/swap.json +0 -0
- package/lib/constants/abis/{json/ib → ib}/swap.json +0 -0
- package/lib/constants/abis/{json/iearn → iearn}/deposit.json +0 -0
- package/lib/constants/abis/{json/iearn → iearn}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/iearn → iearn}/swap.json +0 -0
- package/lib/constants/abis/{json/link → link}/swap.json +0 -0
- package/lib/constants/abis/{json/minter.json → minter.json} +0 -0
- package/lib/constants/abis/{json/musd → musd}/deposit.json +0 -0
- package/lib/constants/abis/{json/musd → musd}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/musd → musd}/swap.json +0 -0
- package/lib/constants/abis/{json/obtc → obtc}/deposit.json +0 -0
- package/lib/constants/abis/{json/obtc → obtc}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/obtc → obtc}/swap.json +0 -0
- package/lib/constants/abis/{json/paave → paave}/rewards.json +0 -0
- package/lib/constants/abis/{json/pax → pax}/deposit.json +0 -0
- package/lib/constants/abis/{json/pax → pax}/swap.json +0 -0
- package/lib/constants/abis/{json/pbtc → pbtc}/deposit.json +0 -0
- package/lib/constants/abis/{json/pbtc → pbtc}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/pbtc → pbtc}/swap.json +0 -0
- package/lib/constants/abis/{json/rai → rai}/deposit.json +0 -0
- package/lib/constants/abis/{json/rai → rai}/swap.json +0 -0
- package/lib/constants/abis/{json/registry_exchange.json → registry_exchange.json} +0 -0
- package/lib/constants/abis/{json/ren → ren}/swap.json +0 -0
- package/lib/constants/abis/{json/ren-polygon → ren-polygon}/swap.json +0 -0
- package/lib/constants/abis/{json/reth → reth}/swap.json +0 -0
- package/lib/constants/abis/{json/router.json → router.json} +0 -0
- package/lib/constants/abis/{json/rsv → rsv}/deposit.json +0 -0
- package/lib/constants/abis/{json/rsv → rsv}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/rsv → rsv}/swap.json +0 -0
- package/lib/constants/abis/{json/saave → saave}/swap.json +0 -0
- package/lib/constants/abis/{json/sbtc → sbtc}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/sbtc → sbtc}/swap.json +0 -0
- package/lib/constants/abis/{json/seth → seth}/swap.json +0 -0
- package/lib/constants/abis/{json/steth → steth}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/steth → steth}/swap.json +0 -0
- package/lib/constants/abis/{json/streamer.json → streamer.json} +0 -0
- package/lib/constants/abis/{json/susdv2 → susdv2}/deposit.json +0 -0
- package/lib/constants/abis/{json/susdv2 → susdv2}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/susdv2 → susdv2}/swap.json +0 -0
- package/lib/constants/abis/{json/tbtc → tbtc}/deposit.json +0 -0
- package/lib/constants/abis/{json/tbtc → tbtc}/sCurveRewards.json +0 -0
- package/lib/constants/abis/{json/tbtc → tbtc}/swap.json +0 -0
- package/lib/constants/abis/{json/tricrypto2 → tricrypto2}/deposit.json +0 -0
- package/lib/constants/abis/{json/tricrypto2 → tricrypto2}/swap.json +0 -0
- package/lib/constants/abis/{json/usdk → usdk}/deposit.json +0 -0
- package/lib/constants/abis/{json/usdk → usdk}/swap.json +0 -0
- package/lib/constants/abis/{json/usdn → usdn}/deposit.json +0 -0
- package/lib/constants/abis/{json/usdn → usdn}/swap.json +0 -0
- package/lib/constants/abis/{json/usdp → usdp}/deposit.json +0 -0
- package/lib/constants/abis/{json/usdp → usdp}/swap.json +0 -0
- package/lib/constants/abis/{json/usdt → usdt}/deposit.json +0 -0
- package/lib/constants/abis/{json/usdt → usdt}/swap.json +0 -0
- package/lib/constants/abis/{json/ust → ust}/deposit.json +0 -0
- package/lib/constants/abis/{json/ust → ust}/swap.json +0 -0
- package/lib/constants/abis/{json/votingescrow.json → votingescrow.json} +0 -0
- package/lib/constants/abis/{json/yERC20.json → yERC20.json} +0 -0
- package/lib/constants/aliases.d.ts +2 -24
- package/lib/constants/aliases.js +5 -4
- package/lib/constants/{coins-ethereum.d.ts → coins/ethereum.d.ts} +0 -9
- package/lib/constants/{coins-ethereum.js → coins/ethereum.js} +12 -23
- package/lib/constants/{coins-polygon.d.ts → coins/polygon.d.ts} +0 -12
- package/lib/constants/{coins-polygon.js → coins/polygon.js} +8 -20
- package/lib/constants/pools/ethereum.d.ts +2 -0
- package/lib/constants/{abis/abis-ethereum.js → pools/ethereum.js} +517 -1012
- package/lib/constants/pools/index.d.ts +3 -0
- package/lib/constants/pools/index.js +7 -0
- package/lib/constants/pools/polygon.d.ts +4 -0
- package/lib/constants/{abis/abis-polygon.js → pools/polygon.js} +53 -81
- package/lib/constants/utils.d.ts +5 -0
- package/lib/constants/utils.js +69 -0
- package/lib/curve.d.ts +10 -32
- package/lib/curve.js +189 -232
- package/lib/external-api.d.ts +3 -1
- package/lib/external-api.js +34 -1
- package/lib/factory/constants.d.ts +15 -15
- package/lib/factory/constants.js +19 -19
- package/lib/factory/factory-api.d.ts +2 -2
- package/lib/factory/factory-api.js +52 -45
- package/lib/factory/factory-crypto.d.ts +2 -2
- package/lib/factory/factory-crypto.js +23 -31
- package/lib/factory/factory.d.ts +2 -2
- package/lib/factory/factory.js +53 -66
- package/lib/index.d.ts +36 -53
- package/lib/index.js +27 -35
- package/lib/interfaces.d.ts +35 -72
- package/lib/pools/PoolTemplate.d.ts +210 -0
- package/lib/pools/PoolTemplate.js +2292 -0
- package/lib/pools/index.d.ts +3 -0
- package/lib/pools/index.js +7 -0
- package/lib/pools/mixins/common.d.ts +3 -0
- package/lib/pools/mixins/common.js +77 -0
- package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +5 -0
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +145 -0
- package/lib/pools/mixins/depositBonusMixins.d.ts +5 -0
- package/lib/pools/mixins/depositBonusMixins.js +164 -0
- package/lib/pools/mixins/depositMixins.d.ts +5 -0
- package/lib/pools/mixins/depositMixins.js +373 -0
- package/lib/pools/mixins/depositWrappedMixins.d.ts +3 -0
- package/lib/pools/mixins/depositWrappedMixins.js +243 -0
- package/lib/pools/mixins/poolBalancesMixin.d.ts +4 -0
- package/lib/pools/mixins/poolBalancesMixin.js +129 -0
- package/lib/pools/mixins/swapMixins.d.ts +4 -0
- package/lib/pools/mixins/swapMixins.js +313 -0
- package/lib/pools/mixins/swapWrappedMixins.d.ts +4 -0
- package/lib/pools/mixins/swapWrappedMixins.js +297 -0
- package/lib/pools/mixins/withdrawExpectedMixins.d.ts +6 -0
- package/lib/pools/mixins/withdrawExpectedMixins.js +164 -0
- package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +5 -0
- package/lib/pools/mixins/withdrawImbalanceMixins.js +348 -0
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +3 -0
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +207 -0
- package/lib/pools/mixins/withdrawMixins.d.ts +5 -0
- package/lib/pools/mixins/withdrawMixins.js +347 -0
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +5 -0
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +104 -0
- package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +5 -0
- package/lib/pools/mixins/withdrawOneCoinMixins.js +347 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +3 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +72 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +3 -0
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +205 -0
- package/lib/pools/mixins/withdrawWrappedMixins.d.ts +3 -0
- package/lib/pools/mixins/withdrawWrappedMixins.js +206 -0
- package/lib/pools/poolConstructor.d.ts +2 -0
- package/lib/pools/poolConstructor.js +228 -0
- package/lib/pools/utils.d.ts +4 -0
- package/lib/pools/utils.js +85 -0
- package/lib/router.d.ts +12 -0
- package/lib/router.js +624 -0
- package/lib/utils.d.ts +10 -16
- package/lib/utils.js +43 -130
- package/package.json +1 -1
- package/lib/constants/abis/abis-ethereum.d.ts +0 -4
- package/lib/constants/abis/abis-polygon.d.ts +0 -4
- package/lib/constants/abis/json/aRewards.json +0 -1
- package/lib/constants/abis/json/compound/migration.json +0 -57
- package/lib/constants/abis/json/compound/oldSwap.json +0 -688
- package/lib/constants/abis/json/ren/adapter.json +0 -1
- package/lib/constants/abis/json/sbtc/adapter.json +0 -1
- package/lib/pools.d.ts +0 -267
- package/lib/pools.js +0 -4742
package/lib/external-api.js
CHANGED
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports._getPoolsFromApi = void 0;
|
|
42
|
+
exports._getMainPoolsGaugeRewards = exports._getSubgraphData = exports._getPoolsFromApi = void 0;
|
|
43
43
|
var axios_1 = __importDefault(require("axios"));
|
|
44
44
|
var memoizee_1 = __importDefault(require("memoizee"));
|
|
45
45
|
exports._getPoolsFromApi = (0, memoizee_1.default)(function (network, poolType) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -59,3 +59,36 @@ exports._getPoolsFromApi = (0, memoizee_1.default)(function (network, poolType)
|
|
|
59
59
|
promise: true,
|
|
60
60
|
maxAge: 5 * 60 * 1000, // 5m
|
|
61
61
|
});
|
|
62
|
+
exports._getSubgraphData = (0, memoizee_1.default)(function (network) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
+
var url, response;
|
|
64
|
+
var _a;
|
|
65
|
+
return __generator(this, function (_b) {
|
|
66
|
+
switch (_b.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
url = "https://api.curve.fi/api/getSubgraphData/".concat(network);
|
|
69
|
+
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
70
|
+
case 1:
|
|
71
|
+
response = _b.sent();
|
|
72
|
+
return [2 /*return*/, (_a = response.data.data.poolList) !== null && _a !== void 0 ? _a : []];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); }, {
|
|
76
|
+
promise: true,
|
|
77
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
78
|
+
});
|
|
79
|
+
exports._getMainPoolsGaugeRewards = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
+
var url, response;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
url = "https://api.curve.fi/api/getMainPoolsGaugeRewards";
|
|
85
|
+
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
86
|
+
case 1:
|
|
87
|
+
response = _a.sent();
|
|
88
|
+
return [2 /*return*/, response.data.data.mainPoolsGaugeRewards];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}); }, {
|
|
92
|
+
promise: true,
|
|
93
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
94
|
+
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const implementationABIDictEthereum:
|
|
3
|
-
export declare const implementationABIDictPolygon:
|
|
4
|
-
export declare const implementationBasePoolAddressDictEthereum:
|
|
5
|
-
export declare const implementationBasePoolAddressDictPolygon:
|
|
6
|
-
export declare const basePoolAddressNameDictEthereum:
|
|
7
|
-
export declare const basePoolAddressNameDictPolygon:
|
|
8
|
-
export declare const basePoolAddressCoinsDictEthereum:
|
|
9
|
-
export declare const basePoolAddressCoinsDictPolygon:
|
|
10
|
-
export declare const basePoolAddressCoinAddressesDictEthereum:
|
|
11
|
-
export declare const basePoolAddressCoinAddressesDictPolygon:
|
|
12
|
-
export declare const basePoolAddressDecimalsDictEthereum:
|
|
13
|
-
export declare const basePoolAddressDecimalsDictPolygon:
|
|
14
|
-
export declare const basePoolAddressZapDictEthereum:
|
|
15
|
-
export declare const basePoolAddressZapDictPolygon:
|
|
1
|
+
import { IDict } from "../interfaces";
|
|
2
|
+
export declare const implementationABIDictEthereum: IDict<any>;
|
|
3
|
+
export declare const implementationABIDictPolygon: IDict<any>;
|
|
4
|
+
export declare const implementationBasePoolAddressDictEthereum: IDict<any>;
|
|
5
|
+
export declare const implementationBasePoolAddressDictPolygon: IDict<any>;
|
|
6
|
+
export declare const basePoolAddressNameDictEthereum: IDict<string>;
|
|
7
|
+
export declare const basePoolAddressNameDictPolygon: IDict<string>;
|
|
8
|
+
export declare const basePoolAddressCoinsDictEthereum: IDict<string[]>;
|
|
9
|
+
export declare const basePoolAddressCoinsDictPolygon: IDict<string[]>;
|
|
10
|
+
export declare const basePoolAddressCoinAddressesDictEthereum: IDict<string[]>;
|
|
11
|
+
export declare const basePoolAddressCoinAddressesDictPolygon: IDict<string[]>;
|
|
12
|
+
export declare const basePoolAddressDecimalsDictEthereum: IDict<number[]>;
|
|
13
|
+
export declare const basePoolAddressDecimalsDictPolygon: IDict<number[]>;
|
|
14
|
+
export declare const basePoolAddressZapDictEthereum: IDict<string>;
|
|
15
|
+
export declare const basePoolAddressZapDictPolygon: IDict<string>;
|
|
16
16
|
export declare const blackListPolygon: string[];
|
|
17
17
|
export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
18
18
|
export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
package/lib/factory/constants.js
CHANGED
|
@@ -4,25 +4,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ETH_ADDRESS = exports.WETH_ADDRESS = exports.blackListPolygon = exports.basePoolAddressZapDictPolygon = exports.basePoolAddressZapDictEthereum = exports.basePoolAddressDecimalsDictPolygon = exports.basePoolAddressDecimalsDictEthereum = exports.basePoolAddressCoinAddressesDictPolygon = exports.basePoolAddressCoinAddressesDictEthereum = exports.basePoolAddressCoinsDictPolygon = exports.basePoolAddressCoinsDictEthereum = exports.basePoolAddressNameDictPolygon = exports.basePoolAddressNameDictEthereum = exports.implementationBasePoolAddressDictPolygon = exports.implementationBasePoolAddressDictEthereum = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
7
|
-
var swap_json_1 = __importDefault(require("../constants/abis/
|
|
8
|
-
var MetaUSD_json_1 = __importDefault(require("../constants/abis/
|
|
9
|
-
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/
|
|
10
|
-
var MetaBTC_json_1 = __importDefault(require("../constants/abis/
|
|
11
|
-
var MetaBTCBalances_json_1 = __importDefault(require("../constants/abis/
|
|
12
|
-
var MetaBTCRen_json_1 = __importDefault(require("../constants/abis/
|
|
13
|
-
var MetaBTCBalancesRen_json_1 = __importDefault(require("../constants/abis/
|
|
14
|
-
var Plain2Basic_json_1 = __importDefault(require("../constants/abis/
|
|
15
|
-
var Plain2Balances_json_1 = __importDefault(require("../constants/abis/
|
|
16
|
-
var Plain2ETH_json_1 = __importDefault(require("../constants/abis/
|
|
17
|
-
var Plain2Optimized_json_1 = __importDefault(require("../constants/abis/
|
|
18
|
-
var Plain3Basic_json_1 = __importDefault(require("../constants/abis/
|
|
19
|
-
var Plain3Balances_json_1 = __importDefault(require("../constants/abis/
|
|
20
|
-
var Plain3ETH_json_1 = __importDefault(require("../constants/abis/
|
|
21
|
-
var Plain3Optimized_json_1 = __importDefault(require("../constants/abis/
|
|
22
|
-
var Plain4Basic_json_1 = __importDefault(require("../constants/abis/
|
|
23
|
-
var Plain4Balances_json_1 = __importDefault(require("../constants/abis/
|
|
24
|
-
var Plain4ETH_json_1 = __importDefault(require("../constants/abis/
|
|
25
|
-
var Plain4Optimized_json_1 = __importDefault(require("../constants/abis/
|
|
7
|
+
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
8
|
+
var MetaUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSD.json"));
|
|
9
|
+
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDBalances.json"));
|
|
10
|
+
var MetaBTC_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTC.json"));
|
|
11
|
+
var MetaBTCBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCBalances.json"));
|
|
12
|
+
var MetaBTCRen_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCRen.json"));
|
|
13
|
+
var MetaBTCBalancesRen_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCBalancesRen.json"));
|
|
14
|
+
var Plain2Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2Basic.json"));
|
|
15
|
+
var Plain2Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2Balances.json"));
|
|
16
|
+
var Plain2ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2ETH.json"));
|
|
17
|
+
var Plain2Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain2Optimized.json"));
|
|
18
|
+
var Plain3Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3Basic.json"));
|
|
19
|
+
var Plain3Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3Balances.json"));
|
|
20
|
+
var Plain3ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3ETH.json"));
|
|
21
|
+
var Plain3Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain3Optimized.json"));
|
|
22
|
+
var Plain4Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Basic.json"));
|
|
23
|
+
var Plain4Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Balances.json"));
|
|
24
|
+
var Plain4ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4ETH.json"));
|
|
25
|
+
var Plain4Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Optimized.json"));
|
|
26
26
|
exports.implementationABIDictEthereum = {
|
|
27
27
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": swap_json_1.default,
|
|
28
28
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": MetaUSD_json_1.default,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getFactoryPoolsDataFromApi(this: ICurve, isCrypto: boolean): Promise<
|
|
1
|
+
import { IDict, IPoolData, ICurve } from "../interfaces";
|
|
2
|
+
export declare function getFactoryPoolsDataFromApi(this: ICurve, isCrypto: boolean): Promise<IDict<IPoolData>>;
|
|
@@ -52,12 +52,12 @@ exports.getFactoryPoolsDataFromApi = void 0;
|
|
|
52
52
|
var axios_1 = __importDefault(require("axios"));
|
|
53
53
|
var ethers_1 = require("ethers");
|
|
54
54
|
var ethcall_1 = require("ethcall");
|
|
55
|
-
var gauge_factory_json_1 = __importDefault(require("../constants/abis/
|
|
56
|
-
var deposit_json_1 = __importDefault(require("../constants/abis/
|
|
57
|
-
var ERC20_json_1 = __importDefault(require("../constants/abis/
|
|
58
|
-
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/
|
|
59
|
-
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/
|
|
60
|
-
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/
|
|
55
|
+
var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
|
|
56
|
+
var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
|
|
57
|
+
var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
|
|
58
|
+
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
59
|
+
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
60
|
+
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
|
|
61
61
|
var constants_1 = require("./constants");
|
|
62
62
|
function setFactorySwapContracts(rawPoolList, isCrypto) {
|
|
63
63
|
var _this = this;
|
|
@@ -78,7 +78,6 @@ function setFactorySwapContracts(rawPoolList, isCrypto) {
|
|
|
78
78
|
contract: new ethers_1.Contract(addr, implementationABIDict_1[pool.implementationAddress], _this.signer || _this.provider),
|
|
79
79
|
multicallContract: new ethcall_1.Contract(addr, implementationABIDict_1[pool.implementationAddress]),
|
|
80
80
|
};
|
|
81
|
-
_this.constants.LP_TOKENS.push(addr);
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
}
|
|
@@ -90,7 +89,6 @@ function setCryptoFactoryTokenContracts(rawPoolList) {
|
|
|
90
89
|
contract: new ethers_1.Contract(addr, ERC20_json_1.default, _this.signer || _this.provider),
|
|
91
90
|
multicallContract: new ethcall_1.Contract(addr, ERC20_json_1.default),
|
|
92
91
|
};
|
|
93
|
-
_this.constants.LP_TOKENS.push(addr);
|
|
94
92
|
});
|
|
95
93
|
}
|
|
96
94
|
function setFactoryGaugeContracts(rawPoolList) {
|
|
@@ -102,7 +100,6 @@ function setFactoryGaugeContracts(rawPoolList) {
|
|
|
102
100
|
contract: new ethers_1.Contract(addr, gauge_factory_json_1.default, _this.signer || _this.provider),
|
|
103
101
|
multicallContract: new ethcall_1.Contract(addr, gauge_factory_json_1.default),
|
|
104
102
|
};
|
|
105
|
-
_this.constants.GAUGES.push(addr);
|
|
106
103
|
}
|
|
107
104
|
});
|
|
108
105
|
}
|
|
@@ -118,7 +115,22 @@ function setFactoryCoinsContracts(rawPoolList) {
|
|
|
118
115
|
contract: new ethers_1.Contract(addr, ERC20_json_1.default, this.signer || this.provider),
|
|
119
116
|
multicallContract: new ethcall_1.Contract(addr, ERC20_json_1.default),
|
|
120
117
|
};
|
|
121
|
-
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function setFactoryRewardCoinsContracts(rawPoolList) {
|
|
122
|
+
var _a;
|
|
123
|
+
for (var _i = 0, rawPoolList_2 = rawPoolList; _i < rawPoolList_2.length; _i++) {
|
|
124
|
+
var pool = rawPoolList_2[_i];
|
|
125
|
+
for (var _b = 0, _c = (_a = pool.gaugeRewards) !== null && _a !== void 0 ? _a : []; _b < _c.length; _b++) {
|
|
126
|
+
var rewardCoin = _c[_b];
|
|
127
|
+
var addr = rewardCoin.tokenAddress.toLowerCase();
|
|
128
|
+
if (addr in this.contracts)
|
|
129
|
+
continue;
|
|
130
|
+
this.contracts[addr] = {
|
|
131
|
+
contract: new ethers_1.Contract(addr, ERC20_json_1.default, this.signer || this.provider),
|
|
132
|
+
multicallContract: new ethcall_1.Contract(addr, ERC20_json_1.default),
|
|
133
|
+
};
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
136
|
}
|
|
@@ -164,10 +176,12 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
164
176
|
setCryptoFactoryTokenContracts.call(this, rawPoolList);
|
|
165
177
|
setFactoryGaugeContracts.call(this, rawPoolList);
|
|
166
178
|
setFactoryCoinsContracts.call(this, rawPoolList);
|
|
179
|
+
setFactoryRewardCoinsContracts.call(this, rawPoolList);
|
|
167
180
|
if (!isCrypto)
|
|
168
181
|
setFactoryZapContracts.call(this);
|
|
169
182
|
FACTORY_POOLS_DATA = {};
|
|
170
183
|
rawPoolList.forEach(function (pool) {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f;
|
|
171
185
|
var coinAddresses = pool.coins.map(function (c) { return c.address.toLowerCase(); });
|
|
172
186
|
var coinNames = pool.coins.map(function (c) { return c.symbol; });
|
|
173
187
|
var coinDecimals = pool.coins.map(function (c) { return Number(c.decimals); });
|
|
@@ -180,23 +194,21 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
180
194
|
full_name: pool.name,
|
|
181
195
|
symbol: pool.symbol,
|
|
182
196
|
reference_asset: "CRYPTO",
|
|
183
|
-
N_COINS: coinAddresses.length,
|
|
184
|
-
is_crypto: true,
|
|
185
|
-
underlying_decimals: coinDecimals,
|
|
186
|
-
decimals: coinDecimals,
|
|
187
|
-
use_lending: coinAddresses.map(function () { return false; }),
|
|
188
|
-
is_plain: coinAddresses.map(function () { return true; }),
|
|
189
|
-
underlying_coins: underlyingCoinNames,
|
|
190
|
-
coins: cryptoCoinNames,
|
|
191
197
|
swap_address: pool.address.toLowerCase(),
|
|
192
198
|
token_address: pool.lpTokenAddress.toLowerCase(),
|
|
193
199
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
|
|
200
|
+
is_crypto: true,
|
|
201
|
+
is_factory: true,
|
|
202
|
+
underlying_coins: underlyingCoinNames,
|
|
203
|
+
wrapped_coins: cryptoCoinNames,
|
|
194
204
|
underlying_coin_addresses: underlyingCoinAddresses,
|
|
195
|
-
|
|
205
|
+
wrapped_coin_addresses: coinAddresses,
|
|
206
|
+
underlying_decimals: coinDecimals,
|
|
207
|
+
wrapped_decimals: coinDecimals,
|
|
208
|
+
reward_tokens: ((_a = pool.gaugeRewards) !== null && _a !== void 0 ? _a : []).map(function (r) { return r.tokenAddress; }),
|
|
209
|
+
reward_decimals: ((_b = pool.gaugeRewards) !== null && _b !== void 0 ? _b : []).map(function (r) { return r.decimals; }),
|
|
196
210
|
swap_abi: factory_crypto_pool_2_json_1.default,
|
|
197
211
|
gauge_abi: gauge_factory_json_1.default,
|
|
198
|
-
is_factory: true,
|
|
199
|
-
is_crypto_factory: true,
|
|
200
212
|
};
|
|
201
213
|
}
|
|
202
214
|
else if (pool.implementation.startsWith("meta")) {
|
|
@@ -217,27 +229,23 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
217
229
|
full_name: pool.name,
|
|
218
230
|
symbol: pool.symbol,
|
|
219
231
|
reference_asset: pool.assetTypeName.toUpperCase(),
|
|
220
|
-
N_COINS: coinAddresses.length,
|
|
221
|
-
underlying_decimals: coinDecimals,
|
|
222
|
-
decimals: coinDecimals,
|
|
223
|
-
use_lending: coinAddresses.map(function () { return false; }),
|
|
224
|
-
is_plain: coinAddresses.map(function () { return true; }),
|
|
225
232
|
swap_address: pool.address.toLowerCase(),
|
|
226
233
|
token_address: pool.address.toLowerCase(),
|
|
227
234
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
|
|
235
|
+
deposit_address: basePoolZap,
|
|
236
|
+
is_meta: true,
|
|
237
|
+
is_factory: true,
|
|
238
|
+
base_pool: basePoolAddressNameDict[basePoolAddress],
|
|
228
239
|
underlying_coins: __spreadArray([coinNames[0]], basePoolCoinNames, true),
|
|
229
|
-
|
|
230
|
-
underlying_coin_addresses: coinAddresses,
|
|
231
|
-
|
|
240
|
+
wrapped_coins: coinNames,
|
|
241
|
+
underlying_coin_addresses: __spreadArray([coinAddresses[0]], basePoolCoinAddresses, true),
|
|
242
|
+
wrapped_coin_addresses: coinAddresses,
|
|
243
|
+
underlying_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
|
|
244
|
+
wrapped_decimals: coinDecimals,
|
|
245
|
+
reward_tokens: ((_c = pool.gaugeRewards) !== null && _c !== void 0 ? _c : []).map(function (r) { return r.tokenAddress; }),
|
|
246
|
+
reward_decimals: ((_d = pool.gaugeRewards) !== null && _d !== void 0 ? _d : []).map(function (r) { return r.decimals; }),
|
|
232
247
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
233
248
|
gauge_abi: gauge_factory_json_1.default,
|
|
234
|
-
is_factory: true,
|
|
235
|
-
is_meta_factory: true,
|
|
236
|
-
is_meta: true,
|
|
237
|
-
base_pool: basePoolAddressNameDict[basePoolAddress],
|
|
238
|
-
meta_coin_addresses: basePoolCoinAddresses,
|
|
239
|
-
meta_coin_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
|
|
240
|
-
deposit_address: basePoolZap,
|
|
241
249
|
deposit_abi: deposit_json_1.default,
|
|
242
250
|
};
|
|
243
251
|
}
|
|
@@ -248,22 +256,21 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
248
256
|
full_name: pool.name,
|
|
249
257
|
symbol: pool.symbol,
|
|
250
258
|
reference_asset: pool.assetTypeName.toUpperCase(),
|
|
251
|
-
N_COINS: coinAddresses.length,
|
|
252
|
-
underlying_decimals: coinDecimals,
|
|
253
|
-
decimals: coinDecimals,
|
|
254
|
-
use_lending: coinAddresses.map(function () { return false; }),
|
|
255
|
-
is_plain: coinAddresses.map(function () { return true; }),
|
|
256
259
|
swap_address: pool.address.toLowerCase(),
|
|
257
260
|
token_address: pool.address.toLowerCase(),
|
|
258
261
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
|
|
262
|
+
is_plain: true,
|
|
263
|
+
is_factory: true,
|
|
259
264
|
underlying_coins: coinNames,
|
|
260
|
-
|
|
265
|
+
wrapped_coins: coinNames,
|
|
261
266
|
underlying_coin_addresses: coinAddresses,
|
|
262
|
-
|
|
267
|
+
wrapped_coin_addresses: coinAddresses,
|
|
268
|
+
underlying_decimals: coinDecimals,
|
|
269
|
+
wrapped_decimals: coinDecimals,
|
|
270
|
+
reward_tokens: ((_e = pool.gaugeRewards) !== null && _e !== void 0 ? _e : []).map(function (r) { return r.tokenAddress; }),
|
|
271
|
+
reward_decimals: ((_f = pool.gaugeRewards) !== null && _f !== void 0 ? _f : []).map(function (r) { return r.decimals; }),
|
|
263
272
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
264
273
|
gauge_abi: gauge_factory_json_1.default,
|
|
265
|
-
is_factory: true,
|
|
266
|
-
is_plain_factory: true,
|
|
267
274
|
};
|
|
268
275
|
}
|
|
269
276
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getCryptoFactoryPoolData(this: ICurve): Promise<
|
|
1
|
+
import { IDict, IPoolData, ICurve } from "../interfaces";
|
|
2
|
+
export declare function getCryptoFactoryPoolData(this: ICurve): Promise<IDict<IPoolData>>;
|
|
@@ -42,9 +42,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.getCryptoFactoryPoolData = void 0;
|
|
43
43
|
var ethers_1 = require("ethers");
|
|
44
44
|
var ethcall_1 = require("ethcall");
|
|
45
|
-
var ERC20_json_1 = __importDefault(require("../constants/abis/
|
|
46
|
-
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/
|
|
47
|
-
var gauge_factory_json_1 = __importDefault(require("../constants/abis/
|
|
45
|
+
var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
|
|
46
|
+
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
|
|
47
|
+
var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
|
|
48
48
|
var WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
49
49
|
var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
|
|
50
50
|
function getCryptoFactoryIdsAndSwapAddresses() {
|
|
@@ -205,9 +205,9 @@ function getCryptoFactoryUnderlyingCoinAddresses(coinAddresses) {
|
|
|
205
205
|
function getExistingCoinAddressNameDict() {
|
|
206
206
|
var dict = {};
|
|
207
207
|
var _loop_1 = function (poolData) {
|
|
208
|
-
poolData.
|
|
208
|
+
poolData.wrapped_coin_addresses.forEach(function (addr, i) {
|
|
209
209
|
if (!(addr.toLowerCase() in dict)) {
|
|
210
|
-
dict[addr.toLowerCase()] = poolData.
|
|
210
|
+
dict[addr.toLowerCase()] = poolData.wrapped_coins[i];
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
213
|
poolData.underlying_coin_addresses.forEach(function (addr, i) {
|
|
@@ -287,7 +287,6 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
|
|
|
287
287
|
decimals = (_a.sent()).map(function (_d) { return Number(ethers_1.ethers.utils.formatUnits(_d, 0)); });
|
|
288
288
|
newCoinAddresses.forEach(function (addr, i) {
|
|
289
289
|
coinAddrNamesDict[addr] = decimals[i];
|
|
290
|
-
existingCoinAddressDecimalsDict[addr] = decimals[i]; // Add to DECIMALS_LOWER_CASE TODO move to another place
|
|
291
290
|
});
|
|
292
291
|
return [2 /*return*/, coinAddrNamesDict];
|
|
293
292
|
}
|
|
@@ -297,41 +296,38 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
|
|
|
297
296
|
function getCryptoFactoryPoolData() {
|
|
298
297
|
return __awaiter(this, void 0, void 0, function () {
|
|
299
298
|
var _a, poolIds, swapAddresses, tokenAddresses, gaugeAddresses, _b, poolSymbols, poolNames, coinAddresses, underlyingCoinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, CRYPTO_FACTORY_POOLS_DATA, i;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
switch (_f.label) {
|
|
299
|
+
return __generator(this, function (_c) {
|
|
300
|
+
switch (_c.label) {
|
|
303
301
|
case 0: return [4 /*yield*/, getCryptoFactoryIdsAndSwapAddresses.call(this)];
|
|
304
302
|
case 1:
|
|
305
|
-
_a =
|
|
303
|
+
_a = _c.sent(), poolIds = _a[0], swapAddresses = _a[1];
|
|
306
304
|
setCryptoFactorySwapContracts.call(this, swapAddresses);
|
|
307
305
|
return [4 /*yield*/, getCryptoFactoryTokenAddresses.call(this, swapAddresses)];
|
|
308
306
|
case 2:
|
|
309
|
-
tokenAddresses =
|
|
307
|
+
tokenAddresses = _c.sent();
|
|
310
308
|
setCryptoFactoryTokenContracts.call(this, tokenAddresses);
|
|
311
|
-
(_c = this.constants.LP_TOKENS).push.apply(_c, tokenAddresses); // TODO move to another place
|
|
312
309
|
return [4 /*yield*/, getCryptoFactoryGaugeAddresses.call(this, swapAddresses)];
|
|
313
310
|
case 3:
|
|
314
|
-
gaugeAddresses =
|
|
311
|
+
gaugeAddresses = _c.sent();
|
|
315
312
|
setCryptoFactoryGaugeContracts.call(this, gaugeAddresses);
|
|
316
|
-
(_e = this.constants.GAUGES).push.apply(_e, gaugeAddresses.filter(function (addr) { return addr !== ethers_1.ethers.constants.AddressZero; })); // TODO move to another place
|
|
317
313
|
return [4 /*yield*/, getCryptoFactorySymbolsAndNames.call(this, tokenAddresses)];
|
|
318
314
|
case 4:
|
|
319
|
-
_b =
|
|
315
|
+
_b = _c.sent(), poolSymbols = _b[0], poolNames = _b[1];
|
|
320
316
|
return [4 /*yield*/, getCryptoFactoryCoinAddresses.call(this, swapAddresses)];
|
|
321
317
|
case 5:
|
|
322
|
-
coinAddresses =
|
|
318
|
+
coinAddresses = _c.sent();
|
|
323
319
|
setCryptoFactoryCoinsContracts.call(this, coinAddresses);
|
|
324
320
|
return [4 /*yield*/, getCryptoFactoryUnderlyingCoinAddresses.call(this, coinAddresses)];
|
|
325
321
|
case 6:
|
|
326
|
-
underlyingCoinAddresses =
|
|
322
|
+
underlyingCoinAddresses = _c.sent();
|
|
327
323
|
existingCoinAddressNameDict = getExistingCoinAddressNameDict.call(this);
|
|
328
324
|
return [4 /*yield*/, getCoinAddressNameDict.call(this, coinAddresses, existingCoinAddressNameDict)];
|
|
329
325
|
case 7:
|
|
330
|
-
coinAddressNameDict =
|
|
326
|
+
coinAddressNameDict = _c.sent();
|
|
331
327
|
coinAddressNameDict['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] = 'ETH';
|
|
332
|
-
return [4 /*yield*/, getCoinAddressDecimalsDict.call(this, coinAddresses, this.constants.
|
|
328
|
+
return [4 /*yield*/, getCoinAddressDecimalsDict.call(this, coinAddresses, this.constants.DECIMALS)];
|
|
333
329
|
case 8:
|
|
334
|
-
coinAddressDecimalsDict =
|
|
330
|
+
coinAddressDecimalsDict = _c.sent();
|
|
335
331
|
coinAddressDecimalsDict['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'] = 18;
|
|
336
332
|
CRYPTO_FACTORY_POOLS_DATA = {};
|
|
337
333
|
for (i = 0; i < poolIds.length; i++) {
|
|
@@ -340,23 +336,19 @@ function getCryptoFactoryPoolData() {
|
|
|
340
336
|
full_name: poolNames[i],
|
|
341
337
|
symbol: poolSymbols[i],
|
|
342
338
|
reference_asset: "CRYPTO",
|
|
343
|
-
N_COINS: coinAddresses[i].length,
|
|
344
|
-
is_crypto: true,
|
|
345
|
-
underlying_decimals: underlyingCoinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
|
|
346
|
-
decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
|
|
347
|
-
use_lending: coinAddresses[i].map(function () { return false; }),
|
|
348
|
-
is_plain: coinAddresses[i].map(function () { return true; }),
|
|
349
|
-
underlying_coins: underlyingCoinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
|
|
350
|
-
coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
|
|
351
339
|
swap_address: swapAddresses[i],
|
|
352
340
|
token_address: tokenAddresses[i],
|
|
353
341
|
gauge_address: gaugeAddresses[i],
|
|
342
|
+
is_crypto: true,
|
|
343
|
+
is_factory: true,
|
|
344
|
+
underlying_coins: underlyingCoinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
|
|
345
|
+
wrapped_coins: coinAddresses[i].map(function (addr) { return coinAddressNameDict[addr]; }),
|
|
354
346
|
underlying_coin_addresses: underlyingCoinAddresses[i],
|
|
355
|
-
|
|
347
|
+
wrapped_coin_addresses: coinAddresses[i],
|
|
348
|
+
underlying_decimals: underlyingCoinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
|
|
349
|
+
wrapped_decimals: coinAddresses[i].map(function (addr) { return coinAddressDecimalsDict[addr]; }),
|
|
356
350
|
swap_abi: factory_crypto_pool_2_json_1.default,
|
|
357
351
|
gauge_abi: gauge_factory_json_1.default,
|
|
358
|
-
is_factory: true,
|
|
359
|
-
is_crypto_factory: true,
|
|
360
352
|
};
|
|
361
353
|
}
|
|
362
354
|
return [2 /*return*/, CRYPTO_FACTORY_POOLS_DATA];
|
package/lib/factory/factory.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getFactoryPoolData(this: ICurve): Promise<
|
|
1
|
+
import { IDict, IPoolData, ICurve } from "../interfaces";
|
|
2
|
+
export declare function getFactoryPoolData(this: ICurve): Promise<IDict<IPoolData>>;
|