@curvefi/api 2.63.3 → 2.63.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.
@@ -129,7 +129,8 @@ export const ALIASES_OPTIMISM = lowerCaseValues({
129
129
  });
130
130
  export const ALIASES_XDAI = lowerCaseValues({
131
131
  "crv": "0x712b3d230f3c1c19db860d80619288b1f0bdd0bd",
132
- "gauge_factory": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
132
+ "gauge_factory": "0x7BE6BD57A319A7180f71552E58c9d32Da32b6f96",
133
+ "gauge_factory_old": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
133
134
  "voting_escrow": "0xefde221f306152971d8e9f181bfe998447975810",
134
135
  "fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc",
135
136
  "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
@@ -143,7 +144,7 @@ export const ALIASES_XDAI = lowerCaseValues({
143
144
  "eywa_factory": '0x37F22A0B028f2152e6CAcef210e0C4d3b875f367',
144
145
  "crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
145
146
  "twocrypto_factory": '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F',
146
- "tricrypto_factory": '0x0c0e5f2fF0ff18a3be9b835635039256dC4B4963',
147
+ "tricrypto_factory": '0xb47988aD49DCE8D909c6f9Cf7B26caF04e1445c8',
147
148
  "stable_ng_factory": '0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8',
148
149
  "factory_admin": "",
149
150
  });
package/lib/curve.js CHANGED
@@ -787,6 +787,9 @@ class Curve {
787
787
  this.constants.DECIMALS[this.constants.ALIASES.crv] = 18;
788
788
  const _gaugeFactoryABI = this.chainId === 1 ? gaugeFactoryABI : gaugeFactorySidechainABI;
789
789
  this.setContract(this.constants.ALIASES.gauge_factory, _gaugeFactoryABI);
790
+ if ("gauge_factory_old" in this.constants.ALIASES) {
791
+ this.setContract(this.constants.ALIASES.gauge_factory_old, _gaugeFactoryABI);
792
+ }
790
793
  if (this.chainId === 1) {
791
794
  this.setContract(this.constants.ALIASES.minter, minterMainnetABI);
792
795
  this.setContract(this.constants.ALIASES.gauge_factory_fraxtal, gaugeFactoryForFraxtalABI);
@@ -68,9 +68,11 @@ function _getLpTokenMap(factorySwapAddresses) {
68
68
  });
69
69
  }
70
70
  function getPoolsData(factorySwapAddresses) {
71
+ var _a;
71
72
  return __awaiter(this, void 0, void 0, function* () {
72
73
  const factoryMulticallContract = this.contracts[this.constants.ALIASES.crypto_factory].multicallContract;
73
- const isfactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
74
+ const isGaugeFactoryNull = this.constants.ALIASES.gauge_factory === curve.constants.ZERO_ADDRESS;
75
+ const isGaugeFactoryOldNull = !("gauge_factory_old" in this.constants.ALIASES);
74
76
  const calls = [];
75
77
  if (this.chainId === 1) {
76
78
  for (const addr of factorySwapAddresses) {
@@ -80,29 +82,32 @@ function getPoolsData(factorySwapAddresses) {
80
82
  }
81
83
  }
82
84
  else {
83
- const factoryMulticallGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
85
+ const gaugeFactoryMulticallContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
86
+ const gaugeFactoryOldMulticallContract = this.contracts[(_a = this.constants.ALIASES.gauge_factory_old) !== null && _a !== void 0 ? _a : curve.constants.ZERO_ADDRESS].multicallContract;
84
87
  const LpTokenMap = yield _getLpTokenMap.call(this, factorySwapAddresses);
85
88
  for (const addr of factorySwapAddresses) {
86
89
  calls.push(factoryMulticallContract.get_token(addr));
87
- if (!isfactoryGaugeNull) {
88
- calls.push(factoryMulticallGaugeContract.get_gauge_from_lp_token(LpTokenMap[addr]));
89
- }
90
+ if (!isGaugeFactoryNull)
91
+ calls.push(gaugeFactoryMulticallContract.get_gauge_from_lp_token(LpTokenMap[addr]));
92
+ if (!isGaugeFactoryOldNull)
93
+ calls.push(gaugeFactoryOldMulticallContract.get_gauge_from_lp_token(LpTokenMap[addr]));
90
94
  calls.push(factoryMulticallContract.get_coins(addr));
91
95
  }
92
96
  }
93
97
  const res = yield this.multicallProvider.all(calls);
94
- if (isfactoryGaugeNull) {
95
- const tokenAddresses = res.filter((a, i) => i % 3 == 0).map((a) => a.toLowerCase());
96
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 3 == 1));
97
- const gaugeAddresses = Array.from(Array(factorySwapAddresses.length)).map(() => '0x0000000000000000000000000000000000000000');
98
- return [tokenAddresses, gaugeAddresses, coinAddresses];
99
- }
100
- else {
101
- const tokenAddresses = res.filter((a, i) => i % 3 == 0).map((a) => a.toLowerCase());
102
- const gaugeAddresses = res.filter((a, i) => i % 3 == 1).map((a) => a.toLowerCase());
103
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 3 == 2));
104
- return [tokenAddresses, gaugeAddresses, coinAddresses];
98
+ if (isGaugeFactoryNull || isGaugeFactoryOldNull) {
99
+ for (let index = 0; index < res.length; index++) {
100
+ if (isGaugeFactoryNull && index % 4 == 1)
101
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
102
+ if (isGaugeFactoryOldNull && index % 4 == 2)
103
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
104
+ }
105
105
  }
106
+ const tokenAddresses = res.filter((a, i) => i % 4 == 0).map((a) => a.toLowerCase());
107
+ const gaugeAddresses = res.filter((a, i) => i % 4 == 1).map((a) => a.toLowerCase());
108
+ const gaugeOldAddresses = res.filter((a, i) => i % 4 == 2).map((a) => a.toLowerCase());
109
+ const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 4 == 3));
110
+ return [tokenAddresses, gaugeAddresses, gaugeOldAddresses, coinAddresses];
106
111
  });
107
112
  }
108
113
  function setCryptoFactorySwapContracts(factorySwapAddresses) {
@@ -199,7 +204,11 @@ export function getCryptoFactoryPoolData(fromIdx = 0, swapAddress) {
199
204
  : yield getCryptoFactoryIdsAndSwapAddresses.call(this, fromIdx);
200
205
  if (poolIds.length === 0)
201
206
  return {};
202
- const [tokenAddresses, gaugeAddresses, coinAddresses] = yield getPoolsData.call(this, swapAddresses);
207
+ const [tokenAddresses, rawGaugeAddresses, rawOldGaugeAddresses, coinAddresses] = yield getPoolsData.call(this, swapAddresses);
208
+ const gaugeAddresses = [];
209
+ for (let i = 0; i < rawGaugeAddresses.length; i++) {
210
+ gaugeAddresses.push(rawGaugeAddresses[i] !== curve.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
211
+ }
203
212
  setCryptoFactorySwapContracts.call(this, swapAddresses);
204
213
  setCryptoFactoryTokenContracts.call(this, tokenAddresses);
205
214
  setCryptoFactoryGaugeContracts.call(this, gaugeAddresses);
@@ -47,47 +47,45 @@ function _handleCoinAddresses(coinAddresses) {
47
47
  return coinAddresses.map((addresses) => addresses.map((addr) => this.chainId === 137 && addr === "0x0000000000000000000000000000000000001010" ? this.constants.NATIVE_TOKEN.wrappedAddress : addr.toLowerCase()));
48
48
  }
49
49
  function getPoolsData(factorySwapAddresses) {
50
+ var _a;
50
51
  return __awaiter(this, void 0, void 0, function* () {
52
+ const factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
53
+ const isGaugeFactoryNull = this.constants.ALIASES.gauge_factory === curve.constants.ZERO_ADDRESS;
54
+ const isGaugeFactoryOldNull = !("gauge_factory_old" in this.constants.ALIASES);
55
+ const calls = [];
51
56
  if (this.chainId === 1) {
52
- const factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
53
- const calls = [];
54
57
  for (const addr of factorySwapAddresses) {
55
58
  calls.push(factoryMulticallContract.get_gauge(addr));
56
59
  calls.push(factoryMulticallContract.get_coins(addr));
57
60
  calls.push(factoryMulticallContract.get_implementation_address(addr));
58
61
  }
59
- const res = yield this.multicallProvider.all(calls);
60
- const gaugeAddresses = res.filter((a, i) => i % 3 == 0).map((a) => a.toLowerCase());
61
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 3 == 1));
62
- const implementationAddresses = res.filter((a, i) => i % 3 == 2).map((a) => a.toLowerCase());
63
- return [gaugeAddresses, coinAddresses, implementationAddresses];
64
62
  }
65
63
  else {
66
- const factoryMulticallContract = this.contracts[this.constants.ALIASES.tricrypto_factory].multicallContract;
67
- const isFactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
68
- const factoryMulticallGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
69
- const calls = [];
64
+ const gaugeFactoryMulticallContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
65
+ const gaugeFactoryOldMulticallContract = this.contracts[(_a = this.constants.ALIASES.gauge_factory_old) !== null && _a !== void 0 ? _a : curve.constants.ZERO_ADDRESS].multicallContract;
70
66
  for (const addr of factorySwapAddresses) {
71
- if (!isFactoryGaugeNull) {
72
- calls.push(factoryMulticallGaugeContract.get_gauge_from_lp_token(addr));
73
- }
67
+ if (!isGaugeFactoryNull)
68
+ calls.push(gaugeFactoryMulticallContract.get_gauge_from_lp_token(addr));
69
+ if (!isGaugeFactoryOldNull)
70
+ calls.push(gaugeFactoryOldMulticallContract.get_gauge_from_lp_token(addr));
74
71
  calls.push(factoryMulticallContract.get_coins(addr));
75
72
  calls.push(factoryMulticallContract.get_implementation_address(addr));
76
73
  }
77
- const res = yield this.multicallProvider.all(calls);
78
- if (!isFactoryGaugeNull) {
79
- const gaugeAddresses = res.filter((a, i) => i % 3 == 0).map((a) => a.toLowerCase());
80
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 3 == 1));
81
- const implementationAddresses = res.filter((a, i) => i % 3 == 2).map((a) => a.toLowerCase());
82
- return [gaugeAddresses, coinAddresses, implementationAddresses];
83
- }
84
- else {
85
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 2 == 0));
86
- const gaugeAddresses = Array.from(Array(factorySwapAddresses.length)).map(() => '0x0000000000000000000000000000000000000000');
87
- const implementationAddresses = res.filter((a, i) => i % 2 == 1).map((a) => a.toLowerCase());
88
- return [gaugeAddresses, coinAddresses, implementationAddresses];
74
+ }
75
+ const res = yield this.multicallProvider.all(calls);
76
+ if (isGaugeFactoryNull || isGaugeFactoryOldNull) {
77
+ for (let index = 0; index < res.length; index++) {
78
+ if (isGaugeFactoryNull && index % 4 == 0)
79
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
80
+ if (isGaugeFactoryOldNull && index % 4 == 1)
81
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
89
82
  }
90
83
  }
84
+ const gaugeAddresses = res.filter((a, i) => i % 4 == 0).map((a) => a.toLowerCase());
85
+ const gaugeOldAddresses = res.filter((a, i) => i % 4 == 1).map((a) => a.toLowerCase());
86
+ const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 4 == 2));
87
+ const implementationAddresses = res.filter((a, i) => i % 4 == 3).map((a) => a.toLowerCase());
88
+ return [gaugeAddresses, gaugeOldAddresses, coinAddresses, implementationAddresses];
91
89
  });
92
90
  }
93
91
  function setCryptoFactorySwapContracts(factorySwapAddresses) {
@@ -95,11 +93,6 @@ function setCryptoFactorySwapContracts(factorySwapAddresses) {
95
93
  this.setContract(addr, tricryptoFactorySwapABI);
96
94
  });
97
95
  }
98
- function setCryptoFactoryTokenContracts(factoryTokenAddresses) {
99
- factoryTokenAddresses.forEach((addr) => {
100
- this.setContract(addr, ERC20ABI);
101
- });
102
- }
103
96
  function setCryptoFactoryGaugeContracts(factoryGaugeAddresses) {
104
97
  factoryGaugeAddresses.filter((addr) => addr !== curve.constants.ZERO_ADDRESS).forEach((addr, i) => {
105
98
  this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
@@ -180,7 +173,11 @@ export function getTricryptoFactoryPoolData(fromIdx = 0, swapAddress) {
180
173
  : yield getCryptoFactoryIdsAndSwapAddresses.call(this, fromIdx);
181
174
  if (poolIds.length === 0)
182
175
  return {};
183
- const [gaugeAddresses, coinAddresses, implementationAddresses] = yield getPoolsData.call(this, swapAddresses);
176
+ const [rawGaugeAddresses, rawOldGaugeAddresses, coinAddresses, implementationAddresses] = yield getPoolsData.call(this, swapAddresses);
177
+ const gaugeAddresses = [];
178
+ for (let i = 0; i < rawGaugeAddresses.length; i++) {
179
+ gaugeAddresses.push(rawGaugeAddresses[i] !== curve.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
180
+ }
184
181
  setCryptoFactorySwapContracts.call(this, swapAddresses);
185
182
  setCryptoFactoryGaugeContracts.call(this, gaugeAddresses);
186
183
  setCryptoFactoryCoinsContracts.call(this, coinAddresses);
@@ -46,42 +46,42 @@ function _handleCoinAddresses(coinAddresses) {
46
46
  return coinAddresses.map((addresses) => addresses.map((addr) => this.chainId === 137 && addr === "0x0000000000000000000000000000000000001010" ? this.constants.NATIVE_TOKEN.wrappedAddress : addr.toLowerCase()));
47
47
  }
48
48
  function getPoolsData(factorySwapAddresses) {
49
+ var _a;
49
50
  return __awaiter(this, void 0, void 0, function* () {
51
+ const factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
52
+ const isGaugeFactoryNull = this.constants.ALIASES.gauge_factory === curve.constants.ZERO_ADDRESS;
53
+ const isGaugeFactoryOldNull = !("gauge_factory_old" in this.constants.ALIASES);
54
+ const calls = [];
50
55
  if (this.chainId === 1) {
51
- const factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
52
- const calls = [];
53
56
  for (const addr of factorySwapAddresses) {
54
57
  calls.push(factoryMulticallContract.get_gauge(addr));
55
58
  calls.push(factoryMulticallContract.get_coins(addr));
56
59
  }
57
- const res = yield this.multicallProvider.all(calls);
58
- const gaugeAddresses = res.filter((a, i) => i % 2 == 0).map((a) => a.toLowerCase());
59
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 2 == 1));
60
- return [gaugeAddresses, coinAddresses];
61
60
  }
62
61
  else {
63
- const factoryMulticallContract = this.contracts[this.constants.ALIASES.twocrypto_factory].multicallContract;
64
- const isFactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
65
- const factoryMulticallGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
66
- const calls = [];
62
+ const gaugeFactoryMulticallContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
63
+ const gaugeFactoryOldMulticallContract = this.contracts[(_a = this.constants.ALIASES.gauge_factory_old) !== null && _a !== void 0 ? _a : curve.constants.ZERO_ADDRESS].multicallContract;
67
64
  for (const addr of factorySwapAddresses) {
68
- if (!isFactoryGaugeNull) {
69
- calls.push(factoryMulticallGaugeContract.get_gauge_from_lp_token(addr));
70
- }
65
+ if (!isGaugeFactoryNull)
66
+ calls.push(gaugeFactoryMulticallContract.get_gauge_from_lp_token(addr));
67
+ if (!isGaugeFactoryOldNull)
68
+ calls.push(gaugeFactoryOldMulticallContract.get_gauge_from_lp_token(addr));
71
69
  calls.push(factoryMulticallContract.get_coins(addr));
72
70
  }
73
- const res = yield this.multicallProvider.all(calls);
74
- if (!isFactoryGaugeNull) {
75
- const gaugeAddresses = res.filter((a, i) => i % 2 == 0).map((a) => a.toLowerCase());
76
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 2 == 1));
77
- return [gaugeAddresses, coinAddresses];
78
- }
79
- else {
80
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 2 == 0));
81
- const gaugeAddresses = Array.from(Array(factorySwapAddresses.length)).map(() => '0x0000000000000000000000000000000000000000');
82
- return [gaugeAddresses, coinAddresses];
71
+ }
72
+ const res = yield this.multicallProvider.all(calls);
73
+ if (isGaugeFactoryNull || isGaugeFactoryOldNull) {
74
+ for (let index = 0; index < res.length; index++) {
75
+ if (isGaugeFactoryNull && index % 3 == 0)
76
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
77
+ if (isGaugeFactoryOldNull && index % 3 == 1)
78
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
83
79
  }
84
80
  }
81
+ const gaugeAddresses = res.filter((a, i) => i % 3 == 0).map((a) => a.toLowerCase());
82
+ const gaugeOldAddresses = res.filter((a, i) => i % 3 == 1).map((a) => a.toLowerCase());
83
+ const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 3 == 2));
84
+ return [gaugeAddresses, gaugeOldAddresses, coinAddresses];
85
85
  });
86
86
  }
87
87
  function setTwocryptoFactorySwapContracts(factorySwapAddresses) {
@@ -89,11 +89,6 @@ function setTwocryptoFactorySwapContracts(factorySwapAddresses) {
89
89
  this.setContract(addr, twocryptoFactorySwapABI);
90
90
  });
91
91
  }
92
- function setTwocryptoFactoryTokenContracts(factoryTokenAddresses) {
93
- factoryTokenAddresses.forEach((addr) => {
94
- this.setContract(addr, ERC20ABI);
95
- });
96
- }
97
92
  function setTwocryptoFactoryGaugeContracts(factoryGaugeAddresses) {
98
93
  factoryGaugeAddresses.filter((addr) => addr !== curve.constants.ZERO_ADDRESS).forEach((addr, i) => {
99
94
  this.setContract(addr, this.chainId === 1 ? factoryGaugeABI : gaugeChildABI);
@@ -177,7 +172,11 @@ export function getTwocryptoFactoryPoolData(fromIdx = 0, swapAddress) {
177
172
  : yield getTwocryptoFactoryIdsAndSwapAddresses.call(this, fromIdx);
178
173
  if (poolIds.length === 0)
179
174
  return {};
180
- const [gaugeAddresses, coinAddresses] = yield getPoolsData.call(this, swapAddresses);
175
+ const [rawGaugeAddresses, rawOldGaugeAddresses, coinAddresses] = yield getPoolsData.call(this, swapAddresses);
176
+ const gaugeAddresses = [];
177
+ for (let i = 0; i < rawGaugeAddresses.length; i++) {
178
+ gaugeAddresses.push(rawGaugeAddresses[i] !== curve.constants.ZERO_ADDRESS ? rawGaugeAddresses[i] : rawOldGaugeAddresses[i]);
179
+ }
181
180
  setTwocryptoFactorySwapContracts.call(this, swapAddresses);
182
181
  setTwocryptoFactoryGaugeContracts.call(this, gaugeAddresses);
183
182
  setTwocryptoFactoryCoinsContracts.call(this, coinAddresses);
@@ -106,11 +106,14 @@ function _handleCoinAddresses(coinAddresses) {
106
106
  .map((addr) => this.chainId === 137 && addr === "0x0000000000000000000000000000000000001010" ? this.constants.NATIVE_TOKEN.address : addr.toLowerCase()));
107
107
  }
108
108
  function getPoolsData(factorySwapAddresses, factoryAddress) {
109
+ var _a;
109
110
  return __awaiter(this, void 0, void 0, function* () {
110
111
  const factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
111
- const isFactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
112
+ const isGaugeFactoryNull = this.constants.ALIASES.gauge_factory === curve.constants.ZERO_ADDRESS;
113
+ const isGaugeFactoryOldNull = !("gauge_factory_old" in this.constants.ALIASES);
112
114
  const isStableNgFactory = factoryAddress === this.constants.ALIASES['stable_ng_factory'];
113
- const factoryGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
115
+ const gaugeFactoryContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
116
+ const gaugeFactoryOldContract = this.contracts[(_a = this.constants.ALIASES.gauge_factory_old) !== null && _a !== void 0 ? _a : curve.constants.ZERO_ADDRESS].multicallContract;
114
117
  const calls = [];
115
118
  for (const addr of factorySwapAddresses) {
116
119
  const tempSwapContract = new MulticallContract(addr, ERC20ABI);
@@ -118,8 +121,11 @@ function getPoolsData(factorySwapAddresses, factoryAddress) {
118
121
  if (this.chainId === 1) {
119
122
  calls.push(factoryMulticallContract.get_gauge(addr));
120
123
  }
121
- else if (!isFactoryGaugeNull) {
122
- calls.push(factoryGaugeContract.get_gauge_from_lp_token(addr));
124
+ else if (!isGaugeFactoryNull) {
125
+ calls.push(gaugeFactoryContract.get_gauge_from_lp_token(addr));
126
+ }
127
+ if (!isGaugeFactoryOldNull) {
128
+ calls.push(gaugeFactoryOldContract.get_gauge_from_lp_token(addr));
123
129
  }
124
130
  if (!isStableNgFactory) {
125
131
  calls.push(factoryMulticallContract.get_pool_asset_type(addr));
@@ -130,28 +136,25 @@ function getPoolsData(factorySwapAddresses, factoryAddress) {
130
136
  calls.push(factoryMulticallContract.get_coins(addr));
131
137
  }
132
138
  const res = yield this.multicallProvider.all(calls);
133
- if (isFactoryGaugeNull) {
139
+ if (isGaugeFactoryNull || isGaugeFactoryOldNull || isStableNgFactory) {
134
140
  for (let index = 0; index < res.length; index++) {
135
- if (index % 7 == 1) {
136
- res.splice(index, 0, '0x0000000000000000000000000000000000000000');
137
- }
138
- }
139
- }
140
- if (isStableNgFactory) {
141
- for (let index = 0; index < res.length; index++) {
142
- if (index % 7 == 2) {
141
+ if (isGaugeFactoryNull && index % 8 == 1)
142
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
143
+ if (isGaugeFactoryOldNull && index % 8 == 2)
144
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
145
+ if (isStableNgFactory && index % 8 == 3)
143
146
  res.splice(index, 0, -1);
144
- }
145
147
  }
146
148
  }
147
- const implememntationAddresses = res.filter((a, i) => i % 7 == 0).map((a) => a.toLowerCase());
148
- const gaugeAddresses = res.filter((a, i) => i % 7 == 1).map((a) => a.toLowerCase());
149
- const referenceAssets = _handleReferenceAssets(res.filter((a, i) => i % 7 == 2));
150
- const symbols = res.filter((a, i) => i % 7 == 3);
151
- const names = res.filter((a, i) => i % 7 == 4);
152
- const isMeta = res.filter((a, i) => i % 7 == 5);
153
- const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 7 == 6));
154
- return [implememntationAddresses, gaugeAddresses, referenceAssets, symbols, names, isMeta, coinAddresses];
149
+ const implememntationAddresses = res.filter((a, i) => i % 8 == 0).map((a) => a.toLowerCase());
150
+ const gaugeAddresses = res.filter((a, i) => i % 8 == 1).map((a) => a.toLowerCase());
151
+ const oldGaugeAddresses = res.filter((a, i) => i % 8 == 2).map((a) => a.toLowerCase());
152
+ const referenceAssets = _handleReferenceAssets(res.filter((a, i) => i % 8 == 3));
153
+ const symbols = res.filter((a, i) => i % 8 == 4);
154
+ const names = res.filter((a, i) => i % 8 == 5);
155
+ const isMeta = res.filter((a, i) => i % 8 == 6);
156
+ const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 8 == 7));
157
+ return [implememntationAddresses, gaugeAddresses, oldGaugeAddresses, referenceAssets, symbols, names, isMeta, coinAddresses];
155
158
  });
156
159
  }
157
160
  function setFactorySwapContracts(factorySwapAddresses, factorySwapABIs) {
@@ -226,7 +229,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
226
229
  : yield getFactoryIdsAndSwapAddresses.call(this, fromIdx, factoryAddress);
227
230
  if (rawPoolIds.length === 0)
228
231
  return {};
229
- const [rawImplementations, rawGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
232
+ const [rawImplementations, rawGauges, rawOldGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
230
233
  const poolIds = [];
231
234
  const swapAddresses = [];
232
235
  const implementations = [];
@@ -242,7 +245,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
242
245
  poolIds.push(rawPoolIds[i]);
243
246
  swapAddresses.push(rawSwapAddresses[i]);
244
247
  implementations.push(rawImplementations[i]);
245
- gaugeAddresses.push(rawGauges[i]);
248
+ gaugeAddresses.push(rawGauges[i] !== curve.constants.ZERO_ADDRESS ? rawGauges[i] : rawOldGauges[i]);
246
249
  referenceAssets.push(rawReferenceAssets[i]);
247
250
  poolSymbols.push(rawPoolSymbols[i]);
248
251
  poolNames.push(rawPoolNames[i]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.63.3",
3
+ "version": "2.63.4",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",