@aurigami/sdk 1.12.7 → 1.12.8
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/helpers/historicalPriceFetcher.d.ts +15 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/interactors/MoneyMarket.d.ts +2 -0
- package/dist/sdk.cjs.development.js +504 -82
- 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 +516 -100
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -3
- package/src/consts/constants.ts +3 -0
- package/src/consts/decimals.ts +2 -0
- package/src/helpers/historicalPriceFetcher.ts +196 -0
- package/src/helpers/index.ts +1 -0
- package/src/interactors/MoneyMarket.ts +12 -0
|
@@ -12,17 +12,17 @@ var abis$1 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/Au
|
|
|
12
12
|
var abis$2 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json'));
|
|
13
13
|
var abis$3 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json'));
|
|
14
14
|
var abis$4 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json'));
|
|
15
|
-
var
|
|
16
|
-
var abis$
|
|
17
|
-
var abis$
|
|
18
|
-
var abis$
|
|
19
|
-
var abis$
|
|
20
|
-
var abis$
|
|
15
|
+
var AuriOracleABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json'));
|
|
16
|
+
var abis$5 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json'));
|
|
17
|
+
var abis$6 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json'));
|
|
18
|
+
var abis$7 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json'));
|
|
19
|
+
var abis$8 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json'));
|
|
20
|
+
var abis$9 = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json'));
|
|
21
21
|
var IUniswapV2PairABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json'));
|
|
22
|
-
var abis$
|
|
23
|
-
var abis$
|
|
24
|
-
var abis$
|
|
25
|
-
var abis$
|
|
22
|
+
var abis$a = _interopDefault(require('@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json'));
|
|
23
|
+
var abis$b = _interopDefault(require('@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json'));
|
|
24
|
+
var abis$c = _interopDefault(require('@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json'));
|
|
25
|
+
var abis$d = _interopDefault(require('@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json'));
|
|
26
26
|
var MAINNET_ADDRESSES = _interopDefault(require('@aurigami/contracts/deployments/aurora_mainnet.json'));
|
|
27
27
|
var aurora_testnet_json = _interopDefault(require('@aurigami/contracts/deployments/aurora_testnet.json'));
|
|
28
28
|
var axios = _interopDefault(require('axios'));
|
|
@@ -32,22 +32,22 @@ var abstractSigner = require('@ethersproject/abstract-signer');
|
|
|
32
32
|
|
|
33
33
|
var index = {
|
|
34
34
|
__proto__: null,
|
|
35
|
-
AuriOracleABI:
|
|
36
|
-
AuTokenABI: abis$
|
|
35
|
+
AuriOracleABI: AuriOracleABI,
|
|
36
|
+
AuTokenABI: abis$5,
|
|
37
37
|
IUniswapV2PairABI: IUniswapV2PairABI,
|
|
38
38
|
AuriAirdropABI: abis$2,
|
|
39
39
|
AuriFairLaunchABI: abis$3,
|
|
40
40
|
AuriLensABI: abis$4,
|
|
41
|
-
ComptrollerABI: abis$
|
|
42
|
-
EIP20InterfaceABI: abis$
|
|
43
|
-
ReferralDirectoryV2ABI: abis$
|
|
41
|
+
ComptrollerABI: abis$6,
|
|
42
|
+
EIP20InterfaceABI: abis$8,
|
|
43
|
+
ReferralDirectoryV2ABI: abis$c,
|
|
44
44
|
AuErc20ABI: abis,
|
|
45
45
|
AuETHABI: abis$1,
|
|
46
|
-
EthRepayHelperABI: abis$
|
|
47
|
-
Multicall2ABI: abis$
|
|
48
|
-
PulpABI: abis$
|
|
49
|
-
AuriInternalLensABI: abis$
|
|
50
|
-
PlyGameABI: abis$
|
|
46
|
+
EthRepayHelperABI: abis$7,
|
|
47
|
+
Multicall2ABI: abis$a,
|
|
48
|
+
PulpABI: abis$b,
|
|
49
|
+
AuriInternalLensABI: abis$9,
|
|
50
|
+
PlyGameABI: abis$d
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
@@ -129,7 +129,10 @@ var networkAddresses = {
|
|
|
129
129
|
META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLowerCase(),
|
|
130
130
|
PULP: /*#__PURE__*/MAINNET_ADDRESSES.PULP.toLowerCase(),
|
|
131
131
|
PLYWNEAR: /*#__PURE__*/MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase(),
|
|
132
|
-
USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase()
|
|
132
|
+
USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase(),
|
|
133
|
+
PLY_WNEAR: /*#__PURE__*/'0x044b6b0cd3bb13d2b9057781df4459c66781dce7'.toLowerCase(),
|
|
134
|
+
WNEAR_TRI: /*#__PURE__*/'0x84b123875f0f36b966d0b6ca14b31121bd9676ad'.toLowerCase(),
|
|
135
|
+
AURORA_WNEAR: /*#__PURE__*/'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase()
|
|
133
136
|
}
|
|
134
137
|
};
|
|
135
138
|
var DEPOSIT_ONLY_TOKENS = [/*#__PURE__*/MAINNET_ADDRESSES.auTokens.STNEAR.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.AURORA.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.TRI.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.PLY.toLowerCase(), /*#__PURE__*/MAINNET_ADDRESSES.auTokens.USN.toLowerCase()]; // All token that we can calculate the price via oracle + coingecko
|
|
@@ -217,7 +220,9 @@ var decimalRecords = {
|
|
|
217
220
|
'0xc21ff01229e982d7c8b8691163b0a3cb8f357453': 24,
|
|
218
221
|
'0x04ac48711bcdc45b4d223fb021e09da73c71095e': 18,
|
|
219
222
|
'0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18,
|
|
220
|
-
'0x5183e1b1091804bc2602586919e6880ac1cf2896': 18
|
|
223
|
+
'0x5183e1b1091804bc2602586919e6880ac1cf2896': 18,
|
|
224
|
+
'0x84b123875f0f36b966d0b6ca14b31121bd9676ad': 18,
|
|
225
|
+
'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008': 18
|
|
221
226
|
};
|
|
222
227
|
|
|
223
228
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -1593,7 +1598,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1593
1598
|
var _this2 = this;
|
|
1594
1599
|
|
|
1595
1600
|
return networkAddresses.auTokens.map(function (auToken) {
|
|
1596
|
-
var contract = _this2.getContract(auToken.address, abis$
|
|
1601
|
+
var contract = _this2.getContract(auToken.address, abis$5.abi);
|
|
1597
1602
|
|
|
1598
1603
|
contract.underlying = auToken.underlying;
|
|
1599
1604
|
return contract;
|
|
@@ -1628,7 +1633,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1628
1633
|
key: "comptroller",
|
|
1629
1634
|
get: function get() {
|
|
1630
1635
|
if (!this._comptroller) {
|
|
1631
|
-
this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$
|
|
1636
|
+
this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$6.abi);
|
|
1632
1637
|
}
|
|
1633
1638
|
|
|
1634
1639
|
return this._comptroller;
|
|
@@ -1655,7 +1660,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1655
1660
|
key: "ply",
|
|
1656
1661
|
get: function get() {
|
|
1657
1662
|
if (!this._ply) {
|
|
1658
|
-
this._ply = this.getContract(networkAddresses.tokens.PLY, abis$
|
|
1663
|
+
this._ply = this.getContract(networkAddresses.tokens.PLY, abis$8.abi);
|
|
1659
1664
|
}
|
|
1660
1665
|
|
|
1661
1666
|
return this._ply;
|
|
@@ -1664,7 +1669,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1664
1669
|
key: "pulp",
|
|
1665
1670
|
get: function get() {
|
|
1666
1671
|
if (!this._pulp) {
|
|
1667
|
-
this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$
|
|
1672
|
+
this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$b.abi);
|
|
1668
1673
|
}
|
|
1669
1674
|
|
|
1670
1675
|
return this._pulp;
|
|
@@ -1673,7 +1678,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1673
1678
|
key: "auriInternalLens",
|
|
1674
1679
|
get: function get() {
|
|
1675
1680
|
if (!this._auriInternalLens) {
|
|
1676
|
-
this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$
|
|
1681
|
+
this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$9.abi);
|
|
1677
1682
|
}
|
|
1678
1683
|
|
|
1679
1684
|
return this._auriInternalLens;
|
|
@@ -1691,7 +1696,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1691
1696
|
key: "referralDirectoryV2",
|
|
1692
1697
|
get: function get() {
|
|
1693
1698
|
if (!this._referralDirectoryV2) {
|
|
1694
|
-
this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$
|
|
1699
|
+
this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$c.abi);
|
|
1695
1700
|
}
|
|
1696
1701
|
|
|
1697
1702
|
return this._referralDirectoryV2;
|
|
@@ -1700,7 +1705,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1700
1705
|
key: "oracle",
|
|
1701
1706
|
get: function get() {
|
|
1702
1707
|
if (!this._oracle) {
|
|
1703
|
-
this._oracle = this.getContract(networkAddresses.misc.oracle,
|
|
1708
|
+
this._oracle = this.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
|
|
1704
1709
|
}
|
|
1705
1710
|
|
|
1706
1711
|
return this._oracle;
|
|
@@ -1709,7 +1714,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1709
1714
|
key: "plygame",
|
|
1710
1715
|
get: function get() {
|
|
1711
1716
|
if (!this._plygame) {
|
|
1712
|
-
this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$
|
|
1717
|
+
this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$d.abi);
|
|
1713
1718
|
}
|
|
1714
1719
|
|
|
1715
1720
|
return this._plygame;
|
|
@@ -2232,7 +2237,7 @@ function _fetchPriceFromOracle() {
|
|
|
2232
2237
|
while (1) {
|
|
2233
2238
|
switch (_context9.prev = _context9.next) {
|
|
2234
2239
|
case 0:
|
|
2235
|
-
oracleContract = new ethers.Contract(networkAddresses.misc.oracle,
|
|
2240
|
+
oracleContract = new ethers.Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
|
|
2236
2241
|
_context9.next = 3;
|
|
2237
2242
|
return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
|
|
2238
2243
|
console.log("Unable to fetch price from oracle for " + auTokenAddress);
|
|
@@ -2598,7 +2603,7 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2598
2603
|
var _this;
|
|
2599
2604
|
|
|
2600
2605
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
2601
|
-
_this.auToken = new ethers.Contract(tokenAddr, abis$
|
|
2606
|
+
_this.auToken = new ethers.Contract(tokenAddr, abis$5.abi, _this._networkConnection.provider);
|
|
2602
2607
|
return _this;
|
|
2603
2608
|
}
|
|
2604
2609
|
/**
|
|
@@ -2692,6 +2697,351 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2692
2697
|
return TransferEventQuery;
|
|
2693
2698
|
}(BlockchainEntityRead);
|
|
2694
2699
|
|
|
2700
|
+
function fetchHistoricalLPPositions(_x, _x2, _x3) {
|
|
2701
|
+
return _fetchHistoricalLPPositions.apply(this, arguments);
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
function _fetchHistoricalLPPositions() {
|
|
2705
|
+
_fetchHistoricalLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(LPAddress, provider, block) {
|
|
2706
|
+
var LPContract, promises, values;
|
|
2707
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2708
|
+
while (1) {
|
|
2709
|
+
switch (_context.prev = _context.next) {
|
|
2710
|
+
case 0:
|
|
2711
|
+
LPContract = new ethers.Contract(LPAddress, IUniswapV2PairABI.abi, provider);
|
|
2712
|
+
promises = [];
|
|
2713
|
+
promises.push(LPContract.token0());
|
|
2714
|
+
promises.push(LPContract.token1());
|
|
2715
|
+
promises.push(LPContract.getReserves({
|
|
2716
|
+
blockTag: block
|
|
2717
|
+
}));
|
|
2718
|
+
promises.push(LPContract.totalSupply({
|
|
2719
|
+
blockTag: block
|
|
2720
|
+
}));
|
|
2721
|
+
_context.next = 8;
|
|
2722
|
+
return Promise.all(promises);
|
|
2723
|
+
|
|
2724
|
+
case 8:
|
|
2725
|
+
values = _context.sent;
|
|
2726
|
+
return _context.abrupt("return", {
|
|
2727
|
+
token0: values[0],
|
|
2728
|
+
token1: values[1],
|
|
2729
|
+
reserve0: values[2].reserve0,
|
|
2730
|
+
reserve1: values[2].reserve1,
|
|
2731
|
+
totalSupply: values[3]
|
|
2732
|
+
});
|
|
2733
|
+
|
|
2734
|
+
case 10:
|
|
2735
|
+
case "end":
|
|
2736
|
+
return _context.stop();
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
}, _callee);
|
|
2740
|
+
}));
|
|
2741
|
+
return _fetchHistoricalLPPositions.apply(this, arguments);
|
|
2742
|
+
}
|
|
2743
|
+
|
|
2744
|
+
function fetchHistoricalLPPrice(_x4, _x5, _x6) {
|
|
2745
|
+
return _fetchHistoricalLPPrice.apply(this, arguments);
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
function _fetchHistoricalLPPrice() {
|
|
2749
|
+
_fetchHistoricalLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(address, provider, block) {
|
|
2750
|
+
var LPInfo, LPDecimal, fetchLPPriceBy, _fetchLPPriceBy, lpPrice;
|
|
2751
|
+
|
|
2752
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2753
|
+
while (1) {
|
|
2754
|
+
switch (_context3.prev = _context3.next) {
|
|
2755
|
+
case 0:
|
|
2756
|
+
_fetchLPPriceBy = function _fetchLPPriceBy3() {
|
|
2757
|
+
_fetchLPPriceBy = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(tokenReverse, block) {
|
|
2758
|
+
var tokenPrice, tokenDecimal, reserveUSD;
|
|
2759
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2760
|
+
while (1) {
|
|
2761
|
+
switch (_context2.prev = _context2.next) {
|
|
2762
|
+
case 0:
|
|
2763
|
+
if (!tokenReverse.reserve.isZero()) {
|
|
2764
|
+
_context2.next = 2;
|
|
2765
|
+
break;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
return _context2.abrupt("return", new BigNumber(0));
|
|
2769
|
+
|
|
2770
|
+
case 2:
|
|
2771
|
+
_context2.next = 4;
|
|
2772
|
+
return fetchHistoricalPrice(tokenReverse.address, provider, block);
|
|
2773
|
+
|
|
2774
|
+
case 4:
|
|
2775
|
+
tokenPrice = _context2.sent;
|
|
2776
|
+
tokenDecimal = getDecimal(tokenReverse.address); // reserveUSD will be divided by 10^tokenDecimal later for more precision
|
|
2777
|
+
|
|
2778
|
+
reserveUSD = tokenPrice.multipliedBy(tokenReverse.reserve.toString()).multipliedBy(2);
|
|
2779
|
+
return _context2.abrupt("return", reserveUSD.multipliedBy(decimalFactor(LPDecimal)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())).dividedBy(decimalFactor(tokenDecimal)));
|
|
2780
|
+
|
|
2781
|
+
case 8:
|
|
2782
|
+
case "end":
|
|
2783
|
+
return _context2.stop();
|
|
2784
|
+
}
|
|
2785
|
+
}
|
|
2786
|
+
}, _callee2);
|
|
2787
|
+
}));
|
|
2788
|
+
return _fetchLPPriceBy.apply(this, arguments);
|
|
2789
|
+
};
|
|
2790
|
+
|
|
2791
|
+
fetchLPPriceBy = function _fetchLPPriceBy2(_x19, _x20) {
|
|
2792
|
+
return _fetchLPPriceBy.apply(this, arguments);
|
|
2793
|
+
};
|
|
2794
|
+
|
|
2795
|
+
_context3.next = 4;
|
|
2796
|
+
return fetchHistoricalLPPositions(address, provider, block);
|
|
2797
|
+
|
|
2798
|
+
case 4:
|
|
2799
|
+
LPInfo = _context3.sent;
|
|
2800
|
+
LPDecimal = getDecimal(address);
|
|
2801
|
+
_context3.prev = 6;
|
|
2802
|
+
_context3.next = 9;
|
|
2803
|
+
return fetchLPPriceBy({
|
|
2804
|
+
address: LPInfo.token0,
|
|
2805
|
+
reserve: LPInfo.reserve0
|
|
2806
|
+
}, block);
|
|
2807
|
+
|
|
2808
|
+
case 9:
|
|
2809
|
+
lpPrice = _context3.sent;
|
|
2810
|
+
|
|
2811
|
+
if (!lpPrice.isZero()) {
|
|
2812
|
+
_context3.next = 12;
|
|
2813
|
+
break;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
throw Error("Price is zero");
|
|
2817
|
+
|
|
2818
|
+
case 12:
|
|
2819
|
+
return _context3.abrupt("return", lpPrice);
|
|
2820
|
+
|
|
2821
|
+
case 15:
|
|
2822
|
+
_context3.prev = 15;
|
|
2823
|
+
_context3.t0 = _context3["catch"](6);
|
|
2824
|
+
devLog("fetchLPPriceBy " + LPInfo.token0 + " failed", _context3.t0);
|
|
2825
|
+
_context3.prev = 18;
|
|
2826
|
+
_context3.next = 21;
|
|
2827
|
+
return fetchLPPriceBy({
|
|
2828
|
+
address: LPInfo.token1,
|
|
2829
|
+
reserve: LPInfo.reserve1
|
|
2830
|
+
}, block);
|
|
2831
|
+
|
|
2832
|
+
case 21:
|
|
2833
|
+
return _context3.abrupt("return", _context3.sent);
|
|
2834
|
+
|
|
2835
|
+
case 24:
|
|
2836
|
+
_context3.prev = 24;
|
|
2837
|
+
_context3.t1 = _context3["catch"](18);
|
|
2838
|
+
devLog("fetchLPPriceBy " + LPInfo.token1 + " failed", _context3.t1);
|
|
2839
|
+
throw Error("Unable to fetch price for both tokens of LP " + address);
|
|
2840
|
+
|
|
2841
|
+
case 28:
|
|
2842
|
+
case "end":
|
|
2843
|
+
return _context3.stop();
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}, _callee3, null, [[6, 15], [18, 24]]);
|
|
2847
|
+
}));
|
|
2848
|
+
return _fetchHistoricalLPPrice.apply(this, arguments);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
function processPriceFromOracle$1(rawPrice, underlyingDecimal) {
|
|
2852
|
+
return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
function fetchHistoricalPriceFromOracle(_x7, _x8, _x9, _x10) {
|
|
2856
|
+
return _fetchHistoricalPriceFromOracle.apply(this, arguments);
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
function _fetchHistoricalPriceFromOracle() {
|
|
2860
|
+
_fetchHistoricalPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(auTokenAddress, underlyingDecimal, provider, block) {
|
|
2861
|
+
var oracleContract, rawPrice;
|
|
2862
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2863
|
+
while (1) {
|
|
2864
|
+
switch (_context4.prev = _context4.next) {
|
|
2865
|
+
case 0:
|
|
2866
|
+
oracleContract = new ethers.Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
|
|
2867
|
+
_context4.next = 3;
|
|
2868
|
+
return oracleContract.getUnderlyingPrice(auTokenAddress, {
|
|
2869
|
+
blockTag: block
|
|
2870
|
+
})["catch"](function (e) {
|
|
2871
|
+
console.log("Unable to fetch price from oracle for " + auTokenAddress);
|
|
2872
|
+
return ethers.BigNumber.from(0);
|
|
2873
|
+
});
|
|
2874
|
+
|
|
2875
|
+
case 3:
|
|
2876
|
+
rawPrice = _context4.sent;
|
|
2877
|
+
return _context4.abrupt("return", processPriceFromOracle$1(rawPrice, underlyingDecimal));
|
|
2878
|
+
|
|
2879
|
+
case 5:
|
|
2880
|
+
case "end":
|
|
2881
|
+
return _context4.stop();
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
}, _callee4);
|
|
2885
|
+
}));
|
|
2886
|
+
return _fetchHistoricalPriceFromOracle.apply(this, arguments);
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
function fetchHistoricalPrice(_x11, _x12, _x13) {
|
|
2890
|
+
return _fetchHistoricalPrice.apply(this, arguments);
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
function _fetchHistoricalPrice() {
|
|
2894
|
+
_fetchHistoricalPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(address, provider, block) {
|
|
2895
|
+
var matchingAuToken;
|
|
2896
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2897
|
+
while (1) {
|
|
2898
|
+
switch (_context5.prev = _context5.next) {
|
|
2899
|
+
case 0:
|
|
2900
|
+
if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
|
|
2901
|
+
_context5.next = 4;
|
|
2902
|
+
break;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
return _context5.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
|
|
2906
|
+
|
|
2907
|
+
case 4:
|
|
2908
|
+
if (!(isSameAddress(address, networkAddresses.tokens.PLY_WNEAR) || isSameAddress(address, networkAddresses.tokens.WNEAR_TRI) || isSameAddress(address, networkAddresses.tokens.AURORA_WNEAR))) {
|
|
2909
|
+
_context5.next = 8;
|
|
2910
|
+
break;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
return _context5.abrupt("return", fetchHistoricalLPPrice(address, provider, block));
|
|
2914
|
+
|
|
2915
|
+
case 8:
|
|
2916
|
+
if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
|
|
2917
|
+
_context5.next = 12;
|
|
2918
|
+
break;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
return _context5.abrupt("return", fetchHistoricalPriceByLP(networkAddresses.tokens.PLY_WNEAR, provider, block));
|
|
2922
|
+
|
|
2923
|
+
case 12:
|
|
2924
|
+
if (!isSameAddress(address, networkAddresses.tokens.TRI)) {
|
|
2925
|
+
_context5.next = 16;
|
|
2926
|
+
break;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
return _context5.abrupt("return", fetchHistoricalPriceByLP(networkAddresses.tokens.WNEAR_TRI, provider, block, 1));
|
|
2930
|
+
|
|
2931
|
+
case 16:
|
|
2932
|
+
if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
|
|
2933
|
+
_context5.next = 18;
|
|
2934
|
+
break;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
return _context5.abrupt("return", fetchHistoricalPriceByLP(networkAddresses.tokens.AURORA_WNEAR, provider, block));
|
|
2938
|
+
|
|
2939
|
+
case 18:
|
|
2940
|
+
matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
|
|
2941
|
+
return isSameAddress(auToken.underlying, address);
|
|
2942
|
+
});
|
|
2943
|
+
|
|
2944
|
+
if (!(matchingAuToken !== undefined)) {
|
|
2945
|
+
_context5.next = 23;
|
|
2946
|
+
break;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
return _context5.abrupt("return", fetchHistoricalPriceFromOracle(matchingAuToken.address, getDecimal(address), provider, block));
|
|
2950
|
+
|
|
2951
|
+
case 23:
|
|
2952
|
+
throw Error("Unable to fetch price for " + address);
|
|
2953
|
+
|
|
2954
|
+
case 24:
|
|
2955
|
+
case "end":
|
|
2956
|
+
return _context5.stop();
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
}, _callee5);
|
|
2960
|
+
}));
|
|
2961
|
+
return _fetchHistoricalPrice.apply(this, arguments);
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
function fetchHistoricalPULPPrice(_x14) {
|
|
2965
|
+
return _fetchHistoricalPULPPrice.apply(this, arguments);
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
function _fetchHistoricalPULPPrice() {
|
|
2969
|
+
_fetchHistoricalPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
|
|
2970
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2971
|
+
while (1) {
|
|
2972
|
+
switch (_context6.prev = _context6.next) {
|
|
2973
|
+
case 0:
|
|
2974
|
+
return _context6.abrupt("return", new BigNumber(0));
|
|
2975
|
+
|
|
2976
|
+
case 1:
|
|
2977
|
+
case "end":
|
|
2978
|
+
return _context6.stop();
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}, _callee6);
|
|
2982
|
+
}));
|
|
2983
|
+
return _fetchHistoricalPULPPrice.apply(this, arguments);
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
function fetchHistoricalPriceByLP(_x15, _x16, _x17, _x18) {
|
|
2987
|
+
return _fetchHistoricalPriceByLP.apply(this, arguments);
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
function _fetchHistoricalPriceByLP() {
|
|
2991
|
+
_fetchHistoricalPriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(LP, provider, block, tokenNumber) {
|
|
2992
|
+
var LPInfo, token0Decimal, token1Decimal;
|
|
2993
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
2994
|
+
while (1) {
|
|
2995
|
+
switch (_context7.prev = _context7.next) {
|
|
2996
|
+
case 0:
|
|
2997
|
+
if (tokenNumber === void 0) {
|
|
2998
|
+
tokenNumber = 0;
|
|
2999
|
+
}
|
|
3000
|
+
|
|
3001
|
+
_context7.next = 3;
|
|
3002
|
+
return fetchHistoricalLPPositions(LP, provider, block);
|
|
3003
|
+
|
|
3004
|
+
case 3:
|
|
3005
|
+
LPInfo = _context7.sent;
|
|
3006
|
+
|
|
3007
|
+
if (tokenNumber === 1) {
|
|
3008
|
+
LPInfo = {
|
|
3009
|
+
token0: LPInfo.token1,
|
|
3010
|
+
token1: LPInfo.token0,
|
|
3011
|
+
reserve0: LPInfo.reserve1,
|
|
3012
|
+
reserve1: LPInfo.reserve0,
|
|
3013
|
+
totalSupply: LPInfo.totalSupply
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
if (!LPInfo.reserve1.isZero()) {
|
|
3018
|
+
_context7.next = 7;
|
|
3019
|
+
break;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
return _context7.abrupt("return", new BigNumber(0));
|
|
3023
|
+
|
|
3024
|
+
case 7:
|
|
3025
|
+
token0Decimal = getDecimal(LPInfo.token0);
|
|
3026
|
+
token1Decimal = getDecimal(LPInfo.token1); // (token0Price * reserve0) / 10^decimal0 = (token1Price * reserve1) / 10^decimal1
|
|
3027
|
+
// token0Price = (token1Price * reserve1) * 10^decimal0 / 10^decimal1 / reserve0
|
|
3028
|
+
|
|
3029
|
+
_context7.next = 11;
|
|
3030
|
+
return fetchHistoricalPrice(LPInfo.token1, provider, block);
|
|
3031
|
+
|
|
3032
|
+
case 11:
|
|
3033
|
+
return _context7.abrupt("return", _context7.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
3034
|
+
|
|
3035
|
+
case 12:
|
|
3036
|
+
case "end":
|
|
3037
|
+
return _context7.stop();
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
}, _callee7);
|
|
3041
|
+
}));
|
|
3042
|
+
return _fetchHistoricalPriceByLP.apply(this, arguments);
|
|
3043
|
+
}
|
|
3044
|
+
|
|
2695
3045
|
|
|
2696
3046
|
|
|
2697
3047
|
var helpers = {
|
|
@@ -2733,7 +3083,13 @@ var helpers = {
|
|
|
2733
3083
|
fetchValuation: fetchValuation,
|
|
2734
3084
|
calcValuation: calcValuation,
|
|
2735
3085
|
valuateToken: valuateToken,
|
|
2736
|
-
TransferEventQuery: TransferEventQuery
|
|
3086
|
+
TransferEventQuery: TransferEventQuery,
|
|
3087
|
+
fetchHistoricalLPPositions: fetchHistoricalLPPositions,
|
|
3088
|
+
fetchHistoricalLPPrice: fetchHistoricalLPPrice,
|
|
3089
|
+
fetchHistoricalPriceFromOracle: fetchHistoricalPriceFromOracle,
|
|
3090
|
+
fetchHistoricalPrice: fetchHistoricalPrice,
|
|
3091
|
+
fetchHistoricalPULPPrice: fetchHistoricalPULPPrice,
|
|
3092
|
+
fetchHistoricalPriceByLP: fetchHistoricalPriceByLP
|
|
2737
3093
|
};
|
|
2738
3094
|
|
|
2739
3095
|
var AirdropRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
@@ -3382,6 +3738,66 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3382
3738
|
}
|
|
3383
3739
|
};
|
|
3384
3740
|
|
|
3741
|
+
_proto.mintCap = /*#__PURE__*/function () {
|
|
3742
|
+
var _mintCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12() {
|
|
3743
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
3744
|
+
while (1) {
|
|
3745
|
+
switch (_context12.prev = _context12.next) {
|
|
3746
|
+
case 0:
|
|
3747
|
+
_context12.t0 = TokenAmount;
|
|
3748
|
+
_context12.t1 = this.underlying;
|
|
3749
|
+
_context12.next = 4;
|
|
3750
|
+
return this.env.comptroller.mintCaps(this.auToken.address);
|
|
3751
|
+
|
|
3752
|
+
case 4:
|
|
3753
|
+
_context12.t2 = _context12.sent.toString();
|
|
3754
|
+
return _context12.abrupt("return", new _context12.t0(_context12.t1, _context12.t2));
|
|
3755
|
+
|
|
3756
|
+
case 6:
|
|
3757
|
+
case "end":
|
|
3758
|
+
return _context12.stop();
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
}, _callee12, this);
|
|
3762
|
+
}));
|
|
3763
|
+
|
|
3764
|
+
function mintCap() {
|
|
3765
|
+
return _mintCap.apply(this, arguments);
|
|
3766
|
+
}
|
|
3767
|
+
|
|
3768
|
+
return mintCap;
|
|
3769
|
+
}();
|
|
3770
|
+
|
|
3771
|
+
_proto.borrowCap = /*#__PURE__*/function () {
|
|
3772
|
+
var _borrowCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
|
|
3773
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
3774
|
+
while (1) {
|
|
3775
|
+
switch (_context13.prev = _context13.next) {
|
|
3776
|
+
case 0:
|
|
3777
|
+
_context13.t0 = TokenAmount;
|
|
3778
|
+
_context13.t1 = this.underlying;
|
|
3779
|
+
_context13.next = 4;
|
|
3780
|
+
return this.env.comptroller.borrowCaps(this.auToken.address);
|
|
3781
|
+
|
|
3782
|
+
case 4:
|
|
3783
|
+
_context13.t2 = _context13.sent.toString();
|
|
3784
|
+
return _context13.abrupt("return", new _context13.t0(_context13.t1, _context13.t2));
|
|
3785
|
+
|
|
3786
|
+
case 6:
|
|
3787
|
+
case "end":
|
|
3788
|
+
return _context13.stop();
|
|
3789
|
+
}
|
|
3790
|
+
}
|
|
3791
|
+
}, _callee13, this);
|
|
3792
|
+
}));
|
|
3793
|
+
|
|
3794
|
+
function borrowCap() {
|
|
3795
|
+
return _borrowCap.apply(this, arguments);
|
|
3796
|
+
}
|
|
3797
|
+
|
|
3798
|
+
return borrowCap;
|
|
3799
|
+
}();
|
|
3800
|
+
|
|
3385
3801
|
return MoneyMarketRead;
|
|
3386
3802
|
}(BlockchainEntityRead);
|
|
3387
3803
|
var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
@@ -3391,36 +3807,36 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3391
3807
|
var _this3;
|
|
3392
3808
|
|
|
3393
3809
|
_this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
|
|
3394
|
-
_this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$
|
|
3810
|
+
_this3._EthRepayHelper = new ethers.Contract(networkAddresses.misc.ETHREPAYHELPER, abis$7.abi, networkConnection.provider);
|
|
3395
3811
|
return _this3;
|
|
3396
3812
|
}
|
|
3397
3813
|
|
|
3398
3814
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
3399
3815
|
|
|
3400
3816
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
3401
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3402
|
-
return runtime_1.wrap(function
|
|
3817
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
|
|
3818
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
3403
3819
|
while (1) {
|
|
3404
|
-
switch (
|
|
3820
|
+
switch (_context14.prev = _context14.next) {
|
|
3405
3821
|
case 0:
|
|
3406
3822
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
3407
|
-
|
|
3823
|
+
_context14.next = 4;
|
|
3408
3824
|
break;
|
|
3409
3825
|
}
|
|
3410
3826
|
|
|
3411
|
-
return
|
|
3827
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
3412
3828
|
value: amount.rawAmount()
|
|
3413
3829
|
}));
|
|
3414
3830
|
|
|
3415
3831
|
case 4:
|
|
3416
|
-
return
|
|
3832
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
3417
3833
|
|
|
3418
3834
|
case 5:
|
|
3419
3835
|
case "end":
|
|
3420
|
-
return
|
|
3836
|
+
return _context14.stop();
|
|
3421
3837
|
}
|
|
3422
3838
|
}
|
|
3423
|
-
},
|
|
3839
|
+
}, _callee14, this);
|
|
3424
3840
|
}));
|
|
3425
3841
|
|
|
3426
3842
|
function deposit(_x3) {
|
|
@@ -3431,19 +3847,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3431
3847
|
}();
|
|
3432
3848
|
|
|
3433
3849
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
3434
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3435
|
-
return runtime_1.wrap(function
|
|
3850
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(amount) {
|
|
3851
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
3436
3852
|
while (1) {
|
|
3437
|
-
switch (
|
|
3853
|
+
switch (_context15.prev = _context15.next) {
|
|
3438
3854
|
case 0:
|
|
3439
|
-
return
|
|
3855
|
+
return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
3440
3856
|
|
|
3441
3857
|
case 1:
|
|
3442
3858
|
case "end":
|
|
3443
|
-
return
|
|
3859
|
+
return _context15.stop();
|
|
3444
3860
|
}
|
|
3445
3861
|
}
|
|
3446
|
-
},
|
|
3862
|
+
}, _callee15, this);
|
|
3447
3863
|
}));
|
|
3448
3864
|
|
|
3449
3865
|
function borrow(_x4) {
|
|
@@ -3454,27 +3870,27 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3454
3870
|
}();
|
|
3455
3871
|
|
|
3456
3872
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
3457
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3458
|
-
return runtime_1.wrap(function
|
|
3873
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(amount) {
|
|
3874
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
3459
3875
|
while (1) {
|
|
3460
|
-
switch (
|
|
3876
|
+
switch (_context16.prev = _context16.next) {
|
|
3461
3877
|
case 0:
|
|
3462
3878
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
3463
|
-
|
|
3879
|
+
_context16.next = 2;
|
|
3464
3880
|
break;
|
|
3465
3881
|
}
|
|
3466
3882
|
|
|
3467
|
-
return
|
|
3883
|
+
return _context16.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
|
|
3468
3884
|
|
|
3469
3885
|
case 2:
|
|
3470
|
-
return
|
|
3886
|
+
return _context16.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
3471
3887
|
|
|
3472
3888
|
case 3:
|
|
3473
3889
|
case "end":
|
|
3474
|
-
return
|
|
3890
|
+
return _context16.stop();
|
|
3475
3891
|
}
|
|
3476
3892
|
}
|
|
3477
|
-
},
|
|
3893
|
+
}, _callee16, this);
|
|
3478
3894
|
}));
|
|
3479
3895
|
|
|
3480
3896
|
function withdraw(_x5) {
|
|
@@ -3485,37 +3901,37 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3485
3901
|
}();
|
|
3486
3902
|
|
|
3487
3903
|
_proto2.repay = /*#__PURE__*/function () {
|
|
3488
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3489
|
-
return runtime_1.wrap(function
|
|
3904
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(amount) {
|
|
3905
|
+
return runtime_1.wrap(function _callee17$(_context17) {
|
|
3490
3906
|
while (1) {
|
|
3491
|
-
switch (
|
|
3907
|
+
switch (_context17.prev = _context17.next) {
|
|
3492
3908
|
case 0:
|
|
3493
3909
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
3494
|
-
|
|
3910
|
+
_context17.next = 4;
|
|
3495
3911
|
break;
|
|
3496
3912
|
}
|
|
3497
3913
|
|
|
3498
|
-
return
|
|
3914
|
+
return _context17.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
|
|
3499
3915
|
value: amount.rawAmount()
|
|
3500
3916
|
}));
|
|
3501
3917
|
|
|
3502
3918
|
case 4:
|
|
3503
3919
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
3504
|
-
|
|
3920
|
+
_context17.next = 8;
|
|
3505
3921
|
break;
|
|
3506
3922
|
}
|
|
3507
3923
|
|
|
3508
|
-
return
|
|
3924
|
+
return _context17.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
|
|
3509
3925
|
|
|
3510
3926
|
case 8:
|
|
3511
|
-
return
|
|
3927
|
+
return _context17.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
3512
3928
|
|
|
3513
3929
|
case 9:
|
|
3514
3930
|
case "end":
|
|
3515
|
-
return
|
|
3931
|
+
return _context17.stop();
|
|
3516
3932
|
}
|
|
3517
3933
|
}
|
|
3518
|
-
},
|
|
3934
|
+
}, _callee17, this);
|
|
3519
3935
|
}));
|
|
3520
3936
|
|
|
3521
3937
|
function repay(_x6) {
|
|
@@ -3526,19 +3942,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3526
3942
|
}();
|
|
3527
3943
|
|
|
3528
3944
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
3529
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3530
|
-
return runtime_1.wrap(function
|
|
3945
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18() {
|
|
3946
|
+
return runtime_1.wrap(function _callee18$(_context18) {
|
|
3531
3947
|
while (1) {
|
|
3532
|
-
switch (
|
|
3948
|
+
switch (_context18.prev = _context18.next) {
|
|
3533
3949
|
case 0:
|
|
3534
|
-
return
|
|
3950
|
+
return _context18.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
3535
3951
|
|
|
3536
3952
|
case 1:
|
|
3537
3953
|
case "end":
|
|
3538
|
-
return
|
|
3954
|
+
return _context18.stop();
|
|
3539
3955
|
}
|
|
3540
3956
|
}
|
|
3541
|
-
},
|
|
3957
|
+
}, _callee18, this);
|
|
3542
3958
|
}));
|
|
3543
3959
|
|
|
3544
3960
|
function enableCollateral() {
|
|
@@ -3549,19 +3965,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3549
3965
|
}();
|
|
3550
3966
|
|
|
3551
3967
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
3552
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3553
|
-
return runtime_1.wrap(function
|
|
3968
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19() {
|
|
3969
|
+
return runtime_1.wrap(function _callee19$(_context19) {
|
|
3554
3970
|
while (1) {
|
|
3555
|
-
switch (
|
|
3971
|
+
switch (_context19.prev = _context19.next) {
|
|
3556
3972
|
case 0:
|
|
3557
|
-
return
|
|
3973
|
+
return _context19.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
3558
3974
|
|
|
3559
3975
|
case 1:
|
|
3560
3976
|
case "end":
|
|
3561
|
-
return
|
|
3977
|
+
return _context19.stop();
|
|
3562
3978
|
}
|
|
3563
3979
|
}
|
|
3564
|
-
},
|
|
3980
|
+
}, _callee19, this);
|
|
3565
3981
|
}));
|
|
3566
3982
|
|
|
3567
3983
|
function disableCollateral() {
|
|
@@ -3605,7 +4021,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3605
4021
|
var _this;
|
|
3606
4022
|
|
|
3607
4023
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
3608
|
-
_this.multicall = new ethers.Contract(networkAddresses.misc.MULTICALL, abis$
|
|
4024
|
+
_this.multicall = new ethers.Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
|
|
3609
4025
|
return _this;
|
|
3610
4026
|
}
|
|
3611
4027
|
/**
|
|
@@ -4177,7 +4593,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4177
4593
|
while (1) {
|
|
4178
4594
|
switch (_context3.prev = _context3.next) {
|
|
4179
4595
|
case 0:
|
|
4180
|
-
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, abis$
|
|
4596
|
+
lpContract = new ethers.Contract(networkAddresses.tokens.PLYWNEAR, abis$8.abi, this._networkConnection.provider);
|
|
4181
4597
|
_context3.next = 3;
|
|
4182
4598
|
return lpContract.balanceOf(user);
|
|
4183
4599
|
|
|
@@ -4657,9 +5073,9 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4657
5073
|
}
|
|
4658
5074
|
|
|
4659
5075
|
_1E18 = ethers.BigNumber.from(10).pow(18);
|
|
4660
|
-
oracle = this.env.getContract(networkAddresses.misc.oracle,
|
|
5076
|
+
oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
|
|
4661
5077
|
tokens = tokenAddresses.map(function (addr) {
|
|
4662
|
-
return _this3.env.getContract(addr, abis$
|
|
5078
|
+
return _this3.env.getContract(addr, abis$5.abi);
|
|
4663
5079
|
});
|
|
4664
5080
|
_context5.next = 6;
|
|
4665
5081
|
return oracle.getUnderlyingPrices(tokenAddresses);
|
|
@@ -6305,6 +6721,12 @@ exports.dummyTokenAmount2 = dummyTokenAmount2;
|
|
|
6305
6721
|
exports.dummyTokenAmount3 = dummyTokenAmount3;
|
|
6306
6722
|
exports.dummyUserMarketDetails = dummyUserMarketDetails;
|
|
6307
6723
|
exports.dummyZeroTokenAmount = dummyZeroTokenAmount;
|
|
6724
|
+
exports.fetchHistoricalLPPositions = fetchHistoricalLPPositions;
|
|
6725
|
+
exports.fetchHistoricalLPPrice = fetchHistoricalLPPrice;
|
|
6726
|
+
exports.fetchHistoricalPULPPrice = fetchHistoricalPULPPrice;
|
|
6727
|
+
exports.fetchHistoricalPrice = fetchHistoricalPrice;
|
|
6728
|
+
exports.fetchHistoricalPriceByLP = fetchHistoricalPriceByLP;
|
|
6729
|
+
exports.fetchHistoricalPriceFromOracle = fetchHistoricalPriceFromOracle;
|
|
6308
6730
|
exports.fetchLPPositions = fetchLPPositions;
|
|
6309
6731
|
exports.fetchLPPrice = fetchLPPrice;
|
|
6310
6732
|
exports.fetchPLYPrice = fetchPLYPrice;
|