@aurigami/sdk 0.6.5 → 0.6.7

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
@@ -6,6 +6,7 @@ import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuEr
6
6
  import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
7
7
  import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
8
8
  import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
9
+ import EthRepayHelperABI from '@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json';
9
10
  import axios from 'axios';
10
11
  import TokenLockABI from '@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json';
11
12
  import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
@@ -916,38 +917,46 @@ var AURORA_CHAINID = 1313161554;
916
917
  var DECIMAL_PRECISION = 10;
917
918
  var networkAddresses = {
918
919
  auTokens: [{
919
- address: /*#__PURE__*/'0x1c7EB2ADdC2df2F28E9631cce970D2E2DF22429A'.toLowerCase(),
920
- underlying: /*#__PURE__*/'0x3dcB6AdF46E4d854E94719b6ed9cfab6939cC1Cb'.toLowerCase()
920
+ name: "auUSDC",
921
+ address: /*#__PURE__*/'0x7A9984522bC81B348d66379ed36Be5BD6147820E'.toLowerCase(),
922
+ underlying: /*#__PURE__*/'0xe1Db3E2f129539b2399d8Cd9e808305c85f0c82f'.toLowerCase()
921
923
  }, {
922
- address: /*#__PURE__*/'0xdaE860b77c26498e7Bd8e16Fb80AD572FaB9688f'.toLowerCase(),
924
+ name: "auETH",
925
+ address: /*#__PURE__*/'0x0e2E6069231928429F36dCA288466bC738e602b3'.toLowerCase(),
923
926
  underlying: /*#__PURE__*/ETHAddress.toLowerCase()
924
927
  }, {
925
- address: /*#__PURE__*/'0x5329f32A9dDaC3d274Cc670B284561b0086D2244'.toLowerCase(),
926
- underlying: /*#__PURE__*/'0x6fF98E346Ba4C56fBc3Ebc3f92477ffCe09D96AB'.toLowerCase()
928
+ name: "auWBTC",
929
+ address: /*#__PURE__*/'0x981bD5832EAB9C8F607940E0e9faCBf8C09ee20a'.toLowerCase(),
930
+ underlying: /*#__PURE__*/'0xA69506eAbdC11BBdAf2259882A02a91B66E6d7E1'.toLowerCase()
927
931
  }, {
928
- address: /*#__PURE__*/'0x57E15Bf9Bc4c8a7AFd3C8DBE153ED29eC90B68Fa'.toLowerCase(),
929
- underlying: /*#__PURE__*/'0x05b8777B6c280DB4E61CF0F63d59b4Ac8ec70538'.toLowerCase()
932
+ name: "auUSDT",
933
+ address: /*#__PURE__*/'0xDACC02a4Ff16Ea3c1515AdbfdCeb7B1F448B79c8'.toLowerCase(),
934
+ underlying: /*#__PURE__*/'0x4459ED2dEFFe0569AE748aD5D7cFEFDeeF667E87'.toLowerCase()
930
935
  }, {
931
- address: /*#__PURE__*/'0xdCdA4c7eF408961200193d7180357AEC404C267A'.toLowerCase(),
932
- underlying: /*#__PURE__*/'0xd94951E6B276fD4327FFBD3253b6307d112403e2'.toLowerCase()
936
+ name: "auDAI",
937
+ address: /*#__PURE__*/'0xC337343d1ac9F77B1305261CCD17e3799F088D4B'.toLowerCase(),
938
+ underlying: /*#__PURE__*/'0x1c9998C7768517b83136d3b237a31bc69eDc9028'.toLowerCase()
933
939
  }, {
934
- address: /*#__PURE__*/'0xa8474c18f502551937367120a6D8453dA785f1DD'.toLowerCase(),
935
- underlying: /*#__PURE__*/'0x84B5C41DC786316c5aA319B5A22CA77472e1d31f'.toLowerCase()
940
+ name: "auPLY",
941
+ address: /*#__PURE__*/'0x5e063B255e2437D75180117905499139a93f16E6'.toLowerCase(),
942
+ underlying: /*#__PURE__*/'0x3cD388c98FE71fE1a37272279F4b50bF27037E23'.toLowerCase()
936
943
  }, {
937
- address: /*#__PURE__*/'0x2Db190F0Db94E78B87D805e022D2a07803652211'.toLowerCase(),
938
- underlying: /*#__PURE__*/'0xb2cBCe33a6fb7D2efFb1cF73A654a4c0c9255874'.toLowerCase()
944
+ name: "auWNEAR",
945
+ address: /*#__PURE__*/'0x910fb0AE51761ccCDBbD9ced613e6A4dc571594a'.toLowerCase(),
946
+ underlying: /*#__PURE__*/'0x01B2EDff9b095DC270beca46E2eFB41a3ecEE169'.toLowerCase()
939
947
  }],
940
948
  misc: {
941
- COMPTROLLER: /*#__PURE__*/"0x1626d7941DF19781657a921014597c449F86941e".toLowerCase(),
942
- oracle: /*#__PURE__*/"0xe0E2Bb669a75Ae2384371cB4c4c95ff6fC1581b0".toLowerCase(),
943
- AURIFAIRLAUNCH: /*#__PURE__*/"0x4e91CdfeA23f44D4269E66494fe532867a0fAe5E".toLowerCase(),
944
- AURILENS: /*#__PURE__*/'0x680e15080Df9ff61131499D21aa5Ca9Bd05E60e0'.toLowerCase(),
945
- TOKENLOCK: /*#__PURE__*/'0xc77E562C41ec3Ce860b5424758B77ad0aDb1bB93'.toLowerCase(),
946
- FAUCET: /*#__PURE__*/'0x8F791d611D71699B76C03857A51D7B7E5E66f01E'.toLowerCase()
949
+ COMPTROLLER: /*#__PURE__*/"0x79e62AAfc1675c9F737Ec4Bb949115bfC8D2E2E6".toLowerCase(),
950
+ oracle: /*#__PURE__*/"0xAc99efFDF7a8934e35Ad13880D25127c548A7e6d".toLowerCase(),
951
+ AURIFAIRLAUNCH: /*#__PURE__*/"0xD204fD43bFe4aAEB9aB993c116c1dECdDF1b9F1A".toLowerCase(),
952
+ AURILENS: /*#__PURE__*/'0x0Aa7Ce0f5D6259412602A230C3Ed83eDc857bDa1'.toLowerCase(),
953
+ TOKENLOCK: /*#__PURE__*/'0x1b5c4c6A77f784104662B293a0166B27aF71d2c0'.toLowerCase(),
954
+ FAUCET: /*#__PURE__*/"0xe8b53eE0443620fB8DcEaEB6DE98ED117971c329".toLowerCase(),
955
+ ETHREPAYHELPER: /*#__PURE__*/"0x0b28E2F1767623f2D5Cd59165e79f83E3D63b71F".toLowerCase()
947
956
  },
948
957
  tokens: {
949
- AURORA: /*#__PURE__*/"0xd3F181B767cbb4e399ABbf4c2d42AEF19E177D30".toLowerCase(),
950
- PLY: /*#__PURE__*/"0x84B5C41DC786316c5aA319B5A22CA77472e1d31f".toLowerCase(),
958
+ AURORA: /*#__PURE__*/dummyAddress.toLowerCase(),
959
+ PLY: /*#__PURE__*/"0x3cD388c98FE71fE1a37272279F4b50bF27037E23".toLowerCase(),
951
960
  AURPLY: /*#__PURE__*/dummyAddress.toLowerCase()
952
961
  }
953
962
  };
@@ -960,20 +969,19 @@ var INF = /*#__PURE__*/BigNumber$1.from(2).pow(256).sub(1);
960
969
 
961
970
  var decimalRecords = {
962
971
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
963
- '0xa8474c18f502551937367120a6d8453da785f1dd': 8,
964
- '0x2db190f0db94e78b87d805e022d2a07803652211': 8,
965
- '0xdae860b77c26498e7bd8e16fb80ad572fab9688f': 8,
966
- '0x84b5c41dc786316c5aa319b5a22ca77472e1d31f': 18,
967
- '0xb2cbce33a6fb7d2effb1cf73a654a4c0c9255874': 24,
968
- '0x05b8777b6c280db4e61cf0f63d59b4ac8ec70538': 6,
969
- '0x6ff98e346ba4c56fbc3ebc3f92477ffce09d96ab': 8,
970
- '0x3dcb6adf46e4d854e94719b6ed9cfab6939cc1cb': 6,
971
- '0xd3f181b767cbb4e399abbf4c2d42aef19e177d30': 18,
972
- '0xdcda4c7ef408961200193d7180357aec404c267a': 8,
973
- '0x1c7eb2addc2df2f28e9631cce970d2e2df22429a': 8,
974
- '0x5329f32a9ddac3d274cc670b284561b0086d2244': 8,
975
- '0xd94951e6b276fd4327ffbd3253b6307d112403e2': 18,
976
- '0x57e15bf9bc4c8a7afd3c8dbe153ed29ec90b68fa': 8
972
+ '0xdacc02a4ff16ea3c1515adbfdceb7b1f448b79c8': 8,
973
+ '0x01b2edff9b095dc270beca46e2efb41a3ecee169': 24,
974
+ '0x4459ed2deffe0569ae748ad5d7cfefdeef667e87': 6,
975
+ '0x3cd388c98fe71fe1a37272279f4b50bf27037e23': 18,
976
+ '0x1c9998c7768517b83136d3b237a31bc69edc9028': 18,
977
+ '0x7a9984522bc81b348d66379ed36be5bd6147820e': 8,
978
+ '0x0e2e6069231928429f36dca288466bc738e602b3': 8,
979
+ '0x981bd5832eab9c8f607940e0e9facbf8c09ee20a': 8,
980
+ '0xa69506eabdc11bbdaf2259882a02a91b66e6d7e1': 8,
981
+ '0x910fb0ae51761cccdbbd9ced613e6a4dc571594a': 8,
982
+ '0xe1db3e2f129539b2399d8cd9e808305c85f0c82f': 6,
983
+ '0x5e063b255e2437d75180117905499139a93f16e6': 8,
984
+ '0xc337343d1ac9f77b1305261ccd17e3799f088d4b': 8
977
985
  };
978
986
 
979
987
  function formatObject(object) {
@@ -2264,7 +2272,7 @@ function _fetchPrice() {
2264
2272
  return _context7.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2265
2273
 
2266
2274
  case 7:
2267
- if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
2275
+ if (!isSameAddress(address, networkAddresses.tokens.AUPLYLP)) {
2268
2276
  _context7.next = 11;
2269
2277
  break;
2270
2278
  }
@@ -2635,24 +2643,8 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2635
2643
  return Promise.all(promises);
2636
2644
 
2637
2645
  case 11:
2638
- _context9.t0 = calcLMRewardApr;
2639
- _context9.next = 14;
2640
- return calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.toString()), plyPrice);
2641
-
2642
- case 14:
2643
- _context9.t1 = _context9.sent;
2644
- _context9.t2 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
2645
- _context9.t3 = ONE_YEAR;
2646
- borrowPlyApy = (0, _context9.t0)(_context9.t1, _context9.t2, _context9.t3);
2647
- _context9.t4 = calcLMRewardApr;
2648
- _context9.next = 21;
2649
- return calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.toString()), plyPrice);
2650
-
2651
- case 21:
2652
- _context9.t5 = _context9.sent;
2653
- _context9.t6 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
2654
- _context9.t7 = ONE_YEAR;
2655
- depositPlyApy = (0, _context9.t4)(_context9.t5, _context9.t6, _context9.t7);
2646
+ borrowPlyApy = calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
2647
+ depositPlyApy = calcLMRewardApr(calcValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.toString()), plyPrice), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
2656
2648
  return _context9.abrupt("return", {
2657
2649
  auTokenAddress: this.auToken.address,
2658
2650
  totalTokenDeposited: totalDeposited,
@@ -2664,7 +2656,7 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2664
2656
  collateralRatio: collateralRatio
2665
2657
  });
2666
2658
 
2667
- case 26:
2659
+ case 14:
2668
2660
  case "end":
2669
2661
  return _context9.stop();
2670
2662
  }
@@ -2742,8 +2734,12 @@ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2742
2734
  var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2743
2735
  _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
2744
2736
 
2745
- function MoneyMarketReadWrite() {
2746
- return _MoneyMarketRead.apply(this, arguments) || this;
2737
+ function MoneyMarketReadWrite(networkConnection, auToken, underlyingAsset) {
2738
+ var _this3;
2739
+
2740
+ _this3 = _MoneyMarketRead.call(this, networkConnection, auToken, underlyingAsset) || this;
2741
+ _this3._EthRepayHelper = new Contract(networkAddresses.misc.ETHREPAYHELPER, EthRepayHelperABI.abi, networkConnection.provider);
2742
+ return _this3;
2747
2743
  }
2748
2744
 
2749
2745
  var _proto2 = MoneyMarketReadWrite.prototype;
@@ -2837,61 +2833,31 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2837
2833
 
2838
2834
  _proto2.repay = /*#__PURE__*/function () {
2839
2835
  var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(amount) {
2840
- var repayAmount;
2841
2836
  return runtime_1.wrap(function _callee15$(_context15) {
2842
2837
  while (1) {
2843
2838
  switch (_context15.prev = _context15.next) {
2844
2839
  case 0:
2845
- if (!new BigNumber(amount.rawAmount()).lt(0)) {
2846
- _context15.next = 16;
2847
- break;
2848
- }
2849
-
2850
2840
  if (!isSameAddress(amount.token.address, ETHAddress)) {
2851
- _context15.next = 13;
2841
+ _context15.next = 4;
2852
2842
  break;
2853
2843
  }
2854
2844
 
2855
- _context15.t0 = BigNumber$1;
2856
- _context15.t1 = this;
2857
- _context15.next = 6;
2858
- return this._networkConnection.signer.getAddress();
2859
-
2860
- case 6:
2861
- _context15.t2 = _context15.sent;
2862
- _context15.next = 9;
2863
- return _context15.t1.getUserBorrowBalance.call(_context15.t1, _context15.t2);
2864
-
2865
- case 9:
2866
- _context15.t3 = _context15.sent.rawAmount();
2867
- repayAmount = _context15.t0.from.call(_context15.t0, _context15.t3);
2868
- _context15.next = 14;
2869
- break;
2870
-
2871
- case 13:
2872
- repayAmount = INF;
2873
-
2874
- case 14:
2875
- _context15.next = 17;
2876
- break;
2877
-
2878
- case 16:
2879
- repayAmount = BigNumber$1.from(amount.rawAmount());
2845
+ return _context15.abrupt("return", this._EthRepayHelper.connect(this._networkConnection.signer).repayBorrow({
2846
+ value: amount.rawAmount()
2847
+ }));
2880
2848
 
2881
- case 17:
2882
- if (!isSameAddress(amount.token.address, ETHAddress)) {
2883
- _context15.next = 21;
2849
+ case 4:
2850
+ if (!new BigNumber(amount.rawAmount()).lt(0)) {
2851
+ _context15.next = 8;
2884
2852
  break;
2885
2853
  }
2886
2854
 
2887
- return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
2888
- value: repayAmount
2889
- }));
2855
+ return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(INF));
2890
2856
 
2891
- case 21:
2892
- return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(repayAmount));
2857
+ case 8:
2858
+ return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
2893
2859
 
2894
- case 22:
2860
+ case 9:
2895
2861
  case "end":
2896
2862
  return _context15.stop();
2897
2863
  }
@@ -2958,12 +2924,12 @@ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
2958
2924
  _inheritsLoose(MoneyMarket, _BlockchainEntity);
2959
2925
 
2960
2926
  function MoneyMarket(address, underlying) {
2961
- var _this3;
2927
+ var _this4;
2962
2928
 
2963
- _this3 = _BlockchainEntity.call(this) || this;
2964
- _this3.address = validateAndParseAddress(address);
2965
- _this3.underlying = validateAndParseAddress(underlying);
2966
- return _this3;
2929
+ _this4 = _BlockchainEntity.call(this) || this;
2930
+ _this4.address = validateAndParseAddress(address);
2931
+ _this4.underlying = validateAndParseAddress(underlying);
2932
+ return _this4;
2967
2933
  }
2968
2934
 
2969
2935
  var _proto3 = MoneyMarket.prototype;
@@ -2972,6 +2938,10 @@ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
2972
2938
  return new MoneyMarketRead(networkConnection, this.address, this.underlying);
2973
2939
  };
2974
2940
 
2941
+ _proto3.readWrite = function readWrite(networkConnection) {
2942
+ return new MoneyMarketReadWrite(networkConnection, this.address, this.underlying);
2943
+ };
2944
+
2975
2945
  return MoneyMarket;
2976
2946
  }(BlockchainEntity);
2977
2947
 
@@ -3373,7 +3343,7 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
3373
3343
  while (1) {
3374
3344
  switch (_context7.prev = _context7.next) {
3375
3345
  case 0:
3376
- return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(AurPlyPid, amount.rawAmount(), false));
3346
+ return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(AurPlyPid, amount.rawAmount()));
3377
3347
 
3378
3348
  case 1:
3379
3349
  case "end":