@aurigami/sdk 1.18.4 → 1.18.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.
package/dist/sdk.esm.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { BigNumber as BigNumber$1, utils, Contract, ethers } from 'ethers';
3
3
  import { Logger } from 'ethers/lib/utils';
4
- import abis$7 from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
- import abis$8 from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
4
+ import abis$6 from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
+ import abis$7 from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
6
6
  import abis$1 from '@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json';
7
7
  import abis$2 from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
8
8
  import abis$3 from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
9
9
  import AuriOracleABI from '@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json';
10
10
  import abis from '@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json';
11
11
  import abis$4 from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
12
- import abis$9 from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
13
- import abis$5 from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
14
- import abis$c from '@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json';
12
+ import abis$8 from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
13
+ import EIP20InterfaceABI from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
14
+ import abis$b from '@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json';
15
15
  import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json';
16
- import abis$a from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
17
- import abis$b from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
18
- import abis$6 from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
19
- import abis$d from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
20
- import abis$e from '@aurigami/contracts/artifacts/contracts/PlyTokenLock.sol/PlyTokenLock.json';
16
+ import abis$9 from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
17
+ import abis$a from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
18
+ import abis$5 from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
19
+ import abis$c from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
20
+ import abis$d from '@aurigami/contracts/artifacts/contracts/PlyTokenLock.sol/PlyTokenLock.json';
21
21
  import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
22
22
  export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
23
23
  export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_testnet.json';
@@ -37,16 +37,16 @@ var index = {
37
37
  AuriFairLaunchABI: abis$2,
38
38
  AuriLensABI: abis$3,
39
39
  ComptrollerABI: abis$4,
40
- EIP20InterfaceABI: abis$5,
41
- ReferralDirectoryV2ABI: abis$6,
42
- AuErc20ABI: abis$7,
43
- AuETHABI: abis$8,
44
- EthRepayHelperABI: abis$9,
45
- Multicall2ABI: abis$a,
46
- PulpABI: abis$b,
47
- AuriInternalLensABI: abis$c,
48
- PlyGameABI: abis$d,
49
- PlyTokenLockABI: abis$e
40
+ EIP20InterfaceABI: EIP20InterfaceABI,
41
+ ReferralDirectoryV2ABI: abis$5,
42
+ AuErc20ABI: abis$6,
43
+ AuETHABI: abis$7,
44
+ EthRepayHelperABI: abis$8,
45
+ Multicall2ABI: abis$9,
46
+ PulpABI: abis$a,
47
+ AuriInternalLensABI: abis$b,
48
+ PlyGameABI: abis$c,
49
+ PlyTokenLockABI: abis$d
50
50
  };
51
51
 
52
52
  var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
@@ -203,6 +203,8 @@ var REFERRAL_CAMPAIGNS = /*#__PURE__*/Object.fromEntries([['referral-2505', {
203
203
  }]]);
204
204
  var CACHE_TIMEOUT = 10 * 1000; // 10 seconds
205
205
  var SD_INCENTIVE_IN_SD = 83.35;
206
+ var STADER_ETH = /*#__PURE__*/'0x30D20208d987713f46DFD34EF128Bb16C404D10f'.toLowerCase();
207
+ var USDT_ETH = /*#__PURE__*/'0xdAC17F958D2ee523a2206206994597C13D831ec7'.toLowerCase();
206
208
 
207
209
  var decimalRecords = {
208
210
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -1103,7 +1105,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1103
1105
  })) == null ? void 0 : _networkAddresses$auT.address;
1104
1106
  assert(address !== undefined, "AuToken with underlying " + underlyingName + " not found");
1105
1107
  }
1106
- return this.getContract(address, abis$7.abi);
1108
+ return this.getContract(address, abis$6.abi);
1107
1109
  };
1108
1110
  _createClass(AuriEnv, [{
1109
1111
  key: "comptroller",
@@ -1133,7 +1135,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1133
1135
  key: "ply",
1134
1136
  get: function get() {
1135
1137
  if (!this._ply) {
1136
- this._ply = this.getContract(networkAddresses.tokens.PLY, abis$5.abi);
1138
+ this._ply = this.getContract(networkAddresses.tokens.PLY, EIP20InterfaceABI.abi);
1137
1139
  }
1138
1140
  return this._ply;
1139
1141
  }
@@ -1141,7 +1143,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1141
1143
  key: "pulp",
1142
1144
  get: function get() {
1143
1145
  if (!this._pulp) {
1144
- this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$b.abi);
1146
+ this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$a.abi);
1145
1147
  }
1146
1148
  return this._pulp;
1147
1149
  }
@@ -1149,7 +1151,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1149
1151
  key: "auriInternalLens",
1150
1152
  get: function get() {
1151
1153
  if (!this._auriInternalLens) {
1152
- this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$c.abi);
1154
+ this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$b.abi);
1153
1155
  }
1154
1156
  return this._auriInternalLens;
1155
1157
  }
@@ -1165,7 +1167,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1165
1167
  key: "referralDirectoryV2",
1166
1168
  get: function get() {
1167
1169
  if (!this._referralDirectoryV2) {
1168
- this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$6.abi);
1170
+ this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$5.abi);
1169
1171
  }
1170
1172
  return this._referralDirectoryV2;
1171
1173
  }
@@ -1181,7 +1183,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1181
1183
  key: "plygame",
1182
1184
  get: function get() {
1183
1185
  if (!this._plygame) {
1184
- this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$d.abi);
1186
+ this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$c.abi);
1185
1187
  }
1186
1188
  return this._plygame;
1187
1189
  }
@@ -1189,7 +1191,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
1189
1191
  key: "plyTokenLock",
1190
1192
  get: function get() {
1191
1193
  if (!this._plyTokenLock) {
1192
- this._plyTokenLock = this.getContract(networkAddresses.misc.PLY_TOKEN_LOCK, abis$e.abi);
1194
+ this._plyTokenLock = this.getContract(networkAddresses.misc.PLY_TOKEN_LOCK, abis$d.abi);
1193
1195
  }
1194
1196
  return this._plyTokenLock;
1195
1197
  }
@@ -1349,16 +1351,190 @@ function _getPaginatedApi() {
1349
1351
  return _getPaginatedApi.apply(this, arguments);
1350
1352
  }
1351
1353
 
1352
- function fetchPriceFromDefiLlamaAPI(_x) {
1354
+ var KYBER_AGGREGATOR_AURORA_API_END_POINT = 'https://aggregator-api.kyberswap.com/aurora/route/encode';
1355
+ var KYBER_AGGREGATOR_ETH_API_END_POINT = 'https://aggregator-api.kyberswap.com/ethereum/route/encode';
1356
+ function getSwapInfo(_x, _x2, _x3, _x4) {
1357
+ return _getSwapInfo.apply(this, arguments);
1358
+ }
1359
+ function _getSwapInfo() {
1360
+ _getSwapInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(tokenIn, tokenOut, amountIn, onAurora) {
1361
+ var params, endpoint, resp;
1362
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1363
+ while (1) switch (_context.prev = _context.next) {
1364
+ case 0:
1365
+ if (onAurora === void 0) {
1366
+ onAurora = true;
1367
+ }
1368
+ params = {
1369
+ tokenIn: tokenIn,
1370
+ tokenOut: tokenOut,
1371
+ amountIn: amountIn,
1372
+ to: '0x0000000000000000000000000000000000000000',
1373
+ useMeta: '1',
1374
+ saveGas: '1',
1375
+ gasInclude: '1'
1376
+ };
1377
+ endpoint = onAurora ? KYBER_AGGREGATOR_AURORA_API_END_POINT : KYBER_AGGREGATOR_ETH_API_END_POINT;
1378
+ _context.next = 5;
1379
+ return axios.get(endpoint + '?' + new URLSearchParams(params), {
1380
+ headers: {
1381
+ 'Content-Type': 'application/json'
1382
+ }
1383
+ });
1384
+ case 5:
1385
+ resp = _context.sent;
1386
+ return _context.abrupt("return", resp.data);
1387
+ case 7:
1388
+ case "end":
1389
+ return _context.stop();
1390
+ }
1391
+ }, _callee);
1392
+ }));
1393
+ return _getSwapInfo.apply(this, arguments);
1394
+ }
1395
+
1396
+ var ONEINCH_AGGREGATOR_API_END_POINT = 'https://api.1inch.io/v5.0/1313161554/quote';
1397
+ function getQuoteOneInch(_x, _x2, _x3) {
1398
+ return _getQuoteOneInch.apply(this, arguments);
1399
+ }
1400
+ function _getQuoteOneInch() {
1401
+ _getQuoteOneInch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fromTokenAddress, toTokenAddress, amount) {
1402
+ var params, resp;
1403
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1404
+ while (1) switch (_context.prev = _context.next) {
1405
+ case 0:
1406
+ params = {
1407
+ fromTokenAddress: fromTokenAddress,
1408
+ toTokenAddress: toTokenAddress,
1409
+ amount: amount
1410
+ };
1411
+ _context.next = 3;
1412
+ return axios.get(ONEINCH_AGGREGATOR_API_END_POINT + '?' + new URLSearchParams(params), {
1413
+ headers: {
1414
+ 'Content-Type': 'application/json'
1415
+ }
1416
+ });
1417
+ case 3:
1418
+ resp = _context.sent;
1419
+ return _context.abrupt("return", resp.data);
1420
+ case 5:
1421
+ case "end":
1422
+ return _context.stop();
1423
+ }
1424
+ }, _callee);
1425
+ }));
1426
+ return _getQuoteOneInch.apply(this, arguments);
1427
+ }
1428
+
1429
+ function prepareParamsAggregator(_x, _x2) {
1430
+ return _prepareParamsAggregator.apply(this, arguments);
1431
+ }
1432
+ function _prepareParamsAggregator() {
1433
+ _prepareParamsAggregator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(address, provider) {
1434
+ var _networkAddresses$auT, _networkAddresses$auT2;
1435
+ var tokenInErc20, tokenInDecimal, tokenInQuantity, usdtAddress, usdtDecimal;
1436
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1437
+ while (1) switch (_context.prev = _context.next) {
1438
+ case 0:
1439
+ tokenInErc20 = new Contract(address, EIP20InterfaceABI.abi, provider);
1440
+ _context.next = 3;
1441
+ return tokenInErc20.decimals();
1442
+ case 3:
1443
+ tokenInDecimal = _context.sent;
1444
+ tokenInQuantity = BigNumber$1.from(10).pow(tokenInDecimal).toString();
1445
+ usdtAddress = (_networkAddresses$auT = (_networkAddresses$auT2 = networkAddresses.auTokens.find(function (autoken) {
1446
+ return autoken.name == 'auUSDT';
1447
+ })) == null ? void 0 : _networkAddresses$auT2.underlying) != null ? _networkAddresses$auT : '';
1448
+ usdtDecimal = getDecimal(usdtAddress);
1449
+ return _context.abrupt("return", {
1450
+ tokenInQuantity: tokenInQuantity,
1451
+ usdtAddress: usdtAddress,
1452
+ usdtDecimal: usdtDecimal
1453
+ });
1454
+ case 8:
1455
+ case "end":
1456
+ return _context.stop();
1457
+ }
1458
+ }, _callee);
1459
+ }));
1460
+ return _prepareParamsAggregator.apply(this, arguments);
1461
+ }
1462
+ function fetchPriceFromOneInch(_x3, _x4) {
1463
+ return _fetchPriceFromOneInch.apply(this, arguments);
1464
+ }
1465
+ function _fetchPriceFromOneInch() {
1466
+ _fetchPriceFromOneInch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(address, provider) {
1467
+ var _yield$prepareParamsA, tokenInQuantity, usdtAddress, usdtDecimal, info, outputAmount;
1468
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1469
+ while (1) switch (_context2.prev = _context2.next) {
1470
+ case 0:
1471
+ _context2.next = 2;
1472
+ return prepareParamsAggregator(address, provider);
1473
+ case 2:
1474
+ _yield$prepareParamsA = _context2.sent;
1475
+ tokenInQuantity = _yield$prepareParamsA.tokenInQuantity;
1476
+ usdtAddress = _yield$prepareParamsA.usdtAddress;
1477
+ usdtDecimal = _yield$prepareParamsA.usdtDecimal;
1478
+ _context2.next = 8;
1479
+ return getQuoteOneInch(address, usdtAddress, tokenInQuantity);
1480
+ case 8:
1481
+ info = _context2.sent;
1482
+ outputAmount = info.toTokenAmount;
1483
+ return _context2.abrupt("return", new BigNumber(outputAmount).dividedBy(Math.pow(10, usdtDecimal)));
1484
+ case 11:
1485
+ case "end":
1486
+ return _context2.stop();
1487
+ }
1488
+ }, _callee2);
1489
+ }));
1490
+ return _fetchPriceFromOneInch.apply(this, arguments);
1491
+ }
1492
+ function fetchPriceFromKyberSwap(_x5, _x6, _x7) {
1493
+ return _fetchPriceFromKyberSwap.apply(this, arguments);
1494
+ }
1495
+ function _fetchPriceFromKyberSwap() {
1496
+ _fetchPriceFromKyberSwap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(address, provider, onAurora) {
1497
+ var _yield$prepareParamsA2, tokenInQuantity, usdtAddress, usdtDecimal, info, outputAmount;
1498
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1499
+ while (1) switch (_context3.prev = _context3.next) {
1500
+ case 0:
1501
+ if (onAurora === void 0) {
1502
+ onAurora = true;
1503
+ }
1504
+ _context3.next = 3;
1505
+ return prepareParamsAggregator(address, provider);
1506
+ case 3:
1507
+ _yield$prepareParamsA2 = _context3.sent;
1508
+ tokenInQuantity = _yield$prepareParamsA2.tokenInQuantity;
1509
+ usdtAddress = _yield$prepareParamsA2.usdtAddress;
1510
+ usdtDecimal = _yield$prepareParamsA2.usdtDecimal;
1511
+ if (!onAurora) {
1512
+ usdtAddress = USDT_ETH;
1513
+ }
1514
+ _context3.next = 10;
1515
+ return getSwapInfo(address, usdtAddress, tokenInQuantity, onAurora);
1516
+ case 10:
1517
+ info = _context3.sent;
1518
+ outputAmount = info.outputAmount;
1519
+ return _context3.abrupt("return", new BigNumber(outputAmount).dividedBy(Math.pow(10, usdtDecimal)));
1520
+ case 13:
1521
+ case "end":
1522
+ return _context3.stop();
1523
+ }
1524
+ }, _callee3);
1525
+ }));
1526
+ return _fetchPriceFromKyberSwap.apply(this, arguments);
1527
+ }
1528
+ function fetchPriceFromDefiLlamaAPI(_x8) {
1353
1529
  return _fetchPriceFromDefiLlamaAPI.apply(this, arguments);
1354
1530
  }
1355
1531
  function _fetchPriceFromDefiLlamaAPI() {
1356
- _fetchPriceFromDefiLlamaAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
1532
+ _fetchPriceFromDefiLlamaAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id) {
1357
1533
  var price;
1358
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1359
- while (1) switch (_context.prev = _context.next) {
1534
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1535
+ while (1) switch (_context4.prev = _context4.next) {
1360
1536
  case 0:
1361
- _context.next = 2;
1537
+ _context4.next = 2;
1362
1538
  return axios.post("https://coins.llama.fi/prices", {
1363
1539
  coins: [id]
1364
1540
  }).then(function (res) {
@@ -1369,26 +1545,26 @@ function _fetchPriceFromDefiLlamaAPI() {
1369
1545
  return 0;
1370
1546
  });
1371
1547
  case 2:
1372
- price = _context.sent;
1373
- return _context.abrupt("return", new BigNumber(price));
1548
+ price = _context4.sent;
1549
+ return _context4.abrupt("return", new BigNumber(price));
1374
1550
  case 4:
1375
1551
  case "end":
1376
- return _context.stop();
1552
+ return _context4.stop();
1377
1553
  }
1378
- }, _callee);
1554
+ }, _callee4);
1379
1555
  }));
1380
1556
  return _fetchPriceFromDefiLlamaAPI.apply(this, arguments);
1381
1557
  }
1382
- function fetchPriceFromCoingeckoAPI(_x2) {
1558
+ function fetchPriceFromCoingeckoAPI(_x9) {
1383
1559
  return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
1384
1560
  }
1385
1561
  function _fetchPriceFromCoingeckoAPI() {
1386
- _fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(id) {
1562
+ _fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(id) {
1387
1563
  var price;
1388
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1389
- while (1) switch (_context2.prev = _context2.next) {
1564
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1565
+ while (1) switch (_context5.prev = _context5.next) {
1390
1566
  case 0:
1391
- _context2.next = 2;
1567
+ _context5.next = 2;
1392
1568
  return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
1393
1569
  return res.data[id];
1394
1570
  })["catch"](function (err) {
@@ -1399,87 +1575,87 @@ function _fetchPriceFromCoingeckoAPI() {
1399
1575
  };
1400
1576
  });
1401
1577
  case 2:
1402
- price = _context2.sent;
1403
- return _context2.abrupt("return", new BigNumber(price.usd));
1578
+ price = _context5.sent;
1579
+ return _context5.abrupt("return", new BigNumber(price.usd));
1404
1580
  case 4:
1405
1581
  case "end":
1406
- return _context2.stop();
1582
+ return _context5.stop();
1407
1583
  }
1408
- }, _callee2);
1584
+ }, _callee5);
1409
1585
  }));
1410
1586
  return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
1411
1587
  }
1412
- function fetchPriceFromDefiLlama(_x3) {
1588
+ function fetchPriceFromDefiLlama(_x10) {
1413
1589
  return _fetchPriceFromDefiLlama.apply(this, arguments);
1414
1590
  }
1415
1591
  function _fetchPriceFromDefiLlama() {
1416
- _fetchPriceFromDefiLlama = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(id) {
1417
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1418
- while (1) switch (_context3.prev = _context3.next) {
1592
+ _fetchPriceFromDefiLlama = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id) {
1593
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1594
+ while (1) switch (_context6.prev = _context6.next) {
1419
1595
  case 0:
1420
1596
  if (!(id.toLowerCase() == networkAddresses.tokens.AURORA || id.toLowerCase() == networkAddresses.tokens.TRI || id.toLowerCase() == networkAddresses.tokens.META)) {
1421
- _context3.next = 2;
1597
+ _context6.next = 2;
1422
1598
  break;
1423
1599
  }
1424
- return _context3.abrupt("return", fetchPriceFromDefiLlamaAPI("aurora:" + id.toLowerCase()));
1600
+ return _context6.abrupt("return", fetchPriceFromDefiLlamaAPI("aurora:" + id.toLowerCase()));
1425
1601
  case 2:
1426
1602
  throw Error("Unknown token " + id + " in fetchPriceFromDefiLlama");
1427
1603
  case 3:
1428
1604
  case "end":
1429
- return _context3.stop();
1605
+ return _context6.stop();
1430
1606
  }
1431
- }, _callee3);
1607
+ }, _callee6);
1432
1608
  }));
1433
1609
  return _fetchPriceFromDefiLlama.apply(this, arguments);
1434
1610
  }
1435
- function fetchPriceFromCoingecko(_x4) {
1611
+ function fetchPriceFromCoingecko(_x11) {
1436
1612
  return _fetchPriceFromCoingecko.apply(this, arguments);
1437
1613
  }
1438
1614
  function _fetchPriceFromCoingecko() {
1439
- _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id) {
1440
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1441
- while (1) switch (_context4.prev = _context4.next) {
1615
+ _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
1616
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1617
+ while (1) switch (_context7.prev = _context7.next) {
1442
1618
  case 0:
1443
- _context4.t0 = id.toLowerCase();
1444
- _context4.next = _context4.t0 === networkAddresses.tokens.AURORA ? 3 : _context4.t0 === networkAddresses.tokens.TRI ? 4 : _context4.t0 === networkAddresses.tokens.META ? 5 : _context4.t0 === networkAddresses.tokens.STADER ? 6 : 7;
1619
+ _context7.t0 = id.toLowerCase();
1620
+ _context7.next = _context7.t0 === networkAddresses.tokens.AURORA ? 3 : _context7.t0 === networkAddresses.tokens.TRI ? 4 : _context7.t0 === networkAddresses.tokens.META ? 5 : _context7.t0 === networkAddresses.tokens.STADER ? 6 : 7;
1445
1621
  break;
1446
1622
  case 3:
1447
- return _context4.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
1623
+ return _context7.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
1448
1624
  case 4:
1449
- return _context4.abrupt("return", fetchPriceFromCoingeckoAPI('trisolaris'));
1625
+ return _context7.abrupt("return", fetchPriceFromCoingeckoAPI('trisolaris'));
1450
1626
  case 5:
1451
- return _context4.abrupt("return", fetchPriceFromCoingeckoAPI('meta-pool'));
1627
+ return _context7.abrupt("return", fetchPriceFromCoingeckoAPI('meta-pool'));
1452
1628
  case 6:
1453
- return _context4.abrupt("return", fetchPriceFromCoingeckoAPI('stader'));
1629
+ return _context7.abrupt("return", fetchPriceFromCoingeckoAPI('stader'));
1454
1630
  case 7:
1455
1631
  throw Error("Unknown token " + id + " in fetchPriceFromCoingecko");
1456
1632
  case 8:
1457
1633
  case "end":
1458
- return _context4.stop();
1634
+ return _context7.stop();
1459
1635
  }
1460
- }, _callee4);
1636
+ }, _callee7);
1461
1637
  }));
1462
1638
  return _fetchPriceFromCoingecko.apply(this, arguments);
1463
1639
  }
1464
- function fetchLPPositions(_x5, _x6) {
1640
+ function fetchLPPositions(_x12, _x13) {
1465
1641
  return _fetchLPPositions.apply(this, arguments);
1466
1642
  }
1467
1643
  function _fetchLPPositions() {
1468
- _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(LPAddress, provider) {
1644
+ _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(LPAddress, provider) {
1469
1645
  var LPContract, _yield$Promise$all, token0, token1, reserves, totalSupply;
1470
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1471
- while (1) switch (_context5.prev = _context5.next) {
1646
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1647
+ while (1) switch (_context8.prev = _context8.next) {
1472
1648
  case 0:
1473
1649
  LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
1474
- _context5.next = 3;
1650
+ _context8.next = 3;
1475
1651
  return Promise.all([LPContract.token0(), LPContract.token1(), LPContract.getReserves(), LPContract.totalSupply()]);
1476
1652
  case 3:
1477
- _yield$Promise$all = _context5.sent;
1653
+ _yield$Promise$all = _context8.sent;
1478
1654
  token0 = _yield$Promise$all[0];
1479
1655
  token1 = _yield$Promise$all[1];
1480
1656
  reserves = _yield$Promise$all[2];
1481
1657
  totalSupply = _yield$Promise$all[3];
1482
- return _context5.abrupt("return", {
1658
+ return _context8.abrupt("return", {
1483
1659
  token0: token0,
1484
1660
  token1: token1,
1485
1661
  reserve0: reserves.reserve0,
@@ -1488,93 +1664,93 @@ function _fetchLPPositions() {
1488
1664
  });
1489
1665
  case 9:
1490
1666
  case "end":
1491
- return _context5.stop();
1667
+ return _context8.stop();
1492
1668
  }
1493
- }, _callee5);
1669
+ }, _callee8);
1494
1670
  }));
1495
1671
  return _fetchLPPositions.apply(this, arguments);
1496
1672
  }
1497
- function fetchLPPrice(_x7, _x8) {
1673
+ function fetchLPPrice(_x14, _x15) {
1498
1674
  return _fetchLPPrice.apply(this, arguments);
1499
1675
  }
1500
1676
  function _fetchLPPrice() {
1501
- _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address, provider) {
1677
+ _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, provider) {
1502
1678
  var LPInfo, LPDecimal, fetchLPPriceBy, _fetchLPPriceBy, lpPrice;
1503
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1504
- while (1) switch (_context7.prev = _context7.next) {
1679
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1680
+ while (1) switch (_context10.prev = _context10.next) {
1505
1681
  case 0:
1506
1682
  _fetchLPPriceBy = function _fetchLPPriceBy3() {
1507
- _fetchLPPriceBy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(tokenReverse) {
1683
+ _fetchLPPriceBy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(tokenReverse) {
1508
1684
  var tokenPrice, tokenDecimal, reserveUSD;
1509
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1510
- while (1) switch (_context6.prev = _context6.next) {
1685
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1686
+ while (1) switch (_context9.prev = _context9.next) {
1511
1687
  case 0:
1512
1688
  if (!tokenReverse.reserve.isZero()) {
1513
- _context6.next = 2;
1689
+ _context9.next = 2;
1514
1690
  break;
1515
1691
  }
1516
- return _context6.abrupt("return", new BigNumber(0));
1692
+ return _context9.abrupt("return", new BigNumber(0));
1517
1693
  case 2:
1518
- _context6.next = 4;
1694
+ _context9.next = 4;
1519
1695
  return _fetchPrice(tokenReverse.address, provider);
1520
1696
  case 4:
1521
- tokenPrice = _context6.sent;
1697
+ tokenPrice = _context9.sent;
1522
1698
  tokenDecimal = getDecimal(tokenReverse.address); // reserveUSD will be divided by 10^tokenDecimal later for more precision
1523
1699
  reserveUSD = tokenPrice.multipliedBy(tokenReverse.reserve.toString()).multipliedBy(2);
1524
- return _context6.abrupt("return", reserveUSD.multipliedBy(decimalFactor(LPDecimal)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())).dividedBy(decimalFactor(tokenDecimal)));
1700
+ return _context9.abrupt("return", reserveUSD.multipliedBy(decimalFactor(LPDecimal)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())).dividedBy(decimalFactor(tokenDecimal)));
1525
1701
  case 8:
1526
1702
  case "end":
1527
- return _context6.stop();
1703
+ return _context9.stop();
1528
1704
  }
1529
- }, _callee6);
1705
+ }, _callee9);
1530
1706
  }));
1531
1707
  return _fetchLPPriceBy.apply(this, arguments);
1532
1708
  };
1533
- fetchLPPriceBy = function _fetchLPPriceBy2(_x25) {
1709
+ fetchLPPriceBy = function _fetchLPPriceBy2(_x32) {
1534
1710
  return _fetchLPPriceBy.apply(this, arguments);
1535
1711
  };
1536
- _context7.next = 4;
1712
+ _context10.next = 4;
1537
1713
  return fetchLPPositions(address, provider);
1538
1714
  case 4:
1539
- LPInfo = _context7.sent;
1715
+ LPInfo = _context10.sent;
1540
1716
  LPDecimal = getDecimal(address);
1541
- _context7.prev = 6;
1542
- _context7.next = 9;
1717
+ _context10.prev = 6;
1718
+ _context10.next = 9;
1543
1719
  return fetchLPPriceBy({
1544
1720
  address: LPInfo.token0,
1545
1721
  reserve: LPInfo.reserve0
1546
1722
  });
1547
1723
  case 9:
1548
- lpPrice = _context7.sent;
1724
+ lpPrice = _context10.sent;
1549
1725
  if (!lpPrice.isZero()) {
1550
- _context7.next = 12;
1726
+ _context10.next = 12;
1551
1727
  break;
1552
1728
  }
1553
1729
  throw Error("Price is zero");
1554
1730
  case 12:
1555
- return _context7.abrupt("return", lpPrice);
1731
+ return _context10.abrupt("return", lpPrice);
1556
1732
  case 15:
1557
- _context7.prev = 15;
1558
- _context7.t0 = _context7["catch"](6);
1559
- devLog("fetchLPPriceBy " + LPInfo.token0 + " failed", _context7.t0);
1560
- _context7.prev = 18;
1561
- _context7.next = 21;
1733
+ _context10.prev = 15;
1734
+ _context10.t0 = _context10["catch"](6);
1735
+ devLog("fetchLPPriceBy " + LPInfo.token0 + " failed", _context10.t0);
1736
+ _context10.prev = 18;
1737
+ _context10.next = 21;
1562
1738
  return fetchLPPriceBy({
1563
1739
  address: LPInfo.token1,
1564
1740
  reserve: LPInfo.reserve1
1565
1741
  });
1566
1742
  case 21:
1567
- return _context7.abrupt("return", _context7.sent);
1743
+ return _context10.abrupt("return", _context10.sent);
1568
1744
  case 24:
1569
- _context7.prev = 24;
1570
- _context7.t1 = _context7["catch"](18);
1571
- devLog("fetchLPPriceBy " + LPInfo.token1 + " failed", _context7.t1);
1745
+ _context10.prev = 24;
1746
+ _context10.t1 = _context10["catch"](18);
1747
+ devLog("fetchLPPriceBy " + LPInfo.token1 + " failed", _context10.t1);
1572
1748
  throw Error("Unable to fetch price for both tokens of LP " + address);
1573
1749
  case 28:
1574
1750
  case "end":
1575
- return _context7.stop();
1751
+ return _context10.stop();
1576
1752
  }
1577
- }, _callee7, null, [[6, 15], [18, 24]]);
1753
+ }, _callee10, null, [[6, 15], [18, 24]]);
1578
1754
  }));
1579
1755
  return _fetchLPPrice.apply(this, arguments);
1580
1756
  }
@@ -1582,81 +1758,81 @@ function fetchStNEARPrice() {
1582
1758
  return _fetchStNEARPrice.apply(this, arguments);
1583
1759
  }
1584
1760
  function _fetchStNEARPrice() {
1585
- _fetchStNEARPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1761
+ _fetchStNEARPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1586
1762
  var ratioPromise, nearPricePromise, _yield$Promise$all2, ratioRes, nearPrice, ratio;
1587
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1588
- while (1) switch (_context8.prev = _context8.next) {
1763
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1764
+ while (1) switch (_context11.prev = _context11.next) {
1589
1765
  case 0:
1590
1766
  ratioPromise = axios.get('https://validators.narwallets.com/metrics_json').then(function (res) {
1591
1767
  return res.data;
1592
1768
  });
1593
1769
  nearPricePromise = fetchPriceFromCoingeckoAPI('near');
1594
- _context8.next = 4;
1770
+ _context11.next = 4;
1595
1771
  return Promise.all([ratioPromise, nearPricePromise]);
1596
1772
  case 4:
1597
- _yield$Promise$all2 = _context8.sent;
1773
+ _yield$Promise$all2 = _context11.sent;
1598
1774
  ratioRes = _yield$Promise$all2[0];
1599
1775
  nearPrice = _yield$Promise$all2[1];
1600
1776
  ratio = new BigNumber(ratioRes.st_near_price);
1601
- return _context8.abrupt("return", ratio.multipliedBy(nearPrice));
1777
+ return _context11.abrupt("return", ratio.multipliedBy(nearPrice));
1602
1778
  case 9:
1603
1779
  case "end":
1604
- return _context8.stop();
1780
+ return _context11.stop();
1605
1781
  }
1606
- }, _callee8);
1782
+ }, _callee11);
1607
1783
  }));
1608
1784
  return _fetchStNEARPrice.apply(this, arguments);
1609
1785
  }
1610
1786
  function processPriceFromOracle(rawPrice, underlyingDecimal) {
1611
1787
  return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
1612
1788
  }
1613
- function fetchPriceFromOracle(_x9, _x10, _x11) {
1789
+ function fetchPriceFromOracle(_x16, _x17, _x18) {
1614
1790
  return _fetchPriceFromOracle.apply(this, arguments);
1615
1791
  }
1616
1792
  function _fetchPriceFromOracle() {
1617
- _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(auTokenAddress, underlyingDecimal, provider) {
1793
+ _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(auTokenAddress, underlyingDecimal, provider) {
1618
1794
  var oracleContract, rawPrice, matchingAuToken;
1619
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1620
- while (1) switch (_context9.prev = _context9.next) {
1795
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1796
+ while (1) switch (_context12.prev = _context12.next) {
1621
1797
  case 0:
1622
1798
  oracleContract = new Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
1623
- _context9.next = 3;
1799
+ _context12.next = 3;
1624
1800
  return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
1625
1801
  console.log("Unable to fetch price from oracle for " + auTokenAddress);
1626
1802
  return BigNumber$1.from(0);
1627
1803
  });
1628
1804
  case 3:
1629
- rawPrice = _context9.sent;
1805
+ rawPrice = _context12.sent;
1630
1806
  if (!rawPrice.isZero()) {
1631
- _context9.next = 8;
1807
+ _context12.next = 8;
1632
1808
  break;
1633
1809
  }
1634
1810
  matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
1635
1811
  return isSameAddress(auToken.address, auTokenAddress);
1636
1812
  });
1637
1813
  if (!((matchingAuToken == null ? void 0 : matchingAuToken.name) == 'auSTNEAR')) {
1638
- _context9.next = 8;
1814
+ _context12.next = 8;
1639
1815
  break;
1640
1816
  }
1641
- return _context9.abrupt("return", fetchStNEARPrice());
1817
+ return _context12.abrupt("return", fetchStNEARPrice());
1642
1818
  case 8:
1643
- return _context9.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
1819
+ return _context12.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
1644
1820
  case 9:
1645
1821
  case "end":
1646
- return _context9.stop();
1822
+ return _context12.stop();
1647
1823
  }
1648
- }, _callee9);
1824
+ }, _callee12);
1649
1825
  }));
1650
1826
  return _fetchPriceFromOracle.apply(this, arguments);
1651
1827
  }
1652
- function fetchUnderlyingTokensPrices(_x12) {
1828
+ function fetchUnderlyingTokensPrices(_x19) {
1653
1829
  return _fetchUnderlyingTokensPrices.apply(this, arguments);
1654
1830
  }
1655
1831
  function _fetchUnderlyingTokensPrices() {
1656
- _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(provider) {
1832
+ _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(provider) {
1657
1833
  var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
1658
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1659
- while (1) switch (_context10.prev = _context10.next) {
1834
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1835
+ while (1) switch (_context13.prev = _context13.next) {
1660
1836
  case 0:
1661
1837
  auriLens = new Contract(networkAddresses.misc.AURILENS, abis$3.abi, provider);
1662
1838
  auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
@@ -1665,11 +1841,11 @@ function _fetchUnderlyingTokensPrices() {
1665
1841
  underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
1666
1842
  return getDecimal(auToken.underlying);
1667
1843
  });
1668
- _context10.next = 5;
1844
+ _context13.next = 5;
1669
1845
  return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
1670
1846
  case 5:
1671
- rawPrices = _context10.sent;
1672
- return _context10.abrupt("return", rawPrices.map(function (res, ind) {
1847
+ rawPrices = _context13.sent;
1848
+ return _context13.abrupt("return", rawPrices.map(function (res, ind) {
1673
1849
  return {
1674
1850
  auToken: res.auToken,
1675
1851
  underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
@@ -1677,215 +1853,214 @@ function _fetchUnderlyingTokensPrices() {
1677
1853
  }));
1678
1854
  case 7:
1679
1855
  case "end":
1680
- return _context10.stop();
1856
+ return _context13.stop();
1681
1857
  }
1682
- }, _callee10);
1858
+ }, _callee13);
1683
1859
  }));
1684
1860
  return _fetchUnderlyingTokensPrices.apply(this, arguments);
1685
1861
  }
1686
- function shouldFetchFromCoingeckoOrDefiLlama(address) {
1862
+ function shouldFetchFromKyberSwap(address) {
1687
1863
  address = address.toLowerCase();
1688
1864
  return address == networkAddresses.tokens.AURORA || address == networkAddresses.tokens.TRI || address == networkAddresses.tokens.META || address == networkAddresses.tokens.STADER;
1689
1865
  }
1690
1866
  /**
1691
1867
  * Fetch price from Oracle or Coingecko
1692
1868
  */
1693
- function _fetchPrice(_x13, _x14) {
1869
+ function _fetchPrice(_x20, _x21) {
1694
1870
  return _fetchPrice2.apply(this, arguments);
1695
1871
  }
1696
1872
  function _fetchPrice2() {
1697
- _fetchPrice2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, provider) {
1698
- var matchingAuToken;
1699
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1700
- while (1) switch (_context11.prev = _context11.next) {
1873
+ _fetchPrice2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, provider) {
1874
+ var ETH_PROVIDER, matchingAuToken;
1875
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1876
+ while (1) switch (_context14.prev = _context14.next) {
1701
1877
  case 0:
1702
1878
  assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
1703
- if (!shouldFetchFromCoingeckoOrDefiLlama(address)) {
1704
- _context11.next = 11;
1879
+ if (!shouldFetchFromKyberSwap(address)) {
1880
+ _context14.next = 6;
1881
+ break;
1882
+ }
1883
+ if (!(address == networkAddresses.tokens.STADER)) {
1884
+ _context14.next = 5;
1705
1885
  break;
1706
1886
  }
1707
- _context11.prev = 2;
1708
- _context11.next = 5;
1709
- return fetchPriceFromCoingecko(address);
1887
+ ETH_PROVIDER = new ethers.providers.JsonRpcProvider('https://rpc.ankr.com/eth');
1888
+ return _context14.abrupt("return", fetchPriceFromKyberSwap(STADER_ETH, ETH_PROVIDER, false));
1710
1889
  case 5:
1711
- return _context11.abrupt("return", _context11.sent);
1712
- case 8:
1713
- _context11.prev = 8;
1714
- _context11.t0 = _context11["catch"](2);
1715
- return _context11.abrupt("return", fetchPriceFromDefiLlama(address));
1716
- case 11:
1890
+ return _context14.abrupt("return", fetchPriceFromKyberSwap(address, provider));
1891
+ case 6:
1717
1892
  matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
1718
1893
  return isSameAddress(auToken.underlying, address);
1719
1894
  });
1720
1895
  if (!(matchingAuToken !== undefined)) {
1721
- _context11.next = 16;
1896
+ _context14.next = 11;
1722
1897
  break;
1723
1898
  }
1724
- return _context11.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
1725
- case 16:
1899
+ return _context14.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
1900
+ case 11:
1726
1901
  throw Error("Unable to fetch price for " + address);
1727
- case 17:
1902
+ case 12:
1728
1903
  case "end":
1729
- return _context11.stop();
1904
+ return _context14.stop();
1730
1905
  }
1731
- }, _callee11, null, [[2, 8]]);
1906
+ }, _callee14);
1732
1907
  }));
1733
1908
  return _fetchPrice2.apply(this, arguments);
1734
1909
  }
1735
- function fetchPrice(_x15, _x16) {
1910
+ function fetchPrice(_x22, _x23) {
1736
1911
  return _fetchPrice3.apply(this, arguments);
1737
1912
  }
1738
1913
  function _fetchPrice3() {
1739
- _fetchPrice3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, provider) {
1740
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1741
- while (1) switch (_context12.prev = _context12.next) {
1914
+ _fetchPrice3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(address, provider) {
1915
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1916
+ while (1) switch (_context15.prev = _context15.next) {
1742
1917
  case 0:
1743
1918
  if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
1744
- _context12.next = 4;
1919
+ _context15.next = 4;
1745
1920
  break;
1746
1921
  }
1747
- return _context12.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
1922
+ return _context15.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
1748
1923
  case 4:
1749
1924
  if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
1750
- _context12.next = 8;
1925
+ _context15.next = 8;
1751
1926
  break;
1752
1927
  }
1753
- return _context12.abrupt("return", fetchLPPrice(address, provider));
1928
+ return _context15.abrupt("return", fetchLPPrice(address, provider));
1754
1929
  case 8:
1755
1930
  if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
1756
- _context12.next = 12;
1931
+ _context15.next = 12;
1757
1932
  break;
1758
1933
  }
1759
- return _context12.abrupt("return", fetchPLYPrice(provider));
1934
+ return _context15.abrupt("return", fetchPLYPrice(provider));
1760
1935
  case 12:
1761
1936
  if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
1762
- _context12.next = 14;
1937
+ _context15.next = 14;
1763
1938
  break;
1764
1939
  }
1765
- return _context12.abrupt("return", fetchPULPPrice(provider));
1940
+ return _context15.abrupt("return", fetchPULPPrice(provider));
1766
1941
  case 14:
1767
- return _context12.abrupt("return", _fetchPrice(address, provider));
1942
+ return _context15.abrupt("return", _fetchPrice(address, provider));
1768
1943
  case 15:
1769
1944
  case "end":
1770
- return _context12.stop();
1945
+ return _context15.stop();
1771
1946
  }
1772
- }, _callee12);
1947
+ }, _callee15);
1773
1948
  }));
1774
1949
  return _fetchPrice3.apply(this, arguments);
1775
1950
  }
1776
- function fetchPLYPrice(_x17) {
1951
+ function fetchPLYPrice(_x24) {
1777
1952
  return _fetchPLYPrice.apply(this, arguments);
1778
1953
  }
1779
1954
  function _fetchPLYPrice() {
1780
- _fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(provider) {
1781
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1782
- while (1) switch (_context13.prev = _context13.next) {
1955
+ _fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(provider) {
1956
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1957
+ while (1) switch (_context16.prev = _context16.next) {
1783
1958
  case 0:
1784
- return _context13.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
1959
+ return _context16.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
1785
1960
  case 1:
1786
1961
  case "end":
1787
- return _context13.stop();
1962
+ return _context16.stop();
1788
1963
  }
1789
- }, _callee13);
1964
+ }, _callee16);
1790
1965
  }));
1791
1966
  return _fetchPLYPrice.apply(this, arguments);
1792
1967
  }
1793
- function fetchPULPPrice(_x18) {
1968
+ function fetchPULPPrice(_x25) {
1794
1969
  return _fetchPULPPrice.apply(this, arguments);
1795
1970
  }
1796
1971
  function _fetchPULPPrice() {
1797
- _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(provider) {
1798
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1799
- while (1) switch (_context14.prev = _context14.next) {
1972
+ _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(provider) {
1973
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1974
+ while (1) switch (_context17.prev = _context17.next) {
1800
1975
  case 0:
1801
- return _context14.abrupt("return", new BigNumber(0));
1976
+ return _context17.abrupt("return", new BigNumber(0));
1802
1977
  case 1:
1803
1978
  case "end":
1804
- return _context14.stop();
1979
+ return _context17.stop();
1805
1980
  }
1806
- }, _callee14);
1981
+ }, _callee17);
1807
1982
  }));
1808
1983
  return _fetchPULPPrice.apply(this, arguments);
1809
1984
  }
1810
- function fetchToken0PriceByLP(_x19, _x20) {
1985
+ function fetchToken0PriceByLP(_x26, _x27) {
1811
1986
  return _fetchToken0PriceByLP.apply(this, arguments);
1812
1987
  }
1813
1988
  function _fetchToken0PriceByLP() {
1814
- _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(LP, provider) {
1989
+ _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(LP, provider) {
1815
1990
  var LPInfo, token0Decimal, token1Decimal;
1816
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1817
- while (1) switch (_context15.prev = _context15.next) {
1991
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1992
+ while (1) switch (_context18.prev = _context18.next) {
1818
1993
  case 0:
1819
- _context15.next = 2;
1994
+ _context18.next = 2;
1820
1995
  return fetchLPPositions(LP, provider);
1821
1996
  case 2:
1822
- LPInfo = _context15.sent;
1997
+ LPInfo = _context18.sent;
1823
1998
  if (!LPInfo.reserve1.isZero()) {
1824
- _context15.next = 5;
1999
+ _context18.next = 5;
1825
2000
  break;
1826
2001
  }
1827
- return _context15.abrupt("return", new BigNumber(0));
2002
+ return _context18.abrupt("return", new BigNumber(0));
1828
2003
  case 5:
1829
2004
  token0Decimal = getDecimal(LPInfo.token0);
1830
2005
  token1Decimal = getDecimal(LPInfo.token1); // (token0Price * reserve0) / 10^decimal0 = (token1Price * reserve1) / 10^decimal1
1831
2006
  // token0Price = (token1Price * reserve1) * 10^decimal0 / 10^decimal1 / reserve0
1832
- _context15.next = 9;
2007
+ _context18.next = 9;
1833
2008
  return fetchPrice(LPInfo.token1, provider);
1834
2009
  case 9:
1835
- return _context15.abrupt("return", _context15.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2010
+ return _context18.abrupt("return", _context18.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
1836
2011
  case 10:
1837
2012
  case "end":
1838
- return _context15.stop();
2013
+ return _context18.stop();
1839
2014
  }
1840
- }, _callee15);
2015
+ }, _callee18);
1841
2016
  }));
1842
2017
  return _fetchToken0PriceByLP.apply(this, arguments);
1843
2018
  }
1844
- function fetchValuation(_x21, _x22) {
2019
+ function fetchValuation(_x28, _x29) {
1845
2020
  return _fetchValuation.apply(this, arguments);
1846
2021
  }
1847
2022
  function _fetchValuation() {
1848
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(tokenAmount, provider) {
2023
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(tokenAmount, provider) {
1849
2024
  var price;
1850
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1851
- while (1) switch (_context16.prev = _context16.next) {
2025
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2026
+ while (1) switch (_context19.prev = _context19.next) {
1852
2027
  case 0:
1853
2028
  if (!(tokenAmount.rawAmount() == '0')) {
1854
- _context16.next = 2;
2029
+ _context19.next = 2;
1855
2030
  break;
1856
2031
  }
1857
- return _context16.abrupt("return", new BigNumber(0));
2032
+ return _context19.abrupt("return", new BigNumber(0));
1858
2033
  case 2:
1859
- _context16.next = 4;
2034
+ _context19.next = 4;
1860
2035
  return fetchPrice(tokenAmount.token.address, provider);
1861
2036
  case 4:
1862
- price = _context16.sent;
1863
- return _context16.abrupt("return", calcValuation(tokenAmount, price));
2037
+ price = _context19.sent;
2038
+ return _context19.abrupt("return", calcValuation(tokenAmount, price));
1864
2039
  case 6:
1865
2040
  case "end":
1866
- return _context16.stop();
2041
+ return _context19.stop();
1867
2042
  }
1868
- }, _callee16);
2043
+ }, _callee19);
1869
2044
  }));
1870
2045
  return _fetchValuation.apply(this, arguments);
1871
2046
  }
1872
2047
  function calcValuation(tokenAmount, price) {
1873
2048
  return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price);
1874
2049
  }
1875
- function valuateToken(_x23, _x24) {
2050
+ function valuateToken(_x30, _x31) {
1876
2051
  return _valuateToken.apply(this, arguments);
1877
2052
  }
1878
2053
  function _valuateToken() {
1879
- _valuateToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(tokenAmount, provider) {
2054
+ _valuateToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(tokenAmount, provider) {
1880
2055
  var tokenValuation;
1881
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1882
- while (1) switch (_context17.prev = _context17.next) {
2056
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2057
+ while (1) switch (_context20.prev = _context20.next) {
1883
2058
  case 0:
1884
- _context17.next = 2;
2059
+ _context20.next = 2;
1885
2060
  return fetchValuation(tokenAmount, provider);
1886
2061
  case 2:
1887
- tokenValuation = _context17.sent;
1888
- return _context17.abrupt("return", {
2062
+ tokenValuation = _context20.sent;
2063
+ return _context20.abrupt("return", {
1889
2064
  tokenAmount: tokenAmount,
1890
2065
  currencyAmount: {
1891
2066
  currency: 'USD',
@@ -1894,9 +2069,9 @@ function _valuateToken() {
1894
2069
  });
1895
2070
  case 4:
1896
2071
  case "end":
1897
- return _context17.stop();
2072
+ return _context20.stop();
1898
2073
  }
1899
- }, _callee17);
2074
+ }, _callee20);
1900
2075
  }));
1901
2076
  return _valuateToken.apply(this, arguments);
1902
2077
  }
@@ -2283,6 +2458,9 @@ var helpers = {
2283
2458
  getBlockBeforeTimestamp: getBlockBeforeTimestamp,
2284
2459
  devLog: devLog,
2285
2460
  sortEvents: sortEvents,
2461
+ prepareParamsAggregator: prepareParamsAggregator,
2462
+ fetchPriceFromOneInch: fetchPriceFromOneInch,
2463
+ fetchPriceFromKyberSwap: fetchPriceFromKyberSwap,
2286
2464
  fetchPriceFromDefiLlamaAPI: fetchPriceFromDefiLlamaAPI,
2287
2465
  fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
2288
2466
  fetchPriceFromDefiLlama: fetchPriceFromDefiLlama,
@@ -2432,9 +2610,9 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2432
2610
  _this = _BlockchainEntityRead.call(this, networkConnection) || this;
2433
2611
  _this.env = new AuriEnv(networkConnection);
2434
2612
  if (isSameAddress(underlyingAsset, ETHAddress)) {
2435
- _this.auToken = new Contract(auToken, abis$8.abi, networkConnection.provider);
2436
- } else {
2437
2613
  _this.auToken = new Contract(auToken, abis$7.abi, networkConnection.provider);
2614
+ } else {
2615
+ _this.auToken = new Contract(auToken, abis$6.abi, networkConnection.provider);
2438
2616
  }
2439
2617
  _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
2440
2618
  return _this;
@@ -3121,7 +3299,7 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3121
3299
  function MoneyMarketReadWrite(networkConnection, auToken, underlyingAsset) {
3122
3300
  var _this2;
3123
3301
  _this2 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
3124
- _this2._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$9.abi, networkConnection.provider);
3302
+ _this2._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$8.abi, networkConnection.provider);
3125
3303
  return _this2;
3126
3304
  }
3127
3305
  var _proto2 = MoneyMarketReadWrite.prototype;
@@ -4647,7 +4825,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4647
4825
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
4648
4826
  while (1) switch (_context3.prev = _context3.next) {
4649
4827
  case 0:
4650
- lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$5.abi, this._networkConnection.provider);
4828
+ lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, EIP20InterfaceABI.abi, this._networkConnection.provider);
4651
4829
  _context3.next = 3;
4652
4830
  return lpContract.balanceOf(user);
4653
4831
  case 3:
@@ -4784,7 +4962,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4784
4962
  function MulticallRead(networkConnection) {
4785
4963
  var _this;
4786
4964
  _this = _BlockchainEntityRead.call(this, networkConnection) || this;
4787
- _this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
4965
+ _this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$9.abi, networkConnection.provider);
4788
4966
  return _this;
4789
4967
  }
4790
4968
  /**
@@ -5803,5 +5981,5 @@ BigNumber.config({
5803
5981
  DECIMAL_PLACES: 50
5804
5982
  });
5805
5983
 
5806
- export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, PlyTokenLock, PlyTokenLockRead, PlyTokenLockReadWrite, Pulp, PulpRead, PulpReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SD_INCENTIVE_IN_SD, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlama, fetchPriceFromDefiLlamaAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
5984
+ export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, CACHE_TIMEOUT, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, PlyTokenLock, PlyTokenLockRead, PlyTokenLockReadWrite, Pulp, PulpRead, PulpReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SD_INCENTIVE_IN_SD, STADER_ETH, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, USDT_ETH, index as abis, assert, calcLMRewardApr, calcNetApy, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlama, fetchPriceFromDefiLlamaAPI, fetchPriceFromKyberSwap, fetchPriceFromOneInch, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, prepareParamsAggregator, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
5807
5985
  //# sourceMappingURL=sdk.esm.js.map