@aurigami/sdk 1.19.1 → 1.19.3
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.d.ts +4 -0
- package/dist/interactors/MoneyMarket.d.ts +4 -0
- package/dist/interactors/misc.d.ts +4 -0
- package/dist/sdk.cjs.development.js +335 -179
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +335 -179
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +6 -4
- package/src/interactors/MoneyMarket.ts +14 -0
- package/src/interactors/Staking.ts +13 -5
- package/src/interactors/misc.ts +41 -0
|
@@ -3173,48 +3173,44 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3173
3173
|
}
|
|
3174
3174
|
return borrowCap;
|
|
3175
3175
|
}();
|
|
3176
|
-
_proto.
|
|
3177
|
-
var
|
|
3178
|
-
var _yield$Promise$all10, price,
|
|
3176
|
+
_proto.getDepositBorrowValue = /*#__PURE__*/function () {
|
|
3177
|
+
var _getDepositBorrowValue = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(userAddress) {
|
|
3178
|
+
var _yield$Promise$all10, price, depositBalance, borrowBalance, suppliedValue, borrowedValue;
|
|
3179
3179
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
3180
3180
|
while (1) switch (_context20.prev = _context20.next) {
|
|
3181
3181
|
case 0:
|
|
3182
3182
|
_context20.next = 2;
|
|
3183
|
-
return Promise.all([this.getUnderlyingPrice(), this.
|
|
3183
|
+
return Promise.all([this.getUnderlyingPrice(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3184
3184
|
case 2:
|
|
3185
3185
|
_yield$Promise$all10 = _context20.sent;
|
|
3186
3186
|
price = _yield$Promise$all10[0];
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
depositBalance = _yield$Promise$all10[3];
|
|
3190
|
-
borrowBalance = _yield$Promise$all10[4];
|
|
3187
|
+
depositBalance = _yield$Promise$all10[1];
|
|
3188
|
+
borrowBalance = _yield$Promise$all10[2];
|
|
3191
3189
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3192
3190
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3193
|
-
sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
|
|
3194
3191
|
return _context20.abrupt("return", {
|
|
3195
|
-
sum: sum,
|
|
3196
3192
|
suppliedValue: suppliedValue,
|
|
3197
3193
|
borrowedValue: borrowedValue
|
|
3198
3194
|
});
|
|
3199
|
-
case
|
|
3195
|
+
case 9:
|
|
3200
3196
|
case "end":
|
|
3201
3197
|
return _context20.stop();
|
|
3202
3198
|
}
|
|
3203
3199
|
}, _callee20, this);
|
|
3204
3200
|
}));
|
|
3205
|
-
function
|
|
3206
|
-
return
|
|
3201
|
+
function getDepositBorrowValue(_x3) {
|
|
3202
|
+
return _getDepositBorrowValue.apply(this, arguments);
|
|
3207
3203
|
}
|
|
3208
|
-
return
|
|
3204
|
+
return getDepositBorrowValue;
|
|
3209
3205
|
}();
|
|
3210
|
-
_proto.
|
|
3211
|
-
var
|
|
3212
|
-
var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance,
|
|
3206
|
+
_proto.getApyWithoutIncentive = /*#__PURE__*/function () {
|
|
3207
|
+
var _getApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(userAddress) {
|
|
3208
|
+
var _yield$Promise$all11, price, depositApy, borrowApy, depositBalance, borrowBalance, suppliedValue, borrowedValue, sum;
|
|
3213
3209
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
3214
3210
|
while (1) switch (_context21.prev = _context21.next) {
|
|
3215
3211
|
case 0:
|
|
3216
3212
|
_context21.next = 2;
|
|
3217
|
-
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)
|
|
3213
|
+
return Promise.all([this.getUnderlyingPrice(), this.getDepositAPY(), this.getBorrowAPY(), this.getUserDepositBalance(userAddress), this.getUserBorrowBalance(userAddress)]);
|
|
3218
3214
|
case 2:
|
|
3219
3215
|
_yield$Promise$all11 = _context21.sent;
|
|
3220
3216
|
price = _yield$Promise$all11[0];
|
|
@@ -3222,32 +3218,66 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3222
3218
|
borrowApy = _yield$Promise$all11[2];
|
|
3223
3219
|
depositBalance = _yield$Promise$all11[3];
|
|
3224
3220
|
borrowBalance = _yield$Promise$all11[4];
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3221
|
+
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3222
|
+
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3223
|
+
sum = calcNetApy(suppliedValue, depositApy, borrowedValue, borrowApy);
|
|
3224
|
+
return _context21.abrupt("return", {
|
|
3225
|
+
sum: sum,
|
|
3226
|
+
suppliedValue: suppliedValue,
|
|
3227
|
+
borrowedValue: borrowedValue
|
|
3228
|
+
});
|
|
3229
|
+
case 12:
|
|
3230
|
+
case "end":
|
|
3231
|
+
return _context21.stop();
|
|
3232
|
+
}
|
|
3233
|
+
}, _callee21, this);
|
|
3234
|
+
}));
|
|
3235
|
+
function getApyWithoutIncentive(_x4) {
|
|
3236
|
+
return _getApyWithoutIncentive.apply(this, arguments);
|
|
3237
|
+
}
|
|
3238
|
+
return getApyWithoutIncentive;
|
|
3239
|
+
}();
|
|
3240
|
+
_proto.getApyWithIncentive = /*#__PURE__*/function () {
|
|
3241
|
+
var _getApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(userAddress) {
|
|
3242
|
+
var _yield$Promise$all12, price, depositApy, borrowApy, depositBalance, borrowBalance, nearDepositApy, plyDepositApy, metaDepositApy, nearBorrowApy, plyBorrowApy, staderDepositApy, suppliedValue, borrowedValue, totalDepositApy, totalBorrowApy, sum;
|
|
3243
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
3244
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
3245
|
+
case 0:
|
|
3246
|
+
_context22.next = 2;
|
|
3247
|
+
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()]);
|
|
3248
|
+
case 2:
|
|
3249
|
+
_yield$Promise$all12 = _context22.sent;
|
|
3250
|
+
price = _yield$Promise$all12[0];
|
|
3251
|
+
depositApy = _yield$Promise$all12[1];
|
|
3252
|
+
borrowApy = _yield$Promise$all12[2];
|
|
3253
|
+
depositBalance = _yield$Promise$all12[3];
|
|
3254
|
+
borrowBalance = _yield$Promise$all12[4];
|
|
3255
|
+
nearDepositApy = _yield$Promise$all12[5];
|
|
3256
|
+
plyDepositApy = _yield$Promise$all12[6];
|
|
3257
|
+
metaDepositApy = _yield$Promise$all12[7];
|
|
3258
|
+
nearBorrowApy = _yield$Promise$all12[8];
|
|
3259
|
+
plyBorrowApy = _yield$Promise$all12[9];
|
|
3260
|
+
_context22.next = 15;
|
|
3231
3261
|
return this.getDepositStaderAPY();
|
|
3232
3262
|
case 15:
|
|
3233
|
-
staderDepositApy =
|
|
3263
|
+
staderDepositApy = _context22.sent;
|
|
3234
3264
|
suppliedValue = price.multipliedBy(depositBalance.formattedAmount());
|
|
3235
3265
|
borrowedValue = price.multipliedBy(borrowBalance.formattedAmount());
|
|
3236
3266
|
totalDepositApy = depositApy.plus(nearDepositApy).plus(plyDepositApy).plus(metaDepositApy).plus(staderDepositApy);
|
|
3237
3267
|
totalBorrowApy = borrowApy.plus(nearBorrowApy).plus(plyBorrowApy);
|
|
3238
3268
|
sum = calcNetApy(suppliedValue, totalDepositApy, borrowedValue, totalBorrowApy);
|
|
3239
|
-
return
|
|
3269
|
+
return _context22.abrupt("return", {
|
|
3240
3270
|
sum: sum,
|
|
3241
3271
|
suppliedValue: suppliedValue,
|
|
3242
3272
|
borrowedValue: borrowedValue
|
|
3243
3273
|
});
|
|
3244
3274
|
case 22:
|
|
3245
3275
|
case "end":
|
|
3246
|
-
return
|
|
3276
|
+
return _context22.stop();
|
|
3247
3277
|
}
|
|
3248
|
-
},
|
|
3278
|
+
}, _callee22, this);
|
|
3249
3279
|
}));
|
|
3250
|
-
function getApyWithIncentive(
|
|
3280
|
+
function getApyWithIncentive(_x5) {
|
|
3251
3281
|
return _getApyWithIncentive.apply(this, arguments);
|
|
3252
3282
|
}
|
|
3253
3283
|
return getApyWithIncentive;
|
|
@@ -3320,112 +3350,112 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3320
3350
|
}
|
|
3321
3351
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
3322
3352
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
3323
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3324
|
-
return _regeneratorRuntime().wrap(function
|
|
3325
|
-
while (1) switch (
|
|
3353
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(amount) {
|
|
3354
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
3355
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
3326
3356
|
case 0:
|
|
3327
3357
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
3328
|
-
|
|
3358
|
+
_context23.next = 4;
|
|
3329
3359
|
break;
|
|
3330
3360
|
}
|
|
3331
|
-
return
|
|
3361
|
+
return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
3332
3362
|
value: amount.rawAmount()
|
|
3333
3363
|
}));
|
|
3334
3364
|
case 4:
|
|
3335
|
-
return
|
|
3365
|
+
return _context23.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
3336
3366
|
case 5:
|
|
3337
3367
|
case "end":
|
|
3338
|
-
return
|
|
3368
|
+
return _context23.stop();
|
|
3339
3369
|
}
|
|
3340
|
-
},
|
|
3370
|
+
}, _callee23, this);
|
|
3341
3371
|
}));
|
|
3342
|
-
function deposit(
|
|
3372
|
+
function deposit(_x6) {
|
|
3343
3373
|
return _deposit.apply(this, arguments);
|
|
3344
3374
|
}
|
|
3345
3375
|
return deposit;
|
|
3346
3376
|
}();
|
|
3347
3377
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
3348
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3349
|
-
return _regeneratorRuntime().wrap(function
|
|
3350
|
-
while (1) switch (
|
|
3378
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(amount) {
|
|
3379
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
3380
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
3351
3381
|
case 0:
|
|
3352
|
-
return
|
|
3382
|
+
return _context24.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
3353
3383
|
case 1:
|
|
3354
3384
|
case "end":
|
|
3355
|
-
return
|
|
3385
|
+
return _context24.stop();
|
|
3356
3386
|
}
|
|
3357
|
-
},
|
|
3387
|
+
}, _callee24, this);
|
|
3358
3388
|
}));
|
|
3359
|
-
function borrow(
|
|
3389
|
+
function borrow(_x7) {
|
|
3360
3390
|
return _borrow.apply(this, arguments);
|
|
3361
3391
|
}
|
|
3362
3392
|
return borrow;
|
|
3363
3393
|
}();
|
|
3364
3394
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
3365
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3366
|
-
return _regeneratorRuntime().wrap(function
|
|
3367
|
-
while (1) switch (
|
|
3395
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(amount) {
|
|
3396
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
3397
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
3368
3398
|
case 0:
|
|
3369
3399
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
3370
|
-
|
|
3400
|
+
_context25.next = 2;
|
|
3371
3401
|
break;
|
|
3372
3402
|
}
|
|
3373
|
-
return
|
|
3403
|
+
return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
|
|
3374
3404
|
case 2:
|
|
3375
|
-
return
|
|
3405
|
+
return _context25.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
3376
3406
|
case 3:
|
|
3377
3407
|
case "end":
|
|
3378
|
-
return
|
|
3408
|
+
return _context25.stop();
|
|
3379
3409
|
}
|
|
3380
|
-
},
|
|
3410
|
+
}, _callee25, this);
|
|
3381
3411
|
}));
|
|
3382
|
-
function withdraw(
|
|
3412
|
+
function withdraw(_x8) {
|
|
3383
3413
|
return _withdraw.apply(this, arguments);
|
|
3384
3414
|
}
|
|
3385
3415
|
return withdraw;
|
|
3386
3416
|
}();
|
|
3387
3417
|
_proto2.repay = /*#__PURE__*/function () {
|
|
3388
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3389
|
-
return _regeneratorRuntime().wrap(function
|
|
3390
|
-
while (1) switch (
|
|
3418
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(amount) {
|
|
3419
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
3420
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
3391
3421
|
case 0:
|
|
3392
3422
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
3393
|
-
|
|
3423
|
+
_context26.next = 4;
|
|
3394
3424
|
break;
|
|
3395
3425
|
}
|
|
3396
|
-
return
|
|
3426
|
+
return _context26.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
|
|
3397
3427
|
value: amount.rawAmount()
|
|
3398
3428
|
}));
|
|
3399
3429
|
case 4:
|
|
3400
3430
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
3401
|
-
|
|
3431
|
+
_context26.next = 8;
|
|
3402
3432
|
break;
|
|
3403
3433
|
}
|
|
3404
|
-
return
|
|
3434
|
+
return _context26.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
|
|
3405
3435
|
case 8:
|
|
3406
|
-
return
|
|
3436
|
+
return _context26.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
3407
3437
|
case 9:
|
|
3408
3438
|
case "end":
|
|
3409
|
-
return
|
|
3439
|
+
return _context26.stop();
|
|
3410
3440
|
}
|
|
3411
|
-
},
|
|
3441
|
+
}, _callee26, this);
|
|
3412
3442
|
}));
|
|
3413
|
-
function repay(
|
|
3443
|
+
function repay(_x9) {
|
|
3414
3444
|
return _repay.apply(this, arguments);
|
|
3415
3445
|
}
|
|
3416
3446
|
return repay;
|
|
3417
3447
|
}();
|
|
3418
3448
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
3419
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3420
|
-
return _regeneratorRuntime().wrap(function
|
|
3421
|
-
while (1) switch (
|
|
3449
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
3450
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
3451
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
3422
3452
|
case 0:
|
|
3423
|
-
return
|
|
3453
|
+
return _context27.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
3424
3454
|
case 1:
|
|
3425
3455
|
case "end":
|
|
3426
|
-
return
|
|
3456
|
+
return _context27.stop();
|
|
3427
3457
|
}
|
|
3428
|
-
},
|
|
3458
|
+
}, _callee27, this);
|
|
3429
3459
|
}));
|
|
3430
3460
|
function enableCollateral() {
|
|
3431
3461
|
return _enableCollateral.apply(this, arguments);
|
|
@@ -3433,16 +3463,16 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3433
3463
|
return enableCollateral;
|
|
3434
3464
|
}();
|
|
3435
3465
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
3436
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3437
|
-
return _regeneratorRuntime().wrap(function
|
|
3438
|
-
while (1) switch (
|
|
3466
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
3467
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3468
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3439
3469
|
case 0:
|
|
3440
|
-
return
|
|
3470
|
+
return _context28.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
3441
3471
|
case 1:
|
|
3442
3472
|
case "end":
|
|
3443
|
-
return
|
|
3473
|
+
return _context28.stop();
|
|
3444
3474
|
}
|
|
3445
|
-
},
|
|
3475
|
+
}, _callee28, this);
|
|
3446
3476
|
}));
|
|
3447
3477
|
function disableCollateral() {
|
|
3448
3478
|
return _disableCollateral.apply(this, arguments);
|
|
@@ -4752,20 +4782,35 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4752
4782
|
var _proto = StakingRead.prototype;
|
|
4753
4783
|
_proto.getPLYWNEARPoolDetails = /*#__PURE__*/function () {
|
|
4754
4784
|
var _getPLYWNEARPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
4755
|
-
var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, totalStakeValuation, promises, i, rewardTokenAddress, rewardToken, rewardPerSecond, APYs;
|
|
4785
|
+
var _yield$this$env$auriF, stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, totalStakeValuation, promises, i, rewardTokenAddress, rewardToken, rewardPerSecond, APYs;
|
|
4756
4786
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4757
4787
|
while (1) switch (_context.prev = _context.next) {
|
|
4758
4788
|
case 0:
|
|
4759
4789
|
_context.next = 2;
|
|
4760
4790
|
return this.env.auriFairLaunch.getPoolInfo(PLYWNEAR_POOL_ID).then(function (res) {
|
|
4761
|
-
|
|
4762
|
-
|
|
4791
|
+
var endedTime = res.endTime;
|
|
4792
|
+
// If the pool has ended, return 0 reward per second
|
|
4793
|
+
if (endedTime < Date.now() / 1000) {
|
|
4794
|
+
return {
|
|
4795
|
+
stakedLiquidity: res.totalStake,
|
|
4796
|
+
rewardPerSeconds: res.rewardPerSeconds.map(function (_) {
|
|
4797
|
+
return ethers.BigNumber.from(0);
|
|
4798
|
+
})
|
|
4799
|
+
};
|
|
4800
|
+
}
|
|
4801
|
+
return {
|
|
4802
|
+
stakedLiquidity: res.totalStake,
|
|
4803
|
+
rewardPerSeconds: res.rewardPerSeconds
|
|
4804
|
+
};
|
|
4763
4805
|
});
|
|
4764
4806
|
case 2:
|
|
4807
|
+
_yield$this$env$auriF = _context.sent;
|
|
4808
|
+
stakedLiquidity = _yield$this$env$auriF.stakedLiquidity;
|
|
4809
|
+
rewardPerSeconds = _yield$this$env$auriF.rewardPerSeconds;
|
|
4765
4810
|
stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity.toString());
|
|
4766
|
-
_context.next =
|
|
4811
|
+
_context.next = 8;
|
|
4767
4812
|
return fetchValuation(stakedLiquidityAmount, this._networkConnection.provider);
|
|
4768
|
-
case
|
|
4813
|
+
case 8:
|
|
4769
4814
|
totalStakeValuation = _context.sent;
|
|
4770
4815
|
promises = []; // Calculate the reward per second in USD
|
|
4771
4816
|
for (i = 0; i < rewardPerSeconds.length; i++) {
|
|
@@ -4775,9 +4820,9 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4775
4820
|
promises.push(fetchValuation(new TokenAmount(rewardToken, rewardPerSecond.toString()), this._networkConnection.provider));
|
|
4776
4821
|
}
|
|
4777
4822
|
APYs = [];
|
|
4778
|
-
_context.next =
|
|
4823
|
+
_context.next = 14;
|
|
4779
4824
|
return Promise.all(promises);
|
|
4780
|
-
case
|
|
4825
|
+
case 14:
|
|
4781
4826
|
_context.sent.forEach(function (rewardPerSecondValuation, i) {
|
|
4782
4827
|
var rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[i];
|
|
4783
4828
|
var apy = calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION);
|
|
@@ -4790,7 +4835,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4790
4835
|
totalStakedLiquidity: stakedLiquidityAmount,
|
|
4791
4836
|
APYs: APYs
|
|
4792
4837
|
});
|
|
4793
|
-
case
|
|
4838
|
+
case 16:
|
|
4794
4839
|
case "end":
|
|
4795
4840
|
return _context.stop();
|
|
4796
4841
|
}
|
|
@@ -5422,25 +5467,123 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5422
5467
|
}
|
|
5423
5468
|
return sneakAccounts;
|
|
5424
5469
|
}();
|
|
5425
|
-
_proto.
|
|
5426
|
-
var
|
|
5470
|
+
_proto.getLTVAndLiquidationThreshold = /*#__PURE__*/function () {
|
|
5471
|
+
var _getLTVAndLiquidationThreshold = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(userAddr) {
|
|
5427
5472
|
var _this3 = this;
|
|
5473
|
+
var totalSuppliedValue, totalBorrowedValue, collateralValue, assetsIn, marketValues, _loop2, i, ltv, liquidationThreshold;
|
|
5474
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context11) {
|
|
5475
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
5476
|
+
case 0:
|
|
5477
|
+
totalSuppliedValue = new BigNumber(0);
|
|
5478
|
+
totalBorrowedValue = new BigNumber(0);
|
|
5479
|
+
collateralValue = new BigNumber(0);
|
|
5480
|
+
_context11.next = 5;
|
|
5481
|
+
return this.env.comptroller.getAssetsIn(userAddr);
|
|
5482
|
+
case 5:
|
|
5483
|
+
assetsIn = _context11.sent;
|
|
5484
|
+
_context11.next = 8;
|
|
5485
|
+
return Promise.all(networkAddresses.auTokens.map( /*#__PURE__*/function () {
|
|
5486
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(auToken) {
|
|
5487
|
+
var moneyMarket;
|
|
5488
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context8) {
|
|
5489
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5490
|
+
case 0:
|
|
5491
|
+
moneyMarket = new MoneyMarketRead(_this3._networkConnection, auToken.address, auToken.underlying);
|
|
5492
|
+
return _context8.abrupt("return", Promise.all([moneyMarket.getCollateralRatio(), moneyMarket.getDepositBorrowValue(userAddr)]));
|
|
5493
|
+
case 2:
|
|
5494
|
+
case "end":
|
|
5495
|
+
return _context8.stop();
|
|
5496
|
+
}
|
|
5497
|
+
}, _callee7);
|
|
5498
|
+
}));
|
|
5499
|
+
return function (_x9) {
|
|
5500
|
+
return _ref2.apply(this, arguments);
|
|
5501
|
+
};
|
|
5502
|
+
}()));
|
|
5503
|
+
case 8:
|
|
5504
|
+
marketValues = _context11.sent;
|
|
5505
|
+
networkAddresses.auTokens.forEach( /*#__PURE__*/function () {
|
|
5506
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(auToken, i) {
|
|
5507
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context9) {
|
|
5508
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5509
|
+
case 0:
|
|
5510
|
+
case "end":
|
|
5511
|
+
return _context9.stop();
|
|
5512
|
+
}
|
|
5513
|
+
}, _callee8);
|
|
5514
|
+
}));
|
|
5515
|
+
return function (_x10, _x11) {
|
|
5516
|
+
return _ref3.apply(this, arguments);
|
|
5517
|
+
};
|
|
5518
|
+
}());
|
|
5519
|
+
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
5520
|
+
var auToken, _marketValues$i, collateralRatio, depositBorrowValue;
|
|
5521
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context10) {
|
|
5522
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5523
|
+
case 0:
|
|
5524
|
+
auToken = networkAddresses.auTokens[i];
|
|
5525
|
+
_marketValues$i = marketValues[i], collateralRatio = _marketValues$i[0], depositBorrowValue = _marketValues$i[1];
|
|
5526
|
+
if (assetsIn.find(function (auAddress) {
|
|
5527
|
+
return isSameAddress(auToken.address, auAddress);
|
|
5528
|
+
}) !== undefined) {
|
|
5529
|
+
totalSuppliedValue = totalSuppliedValue.plus(depositBorrowValue.suppliedValue);
|
|
5530
|
+
collateralValue = collateralValue.plus(depositBorrowValue.suppliedValue.times(collateralRatio));
|
|
5531
|
+
}
|
|
5532
|
+
totalBorrowedValue = totalBorrowedValue.plus(depositBorrowValue.borrowedValue);
|
|
5533
|
+
case 4:
|
|
5534
|
+
case "end":
|
|
5535
|
+
return _context10.stop();
|
|
5536
|
+
}
|
|
5537
|
+
}, _loop2);
|
|
5538
|
+
});
|
|
5539
|
+
i = 0;
|
|
5540
|
+
case 12:
|
|
5541
|
+
if (!(i < marketValues.length)) {
|
|
5542
|
+
_context11.next = 17;
|
|
5543
|
+
break;
|
|
5544
|
+
}
|
|
5545
|
+
return _context11.delegateYield(_loop2(), "t0", 14);
|
|
5546
|
+
case 14:
|
|
5547
|
+
i++;
|
|
5548
|
+
_context11.next = 12;
|
|
5549
|
+
break;
|
|
5550
|
+
case 17:
|
|
5551
|
+
ltv = totalBorrowedValue.div(totalSuppliedValue);
|
|
5552
|
+
liquidationThreshold = collateralValue.div(totalSuppliedValue);
|
|
5553
|
+
return _context11.abrupt("return", {
|
|
5554
|
+
ltv: ltv,
|
|
5555
|
+
liquidationThreshold: liquidationThreshold
|
|
5556
|
+
});
|
|
5557
|
+
case 20:
|
|
5558
|
+
case "end":
|
|
5559
|
+
return _context11.stop();
|
|
5560
|
+
}
|
|
5561
|
+
}, _callee9, this);
|
|
5562
|
+
}));
|
|
5563
|
+
function getLTVAndLiquidationThreshold(_x8) {
|
|
5564
|
+
return _getLTVAndLiquidationThreshold.apply(this, arguments);
|
|
5565
|
+
}
|
|
5566
|
+
return getLTVAndLiquidationThreshold;
|
|
5567
|
+
}();
|
|
5568
|
+
_proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
|
|
5569
|
+
var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(userAddress) {
|
|
5570
|
+
var _this4 = this;
|
|
5428
5571
|
var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator3, _step3, apy;
|
|
5429
|
-
return _regeneratorRuntime().wrap(function
|
|
5430
|
-
while (1) switch (
|
|
5572
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context12) {
|
|
5573
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
5431
5574
|
case 0:
|
|
5432
5575
|
sum = new BigNumber(0);
|
|
5433
5576
|
totalSuppliedValue = new BigNumber(0);
|
|
5434
5577
|
totalBorrowedValue = new BigNumber(0);
|
|
5435
5578
|
netApy = new BigNumber(0);
|
|
5436
|
-
|
|
5579
|
+
_context12.next = 6;
|
|
5437
5580
|
return Promise.all(networkAddresses.auTokens.map(function (auToken) {
|
|
5438
|
-
var moneyMarket = new MoneyMarketRead(
|
|
5581
|
+
var moneyMarket = new MoneyMarketRead(_this4._networkConnection, auToken.address, auToken.underlying);
|
|
5439
5582
|
var apyWithoutIncentive = moneyMarket.getApyWithoutIncentive(userAddress);
|
|
5440
5583
|
return apyWithoutIncentive;
|
|
5441
5584
|
}));
|
|
5442
5585
|
case 6:
|
|
5443
|
-
apys =
|
|
5586
|
+
apys = _context12.sent;
|
|
5444
5587
|
for (_iterator3 = _createForOfIteratorHelperLoose(apys); !(_step3 = _iterator3()).done;) {
|
|
5445
5588
|
apy = _step3.value;
|
|
5446
5589
|
sum = sum.plus(apy.sum);
|
|
@@ -5452,37 +5595,37 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5452
5595
|
} else if (sum.lt(0)) {
|
|
5453
5596
|
netApy = sum.div(totalBorrowedValue);
|
|
5454
5597
|
}
|
|
5455
|
-
return
|
|
5598
|
+
return _context12.abrupt("return", netApy);
|
|
5456
5599
|
case 10:
|
|
5457
5600
|
case "end":
|
|
5458
|
-
return
|
|
5601
|
+
return _context12.stop();
|
|
5459
5602
|
}
|
|
5460
|
-
},
|
|
5603
|
+
}, _callee10);
|
|
5461
5604
|
}));
|
|
5462
|
-
function getNetApyWithoutIncentive(
|
|
5605
|
+
function getNetApyWithoutIncentive(_x12) {
|
|
5463
5606
|
return _getNetApyWithoutIncentive.apply(this, arguments);
|
|
5464
5607
|
}
|
|
5465
5608
|
return getNetApyWithoutIncentive;
|
|
5466
5609
|
}();
|
|
5467
5610
|
_proto.getNetApyWithIncentive = /*#__PURE__*/function () {
|
|
5468
|
-
var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5469
|
-
var
|
|
5611
|
+
var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(userAddress) {
|
|
5612
|
+
var _this5 = this;
|
|
5470
5613
|
var sum, totalSuppliedValue, totalBorrowedValue, netApy, apys, _iterator4, _step4, apy;
|
|
5471
|
-
return _regeneratorRuntime().wrap(function
|
|
5472
|
-
while (1) switch (
|
|
5614
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context13) {
|
|
5615
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
5473
5616
|
case 0:
|
|
5474
5617
|
sum = new BigNumber(0);
|
|
5475
5618
|
totalSuppliedValue = new BigNumber(0);
|
|
5476
5619
|
totalBorrowedValue = new BigNumber(0);
|
|
5477
5620
|
netApy = new BigNumber(0);
|
|
5478
|
-
|
|
5621
|
+
_context13.next = 6;
|
|
5479
5622
|
return Promise.all(networkAddresses.auTokens.map(function (auToken) {
|
|
5480
|
-
var moneyMarket = new MoneyMarketRead(
|
|
5623
|
+
var moneyMarket = new MoneyMarketRead(_this5._networkConnection, auToken.address, auToken.underlying);
|
|
5481
5624
|
var apyWithIncentive = moneyMarket.getApyWithIncentive(userAddress);
|
|
5482
5625
|
return apyWithIncentive;
|
|
5483
5626
|
}));
|
|
5484
5627
|
case 6:
|
|
5485
|
-
apys =
|
|
5628
|
+
apys = _context13.sent;
|
|
5486
5629
|
for (_iterator4 = _createForOfIteratorHelperLoose(apys); !(_step4 = _iterator4()).done;) {
|
|
5487
5630
|
apy = _step4.value;
|
|
5488
5631
|
sum = sum.plus(apy.sum);
|
|
@@ -5494,14 +5637,14 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5494
5637
|
} else if (sum.lt(0)) {
|
|
5495
5638
|
netApy = sum.div(totalBorrowedValue);
|
|
5496
5639
|
}
|
|
5497
|
-
return
|
|
5640
|
+
return _context13.abrupt("return", netApy);
|
|
5498
5641
|
case 10:
|
|
5499
5642
|
case "end":
|
|
5500
|
-
return
|
|
5643
|
+
return _context13.stop();
|
|
5501
5644
|
}
|
|
5502
|
-
},
|
|
5645
|
+
}, _callee11);
|
|
5503
5646
|
}));
|
|
5504
|
-
function getNetApyWithIncentive(
|
|
5647
|
+
function getNetApyWithIncentive(_x13) {
|
|
5505
5648
|
return _getNetApyWithIncentive.apply(this, arguments);
|
|
5506
5649
|
}
|
|
5507
5650
|
return getNetApyWithIncentive;
|
|
@@ -5822,49 +5965,62 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5822
5965
|
}
|
|
5823
5966
|
return sneakAccounts;
|
|
5824
5967
|
}();
|
|
5825
|
-
_proto.
|
|
5826
|
-
var
|
|
5827
|
-
var miscRead;
|
|
5968
|
+
_proto.getLTVAndLiquidationThreshold = /*#__PURE__*/function () {
|
|
5969
|
+
var _getLTVAndLiquidationThreshold = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(userAddr) {
|
|
5828
5970
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
5829
5971
|
while (1) switch (_context10.prev = _context10.next) {
|
|
5830
5972
|
case 0:
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
case 2:
|
|
5973
|
+
return _context10.abrupt("return", this._misc.getLTVAndLiquidationThreshold(userAddr));
|
|
5974
|
+
case 1:
|
|
5834
5975
|
case "end":
|
|
5835
5976
|
return _context10.stop();
|
|
5836
5977
|
}
|
|
5837
5978
|
}, _callee10, this);
|
|
5838
5979
|
}));
|
|
5839
|
-
function
|
|
5840
|
-
return
|
|
5980
|
+
function getLTVAndLiquidationThreshold(_x10) {
|
|
5981
|
+
return _getLTVAndLiquidationThreshold.apply(this, arguments);
|
|
5841
5982
|
}
|
|
5842
|
-
return
|
|
5983
|
+
return getLTVAndLiquidationThreshold;
|
|
5843
5984
|
}();
|
|
5844
|
-
_proto.
|
|
5845
|
-
var
|
|
5846
|
-
var miscRead;
|
|
5985
|
+
_proto.getNetApyWithoutIncentive = /*#__PURE__*/function () {
|
|
5986
|
+
var _getNetApyWithoutIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(userAddress) {
|
|
5847
5987
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
5848
5988
|
while (1) switch (_context11.prev = _context11.next) {
|
|
5849
5989
|
case 0:
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
case 2:
|
|
5990
|
+
return _context11.abrupt("return", this._misc.getNetApyWithoutIncentive(userAddress));
|
|
5991
|
+
case 1:
|
|
5853
5992
|
case "end":
|
|
5854
5993
|
return _context11.stop();
|
|
5855
5994
|
}
|
|
5856
5995
|
}, _callee11, this);
|
|
5857
5996
|
}));
|
|
5858
|
-
function
|
|
5997
|
+
function getNetApyWithoutIncentive(_x11) {
|
|
5998
|
+
return _getNetApyWithoutIncentive.apply(this, arguments);
|
|
5999
|
+
}
|
|
6000
|
+
return getNetApyWithoutIncentive;
|
|
6001
|
+
}();
|
|
6002
|
+
_proto.getNetApyWithIncentive = /*#__PURE__*/function () {
|
|
6003
|
+
var _getNetApyWithIncentive = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(userAddress) {
|
|
6004
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
6005
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
6006
|
+
case 0:
|
|
6007
|
+
return _context12.abrupt("return", this._misc.getNetApyWithIncentive(userAddress));
|
|
6008
|
+
case 1:
|
|
6009
|
+
case "end":
|
|
6010
|
+
return _context12.stop();
|
|
6011
|
+
}
|
|
6012
|
+
}, _callee12, this);
|
|
6013
|
+
}));
|
|
6014
|
+
function getNetApyWithIncentive(_x12) {
|
|
5859
6015
|
return _getNetApyWithIncentive.apply(this, arguments);
|
|
5860
6016
|
}
|
|
5861
6017
|
return getNetApyWithIncentive;
|
|
5862
6018
|
}();
|
|
5863
6019
|
_proto.setUserNotificationSettings = /*#__PURE__*/function () {
|
|
5864
|
-
var _setUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6020
|
+
var _setUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(address, mail, utilisation, liquidation, captchaResponse) {
|
|
5865
6021
|
var body, response;
|
|
5866
|
-
return _regeneratorRuntime().wrap(function
|
|
5867
|
-
while (1) switch (
|
|
6022
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
6023
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
5868
6024
|
case 0:
|
|
5869
6025
|
body = {
|
|
5870
6026
|
address: address,
|
|
@@ -5875,27 +6031,27 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5875
6031
|
},
|
|
5876
6032
|
captchaResponse: captchaResponse
|
|
5877
6033
|
};
|
|
5878
|
-
|
|
6034
|
+
_context13.next = 3;
|
|
5879
6035
|
return postApi('alert-setting/set', body);
|
|
5880
6036
|
case 3:
|
|
5881
|
-
response =
|
|
5882
|
-
return
|
|
6037
|
+
response = _context13.sent;
|
|
6038
|
+
return _context13.abrupt("return", response);
|
|
5883
6039
|
case 5:
|
|
5884
6040
|
case "end":
|
|
5885
|
-
return
|
|
6041
|
+
return _context13.stop();
|
|
5886
6042
|
}
|
|
5887
|
-
},
|
|
6043
|
+
}, _callee13);
|
|
5888
6044
|
}));
|
|
5889
|
-
function setUserNotificationSettings(
|
|
6045
|
+
function setUserNotificationSettings(_x13, _x14, _x15, _x16, _x17) {
|
|
5890
6046
|
return _setUserNotificationSettings.apply(this, arguments);
|
|
5891
6047
|
}
|
|
5892
6048
|
return setUserNotificationSettings;
|
|
5893
6049
|
}();
|
|
5894
6050
|
_proto.unsetUserNotificationSettings = /*#__PURE__*/function () {
|
|
5895
|
-
var _unsetUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6051
|
+
var _unsetUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, captchaResponse) {
|
|
5896
6052
|
var body, response;
|
|
5897
|
-
return _regeneratorRuntime().wrap(function
|
|
5898
|
-
while (1) switch (
|
|
6053
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
6054
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
5899
6055
|
case 0:
|
|
5900
6056
|
body = {
|
|
5901
6057
|
address: address,
|
|
@@ -5906,57 +6062,57 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5906
6062
|
},
|
|
5907
6063
|
captchaResponse: captchaResponse
|
|
5908
6064
|
};
|
|
5909
|
-
|
|
6065
|
+
_context14.next = 3;
|
|
5910
6066
|
return postApi('alert-setting/set', body);
|
|
5911
6067
|
case 3:
|
|
5912
|
-
response =
|
|
5913
|
-
return
|
|
6068
|
+
response = _context14.sent;
|
|
6069
|
+
return _context14.abrupt("return", response);
|
|
5914
6070
|
case 5:
|
|
5915
6071
|
case "end":
|
|
5916
|
-
return
|
|
6072
|
+
return _context14.stop();
|
|
5917
6073
|
}
|
|
5918
|
-
},
|
|
6074
|
+
}, _callee14);
|
|
5919
6075
|
}));
|
|
5920
|
-
function unsetUserNotificationSettings(
|
|
6076
|
+
function unsetUserNotificationSettings(_x18, _x19) {
|
|
5921
6077
|
return _unsetUserNotificationSettings.apply(this, arguments);
|
|
5922
6078
|
}
|
|
5923
6079
|
return unsetUserNotificationSettings;
|
|
5924
6080
|
}();
|
|
5925
6081
|
_proto.getUserNotificationSettings = /*#__PURE__*/function () {
|
|
5926
|
-
var _getUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6082
|
+
var _getUserNotificationSettings = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(addresses) {
|
|
5927
6083
|
var body, response;
|
|
5928
|
-
return _regeneratorRuntime().wrap(function
|
|
5929
|
-
while (1) switch (
|
|
6084
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
6085
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
5930
6086
|
case 0:
|
|
5931
6087
|
body = {
|
|
5932
6088
|
addresses: addresses
|
|
5933
6089
|
};
|
|
5934
|
-
|
|
6090
|
+
_context15.next = 3;
|
|
5935
6091
|
return postApi('alert-setting/get-user-setting', body);
|
|
5936
6092
|
case 3:
|
|
5937
|
-
response =
|
|
5938
|
-
return
|
|
6093
|
+
response = _context15.sent;
|
|
6094
|
+
return _context15.abrupt("return", response);
|
|
5939
6095
|
case 5:
|
|
5940
6096
|
case "end":
|
|
5941
|
-
return
|
|
6097
|
+
return _context15.stop();
|
|
5942
6098
|
}
|
|
5943
|
-
},
|
|
6099
|
+
}, _callee15);
|
|
5944
6100
|
}));
|
|
5945
|
-
function getUserNotificationSettings(
|
|
6101
|
+
function getUserNotificationSettings(_x20) {
|
|
5946
6102
|
return _getUserNotificationSettings.apply(this, arguments);
|
|
5947
6103
|
}
|
|
5948
6104
|
return getUserNotificationSettings;
|
|
5949
6105
|
}();
|
|
5950
6106
|
_proto.getLiquidationHistory = /*#__PURE__*/function () {
|
|
5951
|
-
var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6107
|
+
var _getLiquidationHistory = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(address) {
|
|
5952
6108
|
var liquidationHistorySubgraph, liquidationEvents;
|
|
5953
|
-
return _regeneratorRuntime().wrap(function
|
|
5954
|
-
while (1) switch (
|
|
6109
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
6110
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
5955
6111
|
case 0:
|
|
5956
|
-
|
|
6112
|
+
_context16.next = 2;
|
|
5957
6113
|
return queryGraphQL(getLiquidationEventsQuery(address, 100), AURIGAMI_SUBGRAPH_URL);
|
|
5958
6114
|
case 2:
|
|
5959
|
-
liquidationHistorySubgraph =
|
|
6115
|
+
liquidationHistorySubgraph = _context16.sent;
|
|
5960
6116
|
liquidationEvents = liquidationHistorySubgraph.liquidationEvents.map(function (event) {
|
|
5961
6117
|
var value = {
|
|
5962
6118
|
amount: event.underlyingRepayAmountUSD.toString(),
|
|
@@ -5975,14 +6131,14 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5975
6131
|
transactionId: event.id.split('-')[0]
|
|
5976
6132
|
};
|
|
5977
6133
|
});
|
|
5978
|
-
return
|
|
6134
|
+
return _context16.abrupt("return", liquidationEvents);
|
|
5979
6135
|
case 5:
|
|
5980
6136
|
case "end":
|
|
5981
|
-
return
|
|
6137
|
+
return _context16.stop();
|
|
5982
6138
|
}
|
|
5983
|
-
},
|
|
6139
|
+
}, _callee16);
|
|
5984
6140
|
}));
|
|
5985
|
-
function getLiquidationHistory(
|
|
6141
|
+
function getLiquidationHistory(_x21) {
|
|
5986
6142
|
return _getLiquidationHistory.apply(this, arguments);
|
|
5987
6143
|
}
|
|
5988
6144
|
return getLiquidationHistory;
|
|
@@ -6004,16 +6160,16 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
6004
6160
|
_proto2.claim =
|
|
6005
6161
|
/*#__PURE__*/
|
|
6006
6162
|
function () {
|
|
6007
|
-
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6008
|
-
return _regeneratorRuntime().wrap(function
|
|
6009
|
-
while (1) switch (
|
|
6163
|
+
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
6164
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
6165
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
6010
6166
|
case 0:
|
|
6011
|
-
return
|
|
6167
|
+
return _context17.abrupt("return", this.env.auriLens.connect(this._networkConnection.signer).claimRewards(this.env.comptroller.address, this.env.auriFairLaunch.address, ALL_STAKING_POOLS));
|
|
6012
6168
|
case 1:
|
|
6013
6169
|
case "end":
|
|
6014
|
-
return
|
|
6170
|
+
return _context17.stop();
|
|
6015
6171
|
}
|
|
6016
|
-
},
|
|
6172
|
+
}, _callee17, this);
|
|
6017
6173
|
}));
|
|
6018
6174
|
function claim() {
|
|
6019
6175
|
return _claim.apply(this, arguments);
|
|
@@ -6021,35 +6177,35 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
6021
6177
|
return claim;
|
|
6022
6178
|
}();
|
|
6023
6179
|
_proto2.stake = /*#__PURE__*/function () {
|
|
6024
|
-
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6025
|
-
return _regeneratorRuntime().wrap(function
|
|
6026
|
-
while (1) switch (
|
|
6180
|
+
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(amount) {
|
|
6181
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
6182
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
6027
6183
|
case 0:
|
|
6028
|
-
return
|
|
6184
|
+
return _context18.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
|
|
6029
6185
|
case 1:
|
|
6030
6186
|
case "end":
|
|
6031
|
-
return
|
|
6187
|
+
return _context18.stop();
|
|
6032
6188
|
}
|
|
6033
|
-
},
|
|
6189
|
+
}, _callee18, this);
|
|
6034
6190
|
}));
|
|
6035
|
-
function stake(
|
|
6191
|
+
function stake(_x22) {
|
|
6036
6192
|
return _stake.apply(this, arguments);
|
|
6037
6193
|
}
|
|
6038
6194
|
return stake;
|
|
6039
6195
|
}();
|
|
6040
6196
|
_proto2.unstake = /*#__PURE__*/function () {
|
|
6041
|
-
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6042
|
-
return _regeneratorRuntime().wrap(function
|
|
6043
|
-
while (1) switch (
|
|
6197
|
+
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(amount) {
|
|
6198
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
6199
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
6044
6200
|
case 0:
|
|
6045
|
-
return
|
|
6201
|
+
return _context19.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
|
|
6046
6202
|
case 1:
|
|
6047
6203
|
case "end":
|
|
6048
|
-
return
|
|
6204
|
+
return _context19.stop();
|
|
6049
6205
|
}
|
|
6050
|
-
},
|
|
6206
|
+
}, _callee19, this);
|
|
6051
6207
|
}));
|
|
6052
|
-
function unstake(
|
|
6208
|
+
function unstake(_x23) {
|
|
6053
6209
|
return _unstake.apply(this, arguments);
|
|
6054
6210
|
}
|
|
6055
6211
|
return unstake;
|