@aurigami/sdk 1.12.6 → 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/interactors/Referral.d.ts +2 -1
- package/dist/sdk.cjs.development.js +608 -157
- 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 +620 -175
- 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
- package/src/interactors/Referral.ts +7 -2
package/dist/sdk.esm.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { BigNumber as BigNumber$1, utils, Contract, ethers } from 'ethers';
|
|
3
3
|
import { Logger } from 'ethers/lib/utils';
|
|
4
|
-
import abis$
|
|
5
|
-
import abis$
|
|
6
|
-
import abis$
|
|
7
|
-
import abis$
|
|
8
|
-
import abis$
|
|
9
|
-
import
|
|
10
|
-
import abis
|
|
11
|
-
import abis$
|
|
12
|
-
import abis$
|
|
13
|
-
import abis$
|
|
14
|
-
import abis$
|
|
4
|
+
import abis$7 from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
|
|
5
|
+
import abis$8 from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
|
|
6
|
+
import abis$1 from '@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json';
|
|
7
|
+
import abis$2 from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
|
|
8
|
+
import abis$3 from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
|
|
9
|
+
import AuriOracleABI from '@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json';
|
|
10
|
+
import abis from '@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json';
|
|
11
|
+
import abis$4 from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
|
|
12
|
+
import abis$9 from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
|
|
13
|
+
import abis$5 from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
|
|
14
|
+
import abis$c from '@aurigami/contracts/artifacts/contracts/mock/AuriInternalLens.sol/AuriInternalLens.json';
|
|
15
15
|
import IUniswapV2PairABI from '@aurigami/contracts/artifacts/contracts/mock/IUniswapV2Pair.sol/IUniswapV2Pair.json';
|
|
16
|
-
import abis$
|
|
17
|
-
import abis$
|
|
18
|
-
import abis$
|
|
19
|
-
import abis$
|
|
16
|
+
import abis$a from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
|
|
17
|
+
import abis$b from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
18
|
+
import abis$6 from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
|
|
19
|
+
import abis$d from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
|
|
20
20
|
import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
|
|
21
21
|
export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
|
|
22
22
|
export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_testnet.json';
|
|
@@ -27,22 +27,22 @@ import { Signer } from '@ethersproject/abstract-signer';
|
|
|
27
27
|
|
|
28
28
|
var index = {
|
|
29
29
|
__proto__: null,
|
|
30
|
-
AuriOracleABI:
|
|
31
|
-
AuTokenABI: abis
|
|
30
|
+
AuriOracleABI: AuriOracleABI,
|
|
31
|
+
AuTokenABI: abis,
|
|
32
32
|
IUniswapV2PairABI: IUniswapV2PairABI,
|
|
33
|
-
AuriAirdropABI: abis$
|
|
34
|
-
AuriFairLaunchABI: abis$
|
|
35
|
-
AuriLensABI: abis$
|
|
36
|
-
ComptrollerABI: abis$
|
|
37
|
-
EIP20InterfaceABI: abis$
|
|
38
|
-
ReferralDirectoryV2ABI: abis$
|
|
39
|
-
AuErc20ABI: abis$
|
|
40
|
-
AuETHABI: abis$
|
|
41
|
-
EthRepayHelperABI: abis$
|
|
42
|
-
Multicall2ABI: abis$
|
|
43
|
-
PulpABI: abis$
|
|
44
|
-
AuriInternalLensABI: abis$
|
|
45
|
-
PlyGameABI: abis$
|
|
33
|
+
AuriAirdropABI: abis$1,
|
|
34
|
+
AuriFairLaunchABI: abis$2,
|
|
35
|
+
AuriLensABI: abis$3,
|
|
36
|
+
ComptrollerABI: abis$4,
|
|
37
|
+
EIP20InterfaceABI: abis$5,
|
|
38
|
+
ReferralDirectoryV2ABI: abis$6,
|
|
39
|
+
AuErc20ABI: abis$7,
|
|
40
|
+
AuETHABI: abis$8,
|
|
41
|
+
EthRepayHelperABI: abis$9,
|
|
42
|
+
Multicall2ABI: abis$a,
|
|
43
|
+
PulpABI: abis$b,
|
|
44
|
+
AuriInternalLensABI: abis$c,
|
|
45
|
+
PlyGameABI: abis$d
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
|
|
@@ -124,7 +124,10 @@ var networkAddresses = {
|
|
|
124
124
|
META: /*#__PURE__*/'0xc21ff01229e982d7c8b8691163b0a3cb8f357453'.toLowerCase(),
|
|
125
125
|
PULP: /*#__PURE__*/MAINNET_ADDRESSES.PULP.toLowerCase(),
|
|
126
126
|
PLYWNEAR: /*#__PURE__*/MAINNET_ADDRESSES.ply_wnear_lp.toLowerCase(),
|
|
127
|
-
USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase()
|
|
127
|
+
USN: /*#__PURE__*/'0x5183e1b1091804bc2602586919e6880ac1cf2896'.toLowerCase(),
|
|
128
|
+
PLY_WNEAR: /*#__PURE__*/'0x044b6b0cd3bb13d2b9057781df4459c66781dce7'.toLowerCase(),
|
|
129
|
+
WNEAR_TRI: /*#__PURE__*/'0x84b123875f0f36b966d0b6ca14b31121bd9676ad'.toLowerCase(),
|
|
130
|
+
AURORA_WNEAR: /*#__PURE__*/'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase()
|
|
128
131
|
}
|
|
129
132
|
};
|
|
130
133
|
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
|
|
@@ -212,7 +215,9 @@ var decimalRecords = {
|
|
|
212
215
|
'0xc21ff01229e982d7c8b8691163b0a3cb8f357453': 24,
|
|
213
216
|
'0x04ac48711bcdc45b4d223fb021e09da73c71095e': 18,
|
|
214
217
|
'0x044b6b0cd3bb13d2b9057781df4459c66781dce7': 18,
|
|
215
|
-
'0x5183e1b1091804bc2602586919e6880ac1cf2896': 18
|
|
218
|
+
'0x5183e1b1091804bc2602586919e6880ac1cf2896': 18,
|
|
219
|
+
'0x84b123875f0f36b966d0b6ca14b31121bd9676ad': 18,
|
|
220
|
+
'0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008': 18
|
|
216
221
|
};
|
|
217
222
|
|
|
218
223
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -1588,7 +1593,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1588
1593
|
var _this2 = this;
|
|
1589
1594
|
|
|
1590
1595
|
return networkAddresses.auTokens.map(function (auToken) {
|
|
1591
|
-
var contract = _this2.getContract(auToken.address, abis
|
|
1596
|
+
var contract = _this2.getContract(auToken.address, abis.abi);
|
|
1592
1597
|
|
|
1593
1598
|
contract.underlying = auToken.underlying;
|
|
1594
1599
|
return contract;
|
|
@@ -1616,14 +1621,14 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1616
1621
|
assert(address !== undefined, "AuToken with underlying " + underlyingName + " not found");
|
|
1617
1622
|
}
|
|
1618
1623
|
|
|
1619
|
-
return this.getContract(address, abis$
|
|
1624
|
+
return this.getContract(address, abis$7.abi);
|
|
1620
1625
|
};
|
|
1621
1626
|
|
|
1622
1627
|
_createClass(AuriEnv, [{
|
|
1623
1628
|
key: "comptroller",
|
|
1624
1629
|
get: function get() {
|
|
1625
1630
|
if (!this._comptroller) {
|
|
1626
|
-
this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$
|
|
1631
|
+
this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$4.abi);
|
|
1627
1632
|
}
|
|
1628
1633
|
|
|
1629
1634
|
return this._comptroller;
|
|
@@ -1632,7 +1637,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1632
1637
|
key: "auriFairLaunch",
|
|
1633
1638
|
get: function get() {
|
|
1634
1639
|
if (!this._auriFairLaunch) {
|
|
1635
|
-
this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$
|
|
1640
|
+
this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$2.abi);
|
|
1636
1641
|
}
|
|
1637
1642
|
|
|
1638
1643
|
return this._auriFairLaunch;
|
|
@@ -1641,7 +1646,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1641
1646
|
key: "auriLens",
|
|
1642
1647
|
get: function get() {
|
|
1643
1648
|
if (!this._auriLens) {
|
|
1644
|
-
this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$
|
|
1649
|
+
this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$3.abi);
|
|
1645
1650
|
}
|
|
1646
1651
|
|
|
1647
1652
|
return this._auriLens;
|
|
@@ -1650,7 +1655,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1650
1655
|
key: "ply",
|
|
1651
1656
|
get: function get() {
|
|
1652
1657
|
if (!this._ply) {
|
|
1653
|
-
this._ply = this.getContract(networkAddresses.tokens.PLY, abis$
|
|
1658
|
+
this._ply = this.getContract(networkAddresses.tokens.PLY, abis$5.abi);
|
|
1654
1659
|
}
|
|
1655
1660
|
|
|
1656
1661
|
return this._ply;
|
|
@@ -1659,7 +1664,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1659
1664
|
key: "pulp",
|
|
1660
1665
|
get: function get() {
|
|
1661
1666
|
if (!this._pulp) {
|
|
1662
|
-
this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$
|
|
1667
|
+
this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$b.abi);
|
|
1663
1668
|
}
|
|
1664
1669
|
|
|
1665
1670
|
return this._pulp;
|
|
@@ -1668,7 +1673,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1668
1673
|
key: "auriInternalLens",
|
|
1669
1674
|
get: function get() {
|
|
1670
1675
|
if (!this._auriInternalLens) {
|
|
1671
|
-
this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$
|
|
1676
|
+
this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$c.abi);
|
|
1672
1677
|
}
|
|
1673
1678
|
|
|
1674
1679
|
return this._auriInternalLens;
|
|
@@ -1677,7 +1682,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1677
1682
|
key: "auriAirdrop",
|
|
1678
1683
|
get: function get() {
|
|
1679
1684
|
if (!this._auriAirdrop) {
|
|
1680
|
-
this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$
|
|
1685
|
+
this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$1.abi);
|
|
1681
1686
|
}
|
|
1682
1687
|
|
|
1683
1688
|
return this._auriAirdrop;
|
|
@@ -1686,7 +1691,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1686
1691
|
key: "referralDirectoryV2",
|
|
1687
1692
|
get: function get() {
|
|
1688
1693
|
if (!this._referralDirectoryV2) {
|
|
1689
|
-
this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$
|
|
1694
|
+
this._referralDirectoryV2 = this.getContract(networkAddresses.misc.REFERRAL_V2, abis$6.abi);
|
|
1690
1695
|
}
|
|
1691
1696
|
|
|
1692
1697
|
return this._referralDirectoryV2;
|
|
@@ -1695,7 +1700,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1695
1700
|
key: "oracle",
|
|
1696
1701
|
get: function get() {
|
|
1697
1702
|
if (!this._oracle) {
|
|
1698
|
-
this._oracle = this.getContract(networkAddresses.misc.oracle,
|
|
1703
|
+
this._oracle = this.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
|
|
1699
1704
|
}
|
|
1700
1705
|
|
|
1701
1706
|
return this._oracle;
|
|
@@ -1704,7 +1709,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1704
1709
|
key: "plygame",
|
|
1705
1710
|
get: function get() {
|
|
1706
1711
|
if (!this._plygame) {
|
|
1707
|
-
this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$
|
|
1712
|
+
this._plygame = this.getContract(networkAddresses.misc.PLYGAME, abis$d.abi);
|
|
1708
1713
|
}
|
|
1709
1714
|
|
|
1710
1715
|
return this._plygame;
|
|
@@ -2227,7 +2232,7 @@ function _fetchPriceFromOracle() {
|
|
|
2227
2232
|
while (1) {
|
|
2228
2233
|
switch (_context9.prev = _context9.next) {
|
|
2229
2234
|
case 0:
|
|
2230
|
-
oracleContract = new Contract(networkAddresses.misc.oracle,
|
|
2235
|
+
oracleContract = new Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
|
|
2231
2236
|
_context9.next = 3;
|
|
2232
2237
|
return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
|
|
2233
2238
|
console.log("Unable to fetch price from oracle for " + auTokenAddress);
|
|
@@ -2277,7 +2282,7 @@ function _fetchUnderlyingTokensPrices() {
|
|
|
2277
2282
|
while (1) {
|
|
2278
2283
|
switch (_context10.prev = _context10.next) {
|
|
2279
2284
|
case 0:
|
|
2280
|
-
auriLens = new Contract(networkAddresses.misc.AURILENS, abis$
|
|
2285
|
+
auriLens = new Contract(networkAddresses.misc.AURILENS, abis$3.abi, provider);
|
|
2281
2286
|
auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
|
|
2282
2287
|
return auToken.address;
|
|
2283
2288
|
});
|
|
@@ -2593,7 +2598,7 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2593
2598
|
var _this;
|
|
2594
2599
|
|
|
2595
2600
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
2596
|
-
_this.auToken = new Contract(tokenAddr, abis
|
|
2601
|
+
_this.auToken = new Contract(tokenAddr, abis.abi, _this._networkConnection.provider);
|
|
2597
2602
|
return _this;
|
|
2598
2603
|
}
|
|
2599
2604
|
/**
|
|
@@ -2687,6 +2692,351 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2687
2692
|
return TransferEventQuery;
|
|
2688
2693
|
}(BlockchainEntityRead);
|
|
2689
2694
|
|
|
2695
|
+
function fetchHistoricalLPPositions(_x, _x2, _x3) {
|
|
2696
|
+
return _fetchHistoricalLPPositions.apply(this, arguments);
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
function _fetchHistoricalLPPositions() {
|
|
2700
|
+
_fetchHistoricalLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(LPAddress, provider, block) {
|
|
2701
|
+
var LPContract, promises, values;
|
|
2702
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2703
|
+
while (1) {
|
|
2704
|
+
switch (_context.prev = _context.next) {
|
|
2705
|
+
case 0:
|
|
2706
|
+
LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
|
|
2707
|
+
promises = [];
|
|
2708
|
+
promises.push(LPContract.token0());
|
|
2709
|
+
promises.push(LPContract.token1());
|
|
2710
|
+
promises.push(LPContract.getReserves({
|
|
2711
|
+
blockTag: block
|
|
2712
|
+
}));
|
|
2713
|
+
promises.push(LPContract.totalSupply({
|
|
2714
|
+
blockTag: block
|
|
2715
|
+
}));
|
|
2716
|
+
_context.next = 8;
|
|
2717
|
+
return Promise.all(promises);
|
|
2718
|
+
|
|
2719
|
+
case 8:
|
|
2720
|
+
values = _context.sent;
|
|
2721
|
+
return _context.abrupt("return", {
|
|
2722
|
+
token0: values[0],
|
|
2723
|
+
token1: values[1],
|
|
2724
|
+
reserve0: values[2].reserve0,
|
|
2725
|
+
reserve1: values[2].reserve1,
|
|
2726
|
+
totalSupply: values[3]
|
|
2727
|
+
});
|
|
2728
|
+
|
|
2729
|
+
case 10:
|
|
2730
|
+
case "end":
|
|
2731
|
+
return _context.stop();
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
}, _callee);
|
|
2735
|
+
}));
|
|
2736
|
+
return _fetchHistoricalLPPositions.apply(this, arguments);
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
function fetchHistoricalLPPrice(_x4, _x5, _x6) {
|
|
2740
|
+
return _fetchHistoricalLPPrice.apply(this, arguments);
|
|
2741
|
+
}
|
|
2742
|
+
|
|
2743
|
+
function _fetchHistoricalLPPrice() {
|
|
2744
|
+
_fetchHistoricalLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(address, provider, block) {
|
|
2745
|
+
var LPInfo, LPDecimal, fetchLPPriceBy, _fetchLPPriceBy, lpPrice;
|
|
2746
|
+
|
|
2747
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2748
|
+
while (1) {
|
|
2749
|
+
switch (_context3.prev = _context3.next) {
|
|
2750
|
+
case 0:
|
|
2751
|
+
_fetchLPPriceBy = function _fetchLPPriceBy3() {
|
|
2752
|
+
_fetchLPPriceBy = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(tokenReverse, block) {
|
|
2753
|
+
var tokenPrice, tokenDecimal, reserveUSD;
|
|
2754
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2755
|
+
while (1) {
|
|
2756
|
+
switch (_context2.prev = _context2.next) {
|
|
2757
|
+
case 0:
|
|
2758
|
+
if (!tokenReverse.reserve.isZero()) {
|
|
2759
|
+
_context2.next = 2;
|
|
2760
|
+
break;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
return _context2.abrupt("return", new BigNumber(0));
|
|
2764
|
+
|
|
2765
|
+
case 2:
|
|
2766
|
+
_context2.next = 4;
|
|
2767
|
+
return fetchHistoricalPrice(tokenReverse.address, provider, block);
|
|
2768
|
+
|
|
2769
|
+
case 4:
|
|
2770
|
+
tokenPrice = _context2.sent;
|
|
2771
|
+
tokenDecimal = getDecimal(tokenReverse.address); // reserveUSD will be divided by 10^tokenDecimal later for more precision
|
|
2772
|
+
|
|
2773
|
+
reserveUSD = tokenPrice.multipliedBy(tokenReverse.reserve.toString()).multipliedBy(2);
|
|
2774
|
+
return _context2.abrupt("return", reserveUSD.multipliedBy(decimalFactor(LPDecimal)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())).dividedBy(decimalFactor(tokenDecimal)));
|
|
2775
|
+
|
|
2776
|
+
case 8:
|
|
2777
|
+
case "end":
|
|
2778
|
+
return _context2.stop();
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
}, _callee2);
|
|
2782
|
+
}));
|
|
2783
|
+
return _fetchLPPriceBy.apply(this, arguments);
|
|
2784
|
+
};
|
|
2785
|
+
|
|
2786
|
+
fetchLPPriceBy = function _fetchLPPriceBy2(_x19, _x20) {
|
|
2787
|
+
return _fetchLPPriceBy.apply(this, arguments);
|
|
2788
|
+
};
|
|
2789
|
+
|
|
2790
|
+
_context3.next = 4;
|
|
2791
|
+
return fetchHistoricalLPPositions(address, provider, block);
|
|
2792
|
+
|
|
2793
|
+
case 4:
|
|
2794
|
+
LPInfo = _context3.sent;
|
|
2795
|
+
LPDecimal = getDecimal(address);
|
|
2796
|
+
_context3.prev = 6;
|
|
2797
|
+
_context3.next = 9;
|
|
2798
|
+
return fetchLPPriceBy({
|
|
2799
|
+
address: LPInfo.token0,
|
|
2800
|
+
reserve: LPInfo.reserve0
|
|
2801
|
+
}, block);
|
|
2802
|
+
|
|
2803
|
+
case 9:
|
|
2804
|
+
lpPrice = _context3.sent;
|
|
2805
|
+
|
|
2806
|
+
if (!lpPrice.isZero()) {
|
|
2807
|
+
_context3.next = 12;
|
|
2808
|
+
break;
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
throw Error("Price is zero");
|
|
2812
|
+
|
|
2813
|
+
case 12:
|
|
2814
|
+
return _context3.abrupt("return", lpPrice);
|
|
2815
|
+
|
|
2816
|
+
case 15:
|
|
2817
|
+
_context3.prev = 15;
|
|
2818
|
+
_context3.t0 = _context3["catch"](6);
|
|
2819
|
+
devLog("fetchLPPriceBy " + LPInfo.token0 + " failed", _context3.t0);
|
|
2820
|
+
_context3.prev = 18;
|
|
2821
|
+
_context3.next = 21;
|
|
2822
|
+
return fetchLPPriceBy({
|
|
2823
|
+
address: LPInfo.token1,
|
|
2824
|
+
reserve: LPInfo.reserve1
|
|
2825
|
+
}, block);
|
|
2826
|
+
|
|
2827
|
+
case 21:
|
|
2828
|
+
return _context3.abrupt("return", _context3.sent);
|
|
2829
|
+
|
|
2830
|
+
case 24:
|
|
2831
|
+
_context3.prev = 24;
|
|
2832
|
+
_context3.t1 = _context3["catch"](18);
|
|
2833
|
+
devLog("fetchLPPriceBy " + LPInfo.token1 + " failed", _context3.t1);
|
|
2834
|
+
throw Error("Unable to fetch price for both tokens of LP " + address);
|
|
2835
|
+
|
|
2836
|
+
case 28:
|
|
2837
|
+
case "end":
|
|
2838
|
+
return _context3.stop();
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
}, _callee3, null, [[6, 15], [18, 24]]);
|
|
2842
|
+
}));
|
|
2843
|
+
return _fetchHistoricalLPPrice.apply(this, arguments);
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
function processPriceFromOracle$1(rawPrice, underlyingDecimal) {
|
|
2847
|
+
return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
function fetchHistoricalPriceFromOracle(_x7, _x8, _x9, _x10) {
|
|
2851
|
+
return _fetchHistoricalPriceFromOracle.apply(this, arguments);
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
function _fetchHistoricalPriceFromOracle() {
|
|
2855
|
+
_fetchHistoricalPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(auTokenAddress, underlyingDecimal, provider, block) {
|
|
2856
|
+
var oracleContract, rawPrice;
|
|
2857
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2858
|
+
while (1) {
|
|
2859
|
+
switch (_context4.prev = _context4.next) {
|
|
2860
|
+
case 0:
|
|
2861
|
+
oracleContract = new Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
|
|
2862
|
+
_context4.next = 3;
|
|
2863
|
+
return oracleContract.getUnderlyingPrice(auTokenAddress, {
|
|
2864
|
+
blockTag: block
|
|
2865
|
+
})["catch"](function (e) {
|
|
2866
|
+
console.log("Unable to fetch price from oracle for " + auTokenAddress);
|
|
2867
|
+
return BigNumber$1.from(0);
|
|
2868
|
+
});
|
|
2869
|
+
|
|
2870
|
+
case 3:
|
|
2871
|
+
rawPrice = _context4.sent;
|
|
2872
|
+
return _context4.abrupt("return", processPriceFromOracle$1(rawPrice, underlyingDecimal));
|
|
2873
|
+
|
|
2874
|
+
case 5:
|
|
2875
|
+
case "end":
|
|
2876
|
+
return _context4.stop();
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
}, _callee4);
|
|
2880
|
+
}));
|
|
2881
|
+
return _fetchHistoricalPriceFromOracle.apply(this, arguments);
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
function fetchHistoricalPrice(_x11, _x12, _x13) {
|
|
2885
|
+
return _fetchHistoricalPrice.apply(this, arguments);
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
function _fetchHistoricalPrice() {
|
|
2889
|
+
_fetchHistoricalPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(address, provider, block) {
|
|
2890
|
+
var matchingAuToken;
|
|
2891
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2892
|
+
while (1) {
|
|
2893
|
+
switch (_context5.prev = _context5.next) {
|
|
2894
|
+
case 0:
|
|
2895
|
+
if (!(address.toLowerCase() in HARDCODE_PRICE_TOKENS)) {
|
|
2896
|
+
_context5.next = 4;
|
|
2897
|
+
break;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
return _context5.abrupt("return", new BigNumber(HARDCODE_PRICE_TOKENS[address.toLowerCase()]));
|
|
2901
|
+
|
|
2902
|
+
case 4:
|
|
2903
|
+
if (!(isSameAddress(address, networkAddresses.tokens.PLY_WNEAR) || isSameAddress(address, networkAddresses.tokens.WNEAR_TRI) || isSameAddress(address, networkAddresses.tokens.AURORA_WNEAR))) {
|
|
2904
|
+
_context5.next = 8;
|
|
2905
|
+
break;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
return _context5.abrupt("return", fetchHistoricalLPPrice(address, provider, block));
|
|
2909
|
+
|
|
2910
|
+
case 8:
|
|
2911
|
+
if (!isSameAddress(address, networkAddresses.tokens.PLY)) {
|
|
2912
|
+
_context5.next = 12;
|
|
2913
|
+
break;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
return _context5.abrupt("return", fetchHistoricalPriceByLP(networkAddresses.tokens.PLY_WNEAR, provider, block));
|
|
2917
|
+
|
|
2918
|
+
case 12:
|
|
2919
|
+
if (!isSameAddress(address, networkAddresses.tokens.TRI)) {
|
|
2920
|
+
_context5.next = 16;
|
|
2921
|
+
break;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
return _context5.abrupt("return", fetchHistoricalPriceByLP(networkAddresses.tokens.WNEAR_TRI, provider, block, 1));
|
|
2925
|
+
|
|
2926
|
+
case 16:
|
|
2927
|
+
if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
|
|
2928
|
+
_context5.next = 18;
|
|
2929
|
+
break;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
return _context5.abrupt("return", fetchHistoricalPriceByLP(networkAddresses.tokens.AURORA_WNEAR, provider, block));
|
|
2933
|
+
|
|
2934
|
+
case 18:
|
|
2935
|
+
matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
|
|
2936
|
+
return isSameAddress(auToken.underlying, address);
|
|
2937
|
+
});
|
|
2938
|
+
|
|
2939
|
+
if (!(matchingAuToken !== undefined)) {
|
|
2940
|
+
_context5.next = 23;
|
|
2941
|
+
break;
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
return _context5.abrupt("return", fetchHistoricalPriceFromOracle(matchingAuToken.address, getDecimal(address), provider, block));
|
|
2945
|
+
|
|
2946
|
+
case 23:
|
|
2947
|
+
throw Error("Unable to fetch price for " + address);
|
|
2948
|
+
|
|
2949
|
+
case 24:
|
|
2950
|
+
case "end":
|
|
2951
|
+
return _context5.stop();
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
}, _callee5);
|
|
2955
|
+
}));
|
|
2956
|
+
return _fetchHistoricalPrice.apply(this, arguments);
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
function fetchHistoricalPULPPrice(_x14) {
|
|
2960
|
+
return _fetchHistoricalPULPPrice.apply(this, arguments);
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
function _fetchHistoricalPULPPrice() {
|
|
2964
|
+
_fetchHistoricalPULPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
|
|
2965
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2966
|
+
while (1) {
|
|
2967
|
+
switch (_context6.prev = _context6.next) {
|
|
2968
|
+
case 0:
|
|
2969
|
+
return _context6.abrupt("return", new BigNumber(0));
|
|
2970
|
+
|
|
2971
|
+
case 1:
|
|
2972
|
+
case "end":
|
|
2973
|
+
return _context6.stop();
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}, _callee6);
|
|
2977
|
+
}));
|
|
2978
|
+
return _fetchHistoricalPULPPrice.apply(this, arguments);
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
function fetchHistoricalPriceByLP(_x15, _x16, _x17, _x18) {
|
|
2982
|
+
return _fetchHistoricalPriceByLP.apply(this, arguments);
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
function _fetchHistoricalPriceByLP() {
|
|
2986
|
+
_fetchHistoricalPriceByLP = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(LP, provider, block, tokenNumber) {
|
|
2987
|
+
var LPInfo, token0Decimal, token1Decimal;
|
|
2988
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
2989
|
+
while (1) {
|
|
2990
|
+
switch (_context7.prev = _context7.next) {
|
|
2991
|
+
case 0:
|
|
2992
|
+
if (tokenNumber === void 0) {
|
|
2993
|
+
tokenNumber = 0;
|
|
2994
|
+
}
|
|
2995
|
+
|
|
2996
|
+
_context7.next = 3;
|
|
2997
|
+
return fetchHistoricalLPPositions(LP, provider, block);
|
|
2998
|
+
|
|
2999
|
+
case 3:
|
|
3000
|
+
LPInfo = _context7.sent;
|
|
3001
|
+
|
|
3002
|
+
if (tokenNumber === 1) {
|
|
3003
|
+
LPInfo = {
|
|
3004
|
+
token0: LPInfo.token1,
|
|
3005
|
+
token1: LPInfo.token0,
|
|
3006
|
+
reserve0: LPInfo.reserve1,
|
|
3007
|
+
reserve1: LPInfo.reserve0,
|
|
3008
|
+
totalSupply: LPInfo.totalSupply
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
if (!LPInfo.reserve1.isZero()) {
|
|
3013
|
+
_context7.next = 7;
|
|
3014
|
+
break;
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
return _context7.abrupt("return", new BigNumber(0));
|
|
3018
|
+
|
|
3019
|
+
case 7:
|
|
3020
|
+
token0Decimal = getDecimal(LPInfo.token0);
|
|
3021
|
+
token1Decimal = getDecimal(LPInfo.token1); // (token0Price * reserve0) / 10^decimal0 = (token1Price * reserve1) / 10^decimal1
|
|
3022
|
+
// token0Price = (token1Price * reserve1) * 10^decimal0 / 10^decimal1 / reserve0
|
|
3023
|
+
|
|
3024
|
+
_context7.next = 11;
|
|
3025
|
+
return fetchHistoricalPrice(LPInfo.token1, provider, block);
|
|
3026
|
+
|
|
3027
|
+
case 11:
|
|
3028
|
+
return _context7.abrupt("return", _context7.sent.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(decimalFactor(token0Decimal)).dividedBy(decimalFactor(token1Decimal)).dividedBy(LPInfo.reserve0.toString()));
|
|
3029
|
+
|
|
3030
|
+
case 12:
|
|
3031
|
+
case "end":
|
|
3032
|
+
return _context7.stop();
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
}, _callee7);
|
|
3036
|
+
}));
|
|
3037
|
+
return _fetchHistoricalPriceByLP.apply(this, arguments);
|
|
3038
|
+
}
|
|
3039
|
+
|
|
2690
3040
|
|
|
2691
3041
|
|
|
2692
3042
|
var helpers = {
|
|
@@ -2728,7 +3078,13 @@ var helpers = {
|
|
|
2728
3078
|
fetchValuation: fetchValuation,
|
|
2729
3079
|
calcValuation: calcValuation,
|
|
2730
3080
|
valuateToken: valuateToken,
|
|
2731
|
-
TransferEventQuery: TransferEventQuery
|
|
3081
|
+
TransferEventQuery: TransferEventQuery,
|
|
3082
|
+
fetchHistoricalLPPositions: fetchHistoricalLPPositions,
|
|
3083
|
+
fetchHistoricalLPPrice: fetchHistoricalLPPrice,
|
|
3084
|
+
fetchHistoricalPriceFromOracle: fetchHistoricalPriceFromOracle,
|
|
3085
|
+
fetchHistoricalPrice: fetchHistoricalPrice,
|
|
3086
|
+
fetchHistoricalPULPPrice: fetchHistoricalPULPPrice,
|
|
3087
|
+
fetchHistoricalPriceByLP: fetchHistoricalPriceByLP
|
|
2732
3088
|
};
|
|
2733
3089
|
|
|
2734
3090
|
var AirdropRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
@@ -2909,9 +3265,9 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
2909
3265
|
_this.env = new AuriEnv(networkConnection);
|
|
2910
3266
|
|
|
2911
3267
|
if (isSameAddress(underlyingAsset, ETHAddress)) {
|
|
2912
|
-
_this.auToken = new Contract(auToken, abis$9.abi, networkConnection.provider);
|
|
2913
|
-
} else {
|
|
2914
3268
|
_this.auToken = new Contract(auToken, abis$8.abi, networkConnection.provider);
|
|
3269
|
+
} else {
|
|
3270
|
+
_this.auToken = new Contract(auToken, abis$7.abi, networkConnection.provider);
|
|
2915
3271
|
}
|
|
2916
3272
|
|
|
2917
3273
|
_this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
|
|
@@ -3381,6 +3737,66 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3381
3737
|
}
|
|
3382
3738
|
};
|
|
3383
3739
|
|
|
3740
|
+
_proto.mintCap = /*#__PURE__*/function () {
|
|
3741
|
+
var _mintCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12() {
|
|
3742
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
3743
|
+
while (1) {
|
|
3744
|
+
switch (_context12.prev = _context12.next) {
|
|
3745
|
+
case 0:
|
|
3746
|
+
_context12.t0 = TokenAmount;
|
|
3747
|
+
_context12.t1 = this.underlying;
|
|
3748
|
+
_context12.next = 4;
|
|
3749
|
+
return this.env.comptroller.mintCaps(this.auToken.address);
|
|
3750
|
+
|
|
3751
|
+
case 4:
|
|
3752
|
+
_context12.t2 = _context12.sent.toString();
|
|
3753
|
+
return _context12.abrupt("return", new _context12.t0(_context12.t1, _context12.t2));
|
|
3754
|
+
|
|
3755
|
+
case 6:
|
|
3756
|
+
case "end":
|
|
3757
|
+
return _context12.stop();
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
}, _callee12, this);
|
|
3761
|
+
}));
|
|
3762
|
+
|
|
3763
|
+
function mintCap() {
|
|
3764
|
+
return _mintCap.apply(this, arguments);
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
return mintCap;
|
|
3768
|
+
}();
|
|
3769
|
+
|
|
3770
|
+
_proto.borrowCap = /*#__PURE__*/function () {
|
|
3771
|
+
var _borrowCap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
|
|
3772
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
3773
|
+
while (1) {
|
|
3774
|
+
switch (_context13.prev = _context13.next) {
|
|
3775
|
+
case 0:
|
|
3776
|
+
_context13.t0 = TokenAmount;
|
|
3777
|
+
_context13.t1 = this.underlying;
|
|
3778
|
+
_context13.next = 4;
|
|
3779
|
+
return this.env.comptroller.borrowCaps(this.auToken.address);
|
|
3780
|
+
|
|
3781
|
+
case 4:
|
|
3782
|
+
_context13.t2 = _context13.sent.toString();
|
|
3783
|
+
return _context13.abrupt("return", new _context13.t0(_context13.t1, _context13.t2));
|
|
3784
|
+
|
|
3785
|
+
case 6:
|
|
3786
|
+
case "end":
|
|
3787
|
+
return _context13.stop();
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
}, _callee13, this);
|
|
3791
|
+
}));
|
|
3792
|
+
|
|
3793
|
+
function borrowCap() {
|
|
3794
|
+
return _borrowCap.apply(this, arguments);
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
return borrowCap;
|
|
3798
|
+
}();
|
|
3799
|
+
|
|
3384
3800
|
return MoneyMarketRead;
|
|
3385
3801
|
}(BlockchainEntityRead);
|
|
3386
3802
|
var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
@@ -3390,36 +3806,36 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3390
3806
|
var _this3;
|
|
3391
3807
|
|
|
3392
3808
|
_this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
|
|
3393
|
-
_this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$
|
|
3809
|
+
_this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$9.abi, networkConnection.provider);
|
|
3394
3810
|
return _this3;
|
|
3395
3811
|
}
|
|
3396
3812
|
|
|
3397
3813
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
3398
3814
|
|
|
3399
3815
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
3400
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3401
|
-
return runtime_1.wrap(function
|
|
3816
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
|
|
3817
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
3402
3818
|
while (1) {
|
|
3403
|
-
switch (
|
|
3819
|
+
switch (_context14.prev = _context14.next) {
|
|
3404
3820
|
case 0:
|
|
3405
3821
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
3406
|
-
|
|
3822
|
+
_context14.next = 4;
|
|
3407
3823
|
break;
|
|
3408
3824
|
}
|
|
3409
3825
|
|
|
3410
|
-
return
|
|
3826
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
3411
3827
|
value: amount.rawAmount()
|
|
3412
3828
|
}));
|
|
3413
3829
|
|
|
3414
3830
|
case 4:
|
|
3415
|
-
return
|
|
3831
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
3416
3832
|
|
|
3417
3833
|
case 5:
|
|
3418
3834
|
case "end":
|
|
3419
|
-
return
|
|
3835
|
+
return _context14.stop();
|
|
3420
3836
|
}
|
|
3421
3837
|
}
|
|
3422
|
-
},
|
|
3838
|
+
}, _callee14, this);
|
|
3423
3839
|
}));
|
|
3424
3840
|
|
|
3425
3841
|
function deposit(_x3) {
|
|
@@ -3430,19 +3846,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3430
3846
|
}();
|
|
3431
3847
|
|
|
3432
3848
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
3433
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3434
|
-
return runtime_1.wrap(function
|
|
3849
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(amount) {
|
|
3850
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
3435
3851
|
while (1) {
|
|
3436
|
-
switch (
|
|
3852
|
+
switch (_context15.prev = _context15.next) {
|
|
3437
3853
|
case 0:
|
|
3438
|
-
return
|
|
3854
|
+
return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
3439
3855
|
|
|
3440
3856
|
case 1:
|
|
3441
3857
|
case "end":
|
|
3442
|
-
return
|
|
3858
|
+
return _context15.stop();
|
|
3443
3859
|
}
|
|
3444
3860
|
}
|
|
3445
|
-
},
|
|
3861
|
+
}, _callee15, this);
|
|
3446
3862
|
}));
|
|
3447
3863
|
|
|
3448
3864
|
function borrow(_x4) {
|
|
@@ -3453,27 +3869,27 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3453
3869
|
}();
|
|
3454
3870
|
|
|
3455
3871
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
3456
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3457
|
-
return runtime_1.wrap(function
|
|
3872
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16(amount) {
|
|
3873
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
3458
3874
|
while (1) {
|
|
3459
|
-
switch (
|
|
3875
|
+
switch (_context16.prev = _context16.next) {
|
|
3460
3876
|
case 0:
|
|
3461
3877
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
3462
|
-
|
|
3878
|
+
_context16.next = 2;
|
|
3463
3879
|
break;
|
|
3464
3880
|
}
|
|
3465
3881
|
|
|
3466
|
-
return
|
|
3882
|
+
return _context16.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(INF));
|
|
3467
3883
|
|
|
3468
3884
|
case 2:
|
|
3469
|
-
return
|
|
3885
|
+
return _context16.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
3470
3886
|
|
|
3471
3887
|
case 3:
|
|
3472
3888
|
case "end":
|
|
3473
|
-
return
|
|
3889
|
+
return _context16.stop();
|
|
3474
3890
|
}
|
|
3475
3891
|
}
|
|
3476
|
-
},
|
|
3892
|
+
}, _callee16, this);
|
|
3477
3893
|
}));
|
|
3478
3894
|
|
|
3479
3895
|
function withdraw(_x5) {
|
|
@@ -3484,37 +3900,37 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3484
3900
|
}();
|
|
3485
3901
|
|
|
3486
3902
|
_proto2.repay = /*#__PURE__*/function () {
|
|
3487
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3488
|
-
return runtime_1.wrap(function
|
|
3903
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17(amount) {
|
|
3904
|
+
return runtime_1.wrap(function _callee17$(_context17) {
|
|
3489
3905
|
while (1) {
|
|
3490
|
-
switch (
|
|
3906
|
+
switch (_context17.prev = _context17.next) {
|
|
3491
3907
|
case 0:
|
|
3492
3908
|
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
3493
|
-
|
|
3909
|
+
_context17.next = 4;
|
|
3494
3910
|
break;
|
|
3495
3911
|
}
|
|
3496
3912
|
|
|
3497
|
-
return
|
|
3913
|
+
return _context17.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
|
|
3498
3914
|
value: amount.rawAmount()
|
|
3499
3915
|
}));
|
|
3500
3916
|
|
|
3501
3917
|
case 4:
|
|
3502
3918
|
if (!new BigNumber(amount.rawAmount()).lt(0)) {
|
|
3503
|
-
|
|
3919
|
+
_context17.next = 8;
|
|
3504
3920
|
break;
|
|
3505
3921
|
}
|
|
3506
3922
|
|
|
3507
|
-
return
|
|
3923
|
+
return _context17.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
|
|
3508
3924
|
|
|
3509
3925
|
case 8:
|
|
3510
|
-
return
|
|
3926
|
+
return _context17.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
3511
3927
|
|
|
3512
3928
|
case 9:
|
|
3513
3929
|
case "end":
|
|
3514
|
-
return
|
|
3930
|
+
return _context17.stop();
|
|
3515
3931
|
}
|
|
3516
3932
|
}
|
|
3517
|
-
},
|
|
3933
|
+
}, _callee17, this);
|
|
3518
3934
|
}));
|
|
3519
3935
|
|
|
3520
3936
|
function repay(_x6) {
|
|
@@ -3525,19 +3941,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3525
3941
|
}();
|
|
3526
3942
|
|
|
3527
3943
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
3528
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3529
|
-
return runtime_1.wrap(function
|
|
3944
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee18() {
|
|
3945
|
+
return runtime_1.wrap(function _callee18$(_context18) {
|
|
3530
3946
|
while (1) {
|
|
3531
|
-
switch (
|
|
3947
|
+
switch (_context18.prev = _context18.next) {
|
|
3532
3948
|
case 0:
|
|
3533
|
-
return
|
|
3949
|
+
return _context18.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
3534
3950
|
|
|
3535
3951
|
case 1:
|
|
3536
3952
|
case "end":
|
|
3537
|
-
return
|
|
3953
|
+
return _context18.stop();
|
|
3538
3954
|
}
|
|
3539
3955
|
}
|
|
3540
|
-
},
|
|
3956
|
+
}, _callee18, this);
|
|
3541
3957
|
}));
|
|
3542
3958
|
|
|
3543
3959
|
function enableCollateral() {
|
|
@@ -3548,19 +3964,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
3548
3964
|
}();
|
|
3549
3965
|
|
|
3550
3966
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
3551
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
3552
|
-
return runtime_1.wrap(function
|
|
3967
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee19() {
|
|
3968
|
+
return runtime_1.wrap(function _callee19$(_context19) {
|
|
3553
3969
|
while (1) {
|
|
3554
|
-
switch (
|
|
3970
|
+
switch (_context19.prev = _context19.next) {
|
|
3555
3971
|
case 0:
|
|
3556
|
-
return
|
|
3972
|
+
return _context19.abrupt("return", this.env.comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
3557
3973
|
|
|
3558
3974
|
case 1:
|
|
3559
3975
|
case "end":
|
|
3560
|
-
return
|
|
3976
|
+
return _context19.stop();
|
|
3561
3977
|
}
|
|
3562
3978
|
}
|
|
3563
|
-
},
|
|
3979
|
+
}, _callee19, this);
|
|
3564
3980
|
}));
|
|
3565
3981
|
|
|
3566
3982
|
function disableCollateral() {
|
|
@@ -3604,7 +4020,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3604
4020
|
var _this;
|
|
3605
4021
|
|
|
3606
4022
|
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
3607
|
-
_this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$
|
|
4023
|
+
_this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
|
|
3608
4024
|
return _this;
|
|
3609
4025
|
}
|
|
3610
4026
|
/**
|
|
@@ -4176,7 +4592,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4176
4592
|
while (1) {
|
|
4177
4593
|
switch (_context3.prev = _context3.next) {
|
|
4178
4594
|
case 0:
|
|
4179
|
-
lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$
|
|
4595
|
+
lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$5.abi, this._networkConnection.provider);
|
|
4180
4596
|
_context3.next = 3;
|
|
4181
4597
|
return lpContract.balanceOf(user);
|
|
4182
4598
|
|
|
@@ -4656,9 +5072,9 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
4656
5072
|
}
|
|
4657
5073
|
|
|
4658
5074
|
_1E18 = BigNumber$1.from(10).pow(18);
|
|
4659
|
-
oracle = this.env.getContract(networkAddresses.misc.oracle,
|
|
5075
|
+
oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
|
|
4660
5076
|
tokens = tokenAddresses.map(function (addr) {
|
|
4661
|
-
return _this3.env.getContract(addr, abis
|
|
5077
|
+
return _this3.env.getContract(addr, abis.abi);
|
|
4662
5078
|
});
|
|
4663
5079
|
_context5.next = 6;
|
|
4664
5080
|
return oracle.getUnderlyingPrices(tokenAddresses);
|
|
@@ -5475,16 +5891,14 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5475
5891
|
_proto.slotsInUse =
|
|
5476
5892
|
/*#__PURE__*/
|
|
5477
5893
|
function () {
|
|
5478
|
-
var _slotsInUse = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(
|
|
5894
|
+
var _slotsInUse = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
5479
5895
|
var result;
|
|
5480
5896
|
return runtime_1.wrap(function _callee7$(_context7) {
|
|
5481
5897
|
while (1) {
|
|
5482
5898
|
switch (_context7.prev = _context7.next) {
|
|
5483
5899
|
case 0:
|
|
5484
5900
|
_context7.next = 2;
|
|
5485
|
-
return getApi('/referral/slotsInUse'
|
|
5486
|
-
referralCode: referralCode
|
|
5487
|
-
});
|
|
5901
|
+
return getApi('/referral/slotsInUse');
|
|
5488
5902
|
|
|
5489
5903
|
case 2:
|
|
5490
5904
|
result = _context7.sent;
|
|
@@ -5498,7 +5912,7 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5498
5912
|
}, _callee7);
|
|
5499
5913
|
}));
|
|
5500
5914
|
|
|
5501
|
-
function slotsInUse(
|
|
5915
|
+
function slotsInUse() {
|
|
5502
5916
|
return _slotsInUse.apply(this, arguments);
|
|
5503
5917
|
}
|
|
5504
5918
|
|
|
@@ -5507,7 +5921,38 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5507
5921
|
|
|
5508
5922
|
_proto.totalReferralSlots = function totalReferralSlots() {
|
|
5509
5923
|
return 500;
|
|
5510
|
-
}
|
|
5924
|
+
};
|
|
5925
|
+
|
|
5926
|
+
_proto.queuePosition = /*#__PURE__*/function () {
|
|
5927
|
+
var _queuePosition = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(address) {
|
|
5928
|
+
var result;
|
|
5929
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
5930
|
+
while (1) {
|
|
5931
|
+
switch (_context8.prev = _context8.next) {
|
|
5932
|
+
case 0:
|
|
5933
|
+
_context8.next = 2;
|
|
5934
|
+
return getApi('/referral/queuePosition', {
|
|
5935
|
+
address: address
|
|
5936
|
+
});
|
|
5937
|
+
|
|
5938
|
+
case 2:
|
|
5939
|
+
result = _context8.sent;
|
|
5940
|
+
return _context8.abrupt("return", result);
|
|
5941
|
+
|
|
5942
|
+
case 4:
|
|
5943
|
+
case "end":
|
|
5944
|
+
return _context8.stop();
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5947
|
+
}, _callee8);
|
|
5948
|
+
}));
|
|
5949
|
+
|
|
5950
|
+
function queuePosition(_x7) {
|
|
5951
|
+
return _queuePosition.apply(this, arguments);
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
return queuePosition;
|
|
5955
|
+
}()
|
|
5511
5956
|
/**
|
|
5512
5957
|
* a way to determine qualification status of a user. null if not referred yet,
|
|
5513
5958
|
* qualified if referred + min deposit, notQualified if referred + min deposit
|
|
@@ -5518,41 +5963,41 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5518
5963
|
_proto.userReferralStatus =
|
|
5519
5964
|
/*#__PURE__*/
|
|
5520
5965
|
function () {
|
|
5521
|
-
var _userReferralStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
5966
|
+
var _userReferralStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(userAddr) {
|
|
5522
5967
|
var result;
|
|
5523
|
-
return runtime_1.wrap(function
|
|
5968
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
5524
5969
|
while (1) {
|
|
5525
|
-
switch (
|
|
5970
|
+
switch (_context9.prev = _context9.next) {
|
|
5526
5971
|
case 0:
|
|
5527
|
-
|
|
5972
|
+
_context9.next = 2;
|
|
5528
5973
|
return getApi('/referral/referralStatus', {
|
|
5529
5974
|
address: userAddr
|
|
5530
5975
|
});
|
|
5531
5976
|
|
|
5532
5977
|
case 2:
|
|
5533
|
-
result =
|
|
5534
|
-
|
|
5535
|
-
|
|
5978
|
+
result = _context9.sent;
|
|
5979
|
+
_context9.t0 = result;
|
|
5980
|
+
_context9.next = _context9.t0 === -1 ? 6 : _context9.t0 === 0 ? 7 : _context9.t0 === 1 ? 8 : 9;
|
|
5536
5981
|
break;
|
|
5537
5982
|
|
|
5538
5983
|
case 6:
|
|
5539
|
-
return
|
|
5984
|
+
return _context9.abrupt("return", 'notReferred');
|
|
5540
5985
|
|
|
5541
5986
|
case 7:
|
|
5542
|
-
return
|
|
5987
|
+
return _context9.abrupt("return", 'notQualified');
|
|
5543
5988
|
|
|
5544
5989
|
case 8:
|
|
5545
|
-
return
|
|
5990
|
+
return _context9.abrupt("return", 'Qualified');
|
|
5546
5991
|
|
|
5547
5992
|
case 9:
|
|
5548
|
-
return
|
|
5993
|
+
return _context9.abrupt("return", 'Withdrawn');
|
|
5549
5994
|
|
|
5550
5995
|
case 10:
|
|
5551
5996
|
case "end":
|
|
5552
|
-
return
|
|
5997
|
+
return _context9.stop();
|
|
5553
5998
|
}
|
|
5554
5999
|
}
|
|
5555
|
-
},
|
|
6000
|
+
}, _callee9);
|
|
5556
6001
|
}));
|
|
5557
6002
|
|
|
5558
6003
|
function userReferralStatus(_x8) {
|
|
@@ -5563,25 +6008,25 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5563
6008
|
}();
|
|
5564
6009
|
|
|
5565
6010
|
_proto.isWhitelistedAddress = /*#__PURE__*/function () {
|
|
5566
|
-
var _isWhitelistedAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6011
|
+
var _isWhitelistedAddress = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(address) {
|
|
5567
6012
|
var result;
|
|
5568
|
-
return runtime_1.wrap(function
|
|
6013
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
5569
6014
|
while (1) {
|
|
5570
|
-
switch (
|
|
6015
|
+
switch (_context10.prev = _context10.next) {
|
|
5571
6016
|
case 0:
|
|
5572
|
-
|
|
6017
|
+
_context10.next = 2;
|
|
5573
6018
|
return this.env.referralDirectoryV2.isUserWhitelisted(address);
|
|
5574
6019
|
|
|
5575
6020
|
case 2:
|
|
5576
|
-
result =
|
|
5577
|
-
return
|
|
6021
|
+
result = _context10.sent;
|
|
6022
|
+
return _context10.abrupt("return", result.eq(1));
|
|
5578
6023
|
|
|
5579
6024
|
case 4:
|
|
5580
6025
|
case "end":
|
|
5581
|
-
return
|
|
6026
|
+
return _context10.stop();
|
|
5582
6027
|
}
|
|
5583
6028
|
}
|
|
5584
|
-
},
|
|
6029
|
+
}, _callee10, this);
|
|
5585
6030
|
}));
|
|
5586
6031
|
|
|
5587
6032
|
function isWhitelistedAddress(_x9) {
|
|
@@ -5592,25 +6037,25 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5592
6037
|
}();
|
|
5593
6038
|
|
|
5594
6039
|
_proto.isOnAuroraPlus = /*#__PURE__*/function () {
|
|
5595
|
-
var _isOnAuroraPlus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6040
|
+
var _isOnAuroraPlus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(address) {
|
|
5596
6041
|
var resp;
|
|
5597
|
-
return runtime_1.wrap(function
|
|
6042
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
5598
6043
|
while (1) {
|
|
5599
|
-
switch (
|
|
6044
|
+
switch (_context11.prev = _context11.next) {
|
|
5600
6045
|
case 0:
|
|
5601
|
-
|
|
6046
|
+
_context11.next = 2;
|
|
5602
6047
|
return axios.get(AURORA_PLUS_API_PREFIX + address);
|
|
5603
6048
|
|
|
5604
6049
|
case 2:
|
|
5605
|
-
resp =
|
|
5606
|
-
return
|
|
6050
|
+
resp = _context11.sent;
|
|
6051
|
+
return _context11.abrupt("return", resp.data.status == 'active');
|
|
5607
6052
|
|
|
5608
6053
|
case 4:
|
|
5609
6054
|
case "end":
|
|
5610
|
-
return
|
|
6055
|
+
return _context11.stop();
|
|
5611
6056
|
}
|
|
5612
6057
|
}
|
|
5613
|
-
},
|
|
6058
|
+
}, _callee11);
|
|
5614
6059
|
}));
|
|
5615
6060
|
|
|
5616
6061
|
function isOnAuroraPlus(_x10) {
|
|
@@ -5621,27 +6066,27 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5621
6066
|
}();
|
|
5622
6067
|
|
|
5623
6068
|
_proto.isNewUserAtReferralTime = /*#__PURE__*/function () {
|
|
5624
|
-
var _isNewUserAtReferralTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6069
|
+
var _isNewUserAtReferralTime = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(address) {
|
|
5625
6070
|
var result;
|
|
5626
|
-
return runtime_1.wrap(function
|
|
6071
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
5627
6072
|
while (1) {
|
|
5628
|
-
switch (
|
|
6073
|
+
switch (_context12.prev = _context12.next) {
|
|
5629
6074
|
case 0:
|
|
5630
|
-
|
|
6075
|
+
_context12.next = 2;
|
|
5631
6076
|
return getApi('/referral/isNewUser', {
|
|
5632
6077
|
address: address
|
|
5633
6078
|
});
|
|
5634
6079
|
|
|
5635
6080
|
case 2:
|
|
5636
|
-
result =
|
|
5637
|
-
return
|
|
6081
|
+
result = _context12.sent;
|
|
6082
|
+
return _context12.abrupt("return", result);
|
|
5638
6083
|
|
|
5639
6084
|
case 4:
|
|
5640
6085
|
case "end":
|
|
5641
|
-
return
|
|
6086
|
+
return _context12.stop();
|
|
5642
6087
|
}
|
|
5643
6088
|
}
|
|
5644
|
-
},
|
|
6089
|
+
}, _callee12);
|
|
5645
6090
|
}));
|
|
5646
6091
|
|
|
5647
6092
|
function isNewUserAtReferralTime(_x11) {
|
|
@@ -5652,27 +6097,27 @@ var ReferralRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
5652
6097
|
}();
|
|
5653
6098
|
|
|
5654
6099
|
_proto.depositedMoreThanMinimumAmount = /*#__PURE__*/function () {
|
|
5655
|
-
var _depositedMoreThanMinimumAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6100
|
+
var _depositedMoreThanMinimumAmount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(address) {
|
|
5656
6101
|
var result;
|
|
5657
|
-
return runtime_1.wrap(function
|
|
6102
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
5658
6103
|
while (1) {
|
|
5659
|
-
switch (
|
|
6104
|
+
switch (_context13.prev = _context13.next) {
|
|
5660
6105
|
case 0:
|
|
5661
|
-
|
|
6106
|
+
_context13.next = 2;
|
|
5662
6107
|
return getApi('/referral/depositedEnough', {
|
|
5663
6108
|
address: address
|
|
5664
6109
|
});
|
|
5665
6110
|
|
|
5666
6111
|
case 2:
|
|
5667
|
-
result =
|
|
5668
|
-
return
|
|
6112
|
+
result = _context13.sent;
|
|
6113
|
+
return _context13.abrupt("return", result);
|
|
5669
6114
|
|
|
5670
6115
|
case 4:
|
|
5671
6116
|
case "end":
|
|
5672
|
-
return
|
|
6117
|
+
return _context13.stop();
|
|
5673
6118
|
}
|
|
5674
6119
|
}
|
|
5675
|
-
},
|
|
6120
|
+
}, _callee13);
|
|
5676
6121
|
}));
|
|
5677
6122
|
|
|
5678
6123
|
function depositedMoreThanMinimumAmount(_x12) {
|
|
@@ -5701,21 +6146,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5701
6146
|
_proto2.registerNewReferralCode =
|
|
5702
6147
|
/*#__PURE__*/
|
|
5703
6148
|
function () {
|
|
5704
|
-
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6149
|
+
var _registerNewReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14() {
|
|
5705
6150
|
var referralCode;
|
|
5706
|
-
return runtime_1.wrap(function
|
|
6151
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
5707
6152
|
while (1) {
|
|
5708
|
-
switch (
|
|
6153
|
+
switch (_context14.prev = _context14.next) {
|
|
5709
6154
|
case 0:
|
|
5710
6155
|
referralCode = ethers.utils.formatBytes32String(this.generateReferralCode());
|
|
5711
|
-
return
|
|
6156
|
+
return _context14.abrupt("return", this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerNewUserReferralCode(referralCode));
|
|
5712
6157
|
|
|
5713
6158
|
case 2:
|
|
5714
6159
|
case "end":
|
|
5715
|
-
return
|
|
6160
|
+
return _context14.stop();
|
|
5716
6161
|
}
|
|
5717
6162
|
}
|
|
5718
|
-
},
|
|
6163
|
+
}, _callee14, this);
|
|
5719
6164
|
}));
|
|
5720
6165
|
|
|
5721
6166
|
function registerNewReferralCode() {
|
|
@@ -5732,21 +6177,21 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5732
6177
|
_proto2.useReferralCode =
|
|
5733
6178
|
/*#__PURE__*/
|
|
5734
6179
|
function () {
|
|
5735
|
-
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6180
|
+
var _useReferralCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(code) {
|
|
5736
6181
|
var referralCode;
|
|
5737
|
-
return runtime_1.wrap(function
|
|
6182
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
5738
6183
|
while (1) {
|
|
5739
|
-
switch (
|
|
6184
|
+
switch (_context15.prev = _context15.next) {
|
|
5740
6185
|
case 0:
|
|
5741
6186
|
referralCode = ethers.utils.formatBytes32String(code);
|
|
5742
|
-
return
|
|
6187
|
+
return _context15.abrupt("return", this.env.referralDirectoryV2.connect(this._networkConnection.signer).registerReferralCodeUsed(referralCode));
|
|
5743
6188
|
|
|
5744
6189
|
case 2:
|
|
5745
6190
|
case "end":
|
|
5746
|
-
return
|
|
6191
|
+
return _context15.stop();
|
|
5747
6192
|
}
|
|
5748
6193
|
}
|
|
5749
|
-
},
|
|
6194
|
+
}, _callee15, this);
|
|
5750
6195
|
}));
|
|
5751
6196
|
|
|
5752
6197
|
function useReferralCode(_x13) {
|
|
@@ -5763,23 +6208,23 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5763
6208
|
_proto2.claimReferralRewards =
|
|
5764
6209
|
/*#__PURE__*/
|
|
5765
6210
|
function () {
|
|
5766
|
-
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
6211
|
+
var _claimReferralRewards = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
|
|
5767
6212
|
var unclaimedRewards, campaigns, tokens;
|
|
5768
|
-
return runtime_1.wrap(function
|
|
6213
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
5769
6214
|
while (1) {
|
|
5770
|
-
switch (
|
|
6215
|
+
switch (_context16.prev = _context16.next) {
|
|
5771
6216
|
case 0:
|
|
5772
|
-
|
|
5773
|
-
|
|
6217
|
+
_context16.t0 = this;
|
|
6218
|
+
_context16.next = 3;
|
|
5774
6219
|
return this._networkConnection.signer.getAddress();
|
|
5775
6220
|
|
|
5776
6221
|
case 3:
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
return
|
|
6222
|
+
_context16.t1 = _context16.sent;
|
|
6223
|
+
_context16.next = 6;
|
|
6224
|
+
return _context16.t0.referralRewards.call(_context16.t0, _context16.t1);
|
|
5780
6225
|
|
|
5781
6226
|
case 6:
|
|
5782
|
-
unclaimedRewards =
|
|
6227
|
+
unclaimedRewards = _context16.sent.filter(function (reward) {
|
|
5783
6228
|
return reward.transactionHash == null;
|
|
5784
6229
|
});
|
|
5785
6230
|
campaigns = unclaimedRewards.map(function (reward) {
|
|
@@ -5788,14 +6233,14 @@ var ReferralReadWrite = /*#__PURE__*/function (_ReferralRead) {
|
|
|
5788
6233
|
tokens = unclaimedRewards.map(function (reward) {
|
|
5789
6234
|
return reward.rewardTokenAmount.token.address;
|
|
5790
6235
|
});
|
|
5791
|
-
return
|
|
6236
|
+
return _context16.abrupt("return", new AirdropReadWrite(this._networkConnection).redeemMultiple(campaigns, tokens));
|
|
5792
6237
|
|
|
5793
6238
|
case 10:
|
|
5794
6239
|
case "end":
|
|
5795
|
-
return
|
|
6240
|
+
return _context16.stop();
|
|
5796
6241
|
}
|
|
5797
6242
|
}
|
|
5798
|
-
},
|
|
6243
|
+
}, _callee16, this);
|
|
5799
6244
|
}));
|
|
5800
6245
|
|
|
5801
6246
|
function claimReferralRewards() {
|
|
@@ -6203,5 +6648,5 @@ BigNumber.config({
|
|
|
6203
6648
|
DECIMAL_PLACES: 50
|
|
6204
6649
|
});
|
|
6205
6650
|
|
|
6206
|
-
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlama, fetchPriceFromDefiLlamaAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
6651
|
+
export { AIRDROP_END_TIMESTAMP, AIRDROP_KEEP_THRESHOLD, AIRDROP_START_TIMESTAMP, ALL_STAKING_POOLS, AURORA_CHAINID, AURORA_PLUS_API_PREFIX, Airdrop, AirdropRead, AirdropReadWrite, AuriEnv, BORROW_LIMIT_BUFFER, BORROW_NEAR_REWARDS_PER_WEEK, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, DEPOSIT_NEAR_REWARDS_PER_WEEK, DEPOSIT_ONLY_TOKENS, ETHAddress, HARDCODE_PRICE_TOKENS, INF, MarketAction, MiscRead, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_WEEK, ONE_YEAR, PLYToken, PLYWNEARToken, PLYWNEAR_POOL_ID, PLYWNEAR_REWARD_TOKENS, PRICE_WHITELISTED, Papermill, PapermillRead, PapermillReadWrite, PlyGame, PlyGameRead, PlyGameReadWrite, REFERRAL_CAMPAIGNS, REWARD_CLAIM_START, Referral, ReferralRead, ReferralReadWrite, SDK, SdkRead, SdkReadWrite, Staking, StakingRead, StakingReadWrite, Token, TokenAmount, TransferEventQuery, index as abis, assert, calcLMRewardApr, calcValuation, decimalFactor, decimalRecords, devLog, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchHistoricalLPPositions, fetchHistoricalLPPrice, fetchHistoricalPULPPrice, fetchHistoricalPrice, fetchHistoricalPriceByLP, fetchHistoricalPriceFromOracle, fetchLPPositions, fetchLPPrice, fetchPLYPrice, fetchPULPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromDefiLlama, fetchPriceFromDefiLlamaAPI, fetchPriceFromOracle, fetchStNEARPrice, fetchToken0PriceByLP, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getApi, getBlockBeforeTimestamp, getBlockTimestamp, getBlocksTimestamp, getBlocksTimestampViaRPC, getCurrentTimestamp, getDecimal, getPaginatedApi, getQuery, getSymbol, getUnderlying, isSameAddress, networkAddresses, queryGraphQL, referralRewardDummy1, referralRewardDummy2, sleep, sortEvents, symbolRecords, validateAndParseAddress, valuateToken };
|
|
6207
6652
|
//# sourceMappingURL=sdk.esm.js.map
|