@aurigami/sdk 1.6.2 → 1.6.4

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.
@@ -33,3 +33,6 @@ export declare const DEPOSIT_NEAR_REWARDS_PER_WEEK: {
33
33
  export declare const BORROW_NEAR_REWARDS_PER_WEEK: {
34
34
  [k: string]: string;
35
35
  };
36
+ export declare const HARDCODE_PRICE_TOKENS: {
37
+ [k: string]: string;
38
+ };
@@ -70,6 +70,10 @@ var networkAddresses = {
70
70
  name: 'auPLY',
71
71
  address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(),
72
72
  underlying: /*#__PURE__*/'0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase()
73
+ }, {
74
+ name: 'auUSN',
75
+ address: /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USN.toLowerCase(),
76
+ underlying: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase()
73
77
  }],
74
78
  misc: {
75
79
  COMPTROLLER: /*#__PURE__*/MAINNET_ADDRESSES.comptroller.toLowerCase(),
@@ -90,9 +94,10 @@ var networkAddresses = {
90
94
  USDC: /*#__PURE__*/'0xb12bfca5a55806aaf64e99521918a4bf0fc40802'.toLowerCase(),
91
95
  WNEAR: /*#__PURE__*/'0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d'.toLowerCase(),
92
96
  TRI: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
93
- META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLocaleLowerCase(),
97
+ META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLowerCase(),
94
98
  PULP: /*#__PURE__*/MAINNET_ADDRESSES.PULP.toLowerCase(),
95
- PLYWNEAR: /*#__PURE__*/MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase()
99
+ PLYWNEAR: /*#__PURE__*/MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase(),
100
+ USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase()
96
101
  }
97
102
  }; // All token that we can calculate the price via oracle + coingecko
98
103
 
@@ -129,6 +134,7 @@ Object.entries({
129
134
  }));
130
135
  var BORROW_NEAR_REWARDS_PER_WEEK = {// currently 0 for all markets
131
136
  };
137
+ var HARDCODE_PRICE_TOKENS = /*#__PURE__*/Object.fromEntries([[/*#__PURE__*/networkAddresses.tokens.USN.toLowerCase(), '1']]);
132
138
 
133
139
  var decimalRecords = {
134
140
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -152,7 +158,8 @@ var decimalRecords = {
152
158
  '0xf4eb217ba2454613b15dbdea6e5f22276410e89e': 8,
153
159
  '0xc21ff01229e982d7c8b8691163b0a3cb8f357453': 24,
154
160
  '0x04ac48711bcdc45b4d223fb021e09da73c71095e': 18,
155
- '0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18
161
+ '0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18,
162
+ '0x5183e1b1091804bc2602586919e6880ac1cf2896': 18
156
163
  };
157
164
 
158
165
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -1131,9 +1138,13 @@ function getDecimal(address) {
1131
1138
  return decimalRecords[addressLowercase];
1132
1139
  }
1133
1140
  function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
1141
+ if (rewardsValue.isZero()) {
1142
+ return new BigNumber(0);
1143
+ }
1144
+
1134
1145
  if (totalStakeValue.lte(0)) {
1135
1146
  // avoid division by zero when there is no stake
1136
- return new BigNumber('999999999');
1147
+ return rewardsValue;
1137
1148
  }
1138
1149
 
1139
1150
  return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
@@ -2626,33 +2637,41 @@ function _fetchPrice3() {
2626
2637
  while (1) {
2627
2638
  switch (_context10.prev = _context10.next) {
2628
2639
  case 0:
2629
- if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
2640
+ if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
2630
2641
  _context10.next = 4;
2631
2642
  break;
2632
2643
  }
2633
2644
 
2634
- return _context10.abrupt("return", fetchLPPrice(address, provider));
2645
+ return _context10.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
2635
2646
 
2636
2647
  case 4:
2637
- if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
2648
+ if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
2638
2649
  _context10.next = 8;
2639
2650
  break;
2640
2651
  }
2641
2652
 
2642
- return _context10.abrupt("return", fetchPLYPrice(provider));
2653
+ return _context10.abrupt("return", fetchLPPrice(address, provider));
2643
2654
 
2644
2655
  case 8:
2656
+ if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
2657
+ _context10.next = 12;
2658
+ break;
2659
+ }
2660
+
2661
+ return _context10.abrupt("return", fetchPLYPrice(provider));
2662
+
2663
+ case 12:
2645
2664
  if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
2646
- _context10.next = 10;
2665
+ _context10.next = 14;
2647
2666
  break;
2648
2667
  }
2649
2668
 
2650
2669
  return _context10.abrupt("return", fetchPULPPrice(provider));
2651
2670
 
2652
- case 10:
2671
+ case 14:
2653
2672
  return _context10.abrupt("return", _fetchPrice(address, provider));
2654
2673
 
2655
- case 11:
2674
+ case 15:
2656
2675
  case "end":
2657
2676
  return _context10.stop();
2658
2677
  }
@@ -108361,6 +108380,7 @@ exports.BlockchainEntityReadWrite = BlockchainEntityReadWrite;
108361
108380
  exports.DECIMAL_PRECISION = DECIMAL_PRECISION;
108362
108381
  exports.DEPOSIT_NEAR_REWARDS_PER_WEEK = DEPOSIT_NEAR_REWARDS_PER_WEEK;
108363
108382
  exports.ETHAddress = ETHAddress;
108383
+ exports.HARDCODE_PRICE_TOKENS = HARDCODE_PRICE_TOKENS;
108364
108384
  exports.INF = INF;
108365
108385
  exports.MoneyMarket = MoneyMarket;
108366
108386
  exports.MoneyMarketRead = MoneyMarketRead;