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