@curvefi/api 2.8.6 → 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.
@@ -0,0 +1,242 @@
1
+ [
2
+ {
3
+ "type": "constructor",
4
+ "stateMutability": "nonpayable",
5
+ "outputs": [],
6
+ "inputs": [
7
+ {
8
+ "type": "address",
9
+ "name": "_pool"
10
+ },
11
+ {
12
+ "type": "address",
13
+ "name": "_base_pool"
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ "type": "function",
19
+ "stateMutability": "nonpayable",
20
+ "outputs": [],
21
+ "name": "add_liquidity",
22
+ "inputs": [
23
+ {
24
+ "type": "uint256[5]",
25
+ "name": "_amounts"
26
+ },
27
+ {
28
+ "type": "uint256",
29
+ "name": "_min_mint_amount"
30
+ }
31
+ ],
32
+ "gas": "67403"
33
+ },
34
+ {
35
+ "type": "function",
36
+ "stateMutability": "nonpayable",
37
+ "outputs": [],
38
+ "name": "exchange_underlying",
39
+ "inputs": [
40
+ {
41
+ "type": "uint256",
42
+ "name": "i"
43
+ },
44
+ {
45
+ "type": "uint256",
46
+ "name": "j"
47
+ },
48
+ {
49
+ "type": "uint256",
50
+ "name": "_dx"
51
+ },
52
+ {
53
+ "type": "uint256",
54
+ "name": "_min_dy"
55
+ }
56
+ ],
57
+ "gas": "42830"
58
+ },
59
+ {
60
+ "type": "function",
61
+ "stateMutability": "nonpayable",
62
+ "outputs": [],
63
+ "name": "remove_liquidity",
64
+ "inputs": [
65
+ {
66
+ "type": "uint256",
67
+ "name": "_amount"
68
+ },
69
+ {
70
+ "type": "uint256[5]",
71
+ "name": "_min_amounts"
72
+ }
73
+ ],
74
+ "gas": "93404"
75
+ },
76
+ {
77
+ "type": "function",
78
+ "stateMutability": "nonpayable",
79
+ "outputs": [],
80
+ "name": "remove_liquidity_one_coin",
81
+ "inputs": [
82
+ {
83
+ "type": "uint256",
84
+ "name": "_token_amount"
85
+ },
86
+ {
87
+ "type": "uint256",
88
+ "name": "i"
89
+ },
90
+ {
91
+ "type": "uint256",
92
+ "name": "_min_amount"
93
+ }
94
+ ],
95
+ "gas": "33153"
96
+ },
97
+ {
98
+ "type": "function",
99
+ "stateMutability": "view",
100
+ "outputs": [
101
+ {
102
+ "type": "uint256",
103
+ "name": ""
104
+ }
105
+ ],
106
+ "name": "get_dy_underlying",
107
+ "inputs": [
108
+ {
109
+ "type": "uint256",
110
+ "name": "i"
111
+ },
112
+ {
113
+ "type": "uint256",
114
+ "name": "j"
115
+ },
116
+ {
117
+ "type": "uint256",
118
+ "name": "_dx"
119
+ }
120
+ ],
121
+ "gas": "19678"
122
+ },
123
+ {
124
+ "type": "function",
125
+ "stateMutability": "view",
126
+ "outputs": [
127
+ {
128
+ "type": "uint256",
129
+ "name": ""
130
+ }
131
+ ],
132
+ "name": "calc_token_amount",
133
+ "inputs": [
134
+ {
135
+ "type": "uint256[5]",
136
+ "name": "_amounts"
137
+ },
138
+ {
139
+ "type": "bool",
140
+ "name": "_is_deposit"
141
+ }
142
+ ],
143
+ "gas": "9954"
144
+ },
145
+ {
146
+ "type": "function",
147
+ "stateMutability": "view",
148
+ "outputs": [
149
+ {
150
+ "type": "uint256",
151
+ "name": ""
152
+ }
153
+ ],
154
+ "name": "calc_withdraw_one_coin",
155
+ "inputs": [
156
+ {
157
+ "type": "uint256",
158
+ "name": "token_amount"
159
+ },
160
+ {
161
+ "type": "uint256",
162
+ "name": "i"
163
+ }
164
+ ],
165
+ "gas": "14541"
166
+ },
167
+ {
168
+ "type": "function",
169
+ "stateMutability": "view",
170
+ "outputs": [
171
+ {
172
+ "type": "address",
173
+ "name": ""
174
+ }
175
+ ],
176
+ "name": "coins",
177
+ "inputs": [
178
+ {
179
+ "type": "uint256",
180
+ "name": "arg0"
181
+ }
182
+ ],
183
+ "gas": "2709"
184
+ },
185
+ {
186
+ "type": "function",
187
+ "stateMutability": "view",
188
+ "outputs": [
189
+ {
190
+ "type": "address",
191
+ "name": ""
192
+ }
193
+ ],
194
+ "name": "underlying_coins",
195
+ "inputs": [
196
+ {
197
+ "type": "uint256",
198
+ "name": "arg0"
199
+ }
200
+ ],
201
+ "gas": "2745"
202
+ },
203
+ {
204
+ "type": "function",
205
+ "stateMutability": "view",
206
+ "outputs": [
207
+ {
208
+ "type": "address",
209
+ "name": ""
210
+ }
211
+ ],
212
+ "name": "pool",
213
+ "inputs": [],
214
+ "gas": "2730"
215
+ },
216
+ {
217
+ "type": "function",
218
+ "stateMutability": "view",
219
+ "outputs": [
220
+ {
221
+ "type": "address",
222
+ "name": ""
223
+ }
224
+ ],
225
+ "name": "base_pool",
226
+ "inputs": [],
227
+ "gas": "2760"
228
+ },
229
+ {
230
+ "type": "function",
231
+ "stateMutability": "view",
232
+ "outputs": [
233
+ {
234
+ "type": "address",
235
+ "name": ""
236
+ }
237
+ ],
238
+ "name": "token",
239
+ "inputs": [],
240
+ "gas": "2790"
241
+ }
242
+ ]
@@ -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>;
@@ -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,7 @@
1
+ export declare const COINS_MOONBEAM: {
2
+ [index: string]: string;
3
+ };
4
+ export declare const cTokensMoonbeam: never[];
5
+ export declare const yTokensMoonbeam: never[];
6
+ export declare const ycTokensMoonbeam: never[];
7
+ export declare const aTokensMoonbeam: never[];
@@ -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());
@@ -10,6 +10,10 @@ exports.COINS_XDAI = (0, utils_1.lowerCaseValues)({
10
10
  'usdt': '0x4ECaBa5870353805a9F068101A40E0f32ed605C6',
11
11
  'rai': '0xd7a28aa9c470e7e9d8c676bcd5dd2f40c5683afa',
12
12
  'x3crv': '0x1337BedC9D22ecbe766dF105c9623922A27963EC',
13
+ // --- BTC ---
14
+ 'wbtc': '0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252',
15
+ // --- ETH ---
16
+ 'weth': '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
13
17
  });
14
18
  exports.cTokensXDai = []; //.map((a) => a.toLowerCase());
15
19
  exports.yTokensXDai = []; //.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
- export { POOLS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_FANTOM, POOLS_DATA_AVALANCHE, POOLS_DATA_ARBITRUM, POOLS_DATA_OPTIMISM, POOLS_DATA_XDAI, };
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,4 @@
1
+ import { IPoolData } from "../../interfaces";
2
+ export declare const POOLS_DATA_MOONBEAM: {
3
+ [index: string]: IPoolData;
4
+ };
@@ -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
+ });
@@ -7,6 +7,8 @@ exports.POOLS_DATA_XDAI = void 0;
7
7
  var swap_json_1 = __importDefault(require("../abis/3pool/swap.json"));
8
8
  var swap_json_2 = __importDefault(require("../abis/rai/swap.json"));
9
9
  var deposit_json_1 = __importDefault(require("../abis/rai/deposit.json"));
10
+ var swap_json_3 = __importDefault(require("../abis/tricrypto-xdai/swap.json"));
11
+ var zap_json_1 = __importDefault(require("../abis/tricrypto-xdai/zap.json"));
10
12
  var gauge_rewards_only_json_1 = __importDefault(require("../abis/gauge_rewards_only.json"));
11
13
  var streamer_json_1 = __importDefault(require("../abis/streamer.json"));
12
14
  var utils_1 = require("../utils");
@@ -68,4 +70,36 @@ exports.POOLS_DATA_XDAI = (0, utils_1.lowerCasePoolDataAddresses)({
68
70
  gauge_abi: gauge_rewards_only_json_1.default,
69
71
  deposit_abi: deposit_json_1.default,
70
72
  },
73
+ tricrypto: {
74
+ name: "tricrypto",
75
+ full_name: "tricrypto",
76
+ symbol: "tricrypto",
77
+ reference_asset: 'CRYPTO',
78
+ swap_address: '0x5633E00994896D0F472926050eCb32E38bef3e65',
79
+ token_address: '0x02E7e2dd3BA409148A49D5cc9a9034D2f884F245',
80
+ gauge_address: '0x0000000000000000000000000000000000000000',
81
+ deposit_address: '0xF182926A64C0A19234E7E1FCDfE772aA7A1CA351',
82
+ is_crypto: true,
83
+ is_meta: true,
84
+ base_pool: '3pool',
85
+ underlying_coins: ['WXDAI', 'USDC', 'USDT', 'WBTC', 'WETH'],
86
+ wrapped_coins: ['x3CRV', 'WBTC', 'WETH'],
87
+ underlying_coin_addresses: [
88
+ '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
89
+ '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83',
90
+ '0x4ECaBa5870353805a9F068101A40E0f32ed605C6',
91
+ '0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252',
92
+ '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
93
+ ],
94
+ wrapped_coin_addresses: [
95
+ '0x1337BedC9D22ecbe766dF105c9623922A27963EC',
96
+ '0x8e5bBbb09Ed1ebdE8674Cda39A0c169401db4252',
97
+ '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1',
98
+ ],
99
+ underlying_decimals: [18, 6, 6, 8, 18],
100
+ wrapped_decimals: [18, 8, 18],
101
+ swap_abi: swap_json_3.default,
102
+ gauge_abi: gauge_rewards_only_json_1.default,
103
+ deposit_abi: zap_json_1.default,
104
+ },
71
105
  });
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 () {
@@ -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
+ }[]>>;
@@ -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
+ });
@@ -6,92 +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 deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
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
- if (this.chainId === 1) {
18
- var fraxusdcMetaZapAddress = "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase();
19
- this.contracts[fraxusdcMetaZapAddress] = {
20
- contract: new ethers_1.Contract(fraxusdcMetaZapAddress, metaZap_json_1.default, this.signer || this.provider),
21
- multicallContract: new ethcall_1.Contract(fraxusdcMetaZapAddress, metaZap_json_1.default),
22
- };
23
- var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
24
- this.contracts[metaSBtcZapAddress] = {
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
- }
36
- else if (this.chainId === 100) {
37
- var metaUsdZapAddress = "0x87C067fAc25f123554a0E76596BF28cFa37fD5E9".toLowerCase();
38
- this.contracts[metaUsdZapAddress] = {
39
- contract: new ethers_1.Contract(metaUsdZapAddress, deposit_json_1.default, this.signer || this.provider),
40
- multicallContract: new ethcall_1.Contract(metaUsdZapAddress, deposit_json_1.default),
41
- };
42
- }
43
- else if (this.chainId === 137) {
44
- var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
45
- this.contracts[metaUsdZapAddress] = {
46
- contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
47
- multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
48
- };
49
- var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
50
- this.contracts[metaBtcZapAddress] = {
51
- contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
52
- multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
53
- };
54
- }
55
- else if (this.chainId === 250) {
56
- var metaUsdZapAddress = "0x78D51EB71a62c081550EfcC0a9F9Ea94B2Ef081c".toLowerCase();
57
- this.contracts[metaUsdZapAddress] = {
58
- contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
59
- multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default),
60
- };
61
- var metaRenBtcZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
62
- this.contracts[metaRenBtcZapAddress] = {
63
- contract: new ethers_1.Contract(metaRenBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
64
- multicallContract: new ethcall_1.Contract(metaRenBtcZapAddress, DepositZapFantom_json_1.default),
65
- };
66
- var metaGeistUsdZapAddress = "0x247aEB220E87f24c40C9F86b65d6bd5d3c987B55".toLowerCase();
67
- this.contracts[metaGeistUsdZapAddress] = {
68
- contract: new ethers_1.Contract(metaGeistUsdZapAddress, DepositZapMetaUsd2Fantom_json_1.default, this.signer || this.provider),
69
- multicallContract: new ethcall_1.Contract(metaGeistUsdZapAddress, DepositZapMetaUsd2Fantom_json_1.default),
70
- };
71
- }
72
- else if (this.chainId === 43114) {
73
- var metaUsdZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
74
- this.contracts[metaUsdZapAddress] = {
75
- contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
76
- multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
77
- };
78
- var metaBtcZapAddress = "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase();
79
- this.contracts[metaBtcZapAddress] = {
80
- contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
81
- multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
82
- };
83
- }
84
- else if (this.chainId === 42161) {
85
- var metaUsdZapAddress = "0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287".toLowerCase();
86
- this.contracts[metaUsdZapAddress] = {
87
- contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
88
- multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapFantom_json_1.default),
89
- };
90
- var metaBtcZapAddress = "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2".toLowerCase();
91
- this.contracts[metaBtcZapAddress] = {
92
- contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default, this.signer || this.provider),
93
- multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapFantom_json_1.default),
94
- };
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);
95
20
  }
96
21
  }
97
22
  exports.setFactoryZapContracts = setFactoryZapContracts;