@aurigami/sdk 1.12.9 → 1.13.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.
@@ -27,6 +27,7 @@ var MAINNET_ADDRESSES = _interopDefault(require('@aurigami/contracts/deployments
27
27
  var aurora_testnet_json = _interopDefault(require('@aurigami/contracts/deployments/aurora_testnet.json'));
28
28
  var axios = _interopDefault(require('axios'));
29
29
  var abstractSigner = require('@ethersproject/abstract-signer');
30
+ var tslib = require('tslib');
30
31
 
31
32
 
32
33
 
@@ -196,6 +197,7 @@ var REFERRAL_CAMPAIGNS = /*#__PURE__*/Object.fromEntries([['referral-2505', {
196
197
  start: 1654696800,
197
198
  end: 1655301599
198
199
  }]]);
200
+ var CACHE_TIMEOUT = 10 * 1000; // 10 seconds
199
201
 
200
202
  var decimalRecords = {
201
203
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
@@ -1284,6 +1286,9 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
1284
1286
 
1285
1287
  return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
1286
1288
  }
1289
+ function calcNetApy(suppliedValue, supplyApy, borrowedValue, borrowApy) {
1290
+ return suppliedValue.multipliedBy(supplyApy).minus(borrowedValue.multipliedBy(borrowApy));
1291
+ }
1287
1292
  function getBlockTimestamp(_x2, _x3) {
1288
1293
  return _getBlockTimestamp.apply(this, arguments);
1289
1294
  }
@@ -1535,6 +1540,36 @@ function sortEvents(events) {
1535
1540
  return a.blockNumber - b.blockNumber;
1536
1541
  });
1537
1542
  }
1543
+ function Cache(cacheTimeout) {
1544
+ return function (target, propertyKey, descriptor) {
1545
+ var originalMethod = descriptor.value;
1546
+ var cache = new Map();
1547
+
1548
+ descriptor.value = function () {
1549
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1550
+ args[_key2] = arguments[_key2];
1551
+ }
1552
+
1553
+ var key = JSON.stringify(args);
1554
+
1555
+ if (cache.has(key)) {
1556
+ var _cache$get = cache.get(key),
1557
+ timestamp = _cache$get[0],
1558
+ value = _cache$get[1];
1559
+
1560
+ if (Date.now() - timestamp < cacheTimeout) {
1561
+ return value;
1562
+ }
1563
+ }
1564
+
1565
+ var result = originalMethod.apply(this, args);
1566
+ cache.set(key, [Date.now(), result]);
1567
+ return result;
1568
+ };
1569
+
1570
+ return descriptor;
1571
+ };
1572
+ }
1538
1573
 
1539
1574
  var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
1540
1575
  this._networkConnection = networkConnection;
@@ -2045,31 +2080,31 @@ function fetchLPPositions(_x5, _x6) {
2045
2080
 
2046
2081
  function _fetchLPPositions() {
2047
2082
  _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(LPAddress, provider) {
2048
- var LPContract, promises, values;
2083
+ var LPContract, _yield$Promise$all, token0, token1, reserves, totalSupply;
2084
+
2049
2085
  return runtime_1.wrap(function _callee5$(_context5) {
2050
2086
  while (1) {
2051
2087
  switch (_context5.prev = _context5.next) {
2052
2088
  case 0:
2053
2089
  LPContract = new ethers.Contract(LPAddress, IUniswapV2PairABI.abi, provider);
2054
- promises = [];
2055
- promises.push(LPContract.token0());
2056
- promises.push(LPContract.token1());
2057
- promises.push(LPContract.getReserves());
2058
- promises.push(LPContract.totalSupply());
2059
- _context5.next = 8;
2060
- return Promise.all(promises);
2090
+ _context5.next = 3;
2091
+ return Promise.all([LPContract.token0(), LPContract.token1(), LPContract.getReserves(), LPContract.totalSupply()]);
2061
2092
 
2062
- case 8:
2063
- values = _context5.sent;
2093
+ case 3:
2094
+ _yield$Promise$all = _context5.sent;
2095
+ token0 = _yield$Promise$all[0];
2096
+ token1 = _yield$Promise$all[1];
2097
+ reserves = _yield$Promise$all[2];
2098
+ totalSupply = _yield$Promise$all[3];
2064
2099
  return _context5.abrupt("return", {
2065
- token0: values[0],
2066
- token1: values[1],
2067
- reserve0: values[2].reserve0,
2068
- reserve1: values[2].reserve1,
2069
- totalSupply: values[3]
2100
+ token0: token0,
2101
+ token1: token1,
2102
+ reserve0: reserves.reserve0,
2103
+ reserve1: reserves.reserve1,
2104
+ totalSupply: totalSupply
2070
2105
  });
2071
2106
 
2072
- case 10:
2107
+ case 9:
2073
2108
  case "end":
2074
2109
  return _context5.stop();
2075
2110
  }
@@ -2192,7 +2227,7 @@ function fetchStNEARPrice() {
2192
2227
 
2193
2228
  function _fetchStNEARPrice() {
2194
2229
  _fetchStNEARPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
2195
- var ratioPromise, nearPricePromise, _yield$Promise$all, ratioRes, nearPrice, ratio;
2230
+ var ratioPromise, nearPricePromise, _yield$Promise$all2, ratioRes, nearPrice, ratio;
2196
2231
 
2197
2232
  return runtime_1.wrap(function _callee8$(_context8) {
2198
2233
  while (1) {
@@ -2206,9 +2241,9 @@ function _fetchStNEARPrice() {
2206
2241
  return Promise.all([ratioPromise, nearPricePromise]);
2207
2242
 
2208
2243
  case 4:
2209
- _yield$Promise$all = _context8.sent;
2210
- ratioRes = _yield$Promise$all[0];
2211
- nearPrice = _yield$Promise$all[1];
2244
+ _yield$Promise$all2 = _context8.sent;
2245
+ ratioRes = _yield$Promise$all2[0];
2246
+ nearPrice = _yield$Promise$all2[1];
2212
2247
  ratio = new BigNumber(ratioRes.st_near_price);
2213
2248
  return _context8.abrupt("return", ratio.multipliedBy(nearPrice));
2214
2249
 
@@ -3061,12 +3096,14 @@ var helpers = {
3061
3096
  getSymbol: getSymbol,
3062
3097
  getUnderlying: getUnderlying,
3063
3098
  calcLMRewardApr: calcLMRewardApr,
3099
+ calcNetApy: calcNetApy,
3064
3100
  getBlockTimestamp: getBlockTimestamp,
3065
3101
  getBlocksTimestampViaRPC: getBlocksTimestampViaRPC,
3066
3102
  getBlocksTimestamp: getBlocksTimestamp,
3067
3103
  getBlockBeforeTimestamp: getBlockBeforeTimestamp,
3068
3104
  devLog: devLog,
3069
3105
  sortEvents: sortEvents,
3106
+ Cache: Cache,
3070
3107
  fetchPriceFromDefiLlamaAPI: fetchPriceFromDefiLlamaAPI,
3071
3108
  fetchPriceFromCoingeckoAPI: fetchPriceFromCoingeckoAPI,
3072
3109
  fetchPriceFromDefiLlama: fetchPriceFromDefiLlama,
@@ -3277,26 +3314,72 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3277
3314
 
3278
3315
  var _proto = MoneyMarketRead.prototype;
3279
3316
 
3280
- _proto.getRewardSpeeds = /*#__PURE__*/function () {
3281
- var _getRewardSpeeds = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3282
- var speeds;
3317
+ _proto.getUnderlyingPrice = /*#__PURE__*/function () {
3318
+ var _getUnderlyingPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3283
3319
  return runtime_1.wrap(function _callee$(_context) {
3284
3320
  while (1) {
3285
3321
  switch (_context.prev = _context.next) {
3286
3322
  case 0:
3287
- _context.next = 2;
3323
+ return _context.abrupt("return", fetchPrice(this.underlying.address, this._networkConnection.provider));
3324
+
3325
+ case 1:
3326
+ case "end":
3327
+ return _context.stop();
3328
+ }
3329
+ }
3330
+ }, _callee, this);
3331
+ }));
3332
+
3333
+ function getUnderlyingPrice() {
3334
+ return _getUnderlyingPrice.apply(this, arguments);
3335
+ }
3336
+
3337
+ return getUnderlyingPrice;
3338
+ }();
3339
+
3340
+ _proto.getPlyPrice = /*#__PURE__*/function () {
3341
+ var _getPlyPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
3342
+ return runtime_1.wrap(function _callee2$(_context2) {
3343
+ while (1) {
3344
+ switch (_context2.prev = _context2.next) {
3345
+ case 0:
3346
+ return _context2.abrupt("return", fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider));
3347
+
3348
+ case 1:
3349
+ case "end":
3350
+ return _context2.stop();
3351
+ }
3352
+ }
3353
+ }, _callee2, this);
3354
+ }));
3355
+
3356
+ function getPlyPrice() {
3357
+ return _getPlyPrice.apply(this, arguments);
3358
+ }
3359
+
3360
+ return getPlyPrice;
3361
+ }();
3362
+
3363
+ _proto.getRewardSpeeds = /*#__PURE__*/function () {
3364
+ var _getRewardSpeeds = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
3365
+ var speeds;
3366
+ return runtime_1.wrap(function _callee3$(_context3) {
3367
+ while (1) {
3368
+ switch (_context3.prev = _context3.next) {
3369
+ case 0:
3370
+ _context3.next = 2;
3288
3371
  return this.env.auriLens.getRewardSpeeds(this.env.comptroller.address, this.auToken.address);
3289
3372
 
3290
3373
  case 2:
3291
- speeds = _context.sent;
3292
- return _context.abrupt("return", speeds);
3374
+ speeds = _context3.sent;
3375
+ return _context3.abrupt("return", speeds);
3293
3376
 
3294
3377
  case 4:
3295
3378
  case "end":
3296
- return _context.stop();
3379
+ return _context3.stop();
3297
3380
  }
3298
3381
  }
3299
- }, _callee, this);
3382
+ }, _callee3, this);
3300
3383
  }));
3301
3384
 
3302
3385
  function getRewardSpeeds() {
@@ -3307,26 +3390,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3307
3390
  }();
3308
3391
 
3309
3392
  _proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
3310
- var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
3311
- return runtime_1.wrap(function _callee2$(_context2) {
3393
+ var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
3394
+ return runtime_1.wrap(function _callee4$(_context4) {
3312
3395
  while (1) {
3313
- switch (_context2.prev = _context2.next) {
3396
+ switch (_context4.prev = _context4.next) {
3314
3397
  case 0:
3315
- _context2.t0 = TokenAmount;
3316
- _context2.t1 = this.underlying;
3317
- _context2.next = 4;
3398
+ _context4.t0 = TokenAmount;
3399
+ _context4.t1 = this.underlying;
3400
+ _context4.next = 4;
3318
3401
  return this.auToken.totalBorrows();
3319
3402
 
3320
3403
  case 4:
3321
- _context2.t2 = _context2.sent.toString();
3322
- return _context2.abrupt("return", new _context2.t0(_context2.t1, _context2.t2));
3404
+ _context4.t2 = _context4.sent.toString();
3405
+ return _context4.abrupt("return", new _context4.t0(_context4.t1, _context4.t2));
3323
3406
 
3324
3407
  case 6:
3325
3408
  case "end":
3326
- return _context2.stop();
3409
+ return _context4.stop();
3327
3410
  }
3328
3411
  }
3329
- }, _callee2, this);
3412
+ }, _callee4, this);
3330
3413
  }));
3331
3414
 
3332
3415
  function getTotalTokenBorrowed() {
@@ -3337,33 +3420,28 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3337
3420
  }();
3338
3421
 
3339
3422
  _proto.getTotalTokenDeposited = /*#__PURE__*/function () {
3340
- var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
3341
- var _this2 = this;
3423
+ var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
3424
+ var _yield$Promise$all, totalBorrow, totalCash;
3342
3425
 
3343
- var promises, totalBorrow, totalCash;
3344
- return runtime_1.wrap(function _callee3$(_context3) {
3426
+ return runtime_1.wrap(function _callee5$(_context5) {
3345
3427
  while (1) {
3346
- switch (_context3.prev = _context3.next) {
3428
+ switch (_context5.prev = _context5.next) {
3347
3429
  case 0:
3348
- promises = [];
3349
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
3350
- totalBorrow = res;
3351
- }));
3352
- promises.push(this.auToken.getCash().then(function (res) {
3353
- totalCash = new TokenAmount(_this2.underlying, res.toString());
3354
- }));
3355
- _context3.next = 5;
3356
- return Promise.all(promises);
3430
+ _context5.next = 2;
3431
+ return Promise.all([this.getTotalTokenBorrowed(), this.auToken.getCash()]);
3357
3432
 
3358
- case 5:
3359
- return _context3.abrupt("return", new TokenAmount(this.underlying, ethers.BigNumber.from(totalCash.rawAmount()).add(totalBorrow.rawAmount()).toString()));
3433
+ case 2:
3434
+ _yield$Promise$all = _context5.sent;
3435
+ totalBorrow = _yield$Promise$all[0];
3436
+ totalCash = _yield$Promise$all[1];
3437
+ return _context5.abrupt("return", new TokenAmount(this.underlying, ethers.BigNumber.from(new TokenAmount(this.underlying, totalCash.toString()).rawAmount()).add(totalBorrow.rawAmount()).toString()));
3360
3438
 
3361
3439
  case 6:
3362
3440
  case "end":
3363
- return _context3.stop();
3441
+ return _context5.stop();
3364
3442
  }
3365
3443
  }
3366
- }, _callee3, this);
3444
+ }, _callee5, this);
3367
3445
  }));
3368
3446
 
3369
3447
  function getTotalTokenDeposited() {
@@ -3374,26 +3452,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3374
3452
  }();
3375
3453
 
3376
3454
  _proto.getDepositAPY = /*#__PURE__*/function () {
3377
- var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
3455
+ var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
3378
3456
  var supplyRatePerTimestamp, supplyRatePerDay;
3379
- return runtime_1.wrap(function _callee4$(_context4) {
3457
+ return runtime_1.wrap(function _callee6$(_context6) {
3380
3458
  while (1) {
3381
- switch (_context4.prev = _context4.next) {
3459
+ switch (_context6.prev = _context6.next) {
3382
3460
  case 0:
3383
- _context4.next = 2;
3461
+ _context6.next = 2;
3384
3462
  return this.auToken.supplyRatePerTimestamp();
3385
3463
 
3386
3464
  case 2:
3387
- supplyRatePerTimestamp = _context4.sent;
3465
+ supplyRatePerTimestamp = _context6.sent;
3388
3466
  supplyRatePerDay = new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(ONE_DAY).div(decimalFactor(18));
3389
- return _context4.abrupt("return", new BigNumber(supplyRatePerDay.plus(1)).pow(365).minus(1));
3467
+ return _context6.abrupt("return", new BigNumber(supplyRatePerDay.plus(1)).pow(365).minus(1));
3390
3468
 
3391
3469
  case 5:
3392
3470
  case "end":
3393
- return _context4.stop();
3471
+ return _context6.stop();
3394
3472
  }
3395
3473
  }
3396
- }, _callee4, this);
3474
+ }, _callee6, this);
3397
3475
  }));
3398
3476
 
3399
3477
  function getDepositAPY() {
@@ -3404,26 +3482,26 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3404
3482
  }();
3405
3483
 
3406
3484
  _proto.getBorrowAPY = /*#__PURE__*/function () {
3407
- var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
3485
+ var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
3408
3486
  var borrowRatePerTimestamp, borrowRatePerDay;
3409
- return runtime_1.wrap(function _callee5$(_context5) {
3487
+ return runtime_1.wrap(function _callee7$(_context7) {
3410
3488
  while (1) {
3411
- switch (_context5.prev = _context5.next) {
3489
+ switch (_context7.prev = _context7.next) {
3412
3490
  case 0:
3413
- _context5.next = 2;
3491
+ _context7.next = 2;
3414
3492
  return this.auToken.borrowRatePerTimestamp();
3415
3493
 
3416
3494
  case 2:
3417
- borrowRatePerTimestamp = _context5.sent;
3495
+ borrowRatePerTimestamp = _context7.sent;
3418
3496
  borrowRatePerDay = new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(ONE_DAY).div(decimalFactor(18));
3419
- return _context5.abrupt("return", new BigNumber(borrowRatePerDay.plus(1)).pow(365).minus(1));
3497
+ return _context7.abrupt("return", new BigNumber(borrowRatePerDay.plus(1)).pow(365).minus(1));
3420
3498
 
3421
3499
  case 5:
3422
3500
  case "end":
3423
- return _context5.stop();
3501
+ return _context7.stop();
3424
3502
  }
3425
3503
  }
3426
- }, _callee5, this);
3504
+ }, _callee7, this);
3427
3505
  }));
3428
3506
 
3429
3507
  function getBorrowAPY() {
@@ -3434,21 +3512,21 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3434
3512
  }();
3435
3513
 
3436
3514
  _proto.getCollateralRatio = /*#__PURE__*/function () {
3437
- var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
3438
- return runtime_1.wrap(function _callee6$(_context6) {
3515
+ var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
3516
+ return runtime_1.wrap(function _callee8$(_context8) {
3439
3517
  while (1) {
3440
- switch (_context6.prev = _context6.next) {
3518
+ switch (_context8.prev = _context8.next) {
3441
3519
  case 0:
3442
- return _context6.abrupt("return", this.env.comptroller.markets(this.auToken.address).then(function (res) {
3520
+ return _context8.abrupt("return", this.env.comptroller.markets(this.auToken.address).then(function (res) {
3443
3521
  return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
3444
3522
  }));
3445
3523
 
3446
3524
  case 1:
3447
3525
  case "end":
3448
- return _context6.stop();
3526
+ return _context8.stop();
3449
3527
  }
3450
3528
  }
3451
- }, _callee6, this);
3529
+ }, _callee8, this);
3452
3530
  }));
3453
3531
 
3454
3532
  function getCollateralRatio() {
@@ -3459,37 +3537,30 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3459
3537
  }();
3460
3538
 
3461
3539
  _proto.getBorrowPlyAPY = /*#__PURE__*/function () {
3462
- var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
3463
- var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
3464
- return runtime_1.wrap(function _callee7$(_context7) {
3540
+ var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
3541
+ var _yield$Promise$all2, totalBorrowed, rewardSpeeds, plyPrice, underlyingPrice;
3542
+
3543
+ return runtime_1.wrap(function _callee9$(_context9) {
3465
3544
  while (1) {
3466
- switch (_context7.prev = _context7.next) {
3545
+ switch (_context9.prev = _context9.next) {
3467
3546
  case 0:
3468
- promises = [];
3469
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
3470
- totalBorrowed = res;
3471
- }));
3472
- promises.push(this.env.comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address, false).then(function (res) {
3473
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
3474
- }));
3475
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
3476
- plyPrice = res;
3477
- }));
3478
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
3479
- underlyingPrice = res;
3480
- }));
3481
- _context7.next = 7;
3482
- return Promise.all(promises);
3547
+ _context9.next = 2;
3548
+ return Promise.all([this.getTotalTokenBorrowed(), this.getRewardSpeeds(), this.getPlyPrice(), this.getUnderlyingPrice()]);
3483
3549
 
3484
- case 7:
3485
- return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
3550
+ case 2:
3551
+ _yield$Promise$all2 = _context9.sent;
3552
+ totalBorrowed = _yield$Promise$all2[0];
3553
+ rewardSpeeds = _yield$Promise$all2[1];
3554
+ plyPrice = _yield$Promise$all2[2];
3555
+ underlyingPrice = _yield$Promise$all2[3];
3556
+ return _context9.abrupt("return", calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
3486
3557
 
3487
3558
  case 8:
3488
3559
  case "end":
3489
- return _context7.stop();
3560
+ return _context9.stop();
3490
3561
  }
3491
3562
  }
3492
- }, _callee7, this);
3563
+ }, _callee9, this);
3493
3564
  }));
3494
3565
 
3495
3566
  function getBorrowPlyAPY() {
@@ -3500,37 +3571,30 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3500
3571
  }();
3501
3572
 
3502
3573
  _proto.getDepositPlyAPY = /*#__PURE__*/function () {
3503
- var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
3504
- var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
3505
- return runtime_1.wrap(function _callee8$(_context8) {
3574
+ var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10() {
3575
+ var _yield$Promise$all3, totalDeposited, rewardSpeeds, plyPrice, underlyingPrice;
3576
+
3577
+ return runtime_1.wrap(function _callee10$(_context10) {
3506
3578
  while (1) {
3507
- switch (_context8.prev = _context8.next) {
3579
+ switch (_context10.prev = _context10.next) {
3508
3580
  case 0:
3509
- promises = [];
3510
- promises.push(this.getTotalTokenDeposited().then(function (res) {
3511
- totalDeposited = res;
3512
- }));
3513
- promises.push(this.env.comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address, true).then(function (res) {
3514
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
3515
- }));
3516
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
3517
- plyPrice = res;
3518
- }));
3519
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
3520
- underlyingPrice = res;
3521
- }));
3522
- _context8.next = 7;
3523
- return Promise.all(promises);
3581
+ _context10.next = 2;
3582
+ return Promise.all([this.getTotalTokenDeposited(), this.getRewardSpeeds(), this.getPlyPrice(), this.getUnderlyingPrice()]);
3524
3583
 
3525
- case 7:
3526
- return _context8.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
3584
+ case 2:
3585
+ _yield$Promise$all3 = _context10.sent;
3586
+ totalDeposited = _yield$Promise$all3[0];
3587
+ rewardSpeeds = _yield$Promise$all3[1];
3588
+ plyPrice = _yield$Promise$all3[2];
3589
+ underlyingPrice = _yield$Promise$all3[3];
3590
+ return _context10.abrupt("return", calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
3527
3591
 
3528
3592
  case 8:
3529
3593
  case "end":
3530
- return _context8.stop();
3594
+ return _context10.stop();
3531
3595
  }
3532
3596
  }
3533
- }, _callee8, this);
3597
+ }, _callee10, this);
3534
3598
  }));
3535
3599
 
3536
3600
  function getDepositPlyAPY() {
@@ -3540,103 +3604,190 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3540
3604
  return getDepositPlyAPY;
3541
3605
  }();
3542
3606
 
3543
- _proto.getDetails = /*#__PURE__*/function () {
3544
- var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
3545
- var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, plyPrice, underlyingPrice, rewardSpeeds, borrowPlyApy, depositPlyApy, depositNEARApy, borrowNEARApy, depositMETAApy;
3546
- return runtime_1.wrap(function _callee9$(_context9) {
3607
+ _proto.getDepositNearAPY = /*#__PURE__*/function () {
3608
+ var _getDepositNearAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
3609
+ var _yield$Promise$all4, totalDeposited, underlyingPrice, depositNEARApy;
3610
+
3611
+ return runtime_1.wrap(function _callee11$(_context11) {
3547
3612
  while (1) {
3548
- switch (_context9.prev = _context9.next) {
3613
+ switch (_context11.prev = _context11.next) {
3549
3614
  case 0:
3550
- promises = [];
3551
- promises.push(this.getTotalTokenDeposited().then(function (res) {
3552
- totalDeposited = res;
3553
- }));
3554
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
3555
- totalBorrowed = res;
3556
- }));
3557
- promises.push(this.getDepositAPY().then(function (res) {
3558
- depositAPY = res.toNumber();
3559
- }));
3560
- promises.push(this.getBorrowAPY().then(function (res) {
3561
- borrowAPY = res.toNumber();
3562
- }));
3563
- promises.push(this.getCollateralRatio().then(function (res) {
3564
- collateralRatio = res.toNumber();
3565
- }));
3566
- promises.push(this.getRewardSpeeds().then(function (res) {
3567
- rewardSpeeds = res;
3568
- }));
3569
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
3570
- plyPrice = res;
3571
- }));
3572
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
3573
- underlyingPrice = res;
3574
- }));
3575
- _context9.next = 11;
3576
- return Promise.all(promises);
3615
+ _context11.next = 2;
3616
+ return Promise.all([this.getTotalTokenDeposited(), this.getUnderlyingPrice()]);
3577
3617
 
3578
- case 11:
3579
- borrowPlyApy = calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
3580
- depositPlyApy = calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
3581
- _context9.t0 = helpers;
3582
- _context9.next = 16;
3618
+ case 2:
3619
+ _yield$Promise$all4 = _context11.sent;
3620
+ totalDeposited = _yield$Promise$all4[0];
3621
+ underlyingPrice = _yield$Promise$all4[1];
3622
+ _context11.t0 = helpers;
3623
+ _context11.next = 8;
3583
3624
  return fetchValuation(this.getDepositNEARRewardPerWeek(), this._networkConnection.provider);
3584
3625
 
3585
- case 16:
3586
- _context9.t1 = _context9.sent;
3587
- _context9.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
3588
- depositNEARApy = _context9.t0.calcLMRewardApr.call(_context9.t0, _context9.t1, _context9.t2, 52);
3589
- _context9.t3 = helpers;
3590
- _context9.next = 22;
3626
+ case 8:
3627
+ _context11.t1 = _context11.sent;
3628
+ _context11.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
3629
+ depositNEARApy = _context11.t0.calcLMRewardApr.call(_context11.t0, _context11.t1, _context11.t2, 52);
3630
+ return _context11.abrupt("return", depositNEARApy);
3631
+
3632
+ case 12:
3633
+ case "end":
3634
+ return _context11.stop();
3635
+ }
3636
+ }
3637
+ }, _callee11, this);
3638
+ }));
3639
+
3640
+ function getDepositNearAPY() {
3641
+ return _getDepositNearAPY.apply(this, arguments);
3642
+ }
3643
+
3644
+ return getDepositNearAPY;
3645
+ }();
3646
+
3647
+ _proto.getBorrowNearAPY = /*#__PURE__*/function () {
3648
+ var _getBorrowNearAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12() {
3649
+ var _yield$Promise$all5, totalBorrowed, underlyingPrice, borrowNEARApy;
3650
+
3651
+ return runtime_1.wrap(function _callee12$(_context12) {
3652
+ while (1) {
3653
+ switch (_context12.prev = _context12.next) {
3654
+ case 0:
3655
+ _context12.next = 2;
3656
+ return Promise.all([this.getTotalTokenBorrowed(), this.getUnderlyingPrice()]);
3657
+
3658
+ case 2:
3659
+ _yield$Promise$all5 = _context12.sent;
3660
+ totalBorrowed = _yield$Promise$all5[0];
3661
+ underlyingPrice = _yield$Promise$all5[1];
3662
+ _context12.t0 = helpers;
3663
+ _context12.next = 8;
3591
3664
  return fetchValuation(this.getBorrowNEARRewardPerWeek(), this._networkConnection.provider);
3592
3665
 
3593
- case 22:
3594
- _context9.t4 = _context9.sent;
3595
- _context9.t5 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
3596
- borrowNEARApy = _context9.t3.calcLMRewardApr.call(_context9.t3, _context9.t4, _context9.t5, 52);
3666
+ case 8:
3667
+ _context12.t1 = _context12.sent;
3668
+ _context12.t2 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
3669
+ borrowNEARApy = _context12.t0.calcLMRewardApr.call(_context12.t0, _context12.t1, _context12.t2, 52);
3670
+ return _context12.abrupt("return", borrowNEARApy);
3671
+
3672
+ case 12:
3673
+ case "end":
3674
+ return _context12.stop();
3675
+ }
3676
+ }
3677
+ }, _callee12, this);
3678
+ }));
3679
+
3680
+ function getBorrowNearAPY() {
3681
+ return _getBorrowNearAPY.apply(this, arguments);
3682
+ }
3683
+
3684
+ return getBorrowNearAPY;
3685
+ }();
3686
+
3687
+ _proto.getDepositMetaAPY = /*#__PURE__*/function () {
3688
+ var _getDepositMetaAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
3689
+ var _yield$Promise$all6, totalDeposited, underlyingPrice, depositMETAApy;
3690
+
3691
+ return runtime_1.wrap(function _callee13$(_context13) {
3692
+ while (1) {
3693
+ switch (_context13.prev = _context13.next) {
3694
+ case 0:
3695
+ _context13.next = 2;
3696
+ return Promise.all([this.getTotalTokenDeposited(), fetchPrice(this.underlying.address, this._networkConnection.provider)]);
3697
+
3698
+ case 2:
3699
+ _yield$Promise$all6 = _context13.sent;
3700
+ totalDeposited = _yield$Promise$all6[0];
3701
+ underlyingPrice = _yield$Promise$all6[1];
3597
3702
 
3598
3703
  if (!isSameAddress(this.underlying.address, networkAddresses.tokens.stNEAR)) {
3599
- _context9.next = 34;
3704
+ _context13.next = 14;
3600
3705
  break;
3601
3706
  }
3602
3707
 
3603
- _context9.t6 = helpers;
3604
- _context9.next = 29;
3708
+ _context13.t0 = helpers;
3709
+ _context13.next = 9;
3605
3710
  return fetchValuation(TokenAmount.fromAddressAndAmount(networkAddresses.tokens.META, '1250000', false), this._networkConnection.provider);
3606
3711
 
3607
- case 29:
3608
- _context9.t7 = _context9.sent;
3609
- _context9.t8 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
3610
- depositMETAApy = _context9.t6.calcLMRewardApr.call(_context9.t6, _context9.t7, _context9.t8, 12);
3611
- _context9.next = 35;
3712
+ case 9:
3713
+ _context13.t1 = _context13.sent;
3714
+ _context13.t2 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
3715
+ depositMETAApy = _context13.t0.calcLMRewardApr.call(_context13.t0, _context13.t1, _context13.t2, 12);
3716
+ _context13.next = 15;
3612
3717
  break;
3613
3718
 
3614
- case 34:
3719
+ case 14:
3615
3720
  depositMETAApy = new BigNumber(0);
3616
3721
 
3617
- case 35:
3618
- return _context9.abrupt("return", {
3722
+ case 15:
3723
+ return _context13.abrupt("return", depositMETAApy);
3724
+
3725
+ case 16:
3726
+ case "end":
3727
+ return _context13.stop();
3728
+ }
3729
+ }
3730
+ }, _callee13, this);
3731
+ }));
3732
+
3733
+ function getDepositMetaAPY() {
3734
+ return _getDepositMetaAPY.apply(this, arguments);
3735
+ }
3736
+
3737
+ return getDepositMetaAPY;
3738
+ }();
3739
+
3740
+ _proto.getDetails = /*#__PURE__*/function () {
3741
+ var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14() {
3742
+ var _yield$Promise$all7, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeeds, _yield$Promise$all8, depositPlyAPY, borrowPlyAPY, depositNearAPY, borrowNearAPY, depositMetaAPY;
3743
+
3744
+ return runtime_1.wrap(function _callee14$(_context14) {
3745
+ while (1) {
3746
+ switch (_context14.prev = _context14.next) {
3747
+ case 0:
3748
+ _context14.next = 2;
3749
+ return Promise.all([this.getTotalTokenDeposited(), this.getTotalTokenBorrowed(), this.getDepositAPY(), this.getBorrowAPY(), this.getCollateralRatio(), this.getRewardSpeeds()]);
3750
+
3751
+ case 2:
3752
+ _yield$Promise$all7 = _context14.sent;
3753
+ totalDeposited = _yield$Promise$all7[0];
3754
+ totalBorrowed = _yield$Promise$all7[1];
3755
+ depositAPY = _yield$Promise$all7[2];
3756
+ borrowAPY = _yield$Promise$all7[3];
3757
+ collateralRatio = _yield$Promise$all7[4];
3758
+ rewardSpeeds = _yield$Promise$all7[5];
3759
+ _context14.next = 11;
3760
+ return Promise.all([this.getDepositPlyAPY(), this.getBorrowPlyAPY(), this.getDepositNearAPY(), this.getBorrowNearAPY(), this.getDepositMetaAPY()]);
3761
+
3762
+ case 11:
3763
+ _yield$Promise$all8 = _context14.sent;
3764
+ depositPlyAPY = _yield$Promise$all8[0];
3765
+ borrowPlyAPY = _yield$Promise$all8[1];
3766
+ depositNearAPY = _yield$Promise$all8[2];
3767
+ borrowNearAPY = _yield$Promise$all8[3];
3768
+ depositMetaAPY = _yield$Promise$all8[4];
3769
+ return _context14.abrupt("return", {
3619
3770
  auTokenAddress: this.auToken.address,
3620
3771
  totalTokenDeposited: totalDeposited,
3621
3772
  totalTokenBorrowed: totalBorrowed,
3622
- depositApy: depositAPY,
3623
- depositPlyApy: depositPlyApy.toNumber(),
3624
- borrowApy: borrowAPY,
3625
- borrowPlyApy: borrowPlyApy.toNumber() * -1,
3626
- collateralRatio: collateralRatio,
3773
+ depositApy: depositAPY.toNumber(),
3774
+ depositPlyApy: depositPlyAPY.toNumber(),
3775
+ borrowApy: borrowAPY.toNumber(),
3776
+ borrowPlyApy: borrowPlyAPY.toNumber() * -1,
3777
+ collateralRatio: collateralRatio.toNumber(),
3627
3778
  depositPlyPerWeek: new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.mul(ONE_DAY).mul(7).toString()),
3628
3779
  borrowPlyPerWeek: new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.mul(ONE_DAY).mul(7).toString()),
3629
- depositNEARApy: depositNEARApy.toNumber(),
3630
- borrowNEARApy: borrowNEARApy.toNumber() * -1,
3631
- depositMETAApy: depositMETAApy.toNumber()
3780
+ depositNEARApy: depositNearAPY.toNumber(),
3781
+ borrowNEARApy: borrowNearAPY.toNumber() * -1,
3782
+ depositMETAApy: depositMetaAPY.toNumber()
3632
3783
  });
3633
3784
 
3634
- case 36:
3785
+ case 18:
3635
3786
  case "end":
3636
- return _context9.stop();
3787
+ return _context14.stop();
3637
3788
  }
3638
3789
  }
3639
- }, _callee9, this);
3790
+ }, _callee14, this);
3640
3791
  }));
3641
3792
 
3642
3793
  function getDetails() {
@@ -3647,25 +3798,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3647
3798
  }();
3648
3799
 
3649
3800
  _proto.getUserBorrowBalance = /*#__PURE__*/function () {
3650
- var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
3801
+ var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(userAddress) {
3651
3802
  var totalBorrow;
3652
- return runtime_1.wrap(function _callee10$(_context10) {
3803
+ return runtime_1.wrap(function _callee15$(_context15) {
3653
3804
  while (1) {
3654
- switch (_context10.prev = _context10.next) {
3805
+ switch (_context15.prev = _context15.next) {
3655
3806
  case 0:
3656
- _context10.next = 2;
3807
+ _context15.next = 2;
3657
3808
  return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
3658
3809
 
3659
3810
  case 2:
3660
- totalBorrow = _context10.sent;
3661
- return _context10.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
3811
+ totalBorrow = _context15.sent;
3812
+ return _context15.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
3662
3813
 
3663
3814
  case 4:
3664
3815
  case "end":
3665
- return _context10.stop();
3816
+ return _context15.stop();
3666
3817
  }
3667
3818
  }
3668
- }, _callee10, this);
3819
+ }, _callee15, this);
3669
3820
  }));
3670
3821
 
3671
3822
  function getUserBorrowBalance(_x) {
@@ -3676,25 +3827,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3676
3827
  }();
3677
3828
 
3678
3829
  _proto.getUserDepositBalance = /*#__PURE__*/function () {
3679
- var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(userAddress) {
3830
+ var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(userAddress) {
3680
3831
  var totalDeposit;
3681
- return runtime_1.wrap(function _callee11$(_context11) {
3832
+ return runtime_1.wrap(function _callee16$(_context16) {
3682
3833
  while (1) {
3683
- switch (_context11.prev = _context11.next) {
3834
+ switch (_context16.prev = _context16.next) {
3684
3835
  case 0:
3685
- _context11.next = 2;
3836
+ _context16.next = 2;
3686
3837
  return this.auToken.callStatic.balanceOfUnderlying(userAddress);
3687
3838
 
3688
3839
  case 2:
3689
- totalDeposit = _context11.sent;
3690
- return _context11.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
3840
+ totalDeposit = _context16.sent;
3841
+ return _context16.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
3691
3842
 
3692
3843
  case 4:
3693
3844
  case "end":
3694
- return _context11.stop();
3845
+ return _context16.stop();
3695
3846
  }
3696
3847
  }
3697
- }, _callee11, this);
3848
+ }, _callee16, this);
3698
3849
  }));
3699
3850
 
3700
3851
  function getUserDepositBalance(_x2) {
@@ -3739,107 +3890,225 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3739
3890
  };
3740
3891
 
3741
3892
  _proto.mintCap = /*#__PURE__*/function () {
3742
- var _mintCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12() {
3743
- return runtime_1.wrap(function _callee12$(_context12) {
3893
+ var _mintCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17() {
3894
+ return runtime_1.wrap(function _callee17$(_context17) {
3744
3895
  while (1) {
3745
- switch (_context12.prev = _context12.next) {
3896
+ switch (_context17.prev = _context17.next) {
3897
+ case 0:
3898
+ _context17.t0 = TokenAmount;
3899
+ _context17.t1 = this.underlying;
3900
+ _context17.next = 4;
3901
+ return this.env.comptroller.mintCaps(this.auToken.address);
3902
+
3903
+ case 4:
3904
+ _context17.t2 = _context17.sent.toString();
3905
+ return _context17.abrupt("return", new _context17.t0(_context17.t1, _context17.t2));
3906
+
3907
+ case 6:
3908
+ case "end":
3909
+ return _context17.stop();
3910
+ }
3911
+ }
3912
+ }, _callee17, this);
3913
+ }));
3914
+
3915
+ function mintCap() {
3916
+ return _mintCap.apply(this, arguments);
3917
+ }
3918
+
3919
+ return mintCap;
3920
+ }();
3921
+
3922
+ _proto.borrowCap = /*#__PURE__*/function () {
3923
+ var _borrowCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18() {
3924
+ return runtime_1.wrap(function _callee18$(_context18) {
3925
+ while (1) {
3926
+ switch (_context18.prev = _context18.next) {
3927
+ case 0:
3928
+ _context18.t0 = TokenAmount;
3929
+ _context18.t1 = this.underlying;
3930
+ _context18.next = 4;
3931
+ return this.env.comptroller.borrowCaps(this.auToken.address);
3932
+
3933
+ case 4:
3934
+ _context18.t2 = _context18.sent.toString();
3935
+ return _context18.abrupt("return", new _context18.t0(_context18.t1, _context18.t2));
3936
+
3937
+ case 6:
3938
+ case "end":
3939
+ return _context18.stop();
3940
+ }
3941
+ }
3942
+ }, _callee18, this);
3943
+ }));
3944
+
3945
+ function borrowCap() {
3946
+ return _borrowCap.apply(this, arguments);
3947
+ }
3948
+
3949
+ return borrowCap;
3950
+ }();
3951
+
3952
+ _proto.getApyWithoutIncentive = /*#__PURE__*/function () {
3953
+ var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19(userAddress) {
3954
+ var _yield$Promise$all9, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
3955
+
3956
+ return runtime_1.wrap(function _callee19$(_context19) {
3957
+ while (1) {
3958
+ switch (_context19.prev = _context19.next) {
3746
3959
  case 0:
3747
- _context12.t0 = TokenAmount;
3748
- _context12.t1 = this.underlying;
3749
- _context12.next = 4;
3750
- return this.env.comptroller.mintCaps(this.auToken.address);
3960
+ _context19.next = 2;
3961
+ return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
3751
3962
 
3752
- case 4:
3753
- _context12.t2 = _context12.sent.toString();
3754
- return _context12.abrupt("return", new _context12.t0(_context12.t1, _context12.t2));
3963
+ case 2:
3964
+ _yield$Promise$all9 = _context19.sent;
3965
+ price = _yield$Promise$all9[0];
3966
+ depositApy = _yield$Promise$all9[1];
3967
+ borrowApy = _yield$Promise$all9[2];
3968
+ depositBalance = _yield$Promise$all9[3];
3969
+ borrowBalance = _yield$Promise$all9[4];
3970
+ suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
3971
+ borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
3972
+ sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
3973
+ return _context19.abrupt("return", {
3974
+ sum: sum,
3975
+ suppliedValue: suppliedValue,
3976
+ borrowedValue: borrowedValue
3977
+ });
3755
3978
 
3756
- case 6:
3979
+ case 12:
3757
3980
  case "end":
3758
- return _context12.stop();
3981
+ return _context19.stop();
3759
3982
  }
3760
3983
  }
3761
- }, _callee12, this);
3984
+ }, _callee19, this);
3762
3985
  }));
3763
3986
 
3764
- function mintCap() {
3765
- return _mintCap.apply(this, arguments);
3987
+ function getApyWithoutIncentive(_x3) {
3988
+ return _getApyWithoutIncentive.apply(this, arguments);
3766
3989
  }
3767
3990
 
3768
- return mintCap;
3991
+ return getApyWithoutIncentive;
3769
3992
  }();
3770
3993
 
3771
- _proto.borrowCap = /*#__PURE__*/function () {
3772
- var _borrowCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
3773
- return runtime_1.wrap(function _callee13$(_context13) {
3994
+ _proto.getApyWithIncentive = /*#__PURE__*/function () {
3995
+ var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee20(userAddress) {
3996
+ var _yield$Promise$all10, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
3997
+
3998
+ return runtime_1.wrap(function _callee20$(_context20) {
3774
3999
  while (1) {
3775
- switch (_context13.prev = _context13.next) {
4000
+ switch (_context20.prev = _context20.next) {
3776
4001
  case 0:
3777
- _context13.t0 = TokenAmount;
3778
- _context13.t1 = this.underlying;
3779
- _context13.next = 4;
3780
- return this.env.comptroller.borrowCaps(this.auToken.address);
4002
+ _context20.next = 2;
4003
+ return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress), this.getDepositNearAPY(), this.getDepositPlyAPY(), this.getDepositMetaAPY(), this.getBorrowNearAPY(), this.getBorrowPlyAPY()]);
3781
4004
 
3782
- case 4:
3783
- _context13.t2 = _context13.sent.toString();
3784
- return _context13.abrupt("return", new _context13.t0(_context13.t1, _context13.t2));
4005
+ case 2:
4006
+ _yield$Promise$all10 = _context20.sent;
4007
+ price = _yield$Promise$all10[0];
4008
+ depositApy = _yield$Promise$all10[1];
4009
+ borrowApy = _yield$Promise$all10[2];
4010
+ depositBalance = _yield$Promise$all10[3];
4011
+ borrowBalance = _yield$Promise$all10[4];
4012
+ nearDepositApy = _yield$Promise$all10[5];
4013
+ plyDepositApy = _yield$Promise$all10[6];
4014
+ metaDepositApy = _yield$Promise$all10[7];
4015
+ nearBorrowApy = _yield$Promise$all10[8];
4016
+ plyBorrowApy = _yield$Promise$all10[9];
4017
+ suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
4018
+ borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
4019
+ totalDepositApy = depositApy.plus(nearDepositApy).plus(plyDepositApy).plus(metaDepositApy);
4020
+ totalBorrowApy = borrowApy.plus(nearBorrowApy).plus(plyBorrowApy);
4021
+ sum = calcNetApy(suppliedValue, totalDepositApy, borrowedValue, totalBorrowApy);
4022
+ return _context20.abrupt("return", {
4023
+ sum: sum,
4024
+ suppliedValue: suppliedValue,
4025
+ borrowedValue: borrowedValue
4026
+ });
3785
4027
 
3786
- case 6:
4028
+ case 19:
3787
4029
  case "end":
3788
- return _context13.stop();
4030
+ return _context20.stop();
3789
4031
  }
3790
4032
  }
3791
- }, _callee13, this);
4033
+ }, _callee20, this);
3792
4034
  }));
3793
4035
 
3794
- function borrowCap() {
3795
- return _borrowCap.apply(this, arguments);
4036
+ function getApyWithIncentive(_x4) {
4037
+ return _getApyWithIncentive.apply(this, arguments);
3796
4038
  }
3797
4039
 
3798
- return borrowCap;
4040
+ return getApyWithIncentive;
3799
4041
  }();
3800
4042
 
3801
4043
  return MoneyMarketRead;
3802
4044
  }(BlockchainEntityRead);
4045
+
4046
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getUnderlyingPrice", null);
4047
+
4048
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getPlyPrice", null);
4049
+
4050
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getRewardSpeeds", null);
4051
+
4052
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getTotalTokenBorrowed", null);
4053
+
4054
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getTotalTokenDeposited", null);
4055
+
4056
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositAPY", null);
4057
+
4058
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getBorrowAPY", null);
4059
+
4060
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getCollateralRatio", null);
4061
+
4062
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getBorrowPlyAPY", null);
4063
+
4064
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositPlyAPY", null);
4065
+
4066
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositNearAPY", null);
4067
+
4068
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getBorrowNearAPY", null);
4069
+
4070
+ tslib.__decorate([Cache(CACHE_TIMEOUT), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", Promise)], MoneyMarketRead.prototype, "getDepositMetaAPY", null);
4071
+
3803
4072
  var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3804
4073
  _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
3805
4074
 
3806
4075
  function MoneyMarketReadWrite(networkConnection, auToken, underlyingAsset) {
3807
- var _this3;
4076
+ var _this2;
3808
4077
 
3809
- _this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
3810
- _this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$7.abi, networkConnection.provider);
3811
- return _this3;
4078
+ _this2 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
4079
+ _this2._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$7.abi, networkConnection.provider);
4080
+ return _this2;
3812
4081
  }
3813
4082
 
3814
4083
  var _proto2 = MoneyMarketReadWrite.prototype;
3815
4084
 
3816
4085
  _proto2.deposit = /*#__PURE__*/function () {
3817
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
3818
- return runtime_1.wrap(function _callee14$(_context14) {
4086
+ var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee21(amount) {
4087
+ return runtime_1.wrap(function _callee21$(_context21) {
3819
4088
  while (1) {
3820
- switch (_context14.prev = _context14.next) {
4089
+ switch (_context21.prev = _context21.next) {
3821
4090
  case 0:
3822
4091
  if (!isSameAddress(amount.token.address, ETHAddress)) {
3823
- _context14.next = 4;
4092
+ _context21.next = 4;
3824
4093
  break;
3825
4094
  }
3826
4095
 
3827
- return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
4096
+ return _context21.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
3828
4097
  value: amount.rawAmount()
3829
4098
  }));
3830
4099
 
3831
4100
  case 4:
3832
- return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
4101
+ return _context21.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
3833
4102
 
3834
4103
  case 5:
3835
4104
  case "end":
3836
- return _context14.stop();
4105
+ return _context21.stop();
3837
4106
  }
3838
4107
  }
3839
- }, _callee14, this);
4108
+ }, _callee21, this);
3840
4109
  }));
3841
4110
 
3842
- function deposit(_x3) {
4111
+ function deposit(_x5) {
3843
4112
  return _deposit.apply(this, arguments);
3844
4113
  }
3845
4114
 
@@ -3847,22 +4116,22 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3847
4116
  }();
3848
4117
 
3849
4118
  _proto2.borrow = /*#__PURE__*/function () {
3850
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(amount) {
3851
- return runtime_1.wrap(function _callee15$(_context15) {
4119
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee22(amount) {
4120
+ return runtime_1.wrap(function _callee22$(_context22) {
3852
4121
  while (1) {
3853
- switch (_context15.prev = _context15.next) {
4122
+ switch (_context22.prev = _context22.next) {
3854
4123
  case 0:
3855
- return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
4124
+ return _context22.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
3856
4125
 
3857
4126
  case 1:
3858
4127
  case "end":
3859
- return _context15.stop();
4128
+ return _context22.stop();
3860
4129
  }
3861
4130
  }
3862
- }, _callee15, this);
4131
+ }, _callee22, this);
3863
4132
  }));
3864
4133
 
3865
- function borrow(_x4) {
4134
+ function borrow(_x6) {
3866
4135
  return _borrow.apply(this, arguments);
3867
4136
  }
3868
4137
 
@@ -3870,30 +4139,30 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3870
4139
  }();
3871
4140
 
3872
4141
  _proto2.withdraw = /*#__PURE__*/function () {
3873
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(amount) {
3874
- return runtime_1.wrap(function _callee16$(_context16) {
4142
+ var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee23(amount) {
4143
+ return runtime_1.wrap(function _callee23$(_context23) {
3875
4144
  while (1) {
3876
- switch (_context16.prev = _context16.next) {
4145
+ switch (_context23.prev = _context23.next) {
3877
4146
  case 0:
3878
4147
  if (!new BigNumber(amount.rawAmount()).lt(0)) {
3879
- _context16.next = 2;
4148
+ _context23.next = 2;
3880
4149
  break;
3881
4150
  }
3882
4151
 
3883
- return _context16.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
4152
+ return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
3884
4153
 
3885
4154
  case 2:
3886
- return _context16.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
4155
+ return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
3887
4156
 
3888
4157
  case 3:
3889
4158
  case "end":
3890
- return _context16.stop();
4159
+ return _context23.stop();
3891
4160
  }
3892
4161
  }
3893
- }, _callee16, this);
4162
+ }, _callee23, this);
3894
4163
  }));
3895
4164
 
3896
- function withdraw(_x5) {
4165
+ function withdraw(_x7) {
3897
4166
  return _withdraw.apply(this, arguments);
3898
4167
  }
3899
4168
 
@@ -3901,40 +4170,40 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3901
4170
  }();
3902
4171
 
3903
4172
  _proto2.repay = /*#__PURE__*/function () {
3904
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(amount) {
3905
- return runtime_1.wrap(function _callee17$(_context17) {
4173
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee24(amount) {
4174
+ return runtime_1.wrap(function _callee24$(_context24) {
3906
4175
  while (1) {
3907
- switch (_context17.prev = _context17.next) {
4176
+ switch (_context24.prev = _context24.next) {
3908
4177
  case 0:
3909
4178
  if (!isSameAddress(amount.token.address, ETHAddress)) {
3910
- _context17.next = 4;
4179
+ _context24.next = 4;
3911
4180
  break;
3912
4181
  }
3913
4182
 
3914
- return _context17.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
4183
+ return _context24.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
3915
4184
  value: amount.rawAmount()
3916
4185
  }));
3917
4186
 
3918
4187
  case 4:
3919
4188
  if (!new BigNumber(amount.rawAmount()).lt(0)) {
3920
- _context17.next = 8;
4189
+ _context24.next = 8;
3921
4190
  break;
3922
4191
  }
3923
4192
 
3924
- return _context17.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
4193
+ return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
3925
4194
 
3926
4195
  case 8:
3927
- return _context17.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
4196
+ return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
3928
4197
 
3929
4198
  case 9:
3930
4199
  case "end":
3931
- return _context17.stop();
4200
+ return _context24.stop();
3932
4201
  }
3933
4202
  }
3934
- }, _callee17, this);
4203
+ }, _callee24, this);
3935
4204
  }));
3936
4205
 
3937
- function repay(_x6) {
4206
+ function repay(_x8) {
3938
4207
  return _repay.apply(this, arguments);
3939
4208
  }
3940
4209
 
@@ -3942,19 +4211,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3942
4211
  }();
3943
4212
 
3944
4213
  _proto2.enableCollateral = /*#__PURE__*/function () {
3945
- var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18() {
3946
- return runtime_1.wrap(function _callee18$(_context18) {
4214
+ var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee25() {
4215
+ return runtime_1.wrap(function _callee25$(_context25) {
3947
4216
  while (1) {
3948
- switch (_context18.prev = _context18.next) {
4217
+ switch (_context25.prev = _context25.next) {
3949
4218
  case 0:
3950
- return _context18.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
4219
+ return _context25.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
3951
4220
 
3952
4221
  case 1:
3953
4222
  case "end":
3954
- return _context18.stop();
4223
+ return _context25.stop();
3955
4224
  }
3956
4225
  }
3957
- }, _callee18, this);
4226
+ }, _callee25, this);
3958
4227
  }));
3959
4228
 
3960
4229
  function enableCollateral() {
@@ -3965,19 +4234,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3965
4234
  }();
3966
4235
 
3967
4236
  _proto2.disableCollateral = /*#__PURE__*/function () {
3968
- var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19() {
3969
- return runtime_1.wrap(function _callee19$(_context19) {
4237
+ var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee26() {
4238
+ return runtime_1.wrap(function _callee26$(_context26) {
3970
4239
  while (1) {
3971
- switch (_context19.prev = _context19.next) {
4240
+ switch (_context26.prev = _context26.next) {
3972
4241
  case 0:
3973
- return _context19.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
4242
+ return _context26.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
3974
4243
 
3975
4244
  case 1:
3976
4245
  case "end":
3977
- return _context19.stop();
4246
+ return _context26.stop();
3978
4247
  }
3979
4248
  }
3980
- }, _callee19, this);
4249
+ }, _callee26, this);
3981
4250
  }));
3982
4251
 
3983
4252
  function disableCollateral() {
@@ -3993,12 +4262,12 @@ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
3993
4262
  _inheritsLoose(MoneyMarket, _BlockchainEntity);
3994
4263
 
3995
4264
  function MoneyMarket(address, underlying) {
3996
- var _this4;
4265
+ var _this3;
3997
4266
 
3998
- _this4 = _BlockchainEntity.call(this) || this;
3999
- _this4.address = validateAndParseAddress(address);
4000
- _this4.underlying = validateAndParseAddress(underlying);
4001
- return _this4;
4267
+ _this3 = _BlockchainEntity.call(this) || this;
4268
+ _this3.address = validateAndParseAddress(address);
4269
+ _this3.underlying = validateAndParseAddress(underlying);
4270
+ return _this3;
4002
4271
  }
4003
4272
 
4004
4273
  var _proto3 = MoneyMarket.prototype;
@@ -4225,29 +4494,25 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4225
4494
  /*#__PURE__*/
4226
4495
  function () {
4227
4496
  var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(userAddress) {
4228
- var currentWeek, promises, values, percentLockCurrentWeek, percentLockNextWeek, totalRewards, _yield$this$env$pulp$, pulpAmountCurrentWeek, plyAmountCurrentWeek, plyAmountNextWeek, pulpAmountNextWeek, currentUnlockPortion, nextUnlockPortion;
4497
+ var currentWeek, values, percentLockCurrentWeek, percentLockNextWeek, totalRewards, _yield$this$env$pulp$, pulpAmountCurrentWeek, plyAmountCurrentWeek, plyAmountNextWeek, pulpAmountNextWeek, currentUnlockPortion, nextUnlockPortion;
4229
4498
 
4230
4499
  return runtime_1.wrap(function _callee4$(_context4) {
4231
4500
  while (1) {
4232
4501
  switch (_context4.prev = _context4.next) {
4233
4502
  case 0:
4234
4503
  currentWeek = this.getWeek(getCurrentTimestamp());
4235
- promises = [];
4236
- promises.push(this.env.auriLens.getPercentLock(this.env.pulp.address, userAddress, currentWeek));
4237
- promises.push(this.env.auriLens.getPercentLock(this.env.pulp.address, userAddress, currentWeek + 1));
4238
- promises.push(this.getUnclaimedPlyReward(userAddress));
4239
- _context4.next = 7;
4240
- return Promise.all(promises);
4504
+ _context4.next = 3;
4505
+ return Promise.all([this.env.auriLens.getPercentLock(this.env.pulp.address, userAddress, currentWeek), this.env.auriLens.getPercentLock(this.env.pulp.address, userAddress, currentWeek + 1), this.getUnclaimedPlyReward(userAddress)]);
4241
4506
 
4242
- case 7:
4507
+ case 3:
4243
4508
  values = _context4.sent;
4244
4509
  percentLockCurrentWeek = ethers.BigNumber.from(values[0]);
4245
4510
  percentLockNextWeek = ethers.BigNumber.from(values[1]);
4246
4511
  totalRewards = values[2];
4247
- _context4.next = 13;
4512
+ _context4.next = 9;
4248
4513
  return this.env.pulp.calcLockAmount(userAddress, totalRewards.rawAmount());
4249
4514
 
4250
- case 13:
4515
+ case 9:
4251
4516
  _yield$this$env$pulp$ = _context4.sent;
4252
4517
  pulpAmountCurrentWeek = _yield$this$env$pulp$[0];
4253
4518
  plyAmountCurrentWeek = _yield$this$env$pulp$[1];
@@ -4271,7 +4536,7 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4271
4536
  nextPulp: new TokenAmount(this.pulpToken, pulpAmountNextWeek.toString())
4272
4537
  });
4273
4538
 
4274
- case 21:
4539
+ case 17:
4275
4540
  case "end":
4276
4541
  return _context4.stop();
4277
4542
  }
@@ -4761,9 +5026,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4761
5026
 
4762
5027
  _proto.getUserDetails = /*#__PURE__*/function () {
4763
5028
  var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(userAddress) {
4764
- var _this2 = this;
4765
-
4766
- var marketCount, userMarketDetails, assetsIn, promises, totalBorrowLimit, pricePromises, _loop2, _iterator, _step, underlyingPrices, depositValues, _loop, i, accountLiquidity, borrowedvaluation, bufferedBorrowLimit, minimumBorrowLimitAllowed, borrowableAmount, auToken, moneyMarket, borrowLimitMargin, maxWithdrawCap;
5029
+ var marketCount, userMarketDetails, assetsIn, totalBorrowLimit, _iterator, _step, _auToken, userMarketDetail, _moneyMarket, _yield$Promise$all, depositBalance, borrowBalance, collateralRatio, underlyingPrice, depositValues, _loop, i, accountLiquidity, borrowedvaluation, bufferedBorrowLimit, minimumBorrowLimitAllowed, borrowableAmount, auToken, moneyMarket, borrowLimitMargin, maxWithdrawCap;
4767
5030
 
4768
5031
  return runtime_1.wrap(function _callee$(_context) {
4769
5032
  while (1) {
@@ -4771,47 +5034,44 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4771
5034
  case 0:
4772
5035
  marketCount = networkAddresses.auTokens.length;
4773
5036
  userMarketDetails = [];
4774
- promises = [];
4775
5037
  totalBorrowLimit = new BigNumber(0);
4776
- pricePromises = [];
4777
-
4778
- _loop2 = function _loop2() {
4779
- var auToken = _step.value;
4780
- var userMarketDetail = {};
4781
- userMarketDetails.push(userMarketDetail);
4782
- userMarketDetail.market = auToken.underlying;
4783
- var moneyMarket = new MoneyMarketRead(_this2._networkConnection, auToken.address, auToken.underlying);
4784
- promises.push(moneyMarket.getUserDepositBalance(userAddress).then(function (res) {
4785
- userMarketDetail.depositBalance = res;
4786
- }));
4787
- promises.push(moneyMarket.getUserBorrowBalance(userAddress).then(function (res) {
4788
- userMarketDetail.borrowBalance = res;
4789
- }));
4790
- promises.push(moneyMarket.getCollateralRatio().then(function (res) {
4791
- userMarketDetail.collateralRatio = res.toNumber();
4792
- }));
4793
- pricePromises.push(fetchPrice(moneyMarket.underlying.address, _this2._networkConnection.provider).then(function (res) {
4794
- userMarketDetail.underlyingPrice = res.toString();
4795
- return res;
4796
- }));
4797
- };
5038
+ _iterator = _createForOfIteratorHelperLoose(networkAddresses.auTokens);
4798
5039
 
4799
- for (_iterator = _createForOfIteratorHelperLoose(networkAddresses.auTokens); !(_step = _iterator()).done;) {
4800
- _loop2();
5040
+ case 4:
5041
+ if ((_step = _iterator()).done) {
5042
+ _context.next = 23;
5043
+ break;
4801
5044
  }
4802
5045
 
4803
- promises.push(this.env.comptroller.getAssetsIn(userAddress).then(function (res) {
4804
- assetsIn = res;
4805
- }));
4806
- _context.next = 10;
4807
- return Promise.all(promises);
4808
-
4809
- case 10:
5046
+ _auToken = _step.value;
5047
+ userMarketDetail = {};
5048
+ userMarketDetails.push(userMarketDetail);
5049
+ userMarketDetail.market = _auToken.underlying;
5050
+ _moneyMarket = new MoneyMarketRead(this._networkConnection, _auToken.address, _auToken.underlying);
4810
5051
  _context.next = 12;
4811
- return Promise.all(pricePromises);
5052
+ return Promise.all([_moneyMarket.getUserDepositBalance(userAddress), _moneyMarket.getUserBorrowBalance(userAddress), _moneyMarket.getCollateralRatio(), fetchPrice(_moneyMarket.underlying.address, this._networkConnection.provider)]);
4812
5053
 
4813
5054
  case 12:
4814
- underlyingPrices = _context.sent;
5055
+ _yield$Promise$all = _context.sent;
5056
+ depositBalance = _yield$Promise$all[0];
5057
+ borrowBalance = _yield$Promise$all[1];
5058
+ collateralRatio = _yield$Promise$all[2];
5059
+ underlyingPrice = _yield$Promise$all[3];
5060
+ userMarketDetail.depositBalance = depositBalance;
5061
+ userMarketDetail.borrowBalance = borrowBalance;
5062
+ userMarketDetail.collateralRatio = collateralRatio.toNumber();
5063
+ userMarketDetail.underlyingPrice = underlyingPrice.toString();
5064
+
5065
+ case 21:
5066
+ _context.next = 4;
5067
+ break;
5068
+
5069
+ case 23:
5070
+ _context.next = 25;
5071
+ return this.env.comptroller.getAssetsIn(userAddress);
5072
+
5073
+ case 25:
5074
+ assetsIn = _context.sent;
4815
5075
  depositValues = [];
4816
5076
 
4817
5077
  _loop = function _loop() {
@@ -4825,7 +5085,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4825
5085
  userMarketDetails[i].isCollateral = false;
4826
5086
  }
4827
5087
 
4828
- depositValues.push(calcValuation(userMarketDetails[i].depositBalance, underlyingPrices[i]));
5088
+ depositValues.push(calcValuation(userMarketDetails[i].depositBalance, new BigNumber(userMarketDetails[i].underlyingPrice)));
4829
5089
  };
4830
5090
 
4831
5091
  for (i = 0; i < marketCount; i++) {
@@ -4836,10 +5096,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4836
5096
  if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(userMarketDetails[index].collateralRatio));
4837
5097
  return p;
4838
5098
  }, new BigNumber(0));
4839
- _context.next = 19;
5099
+ _context.next = 32;
4840
5100
  return this.env.comptroller.getAccountLiquidity(userAddress);
4841
5101
 
4842
- case 19:
5102
+ case 32:
4843
5103
  accountLiquidity = _context.sent;
4844
5104
  borrowedvaluation = totalBorrowLimit.minus(new BigNumber(accountLiquidity[0].toString()).div(decimalFactor(18)));
4845
5105
 
@@ -4861,7 +5121,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4861
5121
  auToken = networkAddresses.auTokens[i];
4862
5122
  moneyMarket = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
4863
5123
  borrowLimitMargin = totalBorrowLimit.minus(minimumBorrowLimitAllowed).gt(0) ? totalBorrowLimit.minus(minimumBorrowLimitAllowed) : new BigNumber(0);
4864
- maxWithdrawCap = borrowLimitMargin.div(userMarketDetails[i].collateralRatio).div(underlyingPrices[i]);
5124
+ maxWithdrawCap = borrowLimitMargin.div(userMarketDetails[i].collateralRatio).div(userMarketDetails[i].underlyingPrice);
4865
5125
  userMarketDetails[i].maxWithdrawableAmount = userMarketDetails[i].isCollateral && maxWithdrawCap.lt(userMarketDetails[i].depositBalance.formattedAmount()) ? new TokenAmount(moneyMarket.underlying, maxWithdrawCap.toFixed(24), false) : new TokenAmount(moneyMarket.underlying, userMarketDetails[i].depositBalance.rawAmount());
4866
5126
  }
4867
5127
 
@@ -4870,10 +5130,10 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4870
5130
  currency: 'USD',
4871
5131
  amount: bufferedBorrowLimit.toFixed(DECIMAL_PRECISION)
4872
5132
  };
4873
- _context.next = 30;
5133
+ _context.next = 43;
4874
5134
  return new PapermillRead(this._networkConnection).getLockingDetails(userAddress);
4875
5135
 
4876
- case 30:
5136
+ case 43:
4877
5137
  _context.t2 = _context.sent;
4878
5138
  _context.t3 = {
4879
5139
  currency: 'USD',
@@ -4886,7 +5146,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4886
5146
  borrowableAmount: _context.t3
4887
5147
  });
4888
5148
 
4889
- case 33:
5149
+ case 46:
4890
5150
  case "end":
4891
5151
  return _context.stop();
4892
5152
  }
@@ -5060,7 +5320,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5060
5320
 
5061
5321
  _proto.sneakAccounts = /*#__PURE__*/function () {
5062
5322
  var _sneakAccounts = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(accounts, tokenAddresses, dust) {
5063
- var _this3 = this;
5323
+ var _this2 = this;
5064
5324
 
5065
5325
  var _1E18, oracle, tokens, prices, exrate, res, _iterator2, _step2, addr, infos, _i, snapshot, bal, bor, balR, borR;
5066
5326
 
@@ -5075,7 +5335,7 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5075
5335
  _1E18 = ethers.BigNumber.from(10).pow(18);
5076
5336
  oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
5077
5337
  tokens = tokenAddresses.map(function (addr) {
5078
- return _this3.env.getContract(addr, abis$5.abi);
5338
+ return _this2.env.getContract(addr, abis$5.abi);
5079
5339
  });
5080
5340
  _context5.next = 6;
5081
5341
  return oracle.getUnderlyingPrices(tokenAddresses);
@@ -5163,6 +5423,114 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5163
5423
  return sneakAccounts;
5164
5424
  }();
5165
5425
 
5426
+ _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
5427
+ var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(userAddress) {
5428
+ var _this3 = this;
5429
+
5430
+ var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator3, _step3, apy;
5431
+
5432
+ return runtime_1.wrap(function _callee6$(_context6) {
5433
+ while (1) {
5434
+ switch (_context6.prev = _context6.next) {
5435
+ case 0:
5436
+ sum = new BigNumber(0);
5437
+ totalSuppliedValue = new BigNumber(0);
5438
+ totalBorrowedValue = new BigNumber(0);
5439
+ netApy = new BigNumber(0);
5440
+ _context6.next = 6;
5441
+ return Promise.all(networkAddresses.auTokens.map(function (auToken) {
5442
+ var moneyMarket = new MoneyMarketRead(_this3._networkConnection, auToken.address, auToken.underlying);
5443
+ var apyWithoutIncentive = moneyMarket.getApyWithoutIncentive(userAddress);
5444
+ return apyWithoutIncentive;
5445
+ }));
5446
+
5447
+ case 6:
5448
+ apys = _context6.sent;
5449
+
5450
+ for (_iterator3 = _createForOfIteratorHelperLoose(apys); !(_step3 = _iterator3()).done;) {
5451
+ apy = _step3.value;
5452
+ sum = sum.plus(apy.sum);
5453
+ totalSuppliedValue = totalSuppliedValue.plus(apy.suppliedValue);
5454
+ totalBorrowedValue = totalBorrowedValue.plus(apy.borrowedValue);
5455
+ }
5456
+
5457
+ if (sum.gt(0)) {
5458
+ netApy = sum.div(totalSuppliedValue);
5459
+ } else if (sum.lt(0)) {
5460
+ netApy = sum.div(totalBorrowedValue);
5461
+ }
5462
+
5463
+ return _context6.abrupt("return", netApy);
5464
+
5465
+ case 10:
5466
+ case "end":
5467
+ return _context6.stop();
5468
+ }
5469
+ }
5470
+ }, _callee6);
5471
+ }));
5472
+
5473
+ function getNetApyWithoutIncentive(_x7) {
5474
+ return _getNetApyWithoutIncentive.apply(this, arguments);
5475
+ }
5476
+
5477
+ return getNetApyWithoutIncentive;
5478
+ }();
5479
+
5480
+ _proto.getNetApyWithIncentive = /*#__PURE__*/function () {
5481
+ var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(userAddress) {
5482
+ var _this4 = this;
5483
+
5484
+ var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator4, _step4, apy;
5485
+
5486
+ return runtime_1.wrap(function _callee7$(_context7) {
5487
+ while (1) {
5488
+ switch (_context7.prev = _context7.next) {
5489
+ case 0:
5490
+ sum = new BigNumber(0);
5491
+ totalSuppliedValue = new BigNumber(0);
5492
+ totalBorrowedValue = new BigNumber(0);
5493
+ netApy = new BigNumber(0);
5494
+ _context7.next = 6;
5495
+ return Promise.all(networkAddresses.auTokens.map(function (auToken) {
5496
+ var moneyMarket = new MoneyMarketRead(_this4._networkConnection, auToken.address, auToken.underlying);
5497
+ var apyWithIncentive = moneyMarket.getApyWithIncentive(userAddress);
5498
+ return apyWithIncentive;
5499
+ }));
5500
+
5501
+ case 6:
5502
+ apys = _context7.sent;
5503
+
5504
+ for (_iterator4 = _createForOfIteratorHelperLoose(apys); !(_step4 = _iterator4()).done;) {
5505
+ apy = _step4.value;
5506
+ sum = sum.plus(apy.sum);
5507
+ totalSuppliedValue = totalSuppliedValue.plus(apy.suppliedValue);
5508
+ totalBorrowedValue = totalBorrowedValue.plus(apy.borrowedValue);
5509
+ }
5510
+
5511
+ if (sum.gt(0)) {
5512
+ netApy = sum.div(totalSuppliedValue);
5513
+ } else if (sum.lt(0)) {
5514
+ netApy = sum.div(totalBorrowedValue);
5515
+ }
5516
+
5517
+ return _context7.abrupt("return", netApy);
5518
+
5519
+ case 10:
5520
+ case "end":
5521
+ return _context7.stop();
5522
+ }
5523
+ }
5524
+ }, _callee7);
5525
+ }));
5526
+
5527
+ function getNetApyWithIncentive(_x8) {
5528
+ return _getNetApyWithIncentive.apply(this, arguments);
5529
+ }
5530
+
5531
+ return getNetApyWithIncentive;
5532
+ }();
5533
+
5166
5534
  return MiscRead;
5167
5535
  }(BlockchainEntityRead);
5168
5536
 
@@ -5513,43 +5881,6 @@ var PlyGameRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5513
5881
  return getLastJackpotResult;
5514
5882
  }();
5515
5883
 
5516
- _proto.overallLeaderboard = /*#__PURE__*/function () {
5517
- var _overallLeaderboard = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
5518
- var _this5 = this;
5519
-
5520
- var result;
5521
- return runtime_1.wrap(function _callee8$(_context8) {
5522
- while (1) {
5523
- switch (_context8.prev = _context8.next) {
5524
- case 0:
5525
- _context8.next = 2;
5526
- return getPaginatedApi('/plygame/overallLeaderboard');
5527
-
5528
- case 2:
5529
- result = _context8.sent;
5530
- return _context8.abrupt("return", result.items.map(function (item) {
5531
- return {
5532
- player: item.user,
5533
- unlockedPulpAmount: new TokenAmount(_this5.pulpToken, item.unlockedAmount),
5534
- gamesPlayed: item.count
5535
- };
5536
- }));
5537
-
5538
- case 4:
5539
- case "end":
5540
- return _context8.stop();
5541
- }
5542
- }
5543
- }, _callee8);
5544
- }));
5545
-
5546
- function overallLeaderboard() {
5547
- return _overallLeaderboard.apply(this, arguments);
5548
- }
5549
-
5550
- return overallLeaderboard;
5551
- }();
5552
-
5553
5884
  return PlyGameRead;
5554
5885
  }(BlockchainEntityRead);
5555
5886
  var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
@@ -5567,19 +5898,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
5567
5898
  _proto2.makeBetOnce =
5568
5899
  /*#__PURE__*/
5569
5900
  function () {
5570
- var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
5571
- return runtime_1.wrap(function _callee9$(_context9) {
5901
+ var _makeBetOnce = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
5902
+ return runtime_1.wrap(function _callee8$(_context8) {
5572
5903
  while (1) {
5573
- switch (_context9.prev = _context9.next) {
5904
+ switch (_context8.prev = _context8.next) {
5574
5905
  case 0:
5575
- return _context9.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
5906
+ return _context8.abrupt("return", this.env.plygame.connect(this._networkConnection.signer).makeBetOnce(amount.rawAmount()));
5576
5907
 
5577
5908
  case 1:
5578
5909
  case "end":
5579
- return _context9.stop();
5910
+ return _context8.stop();
5580
5911
  }
5581
5912
  }
5582
- }, _callee9, this);
5913
+ }, _callee8, this);
5583
5914
  }));
5584
5915
 
5585
5916
  function makeBetOnce(_x5) {
@@ -5590,19 +5921,19 @@ var PlyGameReadWrite = /*#__PURE__*/function (_PlyGameRead) {
5590
5921
  }();
5591
5922
 
5592
5923
  _proto2.approve = /*#__PURE__*/function () {
5593
- var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(amount) {
5594
- return runtime_1.wrap(function _callee10$(_context10) {
5924
+ var _approve = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
5925
+ return runtime_1.wrap(function _callee9$(_context9) {
5595
5926
  while (1) {
5596
- switch (_context10.prev = _context10.next) {
5927
+ switch (_context9.prev = _context9.next) {
5597
5928
  case 0:
5598
- return _context10.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
5929
+ return _context9.abrupt("return", this.env.ply.connect(this._networkConnection.signer).approve(this.env.plygame.address, amount.rawAmount()));
5599
5930
 
5600
5931
  case 1:
5601
5932
  case "end":
5602
- return _context10.stop();
5933
+ return _context9.stop();
5603
5934
  }
5604
5935
  }
5605
- }, _callee10, this);
5936
+ }, _callee9, this);
5606
5937
  }));
5607
5938
 
5608
5939
  function approve(_x6) {
@@ -6574,6 +6905,56 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
6574
6905
  return sneakAccounts;
6575
6906
  }();
6576
6907
 
6908
+ _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
6909
+ var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
6910
+ var miscRead;
6911
+ return runtime_1.wrap(function _callee10$(_context10) {
6912
+ while (1) {
6913
+ switch (_context10.prev = _context10.next) {
6914
+ case 0:
6915
+ miscRead = new MiscRead(this._networkConnection);
6916
+ return _context10.abrupt("return", miscRead.getNetApyWithoutIncentive(userAddress));
6917
+
6918
+ case 2:
6919
+ case "end":
6920
+ return _context10.stop();
6921
+ }
6922
+ }
6923
+ }, _callee10, this);
6924
+ }));
6925
+
6926
+ function getNetApyWithoutIncentive(_x10) {
6927
+ return _getNetApyWithoutIncentive.apply(this, arguments);
6928
+ }
6929
+
6930
+ return getNetApyWithoutIncentive;
6931
+ }();
6932
+
6933
+ _proto.getNetApyWithIncentive = /*#__PURE__*/function () {
6934
+ var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(userAddress) {
6935
+ var miscRead;
6936
+ return runtime_1.wrap(function _callee11$(_context11) {
6937
+ while (1) {
6938
+ switch (_context11.prev = _context11.next) {
6939
+ case 0:
6940
+ miscRead = new MiscRead(this._networkConnection);
6941
+ return _context11.abrupt("return", miscRead.getNetApyWithIncentive(userAddress));
6942
+
6943
+ case 2:
6944
+ case "end":
6945
+ return _context11.stop();
6946
+ }
6947
+ }
6948
+ }, _callee11, this);
6949
+ }));
6950
+
6951
+ function getNetApyWithIncentive(_x11) {
6952
+ return _getNetApyWithIncentive.apply(this, arguments);
6953
+ }
6954
+
6955
+ return getNetApyWithIncentive;
6956
+ }();
6957
+
6577
6958
  return SdkRead;
6578
6959
  }(BlockchainEntityRead);
6579
6960
  var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
@@ -6591,19 +6972,19 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
6591
6972
  _proto2.claim =
6592
6973
  /*#__PURE__*/
6593
6974
  function () {
6594
- var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10() {
6595
- return runtime_1.wrap(function _callee10$(_context10) {
6975
+ var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12() {
6976
+ return runtime_1.wrap(function _callee12$(_context12) {
6596
6977
  while (1) {
6597
- switch (_context10.prev = _context10.next) {
6978
+ switch (_context12.prev = _context12.next) {
6598
6979
  case 0:
6599
- return _context10.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
6980
+ return _context12.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
6600
6981
 
6601
6982
  case 1:
6602
6983
  case "end":
6603
- return _context10.stop();
6984
+ return _context12.stop();
6604
6985
  }
6605
6986
  }
6606
- }, _callee10, this);
6987
+ }, _callee12, this);
6607
6988
  }));
6608
6989
 
6609
6990
  function claim() {
@@ -6614,22 +6995,22 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
6614
6995
  }();
6615
6996
 
6616
6997
  _proto2.stake = /*#__PURE__*/function () {
6617
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
6618
- return runtime_1.wrap(function _callee11$(_context11) {
6998
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
6999
+ return runtime_1.wrap(function _callee13$(_context13) {
6619
7000
  while (1) {
6620
- switch (_context11.prev = _context11.next) {
7001
+ switch (_context13.prev = _context13.next) {
6621
7002
  case 0:
6622
- return _context11.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
7003
+ return _context13.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
6623
7004
 
6624
7005
  case 1:
6625
7006
  case "end":
6626
- return _context11.stop();
7007
+ return _context13.stop();
6627
7008
  }
6628
7009
  }
6629
- }, _callee11, this);
7010
+ }, _callee13, this);
6630
7011
  }));
6631
7012
 
6632
- function stake(_x10) {
7013
+ function stake(_x12) {
6633
7014
  return _stake.apply(this, arguments);
6634
7015
  }
6635
7016
 
@@ -6637,22 +7018,22 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
6637
7018
  }();
6638
7019
 
6639
7020
  _proto2.unstake = /*#__PURE__*/function () {
6640
- var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
6641
- return runtime_1.wrap(function _callee12$(_context12) {
7021
+ var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
7022
+ return runtime_1.wrap(function _callee14$(_context14) {
6642
7023
  while (1) {
6643
- switch (_context12.prev = _context12.next) {
7024
+ switch (_context14.prev = _context14.next) {
6644
7025
  case 0:
6645
- return _context12.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
7026
+ return _context14.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
6646
7027
 
6647
7028
  case 1:
6648
7029
  case "end":
6649
- return _context12.stop();
7030
+ return _context14.stop();
6650
7031
  }
6651
7032
  }
6652
- }, _callee12, this);
7033
+ }, _callee14, this);
6653
7034
  }));
6654
7035
 
6655
- function unstake(_x11) {
7036
+ function unstake(_x13) {
6656
7037
  return _unstake.apply(this, arguments);
6657
7038
  }
6658
7039
 
@@ -6703,6 +7084,8 @@ exports.BORROW_NEAR_REWARDS_PER_WEEK = BORROW_NEAR_REWARDS_PER_WEEK;
6703
7084
  exports.BlockchainEntity = BlockchainEntity;
6704
7085
  exports.BlockchainEntityRead = BlockchainEntityRead;
6705
7086
  exports.BlockchainEntityReadWrite = BlockchainEntityReadWrite;
7087
+ exports.CACHE_TIMEOUT = CACHE_TIMEOUT;
7088
+ exports.Cache = Cache;
6706
7089
  exports.DECIMAL_PRECISION = DECIMAL_PRECISION;
6707
7090
  exports.DEPOSIT_NEAR_REWARDS_PER_WEEK = DEPOSIT_NEAR_REWARDS_PER_WEEK;
6708
7091
  exports.DEPOSIT_ONLY_TOKENS = DEPOSIT_ONLY_TOKENS;
@@ -6744,6 +7127,7 @@ exports.TransferEventQuery = TransferEventQuery;
6744
7127
  exports.abis = index;
6745
7128
  exports.assert = assert;
6746
7129
  exports.calcLMRewardApr = calcLMRewardApr;
7130
+ exports.calcNetApy = calcNetApy;
6747
7131
  exports.calcValuation = calcValuation;
6748
7132
  exports.decimalFactor = decimalFactor;
6749
7133
  exports.decimalRecords = decimalRecords;