@curvefi/api 2.25.2 → 2.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ [
2
+ {
3
+ "stateMutability": "payable",
4
+ "type": "function",
5
+ "name": "deposit_and_stake",
6
+ "inputs": [
7
+ {
8
+ "name": "deposit",
9
+ "type": "address"
10
+ },
11
+ {
12
+ "name": "lp_token",
13
+ "type": "address"
14
+ },
15
+ {
16
+ "name": "gauge",
17
+ "type": "address"
18
+ },
19
+ {
20
+ "name": "n_coins",
21
+ "type": "uint256"
22
+ },
23
+ {
24
+ "name": "coins",
25
+ "type": "address[6]"
26
+ },
27
+ {
28
+ "name": "amounts",
29
+ "type": "uint256[6]"
30
+ },
31
+ {
32
+ "name": "min_mint_amount",
33
+ "type": "uint256"
34
+ },
35
+ {
36
+ "name": "use_underlying",
37
+ "type": "bool"
38
+ },
39
+ {
40
+ "name": "pool",
41
+ "type": "address"
42
+ }
43
+ ],
44
+ "outputs": [],
45
+ "gas": "409532"
46
+ },
47
+ {
48
+ "stateMutability": "payable",
49
+ "type": "fallback"
50
+ }
51
+ ]
@@ -23,7 +23,7 @@ exports.ALIASES_POLYGON = (0, utils_1.lowerCaseValues)({
23
23
  "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
24
24
  "address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
25
25
  "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
26
- "deposit_and_stake": "0x43FF7b96808988C9d19C1d05Ef19658B03e8a143",
26
+ "deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
27
27
  "factory": '0x722272d36ef0da72ff51c5a65db7b870e2e8d4ee',
28
28
  "crypto_factory": "0xE5De15A9C9bBedb4F5EC13B131E61245f2983A69",
29
29
  "registry_exchange": "",
package/lib/curve.js CHANGED
@@ -76,6 +76,7 @@ var address_provider_json_1 = __importDefault(require("./constants/abis/address_
76
76
  var gaugecontroller_json_1 = __importDefault(require("./constants/abis/gaugecontroller.json"));
77
77
  var router_json_1 = __importDefault(require("./constants/abis/router.json"));
78
78
  var deposit_and_stake_json_1 = __importDefault(require("./constants/abis/deposit_and_stake.json"));
79
+ var deposit_and_stake_6coins_json_1 = __importDefault(require("./constants/abis/deposit_and_stake_6coins.json"));
79
80
  var registry_exchange_json_1 = __importDefault(require("./constants/abis/registry_exchange.json"));
80
81
  var streamer_json_1 = __importDefault(require("./constants/abis/streamer.json"));
81
82
  var factory_json_1 = __importDefault(require("./constants/abis/factory.json"));
@@ -588,14 +589,14 @@ var Curve = /** @class */ (function () {
588
589
  contract: new ethers_1.Contract(this.constants.ALIASES.router, router_json_1.default, this.signer || this.provider),
589
590
  multicallContract: new ethcall_1.Contract(this.constants.ALIASES.router, router_json_1.default),
590
591
  };
591
- this.contracts[this.constants.ALIASES.deposit_and_stake] = {
592
- contract: new ethers_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default, this.signer || this.provider),
593
- multicallContract: new ethcall_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default),
594
- };
595
- this.contracts[this.constants.ALIASES.deposit_and_stake.toLowerCase()] = {
596
- contract: new ethers_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default, this.signer || this.provider),
597
- multicallContract: new ethcall_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default),
598
- };
592
+ if (this.chainId === 137) {
593
+ this.setContract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_6coins_json_1.default);
594
+ this.setContract(this.constants.ALIASES.deposit_and_stake.toLowerCase(), deposit_and_stake_6coins_json_1.default);
595
+ }
596
+ else {
597
+ this.setContract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default);
598
+ this.setContract(this.constants.ALIASES.deposit_and_stake.toLowerCase(), deposit_and_stake_json_1.default);
599
+ }
599
600
  this.contracts[this.constants.ALIASES.factory] = {
600
601
  contract: new ethers_1.Contract(this.constants.ALIASES.factory, factory_json_1.default, this.signer || this.provider),
601
602
  multicallContract: new ethcall_1.Contract(this.constants.ALIASES.factory, factory_json_1.default),
@@ -2124,7 +2124,7 @@ var PoolTemplate = /** @class */ (function () {
2124
2124
  };
2125
2125
  PoolTemplate.prototype._depositAndStake = function (amounts, slippage, isUnderlying, estimateGas) {
2126
2126
  return __awaiter(this, void 0, void 0, function () {
2127
- var coinAddresses, coins, decimals, depositAddress, balances, _c, _d, _e, _f, _g, i, allowance, _h, _amounts, contract, useUnderlying, _expectedLpTokenAmount, _j, _k, _l, _m, _o, minAmountBN, _minMintAmount, ethIndex, value, i, _gas, gasLimit;
2127
+ var coinAddresses, coins, decimals, depositAddress, balances, _c, _d, _e, _f, _g, i, allowance, _h, _amounts, contract, useUnderlying, _expectedLpTokenAmount, _j, _k, _l, _m, _o, minAmountBN, _minMintAmount, ethIndex, value, maxCoins, i, _gas, gasLimit;
2128
2128
  return __generator(this, function (_q) {
2129
2129
  switch (_q.label) {
2130
2130
  case 0:
@@ -2200,7 +2200,8 @@ var PoolTemplate = /** @class */ (function () {
2200
2200
  _minMintAmount = (0, utils_1.fromBN)(minAmountBN);
2201
2201
  ethIndex = (0, utils_1.getEthIndex)(coinAddresses);
2202
2202
  value = _amounts[ethIndex] || ethers_1.ethers.BigNumber.from(0);
2203
- for (i = 0; i < 5; i++) {
2203
+ maxCoins = curve_1.curve.chainId === 137 ? 6 : 5;
2204
+ for (i = 0; i < maxCoins; i++) {
2204
2205
  coinAddresses[i] = coinAddresses[i] || ethers_1.ethers.constants.AddressZero;
2205
2206
  _amounts[i] = _amounts[i] || ethers_1.ethers.BigNumber.from(0);
2206
2207
  }
@@ -2794,7 +2795,7 @@ var PoolTemplate = /** @class */ (function () {
2794
2795
  case 1:
2795
2796
  lpTotalBalanceBN = _c.sent();
2796
2797
  if (lpTotalBalanceBN.eq(0))
2797
- return [2 /*return*/, this.underlyingCoins.map(function () { return "0"; })];
2798
+ return [2 /*return*/, this.wrappedCoins.map(function () { return "0"; })];
2798
2799
  return [4 /*yield*/, this.withdrawWrappedExpected(lpTotalBalanceBN.toFixed(18))];
2799
2800
  case 2: return [2 /*return*/, _c.sent()];
2800
2801
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.25.2",
3
+ "version": "2.25.3",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",