@aurigami/sdk 1.5.0-dummy-2 → 1.5.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 -2
- package/dist/constants.d.ts +2 -2
- package/dist/sdk.cjs.development.js +38 -39
- 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 +36 -37
- package/dist/sdk.esm.js.map +1 -1
- package/dist/token.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +24 -16
- 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 +1 -1
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
|
}
|
|
@@ -3827,8 +3826,8 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3827
3826
|
return getUserDetails;
|
|
3828
3827
|
}();
|
|
3829
3828
|
|
|
3830
|
-
_proto.
|
|
3831
|
-
var
|
|
3829
|
+
_proto.getPLYWNEARPoolDetails = /*#__PURE__*/function () {
|
|
3830
|
+
var _getPLYWNEARPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
3832
3831
|
var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, promises, _i, rewardTokenAddress, rewardToken, rewardPerSecond, rewardPerSecondValuation, totalStakeValuation;
|
|
3833
3832
|
|
|
3834
3833
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
@@ -3836,17 +3835,17 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3836
3835
|
switch (_context2.prev = _context2.next) {
|
|
3837
3836
|
case 0:
|
|
3838
3837
|
_context2.next = 2;
|
|
3839
|
-
return this._auriFairLaunch.getPoolInfo(
|
|
3838
|
+
return this._auriFairLaunch.getPoolInfo(PLYWNEAR_POOL_ID).then(function (res) {
|
|
3840
3839
|
stakedLiquidity = res.totalStake;
|
|
3841
3840
|
rewardPerSeconds = res.rewardPerSeconds;
|
|
3842
3841
|
});
|
|
3843
3842
|
|
|
3844
3843
|
case 2:
|
|
3845
|
-
stakedLiquidityAmount = new TokenAmount(
|
|
3844
|
+
stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity.toString());
|
|
3846
3845
|
promises = [];
|
|
3847
3846
|
|
|
3848
3847
|
for (_i = 0; _i < rewardPerSeconds.length; _i++) {
|
|
3849
|
-
rewardTokenAddress =
|
|
3848
|
+
rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[_i];
|
|
3850
3849
|
rewardToken = new Token(rewardTokenAddress, getDecimal(rewardTokenAddress));
|
|
3851
3850
|
rewardPerSecond = rewardPerSeconds[_i];
|
|
3852
3851
|
promises.push(fetchValuation(new TokenAmount(rewardToken, rewardPerSecond.toString()), this._networkConnection.provider));
|
|
@@ -3883,11 +3882,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3883
3882
|
}, _callee2, this);
|
|
3884
3883
|
}));
|
|
3885
3884
|
|
|
3886
|
-
function
|
|
3887
|
-
return
|
|
3885
|
+
function getPLYWNEARPoolDetails() {
|
|
3886
|
+
return _getPLYWNEARPoolDetails.apply(this, arguments);
|
|
3888
3887
|
}
|
|
3889
3888
|
|
|
3890
|
-
return
|
|
3889
|
+
return getPLYWNEARPoolDetails;
|
|
3891
3890
|
}();
|
|
3892
3891
|
|
|
3893
3892
|
_proto.getTokenPrice = /*#__PURE__*/function () {
|
|
@@ -3930,11 +3929,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3930
3929
|
switch (_context4.prev = _context4.next) {
|
|
3931
3930
|
case 0:
|
|
3932
3931
|
_context4.next = 2;
|
|
3933
|
-
return this._auriFairLaunch.getUserInfo(
|
|
3932
|
+
return this._auriFairLaunch.getUserInfo(PLYWNEAR_POOL_ID, user);
|
|
3934
3933
|
|
|
3935
3934
|
case 2:
|
|
3936
3935
|
userInfo = _context4.sent;
|
|
3937
|
-
stakeAmount = new TokenAmount(
|
|
3936
|
+
stakeAmount = new TokenAmount(PLYWNEARToken, userInfo.amount.toString());
|
|
3938
3937
|
return _context4.abrupt("return", valuateToken(stakeAmount, this._networkConnection.provider));
|
|
3939
3938
|
|
|
3940
3939
|
case 5:
|
|
@@ -3954,18 +3953,18 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3954
3953
|
|
|
3955
3954
|
_proto.LpBalanceOf = /*#__PURE__*/function () {
|
|
3956
3955
|
var _LpBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
|
|
3957
|
-
var
|
|
3956
|
+
var lpContract, balance;
|
|
3958
3957
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
3959
3958
|
while (1) {
|
|
3960
3959
|
switch (_context5.prev = _context5.next) {
|
|
3961
3960
|
case 0:
|
|
3962
|
-
|
|
3961
|
+
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, EIP20InterfaceABI.abi, this._networkConnection.provider);
|
|
3963
3962
|
_context5.next = 3;
|
|
3964
|
-
return
|
|
3963
|
+
return lpContract.balanceOf(user);
|
|
3965
3964
|
|
|
3966
3965
|
case 3:
|
|
3967
3966
|
balance = _context5.sent;
|
|
3968
|
-
return _context5.abrupt("return", valuateToken(new TokenAmount(
|
|
3967
|
+
return _context5.abrupt("return", valuateToken(new TokenAmount(PLYWNEARToken, balance.toString()), this._networkConnection.provider));
|
|
3969
3968
|
|
|
3970
3969
|
case 5:
|
|
3971
3970
|
case "end":
|
|
@@ -4060,7 +4059,7 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4060
4059
|
while (1) {
|
|
4061
4060
|
switch (_context7.prev = _context7.next) {
|
|
4062
4061
|
case 0:
|
|
4063
|
-
return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(
|
|
4062
|
+
return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(PLYWNEAR_POOL_ID, amount.rawAmount()));
|
|
4064
4063
|
|
|
4065
4064
|
case 1:
|
|
4066
4065
|
case "end":
|
|
@@ -4083,7 +4082,7 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
4083
4082
|
while (1) {
|
|
4084
4083
|
switch (_context8.prev = _context8.next) {
|
|
4085
4084
|
case 0:
|
|
4086
|
-
return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(
|
|
4085
|
+
return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(PLYWNEAR_POOL_ID, amount.rawAmount()));
|
|
4087
4086
|
|
|
4088
4087
|
case 1:
|
|
4089
4088
|
case "end":
|
|
@@ -107375,13 +107374,13 @@ exports.ONE_DAY = ONE_DAY;
|
|
|
107375
107374
|
exports.ONE_WEEK = ONE_WEEK;
|
|
107376
107375
|
exports.ONE_YEAR = ONE_YEAR;
|
|
107377
107376
|
exports.PLYToken = PLYToken;
|
|
107378
|
-
exports.
|
|
107379
|
-
exports.
|
|
107377
|
+
exports.PLYWNEARToken = PLYWNEARToken;
|
|
107378
|
+
exports.PLYWNEAR_POOL_ID = PLYWNEAR_POOL_ID;
|
|
107379
|
+
exports.PLYWNEAR_REWARD_TOKENS = PLYWNEAR_REWARD_TOKENS;
|
|
107380
107380
|
exports.PRICE_WHITELISTED = PRICE_WHITELISTED;
|
|
107381
107381
|
exports.Papermill = Papermill;
|
|
107382
107382
|
exports.PapermillRead = PapermillRead;
|
|
107383
107383
|
exports.PapermillReadWrite = PapermillReadWrite;
|
|
107384
|
-
exports.PlyUsdcPid = PlyUsdcPid;
|
|
107385
107384
|
exports.REWARD_CLAIM_START = REWARD_CLAIM_START;
|
|
107386
107385
|
exports.SDK = SDK;
|
|
107387
107386
|
exports.SdkRead = SdkRead;
|