@curvefi/api 1.25.2 → 2.2.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 +797 -590
- 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 +3 -24
- package/lib/constants/aliases.js +18 -5
- package/lib/constants/coins/avalanche.d.ts +7 -0
- package/lib/constants/coins/avalanche.js +32 -0
- 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/avalanche.d.ts +4 -0
- package/lib/constants/pools/avalanche.js +113 -0
- 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 +4 -0
- package/lib/constants/pools/index.js +9 -0
- package/lib/constants/pools/polygon.d.ts +4 -0
- package/lib/constants/{abis/abis-polygon.js → pools/polygon.js} +52 -80
- package/lib/constants/utils.d.ts +5 -0
- package/lib/constants/utils.js +69 -0
- package/lib/curve.d.ts +13 -31
- package/lib/curve.js +204 -232
- package/lib/external-api.d.ts +4 -3
- package/lib/external-api.js +18 -1
- package/lib/factory/common.d.ts +2 -0
- package/lib/factory/common.js +45 -0
- package/lib/factory/constants.d.ts +16 -16
- package/lib/factory/constants.js +79 -77
- package/lib/factory/factory-api.d.ts +2 -2
- package/lib/factory/factory-api.js +51 -85
- package/lib/factory/factory-crypto.d.ts +2 -2
- package/lib/factory/factory-crypto.js +30 -35
- package/lib/factory/factory.d.ts +2 -2
- package/lib/factory/factory.js +60 -205
- package/lib/index.d.ts +37 -53
- package/lib/index.js +28 -35
- package/lib/interfaces.d.ts +51 -83
- package/lib/pools/PoolTemplate.d.ts +212 -0
- package/lib/pools/PoolTemplate.js +2371 -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 +13 -0
- package/lib/router.js +651 -0
- package/lib/utils.d.ts +12 -16
- package/lib/utils.js +59 -138
- 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 -4752
package/lib/external-api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IExtendedPoolDataFromApi, IReward,
|
|
1
|
+
import { IExtendedPoolDataFromApi, ISubgraphPoolData, IReward, IDict, INetworkName } from "./interfaces";
|
|
2
2
|
import memoize from "memoizee";
|
|
3
|
-
export declare const _getPoolsFromApi: ((network:
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const _getPoolsFromApi: ((network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>) & memoize.Memoized<(network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>>;
|
|
4
|
+
export declare const _getSubgraphData: ((network: INetworkName) => Promise<ISubgraphPoolData[]>) & memoize.Memoized<(network: INetworkName) => Promise<ISubgraphPoolData[]>>;
|
|
5
|
+
export declare const _getMainPoolsGaugeRewards: (() => Promise<IDict<IReward[]>>) & memoize.Memoized<() => Promise<IDict<IReward[]>>>;
|
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._getMainPoolsGaugeRewards = 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,6 +59,23 @@ 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
|
+
});
|
|
62
79
|
exports._getMainPoolsGaugeRewards = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
80
|
var url, response;
|
|
64
81
|
return __generator(this, function (_a) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setFactoryZapContracts = void 0;
|
|
7
|
+
var ethers_1 = require("ethers");
|
|
8
|
+
var ethcall_1 = require("ethcall");
|
|
9
|
+
var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
|
|
10
|
+
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
11
|
+
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
12
|
+
function setFactoryZapContracts() {
|
|
13
|
+
if (this.chainId === 1) {
|
|
14
|
+
var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
|
|
15
|
+
this.contracts[metaSBtcZapAddress] = {
|
|
16
|
+
contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
17
|
+
multicallContract: new ethcall_1.Contract(metaSBtcZapAddress, deposit_json_1.default),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
else if (this.chainId === 137) {
|
|
21
|
+
var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
|
|
22
|
+
this.contracts[metaUsdZapAddress] = {
|
|
23
|
+
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
24
|
+
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
25
|
+
};
|
|
26
|
+
var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
|
|
27
|
+
this.contracts[metaBtcZapAddress] = {
|
|
28
|
+
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
29
|
+
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
else if (this.chainId === 43114) {
|
|
33
|
+
var metaUsdZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
|
|
34
|
+
this.contracts[metaUsdZapAddress] = {
|
|
35
|
+
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
36
|
+
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
37
|
+
};
|
|
38
|
+
var metaBtcZapAddress = "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase();
|
|
39
|
+
this.contracts[metaBtcZapAddress] = {
|
|
40
|
+
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
41
|
+
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.setFactoryZapContracts = setFactoryZapContracts;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const implementationABIDictEthereum:
|
|
3
|
-
export declare const implementationABIDictPolygon:
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const basePoolAddressZapDictEthereum: DictInterface<string>;
|
|
15
|
-
export declare const basePoolAddressZapDictPolygon: DictInterface<string>;
|
|
16
|
-
export declare const blackListPolygon: string[];
|
|
1
|
+
import { IDict } from "../interfaces";
|
|
2
|
+
export declare const implementationABIDictEthereum: IDict<any>;
|
|
3
|
+
export declare const implementationABIDictPolygon: IDict<any>;
|
|
4
|
+
export declare const implementationABIDictAvalanche: IDict<any>;
|
|
5
|
+
export declare const implementationBasePoolAddressDictEthereum: IDict<any>;
|
|
6
|
+
export declare const implementationBasePoolAddressDictPolygon: IDict<any>;
|
|
7
|
+
export declare const implementationBasePoolAddressDictAvalanche: IDict<any>;
|
|
8
|
+
export declare const basePoolAddressIdDictEthereum: IDict<string>;
|
|
9
|
+
export declare const basePoolAddressIdDictPolygon: IDict<string>;
|
|
10
|
+
export declare const basePoolAddressIdDictAvalanche: IDict<string>;
|
|
11
|
+
export declare const basePoolIdZapDictEthereum: IDict<string>;
|
|
12
|
+
export declare const basePoolIdZapDictPolygon: IDict<string>;
|
|
13
|
+
export declare const basePoolIdZapDictAvalanche: IDict<string>;
|
|
17
14
|
export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
18
15
|
export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
16
|
+
export declare const FACTORY_CONSTANTS: {
|
|
17
|
+
[index: number]: any;
|
|
18
|
+
};
|
package/lib/factory/constants.js
CHANGED
|
@@ -3,26 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
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/
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.ETH_ADDRESS = exports.WETH_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.basePoolAddressIdDictAvalanche = exports.basePoolAddressIdDictPolygon = exports.basePoolAddressIdDictEthereum = exports.implementationBasePoolAddressDictAvalanche = exports.implementationBasePoolAddressDictPolygon = exports.implementationBasePoolAddressDictEthereum = exports.implementationABIDictAvalanche = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
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,
|
|
@@ -62,6 +62,24 @@ exports.implementationABIDictPolygon = {
|
|
|
62
62
|
"0xf31bcdf0B9a5eCD7AB463eB905551fBc32e51856": Plain4ETH_json_1.default,
|
|
63
63
|
"0xAc273d5b4FC06625d8b1abA3BE8De15bDFb8E39f": Plain4Optimized_json_1.default,
|
|
64
64
|
};
|
|
65
|
+
exports.implementationABIDictAvalanche = {
|
|
66
|
+
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": MetaUSD_json_1.default,
|
|
67
|
+
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": MetaUSDBalances_json_1.default,
|
|
68
|
+
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": MetaBTCRen_json_1.default,
|
|
69
|
+
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": MetaBTCBalancesRen_json_1.default,
|
|
70
|
+
"0x697434ca761d4F86b553784B69F4f37F5eDf54dF": Plain2Basic_json_1.default,
|
|
71
|
+
"0xBdFF0C27dd073C119ebcb1299a68A6A92aE607F0": Plain2Balances_json_1.default,
|
|
72
|
+
"0x64448B78561690B70E17CBE8029a3e5c1bB7136e": Plain2ETH_json_1.default,
|
|
73
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": Plain2Optimized_json_1.default,
|
|
74
|
+
"0x1de7f0866e2c4adAC7b457c58Cc25c8688CDa1f2": Plain3Basic_json_1.default,
|
|
75
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": Plain3Balances_json_1.default,
|
|
76
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": Plain3ETH_json_1.default,
|
|
77
|
+
"0xaa82ca713D94bBA7A89CEAB55314F9EfFEdDc78c": Plain3Optimized_json_1.default,
|
|
78
|
+
"0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287": Plain4Basic_json_1.default,
|
|
79
|
+
"0x7D86446dDb609eD0F5f8684AcF30380a356b2B4c": Plain4Balances_json_1.default,
|
|
80
|
+
"0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410": Plain4ETH_json_1.default,
|
|
81
|
+
"0xCE94D3E5b0D80565D7B713A687b39a3Dc81780BA": Plain4Optimized_json_1.default,
|
|
82
|
+
};
|
|
65
83
|
exports.implementationBasePoolAddressDictEthereum = {
|
|
66
84
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
67
85
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
@@ -77,73 +95,57 @@ exports.implementationBasePoolAddressDictPolygon = {
|
|
|
77
95
|
"0xC05EB760A135d3D0c839f1141423002681157a17": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67",
|
|
78
96
|
"0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", // ren
|
|
79
97
|
};
|
|
80
|
-
exports.
|
|
98
|
+
exports.implementationBasePoolAddressDictAvalanche = {
|
|
99
|
+
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
|
|
100
|
+
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
|
|
101
|
+
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90",
|
|
102
|
+
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90", // ren
|
|
103
|
+
};
|
|
104
|
+
exports.basePoolAddressIdDictEthereum = {
|
|
81
105
|
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "3pool",
|
|
82
106
|
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "sbtc",
|
|
83
107
|
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "ren",
|
|
84
108
|
};
|
|
85
|
-
exports.
|
|
109
|
+
exports.basePoolAddressIdDictPolygon = {
|
|
86
110
|
"0x445FE580eF8d70FF569aB36e80c647af338db351": "aave",
|
|
87
111
|
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "ren",
|
|
88
112
|
};
|
|
89
|
-
exports.
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": ['renBTC', 'WBTC'], // ren
|
|
93
|
-
};
|
|
94
|
-
exports.basePoolAddressCoinsDictPolygon = {
|
|
95
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": ['DAI', 'USDC', 'USDT'],
|
|
96
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": ['WBTC', 'renBTC'], // ren
|
|
97
|
-
};
|
|
98
|
-
exports.basePoolAddressCoinAddressesDictEthereum = {
|
|
99
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": [
|
|
100
|
-
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
101
|
-
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
102
|
-
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
103
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
104
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": [
|
|
105
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
106
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
107
|
-
'0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6',
|
|
108
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
109
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [
|
|
110
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
111
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
112
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
113
|
+
exports.basePoolAddressIdDictAvalanche = {
|
|
114
|
+
"0x7f90122BF0700F9E7e1F688fe926940E8839F353": "aave",
|
|
115
|
+
"0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90": "ren",
|
|
113
116
|
};
|
|
114
|
-
exports.
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
|
119
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
120
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": [
|
|
121
|
-
'0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
|
122
|
-
'0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
123
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
117
|
+
exports.basePoolIdZapDictEthereum = {
|
|
118
|
+
'3pool': "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
119
|
+
sbtc: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
120
|
+
ren: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // TODO CHECK!!!
|
|
124
121
|
};
|
|
125
|
-
exports.
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [8, 8], // ren
|
|
122
|
+
exports.basePoolIdZapDictPolygon = {
|
|
123
|
+
aave: "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
124
|
+
ren: "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(),
|
|
129
125
|
};
|
|
130
|
-
exports.
|
|
131
|
-
"
|
|
132
|
-
"
|
|
126
|
+
exports.basePoolIdZapDictAvalanche = {
|
|
127
|
+
aave: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
128
|
+
ren: "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase(),
|
|
133
129
|
};
|
|
134
|
-
exports.basePoolAddressZapDictEthereum = {
|
|
135
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
136
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
137
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // ren TODO CHECK!!!
|
|
138
|
-
};
|
|
139
|
-
exports.basePoolAddressZapDictPolygon = {
|
|
140
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
141
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(), // ren
|
|
142
|
-
};
|
|
143
|
-
exports.blackListPolygon = [
|
|
144
|
-
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
145
|
-
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
146
|
-
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
147
|
-
];
|
|
148
130
|
exports.WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
149
131
|
exports.ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
132
|
+
exports.FACTORY_CONSTANTS = {
|
|
133
|
+
1: {
|
|
134
|
+
implementationABIDict: exports.implementationABIDictEthereum,
|
|
135
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictEthereum,
|
|
136
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictEthereum,
|
|
137
|
+
basePoolIdZapDict: exports.basePoolIdZapDictEthereum,
|
|
138
|
+
},
|
|
139
|
+
137: {
|
|
140
|
+
implementationABIDict: exports.implementationABIDictPolygon,
|
|
141
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictPolygon,
|
|
142
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictPolygon,
|
|
143
|
+
basePoolIdZapDict: exports.basePoolIdZapDictPolygon,
|
|
144
|
+
},
|
|
145
|
+
43114: {
|
|
146
|
+
implementationABIDict: exports.implementationABIDictAvalanche,
|
|
147
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictAvalanche,
|
|
148
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictAvalanche,
|
|
149
|
+
basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -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,13 +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
|
|
59
|
-
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/json/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
60
|
-
var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/json/factory-crypto/factory-crypto-pool-2.json"));
|
|
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 factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
|
|
61
59
|
var constants_1 = require("./constants");
|
|
60
|
+
var common_1 = require("./common");
|
|
62
61
|
function setFactorySwapContracts(rawPoolList, isCrypto) {
|
|
63
62
|
var _this = this;
|
|
64
63
|
if (isCrypto) {
|
|
@@ -71,14 +70,13 @@ function setFactorySwapContracts(rawPoolList, isCrypto) {
|
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
else {
|
|
74
|
-
var implementationABIDict_1 = this.chainId
|
|
73
|
+
var implementationABIDict_1 = constants_1.FACTORY_CONSTANTS[this.chainId].implementationABIDict;
|
|
75
74
|
rawPoolList.forEach(function (pool) {
|
|
76
75
|
var addr = pool.address.toLowerCase();
|
|
77
76
|
_this.contracts[addr] = {
|
|
78
77
|
contract: new ethers_1.Contract(addr, implementationABIDict_1[pool.implementationAddress], _this.signer || _this.provider),
|
|
79
78
|
multicallContract: new ethcall_1.Contract(addr, implementationABIDict_1[pool.implementationAddress]),
|
|
80
79
|
};
|
|
81
|
-
_this.constants.LP_TOKENS.push(addr);
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
82
|
}
|
|
@@ -90,7 +88,6 @@ function setCryptoFactoryTokenContracts(rawPoolList) {
|
|
|
90
88
|
contract: new ethers_1.Contract(addr, ERC20_json_1.default, _this.signer || _this.provider),
|
|
91
89
|
multicallContract: new ethcall_1.Contract(addr, ERC20_json_1.default),
|
|
92
90
|
};
|
|
93
|
-
_this.constants.LP_TOKENS.push(addr);
|
|
94
91
|
});
|
|
95
92
|
}
|
|
96
93
|
function setFactoryGaugeContracts(rawPoolList) {
|
|
@@ -102,7 +99,6 @@ function setFactoryGaugeContracts(rawPoolList) {
|
|
|
102
99
|
contract: new ethers_1.Contract(addr, gauge_factory_json_1.default, _this.signer || _this.provider),
|
|
103
100
|
multicallContract: new ethcall_1.Contract(addr, gauge_factory_json_1.default),
|
|
104
101
|
};
|
|
105
|
-
_this.constants.GAUGES.push(addr);
|
|
106
102
|
}
|
|
107
103
|
});
|
|
108
104
|
}
|
|
@@ -118,7 +114,6 @@ function setFactoryCoinsContracts(rawPoolList) {
|
|
|
118
114
|
contract: new ethers_1.Contract(addr, ERC20_json_1.default, this.signer || this.provider),
|
|
119
115
|
multicallContract: new ethcall_1.Contract(addr, ERC20_json_1.default),
|
|
120
116
|
};
|
|
121
|
-
this.constants.DECIMALS_LOWER_CASE[addr] = Number(coin.decimals);
|
|
122
117
|
}
|
|
123
118
|
}
|
|
124
119
|
}
|
|
@@ -135,31 +130,9 @@ function setFactoryRewardCoinsContracts(rawPoolList) {
|
|
|
135
130
|
contract: new ethers_1.Contract(addr, ERC20_json_1.default, this.signer || this.provider),
|
|
136
131
|
multicallContract: new ethcall_1.Contract(addr, ERC20_json_1.default),
|
|
137
132
|
};
|
|
138
|
-
this.constants.DECIMALS_LOWER_CASE[addr] = Number(rewardCoin.decimals);
|
|
139
133
|
}
|
|
140
134
|
}
|
|
141
135
|
}
|
|
142
|
-
function setFactoryZapContracts() {
|
|
143
|
-
if (this.chainId === 137) {
|
|
144
|
-
var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
|
|
145
|
-
this.contracts[metaUsdZapAddress] = {
|
|
146
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
147
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
148
|
-
};
|
|
149
|
-
var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
|
|
150
|
-
this.contracts[metaBtcZapAddress] = {
|
|
151
|
-
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
152
|
-
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
|
|
157
|
-
this.contracts[metaSBtcZapAddress] = {
|
|
158
|
-
contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
159
|
-
multicallContract: new ethcall_1.Contract(metaSBtcZapAddress, deposit_json_1.default),
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
136
|
function getFactoryPoolsDataFromApi(isCrypto) {
|
|
164
137
|
return __awaiter(this, void 0, void 0, function () {
|
|
165
138
|
var network, factoryType, url, response, rawPoolList, mainAddresses, FACTORY_POOLS_DATA;
|
|
@@ -167,7 +140,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
167
140
|
return __generator(this, function (_a) {
|
|
168
141
|
switch (_a.label) {
|
|
169
142
|
case 0:
|
|
170
|
-
network = this.
|
|
143
|
+
network = this.constants.NETWORK_NAME;
|
|
171
144
|
factoryType = isCrypto ? "factory-crypto" : "factory";
|
|
172
145
|
url = "https://api.curve.fi/api/getPools/".concat(network, "/").concat(factoryType);
|
|
173
146
|
return [4 /*yield*/, axios_1.default.get(url)];
|
|
@@ -183,10 +156,10 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
183
156
|
setFactoryCoinsContracts.call(this, rawPoolList);
|
|
184
157
|
setFactoryRewardCoinsContracts.call(this, rawPoolList);
|
|
185
158
|
if (!isCrypto)
|
|
186
|
-
setFactoryZapContracts.call(this);
|
|
159
|
+
common_1.setFactoryZapContracts.call(this);
|
|
187
160
|
FACTORY_POOLS_DATA = {};
|
|
188
161
|
rawPoolList.forEach(function (pool) {
|
|
189
|
-
var _a, _b, _c;
|
|
162
|
+
var _a, _b, _c, _d, _e, _f;
|
|
190
163
|
var coinAddresses = pool.coins.map(function (c) { return c.address.toLowerCase(); });
|
|
191
164
|
var coinNames = pool.coins.map(function (c) { return c.symbol; });
|
|
192
165
|
var coinDecimals = pool.coins.map(function (c) { return Number(c.decimals); });
|
|
@@ -199,93 +172,86 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
199
172
|
full_name: pool.name,
|
|
200
173
|
symbol: pool.symbol,
|
|
201
174
|
reference_asset: "CRYPTO",
|
|
202
|
-
N_COINS: coinAddresses.length,
|
|
203
|
-
is_crypto: true,
|
|
204
|
-
underlying_decimals: coinDecimals,
|
|
205
|
-
decimals: coinDecimals,
|
|
206
|
-
use_lending: coinAddresses.map(function () { return false; }),
|
|
207
|
-
is_plain: coinAddresses.map(function () { return true; }),
|
|
208
|
-
underlying_coins: underlyingCoinNames,
|
|
209
|
-
coins: cryptoCoinNames,
|
|
210
175
|
swap_address: pool.address.toLowerCase(),
|
|
211
176
|
token_address: pool.lpTokenAddress.toLowerCase(),
|
|
212
177
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
|
|
178
|
+
is_crypto: true,
|
|
179
|
+
is_factory: true,
|
|
180
|
+
underlying_coins: underlyingCoinNames,
|
|
181
|
+
wrapped_coins: cryptoCoinNames,
|
|
213
182
|
underlying_coin_addresses: underlyingCoinAddresses,
|
|
214
|
-
|
|
183
|
+
wrapped_coin_addresses: coinAddresses,
|
|
184
|
+
underlying_decimals: coinDecimals,
|
|
185
|
+
wrapped_decimals: coinDecimals,
|
|
215
186
|
reward_tokens: ((_a = pool.gaugeRewards) !== null && _a !== void 0 ? _a : []).map(function (r) { return r.tokenAddress; }),
|
|
187
|
+
reward_decimals: ((_b = pool.gaugeRewards) !== null && _b !== void 0 ? _b : []).map(function (r) { return r.decimals; }),
|
|
216
188
|
swap_abi: factory_crypto_pool_2_json_1.default,
|
|
217
189
|
gauge_abi: gauge_factory_json_1.default,
|
|
218
|
-
is_factory: true,
|
|
219
|
-
is_crypto_factory: true,
|
|
220
190
|
};
|
|
221
191
|
}
|
|
222
192
|
else if (pool.implementation.startsWith("meta")) {
|
|
223
|
-
var implementationABIDict = _this.chainId
|
|
224
|
-
var implementationBasePoolAddressDict = _this.chainId
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
var
|
|
229
|
-
|
|
193
|
+
var implementationABIDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
|
|
194
|
+
var implementationBasePoolAddressDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationBasePoolAddressDict;
|
|
195
|
+
var basePoolAddressIdDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolAddressIdDict; // @ts-ignore
|
|
196
|
+
var basePoolIdCoinsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
|
|
197
|
+
// @ts-ignore
|
|
198
|
+
var basePoolIdCoinAddressesDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
var basePoolIdDecimalsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
|
|
201
|
+
var basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
|
|
230
202
|
var basePoolAddress = implementationBasePoolAddressDict[pool.implementationAddress];
|
|
231
|
-
var
|
|
232
|
-
var
|
|
233
|
-
var
|
|
234
|
-
var
|
|
203
|
+
var basePoolId = basePoolAddressIdDict[basePoolAddress];
|
|
204
|
+
var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
|
|
205
|
+
var basePoolCoinAddresses = basePoolIdCoinAddressesDict[basePoolId];
|
|
206
|
+
var basePoolDecimals = basePoolIdDecimalsDict[basePoolId];
|
|
207
|
+
var basePoolZap = basePoolIdZapDict[basePoolId];
|
|
235
208
|
FACTORY_POOLS_DATA[pool.id] = {
|
|
236
209
|
name: pool.name.split(": ")[1].trim(),
|
|
237
210
|
full_name: pool.name,
|
|
238
211
|
symbol: pool.symbol,
|
|
239
212
|
reference_asset: pool.assetTypeName.toUpperCase(),
|
|
240
|
-
N_COINS: coinAddresses.length,
|
|
241
|
-
underlying_decimals: coinDecimals,
|
|
242
|
-
decimals: coinDecimals,
|
|
243
|
-
use_lending: coinAddresses.map(function () { return false; }),
|
|
244
|
-
is_plain: coinAddresses.map(function () { return true; }),
|
|
245
213
|
swap_address: pool.address.toLowerCase(),
|
|
246
214
|
token_address: pool.address.toLowerCase(),
|
|
247
215
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
|
|
216
|
+
deposit_address: basePoolZap,
|
|
217
|
+
is_meta: true,
|
|
218
|
+
is_factory: true,
|
|
219
|
+
base_pool: basePoolId,
|
|
248
220
|
underlying_coins: __spreadArray([coinNames[0]], basePoolCoinNames, true),
|
|
249
|
-
|
|
250
|
-
underlying_coin_addresses: coinAddresses,
|
|
251
|
-
|
|
252
|
-
|
|
221
|
+
wrapped_coins: coinNames,
|
|
222
|
+
underlying_coin_addresses: __spreadArray([coinAddresses[0]], basePoolCoinAddresses, true),
|
|
223
|
+
wrapped_coin_addresses: coinAddresses,
|
|
224
|
+
underlying_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
|
|
225
|
+
wrapped_decimals: coinDecimals,
|
|
226
|
+
reward_tokens: ((_c = pool.gaugeRewards) !== null && _c !== void 0 ? _c : []).map(function (r) { return r.tokenAddress; }),
|
|
227
|
+
reward_decimals: ((_d = pool.gaugeRewards) !== null && _d !== void 0 ? _d : []).map(function (r) { return r.decimals; }),
|
|
253
228
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
254
229
|
gauge_abi: gauge_factory_json_1.default,
|
|
255
|
-
is_factory: true,
|
|
256
|
-
is_meta_factory: true,
|
|
257
|
-
is_meta: true,
|
|
258
|
-
base_pool: basePoolAddressNameDict[basePoolAddress],
|
|
259
|
-
meta_coin_addresses: basePoolCoinAddresses,
|
|
260
|
-
meta_coin_decimals: __spreadArray([coinDecimals[0]], basePoolDecimals, true),
|
|
261
|
-
deposit_address: basePoolZap,
|
|
262
230
|
deposit_abi: deposit_json_1.default,
|
|
263
231
|
};
|
|
264
232
|
}
|
|
265
233
|
else {
|
|
266
|
-
var implementationABIDict = _this.chainId
|
|
234
|
+
var implementationABIDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
|
|
267
235
|
FACTORY_POOLS_DATA[pool.id] = {
|
|
268
236
|
name: pool.name.split(": ")[1].trim(),
|
|
269
237
|
full_name: pool.name,
|
|
270
238
|
symbol: pool.symbol,
|
|
271
239
|
reference_asset: pool.assetTypeName.toUpperCase(),
|
|
272
|
-
N_COINS: coinAddresses.length,
|
|
273
|
-
underlying_decimals: coinDecimals,
|
|
274
|
-
decimals: coinDecimals,
|
|
275
|
-
use_lending: coinAddresses.map(function () { return false; }),
|
|
276
|
-
is_plain: coinAddresses.map(function () { return true; }),
|
|
277
240
|
swap_address: pool.address.toLowerCase(),
|
|
278
241
|
token_address: pool.address.toLowerCase(),
|
|
279
242
|
gauge_address: pool.gaugeAddress ? pool.gaugeAddress.toLowerCase() : ethers_1.ethers.constants.AddressZero,
|
|
243
|
+
is_plain: true,
|
|
244
|
+
is_factory: true,
|
|
280
245
|
underlying_coins: coinNames,
|
|
281
|
-
|
|
246
|
+
wrapped_coins: coinNames,
|
|
282
247
|
underlying_coin_addresses: coinAddresses,
|
|
283
|
-
|
|
284
|
-
|
|
248
|
+
wrapped_coin_addresses: coinAddresses,
|
|
249
|
+
underlying_decimals: coinDecimals,
|
|
250
|
+
wrapped_decimals: coinDecimals,
|
|
251
|
+
reward_tokens: ((_e = pool.gaugeRewards) !== null && _e !== void 0 ? _e : []).map(function (r) { return r.tokenAddress; }),
|
|
252
|
+
reward_decimals: ((_f = pool.gaugeRewards) !== null && _f !== void 0 ? _f : []).map(function (r) { return r.decimals; }),
|
|
285
253
|
swap_abi: implementationABIDict[pool.implementationAddress],
|
|
286
254
|
gauge_abi: gauge_factory_json_1.default,
|
|
287
|
-
is_factory: true,
|
|
288
|
-
is_plain_factory: true,
|
|
289
255
|
};
|
|
290
256
|
}
|
|
291
257
|
});
|
|
@@ -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>>;
|