@aurigami/sdk 0.2.2 → 0.2.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/MoneyMarket.d.ts +2 -0
- package/dist/constants.d.ts +1 -0
- package/dist/priceFetcher.d.ts +2 -2
- package/dist/sdk.cjs.development.js +181 -81
- 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 +182 -81
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/MoneyMarket.ts +55 -5
- package/src/constants.ts +2 -0
- package/src/priceFetcher.ts +5 -5
- package/src/types.ts +4 -0
package/dist/sdk.esm.js
CHANGED
|
@@ -940,6 +940,7 @@ var networkAddresses = {
|
|
|
940
940
|
var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
|
|
941
941
|
var REWARDCLAIMSTART = 1673280000;
|
|
942
942
|
var ONE_DAY = 86400;
|
|
943
|
+
var ONE_YEAR = ONE_DAY * 365;
|
|
943
944
|
var AurPlyPid = 1;
|
|
944
945
|
|
|
945
946
|
var decimalRecords = {
|
|
@@ -1019,6 +1020,13 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
|
1019
1020
|
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
1020
1021
|
}
|
|
1021
1022
|
|
|
1023
|
+
var ComptrollerRewardType;
|
|
1024
|
+
|
|
1025
|
+
(function (ComptrollerRewardType) {
|
|
1026
|
+
ComptrollerRewardType[ComptrollerRewardType["PLY"] = 0] = "PLY";
|
|
1027
|
+
ComptrollerRewardType[ComptrollerRewardType["AURORA"] = 1] = "AURORA";
|
|
1028
|
+
})(ComptrollerRewardType || (ComptrollerRewardType = {}));
|
|
1029
|
+
|
|
1022
1030
|
var Token = function Token(address, decimals) {
|
|
1023
1031
|
this.address = address.toLowerCase();
|
|
1024
1032
|
this.decimals = decimals;
|
|
@@ -1225,12 +1233,94 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1225
1233
|
return getCollateralRatio;
|
|
1226
1234
|
}();
|
|
1227
1235
|
|
|
1228
|
-
_proto.
|
|
1229
|
-
var
|
|
1230
|
-
var promises,
|
|
1236
|
+
_proto.getBorrowPlyAPY = /*#__PURE__*/function () {
|
|
1237
|
+
var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
1238
|
+
var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
|
|
1231
1239
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1232
1240
|
while (1) {
|
|
1233
1241
|
switch (_context6.prev = _context6.next) {
|
|
1242
|
+
case 0:
|
|
1243
|
+
promises = [];
|
|
1244
|
+
promises.push(this.getTotalTokenBorrowed().then(function (res) {
|
|
1245
|
+
totalBorrowed = res;
|
|
1246
|
+
}));
|
|
1247
|
+
promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1248
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1249
|
+
}));
|
|
1250
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1251
|
+
plyPrice = res;
|
|
1252
|
+
}));
|
|
1253
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1254
|
+
underlyingPrice = res;
|
|
1255
|
+
}));
|
|
1256
|
+
_context6.next = 7;
|
|
1257
|
+
return Promise.all(promises);
|
|
1258
|
+
|
|
1259
|
+
case 7:
|
|
1260
|
+
return _context6.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
|
|
1261
|
+
|
|
1262
|
+
case 8:
|
|
1263
|
+
case "end":
|
|
1264
|
+
return _context6.stop();
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}, _callee6, this);
|
|
1268
|
+
}));
|
|
1269
|
+
|
|
1270
|
+
function getBorrowPlyAPY() {
|
|
1271
|
+
return _getBorrowPlyAPY.apply(this, arguments);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
return getBorrowPlyAPY;
|
|
1275
|
+
}();
|
|
1276
|
+
|
|
1277
|
+
_proto.getDepositPlyAPY = /*#__PURE__*/function () {
|
|
1278
|
+
var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
1279
|
+
var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
|
|
1280
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
1281
|
+
while (1) {
|
|
1282
|
+
switch (_context7.prev = _context7.next) {
|
|
1283
|
+
case 0:
|
|
1284
|
+
promises = [];
|
|
1285
|
+
promises.push(this.getTotalTokenDeposited().then(function (res) {
|
|
1286
|
+
totalDeposited = res;
|
|
1287
|
+
}));
|
|
1288
|
+
promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1289
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1290
|
+
}));
|
|
1291
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1292
|
+
plyPrice = res;
|
|
1293
|
+
}));
|
|
1294
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1295
|
+
underlyingPrice = res;
|
|
1296
|
+
}));
|
|
1297
|
+
_context7.next = 7;
|
|
1298
|
+
return Promise.all(promises);
|
|
1299
|
+
|
|
1300
|
+
case 7:
|
|
1301
|
+
return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
|
|
1302
|
+
|
|
1303
|
+
case 8:
|
|
1304
|
+
case "end":
|
|
1305
|
+
return _context7.stop();
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}, _callee7, this);
|
|
1309
|
+
}));
|
|
1310
|
+
|
|
1311
|
+
function getDepositPlyAPY() {
|
|
1312
|
+
return _getDepositPlyAPY.apply(this, arguments);
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
return getDepositPlyAPY;
|
|
1316
|
+
}();
|
|
1317
|
+
|
|
1318
|
+
_proto.getDetails = /*#__PURE__*/function () {
|
|
1319
|
+
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
|
|
1320
|
+
var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeed, plyPrice, underlyingPrice, borrowPlyApy, depositPlyApy;
|
|
1321
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
1322
|
+
while (1) {
|
|
1323
|
+
switch (_context8.prev = _context8.next) {
|
|
1234
1324
|
case 0:
|
|
1235
1325
|
promises = [];
|
|
1236
1326
|
promises.push(this.getTotalTokenDeposited().then(function (res) {
|
|
@@ -1248,27 +1338,38 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1248
1338
|
promises.push(this.getCollateralRatio().then(function (res) {
|
|
1249
1339
|
collateralRatio = res.toNumber();
|
|
1250
1340
|
}));
|
|
1251
|
-
|
|
1341
|
+
promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1342
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1343
|
+
}));
|
|
1344
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1345
|
+
plyPrice = res;
|
|
1346
|
+
}));
|
|
1347
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1348
|
+
underlyingPrice = res;
|
|
1349
|
+
}));
|
|
1350
|
+
_context8.next = 11;
|
|
1252
1351
|
return Promise.all(promises);
|
|
1253
1352
|
|
|
1254
|
-
case
|
|
1255
|
-
|
|
1353
|
+
case 11:
|
|
1354
|
+
borrowPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
|
|
1355
|
+
depositPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
|
|
1356
|
+
return _context8.abrupt("return", {
|
|
1256
1357
|
auTokenAddress: this.auToken.address,
|
|
1257
1358
|
totalTokenDeposited: totalDeposited,
|
|
1258
1359
|
totalTokenBorrowed: totalBorrowed,
|
|
1259
1360
|
depositApy: depositAPY,
|
|
1260
|
-
depositPlyApy:
|
|
1361
|
+
depositPlyApy: depositPlyApy.toNumber(),
|
|
1261
1362
|
borrowApy: borrowAPY,
|
|
1262
|
-
borrowPlyApy:
|
|
1363
|
+
borrowPlyApy: borrowPlyApy.toNumber(),
|
|
1263
1364
|
collateralRatio: collateralRatio
|
|
1264
1365
|
});
|
|
1265
1366
|
|
|
1266
|
-
case
|
|
1367
|
+
case 14:
|
|
1267
1368
|
case "end":
|
|
1268
|
-
return
|
|
1369
|
+
return _context8.stop();
|
|
1269
1370
|
}
|
|
1270
1371
|
}
|
|
1271
|
-
},
|
|
1372
|
+
}, _callee8, this);
|
|
1272
1373
|
}));
|
|
1273
1374
|
|
|
1274
1375
|
function getDetails() {
|
|
@@ -1279,25 +1380,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1279
1380
|
}();
|
|
1280
1381
|
|
|
1281
1382
|
_proto.getUserBorrowBalance = /*#__PURE__*/function () {
|
|
1282
|
-
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1383
|
+
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(userAddress) {
|
|
1283
1384
|
var totalBorrow;
|
|
1284
|
-
return runtime_1.wrap(function
|
|
1385
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
1285
1386
|
while (1) {
|
|
1286
|
-
switch (
|
|
1387
|
+
switch (_context9.prev = _context9.next) {
|
|
1287
1388
|
case 0:
|
|
1288
|
-
|
|
1389
|
+
_context9.next = 2;
|
|
1289
1390
|
return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
|
|
1290
1391
|
|
|
1291
1392
|
case 2:
|
|
1292
|
-
totalBorrow =
|
|
1293
|
-
return
|
|
1393
|
+
totalBorrow = _context9.sent;
|
|
1394
|
+
return _context9.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
|
|
1294
1395
|
|
|
1295
1396
|
case 4:
|
|
1296
1397
|
case "end":
|
|
1297
|
-
return
|
|
1398
|
+
return _context9.stop();
|
|
1298
1399
|
}
|
|
1299
1400
|
}
|
|
1300
|
-
},
|
|
1401
|
+
}, _callee9, this);
|
|
1301
1402
|
}));
|
|
1302
1403
|
|
|
1303
1404
|
function getUserBorrowBalance(_x) {
|
|
@@ -1308,25 +1409,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1308
1409
|
}();
|
|
1309
1410
|
|
|
1310
1411
|
_proto.getUserDepositBalance = /*#__PURE__*/function () {
|
|
1311
|
-
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1412
|
+
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
|
|
1312
1413
|
var totalDeposit;
|
|
1313
|
-
return runtime_1.wrap(function
|
|
1414
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
1314
1415
|
while (1) {
|
|
1315
|
-
switch (
|
|
1416
|
+
switch (_context10.prev = _context10.next) {
|
|
1316
1417
|
case 0:
|
|
1317
|
-
|
|
1418
|
+
_context10.next = 2;
|
|
1318
1419
|
return this.auToken.callStatic.balanceOfUnderlying(userAddress);
|
|
1319
1420
|
|
|
1320
1421
|
case 2:
|
|
1321
|
-
totalDeposit =
|
|
1322
|
-
return
|
|
1422
|
+
totalDeposit = _context10.sent;
|
|
1423
|
+
return _context10.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
|
|
1323
1424
|
|
|
1324
1425
|
case 4:
|
|
1325
1426
|
case "end":
|
|
1326
|
-
return
|
|
1427
|
+
return _context10.stop();
|
|
1327
1428
|
}
|
|
1328
1429
|
}
|
|
1329
|
-
},
|
|
1430
|
+
}, _callee10, this);
|
|
1330
1431
|
}));
|
|
1331
1432
|
|
|
1332
1433
|
function getUserDepositBalance(_x2) {
|
|
@@ -1348,29 +1449,29 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1348
1449
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
1349
1450
|
|
|
1350
1451
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
1351
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1352
|
-
return runtime_1.wrap(function
|
|
1452
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
|
|
1453
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
1353
1454
|
while (1) {
|
|
1354
|
-
switch (
|
|
1455
|
+
switch (_context11.prev = _context11.next) {
|
|
1355
1456
|
case 0:
|
|
1356
1457
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
1357
|
-
|
|
1458
|
+
_context11.next = 4;
|
|
1358
1459
|
break;
|
|
1359
1460
|
}
|
|
1360
1461
|
|
|
1361
|
-
return
|
|
1462
|
+
return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
1362
1463
|
value: amount.rawAmount()
|
|
1363
1464
|
}));
|
|
1364
1465
|
|
|
1365
1466
|
case 4:
|
|
1366
|
-
return
|
|
1467
|
+
return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
1367
1468
|
|
|
1368
1469
|
case 5:
|
|
1369
1470
|
case "end":
|
|
1370
|
-
return
|
|
1471
|
+
return _context11.stop();
|
|
1371
1472
|
}
|
|
1372
1473
|
}
|
|
1373
|
-
},
|
|
1474
|
+
}, _callee11, this);
|
|
1374
1475
|
}));
|
|
1375
1476
|
|
|
1376
1477
|
function deposit(_x3) {
|
|
@@ -1381,19 +1482,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1381
1482
|
}();
|
|
1382
1483
|
|
|
1383
1484
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
1384
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1385
|
-
return runtime_1.wrap(function
|
|
1485
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
|
|
1486
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
1386
1487
|
while (1) {
|
|
1387
|
-
switch (
|
|
1488
|
+
switch (_context12.prev = _context12.next) {
|
|
1388
1489
|
case 0:
|
|
1389
|
-
return
|
|
1490
|
+
return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
1390
1491
|
|
|
1391
1492
|
case 1:
|
|
1392
1493
|
case "end":
|
|
1393
|
-
return
|
|
1494
|
+
return _context12.stop();
|
|
1394
1495
|
}
|
|
1395
1496
|
}
|
|
1396
|
-
},
|
|
1497
|
+
}, _callee12, this);
|
|
1397
1498
|
}));
|
|
1398
1499
|
|
|
1399
1500
|
function borrow(_x4) {
|
|
@@ -1404,19 +1505,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1404
1505
|
}();
|
|
1405
1506
|
|
|
1406
1507
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
1407
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1408
|
-
return runtime_1.wrap(function
|
|
1508
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
|
|
1509
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
1409
1510
|
while (1) {
|
|
1410
|
-
switch (
|
|
1511
|
+
switch (_context13.prev = _context13.next) {
|
|
1411
1512
|
case 0:
|
|
1412
|
-
return
|
|
1513
|
+
return _context13.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
1413
1514
|
|
|
1414
1515
|
case 1:
|
|
1415
1516
|
case "end":
|
|
1416
|
-
return
|
|
1517
|
+
return _context13.stop();
|
|
1417
1518
|
}
|
|
1418
1519
|
}
|
|
1419
|
-
},
|
|
1520
|
+
}, _callee13, this);
|
|
1420
1521
|
}));
|
|
1421
1522
|
|
|
1422
1523
|
function withdraw(_x5) {
|
|
@@ -1427,29 +1528,29 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1427
1528
|
}();
|
|
1428
1529
|
|
|
1429
1530
|
_proto2.repay = /*#__PURE__*/function () {
|
|
1430
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1431
|
-
return runtime_1.wrap(function
|
|
1531
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
|
|
1532
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
1432
1533
|
while (1) {
|
|
1433
|
-
switch (
|
|
1534
|
+
switch (_context14.prev = _context14.next) {
|
|
1434
1535
|
case 0:
|
|
1435
1536
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
1436
|
-
|
|
1537
|
+
_context14.next = 4;
|
|
1437
1538
|
break;
|
|
1438
1539
|
}
|
|
1439
1540
|
|
|
1440
|
-
return
|
|
1541
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
|
|
1441
1542
|
value: amount.rawAmount()
|
|
1442
1543
|
}));
|
|
1443
1544
|
|
|
1444
1545
|
case 4:
|
|
1445
|
-
return
|
|
1546
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
1446
1547
|
|
|
1447
1548
|
case 5:
|
|
1448
1549
|
case "end":
|
|
1449
|
-
return
|
|
1550
|
+
return _context14.stop();
|
|
1450
1551
|
}
|
|
1451
1552
|
}
|
|
1452
|
-
},
|
|
1553
|
+
}, _callee14, this);
|
|
1453
1554
|
}));
|
|
1454
1555
|
|
|
1455
1556
|
function repay(_x6) {
|
|
@@ -1460,19 +1561,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1460
1561
|
}();
|
|
1461
1562
|
|
|
1462
1563
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
1463
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1464
|
-
return runtime_1.wrap(function
|
|
1564
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
|
|
1565
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
1465
1566
|
while (1) {
|
|
1466
|
-
switch (
|
|
1567
|
+
switch (_context15.prev = _context15.next) {
|
|
1467
1568
|
case 0:
|
|
1468
|
-
return
|
|
1569
|
+
return _context15.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
1469
1570
|
|
|
1470
1571
|
case 1:
|
|
1471
1572
|
case "end":
|
|
1472
|
-
return
|
|
1573
|
+
return _context15.stop();
|
|
1473
1574
|
}
|
|
1474
1575
|
}
|
|
1475
|
-
},
|
|
1576
|
+
}, _callee15, this);
|
|
1476
1577
|
}));
|
|
1477
1578
|
|
|
1478
1579
|
function enableCollateral() {
|
|
@@ -1483,19 +1584,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1483
1584
|
}();
|
|
1484
1585
|
|
|
1485
1586
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
1486
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1487
|
-
return runtime_1.wrap(function
|
|
1587
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
|
|
1588
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
1488
1589
|
while (1) {
|
|
1489
|
-
switch (
|
|
1590
|
+
switch (_context16.prev = _context16.next) {
|
|
1490
1591
|
case 0:
|
|
1491
|
-
return
|
|
1592
|
+
return _context16.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
1492
1593
|
|
|
1493
1594
|
case 1:
|
|
1494
1595
|
case "end":
|
|
1495
|
-
return
|
|
1596
|
+
return _context16.stop();
|
|
1496
1597
|
}
|
|
1497
1598
|
}
|
|
1498
|
-
},
|
|
1599
|
+
}, _callee16, this);
|
|
1499
1600
|
}));
|
|
1500
1601
|
|
|
1501
1602
|
function disableCollateral() {
|
|
@@ -2485,12 +2586,12 @@ var dummyABI = {
|
|
|
2485
2586
|
|
|
2486
2587
|
var axios = /*#__PURE__*/require('axios');
|
|
2487
2588
|
|
|
2488
|
-
function
|
|
2489
|
-
return
|
|
2589
|
+
function fetchPriceFromCoingeckoAPI(_x) {
|
|
2590
|
+
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
2490
2591
|
}
|
|
2491
2592
|
|
|
2492
|
-
function
|
|
2493
|
-
|
|
2593
|
+
function _fetchPriceFromCoingeckoAPI() {
|
|
2594
|
+
_fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
|
|
2494
2595
|
var price;
|
|
2495
2596
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2496
2597
|
while (1) {
|
|
@@ -2512,15 +2613,15 @@ function _fetchPriceFromCoingecko() {
|
|
|
2512
2613
|
}
|
|
2513
2614
|
}, _callee);
|
|
2514
2615
|
}));
|
|
2515
|
-
return
|
|
2616
|
+
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
2516
2617
|
}
|
|
2517
2618
|
|
|
2518
|
-
function
|
|
2519
|
-
return
|
|
2619
|
+
function fetchPriceFromCoingecko(_x2) {
|
|
2620
|
+
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
2520
2621
|
}
|
|
2521
2622
|
|
|
2522
|
-
function
|
|
2523
|
-
|
|
2623
|
+
function _fetchPriceFromCoingecko() {
|
|
2624
|
+
_fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
|
|
2524
2625
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2525
2626
|
while (1) {
|
|
2526
2627
|
switch (_context2.prev = _context2.next) {
|
|
@@ -2530,10 +2631,10 @@ function _fetchBasicTokenPrice() {
|
|
|
2530
2631
|
break;
|
|
2531
2632
|
}
|
|
2532
2633
|
|
|
2533
|
-
return _context2.abrupt("return",
|
|
2634
|
+
return _context2.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
|
|
2534
2635
|
|
|
2535
2636
|
case 4:
|
|
2536
|
-
throw Error("Unknown token " + address + " in
|
|
2637
|
+
throw Error("Unknown token " + address + " in fetchPriceFromCoingecko");
|
|
2537
2638
|
|
|
2538
2639
|
case 5:
|
|
2539
2640
|
case "end":
|
|
@@ -2542,7 +2643,7 @@ function _fetchBasicTokenPrice() {
|
|
|
2542
2643
|
}
|
|
2543
2644
|
}, _callee2);
|
|
2544
2645
|
}));
|
|
2545
|
-
return
|
|
2646
|
+
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
2546
2647
|
}
|
|
2547
2648
|
|
|
2548
2649
|
function fetchLPPositions(_x3, _x4) {
|
|
@@ -2742,7 +2843,7 @@ function _fetchPrice() {
|
|
|
2742
2843
|
return _context7.abrupt("return", fetchLPPrice(address, provider));
|
|
2743
2844
|
|
|
2744
2845
|
case 9:
|
|
2745
|
-
return _context7.abrupt("return",
|
|
2846
|
+
return _context7.abrupt("return", fetchPriceFromCoingecko(address));
|
|
2746
2847
|
|
|
2747
2848
|
case 10:
|
|
2748
2849
|
case "end":
|
|
@@ -3205,5 +3306,5 @@ var dummyUserMarketDetails = {
|
|
|
3205
3306
|
maxWithdrawableAmount: dummyTokenAmount
|
|
3206
3307
|
};
|
|
3207
3308
|
|
|
3208
|
-
export { AURORA_CHAINID, AURPLYToken, AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, AurPlyPid, BORROW_LIMIT_BUFFER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, DECIMAL_PRECISION, ETHAddress, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, PLYToken, REWARDCLAIMSTART, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, calcLMRewardApr, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount,
|
|
3309
|
+
export { AURORA_CHAINID, AURPLYToken, AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, AurPlyPid, BORROW_LIMIT_BUFFER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, ETHAddress, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_YEAR, PLYToken, REWARDCLAIMSTART, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, calcLMRewardApr, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress };
|
|
3209
3310
|
//# sourceMappingURL=sdk.esm.js.map
|