@aurigami/sdk 1.5.4 → 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.
@@ -15,7 +15,7 @@ export declare type NetworkAddresses = {
15
15
  };
16
16
  export declare const networkAddresses: NetworkAddresses;
17
17
  export declare const PRICE_WHITELISTED: Set<string>;
18
- export declare const REWARD_CLAIM_START = 1651748400;
18
+ export declare const REWARD_CLAIM_START = 1651759200;
19
19
  export declare const BORROW_LIMIT_BUFFER: BigNumber;
20
20
  export declare const ONE_DAY = 86400;
21
21
  export declare const ONE_WEEK: number;
@@ -20,6 +20,7 @@ export declare function fetchUnderlyingTokensPrices(provider: providers.Provider
20
20
  export declare function fetchStNEARPrice(): Promise<BigNumber>;
21
21
  export declare function fetchPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
22
22
  export declare function fetchPLYPrice(provider: providers.Provider): Promise<BigNumber>;
23
+ export declare function fetchPULPPrice(provider: providers.Provider): Promise<BigNumber>;
23
24
  export declare function fetchToken0PriceByLP(LP: Address, provider: providers.Provider): Promise<BigNumber>;
24
25
  export declare function fetchValuation(tokenAmount: TokenAmount, provider: providers.Provider): Promise<BigNumber>;
25
26
  export declare function calcValuation(tokenAmount: TokenAmount, price: BigNumber): BigNumber;
@@ -962,11 +962,15 @@ var networkAddresses = {
962
962
  name: 'auTRI',
963
963
  address: /*#__PURE__*/'0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca'.toLowerCase(),
964
964
  underlying: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase()
965
+ }, {
966
+ name: 'auPLY',
967
+ address: /*#__PURE__*/'0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c'.toLowerCase(),
968
+ underlying: /*#__PURE__*/'0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase()
965
969
  }],
966
970
  misc: {
967
971
  COMPTROLLER: /*#__PURE__*/'0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb'.toLowerCase(),
968
972
  oracle: /*#__PURE__*/'0xC6e5185438e1730959c1eF3551059A3feC744E90'.toLowerCase(),
969
- AURIFAIRLAUNCH: /*#__PURE__*/'0x6f068608573c840bB27b39458d7d87eB865e19Cc'.toLowerCase(),
973
+ AURIFAIRLAUNCH: /*#__PURE__*/'0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2'.toLowerCase(),
970
974
  AURILENS: /*#__PURE__*/'0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70'.toLowerCase(),
971
975
  TOKENLOCK: /*#__PURE__*/'0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
972
976
  ETHREPAYHELPER: /*#__PURE__*/'0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6'.toLowerCase(),
@@ -987,13 +991,13 @@ var networkAddresses = {
987
991
  var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
988
992
  return t.underlying;
989
993
  }), [networkAddresses.tokens.AURORA, networkAddresses.tokens.TRI, networkAddresses.tokens.META, networkAddresses.tokens.stNEAR]));
990
- var REWARD_CLAIM_START = 1651748400;
994
+ var REWARD_CLAIM_START = 1651759200;
991
995
  var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(1);
992
996
  var ONE_DAY = 86400;
993
997
  var ONE_WEEK = ONE_DAY * 7;
994
998
  var ONE_YEAR = ONE_DAY * 365;
995
999
  var PLYWNEAR_POOL_ID = 0;
996
- var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
1000
+ var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
997
1001
  var ALL_STAKING_POOLS = [];
998
1002
  var INF = /*#__PURE__*/ethers.BigNumber.from(2).pow(256).sub(1);
999
1003
  var AIRDROP_START_TIMESTAMP = 1649858400;
@@ -1084,9 +1088,8 @@ function assert(condition, message) {
1084
1088
  }
1085
1089
 
1086
1090
  if (!condition) {
1087
- var _message;
1088
-
1089
- throw new Error((_message = message) != null ? _message : 'Assertion failed');
1091
+ message = 'Assertion failed' + (message ? ': ' + message : '');
1092
+ throw new Error(message);
1090
1093
  }
1091
1094
  }
1092
1095
  function formatObject(object) {
@@ -2351,7 +2354,7 @@ function _fetchLPPrice() {
2351
2354
  return _fetchLPPriceBy.apply(this, arguments);
2352
2355
  };
2353
2356
 
2354
- fetchLPPriceBy = function _fetchLPPriceBy2(_x22) {
2357
+ fetchLPPriceBy = function _fetchLPPriceBy2(_x23) {
2355
2358
  return _fetchLPPriceBy.apply(this, arguments);
2356
2359
  };
2357
2360
 
@@ -2524,7 +2527,7 @@ function _fetchPrice2() {
2524
2527
  while (1) {
2525
2528
  switch (_context9.prev = _context9.next) {
2526
2529
  case 0:
2527
- assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()));
2530
+ assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
2528
2531
 
2529
2532
  if (!isSameAddress(address, networkAddresses.tokens.stNEAR)) {
2530
2533
  _context9.next = 3;
@@ -2585,16 +2588,24 @@ function _fetchPrice3() {
2585
2588
 
2586
2589
  case 4:
2587
2590
  if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
2588
- _context10.next = 6;
2591
+ _context10.next = 8;
2589
2592
  break;
2590
2593
  }
2591
2594
 
2592
2595
  return _context10.abrupt("return", fetchPLYPrice(provider));
2593
2596
 
2594
- case 6:
2597
+ case 8:
2598
+ if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
2599
+ _context10.next = 10;
2600
+ break;
2601
+ }
2602
+
2603
+ return _context10.abrupt("return", fetchPULPPrice(provider));
2604
+
2605
+ case 10:
2595
2606
  return _context10.abrupt("return", _fetchPrice(address, provider));
2596
2607
 
2597
- case 7:
2608
+ case 11:
2598
2609
  case "end":
2599
2610
  return _context10.stop();
2600
2611
  }
@@ -2626,81 +2637,103 @@ function _fetchPLYPrice() {
2626
2637
  return _fetchPLYPrice.apply(this, arguments);
2627
2638
  }
2628
2639
 
2629
- function fetchToken0PriceByLP(_x16, _x17) {
2640
+ function fetchPULPPrice(_x16) {
2641
+ return _fetchPULPPrice.apply(this, arguments);
2642
+ }
2643
+
2644
+ function _fetchPULPPrice() {
2645
+ _fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(provider) {
2646
+ return runtime_1.wrap(function _callee12$(_context12) {
2647
+ while (1) {
2648
+ switch (_context12.prev = _context12.next) {
2649
+ case 0:
2650
+ return _context12.abrupt("return", new BigNumber(0));
2651
+
2652
+ case 1:
2653
+ case "end":
2654
+ return _context12.stop();
2655
+ }
2656
+ }
2657
+ }, _callee12);
2658
+ }));
2659
+ return _fetchPULPPrice.apply(this, arguments);
2660
+ }
2661
+
2662
+ function fetchToken0PriceByLP(_x17, _x18) {
2630
2663
  return _fetchToken0PriceByLP.apply(this, arguments);
2631
2664
  }
2632
2665
 
2633
2666
  function _fetchToken0PriceByLP() {
2634
- _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(LP, provider) {
2667
+ _fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(LP, provider) {
2635
2668
  var LPInfo, token0Decimal, token1Decimal;
2636
- return runtime_1.wrap(function _callee12$(_context12) {
2669
+ return runtime_1.wrap(function _callee13$(_context13) {
2637
2670
  while (1) {
2638
- switch (_context12.prev = _context12.next) {
2671
+ switch (_context13.prev = _context13.next) {
2639
2672
  case 0:
2640
- _context12.next = 2;
2673
+ _context13.next = 2;
2641
2674
  return fetchLPPositions(LP, provider);
2642
2675
 
2643
2676
  case 2:
2644
- LPInfo = _context12.sent;
2677
+ LPInfo = _context13.sent;
2645
2678
 
2646
2679
  if (!LPInfo.reserve1.isZero()) {
2647
- _context12.next = 5;
2680
+ _context13.next = 5;
2648
2681
  break;
2649
2682
  }
2650
2683
 
2651
- return _context12.abrupt("return", new BigNumber(0));
2684
+ return _context13.abrupt("return", new BigNumber(0));
2652
2685
 
2653
2686
  case 5:
2654
2687
  token0Decimal = getDecimal(LPInfo.token0);
2655
2688
  token1Decimal = getDecimal(LPInfo.token1);
2656
- _context12.next = 9;
2689
+ _context13.next = 9;
2657
2690
  return fetchPrice(LPInfo.token1, provider);
2658
2691
 
2659
2692
  case 9:
2660
- return _context12.abrupt("return", _context12.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2693
+ return _context13.abrupt("return", _context13.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
2661
2694
 
2662
2695
  case 10:
2663
2696
  case "end":
2664
- return _context12.stop();
2697
+ return _context13.stop();
2665
2698
  }
2666
2699
  }
2667
- }, _callee12);
2700
+ }, _callee13);
2668
2701
  }));
2669
2702
  return _fetchToken0PriceByLP.apply(this, arguments);
2670
2703
  }
2671
2704
 
2672
- function fetchValuation(_x18, _x19) {
2705
+ function fetchValuation(_x19, _x20) {
2673
2706
  return _fetchValuation.apply(this, arguments);
2674
2707
  }
2675
2708
 
2676
2709
  function _fetchValuation() {
2677
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(tokenAmount, provider) {
2710
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2678
2711
  var price;
2679
- return runtime_1.wrap(function _callee13$(_context13) {
2712
+ return runtime_1.wrap(function _callee14$(_context14) {
2680
2713
  while (1) {
2681
- switch (_context13.prev = _context13.next) {
2714
+ switch (_context14.prev = _context14.next) {
2682
2715
  case 0:
2683
2716
  if (!(tokenAmount.rawAmount() == '0')) {
2684
- _context13.next = 2;
2717
+ _context14.next = 2;
2685
2718
  break;
2686
2719
  }
2687
2720
 
2688
- return _context13.abrupt("return", new BigNumber(0));
2721
+ return _context14.abrupt("return", new BigNumber(0));
2689
2722
 
2690
2723
  case 2:
2691
- _context13.next = 4;
2724
+ _context14.next = 4;
2692
2725
  return fetchPrice(tokenAmount.token.address, provider);
2693
2726
 
2694
2727
  case 4:
2695
- price = _context13.sent;
2696
- return _context13.abrupt("return", calcValuation(tokenAmount, price));
2728
+ price = _context14.sent;
2729
+ return _context14.abrupt("return", calcValuation(tokenAmount, price));
2697
2730
 
2698
2731
  case 6:
2699
2732
  case "end":
2700
- return _context13.stop();
2733
+ return _context14.stop();
2701
2734
  }
2702
2735
  }
2703
- }, _callee13);
2736
+ }, _callee14);
2704
2737
  }));
2705
2738
  return _fetchValuation.apply(this, arguments);
2706
2739
  }
@@ -2708,23 +2741,23 @@ function _fetchValuation() {
2708
2741
  function calcValuation(tokenAmount, price) {
2709
2742
  return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price);
2710
2743
  }
2711
- function valuateToken(_x20, _x21) {
2744
+ function valuateToken(_x21, _x22) {
2712
2745
  return _valuateToken.apply(this, arguments);
2713
2746
  }
2714
2747
 
2715
2748
  function _valuateToken() {
2716
- _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
2749
+ _valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(tokenAmount, provider) {
2717
2750
  var tokenValuation;
2718
- return runtime_1.wrap(function _callee14$(_context14) {
2751
+ return runtime_1.wrap(function _callee15$(_context15) {
2719
2752
  while (1) {
2720
- switch (_context14.prev = _context14.next) {
2753
+ switch (_context15.prev = _context15.next) {
2721
2754
  case 0:
2722
- _context14.next = 2;
2755
+ _context15.next = 2;
2723
2756
  return fetchValuation(tokenAmount, provider);
2724
2757
 
2725
2758
  case 2:
2726
- tokenValuation = _context14.sent;
2727
- return _context14.abrupt("return", {
2759
+ tokenValuation = _context15.sent;
2760
+ return _context15.abrupt("return", {
2728
2761
  tokenAmount: tokenAmount,
2729
2762
  currencyAmount: {
2730
2763
  currency: 'USD',
@@ -2734,10 +2767,10 @@ function _valuateToken() {
2734
2767
 
2735
2768
  case 4:
2736
2769
  case "end":
2737
- return _context14.stop();
2770
+ return _context15.stop();
2738
2771
  }
2739
2772
  }
2740
- }, _callee14);
2773
+ }, _callee15);
2741
2774
  }));
2742
2775
  return _valuateToken.apply(this, arguments);
2743
2776
  }
@@ -107683,6 +107716,7 @@ exports.dummyZeroTokenAmount = dummyZeroTokenAmount;
107683
107716
  exports.fetchLPPositions = fetchLPPositions;
107684
107717
  exports.fetchLPPrice = fetchLPPrice;
107685
107718
  exports.fetchPLYPrice = fetchPLYPrice;
107719
+ exports.fetchPULPPrice = fetchPULPPrice;
107686
107720
  exports.fetchPrice = fetchPrice;
107687
107721
  exports.fetchPriceFromCoingecko = fetchPriceFromCoingecko;
107688
107722
  exports.fetchPriceFromCoingeckoAPI = fetchPriceFromCoingeckoAPI;