@curvefi/api 2.8.8 → 2.9.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/lib/constants/aliases.d.ts +1 -0
- package/lib/constants/aliases.js +13 -1
- package/lib/constants/coins/moonbeam.d.ts +7 -0
- package/lib/constants/coins/moonbeam.js +16 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +3 -1
- package/lib/constants/pools/moonbeam.d.ts +4 -0
- package/lib/constants/pools/moonbeam.js +37 -0
- package/lib/curve.d.ts +1 -0
- package/lib/curve.js +17 -0
- package/lib/external-api.d.ts +22 -0
- package/lib/external-api.js +41 -1
- package/lib/factory/common.js +9 -94
- package/lib/factory/constants.d.ts +38 -8
- package/lib/factory/constants.js +102 -18
- package/lib/factory/factory-api.js +1 -1
- package/lib/factory/factory-crypto.js +2 -0
- package/lib/factory/factory.js +4 -1
- package/lib/interfaces.d.ts +2 -0
- package/lib/pools/PoolTemplate.js +58 -17
- package/lib/utils.js +12 -6
- package/package.json +2 -2
|
@@ -5,3 +5,4 @@ export declare const ALIASES_AVALANCHE: import("../interfaces").IDict<string>;
|
|
|
5
5
|
export declare const ALIASES_ARBITRUM: import("../interfaces").IDict<string>;
|
|
6
6
|
export declare const ALIASES_OPTIMISM: import("../interfaces").IDict<string>;
|
|
7
7
|
export declare const ALIASES_XDAI: import("../interfaces").IDict<string>;
|
|
8
|
+
export declare const ALIASES_MOONBEAM: import("../interfaces").IDict<string>;
|
package/lib/constants/aliases.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALIASES_XDAI = exports.ALIASES_OPTIMISM = exports.ALIASES_ARBITRUM = exports.ALIASES_AVALANCHE = exports.ALIASES_FANTOM = exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
3
|
+
exports.ALIASES_MOONBEAM = exports.ALIASES_XDAI = exports.ALIASES_OPTIMISM = exports.ALIASES_ARBITRUM = exports.ALIASES_AVALANCHE = exports.ALIASES_FANTOM = exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
exports.ALIASES_ETHEREUM = (0, utils_1.lowerCaseValues)({
|
|
6
6
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
@@ -86,3 +86,15 @@ exports.ALIASES_XDAI = (0, utils_1.lowerCaseValues)({
|
|
|
86
86
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
87
87
|
"registry_exchange": "",
|
|
88
88
|
});
|
|
89
|
+
exports.ALIASES_MOONBEAM = (0, utils_1.lowerCaseValues)({
|
|
90
|
+
"crv": "0x7C598c96D02398d89FbCb9d41Eab3DF0C16F227D",
|
|
91
|
+
"minter": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
|
|
92
|
+
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
93
|
+
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
94
|
+
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
95
|
+
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
96
|
+
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
97
|
+
"factory": '0x4244eB811D6e0Ef302326675207A95113dB4E1F8',
|
|
98
|
+
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
99
|
+
"registry_exchange": "",
|
|
100
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aTokensMoonbeam = exports.ycTokensMoonbeam = exports.yTokensMoonbeam = exports.cTokensMoonbeam = exports.COINS_MOONBEAM = void 0;
|
|
4
|
+
var utils_1 = require("../utils");
|
|
5
|
+
exports.COINS_MOONBEAM = (0, utils_1.lowerCaseValues)({
|
|
6
|
+
'crv': '0x712b3d230f3c1c19db860d80619288b1f0bdd0bd',
|
|
7
|
+
// --- USD ---
|
|
8
|
+
'dai': '0xc234A67a4F840E61adE794be47de455361b52413',
|
|
9
|
+
'usdc': '0x8f552a71EFE5eeFc207Bf75485b356A0b3f01eC9',
|
|
10
|
+
'usdt': '0x8e70cD5B4Ff3f62659049e74b6649c6603A0E594',
|
|
11
|
+
'3crv': '0xace58a26b8db90498ef0330fdc9c2655db0c45e2',
|
|
12
|
+
});
|
|
13
|
+
exports.cTokensMoonbeam = []; //.map((a) => a.toLowerCase());
|
|
14
|
+
exports.yTokensMoonbeam = []; //.map((a) => a.toLowerCase());
|
|
15
|
+
exports.ycTokensMoonbeam = []; //.map((a) => a.toLowerCase());
|
|
16
|
+
exports.aTokensMoonbeam = []; //.map((a) => a.toLowerCase());
|
|
@@ -5,4 +5,5 @@ import { POOLS_DATA_AVALANCHE } from "./avalanche";
|
|
|
5
5
|
import { POOLS_DATA_ARBITRUM } from "./arbitrum";
|
|
6
6
|
import { POOLS_DATA_OPTIMISM } from "./optimism";
|
|
7
7
|
import { POOLS_DATA_XDAI } from "./xdai";
|
|
8
|
-
|
|
8
|
+
import { POOLS_DATA_MOONBEAM } from "./moonbeam";
|
|
9
|
+
export { POOLS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, POOLS_DATA_MOONBEAM, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.POOLS_DATA_XDAI = exports.POOLS_DATA_OPTIMISM = exports.POOLS_DATA_ARBITRUM = exports.POOLS_DATA_AVALANCHE = exports.POOLS_DATA_FANTOM = exports.POOLS_DATA_POLYGON = exports.POOLS_DATA_ETHEREUM = void 0;
|
|
3
|
+
exports.POOLS_DATA_MOONBEAM = exports.POOLS_DATA_XDAI = exports.POOLS_DATA_OPTIMISM = exports.POOLS_DATA_ARBITRUM = exports.POOLS_DATA_AVALANCHE = exports.POOLS_DATA_FANTOM = exports.POOLS_DATA_POLYGON = exports.POOLS_DATA_ETHEREUM = void 0;
|
|
4
4
|
var ethereum_1 = require("./ethereum");
|
|
5
5
|
Object.defineProperty(exports, "POOLS_DATA_ETHEREUM", { enumerable: true, get: function () { return ethereum_1.POOLS_DATA_ETHEREUM; } });
|
|
6
6
|
var polygon_1 = require("./polygon");
|
|
@@ -15,3 +15,5 @@ var optimism_1 = require("./optimism");
|
|
|
15
15
|
Object.defineProperty(exports, "POOLS_DATA_OPTIMISM", { enumerable: true, get: function () { return optimism_1.POOLS_DATA_OPTIMISM; } });
|
|
16
16
|
var xdai_1 = require("./xdai");
|
|
17
17
|
Object.defineProperty(exports, "POOLS_DATA_XDAI", { enumerable: true, get: function () { return xdai_1.POOLS_DATA_XDAI; } });
|
|
18
|
+
var moonbeam_1 = require("./moonbeam");
|
|
19
|
+
Object.defineProperty(exports, "POOLS_DATA_MOONBEAM", { enumerable: true, get: function () { return moonbeam_1.POOLS_DATA_MOONBEAM; } });
|
|
@@ -0,0 +1,37 @@
|
|
|
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.POOLS_DATA_MOONBEAM = void 0;
|
|
7
|
+
var swap_json_1 = __importDefault(require("../abis/3pool-optimism/swap.json"));
|
|
8
|
+
var gauge_child_json_1 = __importDefault(require("../abis/gauge_child.json"));
|
|
9
|
+
var utils_1 = require("../utils");
|
|
10
|
+
exports.POOLS_DATA_MOONBEAM = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
11
|
+
'3pool': {
|
|
12
|
+
name: "3pool",
|
|
13
|
+
full_name: "3pool",
|
|
14
|
+
symbol: "3pool",
|
|
15
|
+
reference_asset: 'USD',
|
|
16
|
+
swap_address: '0xace58a26b8db90498ef0330fdc9c2655db0c45e2',
|
|
17
|
+
token_address: '0xace58a26b8db90498ef0330fdc9c2655db0c45e2',
|
|
18
|
+
gauge_address: '0x0000000000000000000000000000000000000000',
|
|
19
|
+
is_plain: true,
|
|
20
|
+
underlying_coins: ['DAI', 'USDC', 'USDT'],
|
|
21
|
+
wrapped_coins: ['DAI', 'USDC', 'USDT'],
|
|
22
|
+
underlying_coin_addresses: [
|
|
23
|
+
'0xc234A67a4F840E61adE794be47de455361b52413',
|
|
24
|
+
'0x8f552a71EFE5eeFc207Bf75485b356A0b3f01eC9',
|
|
25
|
+
'0x8e70cD5B4Ff3f62659049e74b6649c6603A0E594',
|
|
26
|
+
],
|
|
27
|
+
wrapped_coin_addresses: [
|
|
28
|
+
'0xc234A67a4F840E61adE794be47de455361b52413',
|
|
29
|
+
'0x8f552a71EFE5eeFc207Bf75485b356A0b3f01eC9',
|
|
30
|
+
'0x8e70cD5B4Ff3f62659049e74b6649c6603A0E594',
|
|
31
|
+
],
|
|
32
|
+
underlying_decimals: [18, 6, 6],
|
|
33
|
+
wrapped_decimals: [18, 6, 6],
|
|
34
|
+
swap_abi: swap_json_1.default,
|
|
35
|
+
gauge_abi: gauge_child_json_1.default,
|
|
36
|
+
},
|
|
37
|
+
});
|
package/lib/curve.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ declare class Curve implements ICurve {
|
|
|
55
55
|
maxPriorityFeePerGas?: number;
|
|
56
56
|
chainId?: number;
|
|
57
57
|
}): Promise<void>;
|
|
58
|
+
setContract(address: string, abi: any): void;
|
|
58
59
|
fetchFactoryPools(useApi?: boolean): Promise<void>;
|
|
59
60
|
fetchCryptoFactoryPools(useApi?: boolean): Promise<void>;
|
|
60
61
|
setCustomFeeData(customFeeData: {
|
package/lib/curve.js
CHANGED
|
@@ -88,6 +88,7 @@ var fantom_1 = require("./constants/coins/fantom");
|
|
|
88
88
|
var avalanche_1 = require("./constants/coins/avalanche");
|
|
89
89
|
var arbitrum_1 = require("./constants/coins/arbitrum");
|
|
90
90
|
var xdai_1 = require("./constants/coins/xdai");
|
|
91
|
+
var moonbeam_1 = require("./constants/coins/moonbeam");
|
|
91
92
|
var utils_1 = require("./constants/utils");
|
|
92
93
|
exports.NETWORK_CONSTANTS = {
|
|
93
94
|
1: {
|
|
@@ -140,6 +141,16 @@ exports.NETWORK_CONSTANTS = {
|
|
|
140
141
|
ycTokens: fantom_1.ycTokensFantom,
|
|
141
142
|
aTokens: fantom_1.aTokensFantom,
|
|
142
143
|
},
|
|
144
|
+
1284: {
|
|
145
|
+
NAME: 'moonbeam',
|
|
146
|
+
ALIASES: aliases_1.ALIASES_MOONBEAM,
|
|
147
|
+
POOLS_DATA: pools_1.POOLS_DATA_MOONBEAM,
|
|
148
|
+
COINS: moonbeam_1.COINS_MOONBEAM,
|
|
149
|
+
cTokens: moonbeam_1.cTokensMoonbeam,
|
|
150
|
+
yTokens: moonbeam_1.yTokensMoonbeam,
|
|
151
|
+
ycTokens: moonbeam_1.ycTokensMoonbeam,
|
|
152
|
+
aTokens: moonbeam_1.aTokensMoonbeam,
|
|
153
|
+
},
|
|
143
154
|
43114: {
|
|
144
155
|
NAME: 'avalanche',
|
|
145
156
|
ALIASES: aliases_1.ALIASES_AVALANCHE,
|
|
@@ -472,6 +483,12 @@ var Curve = /** @class */ (function () {
|
|
|
472
483
|
});
|
|
473
484
|
});
|
|
474
485
|
};
|
|
486
|
+
Curve.prototype.setContract = function (address, abi) {
|
|
487
|
+
this.contracts[address] = {
|
|
488
|
+
contract: new ethers_1.Contract(address, abi, this.signer || this.provider),
|
|
489
|
+
multicallContract: new ethcall_1.Contract(address, abi),
|
|
490
|
+
};
|
|
491
|
+
};
|
|
475
492
|
Curve.prototype.fetchFactoryPools = function (useApi) {
|
|
476
493
|
if (useApi === void 0) { useApi = true; }
|
|
477
494
|
return __awaiter(this, void 0, void 0, function () {
|
package/lib/external-api.d.ts
CHANGED
|
@@ -3,3 +3,25 @@ import memoize from "memoizee";
|
|
|
3
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
4
|
export declare const _getSubgraphData: ((network: INetworkName) => Promise<ISubgraphPoolData[]>) & memoize.Memoized<(network: INetworkName) => Promise<ISubgraphPoolData[]>>;
|
|
5
5
|
export declare const _getMainPoolsGaugeRewards: (() => Promise<IDict<IReward[]>>) & memoize.Memoized<() => Promise<IDict<IReward[]>>>;
|
|
6
|
+
export declare const _getMoonbeamLegacyAPYsAndVolumes: (() => Promise<IDict<{
|
|
7
|
+
apy: {
|
|
8
|
+
day: number;
|
|
9
|
+
week: number;
|
|
10
|
+
};
|
|
11
|
+
volume: number;
|
|
12
|
+
}>>) & memoize.Memoized<() => Promise<IDict<{
|
|
13
|
+
apy: {
|
|
14
|
+
day: number;
|
|
15
|
+
week: number;
|
|
16
|
+
};
|
|
17
|
+
volume: number;
|
|
18
|
+
}>>>;
|
|
19
|
+
export declare const _getMoonbeamFactoryAPYsAndVolumes: (() => Promise<{
|
|
20
|
+
poolAddress: string;
|
|
21
|
+
apy: number;
|
|
22
|
+
volume: number;
|
|
23
|
+
}[]>) & memoize.Memoized<() => Promise<{
|
|
24
|
+
poolAddress: string;
|
|
25
|
+
apy: number;
|
|
26
|
+
volume: number;
|
|
27
|
+
}[]>>;
|
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._getSubgraphData = exports._getPoolsFromApi = void 0;
|
|
42
|
+
exports._getMoonbeamFactoryAPYsAndVolumes = exports._getMoonbeamLegacyAPYsAndVolumes = 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 () {
|
|
@@ -92,3 +92,43 @@ exports._getMainPoolsGaugeRewards = (0, memoizee_1.default)(function () { return
|
|
|
92
92
|
promise: true,
|
|
93
93
|
maxAge: 5 * 60 * 1000, // 5m
|
|
94
94
|
});
|
|
95
|
+
exports._getMoonbeamLegacyAPYsAndVolumes = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
+
var url, data, result;
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
url = "https://stats.curve.fi/raw-stats-moonbeam/apys.json";
|
|
101
|
+
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
102
|
+
case 1:
|
|
103
|
+
data = (_a.sent()).data;
|
|
104
|
+
result = {};
|
|
105
|
+
Object.keys(data.apy.day).forEach(function (poolId) {
|
|
106
|
+
result[poolId] = { apy: { day: 0, week: 0 }, volume: 0 };
|
|
107
|
+
result[poolId].apy.day = data.apy.day[poolId] * 100;
|
|
108
|
+
result[poolId].apy.week = data.apy.week[poolId] * 100;
|
|
109
|
+
result[poolId].volume = data.volume[poolId];
|
|
110
|
+
});
|
|
111
|
+
return [2 /*return*/, result];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}); }, {
|
|
115
|
+
promise: true,
|
|
116
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
117
|
+
});
|
|
118
|
+
exports._getMoonbeamFactoryAPYsAndVolumes = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
|
+
var url, response;
|
|
120
|
+
var _a;
|
|
121
|
+
return __generator(this, function (_b) {
|
|
122
|
+
switch (_b.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
url = "https://api.curve.fi/api/getFactoryAPYs-moonbeam";
|
|
125
|
+
return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
|
|
126
|
+
case 1:
|
|
127
|
+
response = _b.sent();
|
|
128
|
+
return [2 /*return*/, (_a = response.data.data.poolDetails) !== null && _a !== void 0 ? _a : []];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}); }, {
|
|
132
|
+
promise: true,
|
|
133
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
134
|
+
});
|
package/lib/factory/common.js
CHANGED
|
@@ -6,102 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.setCryptoFactoryZapContracts = exports.setFactoryZapContracts = void 0;
|
|
7
7
|
var ethers_1 = require("ethers");
|
|
8
8
|
var ethcall_1 = require("ethcall");
|
|
9
|
-
var
|
|
10
|
-
var metaZap_json_1 = __importDefault(require("../constants/abis/fraxusdc/metaZap.json"));
|
|
11
|
-
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
12
|
-
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
13
|
-
var DepositZapFantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapFantom.json"));
|
|
14
|
-
var DepositZapMetaUsd2Fantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsd2Fantom.json"));
|
|
9
|
+
var constants_1 = require("./constants");
|
|
15
10
|
var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
|
|
16
11
|
function setFactoryZapContracts() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
-
contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
26
|
-
multicallContract: new ethcall_1.Contract(metaSBtcZapAddress, deposit_json_1.default),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
else if (this.chainId === 10) {
|
|
30
|
-
var metaUsdZapAddress = "0x167e42a1c7ab4be03764a2222aac57f5f6754411".toLowerCase();
|
|
31
|
-
this.contracts[metaUsdZapAddress] = {
|
|
32
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
33
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, deposit_json_1.default),
|
|
34
|
-
};
|
|
35
|
-
var metaUsd2ZapAddress = "0x4244eB811D6e0Ef302326675207A95113dB4E1F8".toLowerCase();
|
|
36
|
-
this.contracts[metaUsd2ZapAddress] = {
|
|
37
|
-
contract: new ethers_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
38
|
-
multicallContract: new ethcall_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
else if (this.chainId === 100) {
|
|
42
|
-
var metaUsdZapAddress = "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase();
|
|
43
|
-
this.contracts[metaUsdZapAddress] = {
|
|
44
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
45
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, deposit_json_1.default),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
else if (this.chainId === 137) {
|
|
49
|
-
var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
|
|
50
|
-
this.contracts[metaUsdZapAddress] = {
|
|
51
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
52
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
53
|
-
};
|
|
54
|
-
var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
|
|
55
|
-
this.contracts[metaBtcZapAddress] = {
|
|
56
|
-
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
57
|
-
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
else if (this.chainId === 250) {
|
|
61
|
-
var metaUsdZapAddress = "0x78D51EB71a62c081550EfcC0a9F9Ea94B2Ef081c".toLowerCase();
|
|
62
|
-
this.contracts[metaUsdZapAddress] = {
|
|
63
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
64
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default),
|
|
65
|
-
};
|
|
66
|
-
var metaRenBtcZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
|
|
67
|
-
this.contracts[metaRenBtcZapAddress] = {
|
|
68
|
-
contract: new ethers_1.Contract(metaRenBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
69
|
-
multicallContract: new ethcall_1.Contract(metaRenBtcZapAddress, DepositZapFantom_json_1.default),
|
|
70
|
-
};
|
|
71
|
-
var metaGeistUsdZapAddress = "0x247aEB220E87f24c40C9F86b65d6bd5d3c987B55".toLowerCase();
|
|
72
|
-
this.contracts[metaGeistUsdZapAddress] = {
|
|
73
|
-
contract: new ethers_1.Contract(metaGeistUsdZapAddress, DepositZapMetaUsd2Fantom_json_1.default, this.signer || this.provider),
|
|
74
|
-
multicallContract: new ethcall_1.Contract(metaGeistUsdZapAddress, DepositZapMetaUsd2Fantom_json_1.default),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
else if (this.chainId === 43114) {
|
|
78
|
-
var metaUsdZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
|
|
79
|
-
this.contracts[metaUsdZapAddress] = {
|
|
80
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
81
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
82
|
-
};
|
|
83
|
-
var metaBtcZapAddress = "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase();
|
|
84
|
-
this.contracts[metaBtcZapAddress] = {
|
|
85
|
-
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
86
|
-
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
else if (this.chainId === 42161) {
|
|
90
|
-
var metaUsdZapAddress = "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase();
|
|
91
|
-
this.contracts[metaUsdZapAddress] = {
|
|
92
|
-
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
93
|
-
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default),
|
|
94
|
-
};
|
|
95
|
-
var metaBtcZapAddress = "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase();
|
|
96
|
-
this.contracts[metaBtcZapAddress] = {
|
|
97
|
-
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
98
|
-
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default),
|
|
99
|
-
};
|
|
100
|
-
var metaUsd2ZapAddress = "0x58AC91f5BE7dC0c35b24B96B19BAc55FBB8E705e".toLowerCase();
|
|
101
|
-
this.contracts[metaUsd2ZapAddress] = {
|
|
102
|
-
contract: new ethers_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
|
|
103
|
-
multicallContract: new ethcall_1.Contract(metaUsd2ZapAddress, DepositZapFantom_json_1.default),
|
|
104
|
-
};
|
|
12
|
+
var basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[this.chainId].basePoolIdZapDict;
|
|
13
|
+
for (var basePoolId in basePoolIdZapDict) {
|
|
14
|
+
if (!Object.prototype.hasOwnProperty.call(basePoolIdZapDict, basePoolId))
|
|
15
|
+
continue;
|
|
16
|
+
var basePool = basePoolIdZapDict[basePoolId];
|
|
17
|
+
if (basePool.address in this.constants)
|
|
18
|
+
continue;
|
|
19
|
+
this.setContract(basePool.address, basePool.ABI);
|
|
105
20
|
}
|
|
106
21
|
}
|
|
107
22
|
exports.setFactoryZapContracts = setFactoryZapContracts;
|
|
@@ -6,6 +6,7 @@ export declare const implementationABIDictAvalanche: IDict<any>;
|
|
|
6
6
|
export declare const implementationABIDictArbitrum: IDict<any>;
|
|
7
7
|
export declare const implementationABIDictOptimism: IDict<any>;
|
|
8
8
|
export declare const implementationABIDictXDai: IDict<any>;
|
|
9
|
+
export declare const implementationABIDictMoonbeam: IDict<any>;
|
|
9
10
|
export declare const implementationBasePoolIdDictEthereum: IDict<string>;
|
|
10
11
|
export declare const implementationBasePoolIdDictPolygon: IDict<string>;
|
|
11
12
|
export declare const implementationBasePoolIdDictFantom: IDict<string>;
|
|
@@ -13,13 +14,39 @@ export declare const implementationBasePoolIdDictAvalanche: IDict<string>;
|
|
|
13
14
|
export declare const implementationBasePoolIdDictArbitrum: IDict<string>;
|
|
14
15
|
export declare const implementationBasePoolIdDictOptimism: IDict<string>;
|
|
15
16
|
export declare const implementationBasePoolIdDictXDai: IDict<string>;
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
17
|
+
export declare const implementationBasePoolIdDictMoonbeam: IDict<string>;
|
|
18
|
+
export declare const basePoolIdZapDictEthereum: IDict<{
|
|
19
|
+
address: string;
|
|
20
|
+
ABI: any;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const basePoolIdZapDictPolygon: IDict<{
|
|
23
|
+
address: string;
|
|
24
|
+
ABI: any;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const basePoolIdZapDictFantom: IDict<{
|
|
27
|
+
address: string;
|
|
28
|
+
ABI: any;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const basePoolIdZapDictAvalanche: IDict<{
|
|
31
|
+
address: string;
|
|
32
|
+
ABI: any;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const basePoolIdZapDictArbitrum: IDict<{
|
|
35
|
+
address: string;
|
|
36
|
+
ABI: any;
|
|
37
|
+
}>;
|
|
38
|
+
export declare const basePoolIdZapDictOptimism: IDict<{
|
|
39
|
+
address: string;
|
|
40
|
+
ABI: any;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const basePoolIdZapDictXDai: IDict<{
|
|
43
|
+
address: string;
|
|
44
|
+
ABI: any;
|
|
45
|
+
}>;
|
|
46
|
+
export declare const basePoolIdZapDictMoonbeam: IDict<{
|
|
47
|
+
address: string;
|
|
48
|
+
ABI: any;
|
|
49
|
+
}>;
|
|
23
50
|
export declare const NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
24
51
|
export declare const NATIVE_TOKENS: {
|
|
25
52
|
[index: number]: {
|
|
@@ -32,6 +59,9 @@ export declare const FACTORY_CONSTANTS: {
|
|
|
32
59
|
[index: number]: {
|
|
33
60
|
implementationABIDict: IDict<any>;
|
|
34
61
|
implementationBasePoolIdDict: IDict<string>;
|
|
35
|
-
basePoolIdZapDict: IDict<
|
|
62
|
+
basePoolIdZapDict: IDict<{
|
|
63
|
+
address: string;
|
|
64
|
+
ABI: any;
|
|
65
|
+
}>;
|
|
36
66
|
};
|
|
37
67
|
};
|
package/lib/factory/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.FACTORY_CONSTANTS = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictXDai = exports.implementationBasePoolIdDictOptimism = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictXDai = exports.implementationABIDictOptimism = exports.implementationABIDictArbitrum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictMoonbeam = exports.implementationBasePoolIdDictXDai = exports.implementationBasePoolIdDictOptimism = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictMoonbeam = exports.implementationABIDictXDai = exports.implementationABIDictOptimism = exports.implementationABIDictArbitrum = exports.implementationABIDictAvalanche = exports.implementationABIDictFantom = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
7
7
|
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
8
8
|
var MetaUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSD.json"));
|
|
9
9
|
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDBalances.json"));
|
|
@@ -26,6 +26,13 @@ var Plain4Basic_json_1 = __importDefault(require("../constants/abis/factory-v2/P
|
|
|
26
26
|
var Plain4Balances_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Balances.json"));
|
|
27
27
|
var Plain4ETH_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4ETH.json"));
|
|
28
28
|
var Plain4Optimized_json_1 = __importDefault(require("../constants/abis/factory-v2/Plain4Optimized.json"));
|
|
29
|
+
// --- ZAPS --
|
|
30
|
+
var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
|
|
31
|
+
var metaZap_json_1 = __importDefault(require("../constants/abis/fraxusdc/metaZap.json"));
|
|
32
|
+
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
33
|
+
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
34
|
+
var DepositZapFantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapFantom.json"));
|
|
35
|
+
var DepositZapMetaUsd2Fantom_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsd2Fantom.json"));
|
|
29
36
|
exports.implementationABIDictEthereum = {
|
|
30
37
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": swap_json_1.default,
|
|
31
38
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": MetaUSD_json_1.default,
|
|
@@ -159,6 +166,20 @@ exports.implementationABIDictXDai = {
|
|
|
159
166
|
"0xc1C49622b63B961ce1D352ecb7D8261Ab5556695": Plain4ETH_json_1.default,
|
|
160
167
|
"0x0E2615ce69Cd3Dc3Ff6f66a975bEa0655F3bA7b9": Plain4Optimized_json_1.default,
|
|
161
168
|
};
|
|
169
|
+
exports.implementationABIDictMoonbeam = {
|
|
170
|
+
"0x6842E0412AC1c00464dc48961330156a07268d14": Plain2Basic_json_1.default,
|
|
171
|
+
"0x9fAe78C4bBB649deB7b2295dDB8A03adA7eB660F": Plain2Balances_json_1.default,
|
|
172
|
+
"0xfCE359115dFe1533a2458650123F86C454BC0213": Plain2ETH_json_1.default,
|
|
173
|
+
"0x09C62ad0694e3f1ad8cF8876aaBe56138C586f5F": Plain2Optimized_json_1.default,
|
|
174
|
+
"0xD19Baeadc667Cf2015e395f2B08668Ef120f41F5": Plain3Basic_json_1.default,
|
|
175
|
+
"0x04e39EF8332e979Cf8e4f8891E64934FF65F231b": Plain3Balances_json_1.default,
|
|
176
|
+
"0xC9438d8928486bD9621D326002F4672bF684187A": Plain3ETH_json_1.default,
|
|
177
|
+
"0x2b70A5B878665FfDB4A06Ba40a264d6c70f68F4B": Plain3Optimized_json_1.default,
|
|
178
|
+
"0x2D036f0Ff6F440dB623e0D9D3B5Daa509e5500C3": Plain4Basic_json_1.default,
|
|
179
|
+
"0x7Bb707085905c9D80854652809A1ba8480C11789": Plain4Balances_json_1.default,
|
|
180
|
+
"0xec9cEBE650E181079576C1b6d0d2e092B1EdfF13": Plain4ETH_json_1.default,
|
|
181
|
+
"0xe8269B33E47761f552E1a3070119560d5fa8bBD6": Plain4Optimized_json_1.default,
|
|
182
|
+
};
|
|
162
183
|
exports.implementationBasePoolIdDictEthereum = {
|
|
163
184
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
|
|
164
185
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
|
|
@@ -208,37 +229,90 @@ exports.implementationBasePoolIdDictXDai = {
|
|
|
208
229
|
"0x4A5bF7Ab9A8202692051c19B102d3eDD62aaBAE6": "3pool",
|
|
209
230
|
"0x0B4dc7A945695D11FD83e40B2DfC2B896A02395F": "3pool",
|
|
210
231
|
};
|
|
232
|
+
exports.implementationBasePoolIdDictMoonbeam = {};
|
|
211
233
|
exports.basePoolIdZapDictEthereum = {
|
|
212
|
-
'3pool':
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
234
|
+
'3pool': {
|
|
235
|
+
address: "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
236
|
+
ABI: deposit_json_1.default,
|
|
237
|
+
},
|
|
238
|
+
fraxusdc: {
|
|
239
|
+
address: "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase(),
|
|
240
|
+
ABI: metaZap_json_1.default,
|
|
241
|
+
},
|
|
242
|
+
sbtc: {
|
|
243
|
+
address: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
244
|
+
ABI: deposit_json_1.default,
|
|
245
|
+
},
|
|
246
|
+
ren: {
|
|
247
|
+
address: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
248
|
+
ABI: deposit_json_1.default,
|
|
249
|
+
}, // TODO MUST BE CHANGED!!!
|
|
216
250
|
};
|
|
217
251
|
exports.basePoolIdZapDictPolygon = {
|
|
218
|
-
aave:
|
|
219
|
-
|
|
252
|
+
aave: {
|
|
253
|
+
address: "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
254
|
+
ABI: DepositZapMetaUsdPolygon_json_1.default,
|
|
255
|
+
},
|
|
256
|
+
ren: {
|
|
257
|
+
address: "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(),
|
|
258
|
+
ABI: DepositZapMetaBtcPolygon_json_1.default,
|
|
259
|
+
},
|
|
220
260
|
};
|
|
221
261
|
exports.basePoolIdZapDictFantom = {
|
|
222
|
-
'2pool':
|
|
223
|
-
|
|
224
|
-
|
|
262
|
+
'2pool': {
|
|
263
|
+
address: "0x78D51EB71a62c081550EfcC0a9F9Ea94B2Ef081c".toLowerCase(),
|
|
264
|
+
ABI: DepositZapFantom_json_1.default,
|
|
265
|
+
},
|
|
266
|
+
ren: {
|
|
267
|
+
address: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
268
|
+
ABI: DepositZapFantom_json_1.default,
|
|
269
|
+
},
|
|
270
|
+
geist: {
|
|
271
|
+
address: "0x247aEB220E87f24c40C9F86b65d6bd5d3c987B55".toLowerCase(),
|
|
272
|
+
ABI: DepositZapMetaUsd2Fantom_json_1.default,
|
|
273
|
+
},
|
|
225
274
|
};
|
|
226
275
|
exports.basePoolIdZapDictAvalanche = {
|
|
227
|
-
aave:
|
|
228
|
-
|
|
276
|
+
aave: {
|
|
277
|
+
address: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
278
|
+
ABI: DepositZapMetaUsdPolygon_json_1.default,
|
|
279
|
+
},
|
|
280
|
+
ren: {
|
|
281
|
+
address: "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase(),
|
|
282
|
+
ABI: DepositZapMetaBtcPolygon_json_1.default,
|
|
283
|
+
},
|
|
229
284
|
};
|
|
230
285
|
exports.basePoolIdZapDictArbitrum = {
|
|
231
|
-
"2pool":
|
|
232
|
-
|
|
233
|
-
|
|
286
|
+
"2pool": {
|
|
287
|
+
address: "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase(),
|
|
288
|
+
ABI: DepositZapFantom_json_1.default,
|
|
289
|
+
},
|
|
290
|
+
ren: {
|
|
291
|
+
address: "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase(),
|
|
292
|
+
ABI: DepositZapFantom_json_1.default,
|
|
293
|
+
},
|
|
294
|
+
"factory-v2-41": {
|
|
295
|
+
address: "0x58AC91f5BE7dC0c35b24B96B19BAc55FBB8E705e".toLowerCase(),
|
|
296
|
+
ABI: DepositZapFantom_json_1.default,
|
|
297
|
+
},
|
|
234
298
|
};
|
|
235
299
|
exports.basePoolIdZapDictOptimism = {
|
|
236
|
-
"3pool":
|
|
237
|
-
|
|
300
|
+
"3pool": {
|
|
301
|
+
address: "0x167e42a1c7ab4be03764a2222aac57f5f6754411".toLowerCase(),
|
|
302
|
+
ABI: deposit_json_1.default,
|
|
303
|
+
},
|
|
304
|
+
"factory-v2-16": {
|
|
305
|
+
address: "0x4244eB811D6e0Ef302326675207A95113dB4E1F8".toLowerCase(),
|
|
306
|
+
ABI: DepositZapFantom_json_1.default,
|
|
307
|
+
},
|
|
238
308
|
};
|
|
239
309
|
exports.basePoolIdZapDictXDai = {
|
|
240
|
-
"3pool":
|
|
310
|
+
"3pool": {
|
|
311
|
+
address: "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase(),
|
|
312
|
+
ABI: deposit_json_1.default,
|
|
313
|
+
},
|
|
241
314
|
};
|
|
315
|
+
exports.basePoolIdZapDictMoonbeam = {};
|
|
242
316
|
exports.NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
243
317
|
exports.NATIVE_TOKENS = {
|
|
244
318
|
1: {
|
|
@@ -266,6 +340,11 @@ exports.NATIVE_TOKENS = {
|
|
|
266
340
|
wrappedSymbol: 'WFTM',
|
|
267
341
|
wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
|
|
268
342
|
},
|
|
343
|
+
1284: {
|
|
344
|
+
symbol: 'GLMR',
|
|
345
|
+
wrappedSymbol: 'WGLMR',
|
|
346
|
+
wrappedAddress: '0xAcc15dC74880C9944775448304B263D191c6077F'.toLowerCase(),
|
|
347
|
+
},
|
|
269
348
|
42161: {
|
|
270
349
|
symbol: 'ETH',
|
|
271
350
|
wrappedSymbol: 'WETH',
|
|
@@ -298,6 +377,11 @@ exports.FACTORY_CONSTANTS = {
|
|
|
298
377
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictFantom,
|
|
299
378
|
basePoolIdZapDict: exports.basePoolIdZapDictFantom,
|
|
300
379
|
},
|
|
380
|
+
1284: {
|
|
381
|
+
implementationABIDict: exports.implementationABIDictMoonbeam,
|
|
382
|
+
implementationBasePoolIdDict: exports.implementationBasePoolIdDictMoonbeam,
|
|
383
|
+
basePoolIdZapDict: exports.basePoolIdZapDictMoonbeam,
|
|
384
|
+
},
|
|
301
385
|
43114: {
|
|
302
386
|
implementationABIDict: exports.implementationABIDictAvalanche,
|
|
303
387
|
implementationBasePoolIdDict: exports.implementationBasePoolIdDictAvalanche,
|
|
@@ -273,7 +273,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
|
|
|
273
273
|
var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
|
|
274
274
|
var basePoolCoinAddresses = basePoolIdCoinAddressesDict[basePoolId];
|
|
275
275
|
var basePoolDecimals = basePoolIdDecimalsDict[basePoolId];
|
|
276
|
-
var basePoolZap = basePoolIdZapDict[basePoolId];
|
|
276
|
+
var basePoolZap = basePoolIdZapDict[basePoolId].address;
|
|
277
277
|
FACTORY_POOLS_DATA[pool.id] = {
|
|
278
278
|
name: pool.name.split(": ")[1].trim(),
|
|
279
279
|
full_name: pool.name,
|
|
@@ -243,6 +243,8 @@ function getExistingCoinAddressNameDict() {
|
|
|
243
243
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
|
|
244
244
|
if (this.chainId === 250)
|
|
245
245
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
|
|
246
|
+
if (this.chainId === 1284)
|
|
247
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "GLMR";
|
|
246
248
|
if (this.chainId === 43114)
|
|
247
249
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
|
|
248
250
|
if (this.chainId === 42161)
|
package/lib/factory/factory.js
CHANGED
|
@@ -78,6 +78,7 @@ var BLACK_LIST = {
|
|
|
78
78
|
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
79
79
|
],
|
|
80
80
|
250: [],
|
|
81
|
+
1284: [],
|
|
81
82
|
43114: [],
|
|
82
83
|
42161: [],
|
|
83
84
|
};
|
|
@@ -277,6 +278,8 @@ function getExistingCoinAddressNameDict() {
|
|
|
277
278
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
|
|
278
279
|
if (this.chainId === 250)
|
|
279
280
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
|
|
281
|
+
if (this.chainId === 1284)
|
|
282
|
+
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "GLMR";
|
|
280
283
|
if (this.chainId === 43114)
|
|
281
284
|
dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
|
|
282
285
|
if (this.chainId === 42161)
|
|
@@ -450,7 +453,7 @@ function getFactoryPoolData() {
|
|
|
450
453
|
swap_address: swapAddresses[i],
|
|
451
454
|
token_address: swapAddresses[i],
|
|
452
455
|
gauge_address: gaugeAddresses[i],
|
|
453
|
-
deposit_address: basePoolIdZapDict[basePoolIds[i]],
|
|
456
|
+
deposit_address: basePoolIdZapDict[basePoolIds[i]].address,
|
|
454
457
|
is_meta: true,
|
|
455
458
|
is_factory: true,
|
|
456
459
|
base_pool: basePoolIds[i],
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export interface ICurve {
|
|
|
70
70
|
DECIMALS: IDict<number>;
|
|
71
71
|
GAUGES: string[];
|
|
72
72
|
};
|
|
73
|
+
setContract: (address: string, abi: any) => void;
|
|
73
74
|
}
|
|
74
75
|
export interface ICoinFromPoolDataApi {
|
|
75
76
|
address: string;
|
|
@@ -99,6 +100,7 @@ export interface IPoolDataFromApi {
|
|
|
99
100
|
coins: ICoinFromPoolDataApi[];
|
|
100
101
|
gaugeRewards?: IReward[];
|
|
101
102
|
usdTotal: number;
|
|
103
|
+
totalSupply: number;
|
|
102
104
|
}
|
|
103
105
|
export interface ISubgraphPoolData {
|
|
104
106
|
address: string;
|
|
@@ -162,32 +162,71 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
162
162
|
});
|
|
163
163
|
};
|
|
164
164
|
this.statsVolume = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
165
|
-
var network, poolsData, poolData;
|
|
165
|
+
var _c, mainPoolsData, factoryPoolsData, poolData_1, lpPrice, network, poolsData, poolData;
|
|
166
166
|
var _this = this;
|
|
167
|
-
return __generator(this, function (
|
|
168
|
-
switch (
|
|
167
|
+
return __generator(this, function (_d) {
|
|
168
|
+
switch (_d.label) {
|
|
169
169
|
case 0:
|
|
170
|
+
if (!(curve_1.curve.chainId === 1284)) return [3 /*break*/, 3];
|
|
171
|
+
return [4 /*yield*/, Promise.all([
|
|
172
|
+
(0, external_api_1._getMoonbeamLegacyAPYsAndVolumes)(),
|
|
173
|
+
(0, external_api_1._getMoonbeamFactoryAPYsAndVolumes)(),
|
|
174
|
+
])];
|
|
175
|
+
case 1:
|
|
176
|
+
_c = _d.sent(), mainPoolsData = _c[0], factoryPoolsData = _c[1];
|
|
177
|
+
if (this.id in mainPoolsData) {
|
|
178
|
+
return [2 /*return*/, mainPoolsData[this.id].volume.toString()];
|
|
179
|
+
}
|
|
180
|
+
poolData_1 = factoryPoolsData.find(function (d) { return d.poolAddress.toLowerCase() === _this.address; });
|
|
181
|
+
if (!poolData_1)
|
|
182
|
+
throw Error("Can't get Volume for ".concat(this.name, " (id: ").concat(this.id, ")"));
|
|
183
|
+
return [4 /*yield*/, (0, utils_1._getUsdRate)(this.lpToken)];
|
|
184
|
+
case 2:
|
|
185
|
+
lpPrice = _d.sent();
|
|
186
|
+
return [2 /*return*/, (poolData_1.volume * lpPrice).toString()];
|
|
187
|
+
case 3:
|
|
170
188
|
network = curve_1.curve.constants.NETWORK_NAME;
|
|
171
189
|
return [4 /*yield*/, (0, external_api_1._getSubgraphData)(network)];
|
|
172
|
-
case
|
|
173
|
-
poolsData = (
|
|
190
|
+
case 4:
|
|
191
|
+
poolsData = (_d.sent());
|
|
174
192
|
poolData = poolsData.find(function (d) { return d.address.toLowerCase() === _this.address; });
|
|
175
193
|
if (!poolData)
|
|
176
|
-
throw Error("Can't get
|
|
194
|
+
throw Error("Can't get Volume for ".concat(this.name, " (id: ").concat(this.id, ")"));
|
|
177
195
|
return [2 /*return*/, poolData.volumeUSD.toString()];
|
|
178
196
|
}
|
|
179
197
|
});
|
|
180
198
|
}); };
|
|
181
199
|
this.statsBaseApy = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
182
|
-
var network, poolsData, poolData;
|
|
200
|
+
var _c, mainPoolsData, factoryPoolsData, poolData_2, network, poolsData, poolData;
|
|
183
201
|
var _this = this;
|
|
184
|
-
return __generator(this, function (
|
|
185
|
-
switch (
|
|
202
|
+
return __generator(this, function (_d) {
|
|
203
|
+
switch (_d.label) {
|
|
186
204
|
case 0:
|
|
205
|
+
if (!(curve_1.curve.chainId === 1284)) return [3 /*break*/, 2];
|
|
206
|
+
return [4 /*yield*/, Promise.all([
|
|
207
|
+
(0, external_api_1._getMoonbeamLegacyAPYsAndVolumes)(),
|
|
208
|
+
(0, external_api_1._getMoonbeamFactoryAPYsAndVolumes)(),
|
|
209
|
+
])];
|
|
210
|
+
case 1:
|
|
211
|
+
_c = _d.sent(), mainPoolsData = _c[0], factoryPoolsData = _c[1];
|
|
212
|
+
if (this.id in mainPoolsData) {
|
|
213
|
+
return [2 /*return*/, {
|
|
214
|
+
day: mainPoolsData[this.id].apy.day.toString(),
|
|
215
|
+
week: mainPoolsData[this.id].apy.week.toString(),
|
|
216
|
+
}];
|
|
217
|
+
}
|
|
218
|
+
poolData_2 = factoryPoolsData.find(function (d) { return d.poolAddress.toLowerCase() === _this.address; });
|
|
219
|
+
if (!poolData_2)
|
|
220
|
+
throw Error("Can't get base APY for ".concat(this.name, " (id: ").concat(this.id, ")"));
|
|
221
|
+
return [2 /*return*/, {
|
|
222
|
+
day: poolData_2.apy.toString(),
|
|
223
|
+
week: poolData_2.apy.toString(),
|
|
224
|
+
}];
|
|
225
|
+
case 2:
|
|
187
226
|
network = curve_1.curve.constants.NETWORK_NAME;
|
|
188
227
|
return [4 /*yield*/, (0, external_api_1._getSubgraphData)(network)];
|
|
189
|
-
case
|
|
190
|
-
poolsData = (
|
|
228
|
+
case 3:
|
|
229
|
+
poolsData = (_d.sent());
|
|
191
230
|
poolData = poolsData.find(function (d) { return d.address.toLowerCase() === _this.address; });
|
|
192
231
|
if (!poolData)
|
|
193
232
|
throw Error("Can't get base APY for ".concat(this.name, " (id: ").concat(this.id, ")"));
|
|
@@ -262,7 +301,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
262
301
|
case 0:
|
|
263
302
|
if (this.gauge === ethers_1.ethers.constants.AddressZero)
|
|
264
303
|
return [2 /*return*/, []];
|
|
265
|
-
if (![10, 100, 137, 250, 43114, 42161].includes(curve_1.curve.chainId)) return [3 /*break*/, 8];
|
|
304
|
+
if (![10, 100, 137, 250, 1284, 43114, 42161].includes(curve_1.curve.chainId)) return [3 /*break*/, 8];
|
|
266
305
|
apy = [];
|
|
267
306
|
return [4 /*yield*/, this.rewardTokens()];
|
|
268
307
|
case 1:
|
|
@@ -371,11 +410,13 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
371
410
|
_d = [(0, utils_1.toBN)(_totalSupply), (0, utils_1.toBN)(_fee, 10).times(N_coins).div(4 * (N_coins - 1)), (0, utils_1.toBN)(_lpTokenAmount)], totalSupplyBN = _d[0], feeBN = _d[1], lpTokenAmountBN = _d[2];
|
|
372
411
|
balancesBN = balances.map(function (b) { return (0, utils_1.BN)(b); });
|
|
373
412
|
amountsBN = _amounts.map(function (_a, i) { return (0, utils_1.toBN)(_a, decimals[i]); });
|
|
374
|
-
feesBN =
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
413
|
+
feesBN = Array(N_coins).fill((0, utils_1.BN)(0));
|
|
414
|
+
if (totalSupplyBN.gt(0)) {
|
|
415
|
+
for (i = 0; i < N_coins; i++) {
|
|
416
|
+
feesBN[i] = balancesBN[i].times(lpTokenAmountBN).div(totalSupplyBN).minus(amountsBN[i]).times(feeBN);
|
|
417
|
+
if (feesBN[i].lt(0))
|
|
418
|
+
feesBN[i] = feesBN[i].times(-1);
|
|
419
|
+
}
|
|
379
420
|
}
|
|
380
421
|
_fees = feesBN.map(function (fBN, i) { return (0, utils_1.fromBN)(fBN, decimals[i]); });
|
|
381
422
|
return [4 /*yield*/, this._pureCalcLpTokenAmount(_fees, !isDeposit, useUnderlying)];
|
package/lib/utils.js
CHANGED
|
@@ -408,10 +408,10 @@ var getPoolNameBySwapAddress = function (swapAddress) {
|
|
|
408
408
|
};
|
|
409
409
|
exports.getPoolNameBySwapAddress = getPoolNameBySwapAddress;
|
|
410
410
|
var _getUsdPricesFromApi = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
411
|
-
var network, promises, allTypesExtendedPoolData, priceDict, _i, allTypesExtendedPoolData_1, extendedPoolData, _a, _b, pool, _c, _d, coin, _e, _f, coin;
|
|
412
|
-
var _g;
|
|
413
|
-
return __generator(this, function (
|
|
414
|
-
switch (
|
|
411
|
+
var network, promises, allTypesExtendedPoolData, priceDict, _i, allTypesExtendedPoolData_1, extendedPoolData, _a, _b, pool, lpTokenAddress, totalSupply, _c, _d, coin, _e, _f, coin;
|
|
412
|
+
var _g, _h;
|
|
413
|
+
return __generator(this, function (_j) {
|
|
414
|
+
switch (_j.label) {
|
|
415
415
|
case 0:
|
|
416
416
|
network = curve_1.curve.constants.NETWORK_NAME;
|
|
417
417
|
promises = [
|
|
@@ -422,18 +422,21 @@ var _getUsdPricesFromApi = function () { return __awaiter(void 0, void 0, void 0
|
|
|
422
422
|
];
|
|
423
423
|
return [4 /*yield*/, Promise.all(promises)];
|
|
424
424
|
case 1:
|
|
425
|
-
allTypesExtendedPoolData =
|
|
425
|
+
allTypesExtendedPoolData = _j.sent();
|
|
426
426
|
priceDict = {};
|
|
427
427
|
for (_i = 0, allTypesExtendedPoolData_1 = allTypesExtendedPoolData; _i < allTypesExtendedPoolData_1.length; _i++) {
|
|
428
428
|
extendedPoolData = allTypesExtendedPoolData_1[_i];
|
|
429
429
|
for (_a = 0, _b = extendedPoolData.poolData; _a < _b.length; _a++) {
|
|
430
430
|
pool = _b[_a];
|
|
431
|
+
lpTokenAddress = (_g = pool.lpTokenAddress) !== null && _g !== void 0 ? _g : pool.address;
|
|
432
|
+
totalSupply = pool.totalSupply / (Math.pow(10, 18));
|
|
433
|
+
priceDict[lpTokenAddress.toLowerCase()] = pool.usdTotal && totalSupply ? pool.usdTotal / totalSupply : 0;
|
|
431
434
|
for (_c = 0, _d = pool.coins; _c < _d.length; _c++) {
|
|
432
435
|
coin = _d[_c];
|
|
433
436
|
if (typeof coin.usdPrice === "number")
|
|
434
437
|
priceDict[coin.address.toLowerCase()] = coin.usdPrice;
|
|
435
438
|
}
|
|
436
|
-
for (_e = 0, _f = (
|
|
439
|
+
for (_e = 0, _f = (_h = pool.gaugeRewards) !== null && _h !== void 0 ? _h : []; _e < _f.length; _e++) {
|
|
437
440
|
coin = _f[_e];
|
|
438
441
|
if (typeof coin.tokenPrice === "number")
|
|
439
442
|
priceDict[coin.tokenAddress.toLowerCase()] = coin.tokenPrice;
|
|
@@ -464,6 +467,7 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
464
467
|
100: 'xdai',
|
|
465
468
|
137: 'polygon-pos',
|
|
466
469
|
250: 'fantom',
|
|
470
|
+
1284: 'moonbeam',
|
|
467
471
|
43114: 'avalanche',
|
|
468
472
|
42161: 'arbitrum-one',
|
|
469
473
|
}[curve_1.curve.chainId];
|
|
@@ -473,6 +477,7 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
|
|
|
473
477
|
100: 'xdai',
|
|
474
478
|
137: 'matic-network',
|
|
475
479
|
250: 'fantom',
|
|
480
|
+
1284: 'moonbeam',
|
|
476
481
|
43114: 'avalanche-2',
|
|
477
482
|
42161: 'ethereum',
|
|
478
483
|
}[curve_1.curve.chainId];
|
|
@@ -541,6 +546,7 @@ var getTVL = function (chainId) {
|
|
|
541
546
|
100: 'xdai',
|
|
542
547
|
137: "polygon",
|
|
543
548
|
250: "fantom",
|
|
549
|
+
1284: "moonbeam",
|
|
544
550
|
43114: "avalanche",
|
|
545
551
|
42161: "arbitrum",
|
|
546
552
|
}[chainId]) !== null && _a !== void 0 ? _a : "ethereum";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvefi/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "JavaScript library for curve.fi",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Macket",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@ethersproject/networks": "^5.5.0",
|
|
35
35
|
"axios": "^0.21.1",
|
|
36
36
|
"bignumber.js": "^9.0.1",
|
|
37
|
-
"ethcall": "^4.2
|
|
37
|
+
"ethcall": "^4.8.2",
|
|
38
38
|
"ethers": "^5.4.6",
|
|
39
39
|
"memoizee": "^0.4.15"
|
|
40
40
|
}
|