@curvefi/api 2.63.3 → 2.63.5

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.
@@ -108,9 +108,9 @@ function _handleCoinAddresses(coinAddresses) {
108
108
  function getPoolsData(factorySwapAddresses, factoryAddress) {
109
109
  return __awaiter(this, void 0, void 0, function* () {
110
110
  const factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
111
- const isFactoryGaugeNull = this.constants.ALIASES.gauge_factory === '0x0000000000000000000000000000000000000000';
111
+ const isChildGaugeFactoryNull = curve.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === curve.constants.ZERO_ADDRESS;
112
+ const isChildGaugeFactoryOldNull = !("child_gauge_factory_old" in this.constants.ALIASES);
112
113
  const isStableNgFactory = factoryAddress === this.constants.ALIASES['stable_ng_factory'];
113
- const factoryGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
114
114
  const calls = [];
115
115
  for (const addr of factorySwapAddresses) {
116
116
  const tempSwapContract = new MulticallContract(addr, ERC20ABI);
@@ -118,40 +118,41 @@ function getPoolsData(factorySwapAddresses, factoryAddress) {
118
118
  if (this.chainId === 1) {
119
119
  calls.push(factoryMulticallContract.get_gauge(addr));
120
120
  }
121
- else if (!isFactoryGaugeNull) {
122
- calls.push(factoryGaugeContract.get_gauge_from_lp_token(addr));
121
+ else {
122
+ if (!isChildGaugeFactoryNull) {
123
+ calls.push(this.contracts[this.constants.ALIASES.child_gauge_factory].multicallContract.get_gauge_from_lp_token(addr));
124
+ }
125
+ if (!isChildGaugeFactoryOldNull) {
126
+ calls.push(this.contracts[this.constants.ALIASES.child_gauge_factory_old].multicallContract.get_gauge_from_lp_token(addr));
127
+ }
123
128
  }
124
- if (!isStableNgFactory) {
129
+ if (!isStableNgFactory)
125
130
  calls.push(factoryMulticallContract.get_pool_asset_type(addr));
126
- }
127
131
  calls.push(tempSwapContract.symbol());
128
132
  calls.push(tempSwapContract.name());
129
133
  calls.push(factoryMulticallContract.is_meta(addr));
130
134
  calls.push(factoryMulticallContract.get_coins(addr));
131
135
  }
132
136
  const res = yield this.multicallProvider.all(calls);
133
- if (isFactoryGaugeNull) {
137
+ if (isChildGaugeFactoryNull || isChildGaugeFactoryOldNull || isStableNgFactory) {
134
138
  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) {
139
+ if (isChildGaugeFactoryNull && index % 8 == 1)
140
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
141
+ if (isChildGaugeFactoryOldNull && index % 8 == 2)
142
+ res.splice(index, 0, curve.constants.ZERO_ADDRESS);
143
+ if (isStableNgFactory && index % 8 == 3)
143
144
  res.splice(index, 0, -1);
144
- }
145
145
  }
146
146
  }
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];
147
+ const implememntationAddresses = res.filter((a, i) => i % 8 == 0).map((a) => a.toLowerCase());
148
+ const gaugeAddresses = res.filter((a, i) => i % 8 == 1).map((a) => a.toLowerCase());
149
+ const oldGaugeAddresses = res.filter((a, i) => i % 8 == 2).map((a) => a.toLowerCase());
150
+ const referenceAssets = _handleReferenceAssets(res.filter((a, i) => i % 8 == 3));
151
+ const symbols = res.filter((a, i) => i % 8 == 4);
152
+ const names = res.filter((a, i) => i % 8 == 5);
153
+ const isMeta = res.filter((a, i) => i % 8 == 6);
154
+ const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 8 == 7));
155
+ return [implememntationAddresses, gaugeAddresses, oldGaugeAddresses, referenceAssets, symbols, names, isMeta, coinAddresses];
155
156
  });
156
157
  }
157
158
  function setFactorySwapContracts(factorySwapAddresses, factorySwapABIs) {
@@ -226,7 +227,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
226
227
  : yield getFactoryIdsAndSwapAddresses.call(this, fromIdx, factoryAddress);
227
228
  if (rawPoolIds.length === 0)
228
229
  return {};
229
- const [rawImplementations, rawGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
230
+ const [rawImplementations, rawGauges, rawOldGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
230
231
  const poolIds = [];
231
232
  const swapAddresses = [];
232
233
  const implementations = [];
@@ -242,7 +243,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
242
243
  poolIds.push(rawPoolIds[i]);
243
244
  swapAddresses.push(rawSwapAddresses[i]);
244
245
  implementations.push(rawImplementations[i]);
245
- gaugeAddresses.push(rawGauges[i]);
246
+ gaugeAddresses.push(rawGauges[i] !== curve.constants.ZERO_ADDRESS ? rawGauges[i] : rawOldGauges[i]);
246
247
  referenceAssets.push(rawReferenceAssets[i]);
247
248
  poolSymbols.push(rawPoolSymbols[i]);
248
249
  poolNames.push(rawPoolNames[i]);
@@ -1198,7 +1198,7 @@ export class PoolTemplate {
1198
1198
  return Number(yield curve.contracts[curve.constants.ALIASES.minter].contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
1199
1199
  }
1200
1200
  else {
1201
- return smartNumber(yield curve.contracts[curve.constants.ALIASES.gauge_factory].contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
1201
+ return smartNumber(yield curve.contracts[curve.constants.ALIASES.child_gauge_factory].contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
1202
1202
  }
1203
1203
  });
1204
1204
  }
@@ -1206,7 +1206,9 @@ export class PoolTemplate {
1206
1206
  return __awaiter(this, void 0, void 0, function* () {
1207
1207
  if (this.rewardsOnly())
1208
1208
  throw Error(`${this.name} has Rewards-Only Gauge. Use claimRewards instead`);
1209
- const contract = curve.chainId === 1 ? curve.contracts[curve.constants.ALIASES.minter].contract : curve.contracts[curve.constants.ALIASES.gauge_factory].contract;
1209
+ const contract = curve.chainId === 1 ?
1210
+ curve.contracts[curve.constants.ALIASES.minter].contract :
1211
+ curve.contracts[curve.constants.ALIASES.child_gauge_factory].contract;
1210
1212
  yield curve.updateFeeData();
1211
1213
  const gasLimit = mulBy1_3(DIGas(yield contract.mint.estimateGas(this.gauge.address, curve.constantOptions)));
1212
1214
  return (yield contract.mint(this.gauge.address, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.63.3",
3
+ "version": "2.63.5",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",
@@ -1 +0,0 @@
1
- [{ "name": "BridgerUpdated", "inputs": [{ "name": "_chain_id", "type": "uint256", "indexed": true }, { "name": "_old_bridger", "type": "address", "indexed": false }, { "name": "_new_bridger", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "DeployedGauge", "inputs": [{ "name": "_implementation", "type": "address", "indexed": true }, { "name": "_chain_id", "type": "uint256", "indexed": true }, { "name": "_deployer", "type": "address", "indexed": true }, { "name": "_salt", "type": "bytes32", "indexed": false }, { "name": "_gauge", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "TransferOwnership", "inputs": [{ "name": "_old_owner", "type": "address", "indexed": false }, { "name": "_new_owner", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "UpdateCallProxy", "inputs": [{ "name": "_old_call_proxy", "type": "address", "indexed": false }, { "name": "_new_call_proxy", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "UpdateImplementation", "inputs": [{ "name": "_old_implementation", "type": "address", "indexed": false }, { "name": "_new_implementation", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [{ "name": "_call_proxy", "type": "address" }, { "name": "_owner", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "transmit_emissions", "inputs": [{ "name": "_gauge", "type": "address" }], "outputs": [], "gas": 10132 }, { "stateMutability": "payable", "type": "function", "name": "deploy_gauge", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_salt", "type": "bytes32" }], "outputs": [{ "name": "", "type": "address" }], "gas": 165352 }, { "stateMutability": "nonpayable", "type": "function", "name": "deploy_child_gauge", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_lp_token", "type": "address" }, { "name": "_salt", "type": "bytes32" }], "outputs": [], "gas": 18165 }, { "stateMutability": "nonpayable", "type": "function", "name": "deploy_child_gauge", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_lp_token", "type": "address" }, { "name": "_salt", "type": "bytes32" }, { "name": "_manager", "type": "address" }], "outputs": [], "gas": 18165 }, { "stateMutability": "nonpayable", "type": "function", "name": "set_bridger", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_bridger", "type": "address" }], "outputs": [], "gas": 42889 }, { "stateMutability": "nonpayable", "type": "function", "name": "set_implementation", "inputs": [{ "name": "_implementation", "type": "address" }], "outputs": [], "gas": 41933 }, { "stateMutability": "nonpayable", "type": "function", "name": "set_call_proxy", "inputs": [{ "name": "_new_call_proxy", "type": "address" }], "outputs": [], "gas": 41963 }, { "stateMutability": "nonpayable", "type": "function", "name": "commit_transfer_ownership", "inputs": [{ "name": "_future_owner", "type": "address" }], "outputs": [], "gas": 37785 }, { "stateMutability": "nonpayable", "type": "function", "name": "accept_transfer_ownership", "inputs": [], "outputs": [], "gas": 41864 }, { "stateMutability": "view", "type": "function", "name": "call_proxy", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2700 }, { "stateMutability": "view", "type": "function", "name": "get_bridger", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 2845 }, { "stateMutability": "view", "type": "function", "name": "get_implementation", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2760 }, { "stateMutability": "view", "type": "function", "name": "get_gauge", "inputs": [{ "name": "arg0", "type": "uint256" }, { "name": "arg1", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 2950 }, { "stateMutability": "view", "type": "function", "name": "get_gauge_count", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }], "gas": 2935 }, { "stateMutability": "view", "type": "function", "name": "is_valid_gauge", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }], "gas": 3116 }, { "stateMutability": "view", "type": "function", "name": "owner", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2880 }, { "stateMutability": "view", "type": "function", "name": "future_owner", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2910 }]