@aurigami/sdk 1.5.3 → 1.5.5
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/constants.d.ts +1 -1
- package/dist/helpers.d.ts +1 -0
- package/dist/priceFetcher.d.ts +1 -0
- package/dist/sdk.cjs.development.js +86 -41
- 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 +85 -42
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -5
- package/src/airdrop-lottery.ts +1 -1
- package/src/constants.ts +10 -3
- package/src/deployments/aurora_mainnet.json +4 -3
- package/src/helpers.ts +7 -1
- package/src/priceFetcher.ts +14 -3
package/dist/constants.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare type NetworkAddresses = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const networkAddresses: NetworkAddresses;
|
|
17
17
|
export declare const PRICE_WHITELISTED: Set<string>;
|
|
18
|
-
export declare const REWARD_CLAIM_START =
|
|
18
|
+
export declare const REWARD_CLAIM_START = 1651759200;
|
|
19
19
|
export declare const BORROW_LIMIT_BUFFER: BigNumber;
|
|
20
20
|
export declare const ONE_DAY = 86400;
|
|
21
21
|
export declare const ONE_WEEK: number;
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
2
|
import BigNumber from 'bignumber.js';
|
|
3
3
|
import { Address } from './types';
|
|
4
|
+
export declare function assert(condition: boolean, message?: string): void;
|
|
4
5
|
export declare function formatObject(object: Object): string;
|
|
5
6
|
export declare function decimalFactor(decimal: number): string;
|
|
6
7
|
export declare const isSameAddress: (address1: Address, address2: Address) => boolean;
|
package/dist/priceFetcher.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare function fetchUnderlyingTokensPrices(provider: providers.Provider
|
|
|
20
20
|
export declare function fetchStNEARPrice(): Promise<BigNumber>;
|
|
21
21
|
export declare function fetchPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
|
|
22
22
|
export declare function fetchPLYPrice(provider: providers.Provider): Promise<BigNumber>;
|
|
23
|
+
export declare function fetchPULPPrice(provider: providers.Provider): Promise<BigNumber>;
|
|
23
24
|
export declare function fetchToken0PriceByLP(LP: Address, provider: providers.Provider): Promise<BigNumber>;
|
|
24
25
|
export declare function fetchValuation(tokenAmount: TokenAmount, provider: providers.Provider): Promise<BigNumber>;
|
|
25
26
|
export declare function calcValuation(tokenAmount: TokenAmount, price: BigNumber): BigNumber;
|
|
@@ -12,7 +12,6 @@ var AuriLensABI = _interopDefault(require('@aurigami/contracts/artifacts/contrac
|
|
|
12
12
|
var ComptrollerABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json'));
|
|
13
13
|
var FaucetABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/Faucet.sol/Faucet.json'));
|
|
14
14
|
var abstractSigner = require('@ethersproject/abstract-signer');
|
|
15
|
-
var assert = _interopDefault(require('assert'));
|
|
16
15
|
var axios = _interopDefault(require('axios'));
|
|
17
16
|
var AuErc20ABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json'));
|
|
18
17
|
var AuETHABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json'));
|
|
@@ -963,11 +962,15 @@ var networkAddresses = {
|
|
|
963
962
|
name: 'auTRI',
|
|
964
963
|
address: /*#__PURE__*/'0x6Ea6C03061bDdCE23d4Ec60B6E6e880c33d24dca'.toLowerCase(),
|
|
965
964
|
underlying: /*#__PURE__*/'0xFa94348467f64D5A457F75F8bc40495D33c65aBB'.toLowerCase()
|
|
965
|
+
}, {
|
|
966
|
+
name: 'auPLY',
|
|
967
|
+
address: /*#__PURE__*/'0xC9011e629c9d0b8B1e4A2091e123fBB87B3A792c'.toLowerCase(),
|
|
968
|
+
underlying: /*#__PURE__*/'0x09c9d464b58d96837f8d8b6f4d9fe4ad408d3a4f'.toLowerCase()
|
|
966
969
|
}],
|
|
967
970
|
misc: {
|
|
968
971
|
COMPTROLLER: /*#__PURE__*/'0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb'.toLowerCase(),
|
|
969
972
|
oracle: /*#__PURE__*/'0xC6e5185438e1730959c1eF3551059A3feC744E90'.toLowerCase(),
|
|
970
|
-
AURIFAIRLAUNCH: /*#__PURE__*/'
|
|
973
|
+
AURIFAIRLAUNCH: /*#__PURE__*/'0xC9A848AC73e378516B16E4EeBBa5ef6aFbC0BBc2'.toLowerCase(),
|
|
971
974
|
AURILENS: /*#__PURE__*/'0xFfdFfBDB966Cb84B50e62d70105f2Dbf2e0A1e70'.toLowerCase(),
|
|
972
975
|
TOKENLOCK: /*#__PURE__*/'0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
|
|
973
976
|
ETHREPAYHELPER: /*#__PURE__*/'0xa308A5003fA1A25BFdD9418FcEE51d48Dbe441e6'.toLowerCase(),
|
|
@@ -988,13 +991,13 @@ var networkAddresses = {
|
|
|
988
991
|
var PRICE_WHITELISTED = /*#__PURE__*/new Set( /*#__PURE__*/[].concat( /*#__PURE__*/networkAddresses.auTokens.map(function (t) {
|
|
989
992
|
return t.underlying;
|
|
990
993
|
}), [networkAddresses.tokens.AURORA, networkAddresses.tokens.TRI, networkAddresses.tokens.META, networkAddresses.tokens.stNEAR]));
|
|
991
|
-
var REWARD_CLAIM_START =
|
|
994
|
+
var REWARD_CLAIM_START = 1651759200;
|
|
992
995
|
var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(1);
|
|
993
996
|
var ONE_DAY = 86400;
|
|
994
997
|
var ONE_WEEK = ONE_DAY * 7;
|
|
995
998
|
var ONE_YEAR = ONE_DAY * 365;
|
|
996
999
|
var PLYWNEAR_POOL_ID = 0;
|
|
997
|
-
var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
|
|
1000
|
+
var PLYWNEAR_REWARD_TOKENS = ['0x09C9D464b58d96837f8d8b6f4d9fE4aD408d3A4f', '0x04Ac48711BCdc45b4d223fb021E09DA73c71095e', '0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d', '0x07F9F7f963C5cD2BBFFd30CcfB964Be114332E30', '0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79', '0xFa94348467f64D5A457F75F8bc40495D33c65aBB'];
|
|
998
1001
|
var ALL_STAKING_POOLS = [];
|
|
999
1002
|
var INF = /*#__PURE__*/ethers.BigNumber.from(2).pow(256).sub(1);
|
|
1000
1003
|
var AIRDROP_START_TIMESTAMP = 1649858400;
|
|
@@ -1079,6 +1082,16 @@ var decimalRecords = {
|
|
|
1079
1082
|
'0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18
|
|
1080
1083
|
};
|
|
1081
1084
|
|
|
1085
|
+
function assert(condition, message) {
|
|
1086
|
+
if (message === void 0) {
|
|
1087
|
+
message = '';
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
if (!condition) {
|
|
1091
|
+
message = 'Assertion failed' + (message ? ': ' + message : '');
|
|
1092
|
+
throw new Error(message);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1082
1095
|
function formatObject(object) {
|
|
1083
1096
|
return JSON.stringify(object, null, ' ');
|
|
1084
1097
|
}
|
|
@@ -2341,7 +2354,7 @@ function _fetchLPPrice() {
|
|
|
2341
2354
|
return _fetchLPPriceBy.apply(this, arguments);
|
|
2342
2355
|
};
|
|
2343
2356
|
|
|
2344
|
-
fetchLPPriceBy = function _fetchLPPriceBy2(
|
|
2357
|
+
fetchLPPriceBy = function _fetchLPPriceBy2(_x23) {
|
|
2345
2358
|
return _fetchLPPriceBy.apply(this, arguments);
|
|
2346
2359
|
};
|
|
2347
2360
|
|
|
@@ -2514,7 +2527,7 @@ function _fetchPrice2() {
|
|
|
2514
2527
|
while (1) {
|
|
2515
2528
|
switch (_context9.prev = _context9.next) {
|
|
2516
2529
|
case 0:
|
|
2517
|
-
assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()));
|
|
2530
|
+
assert(PRICE_WHITELISTED.has(address.toLocaleLowerCase()), "Address " + address + " is not whitelisted for price fetching");
|
|
2518
2531
|
|
|
2519
2532
|
if (!isSameAddress(address, networkAddresses.tokens.stNEAR)) {
|
|
2520
2533
|
_context9.next = 3;
|
|
@@ -2575,16 +2588,24 @@ function _fetchPrice3() {
|
|
|
2575
2588
|
|
|
2576
2589
|
case 4:
|
|
2577
2590
|
if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
|
|
2578
|
-
_context10.next =
|
|
2591
|
+
_context10.next = 8;
|
|
2579
2592
|
break;
|
|
2580
2593
|
}
|
|
2581
2594
|
|
|
2582
2595
|
return _context10.abrupt("return", fetchPLYPrice(provider));
|
|
2583
2596
|
|
|
2584
|
-
case
|
|
2597
|
+
case 8:
|
|
2598
|
+
if (!isSameAddress(address, networkAddresses.tokens.PULP)) {
|
|
2599
|
+
_context10.next = 10;
|
|
2600
|
+
break;
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
return _context10.abrupt("return", fetchPULPPrice(provider));
|
|
2604
|
+
|
|
2605
|
+
case 10:
|
|
2585
2606
|
return _context10.abrupt("return", _fetchPrice(address, provider));
|
|
2586
2607
|
|
|
2587
|
-
case
|
|
2608
|
+
case 11:
|
|
2588
2609
|
case "end":
|
|
2589
2610
|
return _context10.stop();
|
|
2590
2611
|
}
|
|
@@ -2616,81 +2637,103 @@ function _fetchPLYPrice() {
|
|
|
2616
2637
|
return _fetchPLYPrice.apply(this, arguments);
|
|
2617
2638
|
}
|
|
2618
2639
|
|
|
2619
|
-
function
|
|
2640
|
+
function fetchPULPPrice(_x16) {
|
|
2641
|
+
return _fetchPULPPrice.apply(this, arguments);
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
function _fetchPULPPrice() {
|
|
2645
|
+
_fetchPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(provider) {
|
|
2646
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
2647
|
+
while (1) {
|
|
2648
|
+
switch (_context12.prev = _context12.next) {
|
|
2649
|
+
case 0:
|
|
2650
|
+
return _context12.abrupt("return", new BigNumber(0));
|
|
2651
|
+
|
|
2652
|
+
case 1:
|
|
2653
|
+
case "end":
|
|
2654
|
+
return _context12.stop();
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
}, _callee12);
|
|
2658
|
+
}));
|
|
2659
|
+
return _fetchPULPPrice.apply(this, arguments);
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
function fetchToken0PriceByLP(_x17, _x18) {
|
|
2620
2663
|
return _fetchToken0PriceByLP.apply(this, arguments);
|
|
2621
2664
|
}
|
|
2622
2665
|
|
|
2623
2666
|
function _fetchToken0PriceByLP() {
|
|
2624
|
-
_fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2667
|
+
_fetchToken0PriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(LP, provider) {
|
|
2625
2668
|
var LPInfo, token0Decimal, token1Decimal;
|
|
2626
|
-
return runtime_1.wrap(function
|
|
2669
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
2627
2670
|
while (1) {
|
|
2628
|
-
switch (
|
|
2671
|
+
switch (_context13.prev = _context13.next) {
|
|
2629
2672
|
case 0:
|
|
2630
|
-
|
|
2673
|
+
_context13.next = 2;
|
|
2631
2674
|
return fetchLPPositions(LP, provider);
|
|
2632
2675
|
|
|
2633
2676
|
case 2:
|
|
2634
|
-
LPInfo =
|
|
2677
|
+
LPInfo = _context13.sent;
|
|
2635
2678
|
|
|
2636
2679
|
if (!LPInfo.reserve1.isZero()) {
|
|
2637
|
-
|
|
2680
|
+
_context13.next = 5;
|
|
2638
2681
|
break;
|
|
2639
2682
|
}
|
|
2640
2683
|
|
|
2641
|
-
return
|
|
2684
|
+
return _context13.abrupt("return", new BigNumber(0));
|
|
2642
2685
|
|
|
2643
2686
|
case 5:
|
|
2644
2687
|
token0Decimal = getDecimal(LPInfo.token0);
|
|
2645
2688
|
token1Decimal = getDecimal(LPInfo.token1);
|
|
2646
|
-
|
|
2689
|
+
_context13.next = 9;
|
|
2647
2690
|
return fetchPrice(LPInfo.token1, provider);
|
|
2648
2691
|
|
|
2649
2692
|
case 9:
|
|
2650
|
-
return
|
|
2693
|
+
return _context13.abrupt("return", _context13.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
2651
2694
|
|
|
2652
2695
|
case 10:
|
|
2653
2696
|
case "end":
|
|
2654
|
-
return
|
|
2697
|
+
return _context13.stop();
|
|
2655
2698
|
}
|
|
2656
2699
|
}
|
|
2657
|
-
},
|
|
2700
|
+
}, _callee13);
|
|
2658
2701
|
}));
|
|
2659
2702
|
return _fetchToken0PriceByLP.apply(this, arguments);
|
|
2660
2703
|
}
|
|
2661
2704
|
|
|
2662
|
-
function fetchValuation(
|
|
2705
|
+
function fetchValuation(_x19, _x20) {
|
|
2663
2706
|
return _fetchValuation.apply(this, arguments);
|
|
2664
2707
|
}
|
|
2665
2708
|
|
|
2666
2709
|
function _fetchValuation() {
|
|
2667
|
-
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2710
|
+
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(tokenAmount, provider) {
|
|
2668
2711
|
var price;
|
|
2669
|
-
return runtime_1.wrap(function
|
|
2712
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
2670
2713
|
while (1) {
|
|
2671
|
-
switch (
|
|
2714
|
+
switch (_context14.prev = _context14.next) {
|
|
2672
2715
|
case 0:
|
|
2673
2716
|
if (!(tokenAmount.rawAmount() == '0')) {
|
|
2674
|
-
|
|
2717
|
+
_context14.next = 2;
|
|
2675
2718
|
break;
|
|
2676
2719
|
}
|
|
2677
2720
|
|
|
2678
|
-
return
|
|
2721
|
+
return _context14.abrupt("return", new BigNumber(0));
|
|
2679
2722
|
|
|
2680
2723
|
case 2:
|
|
2681
|
-
|
|
2724
|
+
_context14.next = 4;
|
|
2682
2725
|
return fetchPrice(tokenAmount.token.address, provider);
|
|
2683
2726
|
|
|
2684
2727
|
case 4:
|
|
2685
|
-
price =
|
|
2686
|
-
return
|
|
2728
|
+
price = _context14.sent;
|
|
2729
|
+
return _context14.abrupt("return", calcValuation(tokenAmount, price));
|
|
2687
2730
|
|
|
2688
2731
|
case 6:
|
|
2689
2732
|
case "end":
|
|
2690
|
-
return
|
|
2733
|
+
return _context14.stop();
|
|
2691
2734
|
}
|
|
2692
2735
|
}
|
|
2693
|
-
},
|
|
2736
|
+
}, _callee14);
|
|
2694
2737
|
}));
|
|
2695
2738
|
return _fetchValuation.apply(this, arguments);
|
|
2696
2739
|
}
|
|
@@ -2698,23 +2741,23 @@ function _fetchValuation() {
|
|
|
2698
2741
|
function calcValuation(tokenAmount, price) {
|
|
2699
2742
|
return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price);
|
|
2700
2743
|
}
|
|
2701
|
-
function valuateToken(
|
|
2744
|
+
function valuateToken(_x21, _x22) {
|
|
2702
2745
|
return _valuateToken.apply(this, arguments);
|
|
2703
2746
|
}
|
|
2704
2747
|
|
|
2705
2748
|
function _valuateToken() {
|
|
2706
|
-
_valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2749
|
+
_valuateToken = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(tokenAmount, provider) {
|
|
2707
2750
|
var tokenValuation;
|
|
2708
|
-
return runtime_1.wrap(function
|
|
2751
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
2709
2752
|
while (1) {
|
|
2710
|
-
switch (
|
|
2753
|
+
switch (_context15.prev = _context15.next) {
|
|
2711
2754
|
case 0:
|
|
2712
|
-
|
|
2755
|
+
_context15.next = 2;
|
|
2713
2756
|
return fetchValuation(tokenAmount, provider);
|
|
2714
2757
|
|
|
2715
2758
|
case 2:
|
|
2716
|
-
tokenValuation =
|
|
2717
|
-
return
|
|
2759
|
+
tokenValuation = _context15.sent;
|
|
2760
|
+
return _context15.abrupt("return", {
|
|
2718
2761
|
tokenAmount: tokenAmount,
|
|
2719
2762
|
currencyAmount: {
|
|
2720
2763
|
currency: 'USD',
|
|
@@ -2724,10 +2767,10 @@ function _valuateToken() {
|
|
|
2724
2767
|
|
|
2725
2768
|
case 4:
|
|
2726
2769
|
case "end":
|
|
2727
|
-
return
|
|
2770
|
+
return _context15.stop();
|
|
2728
2771
|
}
|
|
2729
2772
|
}
|
|
2730
|
-
},
|
|
2773
|
+
}, _callee15);
|
|
2731
2774
|
}));
|
|
2732
2775
|
return _valuateToken.apply(this, arguments);
|
|
2733
2776
|
}
|
|
@@ -107656,6 +107699,7 @@ exports.SdkReadWrite = SdkReadWrite;
|
|
|
107656
107699
|
exports.Token = Token;
|
|
107657
107700
|
exports.TokenAmount = TokenAmount;
|
|
107658
107701
|
exports.TransferEventQuery = TransferEventQuery;
|
|
107702
|
+
exports.assert = assert;
|
|
107659
107703
|
exports.calcLMRewardApr = calcLMRewardApr;
|
|
107660
107704
|
exports.calcValuation = calcValuation;
|
|
107661
107705
|
exports.decimalFactor = decimalFactor;
|
|
@@ -107672,6 +107716,7 @@ exports.dummyZeroTokenAmount = dummyZeroTokenAmount;
|
|
|
107672
107716
|
exports.fetchLPPositions = fetchLPPositions;
|
|
107673
107717
|
exports.fetchLPPrice = fetchLPPrice;
|
|
107674
107718
|
exports.fetchPLYPrice = fetchPLYPrice;
|
|
107719
|
+
exports.fetchPULPPrice = fetchPULPPrice;
|
|
107675
107720
|
exports.fetchPrice = fetchPrice;
|
|
107676
107721
|
exports.fetchPriceFromCoingecko = fetchPriceFromCoingecko;
|
|
107677
107722
|
exports.fetchPriceFromCoingeckoAPI = fetchPriceFromCoingeckoAPI;
|