@aurigami/sdk 1.9.4 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.esm.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { BigNumber as BigNumber$1, Contract, utils, ethers } from 'ethers';
3
3
  import { Logger } from 'ethers/lib/utils';
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';
4
+ import abis$8 from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
+ import abis$9 from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
6
+ import abis$2 from '@aurigami/contracts/artifacts/contracts/AuriAirdrop.sol/AuriAirdrop.json';
7
+ import abis$3 from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
8
+ import abis$4 from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
9
+ import abis from '@aurigami/contracts/artifacts/contracts/AuriOracle.sol/AuriOracle.json';
10
+ import abis$1 from '@aurigami/contracts/artifacts/contracts/AuToken.sol/AuToken.json';
11
+ import abis$5 from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
12
+ import abis$a from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
13
+ import abis$6 from '@aurigami/contracts/artifacts/contracts/interfaces/EIP20Interface.sol/EIP20Interface.json';
14
+ import abis$d 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$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/ReferralDirectory.sol/ReferralDirectory.json';
16
+ import abis$b from '@aurigami/contracts/artifacts/contracts/mock/Multicall2.sol/Multicall2.json';
17
+ import abis$c from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
18
+ import abis$7 from '@aurigami/contracts/artifacts/contracts/ReferralDirectory.sol/ReferralDirectory.json';
19
19
  import MAINNET_ADDRESSES from '@aurigami/contracts/deployments/aurora_mainnet.json';
20
20
  export { default as MAINNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_mainnet.json';
21
21
  export { default as TESTNET_ADDRESSES } from '@aurigami/contracts/deployments/aurora_testnet.json';
@@ -26,21 +26,21 @@ import axios from 'axios';
26
26
 
27
27
  var index = {
28
28
  __proto__: null,
29
- AuriOracleABI: AuriOracleABI,
30
- AuTokenABI: abis,
29
+ AuriOracleABI: abis,
30
+ AuTokenABI: abis$1,
31
31
  IUniswapV2PairABI: IUniswapV2PairABI,
32
- AuriAirdropABI: abis$1,
33
- AuriFairLaunchABI: abis$2,
34
- AuriLensABI: abis$3,
35
- ComptrollerABI: abis$4,
36
- EIP20InterfaceABI: abis$5,
37
- ReferralDirectoryABI: abis$6,
38
- AuErc20ABI: abis$7,
39
- AuETHABI: abis$8,
40
- EthRepayHelperABI: abis$9,
41
- Multicall2ABI: abis$a,
42
- PulpABI: abis$b,
43
- AuriInternalLensABI: abis$c
32
+ AuriAirdropABI: abis$2,
33
+ AuriFairLaunchABI: abis$3,
34
+ AuriLensABI: abis$4,
35
+ ComptrollerABI: abis$5,
36
+ EIP20InterfaceABI: abis$6,
37
+ ReferralDirectoryABI: abis$7,
38
+ AuErc20ABI: abis$8,
39
+ AuETHABI: abis$9,
40
+ EthRepayHelperABI: abis$a,
41
+ Multicall2ABI: abis$b,
42
+ PulpABI: abis$c,
43
+ AuriInternalLensABI: abis$d
44
44
  };
45
45
 
46
46
  var dummyAddress = '0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE';
@@ -384,6 +384,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
384
384
  _this._auriInternalLens = null;
385
385
  _this._auriAirdrop = null;
386
386
  _this._referralDirectory = null;
387
+ _this._oracle = null;
387
388
  return _this;
388
389
  }
389
390
 
@@ -397,7 +398,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
397
398
  var _this2 = this;
398
399
 
399
400
  return networkAddresses.auTokens.map(function (auToken) {
400
- var contract = _this2.getContract(auToken.address, abis.abi);
401
+ var contract = _this2.getContract(auToken.address, abis$1.abi);
401
402
 
402
403
  contract.underlying = auToken.underlying;
403
404
  return contract;
@@ -408,7 +409,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
408
409
  key: "comptroller",
409
410
  get: function get() {
410
411
  if (!this._comptroller) {
411
- this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$4.abi);
412
+ this._comptroller = this.getContract(networkAddresses.misc.COMPTROLLER, abis$5.abi);
412
413
  }
413
414
 
414
415
  return this._comptroller;
@@ -417,7 +418,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
417
418
  key: "auriFairLaunch",
418
419
  get: function get() {
419
420
  if (!this._auriFairLaunch) {
420
- this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$2.abi);
421
+ this._auriFairLaunch = this.getContract(networkAddresses.misc.AURIFAIRLAUNCH, abis$3.abi);
421
422
  }
422
423
 
423
424
  return this._auriFairLaunch;
@@ -426,7 +427,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
426
427
  key: "auriLens",
427
428
  get: function get() {
428
429
  if (!this._auriLens) {
429
- this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$3.abi);
430
+ this._auriLens = this.getContract(networkAddresses.misc.AURILENS, abis$4.abi);
430
431
  }
431
432
 
432
433
  return this._auriLens;
@@ -435,7 +436,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
435
436
  key: "ply",
436
437
  get: function get() {
437
438
  if (!this._ply) {
438
- this._ply = this.getContract(networkAddresses.tokens.PLY, abis$5.abi);
439
+ this._ply = this.getContract(networkAddresses.tokens.PLY, abis$6.abi);
439
440
  }
440
441
 
441
442
  return this._ply;
@@ -444,7 +445,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
444
445
  key: "pulp",
445
446
  get: function get() {
446
447
  if (!this._pulp) {
447
- this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$b.abi);
448
+ this._pulp = this.getContract(networkAddresses.tokens.PULP, abis$c.abi);
448
449
  }
449
450
 
450
451
  return this._pulp;
@@ -453,7 +454,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
453
454
  key: "auriInternalLens",
454
455
  get: function get() {
455
456
  if (!this._auriInternalLens) {
456
- this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$c.abi);
457
+ this._auriInternalLens = this.getContract(networkAddresses.misc.AURI_INTERNAL_LENS, abis$d.abi);
457
458
  }
458
459
 
459
460
  return this._auriInternalLens;
@@ -462,7 +463,7 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
462
463
  key: "auriAirdrop",
463
464
  get: function get() {
464
465
  if (!this._auriAirdrop) {
465
- this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$1.abi);
466
+ this._auriAirdrop = this.getContract(networkAddresses.misc.AURI_AIRDROP, abis$2.abi);
466
467
  }
467
468
 
468
469
  return this._auriAirdrop;
@@ -471,11 +472,20 @@ var AuriEnv = /*#__PURE__*/function (_BlockchainEntityRead) {
471
472
  key: "referralDirectory",
472
473
  get: function get() {
473
474
  if (!this._referralDirectory) {
474
- this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$6.abi);
475
+ this._referralDirectory = this.getContract(networkAddresses.misc.REFERRAL, abis$7.abi);
475
476
  }
476
477
 
477
478
  return this._referralDirectory;
478
479
  }
480
+ }, {
481
+ key: "oracle",
482
+ get: function get() {
483
+ if (!this._oracle) {
484
+ this._oracle = this.getContract(networkAddresses.misc.PRICE_ORACLE, abis.abi);
485
+ }
486
+
487
+ return this._oracle;
488
+ }
479
489
  }]);
480
490
 
481
491
  return AuriEnv;
@@ -2066,7 +2076,7 @@ function _fetchPriceFromOracle() {
2066
2076
  while (1) {
2067
2077
  switch (_context7.prev = _context7.next) {
2068
2078
  case 0:
2069
- oracleContract = new Contract(networkAddresses.misc.oracle, AuriOracleABI.abi, provider);
2079
+ oracleContract = new Contract(networkAddresses.misc.oracle, abis.abi, provider);
2070
2080
  _context7.next = 3;
2071
2081
  return oracleContract.getUnderlyingPrice(auTokenAddress)["catch"](function (e) {
2072
2082
  console.log("Unable to fetch price from oracle for " + auTokenAddress);
@@ -2116,7 +2126,7 @@ function _fetchUnderlyingTokensPrices() {
2116
2126
  while (1) {
2117
2127
  switch (_context8.prev = _context8.next) {
2118
2128
  case 0:
2119
- auriLens = new Contract(networkAddresses.misc.AURILENS, abis$3.abi, provider);
2129
+ auriLens = new Contract(networkAddresses.misc.AURILENS, abis$4.abi, provider);
2120
2130
  auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
2121
2131
  return auToken.address;
2122
2132
  });
@@ -2422,7 +2432,7 @@ var TransferEventQuery = /*#__PURE__*/function (_BlockchainEntityRead) {
2422
2432
  var _this;
2423
2433
 
2424
2434
  _this = _BlockchainEntityRead.call(this, networkConnection) || this;
2425
- _this.auToken = new Contract(tokenAddr, abis.abi, _this._networkConnection.provider);
2435
+ _this.auToken = new Contract(tokenAddr, abis$1.abi, _this._networkConnection.provider);
2426
2436
  return _this;
2427
2437
  }
2428
2438
  /**
@@ -2734,9 +2744,9 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2734
2744
  _this.env = new AuriEnv(networkConnection);
2735
2745
 
2736
2746
  if (isSameAddress(underlyingAsset, ETHAddress)) {
2737
- _this.auToken = new Contract(auToken, abis$8.abi, networkConnection.provider);
2747
+ _this.auToken = new Contract(auToken, abis$9.abi, networkConnection.provider);
2738
2748
  } else {
2739
- _this.auToken = new Contract(auToken, abis$7.abi, networkConnection.provider);
2749
+ _this.auToken = new Contract(auToken, abis$8.abi, networkConnection.provider);
2740
2750
  }
2741
2751
 
2742
2752
  _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
@@ -2843,7 +2853,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2843
2853
 
2844
2854
  _proto.getDepositAPY = /*#__PURE__*/function () {
2845
2855
  var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2846
- var supplyRatePerTimestamp;
2856
+ var supplyRatePerTimestamp, supplyRatePerDay;
2847
2857
  return runtime_1.wrap(function _callee4$(_context4) {
2848
2858
  while (1) {
2849
2859
  switch (_context4.prev = _context4.next) {
@@ -2853,9 +2863,10 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2853
2863
 
2854
2864
  case 2:
2855
2865
  supplyRatePerTimestamp = _context4.sent;
2856
- return _context4.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
2866
+ supplyRatePerDay = new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(ONE_DAY).div(decimalFactor(18));
2867
+ return _context4.abrupt("return", new BigNumber(supplyRatePerDay.plus(1)).pow(365).minus(1));
2857
2868
 
2858
- case 4:
2869
+ case 5:
2859
2870
  case "end":
2860
2871
  return _context4.stop();
2861
2872
  }
@@ -2872,7 +2883,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2872
2883
 
2873
2884
  _proto.getBorrowAPY = /*#__PURE__*/function () {
2874
2885
  var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2875
- var borrowRatePerTimestamp;
2886
+ var borrowRatePerTimestamp, borrowRatePerDay;
2876
2887
  return runtime_1.wrap(function _callee5$(_context5) {
2877
2888
  while (1) {
2878
2889
  switch (_context5.prev = _context5.next) {
@@ -2882,9 +2893,10 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2882
2893
 
2883
2894
  case 2:
2884
2895
  borrowRatePerTimestamp = _context5.sent;
2885
- return _context5.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
2896
+ borrowRatePerDay = new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(ONE_DAY).div(decimalFactor(18));
2897
+ return _context5.abrupt("return", new BigNumber(borrowRatePerDay.plus(1)).pow(365).minus(1));
2886
2898
 
2887
- case 4:
2899
+ case 5:
2888
2900
  case "end":
2889
2901
  return _context5.stop();
2890
2902
  }
@@ -3213,7 +3225,7 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
3213
3225
  var _this3;
3214
3226
 
3215
3227
  _this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
3216
- _this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$9.abi, networkConnection.provider);
3228
+ _this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, abis$a.abi, networkConnection.provider);
3217
3229
  return _this3;
3218
3230
  }
3219
3231
 
@@ -3427,7 +3439,7 @@ var MulticallRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3427
3439
  var _this;
3428
3440
 
3429
3441
  _this = _BlockchainEntityRead.call(this, networkConnection) || this;
3430
- _this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$a.abi, networkConnection.provider);
3442
+ _this.multicall = new Contract(networkAddresses.misc.MULTICALL, abis$b.abi, networkConnection.provider);
3431
3443
  return _this;
3432
3444
  }
3433
3445
  /**
@@ -3999,7 +4011,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3999
4011
  while (1) {
4000
4012
  switch (_context3.prev = _context3.next) {
4001
4013
  case 0:
4002
- lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$5.abi, this._networkConnection.provider);
4014
+ lpContract = new Contract(networkAddresses.tokens.PLYWNEAR, abis$6.abi, this._networkConnection.provider);
4003
4015
  _context3.next = 3;
4004
4016
  return lpContract.balanceOf(user);
4005
4017
 
@@ -4479,9 +4491,9 @@ var MiscRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4479
4491
  }
4480
4492
 
4481
4493
  _1E18 = BigNumber$1.from(10).pow(18);
4482
- oracle = this.env.getContract(networkAddresses.misc.oracle, AuriOracleABI.abi);
4494
+ oracle = this.env.getContract(networkAddresses.misc.oracle, abis.abi);
4483
4495
  tokens = tokenAddresses.map(function (addr) {
4484
- return _this3.env.getContract(addr, abis.abi);
4496
+ return _this3.env.getContract(addr, abis$1.abi);
4485
4497
  });
4486
4498
  _context5.next = 6;
4487
4499
  return oracle.getUnderlyingPrices(tokenAddresses);