@aurigami/sdk 1.19.1 → 1.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.esm.js CHANGED
@@ -3168,48 +3168,44 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3168
3168
  }
3169
3169
  return borrowCap;
3170
3170
  }();
3171
- _proto.getApyWithoutIncentive = /*#__PURE__*/function () {
3172
- var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(userAddress) {
3173
- var _yield$Promise$all10, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
3171
+ _proto.getDepositBorrowValue = /*#__PURE__*/function () {
3172
+ var _getDepositBorrowValue = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(userAddress) {
3173
+ var _yield$Promise$all10, price, depositBalance, borrowBalance, suppliedValue, borrowedValue;
3174
3174
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3175
3175
  while (1) switch (_context20.prev = _context20.next) {
3176
3176
  case 0:
3177
3177
  _context20.next = 2;
3178
- return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
3178
+ return Promise.all([this.getUnderlyingPrice(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
3179
3179
  case 2:
3180
3180
  _yield$Promise$all10 = _context20.sent;
3181
3181
  price = _yield$Promise$all10[0];
3182
- depositApy = _yield$Promise$all10[1];
3183
- borrowApy = _yield$Promise$all10[2];
3184
- depositBalance = _yield$Promise$all10[3];
3185
- borrowBalance = _yield$Promise$all10[4];
3182
+ depositBalance = _yield$Promise$all10[1];
3183
+ borrowBalance = _yield$Promise$all10[2];
3186
3184
  suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
3187
3185
  borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
3188
- sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
3189
3186
  return _context20.abrupt("return", {
3190
- sum: sum,
3191
3187
  suppliedValue: suppliedValue,
3192
3188
  borrowedValue: borrowedValue
3193
3189
  });
3194
- case 12:
3190
+ case 9:
3195
3191
  case "end":
3196
3192
  return _context20.stop();
3197
3193
  }
3198
3194
  }, _callee20, this);
3199
3195
  }));
3200
- function getApyWithoutIncentive(_x3) {
3201
- return _getApyWithoutIncentive.apply(this, arguments);
3196
+ function getDepositBorrowValue(_x3) {
3197
+ return _getDepositBorrowValue.apply(this, arguments);
3202
3198
  }
3203
- return getApyWithoutIncentive;
3199
+ return getDepositBorrowValue;
3204
3200
  }();
3205
- _proto.getApyWithIncentive = /*#__PURE__*/function () {
3206
- var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(userAddress) {
3207
- var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
3201
+ _proto.getApyWithoutIncentive = /*#__PURE__*/function () {
3202
+ var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(userAddress) {
3203
+ var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
3208
3204
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
3209
3205
  while (1) switch (_context21.prev = _context21.next) {
3210
3206
  case 0:
3211
3207
  _context21.next = 2;
3212
- 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()]);
3208
+ return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
3213
3209
  case 2:
3214
3210
  _yield$Promise$all11 = _context21.sent;
3215
3211
  price = _yield$Promise$all11[0];
@@ -3217,32 +3213,66 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3217
3213
  borrowApy = _yield$Promise$all11[2];
3218
3214
  depositBalance = _yield$Promise$all11[3];
3219
3215
  borrowBalance = _yield$Promise$all11[4];
3220
- nearDepositApy = _yield$Promise$all11[5];
3221
- plyDepositApy = _yield$Promise$all11[6];
3222
- metaDepositApy = _yield$Promise$all11[7];
3223
- nearBorrowApy = _yield$Promise$all11[8];
3224
- plyBorrowApy = _yield$Promise$all11[9];
3225
- _context21.next = 15;
3216
+ suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
3217
+ borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
3218
+ sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
3219
+ return _context21.abrupt("return", {
3220
+ sum: sum,
3221
+ suppliedValue: suppliedValue,
3222
+ borrowedValue: borrowedValue
3223
+ });
3224
+ case 12:
3225
+ case "end":
3226
+ return _context21.stop();
3227
+ }
3228
+ }, _callee21, this);
3229
+ }));
3230
+ function getApyWithoutIncentive(_x4) {
3231
+ return _getApyWithoutIncentive.apply(this, arguments);
3232
+ }
3233
+ return getApyWithoutIncentive;
3234
+ }();
3235
+ _proto.getApyWithIncentive = /*#__PURE__*/function () {
3236
+ var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(userAddress) {
3237
+ var _yield$Promise$all12, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
3238
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
3239
+ while (1) switch (_context22.prev = _context22.next) {
3240
+ case 0:
3241
+ _context22.next = 2;
3242
+ 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()]);
3243
+ case 2:
3244
+ _yield$Promise$all12 = _context22.sent;
3245
+ price = _yield$Promise$all12[0];
3246
+ depositApy = _yield$Promise$all12[1];
3247
+ borrowApy = _yield$Promise$all12[2];
3248
+ depositBalance = _yield$Promise$all12[3];
3249
+ borrowBalance = _yield$Promise$all12[4];
3250
+ nearDepositApy = _yield$Promise$all12[5];
3251
+ plyDepositApy = _yield$Promise$all12[6];
3252
+ metaDepositApy = _yield$Promise$all12[7];
3253
+ nearBorrowApy = _yield$Promise$all12[8];
3254
+ plyBorrowApy = _yield$Promise$all12[9];
3255
+ _context22.next = 15;
3226
3256
  return this.getDepositStaderAPY();
3227
3257
  case 15:
3228
- staderDepositApy = _context21.sent;
3258
+ staderDepositApy = _context22.sent;
3229
3259
  suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
3230
3260
  borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
3231
3261
  totalDepositApy = depositApy.plus(nearDepositApy).plus(plyDepositApy).plus(metaDepositApy).plus(staderDepositApy);
3232
3262
  totalBorrowApy = borrowApy.plus(nearBorrowApy).plus(plyBorrowApy);
3233
3263
  sum = calcNetApy(suppliedValue, totalDepositApy, borrowedValue, totalBorrowApy);
3234
- return _context21.abrupt("return", {
3264
+ return _context22.abrupt("return", {
3235
3265
  sum: sum,
3236
3266
  suppliedValue: suppliedValue,
3237
3267
  borrowedValue: borrowedValue
3238
3268
  });
3239
3269
  case 22:
3240
3270
  case "end":
3241
- return _context21.stop();
3271
+ return _context22.stop();
3242
3272
  }
3243
- }, _callee21, this);
3273
+ }, _callee22, this);
3244
3274
  }));
3245
- function getApyWithIncentive(_x4) {
3275
+ function getApyWithIncentive(_x5) {
3246
3276
  return _getApyWithIncentive.apply(this, arguments);
3247
3277
  }
3248
3278
  return getApyWithIncentive;
@@ -3315,112 +3345,112 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3315
3345
  }
3316
3346
  var _proto2 = MoneyMarketReadWrite.prototype;
3317
3347
  _proto2.deposit = /*#__PURE__*/function () {
3318
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(amount) {
3319
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
3320
- while (1) switch (_context22.prev = _context22.next) {
3348
+ var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(amount) {
3349
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3350
+ while (1) switch (_context23.prev = _context23.next) {
3321
3351
  case 0:
3322
3352
  if (!isSameAddress(amount.token.address, ETHAddress)) {
3323
- _context22.next = 4;
3353
+ _context23.next = 4;
3324
3354
  break;
3325
3355
  }
3326
- return _context22.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
3356
+ return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
3327
3357
  value: amount.rawAmount()
3328
3358
  }));
3329
3359
  case 4:
3330
- return _context22.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
3360
+ return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
3331
3361
  case 5:
3332
3362
  case "end":
3333
- return _context22.stop();
3363
+ return _context23.stop();
3334
3364
  }
3335
- }, _callee22, this);
3365
+ }, _callee23, this);
3336
3366
  }));
3337
- function deposit(_x5) {
3367
+ function deposit(_x6) {
3338
3368
  return _deposit.apply(this, arguments);
3339
3369
  }
3340
3370
  return deposit;
3341
3371
  }();
3342
3372
  _proto2.borrow = /*#__PURE__*/function () {
3343
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(amount) {
3344
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
3345
- while (1) switch (_context23.prev = _context23.next) {
3373
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(amount) {
3374
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3375
+ while (1) switch (_context24.prev = _context24.next) {
3346
3376
  case 0:
3347
- return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
3377
+ return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
3348
3378
  case 1:
3349
3379
  case "end":
3350
- return _context23.stop();
3380
+ return _context24.stop();
3351
3381
  }
3352
- }, _callee23, this);
3382
+ }, _callee24, this);
3353
3383
  }));
3354
- function borrow(_x6) {
3384
+ function borrow(_x7) {
3355
3385
  return _borrow.apply(this, arguments);
3356
3386
  }
3357
3387
  return borrow;
3358
3388
  }();
3359
3389
  _proto2.withdraw = /*#__PURE__*/function () {
3360
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(amount) {
3361
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3362
- while (1) switch (_context24.prev = _context24.next) {
3390
+ var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(amount) {
3391
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3392
+ while (1) switch (_context25.prev = _context25.next) {
3363
3393
  case 0:
3364
3394
  if (!new BigNumber(amount.rawAmount()).lt(0)) {
3365
- _context24.next = 2;
3395
+ _context25.next = 2;
3366
3396
  break;
3367
3397
  }
3368
- return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
3398
+ return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
3369
3399
  case 2:
3370
- return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
3400
+ return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
3371
3401
  case 3:
3372
3402
  case "end":
3373
- return _context24.stop();
3403
+ return _context25.stop();
3374
3404
  }
3375
- }, _callee24, this);
3405
+ }, _callee25, this);
3376
3406
  }));
3377
- function withdraw(_x7) {
3407
+ function withdraw(_x8) {
3378
3408
  return _withdraw.apply(this, arguments);
3379
3409
  }
3380
3410
  return withdraw;
3381
3411
  }();
3382
3412
  _proto2.repay = /*#__PURE__*/function () {
3383
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(amount) {
3384
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3385
- while (1) switch (_context25.prev = _context25.next) {
3413
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(amount) {
3414
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3415
+ while (1) switch (_context26.prev = _context26.next) {
3386
3416
  case 0:
3387
3417
  if (!isSameAddress(amount.token.address, ETHAddress)) {
3388
- _context25.next = 4;
3418
+ _context26.next = 4;
3389
3419
  break;
3390
3420
  }
3391
- return _context25.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
3421
+ return _context26.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
3392
3422
  value: amount.rawAmount()
3393
3423
  }));
3394
3424
  case 4:
3395
3425
  if (!new BigNumber(amount.rawAmount()).lt(0)) {
3396
- _context25.next = 8;
3426
+ _context26.next = 8;
3397
3427
  break;
3398
3428
  }
3399
- return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
3429
+ return _context26.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
3400
3430
  case 8:
3401
- return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
3431
+ return _context26.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
3402
3432
  case 9:
3403
3433
  case "end":
3404
- return _context25.stop();
3434
+ return _context26.stop();
3405
3435
  }
3406
- }, _callee25, this);
3436
+ }, _callee26, this);
3407
3437
  }));
3408
- function repay(_x8) {
3438
+ function repay(_x9) {
3409
3439
  return _repay.apply(this, arguments);
3410
3440
  }
3411
3441
  return repay;
3412
3442
  }();
3413
3443
  _proto2.enableCollateral = /*#__PURE__*/function () {
3414
- var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3415
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3416
- while (1) switch (_context26.prev = _context26.next) {
3444
+ var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3445
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3446
+ while (1) switch (_context27.prev = _context27.next) {
3417
3447
  case 0:
3418
- return _context26.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
3448
+ return _context27.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
3419
3449
  case 1:
3420
3450
  case "end":
3421
- return _context26.stop();
3451
+ return _context27.stop();
3422
3452
  }
3423
- }, _callee26, this);
3453
+ }, _callee27, this);
3424
3454
  }));
3425
3455
  function enableCollateral() {
3426
3456
  return _enableCollateral.apply(this, arguments);
@@ -3428,16 +3458,16 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3428
3458
  return enableCollateral;
3429
3459
  }();
3430
3460
  _proto2.disableCollateral = /*#__PURE__*/function () {
3431
- var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3432
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3433
- while (1) switch (_context27.prev = _context27.next) {
3461
+ var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
3462
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3463
+ while (1) switch (_context28.prev = _context28.next) {
3434
3464
  case 0:
3435
- return _context27.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
3465
+ return _context28.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
3436
3466
  case 1:
3437
3467
  case "end":
3438
- return _context27.stop();
3468
+ return _context28.stop();
3439
3469
  }
3440
- }, _callee27, this);
3470
+ }, _callee28, this);
3441
3471
  }));
3442
3472
  function disableCollateral() {
3443
3473
  return _disableCollateral.apply(this, arguments);
@@ -5419,25 +5449,123 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5419
5449
  }
5420
5450
  return sneakAccounts;
5421
5451
  }();
5422
- _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
5423
- var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(userAddress) {
5452
+ _proto.getLTVAndLiquidationThreshold = /*#__PURE__*/function () {
5453
+ var _getLTVAndLiquidationThreshold = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(userAddr) {
5424
5454
  var _this3 = this;
5455
+ var totalSuppliedValue, totalBorrowedValue, collateralValue, assetsIn, marketValues, _loop2, i, ltv, liquidationThreshold;
5456
+ return _regeneratorRuntime().wrap(function _callee9$(_context11) {
5457
+ while (1) switch (_context11.prev = _context11.next) {
5458
+ case 0:
5459
+ totalSuppliedValue = new BigNumber(0);
5460
+ totalBorrowedValue = new BigNumber(0);
5461
+ collateralValue = new BigNumber(0);
5462
+ _context11.next = 5;
5463
+ return this.env.comptroller.getAssetsIn(userAddr);
5464
+ case 5:
5465
+ assetsIn = _context11.sent;
5466
+ _context11.next = 8;
5467
+ return Promise.all(networkAddresses.auTokens.map( /*#__PURE__*/function () {
5468
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(auToken) {
5469
+ var moneyMarket;
5470
+ return _regeneratorRuntime().wrap(function _callee7$(_context8) {
5471
+ while (1) switch (_context8.prev = _context8.next) {
5472
+ case 0:
5473
+ moneyMarket = new MoneyMarketRead(_this3._networkConnection, auToken.address, auToken.underlying);
5474
+ return _context8.abrupt("return", Promise.all([moneyMarket.getCollateralRatio(), moneyMarket.getDepositBorrowValue(userAddr)]));
5475
+ case 2:
5476
+ case "end":
5477
+ return _context8.stop();
5478
+ }
5479
+ }, _callee7);
5480
+ }));
5481
+ return function (_x9) {
5482
+ return _ref2.apply(this, arguments);
5483
+ };
5484
+ }()));
5485
+ case 8:
5486
+ marketValues = _context11.sent;
5487
+ networkAddresses.auTokens.forEach( /*#__PURE__*/function () {
5488
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(auToken, i) {
5489
+ return _regeneratorRuntime().wrap(function _callee8$(_context9) {
5490
+ while (1) switch (_context9.prev = _context9.next) {
5491
+ case 0:
5492
+ case "end":
5493
+ return _context9.stop();
5494
+ }
5495
+ }, _callee8);
5496
+ }));
5497
+ return function (_x10, _x11) {
5498
+ return _ref3.apply(this, arguments);
5499
+ };
5500
+ }());
5501
+ _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
5502
+ var auToken, _marketValues$i, collateralRatio, depositBorrowValue;
5503
+ return _regeneratorRuntime().wrap(function _loop2$(_context10) {
5504
+ while (1) switch (_context10.prev = _context10.next) {
5505
+ case 0:
5506
+ auToken = networkAddresses.auTokens[i];
5507
+ _marketValues$i = marketValues[i], collateralRatio = _marketValues$i[0], depositBorrowValue = _marketValues$i[1];
5508
+ if (assetsIn.find(function (auAddress) {
5509
+ return isSameAddress(auToken.address, auAddress);
5510
+ }) !== undefined) {
5511
+ totalSuppliedValue = totalSuppliedValue.plus(depositBorrowValue.suppliedValue);
5512
+ collateralValue = collateralValue.plus(depositBorrowValue.suppliedValue.times(collateralRatio));
5513
+ }
5514
+ totalBorrowedValue = totalBorrowedValue.plus(depositBorrowValue.borrowedValue);
5515
+ case 4:
5516
+ case "end":
5517
+ return _context10.stop();
5518
+ }
5519
+ }, _loop2);
5520
+ });
5521
+ i = 0;
5522
+ case 12:
5523
+ if (!(i < marketValues.length)) {
5524
+ _context11.next = 17;
5525
+ break;
5526
+ }
5527
+ return _context11.delegateYield(_loop2(), "t0", 14);
5528
+ case 14:
5529
+ i++;
5530
+ _context11.next = 12;
5531
+ break;
5532
+ case 17:
5533
+ ltv = totalBorrowedValue.div(totalSuppliedValue);
5534
+ liquidationThreshold = collateralValue.div(totalSuppliedValue);
5535
+ return _context11.abrupt("return", {
5536
+ ltv: ltv,
5537
+ liquidationThreshold: liquidationThreshold
5538
+ });
5539
+ case 20:
5540
+ case "end":
5541
+ return _context11.stop();
5542
+ }
5543
+ }, _callee9, this);
5544
+ }));
5545
+ function getLTVAndLiquidationThreshold(_x8) {
5546
+ return _getLTVAndLiquidationThreshold.apply(this, arguments);
5547
+ }
5548
+ return getLTVAndLiquidationThreshold;
5549
+ }();
5550
+ _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
5551
+ var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(userAddress) {
5552
+ var _this4 = this;
5425
5553
  var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator3, _step3, apy;
5426
- return _regeneratorRuntime().wrap(function _callee7$(_context8) {
5427
- while (1) switch (_context8.prev = _context8.next) {
5554
+ return _regeneratorRuntime().wrap(function _callee10$(_context12) {
5555
+ while (1) switch (_context12.prev = _context12.next) {
5428
5556
  case 0:
5429
5557
  sum = new BigNumber(0);
5430
5558
  totalSuppliedValue = new BigNumber(0);
5431
5559
  totalBorrowedValue = new BigNumber(0);
5432
5560
  netApy = new BigNumber(0);
5433
- _context8.next = 6;
5561
+ _context12.next = 6;
5434
5562
  return Promise.all(networkAddresses.auTokens.map(function (auToken) {
5435
- var moneyMarket = new MoneyMarketRead(_this3._networkConnection, auToken.address, auToken.underlying);
5563
+ var moneyMarket = new MoneyMarketRead(_this4._networkConnection, auToken.address, auToken.underlying);
5436
5564
  var apyWithoutIncentive = moneyMarket.getApyWithoutIncentive(userAddress);
5437
5565
  return apyWithoutIncentive;
5438
5566
  }));
5439
5567
  case 6:
5440
- apys = _context8.sent;
5568
+ apys = _context12.sent;
5441
5569
  for (_iterator3 = _createForOfIteratorHelperLoose(apys); !(_step3 = _iterator3()).done;) {
5442
5570
  apy = _step3.value;
5443
5571
  sum = sum.plus(apy.sum);
@@ -5449,37 +5577,37 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5449
5577
  } else if (sum.lt(0)) {
5450
5578
  netApy = sum.div(totalBorrowedValue);
5451
5579
  }
5452
- return _context8.abrupt("return", netApy);
5580
+ return _context12.abrupt("return", netApy);
5453
5581
  case 10:
5454
5582
  case "end":
5455
- return _context8.stop();
5583
+ return _context12.stop();
5456
5584
  }
5457
- }, _callee7);
5585
+ }, _callee10);
5458
5586
  }));
5459
- function getNetApyWithoutIncentive(_x8) {
5587
+ function getNetApyWithoutIncentive(_x12) {
5460
5588
  return _getNetApyWithoutIncentive.apply(this, arguments);
5461
5589
  }
5462
5590
  return getNetApyWithoutIncentive;
5463
5591
  }();
5464
5592
  _proto.getNetApyWithIncentive = /*#__PURE__*/function () {
5465
- var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(userAddress) {
5466
- var _this4 = this;
5593
+ var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(userAddress) {
5594
+ var _this5 = this;
5467
5595
  var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator4, _step4, apy;
5468
- return _regeneratorRuntime().wrap(function _callee8$(_context9) {
5469
- while (1) switch (_context9.prev = _context9.next) {
5596
+ return _regeneratorRuntime().wrap(function _callee11$(_context13) {
5597
+ while (1) switch (_context13.prev = _context13.next) {
5470
5598
  case 0:
5471
5599
  sum = new BigNumber(0);
5472
5600
  totalSuppliedValue = new BigNumber(0);
5473
5601
  totalBorrowedValue = new BigNumber(0);
5474
5602
  netApy = new BigNumber(0);
5475
- _context9.next = 6;
5603
+ _context13.next = 6;
5476
5604
  return Promise.all(networkAddresses.auTokens.map(function (auToken) {
5477
- var moneyMarket = new MoneyMarketRead(_this4._networkConnection, auToken.address, auToken.underlying);
5605
+ var moneyMarket = new MoneyMarketRead(_this5._networkConnection, auToken.address, auToken.underlying);
5478
5606
  var apyWithIncentive = moneyMarket.getApyWithIncentive(userAddress);
5479
5607
  return apyWithIncentive;
5480
5608
  }));
5481
5609
  case 6:
5482
- apys = _context9.sent;
5610
+ apys = _context13.sent;
5483
5611
  for (_iterator4 = _createForOfIteratorHelperLoose(apys); !(_step4 = _iterator4()).done;) {
5484
5612
  apy = _step4.value;
5485
5613
  sum = sum.plus(apy.sum);
@@ -5491,14 +5619,14 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5491
5619
  } else if (sum.lt(0)) {
5492
5620
  netApy = sum.div(totalBorrowedValue);
5493
5621
  }
5494
- return _context9.abrupt("return", netApy);
5622
+ return _context13.abrupt("return", netApy);
5495
5623
  case 10:
5496
5624
  case "end":
5497
- return _context9.stop();
5625
+ return _context13.stop();
5498
5626
  }
5499
- }, _callee8);
5627
+ }, _callee11);
5500
5628
  }));
5501
- function getNetApyWithIncentive(_x9) {
5629
+ function getNetApyWithIncentive(_x13) {
5502
5630
  return _getNetApyWithIncentive.apply(this, arguments);
5503
5631
  }
5504
5632
  return getNetApyWithIncentive;
@@ -5819,49 +5947,62 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5819
5947
  }
5820
5948
  return sneakAccounts;
5821
5949
  }();
5822
- _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
5823
- var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(userAddress) {
5824
- var miscRead;
5950
+ _proto.getLTVAndLiquidationThreshold = /*#__PURE__*/function () {
5951
+ var _getLTVAndLiquidationThreshold = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(userAddr) {
5825
5952
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
5826
5953
  while (1) switch (_context10.prev = _context10.next) {
5827
5954
  case 0:
5828
- miscRead = new MiscRead(this._networkConnection);
5829
- return _context10.abrupt("return", miscRead.getNetApyWithoutIncentive(userAddress));
5830
- case 2:
5955
+ return _context10.abrupt("return", this._misc.getLTVAndLiquidationThreshold(userAddr));
5956
+ case 1:
5831
5957
  case "end":
5832
5958
  return _context10.stop();
5833
5959
  }
5834
5960
  }, _callee10, this);
5835
5961
  }));
5836
- function getNetApyWithoutIncentive(_x10) {
5837
- return _getNetApyWithoutIncentive.apply(this, arguments);
5962
+ function getLTVAndLiquidationThreshold(_x10) {
5963
+ return _getLTVAndLiquidationThreshold.apply(this, arguments);
5838
5964
  }
5839
- return getNetApyWithoutIncentive;
5965
+ return getLTVAndLiquidationThreshold;
5840
5966
  }();
5841
- _proto.getNetApyWithIncentive = /*#__PURE__*/function () {
5842
- var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(userAddress) {
5843
- var miscRead;
5967
+ _proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
5968
+ var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(userAddress) {
5844
5969
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
5845
5970
  while (1) switch (_context11.prev = _context11.next) {
5846
5971
  case 0:
5847
- miscRead = new MiscRead(this._networkConnection);
5848
- return _context11.abrupt("return", miscRead.getNetApyWithIncentive(userAddress));
5849
- case 2:
5972
+ return _context11.abrupt("return", this._misc.getNetApyWithoutIncentive(userAddress));
5973
+ case 1:
5850
5974
  case "end":
5851
5975
  return _context11.stop();
5852
5976
  }
5853
5977
  }, _callee11, this);
5854
5978
  }));
5855
- function getNetApyWithIncentive(_x11) {
5979
+ function getNetApyWithoutIncentive(_x11) {
5980
+ return _getNetApyWithoutIncentive.apply(this, arguments);
5981
+ }
5982
+ return getNetApyWithoutIncentive;
5983
+ }();
5984
+ _proto.getNetApyWithIncentive = /*#__PURE__*/function () {
5985
+ var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(userAddress) {
5986
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
5987
+ while (1) switch (_context12.prev = _context12.next) {
5988
+ case 0:
5989
+ return _context12.abrupt("return", this._misc.getNetApyWithIncentive(userAddress));
5990
+ case 1:
5991
+ case "end":
5992
+ return _context12.stop();
5993
+ }
5994
+ }, _callee12, this);
5995
+ }));
5996
+ function getNetApyWithIncentive(_x12) {
5856
5997
  return _getNetApyWithIncentive.apply(this, arguments);
5857
5998
  }
5858
5999
  return getNetApyWithIncentive;
5859
6000
  }();
5860
6001
  _proto.setUserNotificationSettings = /*#__PURE__*/function () {
5861
- var _setUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, mail, utilisation, liquidation, captchaResponse) {
6002
+ var _setUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(address, mail, utilisation, liquidation, captchaResponse) {
5862
6003
  var body, response;
5863
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
5864
- while (1) switch (_context12.prev = _context12.next) {
6004
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
6005
+ while (1) switch (_context13.prev = _context13.next) {
5865
6006
  case 0:
5866
6007
  body = {
5867
6008
  address: address,
@@ -5872,27 +6013,27 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5872
6013
  },
5873
6014
  captchaResponse: captchaResponse
5874
6015
  };
5875
- _context12.next = 3;
6016
+ _context13.next = 3;
5876
6017
  return postApi('alert-setting/set', body);
5877
6018
  case 3:
5878
- response = _context12.sent;
5879
- return _context12.abrupt("return", response);
6019
+ response = _context13.sent;
6020
+ return _context13.abrupt("return", response);
5880
6021
  case 5:
5881
6022
  case "end":
5882
- return _context12.stop();
6023
+ return _context13.stop();
5883
6024
  }
5884
- }, _callee12);
6025
+ }, _callee13);
5885
6026
  }));
5886
- function setUserNotificationSettings(_x12, _x13, _x14, _x15, _x16) {
6027
+ function setUserNotificationSettings(_x13, _x14, _x15, _x16, _x17) {
5887
6028
  return _setUserNotificationSettings.apply(this, arguments);
5888
6029
  }
5889
6030
  return setUserNotificationSettings;
5890
6031
  }();
5891
6032
  _proto.unsetUserNotificationSettings = /*#__PURE__*/function () {
5892
- var _unsetUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(address, captchaResponse) {
6033
+ var _unsetUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, captchaResponse) {
5893
6034
  var body, response;
5894
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
5895
- while (1) switch (_context13.prev = _context13.next) {
6035
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
6036
+ while (1) switch (_context14.prev = _context14.next) {
5896
6037
  case 0:
5897
6038
  body = {
5898
6039
  address: address,
@@ -5903,57 +6044,57 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5903
6044
  },
5904
6045
  captchaResponse: captchaResponse
5905
6046
  };
5906
- _context13.next = 3;
6047
+ _context14.next = 3;
5907
6048
  return postApi('alert-setting/set', body);
5908
6049
  case 3:
5909
- response = _context13.sent;
5910
- return _context13.abrupt("return", response);
6050
+ response = _context14.sent;
6051
+ return _context14.abrupt("return", response);
5911
6052
  case 5:
5912
6053
  case "end":
5913
- return _context13.stop();
6054
+ return _context14.stop();
5914
6055
  }
5915
- }, _callee13);
6056
+ }, _callee14);
5916
6057
  }));
5917
- function unsetUserNotificationSettings(_x17, _x18) {
6058
+ function unsetUserNotificationSettings(_x18, _x19) {
5918
6059
  return _unsetUserNotificationSettings.apply(this, arguments);
5919
6060
  }
5920
6061
  return unsetUserNotificationSettings;
5921
6062
  }();
5922
6063
  _proto.getUserNotificationSettings = /*#__PURE__*/function () {
5923
- var _getUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(addresses) {
6064
+ var _getUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(addresses) {
5924
6065
  var body, response;
5925
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
5926
- while (1) switch (_context14.prev = _context14.next) {
6066
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
6067
+ while (1) switch (_context15.prev = _context15.next) {
5927
6068
  case 0:
5928
6069
  body = {
5929
6070
  addresses: addresses
5930
6071
  };
5931
- _context14.next = 3;
6072
+ _context15.next = 3;
5932
6073
  return postApi('alert-setting/get-user-setting', body);
5933
6074
  case 3:
5934
- response = _context14.sent;
5935
- return _context14.abrupt("return", response);
6075
+ response = _context15.sent;
6076
+ return _context15.abrupt("return", response);
5936
6077
  case 5:
5937
6078
  case "end":
5938
- return _context14.stop();
6079
+ return _context15.stop();
5939
6080
  }
5940
- }, _callee14);
6081
+ }, _callee15);
5941
6082
  }));
5942
- function getUserNotificationSettings(_x19) {
6083
+ function getUserNotificationSettings(_x20) {
5943
6084
  return _getUserNotificationSettings.apply(this, arguments);
5944
6085
  }
5945
6086
  return getUserNotificationSettings;
5946
6087
  }();
5947
6088
  _proto.getLiquidationHistory = /*#__PURE__*/function () {
5948
- var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(address) {
6089
+ var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(address) {
5949
6090
  var liquidationHistorySubgraph, liquidationEvents;
5950
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
5951
- while (1) switch (_context15.prev = _context15.next) {
6091
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
6092
+ while (1) switch (_context16.prev = _context16.next) {
5952
6093
  case 0:
5953
- _context15.next = 2;
6094
+ _context16.next = 2;
5954
6095
  return queryGraphQL(getLiquidationEventsQuery(address, 100), AURIGAMI_SUBGRAPH_URL);
5955
6096
  case 2:
5956
- liquidationHistorySubgraph = _context15.sent;
6097
+ liquidationHistorySubgraph = _context16.sent;
5957
6098
  liquidationEvents = liquidationHistorySubgraph.liquidationEvents.map(function (event) {
5958
6099
  var value = {
5959
6100
  amount: event.underlyingRepayAmountUSD.toString(),
@@ -5972,14 +6113,14 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
5972
6113
  transactionId: event.id.split('-')[0]
5973
6114
  };
5974
6115
  });
5975
- return _context15.abrupt("return", liquidationEvents);
6116
+ return _context16.abrupt("return", liquidationEvents);
5976
6117
  case 5:
5977
6118
  case "end":
5978
- return _context15.stop();
6119
+ return _context16.stop();
5979
6120
  }
5980
- }, _callee15);
6121
+ }, _callee16);
5981
6122
  }));
5982
- function getLiquidationHistory(_x20) {
6123
+ function getLiquidationHistory(_x21) {
5983
6124
  return _getLiquidationHistory.apply(this, arguments);
5984
6125
  }
5985
6126
  return getLiquidationHistory;
@@ -6001,16 +6142,16 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
6001
6142
  _proto2.claim =
6002
6143
  /*#__PURE__*/
6003
6144
  function () {
6004
- var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
6005
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
6006
- while (1) switch (_context16.prev = _context16.next) {
6145
+ var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
6146
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
6147
+ while (1) switch (_context17.prev = _context17.next) {
6007
6148
  case 0:
6008
- return _context16.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
6149
+ return _context17.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
6009
6150
  case 1:
6010
6151
  case "end":
6011
- return _context16.stop();
6152
+ return _context17.stop();
6012
6153
  }
6013
- }, _callee16, this);
6154
+ }, _callee17, this);
6014
6155
  }));
6015
6156
  function claim() {
6016
6157
  return _claim.apply(this, arguments);
@@ -6018,35 +6159,35 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
6018
6159
  return claim;
6019
6160
  }();
6020
6161
  _proto2.stake = /*#__PURE__*/function () {
6021
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(amount) {
6022
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
6023
- while (1) switch (_context17.prev = _context17.next) {
6162
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(amount) {
6163
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
6164
+ while (1) switch (_context18.prev = _context18.next) {
6024
6165
  case 0:
6025
- return _context17.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
6166
+ return _context18.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
6026
6167
  case 1:
6027
6168
  case "end":
6028
- return _context17.stop();
6169
+ return _context18.stop();
6029
6170
  }
6030
- }, _callee17, this);
6171
+ }, _callee18, this);
6031
6172
  }));
6032
- function stake(_x21) {
6173
+ function stake(_x22) {
6033
6174
  return _stake.apply(this, arguments);
6034
6175
  }
6035
6176
  return stake;
6036
6177
  }();
6037
6178
  _proto2.unstake = /*#__PURE__*/function () {
6038
- var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(amount) {
6039
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
6040
- while (1) switch (_context18.prev = _context18.next) {
6179
+ var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(amount) {
6180
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
6181
+ while (1) switch (_context19.prev = _context19.next) {
6041
6182
  case 0:
6042
- return _context18.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
6183
+ return _context19.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
6043
6184
  case 1:
6044
6185
  case "end":
6045
- return _context18.stop();
6186
+ return _context19.stop();
6046
6187
  }
6047
- }, _callee18, this);
6188
+ }, _callee19, this);
6048
6189
  }));
6049
- function unstake(_x22) {
6190
+ function unstake(_x23) {
6050
6191
  return _unstake.apply(this, arguments);
6051
6192
  }
6052
6193
  return unstake;