@curvefi/api 2.3.1 → 2.3.4

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.
@@ -89,6 +89,7 @@ var swap_json_39 = __importDefault(require("../abis/rai/swap.json"));
89
89
  var deposit_json_23 = __importDefault(require("../abis/rai/deposit.json"));
90
90
  var swap_json_40 = __importDefault(require("../abis/2pool/swap.json"));
91
91
  var swap_json_41 = __importDefault(require("../abis/4pool/swap.json"));
92
+ var swap_json_42 = __importDefault(require("../abis/fraxusdc/swap.json"));
92
93
  var utils_1 = require("../utils");
93
94
  exports.POOLS_DATA_ETHEREUM = (0, utils_1.lowerCasePoolDataAddresses)({
94
95
  compound: {
@@ -1494,6 +1495,30 @@ exports.POOLS_DATA_ETHEREUM = (0, utils_1.lowerCasePoolDataAddresses)({
1494
1495
  swap_abi: swap_json_41.default,
1495
1496
  gauge_abi: gauge_v5_json_1.default,
1496
1497
  },
1498
+ fraxusdc: {
1499
+ name: "fraxusdc",
1500
+ full_name: "fraxusdc",
1501
+ symbol: "fraxusdc",
1502
+ reference_asset: 'USD',
1503
+ swap_address: '0xDcEF968d416a41Cdac0ED8702fAC8128A64241A2',
1504
+ token_address: '0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC',
1505
+ gauge_address: '0xCFc25170633581Bf896CB6CDeE170e3E3Aa59503',
1506
+ is_plain: true,
1507
+ underlying_coins: ['FRAX', 'USDC'],
1508
+ wrapped_coins: ['FRAX', 'USDC'],
1509
+ underlying_coin_addresses: [
1510
+ '0x853d955aCEf822Db058eb8505911ED77F175b99e',
1511
+ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
1512
+ ],
1513
+ wrapped_coin_addresses: [
1514
+ '0x853d955aCEf822Db058eb8505911ED77F175b99e',
1515
+ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
1516
+ ],
1517
+ underlying_decimals: [18, 6],
1518
+ wrapped_decimals: [18, 6],
1519
+ swap_abi: swap_json_42.default,
1520
+ gauge_abi: gauge_v5_json_1.default,
1521
+ },
1497
1522
  euroc: {
1498
1523
  name: "euroc",
1499
1524
  full_name: "euroc",
@@ -7,10 +7,16 @@ exports.setFactoryZapContracts = void 0;
7
7
  var ethers_1 = require("ethers");
8
8
  var ethcall_1 = require("ethcall");
9
9
  var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
10
+ var metaZap_json_1 = __importDefault(require("../constants/abis/fraxusdc/metaZap.json"));
10
11
  var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
11
12
  var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
12
13
  function setFactoryZapContracts() {
13
14
  if (this.chainId === 1) {
15
+ var fraxusdcMetaZapAddress = "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase();
16
+ this.contracts[fraxusdcMetaZapAddress] = {
17
+ contract: new ethers_1.Contract(fraxusdcMetaZapAddress, metaZap_json_1.default, this.signer || this.provider),
18
+ multicallContract: new ethcall_1.Contract(fraxusdcMetaZapAddress, metaZap_json_1.default),
19
+ };
14
20
  var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
15
21
  this.contracts[metaSBtcZapAddress] = {
16
22
  contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
@@ -2,17 +2,18 @@ import { IDict } from "../interfaces";
2
2
  export declare const implementationABIDictEthereum: IDict<any>;
3
3
  export declare const implementationABIDictPolygon: IDict<any>;
4
4
  export declare const implementationABIDictAvalanche: IDict<any>;
5
- export declare const implementationBasePoolAddressDictEthereum: IDict<any>;
6
- export declare const implementationBasePoolAddressDictPolygon: IDict<any>;
7
- export declare const implementationBasePoolAddressDictAvalanche: IDict<any>;
8
- export declare const basePoolAddressIdDictEthereum: IDict<string>;
9
- export declare const basePoolAddressIdDictPolygon: IDict<string>;
10
- export declare const basePoolAddressIdDictAvalanche: IDict<string>;
5
+ export declare const implementationBasePoolIdDictEthereum: IDict<string>;
6
+ export declare const implementationBasePoolIdDictPolygon: IDict<string>;
7
+ export declare const implementationBasePoolIdDictAvalanche: IDict<string>;
11
8
  export declare const basePoolIdZapDictEthereum: IDict<string>;
12
9
  export declare const basePoolIdZapDictPolygon: IDict<string>;
13
10
  export declare const basePoolIdZapDictAvalanche: IDict<string>;
14
11
  export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
15
12
  export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
16
13
  export declare const FACTORY_CONSTANTS: {
17
- [index: number]: any;
14
+ [index: number]: {
15
+ implementationABIDict: IDict<any>;
16
+ implementationBasePoolIdDict: IDict<string>;
17
+ basePoolIdZapDict: IDict<string>;
18
+ };
18
19
  };
@@ -3,10 +3,12 @@ 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.ETH_ADDRESS = exports.WETH_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.basePoolAddressIdDictAvalanche = exports.basePoolAddressIdDictPolygon = exports.basePoolAddressIdDictEthereum = exports.implementationBasePoolAddressDictAvalanche = exports.implementationBasePoolAddressDictPolygon = exports.implementationBasePoolAddressDictEthereum = exports.implementationABIDictAvalanche = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
6
+ exports.FACTORY_CONSTANTS = exports.ETH_ADDRESS = exports.WETH_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.implementationBasePoolIdDictAvalanche = exports.implementationBasePoolIdDictPolygon = exports.implementationBasePoolIdDictEthereum = exports.implementationABIDictAvalanche = 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"));
10
+ var MetaFraxUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaFraxUSD.json"));
11
+ var MetaFraxUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaFraxUSDBalances.json"));
10
12
  var MetaBTC_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTC.json"));
11
13
  var MetaBTCBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCBalances.json"));
12
14
  var MetaBTCRen_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaBTCRen.json"));
@@ -27,6 +29,8 @@ exports.implementationABIDictEthereum = {
27
29
  "0x5F890841f657d90E081bAbdB532A05996Af79Fe6": swap_json_1.default,
28
30
  "0x213be373FDff327658139C7df330817DAD2d5bBE": MetaUSD_json_1.default,
29
31
  "0x55Aa9BF126bCABF0bDC17Fa9E39Ec9239e1ce7A9": MetaUSDBalances_json_1.default,
32
+ "0x33bB0e62d5e8C688E645Dd46DFb48Cd613250067": MetaFraxUSD_json_1.default,
33
+ "0x2EB24483Ef551dA247ab87Cf18e1Cc980073032D": MetaFraxUSDBalances_json_1.default,
30
34
  "0xC6A8466d128Fbfd34AdA64a9FFFce325D57C9a52": MetaBTC_json_1.default,
31
35
  "0xc4C78b08fA0c3d0a312605634461A88184Ecd630": MetaBTCBalances_json_1.default,
32
36
  "0xECAaecd9d2193900b424774133B1f51ae0F29d9E": MetaBTCRen_json_1.default,
@@ -80,42 +84,32 @@ exports.implementationABIDictAvalanche = {
80
84
  "0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410": Plain4ETH_json_1.default,
81
85
  "0xCE94D3E5b0D80565D7B713A687b39a3Dc81780BA": Plain4Optimized_json_1.default,
82
86
  };
83
- exports.implementationBasePoolAddressDictEthereum = {
84
- "0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
85
- "0x213be373FDff327658139C7df330817DAD2d5bBE": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
86
- "0x55Aa9BF126bCABF0bDC17Fa9E39Ec9239e1ce7A9": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
87
- "0xC6A8466d128Fbfd34AdA64a9FFFce325D57C9a52": "0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714",
88
- "0xc4C78b08fA0c3d0a312605634461A88184Ecd630": "0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714",
89
- "0xECAaecd9d2193900b424774133B1f51ae0F29d9E": "0x93054188d876f558f4a66B2EF1d97d16eDf0895B",
90
- "0x40fD58D44cFE63E8517c9Bb3ac98676838Ea56A8": "0x93054188d876f558f4a66B2EF1d97d16eDf0895B", // ren
87
+ exports.implementationBasePoolIdDictEthereum = {
88
+ "0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "3pool",
89
+ "0x213be373FDff327658139C7df330817DAD2d5bBE": "3pool",
90
+ "0x55Aa9BF126bCABF0bDC17Fa9E39Ec9239e1ce7A9": "3pool",
91
+ "0x33bB0e62d5e8C688E645Dd46DFb48Cd613250067": "fraxusdc",
92
+ "0x2EB24483Ef551dA247ab87Cf18e1Cc980073032D": "fraxusdc",
93
+ "0xC6A8466d128Fbfd34AdA64a9FFFce325D57C9a52": "sbtc",
94
+ "0xc4C78b08fA0c3d0a312605634461A88184Ecd630": "sbtc",
95
+ "0xECAaecd9d2193900b424774133B1f51ae0F29d9E": "ren",
96
+ "0x40fD58D44cFE63E8517c9Bb3ac98676838Ea56A8": "ren",
91
97
  };
92
- exports.implementationBasePoolAddressDictPolygon = {
93
- "0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c": "0x445FE580eF8d70FF569aB36e80c647af338db351",
94
- "0x39fE1824f98CD828050D7c51dA443E84121c7cf1": "0x445FE580eF8d70FF569aB36e80c647af338db351",
95
- "0xC05EB760A135d3D0c839f1141423002681157a17": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67",
96
- "0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", // ren
98
+ exports.implementationBasePoolIdDictPolygon = {
99
+ "0x4fb93D7d320E8A263F22f62C2059dFC2A8bCbC4c": "aave",
100
+ "0x39fE1824f98CD828050D7c51dA443E84121c7cf1": "aave",
101
+ "0xC05EB760A135d3D0c839f1141423002681157a17": "ren",
102
+ "0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "ren",
97
103
  };
98
- exports.implementationBasePoolAddressDictAvalanche = {
99
- "0xA237034249290De2B07988Ac64b96f22c0E76fE0": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
100
- "0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
101
- "0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90",
102
- "0x505C34ED8dBE96d2D5C7D83158aA844887770970": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90", // ren
103
- };
104
- exports.basePoolAddressIdDictEthereum = {
105
- "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "3pool",
106
- "0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "sbtc",
107
- "0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "ren",
108
- };
109
- exports.basePoolAddressIdDictPolygon = {
110
- "0x445FE580eF8d70FF569aB36e80c647af338db351": "aave",
111
- "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "ren",
112
- };
113
- exports.basePoolAddressIdDictAvalanche = {
114
- "0x7f90122BF0700F9E7e1F688fe926940E8839F353": "aave",
115
- "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90": "ren",
104
+ exports.implementationBasePoolIdDictAvalanche = {
105
+ "0xA237034249290De2B07988Ac64b96f22c0E76fE0": "aave",
106
+ "0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "aave",
107
+ "0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "ren",
108
+ "0x505C34ED8dBE96d2D5C7D83158aA844887770970": "ren",
116
109
  };
117
110
  exports.basePoolIdZapDictEthereum = {
118
111
  '3pool': "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
112
+ fraxusdc: "0x08780fb7E580e492c1935bEe4fA5920b94AA95Da".toLowerCase(),
119
113
  sbtc: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
120
114
  ren: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // TODO CHECK!!!
121
115
  };
@@ -132,20 +126,17 @@ exports.ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
132
126
  exports.FACTORY_CONSTANTS = {
133
127
  1: {
134
128
  implementationABIDict: exports.implementationABIDictEthereum,
135
- implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictEthereum,
136
- basePoolAddressIdDict: exports.basePoolAddressIdDictEthereum,
129
+ implementationBasePoolIdDict: exports.implementationBasePoolIdDictEthereum,
137
130
  basePoolIdZapDict: exports.basePoolIdZapDictEthereum,
138
131
  },
139
132
  137: {
140
133
  implementationABIDict: exports.implementationABIDictPolygon,
141
- implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictPolygon,
142
- basePoolAddressIdDict: exports.basePoolAddressIdDictPolygon,
134
+ implementationBasePoolIdDict: exports.implementationBasePoolIdDictPolygon,
143
135
  basePoolIdZapDict: exports.basePoolIdZapDictPolygon,
144
136
  },
145
137
  43114: {
146
138
  implementationABIDict: exports.implementationABIDictAvalanche,
147
- implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictAvalanche,
148
- basePoolAddressIdDict: exports.basePoolAddressIdDictAvalanche,
139
+ implementationBasePoolIdDict: exports.implementationBasePoolIdDictAvalanche,
149
140
  basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
150
141
  },
151
142
  };
@@ -188,16 +188,16 @@ function getFactoryPoolsDataFromApi(isCrypto) {
188
188
  }
189
189
  else if (pool.implementation.startsWith("meta")) {
190
190
  var implementationABIDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationABIDict;
191
- var implementationBasePoolAddressDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationBasePoolAddressDict;
192
- var basePoolAddressIdDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolAddressIdDict; // @ts-ignore
193
- var basePoolIdCoinsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
191
+ var implementationBasePoolIdDict = constants_1.FACTORY_CONSTANTS[_this.chainId].implementationBasePoolIdDict;
192
+ var basePoolIds = Object.values(implementationBasePoolIdDict).filter(function (poolId, i, arr) { return arr.indexOf(poolId) === i; });
194
193
  // @ts-ignore
195
- var basePoolIdCoinAddressesDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
194
+ var basePoolIdCoinsDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
196
195
  // @ts-ignore
197
- var basePoolIdDecimalsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
196
+ var basePoolIdCoinAddressesDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
197
+ // @ts-ignore
198
+ var basePoolIdDecimalsDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
198
199
  var basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[_this.chainId].basePoolIdZapDict;
199
- var basePoolAddress = implementationBasePoolAddressDict[pool.implementationAddress];
200
- var basePoolId = basePoolAddressIdDict[basePoolAddress];
200
+ var basePoolId = implementationBasePoolIdDict[pool.implementationAddress];
201
201
  var basePoolCoinNames = basePoolIdCoinsDict[basePoolId];
202
202
  var basePoolCoinAddresses = basePoolIdCoinAddressesDict[basePoolId];
203
203
  var basePoolDecimals = basePoolIdDecimalsDict[basePoolId];
@@ -94,14 +94,12 @@ function getFactoryIdsAndSwapAddresses() {
94
94
  });
95
95
  });
96
96
  }
97
- function getFactorySwapABIs(factorySwapAddresses) {
97
+ function getFactoryImplementations(factorySwapAddresses) {
98
98
  return __awaiter(this, void 0, void 0, function () {
99
- var implementationABIDict, factoryMulticallContract, calls, _i, factorySwapAddresses_1, addr, implementationAddresses;
99
+ var factoryMulticallContract, calls, _i, factorySwapAddresses_1, addr;
100
100
  return __generator(this, function (_a) {
101
101
  switch (_a.label) {
102
- case 0:
103
- implementationABIDict = constants_1.FACTORY_CONSTANTS[this.chainId].implementationABIDict;
104
- return [4 /*yield*/, this.contracts[this.constants.ALIASES.factory].multicallContract];
102
+ case 0: return [4 /*yield*/, this.contracts[this.constants.ALIASES.factory].multicallContract];
105
103
  case 1:
106
104
  factoryMulticallContract = _a.sent();
107
105
  calls = [];
@@ -110,9 +108,7 @@ function getFactorySwapABIs(factorySwapAddresses) {
110
108
  calls.push(factoryMulticallContract.get_implementation_address(addr));
111
109
  }
112
110
  return [4 /*yield*/, this.multicallProvider.all(calls)];
113
- case 2:
114
- implementationAddresses = _a.sent();
115
- return [2 /*return*/, implementationAddresses.map(function (addr) { return implementationABIDict[addr]; })];
111
+ case 2: return [2 /*return*/, _a.sent()];
116
112
  }
117
113
  });
118
114
  });
@@ -349,37 +345,20 @@ function getFactoryIsMeta(factorySwapAddresses) {
349
345
  });
350
346
  });
351
347
  }
352
- function getFactoryBasePoolAddresses(factorySwapAddresses) {
353
- return __awaiter(this, void 0, void 0, function () {
354
- var factoryMulticallContract, calls, _i, factorySwapAddresses_7, addr;
355
- return __generator(this, function (_a) {
356
- switch (_a.label) {
357
- case 0: return [4 /*yield*/, this.contracts[this.constants.ALIASES.factory].multicallContract];
358
- case 1:
359
- factoryMulticallContract = _a.sent();
360
- calls = [];
361
- for (_i = 0, factorySwapAddresses_7 = factorySwapAddresses; _i < factorySwapAddresses_7.length; _i++) {
362
- addr = factorySwapAddresses_7[_i];
363
- calls.push(factoryMulticallContract.get_base_pool(addr));
364
- }
365
- return [4 /*yield*/, this.multicallProvider.all(calls)];
366
- case 2: return [2 /*return*/, _a.sent()];
367
- }
368
- });
369
- });
370
- }
371
348
  function getFactoryPoolData() {
372
349
  return __awaiter(this, void 0, void 0, function () {
373
- var _a, poolIds, swapAddresses, swapABIs, gaugeAddresses, _b, poolSymbols, poolNames, referenceAssets, coinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, isMeta, basePoolAddresses, basePoolAddressIdDict, basePoolIds, basePoolIdCoinsDict, basePoolIdCoinAddressesDict, basePoolIdDecimalsDict, basePoolIdZapDict, FACTORY_POOLS_DATA, i;
350
+ var _a, poolIds, swapAddresses, implementations, implementationABIDict, swapABIs, gaugeAddresses, _b, poolSymbols, poolNames, referenceAssets, coinAddresses, existingCoinAddressNameDict, coinAddressNameDict, coinAddressDecimalsDict, isMeta, implementationBasePoolIdDict, basePoolIds, basePoolIdCoinsDict, basePoolIdCoinAddressesDict, basePoolIdDecimalsDict, basePoolIdZapDict, FACTORY_POOLS_DATA, i;
374
351
  var _this = this;
375
352
  return __generator(this, function (_c) {
376
353
  switch (_c.label) {
377
354
  case 0: return [4 /*yield*/, getFactoryIdsAndSwapAddresses.call(this)];
378
355
  case 1:
379
356
  _a = _c.sent(), poolIds = _a[0], swapAddresses = _a[1];
380
- return [4 /*yield*/, getFactorySwapABIs.call(this, swapAddresses)];
357
+ return [4 /*yield*/, getFactoryImplementations.call(this, swapAddresses)];
381
358
  case 2:
382
- swapABIs = _c.sent();
359
+ implementations = _c.sent();
360
+ implementationABIDict = constants_1.FACTORY_CONSTANTS[this.chainId].implementationABIDict;
361
+ swapABIs = implementations.map(function (addr) { return implementationABIDict[addr]; });
383
362
  setFactorySwapContracts.call(this, swapAddresses, swapABIs);
384
363
  return [4 /*yield*/, getFactoryGaugeAddresses.call(this, swapAddresses)];
385
364
  case 3:
@@ -405,15 +384,12 @@ function getFactoryPoolData() {
405
384
  return [4 /*yield*/, getFactoryIsMeta.call(this, swapAddresses)];
406
385
  case 9:
407
386
  isMeta = _c.sent();
408
- return [4 /*yield*/, getFactoryBasePoolAddresses.call(this, swapAddresses)];
409
- case 10:
410
- basePoolAddresses = _c.sent();
387
+ implementationBasePoolIdDict = constants_1.FACTORY_CONSTANTS[this.chainId].implementationBasePoolIdDict;
388
+ basePoolIds = implementations.map(function (addr) { return implementationBasePoolIdDict[addr]; });
411
389
  common_1.setFactoryZapContracts.call(this);
412
- basePoolAddressIdDict = constants_1.FACTORY_CONSTANTS[this.chainId].basePoolAddressIdDict;
413
- basePoolIds = basePoolAddresses.map(function (addr) { return basePoolAddressIdDict[addr]; });
414
- basePoolIdCoinsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
415
- basePoolIdCoinAddressesDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
416
- basePoolIdDecimalsDict = Object.fromEntries(Object.values(basePoolAddressIdDict).map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
390
+ basePoolIdCoinsDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coins]; }));
391
+ basePoolIdCoinAddressesDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_coin_addresses]; }));
392
+ basePoolIdDecimalsDict = Object.fromEntries(basePoolIds.map(function (poolId) { return [poolId, _this.constants.POOLS_DATA[poolId].underlying_decimals]; }));
417
393
  basePoolIdZapDict = constants_1.FACTORY_CONSTANTS[this.chainId].basePoolIdZapDict;
418
394
  FACTORY_POOLS_DATA = {};
419
395
  for (i = 0; i < poolIds.length; i++) {
@@ -1225,9 +1225,9 @@ var PoolTemplate = /** @class */ (function () {
1225
1225
  PoolTemplate.prototype.claimableRewards = function (address) {
1226
1226
  if (address === void 0) { address = ""; }
1227
1227
  return __awaiter(this, void 0, void 0, function () {
1228
- var gaugeContract, rewardTokens, rewards, _i, rewardTokens_2, rewardToken, amount, _a, _c, rewardToken, _totalAmount, _claimedAmount;
1229
- return __generator(this, function (_d) {
1230
- switch (_d.label) {
1228
+ var gaugeContract, rewardTokens, rewards, _i, rewardTokens_2, rewardToken, _amount, rewardToken, _totalAmount, _claimedAmount;
1229
+ return __generator(this, function (_a) {
1230
+ switch (_a.label) {
1231
1231
  case 0:
1232
1232
  if (this.gauge === ethers_1.ethers.constants.AddressZero) {
1233
1233
  throw Error("claimableRewards method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
@@ -1238,24 +1238,23 @@ var PoolTemplate = /** @class */ (function () {
1238
1238
  gaugeContract = curve_1.curve.contracts[this.gauge].contract;
1239
1239
  return [4 /*yield*/, this.rewardTokens()];
1240
1240
  case 1:
1241
- rewardTokens = _d.sent();
1241
+ rewardTokens = _a.sent();
1242
1242
  rewards = [];
1243
1243
  if (!('claimable_reward(address,address)' in gaugeContract)) return [3 /*break*/, 6];
1244
1244
  _i = 0, rewardTokens_2 = rewardTokens;
1245
- _d.label = 2;
1245
+ _a.label = 2;
1246
1246
  case 2:
1247
1247
  if (!(_i < rewardTokens_2.length)) return [3 /*break*/, 5];
1248
1248
  rewardToken = rewardTokens_2[_i];
1249
- _c = (_a = ethers_1.ethers.utils).formatUnits;
1250
- return [4 /*yield*/, gaugeContract.claimable_reward(address, rewardToken, curve_1.curve.constantOptions)];
1249
+ return [4 /*yield*/, gaugeContract.claimable_reward(address, rewardToken.token, curve_1.curve.constantOptions)];
1251
1250
  case 3:
1252
- amount = _c.apply(_a, [_d.sent(), rewardToken.decimals]);
1251
+ _amount = _a.sent();
1253
1252
  rewards.push({
1254
1253
  token: rewardToken.token,
1255
1254
  symbol: rewardToken.symbol,
1256
- amount: amount,
1255
+ amount: ethers_1.ethers.utils.formatUnits(_amount, rewardToken.decimals),
1257
1256
  });
1258
- _d.label = 4;
1257
+ _a.label = 4;
1259
1258
  case 4:
1260
1259
  _i++;
1261
1260
  return [3 /*break*/, 2];
@@ -1265,16 +1264,16 @@ var PoolTemplate = /** @class */ (function () {
1265
1264
  rewardToken = rewardTokens[0];
1266
1265
  return [4 /*yield*/, gaugeContract.claimable_reward(address, curve_1.curve.constantOptions)];
1267
1266
  case 7:
1268
- _totalAmount = _d.sent();
1267
+ _totalAmount = _a.sent();
1269
1268
  return [4 /*yield*/, gaugeContract.claimed_rewards_for(address, curve_1.curve.constantOptions)];
1270
1269
  case 8:
1271
- _claimedAmount = _d.sent();
1270
+ _claimedAmount = _a.sent();
1272
1271
  rewards.push({
1273
1272
  token: rewardToken.token,
1274
1273
  symbol: rewardToken.symbol,
1275
1274
  amount: ethers_1.ethers.utils.formatUnits(_totalAmount.sub(_claimedAmount), rewardToken.decimals),
1276
1275
  });
1277
- _d.label = 9;
1276
+ _a.label = 9;
1278
1277
  case 9: return [2 /*return*/, rewards];
1279
1278
  }
1280
1279
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.3.1",
3
+ "version": "2.3.4",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",