@aurigami/sdk 1.5.0-dummy-2 → 1.5.1
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 +2 -2
- package/dist/constants.d.ts +2 -2
- package/dist/sdk.cjs.development.js +118 -79
- 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 +116 -77
- package/dist/sdk.esm.js.map +1 -1
- package/dist/token.d.ts +1 -1
- package/dist/types.d.ts +6 -2
- package/package.json +1 -1
- package/src/Papermill.ts +28 -10
- package/src/SDK.ts +44 -29
- package/src/constants.ts +4 -4
- package/src/decimals.ts +1 -1
- package/src/deployments/aurora_mainnet.json +1 -1
- package/src/priceFetcher.ts +9 -7
- package/src/token.ts +3 -3
- package/src/types.ts +7 -2
package/dist/Papermill.d.ts
CHANGED
|
@@ -16,8 +16,10 @@ export declare class PapermillRead extends BlockchainEntityRead {
|
|
|
16
16
|
getPlyBalance(userAddress: Address): Promise<TokenAmount>;
|
|
17
17
|
getPulpBalance(userAddress: Address): Promise<TokenAmount>;
|
|
18
18
|
getUnclaimedPlyReward(userAddress: Address): Promise<TokenAmount>;
|
|
19
|
+
private getWeek;
|
|
19
20
|
getLockingDetails(userAddress: Address): Promise<UserLockingDetails>;
|
|
20
21
|
getTimestampToUnlock(userAddress: Address, targetUnlockPortion: number): Promise<number>;
|
|
22
|
+
getUnlockPortionAt(userAddress: Address, timestamp: number): Promise<number>;
|
|
21
23
|
}
|
|
22
24
|
export declare class PapermillReadWrite extends PapermillRead {
|
|
23
25
|
constructor(networkConnection: NetworkConnection);
|
package/dist/SDK.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
|
|
2
|
-
import {
|
|
2
|
+
import { PLYWNEARPoolDetails, NetworkConnection, UserDetails, UserMarketDetails, CurrencyAmount, HypotheticalStats, MarketAction, TokenValuation } from './types';
|
|
3
3
|
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
4
4
|
import { AuriFairLaunch, Comptroller, AuriLens } from '@aurigami/contracts/typechain';
|
|
5
5
|
import { TokenAmount } from './tokenAmount';
|
|
@@ -10,7 +10,7 @@ export declare class SdkRead extends BlockchainEntityRead {
|
|
|
10
10
|
protected _auriLens: AuriLens;
|
|
11
11
|
constructor(networkConnection: NetworkConnection);
|
|
12
12
|
getUserDetails(userAddress: string): Promise<UserDetails>;
|
|
13
|
-
|
|
13
|
+
getPLYWNEARPoolDetails(): Promise<PLYWNEARPoolDetails>;
|
|
14
14
|
getTokenPrice(token: Token): Promise<CurrencyAmount>;
|
|
15
15
|
stakeBalanceOf(user: string): Promise<TokenValuation>;
|
|
16
16
|
LpBalanceOf(user: string): Promise<TokenValuation>;
|
package/dist/constants.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ export declare const BORROW_LIMIT_BUFFER: BigNumber;
|
|
|
20
20
|
export declare const ONE_DAY = 86400;
|
|
21
21
|
export declare const ONE_WEEK: number;
|
|
22
22
|
export declare const ONE_YEAR: number;
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
23
|
+
export declare const PLYWNEAR_POOL_ID = 0;
|
|
24
|
+
export declare const PLYWNEAR_REWARD_TOKENS: string[];
|
|
25
25
|
export declare const ALL_STAKING_POOLS: never[];
|
|
26
26
|
export declare const INF: ethers.BigNumber;
|
|
27
27
|
export declare const AIRDROP_START_TIMESTAMP = 1649858400;
|
|
@@ -996,7 +996,7 @@ var networkAddresses = {
|
|
|
996
996
|
TRI: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase(),
|
|
997
997
|
META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLocaleLowerCase(),
|
|
998
998
|
PULP: /*#__PURE__*/'0x04Ac48711BCdc45b4d223fb021E09DA73c71095e'.toLowerCase(),
|
|
999
|
-
|
|
999
|
+
PLYWNEAR: /*#__PURE__*/'0x044b6B0CD3Bb13D2b9057781Df4459C66781dCe7'.toLowerCase()
|
|
1000
1000
|
}
|
|
1001
1001
|
};
|
|
1002
1002
|
var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
|
|
@@ -1007,8 +1007,8 @@ var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(1);
|
|
|
1007
1007
|
var ONE_DAY = 86400;
|
|
1008
1008
|
var ONE_WEEK = ONE_DAY * 7;
|
|
1009
1009
|
var ONE_YEAR = ONE_DAY * 365;
|
|
1010
|
-
var
|
|
1011
|
-
var
|
|
1010
|
+
var PLYWNEAR_POOL_ID = 0;
|
|
1011
|
+
var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
|
|
1012
1012
|
var ALL_STAKING_POOLS = [];
|
|
1013
1013
|
var INF = /*#__PURE__*/ethers.BigNumber.from(2).pow(256).sub(1);
|
|
1014
1014
|
var AIRDROP_START_TIMESTAMP = 1649858400;
|
|
@@ -1090,7 +1090,7 @@ var decimalRecords = {
|
|
|
1090
1090
|
'0xf4eb217ba2454613b15dbdea6e5f22276410e89e': 8,
|
|
1091
1091
|
'0xc21ff01229e982d7c8b8691163b0a3cb8f357453': 24,
|
|
1092
1092
|
'0x04ac48711bcdc45b4d223fb021e09da73c71095e': 18,
|
|
1093
|
-
'
|
|
1093
|
+
'0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18
|
|
1094
1094
|
};
|
|
1095
1095
|
|
|
1096
1096
|
function formatObject(object) {
|
|
@@ -1202,7 +1202,7 @@ var Token = function Token(address, decimals) {
|
|
|
1202
1202
|
this.decimals = decimals;
|
|
1203
1203
|
};
|
|
1204
1204
|
var PLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.PLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.PLY));
|
|
1205
|
-
var
|
|
1205
|
+
var PLYWNEARToken = /*#__PURE__*/new Token(networkAddresses.tokens.PLYWNEAR, /*#__PURE__*/getDecimal(networkAddresses.tokens.PLYWNEAR));
|
|
1206
1206
|
|
|
1207
1207
|
var TokenAmount = /*#__PURE__*/function () {
|
|
1208
1208
|
function TokenAmount(token, amount, isRaw) {
|
|
@@ -2558,7 +2558,7 @@ function _fetchPrice3() {
|
|
|
2558
2558
|
while (1) {
|
|
2559
2559
|
switch (_context10.prev = _context10.next) {
|
|
2560
2560
|
case 0:
|
|
2561
|
-
if (!isSameAddress(address, networkAddresses.tokens.
|
|
2561
|
+
if (!isSameAddress(address, networkAddresses.tokens.PLYWNEAR)) {
|
|
2562
2562
|
_context10.next = 4;
|
|
2563
2563
|
break;
|
|
2564
2564
|
}
|
|
@@ -2592,38 +2592,37 @@ function fetchPLYPrice(_x15) {
|
|
|
2592
2592
|
|
|
2593
2593
|
function _fetchPLYPrice() {
|
|
2594
2594
|
_fetchPLYPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(provider) {
|
|
2595
|
-
var LPInfo, plyAddress, plyDecimal,
|
|
2595
|
+
var LPInfo, plyAddress, plyDecimal, wnearAddress, wnearDecimal;
|
|
2596
2596
|
return runtime_1.wrap(function _callee11$(_context11) {
|
|
2597
2597
|
while (1) {
|
|
2598
2598
|
switch (_context11.prev = _context11.next) {
|
|
2599
2599
|
case 0:
|
|
2600
|
-
_context11.
|
|
2601
|
-
return fetchLPPositions(networkAddresses.tokens.PLYUSDC, provider);
|
|
2600
|
+
return _context11.abrupt("return", new BigNumber(0));
|
|
2602
2601
|
|
|
2603
|
-
case
|
|
2602
|
+
case 3:
|
|
2604
2603
|
LPInfo = _context11.sent;
|
|
2605
2604
|
|
|
2606
2605
|
if (!LPInfo.reserve1.isZero()) {
|
|
2607
|
-
_context11.next =
|
|
2606
|
+
_context11.next = 6;
|
|
2608
2607
|
break;
|
|
2609
2608
|
}
|
|
2610
2609
|
|
|
2611
2610
|
return _context11.abrupt("return", new BigNumber(0));
|
|
2612
2611
|
|
|
2613
|
-
case
|
|
2612
|
+
case 6:
|
|
2614
2613
|
plyAddress = LPInfo.token0;
|
|
2615
2614
|
assert(isSameAddress(plyAddress, networkAddresses.tokens.PLY));
|
|
2616
2615
|
plyDecimal = getDecimal(plyAddress);
|
|
2617
|
-
|
|
2618
|
-
assert(isSameAddress(
|
|
2619
|
-
|
|
2620
|
-
_context11.next =
|
|
2621
|
-
return fetchPrice(
|
|
2622
|
-
|
|
2623
|
-
case 13:
|
|
2624
|
-
return _context11.abrupt("return", _context11.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(plyDecimal)).dividedBy(decimalFactor(usdcDecimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
2616
|
+
wnearAddress = LPInfo.token1;
|
|
2617
|
+
assert(isSameAddress(wnearAddress, networkAddresses.tokens.WNEAR));
|
|
2618
|
+
wnearDecimal = getDecimal(wnearAddress);
|
|
2619
|
+
_context11.next = 14;
|
|
2620
|
+
return fetchPrice(wnearAddress, provider);
|
|
2625
2621
|
|
|
2626
2622
|
case 14:
|
|
2623
|
+
return _context11.abrupt("return", _context11.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(plyDecimal)).dividedBy(decimalFactor(wnearDecimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
2624
|
+
|
|
2625
|
+
case 15:
|
|
2627
2626
|
case "end":
|
|
2628
2627
|
return _context11.stop();
|
|
2629
2628
|
}
|
|
@@ -3387,6 +3386,7 @@ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
|
|
|
3387
3386
|
return MoneyMarket;
|
|
3388
3387
|
}(BlockchainEntity);
|
|
3389
3388
|
|
|
3389
|
+
var LOCKING_DENOMINATOR = /*#__PURE__*/ethers.BigNumber.from(10000);
|
|
3390
3390
|
var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
3391
3391
|
_inheritsLoose(PapermillRead, _BlockchainEntityRead);
|
|
3392
3392
|
|
|
@@ -3497,40 +3497,42 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3497
3497
|
return getUnclaimedPlyReward;
|
|
3498
3498
|
}();
|
|
3499
3499
|
|
|
3500
|
+
_proto.getWeek = function getWeek(timestamp) {
|
|
3501
|
+
return ethers.BigNumber.from(timestamp - REWARD_CLAIM_START).div(ONE_WEEK).toNumber();
|
|
3502
|
+
};
|
|
3503
|
+
|
|
3500
3504
|
_proto.getLockingDetails = /*#__PURE__*/function () {
|
|
3501
3505
|
var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(userAddress) {
|
|
3502
|
-
var
|
|
3506
|
+
var currentWeek, promises, values, percentLockCurrentWeek, percentLockNextWeek, totalRewards, _yield$this$_pulp$cal, pulpAmountCurrentWeek, plyAmountCurrentWeek, plyAmountNextWeek, pulpAmountNextWeek, currentUnlockPortion, nextUnlockPortion;
|
|
3503
3507
|
|
|
3504
3508
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
3505
3509
|
while (1) {
|
|
3506
3510
|
switch (_context4.prev = _context4.next) {
|
|
3507
3511
|
case 0:
|
|
3508
|
-
|
|
3509
|
-
currentWeek = ethers.BigNumber.from(currentTime - REWARD_CLAIM_START).div(ONE_WEEK).toNumber();
|
|
3510
|
-
denominator = ethers.BigNumber.from(10000);
|
|
3512
|
+
currentWeek = this.getWeek(getCurrentTimestamp());
|
|
3511
3513
|
promises = [];
|
|
3512
3514
|
promises.push(this._auriLens.getPercentLock(this._pulp.address, userAddress, currentWeek));
|
|
3513
3515
|
promises.push(this._auriLens.getPercentLock(this._pulp.address, userAddress, currentWeek + 1));
|
|
3514
3516
|
promises.push(this.getUnclaimedPlyReward(userAddress));
|
|
3515
|
-
_context4.next =
|
|
3517
|
+
_context4.next = 7;
|
|
3516
3518
|
return Promise.all(promises);
|
|
3517
3519
|
|
|
3518
|
-
case
|
|
3520
|
+
case 7:
|
|
3519
3521
|
values = _context4.sent;
|
|
3520
3522
|
percentLockCurrentWeek = ethers.BigNumber.from(values[0]);
|
|
3521
3523
|
percentLockNextWeek = ethers.BigNumber.from(values[1]);
|
|
3522
3524
|
totalRewards = values[2];
|
|
3523
|
-
_context4.next =
|
|
3525
|
+
_context4.next = 13;
|
|
3524
3526
|
return this._pulp.calcLockAmount(userAddress, totalRewards.rawAmount());
|
|
3525
3527
|
|
|
3526
|
-
case
|
|
3528
|
+
case 13:
|
|
3527
3529
|
_yield$this$_pulp$cal = _context4.sent;
|
|
3528
3530
|
pulpAmountCurrentWeek = _yield$this$_pulp$cal[0];
|
|
3529
3531
|
plyAmountCurrentWeek = _yield$this$_pulp$cal[1];
|
|
3530
|
-
plyAmountNextWeek = percentLockNextWeek.mul(totalRewards.rawAmount()).div(
|
|
3532
|
+
plyAmountNextWeek = percentLockNextWeek.mul(totalRewards.rawAmount()).div(LOCKING_DENOMINATOR);
|
|
3531
3533
|
pulpAmountNextWeek = ethers.BigNumber.from(totalRewards.rawAmount()).sub(plyAmountNextWeek);
|
|
3532
|
-
currentUnlockPortion =
|
|
3533
|
-
nextUnlockPortion =
|
|
3534
|
+
currentUnlockPortion = LOCKING_DENOMINATOR.sub(percentLockCurrentWeek).toString();
|
|
3535
|
+
nextUnlockPortion = LOCKING_DENOMINATOR.sub(percentLockNextWeek).toString();
|
|
3534
3536
|
return _context4.abrupt("return", {
|
|
3535
3537
|
vestingStart: REWARD_CLAIM_START,
|
|
3536
3538
|
currentUnlockPortion: new BigNumber(currentUnlockPortion).dividedBy(100).toNumber(),
|
|
@@ -3542,7 +3544,7 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3542
3544
|
nextPulp: new TokenAmount(this.pulpToken, pulpAmountNextWeek.toString())
|
|
3543
3545
|
});
|
|
3544
3546
|
|
|
3545
|
-
case
|
|
3547
|
+
case 21:
|
|
3546
3548
|
case "end":
|
|
3547
3549
|
return _context4.stop();
|
|
3548
3550
|
}
|
|
@@ -3586,6 +3588,36 @@ var PapermillRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3586
3588
|
return getTimestampToUnlock;
|
|
3587
3589
|
}();
|
|
3588
3590
|
|
|
3591
|
+
_proto.getUnlockPortionAt = /*#__PURE__*/function () {
|
|
3592
|
+
var _getUnlockPortionAt = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(userAddress, timestamp) {
|
|
3593
|
+
var lockPortion, unlockPortion;
|
|
3594
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
3595
|
+
while (1) {
|
|
3596
|
+
switch (_context6.prev = _context6.next) {
|
|
3597
|
+
case 0:
|
|
3598
|
+
_context6.next = 2;
|
|
3599
|
+
return this._auriLens.getPercentLock(this._pulp.address, userAddress, this.getWeek(timestamp));
|
|
3600
|
+
|
|
3601
|
+
case 2:
|
|
3602
|
+
lockPortion = _context6.sent;
|
|
3603
|
+
unlockPortion = LOCKING_DENOMINATOR.sub(lockPortion);
|
|
3604
|
+
return _context6.abrupt("return", unlockPortion.toNumber() / 100);
|
|
3605
|
+
|
|
3606
|
+
case 5:
|
|
3607
|
+
case "end":
|
|
3608
|
+
return _context6.stop();
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
}, _callee6, this);
|
|
3612
|
+
}));
|
|
3613
|
+
|
|
3614
|
+
function getUnlockPortionAt(_x7, _x8) {
|
|
3615
|
+
return _getUnlockPortionAt.apply(this, arguments);
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
return getUnlockPortionAt;
|
|
3619
|
+
}();
|
|
3620
|
+
|
|
3589
3621
|
return PapermillRead;
|
|
3590
3622
|
}(BlockchainEntityRead);
|
|
3591
3623
|
var PapermillReadWrite = /*#__PURE__*/function (_PapermillRead) {
|
|
@@ -3598,22 +3630,22 @@ var PapermillReadWrite = /*#__PURE__*/function (_PapermillRead) {
|
|
|
3598
3630
|
var _proto2 = PapermillReadWrite.prototype;
|
|
3599
3631
|
|
|
3600
3632
|
_proto2.redeem = /*#__PURE__*/function () {
|
|
3601
|
-
var _redeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3602
|
-
return runtime_1.wrap(function
|
|
3633
|
+
var _redeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(recipient, amount) {
|
|
3634
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
3603
3635
|
while (1) {
|
|
3604
|
-
switch (
|
|
3636
|
+
switch (_context7.prev = _context7.next) {
|
|
3605
3637
|
case 0:
|
|
3606
|
-
return
|
|
3638
|
+
return _context7.abrupt("return", this._pulp.connect(this._networkConnection.signer).redeem(recipient, amount.rawAmount()));
|
|
3607
3639
|
|
|
3608
3640
|
case 1:
|
|
3609
3641
|
case "end":
|
|
3610
|
-
return
|
|
3642
|
+
return _context7.stop();
|
|
3611
3643
|
}
|
|
3612
3644
|
}
|
|
3613
|
-
},
|
|
3645
|
+
}, _callee7, this);
|
|
3614
3646
|
}));
|
|
3615
3647
|
|
|
3616
|
-
function redeem(
|
|
3648
|
+
function redeem(_x9, _x10) {
|
|
3617
3649
|
return _redeem.apply(this, arguments);
|
|
3618
3650
|
}
|
|
3619
3651
|
|
|
@@ -3621,28 +3653,28 @@ var PapermillReadWrite = /*#__PURE__*/function (_PapermillRead) {
|
|
|
3621
3653
|
}();
|
|
3622
3654
|
|
|
3623
3655
|
_proto2.selfRedeem = /*#__PURE__*/function () {
|
|
3624
|
-
var _selfRedeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3656
|
+
var _selfRedeem = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
|
|
3625
3657
|
var msgSender;
|
|
3626
|
-
return runtime_1.wrap(function
|
|
3658
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
3627
3659
|
while (1) {
|
|
3628
|
-
switch (
|
|
3660
|
+
switch (_context8.prev = _context8.next) {
|
|
3629
3661
|
case 0:
|
|
3630
|
-
|
|
3662
|
+
_context8.next = 2;
|
|
3631
3663
|
return this._networkConnection.signer.getAddress();
|
|
3632
3664
|
|
|
3633
3665
|
case 2:
|
|
3634
|
-
msgSender =
|
|
3635
|
-
return
|
|
3666
|
+
msgSender = _context8.sent;
|
|
3667
|
+
return _context8.abrupt("return", this.redeem(msgSender, amount));
|
|
3636
3668
|
|
|
3637
3669
|
case 4:
|
|
3638
3670
|
case "end":
|
|
3639
|
-
return
|
|
3671
|
+
return _context8.stop();
|
|
3640
3672
|
}
|
|
3641
3673
|
}
|
|
3642
|
-
},
|
|
3674
|
+
}, _callee8, this);
|
|
3643
3675
|
}));
|
|
3644
3676
|
|
|
3645
|
-
function selfRedeem(
|
|
3677
|
+
function selfRedeem(_x11) {
|
|
3646
3678
|
return _selfRedeem.apply(this, arguments);
|
|
3647
3679
|
}
|
|
3648
3680
|
|
|
@@ -3827,43 +3859,50 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3827
3859
|
return getUserDetails;
|
|
3828
3860
|
}();
|
|
3829
3861
|
|
|
3830
|
-
_proto.
|
|
3831
|
-
var
|
|
3832
|
-
var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, promises, _i, rewardTokenAddress, rewardToken, rewardPerSecond,
|
|
3862
|
+
_proto.getPLYWNEARPoolDetails = /*#__PURE__*/function () {
|
|
3863
|
+
var _getPLYWNEARPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
3864
|
+
var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, totalStakeValuation, promises, _i, rewardTokenAddress, rewardToken, rewardPerSecond, APYs;
|
|
3833
3865
|
|
|
3834
3866
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
3835
3867
|
while (1) {
|
|
3836
3868
|
switch (_context2.prev = _context2.next) {
|
|
3837
3869
|
case 0:
|
|
3838
3870
|
_context2.next = 2;
|
|
3839
|
-
return this._auriFairLaunch.getPoolInfo(
|
|
3871
|
+
return this._auriFairLaunch.getPoolInfo(PLYWNEAR_POOL_ID).then(function (res) {
|
|
3840
3872
|
stakedLiquidity = res.totalStake;
|
|
3841
3873
|
rewardPerSeconds = res.rewardPerSeconds;
|
|
3842
3874
|
});
|
|
3843
3875
|
|
|
3844
3876
|
case 2:
|
|
3845
|
-
stakedLiquidityAmount = new TokenAmount(
|
|
3877
|
+
stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity.toString());
|
|
3878
|
+
_context2.next = 5;
|
|
3879
|
+
return fetchValuation(stakedLiquidityAmount, this._networkConnection.provider);
|
|
3880
|
+
|
|
3881
|
+
case 5:
|
|
3882
|
+
totalStakeValuation = _context2.sent;
|
|
3846
3883
|
promises = [];
|
|
3847
3884
|
|
|
3848
3885
|
for (_i = 0; _i < rewardPerSeconds.length; _i++) {
|
|
3849
|
-
rewardTokenAddress =
|
|
3886
|
+
rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[_i];
|
|
3850
3887
|
rewardToken = new Token(rewardTokenAddress, getDecimal(rewardTokenAddress));
|
|
3851
3888
|
rewardPerSecond = rewardPerSeconds[_i];
|
|
3852
3889
|
promises.push(fetchValuation(new TokenAmount(rewardToken, rewardPerSecond.toString()), this._networkConnection.provider));
|
|
3853
3890
|
}
|
|
3854
3891
|
|
|
3855
|
-
|
|
3892
|
+
APYs = [];
|
|
3893
|
+
_context2.next = 11;
|
|
3856
3894
|
return Promise.all(promises);
|
|
3857
3895
|
|
|
3858
|
-
case
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3896
|
+
case 11:
|
|
3897
|
+
_context2.sent.forEach(function (rewardPerSecondValuation, i) {
|
|
3898
|
+
var rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[i];
|
|
3899
|
+
var apy = calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION);
|
|
3900
|
+
APYs.push({
|
|
3901
|
+
address: rewardTokenAddress,
|
|
3902
|
+
apy: apy
|
|
3903
|
+
});
|
|
3904
|
+
});
|
|
3864
3905
|
|
|
3865
|
-
case 10:
|
|
3866
|
-
totalStakeValuation = _context2.sent;
|
|
3867
3906
|
return _context2.abrupt("return", {
|
|
3868
3907
|
totalStakedLiquidity: {
|
|
3869
3908
|
tokenAmount: stakedLiquidityAmount,
|
|
@@ -3872,10 +3911,10 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3872
3911
|
amount: totalStakeValuation.toFixed(DECIMAL_PRECISION)
|
|
3873
3912
|
}
|
|
3874
3913
|
},
|
|
3875
|
-
|
|
3914
|
+
APYs: APYs
|
|
3876
3915
|
});
|
|
3877
3916
|
|
|
3878
|
-
case
|
|
3917
|
+
case 13:
|
|
3879
3918
|
case "end":
|
|
3880
3919
|
return _context2.stop();
|
|
3881
3920
|
}
|
|
@@ -3883,11 +3922,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3883
3922
|
}, _callee2, this);
|
|
3884
3923
|
}));
|
|
3885
3924
|
|
|
3886
|
-
function
|
|
3887
|
-
return
|
|
3925
|
+
function getPLYWNEARPoolDetails() {
|
|
3926
|
+
return _getPLYWNEARPoolDetails.apply(this, arguments);
|
|
3888
3927
|
}
|
|
3889
3928
|
|
|
3890
|
-
return
|
|
3929
|
+
return getPLYWNEARPoolDetails;
|
|
3891
3930
|
}();
|
|
3892
3931
|
|
|
3893
3932
|
_proto.getTokenPrice = /*#__PURE__*/function () {
|
|
@@ -3930,11 +3969,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3930
3969
|
switch (_context4.prev = _context4.next) {
|
|
3931
3970
|
case 0:
|
|
3932
3971
|
_context4.next = 2;
|
|
3933
|
-
return this._auriFairLaunch.getUserInfo(
|
|
3972
|
+
return this._auriFairLaunch.getUserInfo(PLYWNEAR_POOL_ID, user);
|
|
3934
3973
|
|
|
3935
3974
|
case 2:
|
|
3936
3975
|
userInfo = _context4.sent;
|
|
3937
|
-
stakeAmount = new TokenAmount(
|
|
3976
|
+
stakeAmount = new TokenAmount(PLYWNEARToken, userInfo.amount.toString());
|
|
3938
3977
|
return _context4.abrupt("return", valuateToken(stakeAmount, this._networkConnection.provider));
|
|
3939
3978
|
|
|
3940
3979
|
case 5:
|
|
@@ -3954,18 +3993,18 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3954
3993
|
|
|
3955
3994
|
_proto.LpBalanceOf = /*#__PURE__*/function () {
|
|
3956
3995
|
var _LpBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
|
|
3957
|
-
var
|
|
3996
|
+
var lpContract, balance;
|
|
3958
3997
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
3959
3998
|
while (1) {
|
|
3960
3999
|
switch (_context5.prev = _context5.next) {
|
|
3961
4000
|
case 0:
|
|
3962
|
-
|
|
4001
|
+
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, EIP20InterfaceABI.abi, this._networkConnection.provider);
|
|
3963
4002
|
_context5.next = 3;
|
|
3964
|
-
return
|
|
4003
|
+
return lpContract.balanceOf(user);
|
|
3965
4004
|
|
|
3966
4005
|
case 3:
|
|
3967
4006
|
balance = _context5.sent;
|
|
3968
|
-
return _context5.abrupt("return", valuateToken(new TokenAmount(
|
|
4007
|
+
return _context5.abrupt("return", valuateToken(new TokenAmount(PLYWNEARToken, balance.toString()), this._networkConnection.provider));
|
|
3969
4008
|
|
|
3970
4009
|
case 5:
|
|
3971
4010
|
case "end":
|
|
@@ -4060,7 +4099,7 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4060
4099
|
while (1) {
|
|
4061
4100
|
switch (_context7.prev = _context7.next) {
|
|
4062
4101
|
case 0:
|
|
4063
|
-
return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(
|
|
4102
|
+
return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(PLYWNEAR_POOL_ID, amount.rawAmount()));
|
|
4064
4103
|
|
|
4065
4104
|
case 1:
|
|
4066
4105
|
case "end":
|
|
@@ -4083,7 +4122,7 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4083
4122
|
while (1) {
|
|
4084
4123
|
switch (_context8.prev = _context8.next) {
|
|
4085
4124
|
case 0:
|
|
4086
|
-
return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(
|
|
4125
|
+
return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(PLYWNEAR_POOL_ID, amount.rawAmount()));
|
|
4087
4126
|
|
|
4088
4127
|
case 1:
|
|
4089
4128
|
case "end":
|
|
@@ -107375,13 +107414,13 @@ exports.ONE_DAY = ONE_DAY;
|
|
|
107375
107414
|
exports.ONE_WEEK = ONE_WEEK;
|
|
107376
107415
|
exports.ONE_YEAR = ONE_YEAR;
|
|
107377
107416
|
exports.PLYToken = PLYToken;
|
|
107378
|
-
exports.
|
|
107379
|
-
exports.
|
|
107417
|
+
exports.PLYWNEARToken = PLYWNEARToken;
|
|
107418
|
+
exports.PLYWNEAR_POOL_ID = PLYWNEAR_POOL_ID;
|
|
107419
|
+
exports.PLYWNEAR_REWARD_TOKENS = PLYWNEAR_REWARD_TOKENS;
|
|
107380
107420
|
exports.PRICE_WHITELISTED = PRICE_WHITELISTED;
|
|
107381
107421
|
exports.Papermill = Papermill;
|
|
107382
107422
|
exports.PapermillRead = PapermillRead;
|
|
107383
107423
|
exports.PapermillReadWrite = PapermillReadWrite;
|
|
107384
|
-
exports.PlyUsdcPid = PlyUsdcPid;
|
|
107385
107424
|
exports.REWARD_CLAIM_START = REWARD_CLAIM_START;
|
|
107386
107425
|
exports.SDK = SDK;
|
|
107387
107426
|
exports.SdkRead = SdkRead;
|