@curvefi/api 1.25.1 → 2.1.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.
Files changed (213) hide show
  1. package/README.md +797 -590
  2. package/docs/v1/README.md +916 -0
  3. package/lib/boosting.d.ts +12 -12
  4. package/lib/boosting.js +23 -23
  5. package/lib/constants/abis/{json/2pool → 2pool}/swap.json +0 -0
  6. package/lib/constants/abis/{json/3pool → 3pool}/swap.json +0 -0
  7. package/lib/constants/abis/{json/4pool → 4pool}/swap.json +0 -0
  8. package/lib/constants/abis/{json/ERC20.json → ERC20.json} +0 -0
  9. package/lib/constants/abis/{json/aave → aave}/rewards.json +0 -0
  10. package/lib/constants/abis/{json/aave → aave}/swap.json +0 -0
  11. package/lib/constants/abis/{json/address_provider.json → address_provider.json} +0 -0
  12. package/lib/constants/abis/{json/ankreth → ankreth}/sCurveRewards.json +0 -0
  13. package/lib/constants/abis/{json/ankreth → ankreth}/swap.json +0 -0
  14. package/lib/constants/abis/{json/atricrypto3 → atricrypto3}/swap.json +0 -0
  15. package/lib/constants/abis/{json/atricrypto3 → atricrypto3}/zap.json +0 -0
  16. package/lib/constants/abis/{json/bbtc → bbtc}/deposit.json +0 -0
  17. package/lib/constants/abis/{json/bbtc → bbtc}/swap.json +0 -0
  18. package/lib/constants/abis/{json/busd → busd}/deposit.json +0 -0
  19. package/lib/constants/abis/{json/busd → busd}/swap.json +0 -0
  20. package/lib/constants/abis/{json/cERC20.json → cERC20.json} +0 -0
  21. package/lib/constants/abis/{json/compound → compound}/deposit.json +0 -0
  22. package/lib/constants/abis/{json/compound → compound}/swap.json +0 -0
  23. package/lib/constants/abis/{json/crveth → crveth}/swap.json +0 -0
  24. package/lib/constants/abis/{json/deposit_and_stake.json → deposit_and_stake.json} +0 -0
  25. package/lib/constants/abis/{json/dusd → dusd}/deposit.json +0 -0
  26. package/lib/constants/abis/{json/dusd → dusd}/sCurveRewards.json +0 -0
  27. package/lib/constants/abis/{json/dusd → dusd}/swap.json +0 -0
  28. package/lib/constants/abis/{json/eurs → eurs}/sCurveRewards.json +0 -0
  29. package/lib/constants/abis/{json/eurs → eurs}/swap.json +0 -0
  30. package/lib/constants/abis/{json/eursusd → eursusd}/swap.json +0 -0
  31. package/lib/constants/abis/{json/eurt → eurt}/swap.json +0 -0
  32. package/lib/constants/abis/{json/eurtusd → eurtusd}/deposit.json +0 -0
  33. package/lib/constants/abis/{json/eurtusd → eurtusd}/swap.json +0 -0
  34. package/lib/constants/abis/{json/factory-crypto → factory-crypto}/factory-crypto-pool-2.json +0 -0
  35. package/lib/constants/abis/{json/factory-crypto.json → factory-crypto.json} +0 -0
  36. package/lib/constants/abis/{json/factory-v2 → factory-v2}/DepositZapMetaBtcPolygon.json +0 -0
  37. package/lib/constants/abis/{json/factory-v2 → factory-v2}/DepositZapMetaUsdPolygon.json +0 -0
  38. package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTC.json +0 -0
  39. package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTCBalances.json +0 -0
  40. package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTCBalancesRen.json +0 -0
  41. package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaBTCRen.json +0 -0
  42. package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaUSD.json +0 -0
  43. package/lib/constants/abis/{json/factory-v2 → factory-v2}/MetaUSDBalances.json +0 -0
  44. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2Balances.json +0 -0
  45. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2Basic.json +0 -0
  46. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2ETH.json +0 -0
  47. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain2Optimized.json +0 -0
  48. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3Balances.json +0 -0
  49. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3Basic.json +0 -0
  50. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3ETH.json +0 -0
  51. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain3Optimized.json +0 -0
  52. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4Balances.json +0 -0
  53. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4Basic.json +0 -0
  54. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4ETH.json +0 -0
  55. package/lib/constants/abis/{json/factory-v2 → factory-v2}/Plain4Optimized.json +0 -0
  56. package/lib/constants/abis/{json/factory.json → factory.json} +0 -0
  57. package/lib/constants/abis/{json/factoryPools → factoryPools}/deposit.json +0 -0
  58. package/lib/constants/abis/{json/factoryPools → factoryPools}/rewards.json +0 -0
  59. package/lib/constants/abis/{json/factoryPools → factoryPools}/swap.json +0 -0
  60. package/lib/constants/abis/{json/gauge.json → gauge.json} +0 -0
  61. package/lib/constants/abis/{json/gauge_factory.json → gauge_factory.json} +0 -0
  62. package/lib/constants/abis/{json/gauge_rewards_only.json → gauge_rewards_only.json} +0 -0
  63. package/lib/constants/abis/{json/gauge_synthetix.json → gauge_synthetix.json} +0 -0
  64. package/lib/constants/abis/{json/gauge_v2.json → gauge_v2.json} +0 -0
  65. package/lib/constants/abis/{json/gauge_v3.json → gauge_v3.json} +0 -0
  66. package/lib/constants/abis/{json/gauge_v4.json → gauge_v4.json} +0 -0
  67. package/lib/constants/abis/{json/gauge_v5.json → gauge_v5.json} +0 -0
  68. package/lib/constants/abis/{json/gaugecontroller.json → gaugecontroller.json} +0 -0
  69. package/lib/constants/abis/{json/gusd → gusd}/deposit.json +0 -0
  70. package/lib/constants/abis/{json/gusd → gusd}/swap.json +0 -0
  71. package/lib/constants/abis/{json/hbtc → hbtc}/swap.json +0 -0
  72. package/lib/constants/abis/{json/husd → husd}/deposit.json +0 -0
  73. package/lib/constants/abis/{json/husd → husd}/swap.json +0 -0
  74. package/lib/constants/abis/{json/ib → ib}/swap.json +0 -0
  75. package/lib/constants/abis/{json/iearn → iearn}/deposit.json +0 -0
  76. package/lib/constants/abis/{json/iearn → iearn}/sCurveRewards.json +0 -0
  77. package/lib/constants/abis/{json/iearn → iearn}/swap.json +0 -0
  78. package/lib/constants/abis/{json/link → link}/swap.json +0 -0
  79. package/lib/constants/abis/{json/minter.json → minter.json} +0 -0
  80. package/lib/constants/abis/{json/musd → musd}/deposit.json +0 -0
  81. package/lib/constants/abis/{json/musd → musd}/sCurveRewards.json +0 -0
  82. package/lib/constants/abis/{json/musd → musd}/swap.json +0 -0
  83. package/lib/constants/abis/{json/obtc → obtc}/deposit.json +0 -0
  84. package/lib/constants/abis/{json/obtc → obtc}/sCurveRewards.json +0 -0
  85. package/lib/constants/abis/{json/obtc → obtc}/swap.json +0 -0
  86. package/lib/constants/abis/{json/paave → paave}/rewards.json +0 -0
  87. package/lib/constants/abis/{json/pax → pax}/deposit.json +0 -0
  88. package/lib/constants/abis/{json/pax → pax}/swap.json +0 -0
  89. package/lib/constants/abis/{json/pbtc → pbtc}/deposit.json +0 -0
  90. package/lib/constants/abis/{json/pbtc → pbtc}/sCurveRewards.json +0 -0
  91. package/lib/constants/abis/{json/pbtc → pbtc}/swap.json +0 -0
  92. package/lib/constants/abis/{json/rai → rai}/deposit.json +0 -0
  93. package/lib/constants/abis/{json/rai → rai}/swap.json +0 -0
  94. package/lib/constants/abis/{json/registry_exchange.json → registry_exchange.json} +0 -0
  95. package/lib/constants/abis/{json/ren → ren}/swap.json +0 -0
  96. package/lib/constants/abis/{json/ren-polygon → ren-polygon}/swap.json +0 -0
  97. package/lib/constants/abis/{json/reth → reth}/swap.json +0 -0
  98. package/lib/constants/abis/{json/router.json → router.json} +0 -0
  99. package/lib/constants/abis/{json/rsv → rsv}/deposit.json +0 -0
  100. package/lib/constants/abis/{json/rsv → rsv}/sCurveRewards.json +0 -0
  101. package/lib/constants/abis/{json/rsv → rsv}/swap.json +0 -0
  102. package/lib/constants/abis/{json/saave → saave}/swap.json +0 -0
  103. package/lib/constants/abis/{json/sbtc → sbtc}/sCurveRewards.json +0 -0
  104. package/lib/constants/abis/{json/sbtc → sbtc}/swap.json +0 -0
  105. package/lib/constants/abis/{json/seth → seth}/swap.json +0 -0
  106. package/lib/constants/abis/{json/steth → steth}/sCurveRewards.json +0 -0
  107. package/lib/constants/abis/{json/steth → steth}/swap.json +0 -0
  108. package/lib/constants/abis/{json/streamer.json → streamer.json} +0 -0
  109. package/lib/constants/abis/{json/susdv2 → susdv2}/deposit.json +0 -0
  110. package/lib/constants/abis/{json/susdv2 → susdv2}/sCurveRewards.json +0 -0
  111. package/lib/constants/abis/{json/susdv2 → susdv2}/swap.json +0 -0
  112. package/lib/constants/abis/{json/tbtc → tbtc}/deposit.json +0 -0
  113. package/lib/constants/abis/{json/tbtc → tbtc}/sCurveRewards.json +0 -0
  114. package/lib/constants/abis/{json/tbtc → tbtc}/swap.json +0 -0
  115. package/lib/constants/abis/{json/tricrypto2 → tricrypto2}/deposit.json +0 -0
  116. package/lib/constants/abis/{json/tricrypto2 → tricrypto2}/swap.json +0 -0
  117. package/lib/constants/abis/{json/usdk → usdk}/deposit.json +0 -0
  118. package/lib/constants/abis/{json/usdk → usdk}/swap.json +0 -0
  119. package/lib/constants/abis/{json/usdn → usdn}/deposit.json +0 -0
  120. package/lib/constants/abis/{json/usdn → usdn}/swap.json +0 -0
  121. package/lib/constants/abis/{json/usdp → usdp}/deposit.json +0 -0
  122. package/lib/constants/abis/{json/usdp → usdp}/swap.json +0 -0
  123. package/lib/constants/abis/{json/usdt → usdt}/deposit.json +0 -0
  124. package/lib/constants/abis/{json/usdt → usdt}/swap.json +0 -0
  125. package/lib/constants/abis/{json/ust → ust}/deposit.json +0 -0
  126. package/lib/constants/abis/{json/ust → ust}/swap.json +0 -0
  127. package/lib/constants/abis/{json/votingescrow.json → votingescrow.json} +0 -0
  128. package/lib/constants/abis/{json/yERC20.json → yERC20.json} +0 -0
  129. package/lib/constants/aliases.d.ts +2 -24
  130. package/lib/constants/aliases.js +5 -4
  131. package/lib/constants/{coins-ethereum.d.ts → coins/ethereum.d.ts} +0 -9
  132. package/lib/constants/{coins-ethereum.js → coins/ethereum.js} +12 -23
  133. package/lib/constants/{coins-polygon.d.ts → coins/polygon.d.ts} +0 -12
  134. package/lib/constants/{coins-polygon.js → coins/polygon.js} +8 -20
  135. package/lib/constants/pools/ethereum.d.ts +2 -0
  136. package/lib/constants/{abis/abis-ethereum.js → pools/ethereum.js} +517 -1012
  137. package/lib/constants/pools/index.d.ts +3 -0
  138. package/lib/constants/pools/index.js +7 -0
  139. package/lib/constants/pools/polygon.d.ts +4 -0
  140. package/lib/constants/{abis/abis-polygon.js → pools/polygon.js} +53 -81
  141. package/lib/constants/utils.d.ts +5 -0
  142. package/lib/constants/utils.js +69 -0
  143. package/lib/curve.d.ts +10 -32
  144. package/lib/curve.js +188 -232
  145. package/lib/external-api.d.ts +3 -1
  146. package/lib/external-api.js +34 -1
  147. package/lib/factory/constants.d.ts +15 -15
  148. package/lib/factory/constants.js +19 -19
  149. package/lib/factory/factory-api.d.ts +2 -2
  150. package/lib/factory/factory-api.js +52 -45
  151. package/lib/factory/factory-crypto.d.ts +2 -2
  152. package/lib/factory/factory-crypto.js +23 -31
  153. package/lib/factory/factory.d.ts +2 -2
  154. package/lib/factory/factory.js +53 -66
  155. package/lib/index.d.ts +37 -53
  156. package/lib/index.js +28 -35
  157. package/lib/interfaces.d.ts +35 -72
  158. package/lib/pools/PoolTemplate.d.ts +212 -0
  159. package/lib/pools/PoolTemplate.js +2371 -0
  160. package/lib/pools/index.d.ts +3 -0
  161. package/lib/pools/index.js +7 -0
  162. package/lib/pools/mixins/common.d.ts +3 -0
  163. package/lib/pools/mixins/common.js +77 -0
  164. package/lib/pools/mixins/depositBalancedAmountsMixins.d.ts +5 -0
  165. package/lib/pools/mixins/depositBalancedAmountsMixins.js +145 -0
  166. package/lib/pools/mixins/depositBonusMixins.d.ts +5 -0
  167. package/lib/pools/mixins/depositBonusMixins.js +164 -0
  168. package/lib/pools/mixins/depositMixins.d.ts +5 -0
  169. package/lib/pools/mixins/depositMixins.js +373 -0
  170. package/lib/pools/mixins/depositWrappedMixins.d.ts +3 -0
  171. package/lib/pools/mixins/depositWrappedMixins.js +243 -0
  172. package/lib/pools/mixins/poolBalancesMixin.d.ts +4 -0
  173. package/lib/pools/mixins/poolBalancesMixin.js +129 -0
  174. package/lib/pools/mixins/swapMixins.d.ts +4 -0
  175. package/lib/pools/mixins/swapMixins.js +313 -0
  176. package/lib/pools/mixins/swapWrappedMixins.d.ts +4 -0
  177. package/lib/pools/mixins/swapWrappedMixins.js +297 -0
  178. package/lib/pools/mixins/withdrawExpectedMixins.d.ts +6 -0
  179. package/lib/pools/mixins/withdrawExpectedMixins.js +164 -0
  180. package/lib/pools/mixins/withdrawImbalanceMixins.d.ts +5 -0
  181. package/lib/pools/mixins/withdrawImbalanceMixins.js +348 -0
  182. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.d.ts +3 -0
  183. package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +207 -0
  184. package/lib/pools/mixins/withdrawMixins.d.ts +5 -0
  185. package/lib/pools/mixins/withdrawMixins.js +347 -0
  186. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.d.ts +5 -0
  187. package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +104 -0
  188. package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +5 -0
  189. package/lib/pools/mixins/withdrawOneCoinMixins.js +347 -0
  190. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.d.ts +3 -0
  191. package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +72 -0
  192. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +3 -0
  193. package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +205 -0
  194. package/lib/pools/mixins/withdrawWrappedMixins.d.ts +3 -0
  195. package/lib/pools/mixins/withdrawWrappedMixins.js +206 -0
  196. package/lib/pools/poolConstructor.d.ts +2 -0
  197. package/lib/pools/poolConstructor.js +228 -0
  198. package/lib/pools/utils.d.ts +4 -0
  199. package/lib/pools/utils.js +85 -0
  200. package/lib/router.d.ts +13 -0
  201. package/lib/router.js +651 -0
  202. package/lib/utils.d.ts +11 -16
  203. package/lib/utils.js +47 -130
  204. package/package.json +1 -1
  205. package/lib/constants/abis/abis-ethereum.d.ts +0 -4
  206. package/lib/constants/abis/abis-polygon.d.ts +0 -4
  207. package/lib/constants/abis/json/aRewards.json +0 -1
  208. package/lib/constants/abis/json/compound/migration.json +0 -57
  209. package/lib/constants/abis/json/compound/oldSwap.json +0 -688
  210. package/lib/constants/abis/json/ren/adapter.json +0 -1
  211. package/lib/constants/abis/json/sbtc/adapter.json +0 -1
  212. package/lib/pools.d.ts +0 -267
  213. package/lib/pools.js +0 -4742
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.withdrawOneCoinPlainMixin = exports.withdrawOneCoinLendingOrCryptoMixin = exports.withdrawOneCoinZapMixin = exports.withdrawOneCoinMetaFactoryMixin = void 0;
51
+ var curve_1 = require("../../curve");
52
+ var utils_1 = require("../../utils");
53
+ // @ts-ignore
54
+ function _withdrawOneCoinCheck(lpTokenAmount, coin, estimateGas) {
55
+ if (estimateGas === void 0) { estimateGas = false; }
56
+ return __awaiter(this, void 0, void 0, function () {
57
+ var lpTokenBalance, _a, i, _lpTokenAmount;
58
+ return __generator(this, function (_b) {
59
+ switch (_b.label) {
60
+ case 0: return [4 /*yield*/, this.wallet.lpTokenBalances()];
61
+ case 1:
62
+ lpTokenBalance = (_b.sent())['lpToken'];
63
+ if (Number(lpTokenBalance) < Number(lpTokenAmount)) {
64
+ throw Error("Not enough LP tokens. Actual: ".concat(lpTokenBalance, ", required: ").concat(lpTokenAmount));
65
+ }
66
+ _a = estimateGas && this.zap;
67
+ if (!_a) return [3 /*break*/, 3];
68
+ return [4 /*yield*/, (0, utils_1.hasAllowance)([this.lpToken], [lpTokenAmount], curve_1.curve.signerAddress, this.zap)];
69
+ case 2:
70
+ _a = !(_b.sent());
71
+ _b.label = 3;
72
+ case 3:
73
+ if (_a) {
74
+ throw Error("Token allowance is needed to estimate gas");
75
+ }
76
+ if (!!estimateGas) return [3 /*break*/, 5];
77
+ return [4 /*yield*/, curve_1.curve.updateFeeData()];
78
+ case 4:
79
+ _b.sent();
80
+ _b.label = 5;
81
+ case 5:
82
+ i = this._getCoinIdx(coin);
83
+ _lpTokenAmount = (0, utils_1.parseUnits)(lpTokenAmount);
84
+ return [2 /*return*/, [_lpTokenAmount, i]];
85
+ }
86
+ });
87
+ });
88
+ }
89
+ function _withdrawOneCoinMinAmount(_lpTokenAmount, i, slippage) {
90
+ if (slippage === void 0) { slippage = 0.5; }
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ var _expectedLpTokenAmount, minAmountBN;
93
+ return __generator(this, function (_a) {
94
+ switch (_a.label) {
95
+ case 0: return [4 /*yield*/, this._withdrawOneCoinExpected(_lpTokenAmount, i)];
96
+ case 1:
97
+ _expectedLpTokenAmount = _a.sent();
98
+ minAmountBN = (0, utils_1.toBN)(_expectedLpTokenAmount).times(100 - slippage).div(100);
99
+ return [2 /*return*/, (0, utils_1.fromBN)(minAmountBN)];
100
+ }
101
+ });
102
+ });
103
+ }
104
+ // @ts-ignore
105
+ exports.withdrawOneCoinMetaFactoryMixin = {
106
+ // @ts-ignore
107
+ _withdrawOneCoin: function (_lpTokenAmount, i, slippage, estimateGas) {
108
+ if (estimateGas === void 0) { estimateGas = false; }
109
+ return __awaiter(this, void 0, void 0, function () {
110
+ var _minAmount, contract, gas, gasLimit;
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0:
114
+ if (!!estimateGas) return [3 /*break*/, 2];
115
+ return [4 /*yield*/, (0, utils_1._ensureAllowance)([this.lpToken], [_lpTokenAmount], this.zap)];
116
+ case 1:
117
+ _a.sent();
118
+ _a.label = 2;
119
+ case 2: return [4 /*yield*/, _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage)];
120
+ case 3:
121
+ _minAmount = _a.sent();
122
+ contract = curve_1.curve.contracts[this.zap].contract;
123
+ return [4 /*yield*/, contract.estimateGas.remove_liquidity_one_coin(this.address, _lpTokenAmount, i, _minAmount, curve_1.curve.constantOptions)];
124
+ case 4:
125
+ gas = _a.sent();
126
+ if (estimateGas)
127
+ return [2 /*return*/, gas.toNumber()];
128
+ gasLimit = gas.mul(130).div(100);
129
+ return [4 /*yield*/, contract.remove_liquidity_one_coin(this.address, _lpTokenAmount, i, _minAmount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
130
+ case 5: return [2 /*return*/, (_a.sent()).hash];
131
+ }
132
+ });
133
+ });
134
+ },
135
+ withdrawOneCoinEstimateGas: function (lpTokenAmount, coin) {
136
+ return __awaiter(this, void 0, void 0, function () {
137
+ var _a, _lpTokenAmount, i;
138
+ return __generator(this, function (_b) {
139
+ switch (_b.label) {
140
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true)];
141
+ case 1:
142
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
143
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true)];
144
+ case 2:
145
+ // @ts-ignore
146
+ return [2 /*return*/, _b.sent()];
147
+ }
148
+ });
149
+ });
150
+ },
151
+ withdrawOneCoin: function (lpTokenAmount, coin, slippage) {
152
+ return __awaiter(this, void 0, void 0, function () {
153
+ var _a, _lpTokenAmount, i;
154
+ return __generator(this, function (_b) {
155
+ switch (_b.label) {
156
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin)];
157
+ case 1:
158
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
159
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, slippage)];
160
+ case 2:
161
+ // @ts-ignore
162
+ return [2 /*return*/, _b.sent()];
163
+ }
164
+ });
165
+ });
166
+ },
167
+ };
168
+ // @ts-ignore
169
+ exports.withdrawOneCoinZapMixin = {
170
+ // @ts-ignore
171
+ _withdrawOneCoin: function (_lpTokenAmount, i, slippage, estimateGas) {
172
+ if (estimateGas === void 0) { estimateGas = false; }
173
+ return __awaiter(this, void 0, void 0, function () {
174
+ var _minAmount, contract, gas, gasLimit;
175
+ return __generator(this, function (_a) {
176
+ switch (_a.label) {
177
+ case 0:
178
+ if (!!estimateGas) return [3 /*break*/, 2];
179
+ return [4 /*yield*/, (0, utils_1._ensureAllowance)([this.lpToken], [_lpTokenAmount], this.zap)];
180
+ case 1:
181
+ _a.sent();
182
+ _a.label = 2;
183
+ case 2: return [4 /*yield*/, _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage)];
184
+ case 3:
185
+ _minAmount = _a.sent();
186
+ contract = curve_1.curve.contracts[this.zap].contract;
187
+ return [4 /*yield*/, contract.estimateGas.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, curve_1.curve.constantOptions)];
188
+ case 4:
189
+ gas = _a.sent();
190
+ if (estimateGas)
191
+ return [2 /*return*/, gas.toNumber()];
192
+ gasLimit = gas.mul(130).div(100);
193
+ return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
194
+ case 5: return [2 /*return*/, (_a.sent()).hash];
195
+ }
196
+ });
197
+ });
198
+ },
199
+ withdrawOneCoinEstimateGas: function (lpTokenAmount, coin) {
200
+ return __awaiter(this, void 0, void 0, function () {
201
+ var _a, _lpTokenAmount, i;
202
+ return __generator(this, function (_b) {
203
+ switch (_b.label) {
204
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true)];
205
+ case 1:
206
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
207
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true)];
208
+ case 2:
209
+ // @ts-ignore
210
+ return [2 /*return*/, _b.sent()];
211
+ }
212
+ });
213
+ });
214
+ },
215
+ withdrawOneCoin: function (lpTokenAmount, coin, slippage) {
216
+ return __awaiter(this, void 0, void 0, function () {
217
+ var _a, _lpTokenAmount, i;
218
+ return __generator(this, function (_b) {
219
+ switch (_b.label) {
220
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin)];
221
+ case 1:
222
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
223
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, slippage)];
224
+ case 2:
225
+ // @ts-ignore
226
+ return [2 /*return*/, _b.sent()];
227
+ }
228
+ });
229
+ });
230
+ },
231
+ };
232
+ // @ts-ignore
233
+ exports.withdrawOneCoinLendingOrCryptoMixin = {
234
+ // @ts-ignore
235
+ _withdrawOneCoin: function (_lpTokenAmount, i, slippage, estimateGas) {
236
+ if (estimateGas === void 0) { estimateGas = false; }
237
+ return __awaiter(this, void 0, void 0, function () {
238
+ var _minAmount, contract, gas, gasLimit;
239
+ return __generator(this, function (_a) {
240
+ switch (_a.label) {
241
+ case 0: return [4 /*yield*/, _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage)];
242
+ case 1:
243
+ _minAmount = _a.sent();
244
+ contract = curve_1.curve.contracts[this.address].contract;
245
+ return [4 /*yield*/, contract.estimateGas.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, true, curve_1.curve.constantOptions)];
246
+ case 2:
247
+ gas = _a.sent();
248
+ if (estimateGas)
249
+ return [2 /*return*/, gas.toNumber()];
250
+ gasLimit = curve_1.curve.chainId === 137 && this.id === 'ren' ? gas.mul(160).div(100) : gas.mul(130).div(100);
251
+ return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, true, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
252
+ case 3: return [2 /*return*/, (_a.sent()).hash];
253
+ }
254
+ });
255
+ });
256
+ },
257
+ withdrawOneCoinEstimateGas: function (lpTokenAmount, coin) {
258
+ return __awaiter(this, void 0, void 0, function () {
259
+ var _a, _lpTokenAmount, i;
260
+ return __generator(this, function (_b) {
261
+ switch (_b.label) {
262
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true)];
263
+ case 1:
264
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
265
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true)];
266
+ case 2:
267
+ // @ts-ignore
268
+ return [2 /*return*/, _b.sent()];
269
+ }
270
+ });
271
+ });
272
+ },
273
+ withdrawOneCoin: function (lpTokenAmount, coin, slippage) {
274
+ return __awaiter(this, void 0, void 0, function () {
275
+ var _a, _lpTokenAmount, i;
276
+ return __generator(this, function (_b) {
277
+ switch (_b.label) {
278
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin)];
279
+ case 1:
280
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
281
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, slippage)];
282
+ case 2:
283
+ // @ts-ignore
284
+ return [2 /*return*/, _b.sent()];
285
+ }
286
+ });
287
+ });
288
+ },
289
+ };
290
+ // @ts-ignore
291
+ exports.withdrawOneCoinPlainMixin = {
292
+ // @ts-ignore
293
+ _withdrawOneCoin: function (_lpTokenAmount, i, slippage, estimateGas) {
294
+ if (estimateGas === void 0) { estimateGas = false; }
295
+ return __awaiter(this, void 0, void 0, function () {
296
+ var _minAmount, contract, gas, gasLimit;
297
+ return __generator(this, function (_a) {
298
+ switch (_a.label) {
299
+ case 0: return [4 /*yield*/, _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage)];
300
+ case 1:
301
+ _minAmount = _a.sent();
302
+ contract = curve_1.curve.contracts[this.address].contract;
303
+ return [4 /*yield*/, contract.estimateGas.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, curve_1.curve.constantOptions)];
304
+ case 2:
305
+ gas = _a.sent();
306
+ if (estimateGas)
307
+ return [2 /*return*/, gas.toNumber()];
308
+ gasLimit = gas.mul(130).div(100);
309
+ return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
310
+ case 3: return [2 /*return*/, (_a.sent()).hash];
311
+ }
312
+ });
313
+ });
314
+ },
315
+ withdrawOneCoinEstimateGas: function (lpTokenAmount, coin) {
316
+ return __awaiter(this, void 0, void 0, function () {
317
+ var _a, _lpTokenAmount, i;
318
+ return __generator(this, function (_b) {
319
+ switch (_b.label) {
320
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin, true)];
321
+ case 1:
322
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
323
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, 0.1, true)];
324
+ case 2:
325
+ // @ts-ignore
326
+ return [2 /*return*/, _b.sent()];
327
+ }
328
+ });
329
+ });
330
+ },
331
+ withdrawOneCoin: function (lpTokenAmount, coin, slippage) {
332
+ return __awaiter(this, void 0, void 0, function () {
333
+ var _a, _lpTokenAmount, i;
334
+ return __generator(this, function (_b) {
335
+ switch (_b.label) {
336
+ case 0: return [4 /*yield*/, _withdrawOneCoinCheck.call(this, lpTokenAmount, coin)];
337
+ case 1:
338
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
339
+ return [4 /*yield*/, this._withdrawOneCoin(_lpTokenAmount, i, slippage)];
340
+ case 2:
341
+ // @ts-ignore
342
+ return [2 /*return*/, _b.sent()];
343
+ }
344
+ });
345
+ });
346
+ },
347
+ };
@@ -0,0 +1,3 @@
1
+ import { PoolTemplate } from "../PoolTemplate";
2
+ export declare const withdrawOneCoinWrappedExpected2argsMixin: PoolTemplate;
3
+ export declare const withdrawOneCoinWrappedExpected3argsMixin: PoolTemplate;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.withdrawOneCoinWrappedExpected3argsMixin = exports.withdrawOneCoinWrappedExpected2argsMixin = void 0;
40
+ var curve_1 = require("../../curve");
41
+ // @ts-ignore
42
+ exports.withdrawOneCoinWrappedExpected2argsMixin = {
43
+ _withdrawOneCoinWrappedExpected: function (_lpTokenAmount, i) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ var contract;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0:
49
+ contract = curve_1.curve.contracts[this.address].contract;
50
+ return [4 /*yield*/, contract.calc_withdraw_one_coin(_lpTokenAmount, i, curve_1.curve.constantOptions)];
51
+ case 1: return [2 /*return*/, _a.sent()];
52
+ }
53
+ });
54
+ });
55
+ },
56
+ };
57
+ // @ts-ignore
58
+ exports.withdrawOneCoinWrappedExpected3argsMixin = {
59
+ _withdrawOneCoinWrappedExpected: function (_lpTokenAmount, i) {
60
+ return __awaiter(this, void 0, void 0, function () {
61
+ var contract;
62
+ return __generator(this, function (_a) {
63
+ switch (_a.label) {
64
+ case 0:
65
+ contract = curve_1.curve.contracts[this.address].contract;
66
+ return [4 /*yield*/, contract.calc_withdraw_one_coin(_lpTokenAmount, i, false, curve_1.curve.constantOptions)];
67
+ case 1: return [2 /*return*/, _a.sent()];
68
+ }
69
+ });
70
+ });
71
+ },
72
+ };
@@ -0,0 +1,3 @@
1
+ import { PoolTemplate } from "../PoolTemplate";
2
+ export declare const withdrawOneCoinWrappedLendingOrCryptoMixin: PoolTemplate;
3
+ export declare const withdrawOneCoinWrappedMixin: PoolTemplate;
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.withdrawOneCoinWrappedMixin = exports.withdrawOneCoinWrappedLendingOrCryptoMixin = void 0;
51
+ var curve_1 = require("../../curve");
52
+ var utils_1 = require("../../utils");
53
+ // @ts-ignore
54
+ function _withdrawOneCoinWrappedCheck(lpTokenAmount, coin) {
55
+ return __awaiter(this, void 0, void 0, function () {
56
+ var lpTokenBalance, i, _lpTokenAmount;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0: return [4 /*yield*/, this.wallet.lpTokenBalances()];
60
+ case 1:
61
+ lpTokenBalance = (_a.sent())['lpToken'];
62
+ if (Number(lpTokenBalance) < Number(lpTokenAmount)) {
63
+ throw Error("Not enough LP tokens. Actual: ".concat(lpTokenBalance, ", required: ").concat(lpTokenAmount));
64
+ }
65
+ return [4 /*yield*/, curve_1.curve.updateFeeData()];
66
+ case 2:
67
+ _a.sent();
68
+ i = this._getCoinIdx(coin, false);
69
+ _lpTokenAmount = (0, utils_1.parseUnits)(lpTokenAmount);
70
+ return [2 /*return*/, [_lpTokenAmount, i]];
71
+ }
72
+ });
73
+ });
74
+ }
75
+ function _withdrawOneCoinWrappedMinAmount(_lpTokenAmount, i, slippage) {
76
+ if (slippage === void 0) { slippage = 0.5; }
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var _expectedLpTokenAmount, minAmountBN;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
81
+ case 0: return [4 /*yield*/, this._withdrawOneCoinWrappedExpected(_lpTokenAmount, i)];
82
+ case 1:
83
+ _expectedLpTokenAmount = _a.sent();
84
+ minAmountBN = (0, utils_1.toBN)(_expectedLpTokenAmount).times(100 - slippage).div(100);
85
+ return [2 /*return*/, (0, utils_1.fromBN)(minAmountBN)];
86
+ }
87
+ });
88
+ });
89
+ }
90
+ // @ts-ignore
91
+ exports.withdrawOneCoinWrappedLendingOrCryptoMixin = {
92
+ // @ts-ignore
93
+ _withdrawOneCoinWrapped: function (_lpTokenAmount, i, slippage, estimateGas) {
94
+ if (estimateGas === void 0) { estimateGas = false; }
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ var _minAmount, contract, gas, gasLimit;
97
+ return __generator(this, function (_a) {
98
+ switch (_a.label) {
99
+ case 0: return [4 /*yield*/, _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage)];
100
+ case 1:
101
+ _minAmount = _a.sent();
102
+ contract = curve_1.curve.contracts[this.address].contract;
103
+ return [4 /*yield*/, contract.estimateGas.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, false, curve_1.curve.constantOptions)];
104
+ case 2:
105
+ gas = _a.sent();
106
+ if (estimateGas)
107
+ return [2 /*return*/, gas.toNumber()];
108
+ gasLimit = curve_1.curve.chainId === 137 && this.id === 'ren' ? gas.mul(160).div(100) : gas.mul(130).div(100);
109
+ return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, false, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
110
+ case 3: return [2 /*return*/, (_a.sent()).hash];
111
+ }
112
+ });
113
+ });
114
+ },
115
+ withdrawOneCoinWrappedEstimateGas: function (lpTokenAmount, coin) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var _a, _lpTokenAmount, i;
118
+ return __generator(this, function (_b) {
119
+ switch (_b.label) {
120
+ case 0: return [4 /*yield*/, _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin)];
121
+ case 1:
122
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
123
+ return [4 /*yield*/, this._withdrawOneCoinWrapped(_lpTokenAmount, i, 0.1, true)];
124
+ case 2:
125
+ // @ts-ignore
126
+ return [2 /*return*/, _b.sent()];
127
+ }
128
+ });
129
+ });
130
+ },
131
+ withdrawOneCoinWrapped: function (lpTokenAmount, coin, slippage) {
132
+ return __awaiter(this, void 0, void 0, function () {
133
+ var _a, _lpTokenAmount, i;
134
+ return __generator(this, function (_b) {
135
+ switch (_b.label) {
136
+ case 0: return [4 /*yield*/, _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin)];
137
+ case 1:
138
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
139
+ return [4 /*yield*/, this._withdrawOneCoinWrapped(_lpTokenAmount, i, slippage)];
140
+ case 2:
141
+ // @ts-ignore
142
+ return [2 /*return*/, _b.sent()];
143
+ }
144
+ });
145
+ });
146
+ },
147
+ };
148
+ // @ts-ignore
149
+ exports.withdrawOneCoinWrappedMixin = {
150
+ // @ts-ignore
151
+ _withdrawOneCoinWrapped: function (_lpTokenAmount, i, slippage, estimateGas) {
152
+ if (estimateGas === void 0) { estimateGas = false; }
153
+ return __awaiter(this, void 0, void 0, function () {
154
+ var _minAmount, contract, gas, gasLimit;
155
+ return __generator(this, function (_a) {
156
+ switch (_a.label) {
157
+ case 0: return [4 /*yield*/, _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage)];
158
+ case 1:
159
+ _minAmount = _a.sent();
160
+ contract = curve_1.curve.contracts[this.address].contract;
161
+ return [4 /*yield*/, contract.estimateGas.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, curve_1.curve.constantOptions)];
162
+ case 2:
163
+ gas = _a.sent();
164
+ if (estimateGas)
165
+ return [2 /*return*/, gas.toNumber()];
166
+ gasLimit = gas.mul(130).div(100);
167
+ return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
168
+ case 3: return [2 /*return*/, (_a.sent()).hash];
169
+ }
170
+ });
171
+ });
172
+ },
173
+ withdrawOneCoinWrappedEstimateGas: function (lpTokenAmount, coin) {
174
+ return __awaiter(this, void 0, void 0, function () {
175
+ var _a, _lpTokenAmount, i;
176
+ return __generator(this, function (_b) {
177
+ switch (_b.label) {
178
+ case 0: return [4 /*yield*/, _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin)];
179
+ case 1:
180
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
181
+ return [4 /*yield*/, this._withdrawOneCoinWrapped(_lpTokenAmount, i, 0.1, true)];
182
+ case 2:
183
+ // @ts-ignore
184
+ return [2 /*return*/, _b.sent()];
185
+ }
186
+ });
187
+ });
188
+ },
189
+ withdrawOneCoinWrapped: function (lpTokenAmount, coin, slippage) {
190
+ return __awaiter(this, void 0, void 0, function () {
191
+ var _a, _lpTokenAmount, i;
192
+ return __generator(this, function (_b) {
193
+ switch (_b.label) {
194
+ case 0: return [4 /*yield*/, _withdrawOneCoinWrappedCheck.call(this, lpTokenAmount, coin)];
195
+ case 1:
196
+ _a = _b.sent(), _lpTokenAmount = _a[0], i = _a[1];
197
+ return [4 /*yield*/, this._withdrawOneCoinWrapped(_lpTokenAmount, i, slippage)];
198
+ case 2:
199
+ // @ts-ignore
200
+ return [2 /*return*/, _b.sent()];
201
+ }
202
+ });
203
+ });
204
+ },
205
+ };
@@ -0,0 +1,3 @@
1
+ import { PoolTemplate } from "../PoolTemplate";
2
+ export declare const withdrawWrapped2argsMixin: PoolTemplate;
3
+ export declare const withdrawWrapped3argsMixin: PoolTemplate;