@aurigami/sdk 1.5.3 → 1.5.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
@@ -6,7 +6,6 @@ import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/Au
6
6
  import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
7
7
  import FaucetABI from '@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json';
8
8
  import { Signer } from '@ethersproject/abstract-signer';
9
- import assert from 'assert';
10
9
  import axios from 'axios';
11
10
  import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
12
11
  import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
@@ -957,11 +956,15 @@ var networkAddresses = {
957
956
  name: 'auTRI',
958
957
  address: /*#__PURE__*/'0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca'.toLowerCase(),
959
958
  underlying: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase()
959
+ }, {
960
+ name: 'auPLY',
961
+ address: /*#__PURE__*/'0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c'.toLowerCase(),
962
+ underlying: /*#__PURE__*/'0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase()
960
963
  }],
961
964
  misc: {
962
965
  COMPTROLLER: /*#__PURE__*/'0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb'.toLowerCase(),
963
966
  oracle: /*#__PURE__*/'0xC6e5185438e1730959c1eF3551059A3feC744E90'.toLowerCase(),
964
- AURIFAIRLAUNCH: /*#__PURE__*/'0x6f068608573c840bB27b39458d7d87eB865e19Cc'.toLowerCase(),
967
+ AURIFAIRLAUNCH: /*#__PURE__*/'0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2'.toLowerCase(),
965
968
  AURILENS: /*#__PURE__*/'0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70'.toLowerCase(),
966
969
  TOKENLOCK: /*#__PURE__*/'0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
967
970
  ETHREPAYHELPER: /*#__PURE__*/'0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6'.toLowerCase(),
@@ -982,13 +985,13 @@ var networkAddresses = {
982
985
  var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
983
986
  return t.underlying;
984
987
  }), [networkAddresses.tokens.AURORA, networkAddresses.tokens.TRI, networkAddresses.tokens.META, networkAddresses.tokens.stNEAR]));
985
- var REWARD_CLAIM_START = 1651748400;
988
+ var REWARD_CLAIM_START = 1651759200;
986
989
  var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(1);
987
990
  var ONE_DAY = 86400;
988
991
  var ONE_WEEK = ONE_DAY * 7;
989
992
  var ONE_YEAR = ONE_DAY * 365;
990
993
  var PLYWNEAR_POOL_ID = 0;
991
- var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
994
+ var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
992
995
  var ALL_STAKING_POOLS = [];
993
996
  var INF = /*#__PURE__*/BigNumber$1.from(2).pow(256).sub(1);
994
997
  var AIRDROP_START_TIMESTAMP = 1649858400;
@@ -1073,6 +1076,16 @@ var decimalRecords = {
1073
1076
  '0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18
1074
1077
  };
1075
1078
 
1079
+ function assert(condition, message) {
1080
+ if (message === void 0) {
1081
+ message = '';
1082
+ }
1083
+
1084
+ if (!condition) {
1085
+ message = 'Assertion failed' + (message ? ': ' + message : '');
1086
+ throw new Error(message);
1087
+ }
1088
+ }
1076
1089
  function formatObject(object) {
1077
1090
  return JSON.stringify(object, null, ' ');
1078
1091
  }
@@ -2339,7 +2352,7 @@ function _fetchLPPrice() {
2339
2352
  return _fetchLPPriceBy.apply(this, arguments);
2340
2353
  };
2341
2354
 
2342
- fetchLPPriceBy = function _fetchLPPriceBy2(_x22) {
2355
+ fetchLPPriceBy = function _fetchLPPriceBy2(_x23) {
2343
2356
  return _fetchLPPriceBy.apply(this, arguments);
2344
2357
  };
2345
2358
 
@@ -2512,7 +2525,7 @@ function _fetchPrice2() {
2512
2525
  while (1) {
2513
2526
  switch (_context9.prev = _context9.next) {
2514
2527
  case 0:
2515
- assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()));
2528
+ assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
2516
2529
 
2517
2530
  if (!isSameAddress(address, networkAddresses.tokens.stNEAR)) {
2518
2531
  _context9.next = 3;
@@ -2573,16 +2586,24 @@ function _fetchPrice3() {
2573
2586
 
2574
2587
  case 4:
2575
2588
  if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
2576
- _context10.next = 6;
2589
+ _context10.next = 8;
2577
2590
  break;
2578
2591
  }
2579
2592
 
2580
2593
  return _context10.abrupt("return", fetchPLYPrice(provider));
2581
2594
 
2582
- case 6:
2595
+ case 8:
2596
+ if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
2597
+ _context10.next = 10;
2598
+ break;
2599
+ }
2600
+
2601
+ return _context10.abrupt("return", fetchPULPPrice(provider));
2602
+
2603
+ case 10:
2583
2604
  return _context10.abrupt("return", _fetchPrice(address, provider));
2584
2605
 
2585
- case 7:
2606
+ case 11:
2586
2607
  case "end":
2587
2608
  return _context10.stop();
2588
2609
  }
@@ -2614,81 +2635,103 @@ function _fetchPLYPrice() {
2614
2635
  return _fetchPLYPrice.apply(this, arguments);
2615
2636
  }
2616
2637
 
2617
- function fetchToken0PriceByLP(_x16, _x17) {
2638
+ function fetchPULPPrice(_x16) {
2639
+ return _fetchPULPPrice.apply(this, arguments);
2640
+ }
2641
+
2642
+ function _fetchPULPPrice() {
2643
+ _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(provider) {
2644
+ return runtime_1.wrap(function _callee12$(_context12) {
2645
+ while (1) {
2646
+ switch (_context12.prev = _context12.next) {
2647
+ case 0:
2648
+ return _context12.abrupt("return", new BigNumber(0));
2649
+
2650
+ case 1:
2651
+ case "end":
2652
+ return _context12.stop();
2653
+ }
2654
+ }
2655
+ }, _callee12);
2656
+ }));
2657
+ return _fetchPULPPrice.apply(this, arguments);
2658
+ }
2659
+
2660
+ function fetchToken0PriceByLP(_x17, _x18) {
2618
2661
  return _fetchToken0PriceByLP.apply(this, arguments);
2619
2662
  }
2620
2663
 
2621
2664
  function _fetchToken0PriceByLP() {
2622
- _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(LP, provider) {
2665
+ _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(LP, provider) {
2623
2666
  var LPInfo, token0Decimal, token1Decimal;
2624
- return runtime_1.wrap(function _callee12$(_context12) {
2667
+ return runtime_1.wrap(function _callee13$(_context13) {
2625
2668
  while (1) {
2626
- switch (_context12.prev = _context12.next) {
2669
+ switch (_context13.prev = _context13.next) {
2627
2670
  case 0:
2628
- _context12.next = 2;
2671
+ _context13.next = 2;
2629
2672
  return fetchLPPositions(LP, provider);
2630
2673
 
2631
2674
  case 2:
2632
- LPInfo = _context12.sent;
2675
+ LPInfo = _context13.sent;
2633
2676
 
2634
2677
  if (!LPInfo.reserve1.isZero()) {
2635
- _context12.next = 5;
2678
+ _context13.next = 5;
2636
2679
  break;
2637
2680
  }
2638
2681
 
2639
- return _context12.abrupt("return", new BigNumber(0));
2682
+ return _context13.abrupt("return", new BigNumber(0));
2640
2683
 
2641
2684
  case 5:
2642
2685
  token0Decimal = getDecimal(LPInfo.token0);
2643
2686
  token1Decimal = getDecimal(LPInfo.token1);
2644
- _context12.next = 9;
2687
+ _context13.next = 9;
2645
2688
  return fetchPrice(LPInfo.token1, provider);
2646
2689
 
2647
2690
  case 9:
2648
- return _context12.abrupt("return", _context12.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2691
+ return _context13.abrupt("return", _context13.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2649
2692
 
2650
2693
  case 10:
2651
2694
  case "end":
2652
- return _context12.stop();
2695
+ return _context13.stop();
2653
2696
  }
2654
2697
  }
2655
- }, _callee12);
2698
+ }, _callee13);
2656
2699
  }));
2657
2700
  return _fetchToken0PriceByLP.apply(this, arguments);
2658
2701
  }
2659
2702
 
2660
- function fetchValuation(_x18, _x19) {
2703
+ function fetchValuation(_x19, _x20) {
2661
2704
  return _fetchValuation.apply(this, arguments);
2662
2705
  }
2663
2706
 
2664
2707
  function _fetchValuation() {
2665
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(tokenAmount, provider) {
2708
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2666
2709
  var price;
2667
- return runtime_1.wrap(function _callee13$(_context13) {
2710
+ return runtime_1.wrap(function _callee14$(_context14) {
2668
2711
  while (1) {
2669
- switch (_context13.prev = _context13.next) {
2712
+ switch (_context14.prev = _context14.next) {
2670
2713
  case 0:
2671
2714
  if (!(tokenAmount.rawAmount() == '0')) {
2672
- _context13.next = 2;
2715
+ _context14.next = 2;
2673
2716
  break;
2674
2717
  }
2675
2718
 
2676
- return _context13.abrupt("return", new BigNumber(0));
2719
+ return _context14.abrupt("return", new BigNumber(0));
2677
2720
 
2678
2721
  case 2:
2679
- _context13.next = 4;
2722
+ _context14.next = 4;
2680
2723
  return fetchPrice(tokenAmount.token.address, provider);
2681
2724
 
2682
2725
  case 4:
2683
- price = _context13.sent;
2684
- return _context13.abrupt("return", calcValuation(tokenAmount, price));
2726
+ price = _context14.sent;
2727
+ return _context14.abrupt("return", calcValuation(tokenAmount, price));
2685
2728
 
2686
2729
  case 6:
2687
2730
  case "end":
2688
- return _context13.stop();
2731
+ return _context14.stop();
2689
2732
  }
2690
2733
  }
2691
- }, _callee13);
2734
+ }, _callee14);
2692
2735
  }));
2693
2736
  return _fetchValuation.apply(this, arguments);
2694
2737
  }
@@ -2696,23 +2739,23 @@ function _fetchValuation() {
2696
2739
  function calcValuation(tokenAmount, price) {
2697
2740
  return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price);
2698
2741
  }
2699
- function valuateToken(_x20, _x21) {
2742
+ function valuateToken(_x21, _x22) {
2700
2743
  return _valuateToken.apply(this, arguments);
2701
2744
  }
2702
2745
 
2703
2746
  function _valuateToken() {
2704
- _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2747
+ _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(tokenAmount, provider) {
2705
2748
  var tokenValuation;
2706
- return runtime_1.wrap(function _callee14$(_context14) {
2749
+ return runtime_1.wrap(function _callee15$(_context15) {
2707
2750
  while (1) {
2708
- switch (_context14.prev = _context14.next) {
2751
+ switch (_context15.prev = _context15.next) {
2709
2752
  case 0:
2710
- _context14.next = 2;
2753
+ _context15.next = 2;
2711
2754
  return fetchValuation(tokenAmount, provider);
2712
2755
 
2713
2756
  case 2:
2714
- tokenValuation = _context14.sent;
2715
- return _context14.abrupt("return", {
2757
+ tokenValuation = _context15.sent;
2758
+ return _context15.abrupt("return", {
2716
2759
  tokenAmount: tokenAmount,
2717
2760
  currencyAmount: {
2718
2761
  currency: 'USD',
@@ -2722,10 +2765,10 @@ function _valuateToken() {
2722
2765
 
2723
2766
  case 4:
2724
2767
  case "end":
2725
- return _context14.stop();
2768
+ return _context15.stop();
2726
2769
  }
2727
2770
  }
2728
- }, _callee14);
2771
+ }, _callee15);
2729
2772
  }));
2730
2773
  return _valuateToken.apply(this, arguments);
2731
2774
  }
@@ -107616,5 +107659,5 @@ BigNumber.config({
107616
107659
  DECIMAL_PLACES: 50
107617
107660
  });
107618
107661
 
107619
- export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, TransferEventQuery, calcLMRewardApr, calcValuation, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
107662
+ export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, TransferEventQuery, assert, calcLMRewardApr, calcValuation, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
107620
107663
  //# sourceMappingURL=sdk.esm.js.map