@curvefi/api 2.10.1 → 2.12.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.
@@ -6,3 +6,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
8
  export declare const ALIASES_MOONBEAM: import("../interfaces").IDict<string>;
9
+ export declare const ALIASES_AURORA: import("../interfaces").IDict<string>;
10
+ export declare const ALIASES_KAVA: import("../interfaces").IDict<string>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.ALIASES_KAVA = exports.ALIASES_AURORA = 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",
@@ -98,3 +98,27 @@ exports.ALIASES_MOONBEAM = (0, utils_1.lowerCaseValues)({
98
98
  "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
99
99
  "registry_exchange": "",
100
100
  });
101
+ exports.ALIASES_AURORA = (0, utils_1.lowerCaseValues)({
102
+ "crv": "0x64D5BaF5ac030e2b7c435aDD967f787ae94D0205",
103
+ "minter": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
104
+ "voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
105
+ "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
106
+ "address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
107
+ "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
108
+ "deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
109
+ "factory": '0xb9fc157394af804a3578134a6585c0dc9cc990d4',
110
+ "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
111
+ "registry_exchange": "",
112
+ });
113
+ exports.ALIASES_KAVA = (0, utils_1.lowerCaseValues)({
114
+ "crv": "0x64D5BaF5ac030e2b7c435aDD967f787ae94D0205",
115
+ "minter": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
116
+ "voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
117
+ "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
118
+ "address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
119
+ "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
120
+ "deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
121
+ "factory": '0x40bc62805471eF53DdD5C5cF99ed3d9e5aa81b48',
122
+ "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
123
+ "registry_exchange": "",
124
+ });
@@ -0,0 +1,7 @@
1
+ export declare const COINS_AURORA: {
2
+ [index: string]: string;
3
+ };
4
+ export declare const cTokensAurora: never[];
5
+ export declare const yTokensAurora: never[];
6
+ export declare const ycTokensAurora: never[];
7
+ export declare const aTokensAurora: never[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aTokensAurora = exports.ycTokensAurora = exports.yTokensAurora = exports.cTokensAurora = exports.COINS_AURORA = void 0;
4
+ var utils_1 = require("../utils");
5
+ exports.COINS_AURORA = (0, utils_1.lowerCaseValues)({
6
+ 'crv': '0x64D5BaF5ac030e2b7c435aDD967f787ae94D0205',
7
+ // --- USD ---
8
+ 'dai': '0xe3520349F477A5F6EB06107066048508498A291b',
9
+ 'usdc': '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
10
+ 'usdt': '0x4988a896b1227218e4A686fdE5EabdcAbd91571f',
11
+ '3crv': '0xbF7E49483881C76487b0989CD7d9A8239B20CA41',
12
+ });
13
+ exports.cTokensAurora = []; //.map((a) => a.toLowerCase());
14
+ exports.yTokensAurora = []; //.map((a) => a.toLowerCase());
15
+ exports.ycTokensAurora = []; //.map((a) => a.toLowerCase());
16
+ exports.aTokensAurora = []; //.map((a) => a.toLowerCase());
@@ -0,0 +1,7 @@
1
+ export declare const COINS_KAVA: {
2
+ [index: string]: string;
3
+ };
4
+ export declare const cTokensKava: never[];
5
+ export declare const yTokensKava: never[];
6
+ export declare const ycTokensKava: never[];
7
+ export declare const aTokensKava: never[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aTokensKava = exports.ycTokensKava = exports.yTokensKava = exports.cTokensKava = exports.COINS_KAVA = void 0;
4
+ var utils_1 = require("../utils");
5
+ exports.COINS_KAVA = (0, utils_1.lowerCaseValues)({
6
+ 'crv': '0x64D5BaF5ac030e2b7c435aDD967f787ae94D0205',
7
+ // --- USD ---
8
+ 'dai': '0x765277EebeCA2e31912C9946eAe1021199B39C61',
9
+ 'usdc': '0xfA9343C3897324496A05fC75abeD6bAC29f8A40f',
10
+ 'usdt': '0xB44a9B6905aF7c801311e8F4E76932ee959c663C',
11
+ '3crv': '0x7A0e3b70b1dB0D6CA63Cac240895b2D21444A7b9',
12
+ });
13
+ exports.cTokensKava = []; //.map((a) => a.toLowerCase());
14
+ exports.yTokensKava = []; //.map((a) => a.toLowerCase());
15
+ exports.ycTokensKava = []; //.map((a) => a.toLowerCase());
16
+ exports.aTokensKava = []; //.map((a) => a.toLowerCase());
@@ -0,0 +1,4 @@
1
+ import { IPoolData } from "../../interfaces";
2
+ export declare const POOLS_DATA_AURORA: {
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_AURORA = void 0;
7
+ var swap_json_1 = __importDefault(require("../abis/3pool-optimism/swap.json"));
8
+ var gauge_rewards_only_json_1 = __importDefault(require("../abis/gauge_rewards_only.json"));
9
+ var utils_1 = require("../utils");
10
+ exports.POOLS_DATA_AURORA = (0, utils_1.lowerCasePoolDataAddresses)({
11
+ '3pool': {
12
+ name: "3pool",
13
+ full_name: "3pool",
14
+ symbol: "3pool",
15
+ reference_asset: 'USD',
16
+ swap_address: '0xbF7E49483881C76487b0989CD7d9A8239B20CA41',
17
+ token_address: '0xbF7E49483881C76487b0989CD7d9A8239B20CA41',
18
+ gauge_address: '0xC2b1DF84112619D190193E48148000e3990Bf627',
19
+ is_plain: true,
20
+ underlying_coins: ['DAI', 'USDC', 'USDT'],
21
+ wrapped_coins: ['DAI', 'USDC', 'USDT'],
22
+ underlying_coin_addresses: [
23
+ '0xe3520349F477A5F6EB06107066048508498A291b',
24
+ '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
25
+ '0x4988a896b1227218e4A686fdE5EabdcAbd91571f',
26
+ ],
27
+ wrapped_coin_addresses: [
28
+ '0xe3520349F477A5F6EB06107066048508498A291b',
29
+ '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
30
+ '0x4988a896b1227218e4A686fdE5EabdcAbd91571f',
31
+ ],
32
+ underlying_decimals: [18, 6, 6],
33
+ wrapped_decimals: [18, 6, 6],
34
+ swap_abi: swap_json_1.default,
35
+ gauge_abi: gauge_rewards_only_json_1.default,
36
+ },
37
+ });
@@ -6,4 +6,6 @@ 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, };
9
+ import { POOLS_DATA_AURORA } from "./aurora";
10
+ import { POOLS_DATA_KAVA } from "./kava";
11
+ 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, POOLS_DATA_AURORA, POOLS_DATA_KAVA, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.POOLS_DATA_KAVA = exports.POOLS_DATA_AURORA = 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");
@@ -17,3 +17,7 @@ var xdai_1 = require("./xdai");
17
17
  Object.defineProperty(exports, "POOLS_DATA_XDAI", { enumerable: true, get: function () { return xdai_1.POOLS_DATA_XDAI; } });
18
18
  var moonbeam_1 = require("./moonbeam");
19
19
  Object.defineProperty(exports, "POOLS_DATA_MOONBEAM", { enumerable: true, get: function () { return moonbeam_1.POOLS_DATA_MOONBEAM; } });
20
+ var aurora_1 = require("./aurora");
21
+ Object.defineProperty(exports, "POOLS_DATA_AURORA", { enumerable: true, get: function () { return aurora_1.POOLS_DATA_AURORA; } });
22
+ var kava_1 = require("./kava");
23
+ Object.defineProperty(exports, "POOLS_DATA_KAVA", { enumerable: true, get: function () { return kava_1.POOLS_DATA_KAVA; } });
@@ -0,0 +1,4 @@
1
+ import { IPoolData } from "../../interfaces";
2
+ export declare const POOLS_DATA_KAVA: {
3
+ [index: string]: IPoolData;
4
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.POOLS_DATA_KAVA = void 0;
4
+ var utils_1 = require("../utils");
5
+ exports.POOLS_DATA_KAVA = (0, utils_1.lowerCasePoolDataAddresses)({});
package/lib/curve.d.ts CHANGED
@@ -2,6 +2,14 @@ import { ethers, Contract } from "ethers";
2
2
  import { Networkish } from "@ethersproject/networks";
3
3
  import { Provider as MulticallProvider, Contract as MulticallContract } from 'ethcall';
4
4
  import { IPoolData, IDict, ICurve, INetworkName } from "./interfaces";
5
+ export declare const NATIVE_TOKENS: {
6
+ [index: number]: {
7
+ symbol: string;
8
+ wrappedSymbol: string;
9
+ address: string;
10
+ wrappedAddress: string;
11
+ };
12
+ };
5
13
  export declare const NETWORK_CONSTANTS: {
6
14
  [index: number]: any;
7
15
  };
@@ -31,6 +39,12 @@ declare class Curve implements ICurve {
31
39
  maxPriorityFeePerGas?: number | ethers.BigNumber;
32
40
  };
33
41
  constants: {
42
+ NATIVE_TOKEN: {
43
+ symbol: string;
44
+ wrappedSymbol: string;
45
+ address: string;
46
+ wrappedAddress: string;
47
+ };
34
48
  NETWORK_NAME: INetworkName;
35
49
  ALIASES: IDict<string>;
36
50
  POOLS_DATA: IDict<IPoolData>;
package/lib/curve.js CHANGED
@@ -59,7 +59,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
59
59
  return (mod && mod.__esModule) ? mod : { "default": mod };
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.curve = exports.NETWORK_CONSTANTS = void 0;
62
+ exports.curve = exports.NETWORK_CONSTANTS = exports.NATIVE_TOKENS = void 0;
63
63
  var ethers_1 = require("ethers");
64
64
  var ethcall_1 = require("ethcall");
65
65
  var factory_1 = require("./factory/factory");
@@ -89,7 +89,71 @@ 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
91
  var moonbeam_1 = require("./constants/coins/moonbeam");
92
+ var aurora_1 = require("./constants/coins/aurora");
93
+ var kava_1 = require("./constants/coins/kava");
92
94
  var utils_1 = require("./constants/utils");
95
+ exports.NATIVE_TOKENS = {
96
+ 1: {
97
+ symbol: 'ETH',
98
+ wrappedSymbol: 'WETH',
99
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
100
+ wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'.toLowerCase(),
101
+ },
102
+ 10: {
103
+ symbol: 'ETH',
104
+ wrappedSymbol: 'WETH',
105
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
106
+ wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
107
+ },
108
+ 100: {
109
+ symbol: 'XDAi',
110
+ wrappedSymbol: 'WXDAI',
111
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
112
+ wrappedAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'.toLowerCase(),
113
+ },
114
+ 137: {
115
+ symbol: 'MATIC',
116
+ wrappedSymbol: 'WMATIC',
117
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
118
+ wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'.toLowerCase(),
119
+ },
120
+ 250: {
121
+ symbol: 'FTM',
122
+ wrappedSymbol: 'WFTM',
123
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
124
+ wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
125
+ },
126
+ 1284: {
127
+ symbol: 'GLMR',
128
+ wrappedSymbol: 'WGLMR',
129
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
130
+ wrappedAddress: '0xAcc15dC74880C9944775448304B263D191c6077F'.toLowerCase(),
131
+ },
132
+ 2222: {
133
+ symbol: 'KAVA',
134
+ wrappedSymbol: 'WKAVA',
135
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
136
+ wrappedAddress: '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b'.toLowerCase(),
137
+ },
138
+ 43114: {
139
+ symbol: 'AVAX',
140
+ wrappedSymbol: 'WAVAX',
141
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
142
+ wrappedAddress: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'.toLowerCase(),
143
+ },
144
+ 42161: {
145
+ symbol: 'ETH',
146
+ wrappedSymbol: 'WETH',
147
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
148
+ wrappedAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'.toLowerCase(),
149
+ },
150
+ 1313161554: {
151
+ symbol: 'ETH',
152
+ wrappedSymbol: 'WETH',
153
+ address: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
154
+ wrappedAddress: '0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB'.toLowerCase(),
155
+ },
156
+ };
93
157
  exports.NETWORK_CONSTANTS = {
94
158
  1: {
95
159
  NAME: 'ethereum',
@@ -151,6 +215,16 @@ exports.NETWORK_CONSTANTS = {
151
215
  ycTokens: moonbeam_1.ycTokensMoonbeam,
152
216
  aTokens: moonbeam_1.aTokensMoonbeam,
153
217
  },
218
+ 2222: {
219
+ NAME: 'kava',
220
+ ALIASES: aliases_1.ALIASES_KAVA,
221
+ POOLS_DATA: pools_1.POOLS_DATA_KAVA,
222
+ COINS: kava_1.COINS_KAVA,
223
+ cTokens: kava_1.cTokensKava,
224
+ yTokens: kava_1.yTokensKava,
225
+ ycTokens: kava_1.ycTokensKava,
226
+ aTokens: kava_1.aTokensKava,
227
+ },
154
228
  43114: {
155
229
  NAME: 'avalanche',
156
230
  ALIASES: aliases_1.ALIASES_AVALANCHE,
@@ -171,6 +245,16 @@ exports.NETWORK_CONSTANTS = {
171
245
  ycTokens: arbitrum_1.ycTokensArbitrum,
172
246
  aTokens: arbitrum_1.aTokensArbitrum,
173
247
  },
248
+ 1313161554: {
249
+ NAME: 'aurora',
250
+ ALIASES: aliases_1.ALIASES_AURORA,
251
+ POOLS_DATA: pools_1.POOLS_DATA_AURORA,
252
+ COINS: aurora_1.COINS_AURORA,
253
+ cTokens: aurora_1.cTokensAurora,
254
+ yTokens: aurora_1.yTokensAurora,
255
+ ycTokens: aurora_1.ycTokensAurora,
256
+ aTokens: aurora_1.aTokensAurora,
257
+ },
174
258
  };
175
259
  var Curve = /** @class */ (function () {
176
260
  function Curve() {
@@ -187,6 +271,7 @@ var Curve = /** @class */ (function () {
187
271
  this.constantOptions = { gasLimit: 12000000 };
188
272
  this.options = {};
189
273
  this.constants = {
274
+ NATIVE_TOKEN: exports.NATIVE_TOKENS[1],
190
275
  NETWORK_NAME: 'ethereum',
191
276
  ALIASES: {},
192
277
  POOLS_DATA: {},
@@ -219,6 +304,7 @@ var Curve = /** @class */ (function () {
219
304
  this.constantOptions = { gasLimit: 12000000 };
220
305
  this.options = {};
221
306
  this.constants = {
307
+ NATIVE_TOKEN: exports.NATIVE_TOKENS[1],
222
308
  NETWORK_NAME: 'ethereum',
223
309
  ALIASES: {},
224
310
  POOLS_DATA: {},
@@ -275,6 +361,7 @@ var Curve = /** @class */ (function () {
275
361
  network = _b;
276
362
  console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
277
363
  this.chainId = network.chainId === 1337 ? 1 : network.chainId;
364
+ this.constants.NATIVE_TOKEN = exports.NATIVE_TOKENS[this.chainId];
278
365
  this.constants.NETWORK_NAME = exports.NETWORK_CONSTANTS[this.chainId].NAME;
279
366
  this.constants.ALIASES = exports.NETWORK_CONSTANTS[this.chainId].ALIASES;
280
367
  this.constants.POOLS_DATA = exports.NETWORK_CONSTANTS[this.chainId].POOLS_DATA;
@@ -496,6 +583,8 @@ var Curve = /** @class */ (function () {
496
583
  return __generator(this, function (_e) {
497
584
  switch (_e.label) {
498
585
  case 0:
586
+ if (this.chainId === 1313161554)
587
+ return [2 /*return*/];
499
588
  if (!useApi) return [3 /*break*/, 2];
500
589
  _a = this.constants;
501
590
  _b = utils_1.lowerCasePoolDataAddresses;
@@ -3,24 +3,24 @@ 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<{
6
+ export declare const _getLegacyAPYsAndVolumes: ((network: string) => Promise<IDict<{
7
7
  apy: {
8
8
  day: number;
9
9
  week: number;
10
10
  };
11
11
  volume: number;
12
- }>>) & memoize.Memoized<() => Promise<IDict<{
12
+ }>>) & memoize.Memoized<(network: string) => Promise<IDict<{
13
13
  apy: {
14
14
  day: number;
15
15
  week: number;
16
16
  };
17
17
  volume: number;
18
18
  }>>>;
19
- export declare const _getMoonbeamFactoryAPYsAndVolumes: (() => Promise<{
19
+ export declare const _getFactoryAPYsAndVolumes: ((network: string) => Promise<{
20
20
  poolAddress: string;
21
21
  apy: number;
22
22
  volume: number;
23
- }[]>) & memoize.Memoized<() => Promise<{
23
+ }[]>) & memoize.Memoized<(network: string) => Promise<{
24
24
  poolAddress: string;
25
25
  apy: number;
26
26
  volume: number;
@@ -39,9 +39,10 @@ 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._getMoonbeamFactoryAPYsAndVolumes = exports._getMoonbeamLegacyAPYsAndVolumes = exports._getMainPoolsGaugeRewards = exports._getSubgraphData = exports._getPoolsFromApi = void 0;
42
+ exports._getFactoryAPYsAndVolumes = exports._getLegacyAPYsAndVolumes = 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
+ var curve_1 = require("./curve");
45
46
  exports._getPoolsFromApi = (0, memoizee_1.default)(function (network, poolType) { return __awaiter(void 0, void 0, void 0, function () {
46
47
  var url, response;
47
48
  var _a;
@@ -92,12 +93,15 @@ exports._getMainPoolsGaugeRewards = (0, memoizee_1.default)(function () { return
92
93
  promise: true,
93
94
  maxAge: 5 * 60 * 1000, // 5m
94
95
  });
95
- exports._getMoonbeamLegacyAPYsAndVolumes = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
96
+ // Moonbeam and Aurora only
97
+ exports._getLegacyAPYsAndVolumes = (0, memoizee_1.default)(function (network) { return __awaiter(void 0, void 0, void 0, function () {
96
98
  var url, data, result;
97
99
  return __generator(this, function (_a) {
98
100
  switch (_a.label) {
99
101
  case 0:
100
- url = "https://stats.curve.fi/raw-stats-moonbeam/apys.json";
102
+ if (curve_1.curve.chainId === 2222)
103
+ return [2 /*return*/, {}]; // Exclude Kava
104
+ url = "https://stats.curve.fi/raw-stats-".concat(network, "/apys.json");
101
105
  return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
102
106
  case 1:
103
107
  data = (_a.sent()).data;
@@ -115,13 +119,16 @@ exports._getMoonbeamLegacyAPYsAndVolumes = (0, memoizee_1.default)(function () {
115
119
  promise: true,
116
120
  maxAge: 5 * 60 * 1000, // 5m
117
121
  });
118
- exports._getMoonbeamFactoryAPYsAndVolumes = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
122
+ // Moonbeam and Kava only
123
+ exports._getFactoryAPYsAndVolumes = (0, memoizee_1.default)(function (network) { return __awaiter(void 0, void 0, void 0, function () {
119
124
  var url, response;
120
125
  var _a;
121
126
  return __generator(this, function (_b) {
122
127
  switch (_b.label) {
123
128
  case 0:
124
- url = "https://api.curve.fi/api/getFactoryAPYs-moonbeam";
129
+ if (curve_1.curve.chainId !== 1284 && curve_1.curve.chainId !== 2222)
130
+ return [2 /*return*/, []];
131
+ url = "https://api.curve.fi/api/getFactoryAPYs-".concat(network);
125
132
  return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
126
133
  case 1:
127
134
  response = _b.sent();
@@ -7,6 +7,7 @@ export declare const implementationABIDictArbitrum: IDict<any>;
7
7
  export declare const implementationABIDictOptimism: IDict<any>;
8
8
  export declare const implementationABIDictXDai: IDict<any>;
9
9
  export declare const implementationABIDictMoonbeam: IDict<any>;
10
+ export declare const implementationABIDictKava: IDict<any>;
10
11
  export declare const implementationBasePoolIdDictEthereum: IDict<string>;
11
12
  export declare const implementationBasePoolIdDictPolygon: IDict<string>;
12
13
  export declare const implementationBasePoolIdDictFantom: IDict<string>;
@@ -15,6 +16,7 @@ export declare const implementationBasePoolIdDictArbitrum: IDict<string>;
15
16
  export declare const implementationBasePoolIdDictOptimism: IDict<string>;
16
17
  export declare const implementationBasePoolIdDictXDai: IDict<string>;
17
18
  export declare const implementationBasePoolIdDictMoonbeam: IDict<string>;
19
+ export declare const implementationBasePoolIdDictKava: IDict<string>;
18
20
  export declare const basePoolIdZapDictEthereum: IDict<{
19
21
  address: string;
20
22
  ABI: any;
@@ -47,14 +49,10 @@ export declare const basePoolIdZapDictMoonbeam: IDict<{
47
49
  address: string;
48
50
  ABI: any;
49
51
  }>;
50
- export declare const NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
51
- export declare const NATIVE_TOKENS: {
52
- [index: number]: {
53
- symbol: string;
54
- wrappedSymbol: string;
55
- wrappedAddress: string;
56
- };
57
- };
52
+ export declare const basePoolIdZapDictKava: IDict<{
53
+ address: string;
54
+ ABI: any;
55
+ }>;
58
56
  export declare const FACTORY_CONSTANTS: {
59
57
  [index: number]: {
60
58
  implementationABIDict: IDict<any>;
@@ -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.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;
6
+ exports.FACTORY_CONSTANTS = exports.basePoolIdZapDictKava = exports.basePoolIdZapDictMoonbeam = exports.basePoolIdZapDictXDai = exports.basePoolIdZapDictOptimism = exports.basePoolIdZapDictArbitrum = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictFantom = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictKava = exports.implementationBasePoolIdDictMoonbeam = exports.implementationBasePoolIdDictXDai = exports.implementationBasePoolIdDictOptimism = exports.implementationBasePoolIdDictArbitrum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictFantom = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictKava = 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"));
@@ -180,6 +180,21 @@ exports.implementationABIDictMoonbeam = {
180
180
  "0xec9cEBE650E181079576C1b6d0d2e092B1EdfF13": Plain4ETH_json_1.default,
181
181
  "0xe8269B33E47761f552E1a3070119560d5fa8bBD6": Plain4Optimized_json_1.default,
182
182
  };
183
+ exports.implementationABIDictKava = {
184
+ "0x2632679f5ca396a1bd2647092d9dbf7ec5d7b263": Plain2Basic_json_1.default,
185
+ "0x12f196251efcaca0fd73d5b58132b16760ba96a8": Plain2Balances_json_1.default,
186
+ "0xafdab4f8f6e6992b16e3906295fba390aab59ca5": Plain2ETH_json_1.default,
187
+ "0x50d7a3e0d5350d52e9e08a1b58eefd1db8759d7d": Plain2Optimized_json_1.default,
188
+ "0xc8913d486a42459e6b34db33f0c660fca61306b9": Plain3Basic_json_1.default,
189
+ "0xc8913D486a42459e6B34db33F0C660FCa61306b9": Plain3Basic_json_1.default,
190
+ "0xc5ec776a55ea062fa3173c6c76703e9c9fa91c47": Plain3Balances_json_1.default,
191
+ "0xed2c5f2c4cab6e82630d5615ea15dd47d8b29983": Plain3ETH_json_1.default,
192
+ "0xe7d5293c01685a414ddde527eb5effbf92b52648": Plain3Optimized_json_1.default,
193
+ "0x77016d2de65de15a3c36bebbddc90804f670d2d0": Plain4Basic_json_1.default,
194
+ "0xd59c875dccb6cdcb3a75b91b58a363b5e4b0ca9a": Plain4Balances_json_1.default,
195
+ "0x6378dd741b24bd884f3590d7bc7555fdb2f5b003": Plain4ETH_json_1.default,
196
+ "0x509495dfeec3a53acb2f60669985d868131ad9a5": Plain4Optimized_json_1.default,
197
+ };
183
198
  exports.implementationBasePoolIdDictEthereum = {
184
199
  "0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
185
200
  "0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
@@ -230,6 +245,7 @@ exports.implementationBasePoolIdDictXDai = {
230
245
  "0x0B4dc7A945695D11FD83e40B2DfC2B896A02395F": "3pool",
231
246
  };
232
247
  exports.implementationBasePoolIdDictMoonbeam = {};
248
+ exports.implementationBasePoolIdDictKava = {};
233
249
  exports.basePoolIdZapDictEthereum = {
234
250
  '3pool': {
235
251
  address: "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
@@ -313,50 +329,7 @@ exports.basePoolIdZapDictXDai = {
313
329
  },
314
330
  };
315
331
  exports.basePoolIdZapDictMoonbeam = {};
316
- // TODO Move to another place
317
- exports.NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
318
- exports.NATIVE_TOKENS = {
319
- 1: {
320
- symbol: 'ETH',
321
- wrappedSymbol: 'WETH',
322
- wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'.toLowerCase(),
323
- },
324
- 10: {
325
- symbol: 'ETH',
326
- wrappedSymbol: 'WETH',
327
- wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
328
- },
329
- 100: {
330
- symbol: 'XDAi',
331
- wrappedSymbol: 'WXDAI',
332
- wrappedAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'.toLowerCase(),
333
- },
334
- 137: {
335
- symbol: 'MATIC',
336
- wrappedSymbol: 'WMATIC',
337
- wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'.toLowerCase(),
338
- },
339
- 250: {
340
- symbol: 'FTM',
341
- wrappedSymbol: 'WFTM',
342
- wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
343
- },
344
- 1284: {
345
- symbol: 'GLMR',
346
- wrappedSymbol: 'WGLMR',
347
- wrappedAddress: '0xAcc15dC74880C9944775448304B263D191c6077F'.toLowerCase(),
348
- },
349
- 43114: {
350
- symbol: 'AVAX',
351
- wrappedSymbol: 'WAVAX',
352
- wrappedAddress: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'.toLowerCase(),
353
- },
354
- 42161: {
355
- symbol: 'ETH',
356
- wrappedSymbol: 'WETH',
357
- wrappedAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'.toLowerCase(),
358
- },
359
- };
332
+ exports.basePoolIdZapDictKava = {};
360
333
  exports.FACTORY_CONSTANTS = {
361
334
  1: {
362
335
  implementationABIDict: exports.implementationABIDictEthereum,
@@ -388,6 +361,11 @@ exports.FACTORY_CONSTANTS = {
388
361
  implementationBasePoolIdDict: exports.implementationBasePoolIdDictMoonbeam,
389
362
  basePoolIdZapDict: exports.basePoolIdZapDictMoonbeam,
390
363
  },
364
+ 2222: {
365
+ implementationABIDict: exports.implementationABIDictKava,
366
+ implementationBasePoolIdDict: exports.implementationBasePoolIdDictKava,
367
+ basePoolIdZapDict: exports.basePoolIdZapDictKava,
368
+ },
391
369
  43114: {
392
370
  implementationABIDict: exports.implementationABIDictAvalanche,
393
371
  implementationBasePoolIdDict: exports.implementationBasePoolIdDictAvalanche,
@@ -65,6 +65,7 @@ var ethers_1 = require("ethers");
65
65
  var ethcall_1 = require("ethcall");
66
66
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
67
67
  var gauge_child_json_1 = __importDefault(require("../constants/abis/gauge_child.json"));
68
+ var gauge_rewards_only_json_1 = __importDefault(require("../constants/abis/gauge_rewards_only.json"));
68
69
  var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
69
70
  var ERC20_json_1 = __importDefault(require("../constants/abis/ERC20.json"));
70
71
  var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/factory-crypto/factory-crypto-pool-2.json"));
@@ -109,8 +110,8 @@ function setFactoryGaugeContracts(rawPoolList) {
109
110
  if (pool.gaugeAddress) {
110
111
  var addr = pool.gaugeAddress.toLowerCase();
111
112
  _this.contracts[addr] = {
112
- contract: new ethers_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default, _this.signer || _this.provider),
113
- multicallContract: new ethcall_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default),
113
+ contract: new ethers_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : _this.chainId === 2222 ? gauge_rewards_only_json_1.default : gauge_child_json_1.default, _this.signer || _this.provider),
114
+ multicallContract: new ethcall_1.Contract(addr, _this.chainId === 1 ? gauge_factory_json_1.default : _this.chainId === 2222 ? gauge_rewards_only_json_1.default : gauge_child_json_1.default),
114
115
  };
115
116
  }
116
117
  });
@@ -193,11 +194,11 @@ function getFactoryPoolsDataFromApi(isCrypto) {
193
194
  var coinAddresses = pool.coins.map(function (c) { return c.address.toLowerCase(); });
194
195
  var coinNames = pool.coins.map(function (c) { return c.symbol; });
195
196
  var coinDecimals = pool.coins.map(function (c) { return Number(c.decimals); });
196
- var nativeToken = constants_1.NATIVE_TOKENS[_this.chainId];
197
+ var nativeToken = _this.constants.NATIVE_TOKEN;
197
198
  if (isCrypto) {
198
199
  var cryptoCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.symbol ? nativeToken.wrappedSymbol : c.symbol; });
199
200
  var underlyingCoinNames = pool.coins.map(function (c) { return c.symbol === nativeToken.wrappedSymbol ? nativeToken.symbol : c.symbol; });
200
- var underlyingCoinAddresses = coinAddresses.map(function (addr) { return addr === nativeToken.wrappedAddress ? constants_1.NATIVE_TOKEN_ADDRESS : addr; });
201
+ var underlyingCoinAddresses = coinAddresses.map(function (addr) { return addr === nativeToken.wrappedAddress ? nativeToken.address : addr; });
201
202
  var isPlain = !coinAddresses.includes(nativeToken.wrappedAddress);
202
203
  var isMeta = _this.chainId === 137 && coinAddresses[1].toLowerCase() === atricrypto3Lp;
203
204
  if (isMeta) {
@@ -318,7 +319,7 @@ function getFactoryPoolsDataFromApi(isCrypto) {
318
319
  underlying_decimals: coinDecimals,
319
320
  wrapped_decimals: coinDecimals,
320
321
  swap_abi: implementationABIDict[pool.implementationAddress],
321
- gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : gauge_child_json_1.default,
322
+ gauge_abi: _this.chainId === 1 ? gauge_factory_json_1.default : _this.chainId === 2222 ? gauge_rewards_only_json_1.default : gauge_child_json_1.default, // TODO remove RewardsOnly for Kava
322
323
  };
323
324
  }
324
325
  });
@@ -56,7 +56,6 @@ var factory_crypto_pool_2_json_1 = __importDefault(require("../constants/abis/fa
56
56
  var gauge_factory_json_1 = __importDefault(require("../constants/abis/gauge_factory.json"));
57
57
  var gauge_child_json_1 = __importDefault(require("../constants/abis/gauge_child.json"));
58
58
  var base_pool_zap_json_1 = __importDefault(require("../constants/abis/atricrypto3/base_pool_zap.json"));
59
- var constants_1 = require("./constants");
60
59
  var common_1 = require("./common");
61
60
  var deepFlatten = function (arr) { return [].concat.apply([], arr.map(function (v) { return (Array.isArray(v) ? deepFlatten(v) : v); })); };
62
61
  function getCryptoFactoryIdsAndSwapAddresses() {
@@ -211,7 +210,7 @@ function getCryptoFactoryUnderlyingCoinAddresses(coinAddresses) {
211
210
  return __awaiter(this, void 0, void 0, function () {
212
211
  var _this = this;
213
212
  return __generator(this, function (_a) {
214
- return [2 /*return*/, coinAddresses.map(function (coins) { return coins.map(function (c) { return c === constants_1.NATIVE_TOKENS[_this.chainId].wrappedAddress ? constants_1.NATIVE_TOKEN_ADDRESS : c; }); })];
213
+ return [2 /*return*/, coinAddresses.map(function (coins) { return coins.map(function (c) { return c === _this.constants.NATIVE_TOKEN.wrappedAddress ? _this.constants.NATIVE_TOKEN.address : c; }); })];
215
214
  });
216
215
  });
217
216
  }
@@ -234,21 +233,23 @@ function getExistingCoinAddressNameDict() {
234
233
  _loop_1(poolData);
235
234
  }
236
235
  if (this.chainId === 1)
237
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
236
+ dict[this.constants.NATIVE_TOKEN.address] = "ETH";
238
237
  if (this.chainId === 10)
239
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
238
+ dict[this.constants.NATIVE_TOKEN.address] = "ETH";
240
239
  if (this.chainId === 100)
241
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "XDAI";
240
+ dict[this.constants.NATIVE_TOKEN.address] = "XDAI";
242
241
  if (this.chainId === 137)
243
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
242
+ dict[this.constants.NATIVE_TOKEN.address] = "MATIC";
244
243
  if (this.chainId === 250)
245
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
244
+ dict[this.constants.NATIVE_TOKEN.address] = "FTM";
246
245
  if (this.chainId === 1284)
247
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "GLMR";
246
+ dict[this.constants.NATIVE_TOKEN.address] = "GLMR";
247
+ if (this.chainId === 2222)
248
+ dict[this.constants.NATIVE_TOKEN.address] = "KAVA";
248
249
  if (this.chainId === 43114)
249
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
250
+ dict[this.constants.NATIVE_TOKEN.address] = "AVAX";
250
251
  if (this.chainId === 42161)
251
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
252
+ dict[this.constants.NATIVE_TOKEN.address] = "ETH";
252
253
  return dict;
253
254
  }
254
255
  function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
@@ -282,7 +283,7 @@ function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
282
283
  newCoinAddresses.forEach(function (addr, i) {
283
284
  coinAddrNamesDict[addr] = names[i];
284
285
  });
285
- coinAddrNamesDict[constants_1.NATIVE_TOKEN_ADDRESS] = constants_1.NATIVE_TOKENS[this.chainId].symbol;
286
+ coinAddrNamesDict[this.constants.NATIVE_TOKEN.address] = this.constants.NATIVE_TOKEN.symbol;
286
287
  return [2 /*return*/, coinAddrNamesDict];
287
288
  }
288
289
  });
@@ -316,7 +317,7 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
316
317
  newCoinAddresses.forEach(function (addr, i) {
317
318
  coinAddressDecimalsDict[addr] = decimals[i];
318
319
  });
319
- coinAddressDecimalsDict[constants_1.NATIVE_TOKEN_ADDRESS] = 18;
320
+ coinAddressDecimalsDict[this.constants.NATIVE_TOKEN.address] = 18;
320
321
  return [2 /*return*/, coinAddressDecimalsDict];
321
322
  }
322
323
  });
@@ -79,6 +79,7 @@ var BLACK_LIST = {
79
79
  ],
80
80
  250: [],
81
81
  1284: [],
82
+ 2222: [],
82
83
  43114: [],
83
84
  42161: [],
84
85
  };
@@ -269,21 +270,23 @@ function getExistingCoinAddressNameDict() {
269
270
  _loop_1(poolData);
270
271
  }
271
272
  if (this.chainId === 1)
272
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
273
+ dict[this.constants.NATIVE_TOKEN.address] = "ETH";
273
274
  if (this.chainId === 10)
274
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
275
+ dict[this.constants.NATIVE_TOKEN.address] = "ETH";
275
276
  if (this.chainId === 100)
276
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "XDAI";
277
+ dict[this.constants.NATIVE_TOKEN.address] = "XDAI";
277
278
  if (this.chainId === 137)
278
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "MATIC";
279
+ dict[this.constants.NATIVE_TOKEN.address] = "MATIC";
279
280
  if (this.chainId === 250)
280
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "FTM";
281
+ dict[this.constants.NATIVE_TOKEN.address] = "FTM";
281
282
  if (this.chainId === 1284)
282
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "GLMR";
283
+ dict[this.constants.NATIVE_TOKEN.address] = "GLMR";
284
+ if (this.chainId === 2222)
285
+ dict[this.constants.NATIVE_TOKEN.address] = "KAVA";
283
286
  if (this.chainId === 43114)
284
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "AVAX";
287
+ dict[this.constants.NATIVE_TOKEN.address] = "AVAX";
285
288
  if (this.chainId === 42161)
286
- dict[constants_1.NATIVE_TOKEN_ADDRESS] = "ETH";
289
+ dict[this.constants.NATIVE_TOKEN.address] = "ETH";
287
290
  return dict;
288
291
  }
289
292
  function getCoinAddressNameDict(coinAddresses, existingCoinAddrNameDict) {
@@ -326,7 +329,7 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
326
329
  return __generator(this, function (_a) {
327
330
  switch (_a.label) {
328
331
  case 0:
329
- flattenedCoinAddresses = Array.from(new Set(deepFlatten(coinAddresses))).filter(function (addr) { return addr !== constants_1.NATIVE_TOKEN_ADDRESS; });
332
+ flattenedCoinAddresses = Array.from(new Set(deepFlatten(coinAddresses))).filter(function (addr) { return addr !== _this.constants.NATIVE_TOKEN.address; });
330
333
  newCoinAddresses = [];
331
334
  coinAddrNamesDict = {};
332
335
  for (_i = 0, flattenedCoinAddresses_3 = flattenedCoinAddresses; _i < flattenedCoinAddresses_3.length; _i++) {
@@ -347,7 +350,7 @@ function getCoinAddressDecimalsDict(coinAddresses, existingCoinAddressDecimalsDi
347
350
  newCoinAddresses.forEach(function (addr, i) {
348
351
  coinAddrNamesDict[addr] = decimals[i];
349
352
  });
350
- coinAddrNamesDict[constants_1.NATIVE_TOKEN_ADDRESS] = 18;
353
+ coinAddrNamesDict[this.constants.NATIVE_TOKEN.address] = 18;
351
354
  return [2 /*return*/, coinAddrNamesDict];
352
355
  }
353
356
  });
@@ -61,6 +61,12 @@ export interface ICurve {
61
61
  maxPriorityFeePerGas?: number | ethers.BigNumber;
62
62
  };
63
63
  constants: {
64
+ NATIVE_TOKEN: {
65
+ symbol: string;
66
+ wrappedSymbol: string;
67
+ address: string;
68
+ wrappedAddress: string;
69
+ };
64
70
  NETWORK_NAME: INetworkName;
65
71
  ALIASES: IDict<string>;
66
72
  POOLS_DATA: IDict<IPoolData>;
@@ -164,31 +164,32 @@ var PoolTemplate = /** @class */ (function () {
164
164
  this.statsVolume = function () { return __awaiter(_this, void 0, void 0, function () {
165
165
  var _c, mainPoolsData, factoryPoolsData, poolData_1, lpPrice, network, poolsData, poolData;
166
166
  var _this = this;
167
- return __generator(this, function (_d) {
168
- switch (_d.label) {
167
+ var _d;
168
+ return __generator(this, function (_e) {
169
+ switch (_e.label) {
169
170
  case 0:
170
- if (!(curve_1.curve.chainId === 1284)) return [3 /*break*/, 3];
171
+ if (![1284, 2222, 1313161554].includes(curve_1.curve.chainId)) return [3 /*break*/, 3];
171
172
  return [4 /*yield*/, Promise.all([
172
- (0, external_api_1._getMoonbeamLegacyAPYsAndVolumes)(),
173
- (0, external_api_1._getMoonbeamFactoryAPYsAndVolumes)(),
173
+ (0, external_api_1._getLegacyAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
174
+ (0, external_api_1._getFactoryAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
174
175
  ])];
175
176
  case 1:
176
- _c = _d.sent(), mainPoolsData = _c[0], factoryPoolsData = _c[1];
177
+ _c = _e.sent(), mainPoolsData = _c[0], factoryPoolsData = _c[1];
177
178
  if (this.id in mainPoolsData) {
178
- return [2 /*return*/, mainPoolsData[this.id].volume.toString()];
179
+ return [2 /*return*/, ((_d = mainPoolsData[this.id].volume) !== null && _d !== void 0 ? _d : 0).toString()];
179
180
  }
180
181
  poolData_1 = factoryPoolsData.find(function (d) { return d.poolAddress.toLowerCase() === _this.address; });
181
182
  if (!poolData_1)
182
183
  throw Error("Can't get Volume for ".concat(this.name, " (id: ").concat(this.id, ")"));
183
184
  return [4 /*yield*/, (0, utils_1._getUsdRate)(this.lpToken)];
184
185
  case 2:
185
- lpPrice = _d.sent();
186
+ lpPrice = _e.sent();
186
187
  return [2 /*return*/, (poolData_1.volume * lpPrice).toString()];
187
188
  case 3:
188
189
  network = curve_1.curve.constants.NETWORK_NAME;
189
190
  return [4 /*yield*/, (0, external_api_1._getSubgraphData)(network)];
190
191
  case 4:
191
- poolsData = (_d.sent());
192
+ poolsData = (_e.sent());
192
193
  poolData = poolsData.find(function (d) { return d.address.toLowerCase() === _this.address; });
193
194
  if (!poolData)
194
195
  throw Error("Can't get Volume for ".concat(this.name, " (id: ").concat(this.id, ")"));
@@ -202,10 +203,10 @@ var PoolTemplate = /** @class */ (function () {
202
203
  return __generator(this, function (_d) {
203
204
  switch (_d.label) {
204
205
  case 0:
205
- if (!(curve_1.curve.chainId === 1284)) return [3 /*break*/, 2];
206
+ if (![1284, 2222, 1313161554].includes(curve_1.curve.chainId)) return [3 /*break*/, 2];
206
207
  return [4 /*yield*/, Promise.all([
207
- (0, external_api_1._getMoonbeamLegacyAPYsAndVolumes)(),
208
- (0, external_api_1._getMoonbeamFactoryAPYsAndVolumes)(),
208
+ (0, external_api_1._getLegacyAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
209
+ (0, external_api_1._getFactoryAPYsAndVolumes)(curve_1.curve.constants.NETWORK_NAME),
209
210
  ])];
210
211
  case 1:
211
212
  _c = _d.sent(), mainPoolsData = _c[0], factoryPoolsData = _c[1];
@@ -301,7 +302,7 @@ var PoolTemplate = /** @class */ (function () {
301
302
  case 0:
302
303
  if (this.gauge === ethers_1.ethers.constants.AddressZero)
303
304
  return [2 /*return*/, []];
304
- if (![10, 100, 137, 250, 1284, 43114, 42161].includes(curve_1.curve.chainId)) return [3 /*break*/, 8];
305
+ if (!(curve_1.curve.chainId !== 1)) return [3 /*break*/, 8];
305
306
  apy = [];
306
307
  return [4 /*yield*/, this.rewardTokens()];
307
308
  case 1:
package/lib/router.d.ts CHANGED
@@ -1,12 +1,4 @@
1
1
  import { IRouteStep } from "./interfaces";
2
- export declare const NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
3
- export declare const NATIVE_TOKENS: {
4
- [index: number]: {
5
- symbol: string;
6
- wrappedSymbol: string;
7
- wrappedAddress: string;
8
- };
9
- };
10
2
  export declare const _findAllRoutesTheShorterTheBetter: (inputCoinAddress: string, outputCoinAddress: string) => Promise<IRouteStep[][]>;
11
3
  export declare const _findAllRoutesTvl: (inputCoinAddress: string, outputCoinAddress: string) => Promise<IRouteStep[][]>;
12
4
  export declare const _findAllRoutes: (inputCoinAddress: string, outputCoinAddress: string) => Promise<IRouteStep[][]>;
package/lib/router.js CHANGED
@@ -59,7 +59,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
59
59
  return (mod && mod.__esModule) ? mod : { "default": mod };
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.swap = exports.swapEstimateGas = exports.swapApprove = exports.swapApproveEstimateGas = exports.swapIsApproved = exports.swapPriceImpact = exports.swapExpected = exports.getBestRouteAndOutput = exports._findAllRoutes = exports._findAllRoutesTvl = exports._findAllRoutesTheShorterTheBetter = exports.NATIVE_TOKENS = exports.NATIVE_TOKEN_ADDRESS = void 0;
62
+ exports.swap = exports.swapEstimateGas = exports.swapApprove = exports.swapApproveEstimateGas = exports.swapIsApproved = exports.swapPriceImpact = exports.swapExpected = exports.getBestRouteAndOutput = exports._findAllRoutes = exports._findAllRoutesTvl = exports._findAllRoutesTheShorterTheBetter = void 0;
63
63
  var axios_1 = __importDefault(require("axios"));
64
64
  var memoizee_1 = __importDefault(require("memoizee"));
65
65
  var bignumber_js_1 = __importDefault(require("bignumber.js"));
@@ -67,50 +67,6 @@ var ethers_1 = require("ethers");
67
67
  var curve_1 = require("./curve");
68
68
  var utils_1 = require("./utils");
69
69
  var pools_1 = require("./pools");
70
- // TODO Move to another place
71
- exports.NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
72
- exports.NATIVE_TOKENS = {
73
- 1: {
74
- symbol: 'ETH',
75
- wrappedSymbol: 'WETH',
76
- wrappedAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'.toLowerCase(),
77
- },
78
- 10: {
79
- symbol: 'ETH',
80
- wrappedSymbol: 'WETH',
81
- wrappedAddress: '0x4200000000000000000000000000000000000006'.toLowerCase(),
82
- },
83
- 100: {
84
- symbol: 'XDAi',
85
- wrappedSymbol: 'WXDAI',
86
- wrappedAddress: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'.toLowerCase(),
87
- },
88
- 137: {
89
- symbol: 'MATIC',
90
- wrappedSymbol: 'WMATIC',
91
- wrappedAddress: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'.toLowerCase(),
92
- },
93
- 250: {
94
- symbol: 'FTM',
95
- wrappedSymbol: 'WFTM',
96
- wrappedAddress: '0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83'.toLowerCase(),
97
- },
98
- 1284: {
99
- symbol: 'GLMR',
100
- wrappedSymbol: 'WGLMR',
101
- wrappedAddress: '0xAcc15dC74880C9944775448304B263D191c6077F'.toLowerCase(),
102
- },
103
- 43114: {
104
- symbol: 'AVAX',
105
- wrappedSymbol: 'WAVAX',
106
- wrappedAddress: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7'.toLowerCase(),
107
- },
108
- 42161: {
109
- symbol: 'ETH',
110
- wrappedSymbol: 'WETH',
111
- wrappedAddress: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'.toLowerCase(),
112
- },
113
- };
114
70
  var MAX_ROUTES_FOR_ONE_COIN = 3;
115
71
  // Inspired by Dijkstra's algorithm
116
72
  var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAddress) { return __awaiter(void 0, void 0, void 0, function () {
@@ -227,7 +183,7 @@ var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAd
227
183
  if (markedCoins.includes(wrapped_coin_addresses[j]) || curCoins.includes(wrapped_coin_addresses[j]))
228
184
  return [3 /*break*/, 6];
229
185
  // Native swaps spend less gas
230
- if (wrapped_coin_addresses[j] !== outputCoinAddress && wrapped_coin_addresses[j] === exports.NATIVE_TOKENS[curve_1.curve.chainId].wrappedAddress)
186
+ if (wrapped_coin_addresses[j] !== outputCoinAddress && wrapped_coin_addresses[j] === curve_1.curve.constants.NATIVE_TOKEN.wrappedAddress)
231
187
  return [3 /*break*/, 6];
232
188
  // Looking for outputCoinAddress only on the final step
233
189
  if (step === 3 && wrapped_coin_addresses[j] !== outputCoinAddress)
@@ -282,7 +238,7 @@ var _findAllRoutesTheShorterTheBetter = function (inputCoinAddress, outputCoinAd
282
238
  tvl = _m.apply(void 0, [_x.sent()]);
283
239
  if (tvl === 0)
284
240
  return [3 /*break*/, 10];
285
- hasEth = (inCoin === exports.NATIVE_TOKEN_ADDRESS || underlying_coin_addresses[j] === exports.NATIVE_TOKEN_ADDRESS);
241
+ hasEth = (inCoin === curve_1.curve.constants.NATIVE_TOKEN.address || underlying_coin_addresses[j] === curve_1.curve.constants.NATIVE_TOKEN.address);
286
242
  swapType = ((base_pool === null || base_pool === void 0 ? void 0 : base_pool.is_lending) && poolData.is_factory) ? 5 : hasEth ? 3 : poolData.is_crypto ? 4 : 2;
287
243
  for (_o = 0, _p = routes[inCoin]; _o < _p.length; _o++) {
288
244
  inCoinRoute = _p[_o];
@@ -494,7 +450,7 @@ var _findAllRoutesTvl = function (inputCoinAddress, outputCoinAddress) { return
494
450
  if (j === inCoinIndexes.wrapped_coin)
495
451
  return [2 /*return*/, "continue"];
496
452
  // Native swaps spend less gas
497
- if (wrapped_coin_addresses[j] !== outputCoinAddress && wrapped_coin_addresses[j] === exports.NATIVE_TOKENS[curve_1.curve.chainId].wrappedAddress)
453
+ if (wrapped_coin_addresses[j] !== outputCoinAddress && wrapped_coin_addresses[j] === curve_1.curve.constants.NATIVE_TOKEN.wrappedAddress)
498
454
  return [2 /*return*/, "continue"];
499
455
  // Looking for outputCoinAddress only on the final step
500
456
  if (step === 3 && wrapped_coin_addresses[j] !== outputCoinAddress)
@@ -583,7 +539,7 @@ var _findAllRoutesTvl = function (inputCoinAddress, outputCoinAddress) { return
583
539
  tvl = _u.apply(void 0, [_v.sent()]);
584
540
  if (tvl === 0)
585
541
  return [2 /*return*/, "continue"];
586
- hasEth = (inCoin === exports.NATIVE_TOKEN_ADDRESS || underlying_coin_addresses[j] === exports.NATIVE_TOKEN_ADDRESS);
542
+ hasEth = (inCoin === curve_1.curve.constants.NATIVE_TOKEN.address || underlying_coin_addresses[j] === curve_1.curve.constants.NATIVE_TOKEN.address);
587
543
  swapType = ((base_pool === null || base_pool === void 0 ? void 0 : base_pool.is_lending) && poolData.is_factory) ? 5 : hasEth ? 3 : poolData.is_crypto ? 4 : 2;
588
544
  newRoutes = routes[inCoin].map(function (route) {
589
545
  var routePoolIds = route.steps.map(function (s) { return s.poolId; });
package/lib/utils.js CHANGED
@@ -468,8 +468,10 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
468
468
  137: 'polygon-pos',
469
469
  250: 'fantom',
470
470
  1284: 'moonbeam',
471
+ 2222: 'kava',
471
472
  43114: 'avalanche',
472
473
  42161: 'arbitrum-one',
474
+ 1313161554: 'aurora',
473
475
  }[curve_1.curve.chainId];
474
476
  nativeTokenName = {
475
477
  1: 'ethereum',
@@ -478,8 +480,10 @@ var _getUsdRate = function (assetId) { return __awaiter(void 0, void 0, void 0,
478
480
  137: 'matic-network',
479
481
  250: 'fantom',
480
482
  1284: 'moonbeam',
483
+ 2222: 'kava',
481
484
  43114: 'avalanche-2',
482
485
  42161: 'ethereum',
486
+ 1313161554: 'ethereum',
483
487
  }[curve_1.curve.chainId];
484
488
  if (chainName === undefined) {
485
489
  throw Error('curve object is not initialized');
@@ -547,8 +551,10 @@ var getTVL = function (chainId) {
547
551
  137: "polygon",
548
552
  250: "fantom",
549
553
  1284: "moonbeam",
554
+ 2222: 'kava',
550
555
  43114: "avalanche",
551
556
  42161: "arbitrum",
557
+ 1313161554: "aurora",
552
558
  }[chainId]) !== null && _a !== void 0 ? _a : "ethereum";
553
559
  promises = [
554
560
  (0, external_api_1._getPoolsFromApi)(network, "main"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.10.1",
3
+ "version": "2.12.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.8.2",
37
+ "ethcall": "^4.8.4",
38
38
  "ethers": "^5.4.6",
39
39
  "memoizee": "^0.4.15"
40
40
  }