@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/MoneyMarket.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare class MoneyMarketRead extends BlockchainEntityRead {
|
|
|
15
15
|
getDepositAPY(): Promise<BigNumber>;
|
|
16
16
|
getBorrowAPY(): Promise<BigNumber>;
|
|
17
17
|
getCollateralRatio(): Promise<BigNumber>;
|
|
18
|
+
getBorrowPlyAPY(): Promise<BigNumber>;
|
|
19
|
+
getDepositPlyAPY(): Promise<BigNumber>;
|
|
18
20
|
getDetails(): Promise<MoneyMarketDetails>;
|
|
19
21
|
getUserBorrowBalance(userAddress: string): Promise<TokenAmount>;
|
|
20
22
|
getUserDepositBalance(userAddress: string): Promise<TokenAmount>;
|
package/dist/constants.d.ts
CHANGED
|
@@ -19,4 +19,5 @@ export declare const networkAddresses: NetworkAddresses;
|
|
|
19
19
|
export declare const BORROW_LIMIT_BUFFER: BigNumber;
|
|
20
20
|
export declare const REWARDCLAIMSTART = 1673280000;
|
|
21
21
|
export declare const ONE_DAY = 86400;
|
|
22
|
+
export declare const ONE_YEAR: number;
|
|
22
23
|
export declare const AurPlyPid = 1;
|
package/dist/priceFetcher.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import BigNumber from "bignumber.js";
|
|
|
2
2
|
import { providers, BigNumber as BN } from "ethers";
|
|
3
3
|
import { TokenAmount } from "./tokenAmount";
|
|
4
4
|
import { Address } from "./types";
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
5
|
+
export declare function fetchPriceFromCoingeckoAPI(id: string): Promise<BigNumber>;
|
|
6
|
+
export declare function fetchPriceFromCoingecko(address: Address): Promise<BigNumber>;
|
|
7
7
|
export declare function fetchLPPositions(LPAddress: Address, provider: providers.Provider): Promise<{
|
|
8
8
|
token0: Address;
|
|
9
9
|
token1: Address;
|
|
@@ -946,6 +946,7 @@ var networkAddresses = {
|
|
|
946
946
|
var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
|
|
947
947
|
var REWARDCLAIMSTART = 1673280000;
|
|
948
948
|
var ONE_DAY = 86400;
|
|
949
|
+
var ONE_YEAR = ONE_DAY * 365;
|
|
949
950
|
var AurPlyPid = 1;
|
|
950
951
|
|
|
951
952
|
var decimalRecords = {
|
|
@@ -1025,6 +1026,11 @@ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
|
1025
1026
|
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
1026
1027
|
}
|
|
1027
1028
|
|
|
1029
|
+
(function (ComptrollerRewardType) {
|
|
1030
|
+
ComptrollerRewardType[ComptrollerRewardType["PLY"] = 0] = "PLY";
|
|
1031
|
+
ComptrollerRewardType[ComptrollerRewardType["AURORA"] = 1] = "AURORA";
|
|
1032
|
+
})(exports.ComptrollerRewardType || (exports.ComptrollerRewardType = {}));
|
|
1033
|
+
|
|
1028
1034
|
var Token = function Token(address, decimals) {
|
|
1029
1035
|
this.address = address.toLowerCase();
|
|
1030
1036
|
this.decimals = decimals;
|
|
@@ -1231,12 +1237,94 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1231
1237
|
return getCollateralRatio;
|
|
1232
1238
|
}();
|
|
1233
1239
|
|
|
1234
|
-
_proto.
|
|
1235
|
-
var
|
|
1236
|
-
var promises,
|
|
1240
|
+
_proto.getBorrowPlyAPY = /*#__PURE__*/function () {
|
|
1241
|
+
var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
1242
|
+
var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
|
|
1237
1243
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1238
1244
|
while (1) {
|
|
1239
1245
|
switch (_context6.prev = _context6.next) {
|
|
1246
|
+
case 0:
|
|
1247
|
+
promises = [];
|
|
1248
|
+
promises.push(this.getTotalTokenBorrowed().then(function (res) {
|
|
1249
|
+
totalBorrowed = res;
|
|
1250
|
+
}));
|
|
1251
|
+
promises.push(this._comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1252
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1253
|
+
}));
|
|
1254
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1255
|
+
plyPrice = res;
|
|
1256
|
+
}));
|
|
1257
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1258
|
+
underlyingPrice = res;
|
|
1259
|
+
}));
|
|
1260
|
+
_context6.next = 7;
|
|
1261
|
+
return Promise.all(promises);
|
|
1262
|
+
|
|
1263
|
+
case 7:
|
|
1264
|
+
return _context6.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
|
|
1265
|
+
|
|
1266
|
+
case 8:
|
|
1267
|
+
case "end":
|
|
1268
|
+
return _context6.stop();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
}, _callee6, this);
|
|
1272
|
+
}));
|
|
1273
|
+
|
|
1274
|
+
function getBorrowPlyAPY() {
|
|
1275
|
+
return _getBorrowPlyAPY.apply(this, arguments);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
return getBorrowPlyAPY;
|
|
1279
|
+
}();
|
|
1280
|
+
|
|
1281
|
+
_proto.getDepositPlyAPY = /*#__PURE__*/function () {
|
|
1282
|
+
var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
1283
|
+
var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
|
|
1284
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
1285
|
+
while (1) {
|
|
1286
|
+
switch (_context7.prev = _context7.next) {
|
|
1287
|
+
case 0:
|
|
1288
|
+
promises = [];
|
|
1289
|
+
promises.push(this.getTotalTokenDeposited().then(function (res) {
|
|
1290
|
+
totalDeposited = res;
|
|
1291
|
+
}));
|
|
1292
|
+
promises.push(this._comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1293
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1294
|
+
}));
|
|
1295
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1296
|
+
plyPrice = res;
|
|
1297
|
+
}));
|
|
1298
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1299
|
+
underlyingPrice = res;
|
|
1300
|
+
}));
|
|
1301
|
+
_context7.next = 7;
|
|
1302
|
+
return Promise.all(promises);
|
|
1303
|
+
|
|
1304
|
+
case 7:
|
|
1305
|
+
return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
|
|
1306
|
+
|
|
1307
|
+
case 8:
|
|
1308
|
+
case "end":
|
|
1309
|
+
return _context7.stop();
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}, _callee7, this);
|
|
1313
|
+
}));
|
|
1314
|
+
|
|
1315
|
+
function getDepositPlyAPY() {
|
|
1316
|
+
return _getDepositPlyAPY.apply(this, arguments);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
return getDepositPlyAPY;
|
|
1320
|
+
}();
|
|
1321
|
+
|
|
1322
|
+
_proto.getDetails = /*#__PURE__*/function () {
|
|
1323
|
+
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
|
|
1324
|
+
var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeed, plyPrice, underlyingPrice, borrowPlyApy, depositPlyApy;
|
|
1325
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
1326
|
+
while (1) {
|
|
1327
|
+
switch (_context8.prev = _context8.next) {
|
|
1240
1328
|
case 0:
|
|
1241
1329
|
promises = [];
|
|
1242
1330
|
promises.push(this.getTotalTokenDeposited().then(function (res) {
|
|
@@ -1254,27 +1342,38 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1254
1342
|
promises.push(this.getCollateralRatio().then(function (res) {
|
|
1255
1343
|
collateralRatio = res.toNumber();
|
|
1256
1344
|
}));
|
|
1257
|
-
|
|
1345
|
+
promises.push(this._comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1346
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1347
|
+
}));
|
|
1348
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1349
|
+
plyPrice = res;
|
|
1350
|
+
}));
|
|
1351
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1352
|
+
underlyingPrice = res;
|
|
1353
|
+
}));
|
|
1354
|
+
_context8.next = 11;
|
|
1258
1355
|
return Promise.all(promises);
|
|
1259
1356
|
|
|
1260
|
-
case
|
|
1261
|
-
|
|
1357
|
+
case 11:
|
|
1358
|
+
borrowPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
|
|
1359
|
+
depositPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
|
|
1360
|
+
return _context8.abrupt("return", {
|
|
1262
1361
|
auTokenAddress: this.auToken.address,
|
|
1263
1362
|
totalTokenDeposited: totalDeposited,
|
|
1264
1363
|
totalTokenBorrowed: totalBorrowed,
|
|
1265
1364
|
depositApy: depositAPY,
|
|
1266
|
-
depositPlyApy:
|
|
1365
|
+
depositPlyApy: depositPlyApy.toNumber(),
|
|
1267
1366
|
borrowApy: borrowAPY,
|
|
1268
|
-
borrowPlyApy:
|
|
1367
|
+
borrowPlyApy: borrowPlyApy.toNumber(),
|
|
1269
1368
|
collateralRatio: collateralRatio
|
|
1270
1369
|
});
|
|
1271
1370
|
|
|
1272
|
-
case
|
|
1371
|
+
case 14:
|
|
1273
1372
|
case "end":
|
|
1274
|
-
return
|
|
1373
|
+
return _context8.stop();
|
|
1275
1374
|
}
|
|
1276
1375
|
}
|
|
1277
|
-
},
|
|
1376
|
+
}, _callee8, this);
|
|
1278
1377
|
}));
|
|
1279
1378
|
|
|
1280
1379
|
function getDetails() {
|
|
@@ -1285,25 +1384,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1285
1384
|
}();
|
|
1286
1385
|
|
|
1287
1386
|
_proto.getUserBorrowBalance = /*#__PURE__*/function () {
|
|
1288
|
-
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1387
|
+
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(userAddress) {
|
|
1289
1388
|
var totalBorrow;
|
|
1290
|
-
return runtime_1.wrap(function
|
|
1389
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
1291
1390
|
while (1) {
|
|
1292
|
-
switch (
|
|
1391
|
+
switch (_context9.prev = _context9.next) {
|
|
1293
1392
|
case 0:
|
|
1294
|
-
|
|
1393
|
+
_context9.next = 2;
|
|
1295
1394
|
return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
|
|
1296
1395
|
|
|
1297
1396
|
case 2:
|
|
1298
|
-
totalBorrow =
|
|
1299
|
-
return
|
|
1397
|
+
totalBorrow = _context9.sent;
|
|
1398
|
+
return _context9.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
|
|
1300
1399
|
|
|
1301
1400
|
case 4:
|
|
1302
1401
|
case "end":
|
|
1303
|
-
return
|
|
1402
|
+
return _context9.stop();
|
|
1304
1403
|
}
|
|
1305
1404
|
}
|
|
1306
|
-
},
|
|
1405
|
+
}, _callee9, this);
|
|
1307
1406
|
}));
|
|
1308
1407
|
|
|
1309
1408
|
function getUserBorrowBalance(_x) {
|
|
@@ -1314,25 +1413,25 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1314
1413
|
}();
|
|
1315
1414
|
|
|
1316
1415
|
_proto.getUserDepositBalance = /*#__PURE__*/function () {
|
|
1317
|
-
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1416
|
+
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
|
|
1318
1417
|
var totalDeposit;
|
|
1319
|
-
return runtime_1.wrap(function
|
|
1418
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
1320
1419
|
while (1) {
|
|
1321
|
-
switch (
|
|
1420
|
+
switch (_context10.prev = _context10.next) {
|
|
1322
1421
|
case 0:
|
|
1323
|
-
|
|
1422
|
+
_context10.next = 2;
|
|
1324
1423
|
return this.auToken.callStatic.balanceOfUnderlying(userAddress);
|
|
1325
1424
|
|
|
1326
1425
|
case 2:
|
|
1327
|
-
totalDeposit =
|
|
1328
|
-
return
|
|
1426
|
+
totalDeposit = _context10.sent;
|
|
1427
|
+
return _context10.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
|
|
1329
1428
|
|
|
1330
1429
|
case 4:
|
|
1331
1430
|
case "end":
|
|
1332
|
-
return
|
|
1431
|
+
return _context10.stop();
|
|
1333
1432
|
}
|
|
1334
1433
|
}
|
|
1335
|
-
},
|
|
1434
|
+
}, _callee10, this);
|
|
1336
1435
|
}));
|
|
1337
1436
|
|
|
1338
1437
|
function getUserDepositBalance(_x2) {
|
|
@@ -1354,29 +1453,29 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1354
1453
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
1355
1454
|
|
|
1356
1455
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
1357
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1358
|
-
return runtime_1.wrap(function
|
|
1456
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
|
|
1457
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
1359
1458
|
while (1) {
|
|
1360
|
-
switch (
|
|
1459
|
+
switch (_context11.prev = _context11.next) {
|
|
1361
1460
|
case 0:
|
|
1362
1461
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
1363
|
-
|
|
1462
|
+
_context11.next = 4;
|
|
1364
1463
|
break;
|
|
1365
1464
|
}
|
|
1366
1465
|
|
|
1367
|
-
return
|
|
1466
|
+
return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
1368
1467
|
value: amount.rawAmount()
|
|
1369
1468
|
}));
|
|
1370
1469
|
|
|
1371
1470
|
case 4:
|
|
1372
|
-
return
|
|
1471
|
+
return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
1373
1472
|
|
|
1374
1473
|
case 5:
|
|
1375
1474
|
case "end":
|
|
1376
|
-
return
|
|
1475
|
+
return _context11.stop();
|
|
1377
1476
|
}
|
|
1378
1477
|
}
|
|
1379
|
-
},
|
|
1478
|
+
}, _callee11, this);
|
|
1380
1479
|
}));
|
|
1381
1480
|
|
|
1382
1481
|
function deposit(_x3) {
|
|
@@ -1387,19 +1486,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1387
1486
|
}();
|
|
1388
1487
|
|
|
1389
1488
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
1390
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1391
|
-
return runtime_1.wrap(function
|
|
1489
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
|
|
1490
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
1392
1491
|
while (1) {
|
|
1393
|
-
switch (
|
|
1492
|
+
switch (_context12.prev = _context12.next) {
|
|
1394
1493
|
case 0:
|
|
1395
|
-
return
|
|
1494
|
+
return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
1396
1495
|
|
|
1397
1496
|
case 1:
|
|
1398
1497
|
case "end":
|
|
1399
|
-
return
|
|
1498
|
+
return _context12.stop();
|
|
1400
1499
|
}
|
|
1401
1500
|
}
|
|
1402
|
-
},
|
|
1501
|
+
}, _callee12, this);
|
|
1403
1502
|
}));
|
|
1404
1503
|
|
|
1405
1504
|
function borrow(_x4) {
|
|
@@ -1410,19 +1509,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1410
1509
|
}();
|
|
1411
1510
|
|
|
1412
1511
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
1413
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1414
|
-
return runtime_1.wrap(function
|
|
1512
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
|
|
1513
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
1415
1514
|
while (1) {
|
|
1416
|
-
switch (
|
|
1515
|
+
switch (_context13.prev = _context13.next) {
|
|
1417
1516
|
case 0:
|
|
1418
|
-
return
|
|
1517
|
+
return _context13.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
1419
1518
|
|
|
1420
1519
|
case 1:
|
|
1421
1520
|
case "end":
|
|
1422
|
-
return
|
|
1521
|
+
return _context13.stop();
|
|
1423
1522
|
}
|
|
1424
1523
|
}
|
|
1425
|
-
},
|
|
1524
|
+
}, _callee13, this);
|
|
1426
1525
|
}));
|
|
1427
1526
|
|
|
1428
1527
|
function withdraw(_x5) {
|
|
@@ -1433,29 +1532,29 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1433
1532
|
}();
|
|
1434
1533
|
|
|
1435
1534
|
_proto2.repay = /*#__PURE__*/function () {
|
|
1436
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1437
|
-
return runtime_1.wrap(function
|
|
1535
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
|
|
1536
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
1438
1537
|
while (1) {
|
|
1439
|
-
switch (
|
|
1538
|
+
switch (_context14.prev = _context14.next) {
|
|
1440
1539
|
case 0:
|
|
1441
1540
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
1442
|
-
|
|
1541
|
+
_context14.next = 4;
|
|
1443
1542
|
break;
|
|
1444
1543
|
}
|
|
1445
1544
|
|
|
1446
|
-
return
|
|
1545
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
|
|
1447
1546
|
value: amount.rawAmount()
|
|
1448
1547
|
}));
|
|
1449
1548
|
|
|
1450
1549
|
case 4:
|
|
1451
|
-
return
|
|
1550
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
1452
1551
|
|
|
1453
1552
|
case 5:
|
|
1454
1553
|
case "end":
|
|
1455
|
-
return
|
|
1554
|
+
return _context14.stop();
|
|
1456
1555
|
}
|
|
1457
1556
|
}
|
|
1458
|
-
},
|
|
1557
|
+
}, _callee14, this);
|
|
1459
1558
|
}));
|
|
1460
1559
|
|
|
1461
1560
|
function repay(_x6) {
|
|
@@ -1466,19 +1565,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1466
1565
|
}();
|
|
1467
1566
|
|
|
1468
1567
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
1469
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1470
|
-
return runtime_1.wrap(function
|
|
1568
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
|
|
1569
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
1471
1570
|
while (1) {
|
|
1472
|
-
switch (
|
|
1571
|
+
switch (_context15.prev = _context15.next) {
|
|
1473
1572
|
case 0:
|
|
1474
|
-
return
|
|
1573
|
+
return _context15.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
1475
1574
|
|
|
1476
1575
|
case 1:
|
|
1477
1576
|
case "end":
|
|
1478
|
-
return
|
|
1577
|
+
return _context15.stop();
|
|
1479
1578
|
}
|
|
1480
1579
|
}
|
|
1481
|
-
},
|
|
1580
|
+
}, _callee15, this);
|
|
1482
1581
|
}));
|
|
1483
1582
|
|
|
1484
1583
|
function enableCollateral() {
|
|
@@ -1489,19 +1588,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1489
1588
|
}();
|
|
1490
1589
|
|
|
1491
1590
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
1492
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1493
|
-
return runtime_1.wrap(function
|
|
1591
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
|
|
1592
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
1494
1593
|
while (1) {
|
|
1495
|
-
switch (
|
|
1594
|
+
switch (_context16.prev = _context16.next) {
|
|
1496
1595
|
case 0:
|
|
1497
|
-
return
|
|
1596
|
+
return _context16.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
1498
1597
|
|
|
1499
1598
|
case 1:
|
|
1500
1599
|
case "end":
|
|
1501
|
-
return
|
|
1600
|
+
return _context16.stop();
|
|
1502
1601
|
}
|
|
1503
1602
|
}
|
|
1504
|
-
},
|
|
1603
|
+
}, _callee16, this);
|
|
1505
1604
|
}));
|
|
1506
1605
|
|
|
1507
1606
|
function disableCollateral() {
|
|
@@ -2491,12 +2590,12 @@ var dummyABI = {
|
|
|
2491
2590
|
|
|
2492
2591
|
var axios = /*#__PURE__*/require('axios');
|
|
2493
2592
|
|
|
2494
|
-
function
|
|
2495
|
-
return
|
|
2593
|
+
function fetchPriceFromCoingeckoAPI(_x) {
|
|
2594
|
+
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
2496
2595
|
}
|
|
2497
2596
|
|
|
2498
|
-
function
|
|
2499
|
-
|
|
2597
|
+
function _fetchPriceFromCoingeckoAPI() {
|
|
2598
|
+
_fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
|
|
2500
2599
|
var price;
|
|
2501
2600
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2502
2601
|
while (1) {
|
|
@@ -2518,15 +2617,15 @@ function _fetchPriceFromCoingecko() {
|
|
|
2518
2617
|
}
|
|
2519
2618
|
}, _callee);
|
|
2520
2619
|
}));
|
|
2521
|
-
return
|
|
2620
|
+
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
2522
2621
|
}
|
|
2523
2622
|
|
|
2524
|
-
function
|
|
2525
|
-
return
|
|
2623
|
+
function fetchPriceFromCoingecko(_x2) {
|
|
2624
|
+
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
2526
2625
|
}
|
|
2527
2626
|
|
|
2528
|
-
function
|
|
2529
|
-
|
|
2627
|
+
function _fetchPriceFromCoingecko() {
|
|
2628
|
+
_fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
|
|
2530
2629
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2531
2630
|
while (1) {
|
|
2532
2631
|
switch (_context2.prev = _context2.next) {
|
|
@@ -2536,10 +2635,10 @@ function _fetchBasicTokenPrice() {
|
|
|
2536
2635
|
break;
|
|
2537
2636
|
}
|
|
2538
2637
|
|
|
2539
|
-
return _context2.abrupt("return",
|
|
2638
|
+
return _context2.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
|
|
2540
2639
|
|
|
2541
2640
|
case 4:
|
|
2542
|
-
throw Error("Unknown token " + address + " in
|
|
2641
|
+
throw Error("Unknown token " + address + " in fetchPriceFromCoingecko");
|
|
2543
2642
|
|
|
2544
2643
|
case 5:
|
|
2545
2644
|
case "end":
|
|
@@ -2548,7 +2647,7 @@ function _fetchBasicTokenPrice() {
|
|
|
2548
2647
|
}
|
|
2549
2648
|
}, _callee2);
|
|
2550
2649
|
}));
|
|
2551
|
-
return
|
|
2650
|
+
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
2552
2651
|
}
|
|
2553
2652
|
|
|
2554
2653
|
function fetchLPPositions(_x3, _x4) {
|
|
@@ -2748,7 +2847,7 @@ function _fetchPrice() {
|
|
|
2748
2847
|
return _context7.abrupt("return", fetchLPPrice(address, provider));
|
|
2749
2848
|
|
|
2750
2849
|
case 9:
|
|
2751
|
-
return _context7.abrupt("return",
|
|
2850
|
+
return _context7.abrupt("return", fetchPriceFromCoingecko(address));
|
|
2752
2851
|
|
|
2753
2852
|
case 10:
|
|
2754
2853
|
case "end":
|
|
@@ -3227,6 +3326,7 @@ exports.MoneyMarket = MoneyMarket;
|
|
|
3227
3326
|
exports.MoneyMarketRead = MoneyMarketRead;
|
|
3228
3327
|
exports.MoneyMarketReadWrite = MoneyMarketReadWrite;
|
|
3229
3328
|
exports.ONE_DAY = ONE_DAY;
|
|
3329
|
+
exports.ONE_YEAR = ONE_YEAR;
|
|
3230
3330
|
exports.PLYToken = PLYToken;
|
|
3231
3331
|
exports.REWARDCLAIMSTART = REWARDCLAIMSTART;
|
|
3232
3332
|
exports.SDK = SDK;
|
|
@@ -3246,11 +3346,11 @@ exports.dummyTokenAmount2 = dummyTokenAmount2;
|
|
|
3246
3346
|
exports.dummyTokenAmount3 = dummyTokenAmount3;
|
|
3247
3347
|
exports.dummyUserMarketDetails = dummyUserMarketDetails;
|
|
3248
3348
|
exports.dummyZeroTokenAmount = dummyZeroTokenAmount;
|
|
3249
|
-
exports.fetchBasicTokenPrice = fetchBasicTokenPrice;
|
|
3250
3349
|
exports.fetchLPPositions = fetchLPPositions;
|
|
3251
3350
|
exports.fetchLPPrice = fetchLPPrice;
|
|
3252
3351
|
exports.fetchPrice = fetchPrice;
|
|
3253
3352
|
exports.fetchPriceFromCoingecko = fetchPriceFromCoingecko;
|
|
3353
|
+
exports.fetchPriceFromCoingeckoAPI = fetchPriceFromCoingeckoAPI;
|
|
3254
3354
|
exports.fetchPriceFromOracle = fetchPriceFromOracle;
|
|
3255
3355
|
exports.fetchUnderlyingTokensPrices = fetchUnderlyingTokensPrices;
|
|
3256
3356
|
exports.fetchValuation = fetchValuation;
|