@aurigami/sdk 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Papermill.d.ts +2 -0
- package/dist/SDK.d.ts +5 -4
- package/dist/Staking.d.ts +24 -0
- package/dist/constants.d.ts +2 -2
- package/dist/priceFetcher.d.ts +1 -0
- package/dist/sdk.cjs.development.js +447 -179
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +451 -184
- package/dist/sdk.esm.js.map +1 -1
- package/dist/tokenAmount.d.ts +2 -0
- package/dist/types.d.ts +5 -1
- package/package.json +1 -1
- package/src/Papermill.ts +28 -10
- package/src/SDK.ts +37 -122
- package/src/Staking.ts +193 -0
- package/src/constants.ts +2 -2
- package/src/helpers.ts +3 -5
- package/src/priceFetcher.ts +13 -15
- package/src/tokenAmount.ts +14 -1
- package/src/types.ts +6 -1
package/dist/sdk.esm.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { BigNumber as BigNumber$1, utils, Contract, ethers } from 'ethers';
|
|
3
3
|
import { Logger } from 'ethers/lib/utils';
|
|
4
|
+
import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
|
|
5
|
+
import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
6
|
+
import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
|
|
7
|
+
import FaucetABI from '@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json';
|
|
4
8
|
import { Signer } from '@ethersproject/abstract-signer';
|
|
5
|
-
import axios from 'axios';
|
|
6
9
|
import assert from 'assert';
|
|
10
|
+
import axios from 'axios';
|
|
7
11
|
import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
|
|
8
12
|
import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
|
|
9
|
-
import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
|
|
10
|
-
import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
11
13
|
import EthRepayHelperABI from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
|
|
12
|
-
import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
|
|
13
|
-
import FaucetABI from '@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json';
|
|
14
|
-
import EIP20InterfaceABI from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
|
|
15
14
|
import PulpABI from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
15
|
+
import EIP20InterfaceABI from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
|
|
16
16
|
import AuTokenABI from '@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json';
|
|
17
17
|
import AuriAirdropABI from '@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json';
|
|
18
18
|
|
|
@@ -916,24 +916,6 @@ var BlockchainEntity = /*#__PURE__*/function () {
|
|
|
916
916
|
return BlockchainEntity;
|
|
917
917
|
}();
|
|
918
918
|
|
|
919
|
-
var ComptrollerRewardType;
|
|
920
|
-
|
|
921
|
-
(function (ComptrollerRewardType) {
|
|
922
|
-
ComptrollerRewardType[ComptrollerRewardType["PLY"] = 0] = "PLY";
|
|
923
|
-
ComptrollerRewardType[ComptrollerRewardType["AURORA"] = 1] = "AURORA";
|
|
924
|
-
})(ComptrollerRewardType || (ComptrollerRewardType = {}));
|
|
925
|
-
|
|
926
|
-
var MarketAction;
|
|
927
|
-
|
|
928
|
-
(function (MarketAction) {
|
|
929
|
-
MarketAction[MarketAction["Deposit"] = 0] = "Deposit";
|
|
930
|
-
MarketAction[MarketAction["Borrow"] = 1] = "Borrow";
|
|
931
|
-
MarketAction[MarketAction["Withdraw"] = 2] = "Withdraw";
|
|
932
|
-
MarketAction[MarketAction["Repay"] = 3] = "Repay";
|
|
933
|
-
MarketAction[MarketAction["EnableCollateral"] = 4] = "EnableCollateral";
|
|
934
|
-
MarketAction[MarketAction["DisableCollateral"] = 5] = "DisableCollateral";
|
|
935
|
-
})(MarketAction || (MarketAction = {}));
|
|
936
|
-
|
|
937
919
|
var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
938
920
|
var ETHAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
939
921
|
var AURORA_CHAINID = 1313161554;
|
|
@@ -1000,7 +982,7 @@ var networkAddresses = {
|
|
|
1000
982
|
var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
|
|
1001
983
|
return t.underlying;
|
|
1002
984
|
}), [networkAddresses.tokens.AURORA, networkAddresses.tokens.TRI, networkAddresses.tokens.META, networkAddresses.tokens.stNEAR]));
|
|
1003
|
-
var REWARD_CLAIM_START =
|
|
985
|
+
var REWARD_CLAIM_START = 1651748400;
|
|
1004
986
|
var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(1);
|
|
1005
987
|
var ONE_DAY = 86400;
|
|
1006
988
|
var ONE_WEEK = ONE_DAY * 7;
|
|
@@ -1195,6 +1177,24 @@ function _getBlockBeforeTimestamp() {
|
|
|
1195
1177
|
return _getBlockBeforeTimestamp.apply(this, arguments);
|
|
1196
1178
|
}
|
|
1197
1179
|
|
|
1180
|
+
var ComptrollerRewardType;
|
|
1181
|
+
|
|
1182
|
+
(function (ComptrollerRewardType) {
|
|
1183
|
+
ComptrollerRewardType[ComptrollerRewardType["PLY"] = 0] = "PLY";
|
|
1184
|
+
ComptrollerRewardType[ComptrollerRewardType["AURORA"] = 1] = "AURORA";
|
|
1185
|
+
})(ComptrollerRewardType || (ComptrollerRewardType = {}));
|
|
1186
|
+
|
|
1187
|
+
var MarketAction;
|
|
1188
|
+
|
|
1189
|
+
(function (MarketAction) {
|
|
1190
|
+
MarketAction[MarketAction["Deposit"] = 0] = "Deposit";
|
|
1191
|
+
MarketAction[MarketAction["Borrow"] = 1] = "Borrow";
|
|
1192
|
+
MarketAction[MarketAction["Withdraw"] = 2] = "Withdraw";
|
|
1193
|
+
MarketAction[MarketAction["Repay"] = 3] = "Repay";
|
|
1194
|
+
MarketAction[MarketAction["EnableCollateral"] = 4] = "EnableCollateral";
|
|
1195
|
+
MarketAction[MarketAction["DisableCollateral"] = 5] = "DisableCollateral";
|
|
1196
|
+
})(MarketAction || (MarketAction = {}));
|
|
1197
|
+
|
|
1198
1198
|
var Token = function Token(address, decimals) {
|
|
1199
1199
|
this.address = address.toLowerCase();
|
|
1200
1200
|
this.decimals = decimals;
|
|
@@ -1227,6 +1227,14 @@ var TokenAmount = /*#__PURE__*/function () {
|
|
|
1227
1227
|
return this.rawAmnt;
|
|
1228
1228
|
};
|
|
1229
1229
|
|
|
1230
|
+
TokenAmount.fromAddressAndAmount = function fromAddressAndAmount(tokenAddress, amount, isRaw) {
|
|
1231
|
+
if (isRaw === void 0) {
|
|
1232
|
+
isRaw = true;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
return new TokenAmount(new Token(tokenAddress, getDecimal(tokenAddress)), amount, isRaw);
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1230
1238
|
return TokenAmount;
|
|
1231
1239
|
}();
|
|
1232
1240
|
|
|
@@ -2331,7 +2339,7 @@ function _fetchLPPrice() {
|
|
|
2331
2339
|
return _fetchLPPriceBy.apply(this, arguments);
|
|
2332
2340
|
};
|
|
2333
2341
|
|
|
2334
|
-
fetchLPPriceBy = function _fetchLPPriceBy2(
|
|
2342
|
+
fetchLPPriceBy = function _fetchLPPriceBy2(_x22) {
|
|
2335
2343
|
return _fetchLPPriceBy.apply(this, arguments);
|
|
2336
2344
|
};
|
|
2337
2345
|
|
|
@@ -2590,78 +2598,97 @@ function fetchPLYPrice(_x15) {
|
|
|
2590
2598
|
|
|
2591
2599
|
function _fetchPLYPrice() {
|
|
2592
2600
|
_fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(provider) {
|
|
2593
|
-
var LPInfo, plyAddress, plyDecimal, wnearAddress, wnearDecimal;
|
|
2594
2601
|
return runtime_1.wrap(function _callee11$(_context11) {
|
|
2595
2602
|
while (1) {
|
|
2596
2603
|
switch (_context11.prev = _context11.next) {
|
|
2597
2604
|
case 0:
|
|
2598
|
-
return _context11.abrupt("return",
|
|
2605
|
+
return _context11.abrupt("return", fetchToken0PriceByLP(networkAddresses.tokens.PLYWNEAR, provider));
|
|
2599
2606
|
|
|
2600
|
-
case
|
|
2601
|
-
|
|
2607
|
+
case 1:
|
|
2608
|
+
case "end":
|
|
2609
|
+
return _context11.stop();
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
}, _callee11);
|
|
2613
|
+
}));
|
|
2614
|
+
return _fetchPLYPrice.apply(this, arguments);
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
function fetchToken0PriceByLP(_x16, _x17) {
|
|
2618
|
+
return _fetchToken0PriceByLP.apply(this, arguments);
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
function _fetchToken0PriceByLP() {
|
|
2622
|
+
_fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(LP, provider) {
|
|
2623
|
+
var LPInfo, token0Decimal, token1Decimal;
|
|
2624
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
2625
|
+
while (1) {
|
|
2626
|
+
switch (_context12.prev = _context12.next) {
|
|
2627
|
+
case 0:
|
|
2628
|
+
_context12.next = 2;
|
|
2629
|
+
return fetchLPPositions(LP, provider);
|
|
2630
|
+
|
|
2631
|
+
case 2:
|
|
2632
|
+
LPInfo = _context12.sent;
|
|
2602
2633
|
|
|
2603
2634
|
if (!LPInfo.reserve1.isZero()) {
|
|
2604
|
-
|
|
2635
|
+
_context12.next = 5;
|
|
2605
2636
|
break;
|
|
2606
2637
|
}
|
|
2607
2638
|
|
|
2608
|
-
return
|
|
2639
|
+
return _context12.abrupt("return", new BigNumber(0));
|
|
2609
2640
|
|
|
2610
|
-
case
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
case 14:
|
|
2621
|
-
return _context11.abrupt("return", _context11.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(plyDecimal)).dividedBy(decimalFactor(wnearDecimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
2622
|
-
|
|
2623
|
-
case 15:
|
|
2641
|
+
case 5:
|
|
2642
|
+
token0Decimal = getDecimal(LPInfo.token0);
|
|
2643
|
+
token1Decimal = getDecimal(LPInfo.token1);
|
|
2644
|
+
_context12.next = 9;
|
|
2645
|
+
return fetchPrice(LPInfo.token1, provider);
|
|
2646
|
+
|
|
2647
|
+
case 9:
|
|
2648
|
+
return _context12.abrupt("return", _context12.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
2649
|
+
|
|
2650
|
+
case 10:
|
|
2624
2651
|
case "end":
|
|
2625
|
-
return
|
|
2652
|
+
return _context12.stop();
|
|
2626
2653
|
}
|
|
2627
2654
|
}
|
|
2628
|
-
},
|
|
2655
|
+
}, _callee12);
|
|
2629
2656
|
}));
|
|
2630
|
-
return
|
|
2657
|
+
return _fetchToken0PriceByLP.apply(this, arguments);
|
|
2631
2658
|
}
|
|
2632
2659
|
|
|
2633
|
-
function fetchValuation(
|
|
2660
|
+
function fetchValuation(_x18, _x19) {
|
|
2634
2661
|
return _fetchValuation.apply(this, arguments);
|
|
2635
2662
|
}
|
|
2636
2663
|
|
|
2637
2664
|
function _fetchValuation() {
|
|
2638
|
-
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2665
|
+
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(tokenAmount, provider) {
|
|
2639
2666
|
var price;
|
|
2640
|
-
return runtime_1.wrap(function
|
|
2667
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
2641
2668
|
while (1) {
|
|
2642
|
-
switch (
|
|
2669
|
+
switch (_context13.prev = _context13.next) {
|
|
2643
2670
|
case 0:
|
|
2644
2671
|
if (!(tokenAmount.rawAmount() == '0')) {
|
|
2645
|
-
|
|
2672
|
+
_context13.next = 2;
|
|
2646
2673
|
break;
|
|
2647
2674
|
}
|
|
2648
2675
|
|
|
2649
|
-
return
|
|
2676
|
+
return _context13.abrupt("return", new BigNumber(0));
|
|
2650
2677
|
|
|
2651
2678
|
case 2:
|
|
2652
|
-
|
|
2679
|
+
_context13.next = 4;
|
|
2653
2680
|
return fetchPrice(tokenAmount.token.address, provider);
|
|
2654
2681
|
|
|
2655
2682
|
case 4:
|
|
2656
|
-
price =
|
|
2657
|
-
return
|
|
2683
|
+
price = _context13.sent;
|
|
2684
|
+
return _context13.abrupt("return", calcValuation(tokenAmount, price));
|
|
2658
2685
|
|
|
2659
2686
|
case 6:
|
|
2660
2687
|
case "end":
|
|
2661
|
-
return
|
|
2688
|
+
return _context13.stop();
|
|
2662
2689
|
}
|
|
2663
2690
|
}
|
|
2664
|
-
},
|
|
2691
|
+
}, _callee13);
|
|
2665
2692
|
}));
|
|
2666
2693
|
return _fetchValuation.apply(this, arguments);
|
|
2667
2694
|
}
|
|
@@ -2669,23 +2696,23 @@ function _fetchValuation() {
|
|
|
2669
2696
|
function calcValuation(tokenAmount, price) {
|
|
2670
2697
|
return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price);
|
|
2671
2698
|
}
|
|
2672
|
-
function valuateToken(
|
|
2699
|
+
function valuateToken(_x20, _x21) {
|
|
2673
2700
|
return _valuateToken.apply(this, arguments);
|
|
2674
2701
|
}
|
|
2675
2702
|
|
|
2676
2703
|
function _valuateToken() {
|
|
2677
|
-
_valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2704
|
+
_valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
|
|
2678
2705
|
var tokenValuation;
|
|
2679
|
-
return runtime_1.wrap(function
|
|
2706
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
2680
2707
|
while (1) {
|
|
2681
|
-
switch (
|
|
2708
|
+
switch (_context14.prev = _context14.next) {
|
|
2682
2709
|
case 0:
|
|
2683
|
-
|
|
2710
|
+
_context14.next = 2;
|
|
2684
2711
|
return fetchValuation(tokenAmount, provider);
|
|
2685
2712
|
|
|
2686
2713
|
case 2:
|
|
2687
|
-
tokenValuation =
|
|
2688
|
-
return
|
|
2714
|
+
tokenValuation = _context14.sent;
|
|
2715
|
+
return _context14.abrupt("return", {
|
|
2689
2716
|
tokenAmount: tokenAmount,
|
|
2690
2717
|
currencyAmount: {
|
|
2691
2718
|
currency: 'USD',
|
|
@@ -2695,10 +2722,10 @@ function _valuateToken() {
|
|
|
2695
2722
|
|
|
2696
2723
|
case 4:
|
|
2697
2724
|
case "end":
|
|
2698
|
-
return
|
|
2725
|
+
return _context14.stop();
|
|
2699
2726
|
}
|
|
2700
2727
|
}
|
|
2701
|
-
},
|
|
2728
|
+
}, _callee14);
|
|
2702
2729
|
}));
|
|
2703
2730
|
return _valuateToken.apply(this, arguments);
|
|
2704
2731
|
}
|
|
@@ -3384,6 +3411,7 @@ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
|
|
|
3384
3411
|
return MoneyMarket;
|
|
3385
3412
|
}(BlockchainEntity);
|
|
3386
3413
|
|
|
3414
|
+
var LOCKING_DENOMINATOR = /*#__PURE__*/BigNumber$1.from(10000);
|
|
3387
3415
|
var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
3388
3416
|
_inheritsLoose(PapermillRead, _BlockchainEntityRead);
|
|
3389
3417
|
|
|
@@ -3494,40 +3522,42 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3494
3522
|
return getUnclaimedPlyReward;
|
|
3495
3523
|
}();
|
|
3496
3524
|
|
|
3525
|
+
_proto.getWeek = function getWeek(timestamp) {
|
|
3526
|
+
return BigNumber$1.from(timestamp - REWARD_CLAIM_START).div(ONE_WEEK).toNumber();
|
|
3527
|
+
};
|
|
3528
|
+
|
|
3497
3529
|
_proto.getLockingDetails = /*#__PURE__*/function () {
|
|
3498
3530
|
var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(userAddress) {
|
|
3499
|
-
var
|
|
3531
|
+
var currentWeek, promises, values, percentLockCurrentWeek, percentLockNextWeek, totalRewards, _yield$this$_pulp$cal, pulpAmountCurrentWeek, plyAmountCurrentWeek, plyAmountNextWeek, pulpAmountNextWeek, currentUnlockPortion, nextUnlockPortion;
|
|
3500
3532
|
|
|
3501
3533
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
3502
3534
|
while (1) {
|
|
3503
3535
|
switch (_context4.prev = _context4.next) {
|
|
3504
3536
|
case 0:
|
|
3505
|
-
|
|
3506
|
-
currentWeek = BigNumber$1.from(currentTime - REWARD_CLAIM_START).div(ONE_WEEK).toNumber();
|
|
3507
|
-
denominator = BigNumber$1.from(10000);
|
|
3537
|
+
currentWeek = this.getWeek(getCurrentTimestamp());
|
|
3508
3538
|
promises = [];
|
|
3509
3539
|
promises.push(this._auriLens.getPercentLock(this._pulp.address, userAddress, currentWeek));
|
|
3510
3540
|
promises.push(this._auriLens.getPercentLock(this._pulp.address, userAddress, currentWeek + 1));
|
|
3511
3541
|
promises.push(this.getUnclaimedPlyReward(userAddress));
|
|
3512
|
-
_context4.next =
|
|
3542
|
+
_context4.next = 7;
|
|
3513
3543
|
return Promise.all(promises);
|
|
3514
3544
|
|
|
3515
|
-
case
|
|
3545
|
+
case 7:
|
|
3516
3546
|
values = _context4.sent;
|
|
3517
3547
|
percentLockCurrentWeek = BigNumber$1.from(values[0]);
|
|
3518
3548
|
percentLockNextWeek = BigNumber$1.from(values[1]);
|
|
3519
3549
|
totalRewards = values[2];
|
|
3520
|
-
_context4.next =
|
|
3550
|
+
_context4.next = 13;
|
|
3521
3551
|
return this._pulp.calcLockAmount(userAddress, totalRewards.rawAmount());
|
|
3522
3552
|
|
|
3523
|
-
case
|
|
3553
|
+
case 13:
|
|
3524
3554
|
_yield$this$_pulp$cal = _context4.sent;
|
|
3525
3555
|
pulpAmountCurrentWeek = _yield$this$_pulp$cal[0];
|
|
3526
3556
|
plyAmountCurrentWeek = _yield$this$_pulp$cal[1];
|
|
3527
|
-
plyAmountNextWeek = percentLockNextWeek.mul(totalRewards.rawAmount()).div(
|
|
3557
|
+
plyAmountNextWeek = percentLockNextWeek.mul(totalRewards.rawAmount()).div(LOCKING_DENOMINATOR);
|
|
3528
3558
|
pulpAmountNextWeek = BigNumber$1.from(totalRewards.rawAmount()).sub(plyAmountNextWeek);
|
|
3529
|
-
currentUnlockPortion =
|
|
3530
|
-
nextUnlockPortion =
|
|
3559
|
+
currentUnlockPortion = LOCKING_DENOMINATOR.sub(percentLockCurrentWeek).toString();
|
|
3560
|
+
nextUnlockPortion = LOCKING_DENOMINATOR.sub(percentLockNextWeek).toString();
|
|
3531
3561
|
return _context4.abrupt("return", {
|
|
3532
3562
|
vestingStart: REWARD_CLAIM_START,
|
|
3533
3563
|
currentUnlockPortion: new BigNumber(currentUnlockPortion).dividedBy(100).toNumber(),
|
|
@@ -3539,7 +3569,7 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3539
3569
|
nextPulp: new TokenAmount(this.pulpToken, pulpAmountNextWeek.toString())
|
|
3540
3570
|
});
|
|
3541
3571
|
|
|
3542
|
-
case
|
|
3572
|
+
case 21:
|
|
3543
3573
|
case "end":
|
|
3544
3574
|
return _context4.stop();
|
|
3545
3575
|
}
|
|
@@ -3583,6 +3613,36 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3583
3613
|
return getTimestampToUnlock;
|
|
3584
3614
|
}();
|
|
3585
3615
|
|
|
3616
|
+
_proto.getUnlockPortionAt = /*#__PURE__*/function () {
|
|
3617
|
+
var _getUnlockPortionAt = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(userAddress, timestamp) {
|
|
3618
|
+
var lockPortion, unlockPortion;
|
|
3619
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
3620
|
+
while (1) {
|
|
3621
|
+
switch (_context6.prev = _context6.next) {
|
|
3622
|
+
case 0:
|
|
3623
|
+
_context6.next = 2;
|
|
3624
|
+
return this._auriLens.getPercentLock(this._pulp.address, userAddress, this.getWeek(timestamp));
|
|
3625
|
+
|
|
3626
|
+
case 2:
|
|
3627
|
+
lockPortion = _context6.sent;
|
|
3628
|
+
unlockPortion = LOCKING_DENOMINATOR.sub(lockPortion);
|
|
3629
|
+
return _context6.abrupt("return", unlockPortion.toNumber() / 100);
|
|
3630
|
+
|
|
3631
|
+
case 5:
|
|
3632
|
+
case "end":
|
|
3633
|
+
return _context6.stop();
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
}, _callee6, this);
|
|
3637
|
+
}));
|
|
3638
|
+
|
|
3639
|
+
function getUnlockPortionAt(_x7, _x8) {
|
|
3640
|
+
return _getUnlockPortionAt.apply(this, arguments);
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
return getUnlockPortionAt;
|
|
3644
|
+
}();
|
|
3645
|
+
|
|
3586
3646
|
return PapermillRead;
|
|
3587
3647
|
}(BlockchainEntityRead);
|
|
3588
3648
|
var PapermillReadWrite = /*#__PURE__*/function (_PapermillRead) {
|
|
@@ -3595,22 +3655,22 @@ var PapermillReadWrite = /*#__PURE__*/function (_PapermillRead) {
|
|
|
3595
3655
|
var _proto2 = PapermillReadWrite.prototype;
|
|
3596
3656
|
|
|
3597
3657
|
_proto2.redeem = /*#__PURE__*/function () {
|
|
3598
|
-
var _redeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3599
|
-
return runtime_1.wrap(function
|
|
3658
|
+
var _redeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(recipient, amount) {
|
|
3659
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
3600
3660
|
while (1) {
|
|
3601
|
-
switch (
|
|
3661
|
+
switch (_context7.prev = _context7.next) {
|
|
3602
3662
|
case 0:
|
|
3603
|
-
return
|
|
3663
|
+
return _context7.abrupt("return", this._pulp.connect(this._networkConnection.signer).redeem(recipient, amount.rawAmount()));
|
|
3604
3664
|
|
|
3605
3665
|
case 1:
|
|
3606
3666
|
case "end":
|
|
3607
|
-
return
|
|
3667
|
+
return _context7.stop();
|
|
3608
3668
|
}
|
|
3609
3669
|
}
|
|
3610
|
-
},
|
|
3670
|
+
}, _callee7, this);
|
|
3611
3671
|
}));
|
|
3612
3672
|
|
|
3613
|
-
function redeem(
|
|
3673
|
+
function redeem(_x9, _x10) {
|
|
3614
3674
|
return _redeem.apply(this, arguments);
|
|
3615
3675
|
}
|
|
3616
3676
|
|
|
@@ -3618,28 +3678,28 @@ var PapermillReadWrite = /*#__PURE__*/function (_PapermillRead) {
|
|
|
3618
3678
|
}();
|
|
3619
3679
|
|
|
3620
3680
|
_proto2.selfRedeem = /*#__PURE__*/function () {
|
|
3621
|
-
var _selfRedeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3681
|
+
var _selfRedeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
|
|
3622
3682
|
var msgSender;
|
|
3623
|
-
return runtime_1.wrap(function
|
|
3683
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
3624
3684
|
while (1) {
|
|
3625
|
-
switch (
|
|
3685
|
+
switch (_context8.prev = _context8.next) {
|
|
3626
3686
|
case 0:
|
|
3627
|
-
|
|
3687
|
+
_context8.next = 2;
|
|
3628
3688
|
return this._networkConnection.signer.getAddress();
|
|
3629
3689
|
|
|
3630
3690
|
case 2:
|
|
3631
|
-
msgSender =
|
|
3632
|
-
return
|
|
3691
|
+
msgSender = _context8.sent;
|
|
3692
|
+
return _context8.abrupt("return", this.redeem(msgSender, amount));
|
|
3633
3693
|
|
|
3634
3694
|
case 4:
|
|
3635
3695
|
case "end":
|
|
3636
|
-
return
|
|
3696
|
+
return _context8.stop();
|
|
3637
3697
|
}
|
|
3638
3698
|
}
|
|
3639
|
-
},
|
|
3699
|
+
}, _callee8, this);
|
|
3640
3700
|
}));
|
|
3641
3701
|
|
|
3642
|
-
function selfRedeem(
|
|
3702
|
+
function selfRedeem(_x11) {
|
|
3643
3703
|
return _selfRedeem.apply(this, arguments);
|
|
3644
3704
|
}
|
|
3645
3705
|
|
|
@@ -3668,6 +3728,244 @@ var Papermill = /*#__PURE__*/function (_BlockchainEntity) {
|
|
|
3668
3728
|
return Papermill;
|
|
3669
3729
|
}(BlockchainEntity);
|
|
3670
3730
|
|
|
3731
|
+
var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
3732
|
+
_inheritsLoose(StakingRead, _BlockchainEntityRead);
|
|
3733
|
+
|
|
3734
|
+
function StakingRead(networkConnection) {
|
|
3735
|
+
var _this;
|
|
3736
|
+
|
|
3737
|
+
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
3738
|
+
_this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
|
|
3739
|
+
_this._auriFairLaunch = new Contract(networkAddresses.misc.AURIFAIRLAUNCH, AuriFairLaunchABI.abi, networkConnection.provider);
|
|
3740
|
+
_this._auriLens = new Contract(networkAddresses.misc.AURILENS, AuriLensABI.abi, networkConnection.provider);
|
|
3741
|
+
return _this;
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
var _proto = StakingRead.prototype;
|
|
3745
|
+
|
|
3746
|
+
_proto.getPLYWNEARPoolDetails = /*#__PURE__*/function () {
|
|
3747
|
+
var _getPLYWNEARPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3748
|
+
var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, totalStakeValuation, promises, i, rewardTokenAddress, rewardToken, rewardPerSecond, APYs;
|
|
3749
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
3750
|
+
while (1) {
|
|
3751
|
+
switch (_context.prev = _context.next) {
|
|
3752
|
+
case 0:
|
|
3753
|
+
_context.next = 2;
|
|
3754
|
+
return this._auriFairLaunch.getPoolInfo(PLYWNEAR_POOL_ID).then(function (res) {
|
|
3755
|
+
stakedLiquidity = res.totalStake;
|
|
3756
|
+
rewardPerSeconds = res.rewardPerSeconds;
|
|
3757
|
+
});
|
|
3758
|
+
|
|
3759
|
+
case 2:
|
|
3760
|
+
stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity.toString());
|
|
3761
|
+
_context.next = 5;
|
|
3762
|
+
return fetchValuation(stakedLiquidityAmount, this._networkConnection.provider);
|
|
3763
|
+
|
|
3764
|
+
case 5:
|
|
3765
|
+
totalStakeValuation = _context.sent;
|
|
3766
|
+
promises = [];
|
|
3767
|
+
|
|
3768
|
+
for (i = 0; i < rewardPerSeconds.length; i++) {
|
|
3769
|
+
rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[i];
|
|
3770
|
+
rewardToken = new Token(rewardTokenAddress, getDecimal(rewardTokenAddress));
|
|
3771
|
+
rewardPerSecond = rewardPerSeconds[i];
|
|
3772
|
+
promises.push(fetchValuation(new TokenAmount(rewardToken, rewardPerSecond.toString()), this._networkConnection.provider));
|
|
3773
|
+
}
|
|
3774
|
+
|
|
3775
|
+
APYs = [];
|
|
3776
|
+
_context.next = 11;
|
|
3777
|
+
return Promise.all(promises);
|
|
3778
|
+
|
|
3779
|
+
case 11:
|
|
3780
|
+
_context.sent.forEach(function (rewardPerSecondValuation, i) {
|
|
3781
|
+
var rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[i];
|
|
3782
|
+
var apy = calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION);
|
|
3783
|
+
APYs.push({
|
|
3784
|
+
address: rewardTokenAddress,
|
|
3785
|
+
apy: apy
|
|
3786
|
+
});
|
|
3787
|
+
});
|
|
3788
|
+
|
|
3789
|
+
return _context.abrupt("return", {
|
|
3790
|
+
totalStakedLiquidity: {
|
|
3791
|
+
tokenAmount: stakedLiquidityAmount,
|
|
3792
|
+
currencyAmount: {
|
|
3793
|
+
currency: 'USD',
|
|
3794
|
+
amount: totalStakeValuation.toFixed(DECIMAL_PRECISION)
|
|
3795
|
+
}
|
|
3796
|
+
},
|
|
3797
|
+
APYs: APYs
|
|
3798
|
+
});
|
|
3799
|
+
|
|
3800
|
+
case 13:
|
|
3801
|
+
case "end":
|
|
3802
|
+
return _context.stop();
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
}, _callee, this);
|
|
3806
|
+
}));
|
|
3807
|
+
|
|
3808
|
+
function getPLYWNEARPoolDetails() {
|
|
3809
|
+
return _getPLYWNEARPoolDetails.apply(this, arguments);
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3812
|
+
return getPLYWNEARPoolDetails;
|
|
3813
|
+
}();
|
|
3814
|
+
|
|
3815
|
+
_proto.stakeBalanceOf = /*#__PURE__*/function () {
|
|
3816
|
+
var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(user) {
|
|
3817
|
+
var userInfo, stakeAmount;
|
|
3818
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
3819
|
+
while (1) {
|
|
3820
|
+
switch (_context2.prev = _context2.next) {
|
|
3821
|
+
case 0:
|
|
3822
|
+
_context2.next = 2;
|
|
3823
|
+
return this._auriFairLaunch.getUserInfo(PLYWNEAR_POOL_ID, user);
|
|
3824
|
+
|
|
3825
|
+
case 2:
|
|
3826
|
+
userInfo = _context2.sent;
|
|
3827
|
+
stakeAmount = new TokenAmount(PLYWNEARToken, userInfo.amount.toString());
|
|
3828
|
+
return _context2.abrupt("return", valuateToken(stakeAmount, this._networkConnection.provider));
|
|
3829
|
+
|
|
3830
|
+
case 5:
|
|
3831
|
+
case "end":
|
|
3832
|
+
return _context2.stop();
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
}, _callee2, this);
|
|
3836
|
+
}));
|
|
3837
|
+
|
|
3838
|
+
function stakeBalanceOf(_x) {
|
|
3839
|
+
return _stakeBalanceOf.apply(this, arguments);
|
|
3840
|
+
}
|
|
3841
|
+
|
|
3842
|
+
return stakeBalanceOf;
|
|
3843
|
+
}();
|
|
3844
|
+
|
|
3845
|
+
_proto.LpBalanceOf = /*#__PURE__*/function () {
|
|
3846
|
+
var _LpBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(user) {
|
|
3847
|
+
var lpContract, balance;
|
|
3848
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
3849
|
+
while (1) {
|
|
3850
|
+
switch (_context3.prev = _context3.next) {
|
|
3851
|
+
case 0:
|
|
3852
|
+
lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, EIP20InterfaceABI.abi, this._networkConnection.provider);
|
|
3853
|
+
_context3.next = 3;
|
|
3854
|
+
return lpContract.balanceOf(user);
|
|
3855
|
+
|
|
3856
|
+
case 3:
|
|
3857
|
+
balance = _context3.sent;
|
|
3858
|
+
return _context3.abrupt("return", valuateToken(new TokenAmount(PLYWNEARToken, balance.toString()), this._networkConnection.provider));
|
|
3859
|
+
|
|
3860
|
+
case 5:
|
|
3861
|
+
case "end":
|
|
3862
|
+
return _context3.stop();
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
}, _callee3, this);
|
|
3866
|
+
}));
|
|
3867
|
+
|
|
3868
|
+
function LpBalanceOf(_x2) {
|
|
3869
|
+
return _LpBalanceOf.apply(this, arguments);
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
return LpBalanceOf;
|
|
3873
|
+
}();
|
|
3874
|
+
|
|
3875
|
+
_proto.unclaimedRewardsOf = /*#__PURE__*/function () {
|
|
3876
|
+
var _unclaimedRewardsOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(user) {
|
|
3877
|
+
var userInfo, rewards;
|
|
3878
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
3879
|
+
while (1) {
|
|
3880
|
+
switch (_context4.prev = _context4.next) {
|
|
3881
|
+
case 0:
|
|
3882
|
+
_context4.next = 2;
|
|
3883
|
+
return this._auriFairLaunch.callStatic.updateAndGetUserInfo(PLYWNEAR_POOL_ID, user, {
|
|
3884
|
+
from: user
|
|
3885
|
+
});
|
|
3886
|
+
|
|
3887
|
+
case 2:
|
|
3888
|
+
userInfo = _context4.sent;
|
|
3889
|
+
rewards = userInfo.unclaimedRewards;
|
|
3890
|
+
return _context4.abrupt("return", rewards.map(function (reward, i) {
|
|
3891
|
+
return TokenAmount.fromAddressAndAmount(PLYWNEAR_REWARD_TOKENS[i], reward.toString());
|
|
3892
|
+
}));
|
|
3893
|
+
|
|
3894
|
+
case 5:
|
|
3895
|
+
case "end":
|
|
3896
|
+
return _context4.stop();
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
}, _callee4, this);
|
|
3900
|
+
}));
|
|
3901
|
+
|
|
3902
|
+
function unclaimedRewardsOf(_x3) {
|
|
3903
|
+
return _unclaimedRewardsOf.apply(this, arguments);
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
return unclaimedRewardsOf;
|
|
3907
|
+
}();
|
|
3908
|
+
|
|
3909
|
+
return StakingRead;
|
|
3910
|
+
}(BlockchainEntityRead);
|
|
3911
|
+
var StakingReadWrite = /*#__PURE__*/function (_StakingRead) {
|
|
3912
|
+
_inheritsLoose(StakingReadWrite, _StakingRead);
|
|
3913
|
+
|
|
3914
|
+
function StakingReadWrite() {
|
|
3915
|
+
return _StakingRead.apply(this, arguments) || this;
|
|
3916
|
+
}
|
|
3917
|
+
|
|
3918
|
+
var _proto2 = StakingReadWrite.prototype;
|
|
3919
|
+
|
|
3920
|
+
_proto2.stake = /*#__PURE__*/function () {
|
|
3921
|
+
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(amount) {
|
|
3922
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
3923
|
+
while (1) {
|
|
3924
|
+
switch (_context5.prev = _context5.next) {
|
|
3925
|
+
case 0:
|
|
3926
|
+
return _context5.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(PLYWNEAR_POOL_ID, amount.rawAmount()));
|
|
3927
|
+
|
|
3928
|
+
case 1:
|
|
3929
|
+
case "end":
|
|
3930
|
+
return _context5.stop();
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
}, _callee5, this);
|
|
3934
|
+
}));
|
|
3935
|
+
|
|
3936
|
+
function stake(_x4) {
|
|
3937
|
+
return _stake.apply(this, arguments);
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
return stake;
|
|
3941
|
+
}();
|
|
3942
|
+
|
|
3943
|
+
_proto2.unstake = /*#__PURE__*/function () {
|
|
3944
|
+
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(amount) {
|
|
3945
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
3946
|
+
while (1) {
|
|
3947
|
+
switch (_context6.prev = _context6.next) {
|
|
3948
|
+
case 0:
|
|
3949
|
+
return _context6.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(PLYWNEAR_POOL_ID, amount.rawAmount()));
|
|
3950
|
+
|
|
3951
|
+
case 1:
|
|
3952
|
+
case "end":
|
|
3953
|
+
return _context6.stop();
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
}, _callee6, this);
|
|
3957
|
+
}));
|
|
3958
|
+
|
|
3959
|
+
function unstake(_x5) {
|
|
3960
|
+
return _unstake.apply(this, arguments);
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
return unstake;
|
|
3964
|
+
}();
|
|
3965
|
+
|
|
3966
|
+
return StakingReadWrite;
|
|
3967
|
+
}(StakingRead);
|
|
3968
|
+
|
|
3671
3969
|
var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
3672
3970
|
_inheritsLoose(SdkRead, _BlockchainEntityRead);
|
|
3673
3971
|
|
|
@@ -3826,53 +4124,13 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3826
4124
|
|
|
3827
4125
|
_proto.getPLYWNEARPoolDetails = /*#__PURE__*/function () {
|
|
3828
4126
|
var _getPLYWNEARPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
3829
|
-
var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, promises, _i, rewardTokenAddress, rewardToken, rewardPerSecond, rewardPerSecondValuation, totalStakeValuation;
|
|
3830
|
-
|
|
3831
4127
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
3832
4128
|
while (1) {
|
|
3833
4129
|
switch (_context2.prev = _context2.next) {
|
|
3834
4130
|
case 0:
|
|
3835
|
-
_context2.
|
|
3836
|
-
return this._auriFairLaunch.getPoolInfo(PLYWNEAR_POOL_ID).then(function (res) {
|
|
3837
|
-
stakedLiquidity = res.totalStake;
|
|
3838
|
-
rewardPerSeconds = res.rewardPerSeconds;
|
|
3839
|
-
});
|
|
3840
|
-
|
|
3841
|
-
case 2:
|
|
3842
|
-
stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity.toString());
|
|
3843
|
-
promises = [];
|
|
3844
|
-
|
|
3845
|
-
for (_i = 0; _i < rewardPerSeconds.length; _i++) {
|
|
3846
|
-
rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[_i];
|
|
3847
|
-
rewardToken = new Token(rewardTokenAddress, getDecimal(rewardTokenAddress));
|
|
3848
|
-
rewardPerSecond = rewardPerSeconds[_i];
|
|
3849
|
-
promises.push(fetchValuation(new TokenAmount(rewardToken, rewardPerSecond.toString()), this._networkConnection.provider));
|
|
3850
|
-
}
|
|
3851
|
-
|
|
3852
|
-
_context2.next = 7;
|
|
3853
|
-
return Promise.all(promises);
|
|
3854
|
-
|
|
3855
|
-
case 7:
|
|
3856
|
-
rewardPerSecondValuation = _context2.sent.reduce(function (p, v) {
|
|
3857
|
-
return p.plus(v);
|
|
3858
|
-
}, new BigNumber(0));
|
|
3859
|
-
_context2.next = 10;
|
|
3860
|
-
return fetchValuation(stakedLiquidityAmount, this._networkConnection.provider);
|
|
4131
|
+
return _context2.abrupt("return", new StakingRead(this._networkConnection).getPLYWNEARPoolDetails());
|
|
3861
4132
|
|
|
3862
|
-
case
|
|
3863
|
-
totalStakeValuation = _context2.sent;
|
|
3864
|
-
return _context2.abrupt("return", {
|
|
3865
|
-
totalStakedLiquidity: {
|
|
3866
|
-
tokenAmount: stakedLiquidityAmount,
|
|
3867
|
-
currencyAmount: {
|
|
3868
|
-
currency: 'USD',
|
|
3869
|
-
amount: totalStakeValuation.toFixed(DECIMAL_PRECISION)
|
|
3870
|
-
}
|
|
3871
|
-
},
|
|
3872
|
-
apy: calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION)
|
|
3873
|
-
});
|
|
3874
|
-
|
|
3875
|
-
case 12:
|
|
4133
|
+
case 1:
|
|
3876
4134
|
case "end":
|
|
3877
4135
|
return _context2.stop();
|
|
3878
4136
|
}
|
|
@@ -3921,20 +4179,13 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3921
4179
|
|
|
3922
4180
|
_proto.stakeBalanceOf = /*#__PURE__*/function () {
|
|
3923
4181
|
var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(user) {
|
|
3924
|
-
var userInfo, stakeAmount;
|
|
3925
4182
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
3926
4183
|
while (1) {
|
|
3927
4184
|
switch (_context4.prev = _context4.next) {
|
|
3928
4185
|
case 0:
|
|
3929
|
-
_context4.
|
|
3930
|
-
return this._auriFairLaunch.getUserInfo(PLYWNEAR_POOL_ID, user);
|
|
4186
|
+
return _context4.abrupt("return", new StakingRead(this._networkConnection).stakeBalanceOf(user));
|
|
3931
4187
|
|
|
3932
|
-
case
|
|
3933
|
-
userInfo = _context4.sent;
|
|
3934
|
-
stakeAmount = new TokenAmount(PLYWNEARToken, userInfo.amount.toString());
|
|
3935
|
-
return _context4.abrupt("return", valuateToken(stakeAmount, this._networkConnection.provider));
|
|
3936
|
-
|
|
3937
|
-
case 5:
|
|
4188
|
+
case 1:
|
|
3938
4189
|
case "end":
|
|
3939
4190
|
return _context4.stop();
|
|
3940
4191
|
}
|
|
@@ -3951,20 +4202,13 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3951
4202
|
|
|
3952
4203
|
_proto.LpBalanceOf = /*#__PURE__*/function () {
|
|
3953
4204
|
var _LpBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
|
|
3954
|
-
var lpContract, balance;
|
|
3955
4205
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
3956
4206
|
while (1) {
|
|
3957
4207
|
switch (_context5.prev = _context5.next) {
|
|
3958
4208
|
case 0:
|
|
3959
|
-
|
|
3960
|
-
_context5.next = 3;
|
|
3961
|
-
return lpContract.balanceOf(user);
|
|
4209
|
+
return _context5.abrupt("return", new StakingRead(this._networkConnection).LpBalanceOf(user));
|
|
3962
4210
|
|
|
3963
|
-
case
|
|
3964
|
-
balance = _context5.sent;
|
|
3965
|
-
return _context5.abrupt("return", valuateToken(new TokenAmount(PLYWNEARToken, balance.toString()), this._networkConnection.provider));
|
|
3966
|
-
|
|
3967
|
-
case 5:
|
|
4211
|
+
case 1:
|
|
3968
4212
|
case "end":
|
|
3969
4213
|
return _context5.stop();
|
|
3970
4214
|
}
|
|
@@ -3979,6 +4223,29 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3979
4223
|
return LpBalanceOf;
|
|
3980
4224
|
}();
|
|
3981
4225
|
|
|
4226
|
+
_proto.unclaimedRewardsOf = /*#__PURE__*/function () {
|
|
4227
|
+
var _unclaimedRewardsOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(user) {
|
|
4228
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
4229
|
+
while (1) {
|
|
4230
|
+
switch (_context6.prev = _context6.next) {
|
|
4231
|
+
case 0:
|
|
4232
|
+
return _context6.abrupt("return", new StakingRead(this._networkConnection).unclaimedRewardsOf(user));
|
|
4233
|
+
|
|
4234
|
+
case 1:
|
|
4235
|
+
case "end":
|
|
4236
|
+
return _context6.stop();
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
}, _callee6, this);
|
|
4240
|
+
}));
|
|
4241
|
+
|
|
4242
|
+
function unclaimedRewardsOf(_x5) {
|
|
4243
|
+
return _unclaimedRewardsOf.apply(this, arguments);
|
|
4244
|
+
}
|
|
4245
|
+
|
|
4246
|
+
return unclaimedRewardsOf;
|
|
4247
|
+
}();
|
|
4248
|
+
|
|
3982
4249
|
_proto.calcHypotheticalStats = function calcHypotheticalStats(_ref) {
|
|
3983
4250
|
var userMarketDetail = _ref.userMarketDetail,
|
|
3984
4251
|
currentBorrowLimit = _ref.currentBorrowLimit,
|
|
@@ -4029,19 +4296,19 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4029
4296
|
var _proto2 = SdkReadWrite.prototype;
|
|
4030
4297
|
|
|
4031
4298
|
_proto2.claim = /*#__PURE__*/function () {
|
|
4032
|
-
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4033
|
-
return runtime_1.wrap(function
|
|
4299
|
+
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
4300
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
4034
4301
|
while (1) {
|
|
4035
|
-
switch (
|
|
4302
|
+
switch (_context7.prev = _context7.next) {
|
|
4036
4303
|
case 0:
|
|
4037
|
-
return
|
|
4304
|
+
return _context7.abrupt("return", this._auriLens.connect(this._networkConnection.signer).claimRewards(this._comptroller.address, this._auriFairLaunch.address, ALL_STAKING_POOLS));
|
|
4038
4305
|
|
|
4039
4306
|
case 1:
|
|
4040
4307
|
case "end":
|
|
4041
|
-
return
|
|
4308
|
+
return _context7.stop();
|
|
4042
4309
|
}
|
|
4043
4310
|
}
|
|
4044
|
-
},
|
|
4311
|
+
}, _callee7, this);
|
|
4045
4312
|
}));
|
|
4046
4313
|
|
|
4047
4314
|
function claim() {
|
|
@@ -4052,22 +4319,22 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4052
4319
|
}();
|
|
4053
4320
|
|
|
4054
4321
|
_proto2.stake = /*#__PURE__*/function () {
|
|
4055
|
-
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4056
|
-
return runtime_1.wrap(function
|
|
4322
|
+
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
|
|
4323
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
4057
4324
|
while (1) {
|
|
4058
|
-
switch (
|
|
4325
|
+
switch (_context8.prev = _context8.next) {
|
|
4059
4326
|
case 0:
|
|
4060
|
-
return
|
|
4327
|
+
return _context8.abrupt("return", new StakingReadWrite(this._networkConnection).stake(amount));
|
|
4061
4328
|
|
|
4062
4329
|
case 1:
|
|
4063
4330
|
case "end":
|
|
4064
|
-
return
|
|
4331
|
+
return _context8.stop();
|
|
4065
4332
|
}
|
|
4066
4333
|
}
|
|
4067
|
-
},
|
|
4334
|
+
}, _callee8, this);
|
|
4068
4335
|
}));
|
|
4069
4336
|
|
|
4070
|
-
function stake(
|
|
4337
|
+
function stake(_x6) {
|
|
4071
4338
|
return _stake.apply(this, arguments);
|
|
4072
4339
|
}
|
|
4073
4340
|
|
|
@@ -4075,22 +4342,22 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4075
4342
|
}();
|
|
4076
4343
|
|
|
4077
4344
|
_proto2.unstake = /*#__PURE__*/function () {
|
|
4078
|
-
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4079
|
-
return runtime_1.wrap(function
|
|
4345
|
+
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
|
|
4346
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
4080
4347
|
while (1) {
|
|
4081
|
-
switch (
|
|
4348
|
+
switch (_context9.prev = _context9.next) {
|
|
4082
4349
|
case 0:
|
|
4083
|
-
return
|
|
4350
|
+
return _context9.abrupt("return", new StakingReadWrite(this._networkConnection).unstake(amount));
|
|
4084
4351
|
|
|
4085
4352
|
case 1:
|
|
4086
4353
|
case "end":
|
|
4087
|
-
return
|
|
4354
|
+
return _context9.stop();
|
|
4088
4355
|
}
|
|
4089
4356
|
}
|
|
4090
|
-
},
|
|
4357
|
+
}, _callee9, this);
|
|
4091
4358
|
}));
|
|
4092
4359
|
|
|
4093
|
-
function unstake(
|
|
4360
|
+
function unstake(_x7) {
|
|
4094
4361
|
return _unstake.apply(this, arguments);
|
|
4095
4362
|
}
|
|
4096
4363
|
|
|
@@ -4098,21 +4365,21 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4098
4365
|
}();
|
|
4099
4366
|
|
|
4100
4367
|
_proto2.faucetDrip = /*#__PURE__*/function () {
|
|
4101
|
-
var _faucetDrip = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
4368
|
+
var _faucetDrip = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10() {
|
|
4102
4369
|
var faucet;
|
|
4103
|
-
return runtime_1.wrap(function
|
|
4370
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
4104
4371
|
while (1) {
|
|
4105
|
-
switch (
|
|
4372
|
+
switch (_context10.prev = _context10.next) {
|
|
4106
4373
|
case 0:
|
|
4107
4374
|
faucet = new Contract(networkAddresses.misc.FAUCET, FaucetABI.abi, this._networkConnection.provider);
|
|
4108
|
-
return
|
|
4375
|
+
return _context10.abrupt("return", faucet.connect(this._networkConnection.signer).drip());
|
|
4109
4376
|
|
|
4110
4377
|
case 2:
|
|
4111
4378
|
case "end":
|
|
4112
|
-
return
|
|
4379
|
+
return _context10.stop();
|
|
4113
4380
|
}
|
|
4114
4381
|
}
|
|
4115
|
-
},
|
|
4382
|
+
}, _callee10, this);
|
|
4116
4383
|
}));
|
|
4117
4384
|
|
|
4118
4385
|
function faucetDrip() {
|
|
@@ -107348,5 +107615,5 @@ BigNumber.config({
|
|
|
107348
107615
|
DECIMAL_PLACES: 50
|
|
107349
107616
|
});
|
|
107350
107617
|
|
|
107351
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, TransferEventQuery, calcLMRewardApr, calcValuation, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
|
|
107618
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, Airdrop, AirdropRead, AirdropReadWrite, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, ETHAddress, INF, MarketAction, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, REWARD_CLAIM_START, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, TransferEventQuery, calcLMRewardApr, calcValuation, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getBlockBeforeTimestamp, getBlockTimestamp, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress, valuateToken };
|
|
107352
107619
|
//# sourceMappingURL=sdk.esm.js.map
|