@aurigami/sdk 0.1.5 → 0.2.2

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,5 +1,11 @@
1
- import BigNumber$1 from 'bignumber.js';
2
- import { BigNumber, utils, Contract } from 'ethers';
1
+ import { Signer } from '@ethersproject/abstract-signer';
2
+ import BigNumber from 'bignumber.js';
3
+ import { BigNumber as BigNumber$1, utils, Contract, ethers as ethers$1 } from 'ethers';
4
+ import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
+ import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
6
+ import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
7
+ import TokenLockABI from '@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json';
8
+ import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
3
9
 
4
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
5
11
  try {
@@ -53,6 +59,44 @@ function _setPrototypeOf(o, p) {
53
59
  return _setPrototypeOf(o, p);
54
60
  }
55
61
 
62
+ function _unsupportedIterableToArray(o, minLen) {
63
+ if (!o) return;
64
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
65
+ var n = Object.prototype.toString.call(o).slice(8, -1);
66
+ if (n === "Object" && o.constructor) n = o.constructor.name;
67
+ if (n === "Map" || n === "Set") return Array.from(o);
68
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
69
+ }
70
+
71
+ function _arrayLikeToArray(arr, len) {
72
+ if (len == null || len > arr.length) len = arr.length;
73
+
74
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
75
+
76
+ return arr2;
77
+ }
78
+
79
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
80
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
81
+ if (it) return (it = it.call(o)).next.bind(it);
82
+
83
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
84
+ if (it) o = it;
85
+ var i = 0;
86
+ return function () {
87
+ if (i >= o.length) return {
88
+ done: true
89
+ };
90
+ return {
91
+ done: false,
92
+ value: o[i++]
93
+ };
94
+ };
95
+ }
96
+
97
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
98
+ }
99
+
56
100
  function createCommonjsModule(fn, module) {
57
101
  return module = { exports: {} }, fn(module, module.exports), module.exports;
58
102
  }
@@ -813,14 +857,18 @@ try {
813
857
  }
814
858
  });
815
859
 
816
- var BlockchainEntityRead = function BlockchainEntityRead(providerOrSigner) {
817
- this._providerOrSigner = providerOrSigner;
860
+ var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
861
+ this._networkConnection = networkConnection;
818
862
  };
819
863
  var BlockchainEntityReadWrite = /*#__PURE__*/function (_BlockchainEntityRead) {
820
864
  _inheritsLoose(BlockchainEntityReadWrite, _BlockchainEntityRead);
821
865
 
822
- function BlockchainEntityReadWrite(signer) {
823
- return _BlockchainEntityRead.call(this, signer) || this;
866
+ function BlockchainEntityReadWrite(networkConnection) {
867
+ if (!(networkConnection.signer instanceof Signer)) {
868
+ throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");
869
+ }
870
+
871
+ return _BlockchainEntityRead.call(this, networkConnection) || this;
824
872
  }
825
873
 
826
874
  return BlockchainEntityReadWrite;
@@ -830,36 +878,153 @@ var BlockchainEntity = /*#__PURE__*/function () {
830
878
 
831
879
  var _proto = BlockchainEntity.prototype;
832
880
 
833
- _proto.read = function read(provider) {
834
- return new BlockchainEntityRead(provider);
881
+ _proto.read = function read(networkConnection) {
882
+ return new BlockchainEntityRead(networkConnection);
835
883
  };
836
884
 
837
- _proto.readWrite = function readWrite(signer) {
838
- return new BlockchainEntityReadWrite(signer);
885
+ _proto.readWrite = function readWrite(networkConnection) {
886
+ return new BlockchainEntityReadWrite(networkConnection);
839
887
  };
840
888
 
841
889
  return BlockchainEntity;
842
890
  }();
843
891
 
844
- var Token = function Token(address, decimals, expiry) {
845
- this.address = address.toLowerCase();
846
- this.decimals = decimals;
847
- this.expiry = expiry;
892
+ var ethers = /*#__PURE__*/require('ethers');
893
+
894
+ var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
895
+ var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
896
+ var dummyAddress = "0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE";
897
+ var ETHAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
898
+ var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
899
+ var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
900
+ var AURORA_CHAINID = 1313161554;
901
+ var DECIMAL_PRECISION = 6;
902
+ var networkAddresses = {
903
+ auTokens: [{
904
+ address: '0x7967532568bef9ec96cfad6badea4c63add5888a',
905
+ underlying: '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8'
906
+ }, {
907
+ address: '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60',
908
+ underlying: ETHAddress
909
+ }, {
910
+ address: '0xccf005cfc3669d806a03f0617885648c397c456e',
911
+ underlying: '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6'
912
+ }, {
913
+ address: '0x55a4c111c007f39326edf22cfd63bbbb21a35b35',
914
+ underlying: '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369'
915
+ }, {
916
+ address: '0x77b088236c071ab5bd4e0bd21240b093275adffc',
917
+ underlying: '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18'
918
+ }, {
919
+ address: '0xaa68274f87fd9ae940f1dec31b643486838481c1',
920
+ underlying: '0x7a80df8230c5aa711e2702a275ab31aeb32754bf'
921
+ }, {
922
+ address: '0x6970167dfaa2aaa67404204102cbbd18b405eca9',
923
+ underlying: '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428'
924
+ }, {
925
+ address: '0x9630a6c5b729194972199805075fd76707a9713a',
926
+ underlying: '0x6f8a1daa158e08f75711a64e5a3073e959d688a6'
927
+ }],
928
+ misc: {
929
+ COMPTROLLER: "0xb51028d4f3fc69e3f9e3118ce067a4562c595aad",
930
+ oracle: "0xf1ebfaa2af93f4d82215fd7817c1835853c62fb8",
931
+ AURIFAIRLAUNCH: "0x7942874a9ef8059c5de259625a883dc61f03320d",
932
+ AURILENS: '0xa2635a23a7688cd3acdd07713c4943b2f0f9082c'
933
+ },
934
+ tokens: {
935
+ AURORA: "0x7a80df8230c5aa711e2702a275ab31aeb32754bf",
936
+ PLY: "0x6f8a1daa158e08f75711a64e5a3073e959d688a6",
937
+ AURPLY: dummyAddress
938
+ }
939
+ };
940
+ var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
941
+ var REWARDCLAIMSTART = 1673280000;
942
+ var ONE_DAY = 86400;
943
+ var AurPlyPid = 1;
944
+
945
+ var decimalRecords = {
946
+ '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
947
+ '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8': 18,
948
+ '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428': 18,
949
+ '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369': 18,
950
+ '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18': 18,
951
+ '0xaa68274f87fd9ae940f1dec31b643486838481c1': 8,
952
+ '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60': 8,
953
+ '0x6970167dfaa2aaa67404204102cbbd18b405eca9': 8,
954
+ '0x6f8a1daa158e08f75711a64e5a3073e959d688a6': 18,
955
+ '0xccf005cfc3669d806a03f0617885648c397c456e': 8,
956
+ '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6': 18,
957
+ '0x7a80df8230c5aa711e2702a275ab31aeb32754bf': 18,
958
+ '0x9630a6c5b729194972199805075fd76707a9713a': 8,
959
+ '0x77b088236c071ab5bd4e0bd21240b093275adffc': 8,
960
+ '0x7967532568bef9ec96cfad6badea4c63add5888a': 8,
961
+ '0x55a4c111c007f39326edf22cfd63bbbb21a35b35': 8
848
962
  };
849
963
 
850
964
  function formatObject(object) {
851
965
  return JSON.stringify(object, null, ' ');
852
966
  }
853
- var decimalFactor = function decimalFactor(decimal) {
854
- return BigNumber.from(10).pow(decimal).toString();
967
+ function decimalFactor(decimal) {
968
+ return BigNumber$1.from(10).pow(decimal).toString();
969
+ }
970
+ var isSameAddress = function isSameAddress(address1, address2) {
971
+ return address1.toLowerCase() == address2.toLowerCase();
855
972
  };
973
+ var getCurrentTimestamp = /*#__PURE__*/function () {
974
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider) {
975
+ var latestBlockNumber, currentTime;
976
+ return runtime_1.wrap(function _callee$(_context) {
977
+ while (1) {
978
+ switch (_context.prev = _context.next) {
979
+ case 0:
980
+ _context.next = 2;
981
+ return provider.getBlockNumber();
982
+
983
+ case 2:
984
+ latestBlockNumber = _context.sent;
985
+ _context.next = 5;
986
+ return provider.getBlock(latestBlockNumber);
987
+
988
+ case 5:
989
+ currentTime = _context.sent.timestamp;
990
+ return _context.abrupt("return", currentTime);
991
+
992
+ case 7:
993
+ case "end":
994
+ return _context.stop();
995
+ }
996
+ }
997
+ }, _callee);
998
+ }));
999
+
1000
+ return function getCurrentTimestamp(_x) {
1001
+ return _ref.apply(this, arguments);
1002
+ };
1003
+ }();
856
1004
  function validateAndParseAddress(address) {
857
1005
  try {
858
1006
  return utils.getAddress(address);
859
1007
  } catch (error) {
860
- throw new Error("Invalid address " + address);
1008
+ throw new Error("Invalid address: " + address);
861
1009
  }
862
1010
  }
1011
+ function getDecimal(address) {
1012
+ return decimalRecords[address.toLowerCase()];
1013
+ }
1014
+ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
1015
+ if (totalStakeValue.lte(0)) {
1016
+ return new BigNumber('999999999');
1017
+ }
1018
+
1019
+ return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
1020
+ }
1021
+
1022
+ var Token = function Token(address, decimals) {
1023
+ this.address = address.toLowerCase();
1024
+ this.decimals = decimals;
1025
+ };
1026
+ var PLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.PLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.PLY));
1027
+ var AURPLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.AURPLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.AURPLY));
863
1028
 
864
1029
  var TokenAmount = /*#__PURE__*/function () {
865
1030
  function TokenAmount(token, amount, isRaw) {
@@ -870,7 +1035,7 @@ var TokenAmount = /*#__PURE__*/function () {
870
1035
  if (isRaw) {
871
1036
  this.rawAmnt = amount;
872
1037
  } else {
873
- this.rawAmnt = new BigNumber$1(amount).times(decimalFactor(token.decimals)).toFixed(0);
1038
+ this.rawAmnt = new BigNumber(amount).times(decimalFactor(token.decimals)).toFixed(0);
874
1039
  }
875
1040
 
876
1041
  this.token = token;
@@ -879,7 +1044,7 @@ var TokenAmount = /*#__PURE__*/function () {
879
1044
  var _proto = TokenAmount.prototype;
880
1045
 
881
1046
  _proto.formattedAmount = function formattedAmount() {
882
- return new BigNumber$1(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
1047
+ return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
883
1048
  };
884
1049
 
885
1050
  _proto.rawAmount = function rawAmount() {
@@ -889,214 +1054,245 @@ var TokenAmount = /*#__PURE__*/function () {
889
1054
  return TokenAmount;
890
1055
  }();
891
1056
 
892
- var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
893
- var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
894
- var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
895
- var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
896
- var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
897
- var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
898
- var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
899
- var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
900
- var dummyUserMarketDetails = {
901
- market: dummyMarketAddress,
902
- depositBalance: dummyTokenAmount2,
903
- borrowBalance: dummyZeroTokenAmount,
904
- isCollateral: true,
905
- maxWithdrawableAmount: dummyTokenAmount
906
- };
907
-
908
- var ethers = /*#__PURE__*/require('ethers');
1057
+ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
1058
+ _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
909
1059
 
910
- var DOLLAR = /*#__PURE__*/new Token('0x0000000000000000000000000000000000000001', 2);
911
- var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
912
- var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
913
- var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
914
- var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
1060
+ function MoneyMarketRead(networkConnection, auToken, underlyingAsset) {
1061
+ var _this;
915
1062
 
916
- var ethers$1 = /*#__PURE__*/require('ethers');
1063
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
917
1064
 
918
- var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
919
- _inheritsLoose(SdkRead, _BlockchainEntityRead);
1065
+ if (isSameAddress(underlyingAsset, ETHAddress)) {
1066
+ _this.auToken = new Contract(auToken, AuETHABI.abi, networkConnection.provider);
1067
+ } else {
1068
+ _this.auToken = new Contract(auToken, AuErc20ABI.abi, networkConnection.provider);
1069
+ }
920
1070
 
921
- function SdkRead(providerOrSigner) {
922
- return _BlockchainEntityRead.call(this, providerOrSigner) || this;
1071
+ _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
1072
+ _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
1073
+ return _this;
923
1074
  }
924
1075
 
925
- var _proto = SdkRead.prototype;
1076
+ var _proto = MoneyMarketRead.prototype;
926
1077
 
927
- _proto.getLockingDetails = /*#__PURE__*/function () {
928
- var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1078
+ _proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
1079
+ var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
929
1080
  return runtime_1.wrap(function _callee$(_context) {
930
1081
  while (1) {
931
1082
  switch (_context.prev = _context.next) {
932
1083
  case 0:
933
- return _context.abrupt("return", {
934
- vestingStart: 1673280000,
935
- currentUnlockPortion: 0.17,
936
- nextUnlockPortion: 0.19
937
- });
1084
+ _context.t0 = TokenAmount;
1085
+ _context.t1 = this.underlying;
1086
+ _context.next = 4;
1087
+ return this.auToken.totalBorrows();
938
1088
 
939
- case 1:
1089
+ case 4:
1090
+ _context.t2 = _context.sent.toString();
1091
+ return _context.abrupt("return", new _context.t0(_context.t1, _context.t2));
1092
+
1093
+ case 6:
940
1094
  case "end":
941
1095
  return _context.stop();
942
1096
  }
943
1097
  }
944
- }, _callee);
1098
+ }, _callee, this);
945
1099
  }));
946
1100
 
947
- function getLockingDetails() {
948
- return _getLockingDetails.apply(this, arguments);
1101
+ function getTotalTokenBorrowed() {
1102
+ return _getTotalTokenBorrowed.apply(this, arguments);
949
1103
  }
950
1104
 
951
- return getLockingDetails;
1105
+ return getTotalTokenBorrowed;
952
1106
  }();
953
1107
 
954
- _proto.getUserDetails = /*#__PURE__*/function () {
955
- var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
1108
+ _proto.getTotalTokenDeposited = /*#__PURE__*/function () {
1109
+ var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1110
+ var _this2 = this;
1111
+
1112
+ var promises, totalBorrow, totalCash;
956
1113
  return runtime_1.wrap(function _callee2$(_context2) {
957
1114
  while (1) {
958
1115
  switch (_context2.prev = _context2.next) {
959
1116
  case 0:
960
- return _context2.abrupt("return", {
961
- markets: [dummyUserMarketDetails],
962
- borrowLimit: dummyTokenAmount3,
963
- accruedPly: new TokenAmount(dummyPly, '100.12', false),
964
- lockedPly: new TokenAmount(dummyPly, '200.12', false),
965
- borrowableAmount: dummyTokenAmount2
966
- });
967
-
968
- case 1:
1117
+ promises = [];
1118
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
1119
+ totalBorrow = res;
1120
+ }));
1121
+ promises.push(this.auToken.getCash().then(function (res) {
1122
+ totalCash = new TokenAmount(_this2.underlying, res.toString());
1123
+ }));
1124
+ _context2.next = 5;
1125
+ return Promise.all(promises);
1126
+
1127
+ case 5:
1128
+ return _context2.abrupt("return", new TokenAmount(this.underlying, BigNumber$1.from(totalCash.rawAmount).add(totalBorrow.rawAmount()).toString()));
1129
+
1130
+ case 6:
969
1131
  case "end":
970
1132
  return _context2.stop();
971
1133
  }
972
1134
  }
973
- }, _callee2);
1135
+ }, _callee2, this);
974
1136
  }));
975
1137
 
976
- function getUserDetails(_x) {
977
- return _getUserDetails.apply(this, arguments);
1138
+ function getTotalTokenDeposited() {
1139
+ return _getTotalTokenDeposited.apply(this, arguments);
978
1140
  }
979
1141
 
980
- return getUserDetails;
1142
+ return getTotalTokenDeposited;
981
1143
  }();
982
1144
 
983
- _proto.getPlyAuroraPoolDetails = /*#__PURE__*/function () {
984
- var _getPlyAuroraPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1145
+ _proto.getDepositAPY = /*#__PURE__*/function () {
1146
+ var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1147
+ var supplyRatePerTimestamp;
985
1148
  return runtime_1.wrap(function _callee3$(_context3) {
986
1149
  while (1) {
987
1150
  switch (_context3.prev = _context3.next) {
988
1151
  case 0:
989
- return _context3.abrupt("return", {
990
- totalStakedLiquidity: new TokenAmount(dummyPlyAurora, '12.1', false),
991
- apy: 1.21
992
- });
1152
+ _context3.next = 2;
1153
+ return this.auToken.supplyRatePerTimestamp();
993
1154
 
994
- case 1:
1155
+ case 2:
1156
+ supplyRatePerTimestamp = _context3.sent;
1157
+ return _context3.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1158
+
1159
+ case 4:
995
1160
  case "end":
996
1161
  return _context3.stop();
997
1162
  }
998
1163
  }
999
- }, _callee3);
1164
+ }, _callee3, this);
1000
1165
  }));
1001
1166
 
1002
- function getPlyAuroraPoolDetails() {
1003
- return _getPlyAuroraPoolDetails.apply(this, arguments);
1167
+ function getDepositAPY() {
1168
+ return _getDepositAPY.apply(this, arguments);
1004
1169
  }
1005
1170
 
1006
- return getPlyAuroraPoolDetails;
1171
+ return getDepositAPY;
1007
1172
  }();
1008
1173
 
1009
- _proto.getTokenPrice = /*#__PURE__*/function () {
1010
- var _getTokenPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
1174
+ _proto.getBorrowAPY = /*#__PURE__*/function () {
1175
+ var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
1176
+ var borrowRatePerTimestamp;
1011
1177
  return runtime_1.wrap(function _callee4$(_context4) {
1012
1178
  while (1) {
1013
1179
  switch (_context4.prev = _context4.next) {
1014
1180
  case 0:
1015
- if (!(token.address == dummyToken.address)) {
1016
- _context4.next = 2;
1017
- break;
1018
- }
1019
-
1020
- return _context4.abrupt("return", new TokenAmount(DOLLAR, '1', false));
1181
+ _context4.next = 2;
1182
+ return this.auToken.borrowRatePerTimestamp();
1021
1183
 
1022
1184
  case 2:
1023
- return _context4.abrupt("return", new TokenAmount(DOLLAR, '12.1', false));
1185
+ borrowRatePerTimestamp = _context4.sent;
1186
+ return _context4.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1024
1187
 
1025
- case 3:
1188
+ case 4:
1026
1189
  case "end":
1027
1190
  return _context4.stop();
1028
1191
  }
1029
1192
  }
1030
- }, _callee4);
1193
+ }, _callee4, this);
1031
1194
  }));
1032
1195
 
1033
- function getTokenPrice(_x2) {
1034
- return _getTokenPrice.apply(this, arguments);
1196
+ function getBorrowAPY() {
1197
+ return _getBorrowAPY.apply(this, arguments);
1035
1198
  }
1036
1199
 
1037
- return getTokenPrice;
1200
+ return getBorrowAPY;
1038
1201
  }();
1039
1202
 
1040
- _proto.stakeBalanceOf = /*#__PURE__*/function () {
1041
- var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
1203
+ _proto.getCollateralRatio = /*#__PURE__*/function () {
1204
+ var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
1042
1205
  return runtime_1.wrap(function _callee5$(_context5) {
1043
1206
  while (1) {
1044
1207
  switch (_context5.prev = _context5.next) {
1045
1208
  case 0:
1046
- return _context5.abrupt("return", new TokenAmount(dummyPlyAurora, '103.4', false));
1209
+ return _context5.abrupt("return", this._comptroller.markets(this.auToken.address).then(function (res) {
1210
+ return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
1211
+ }));
1047
1212
 
1048
1213
  case 1:
1049
1214
  case "end":
1050
1215
  return _context5.stop();
1051
1216
  }
1052
1217
  }
1053
- }, _callee5);
1218
+ }, _callee5, this);
1054
1219
  }));
1055
1220
 
1056
- function stakeBalanceOf(_x3) {
1057
- return _stakeBalanceOf.apply(this, arguments);
1221
+ function getCollateralRatio() {
1222
+ return _getCollateralRatio.apply(this, arguments);
1058
1223
  }
1059
1224
 
1060
- return stakeBalanceOf;
1225
+ return getCollateralRatio;
1061
1226
  }();
1062
1227
 
1063
- return SdkRead;
1064
- }(BlockchainEntityRead);
1065
- var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
1066
- _inheritsLoose(SdkReadWrite, _SdkRead);
1067
-
1068
- function SdkReadWrite() {
1069
- var _this;
1070
-
1071
- _this = _SdkRead.apply(this, arguments) || this;
1072
- _this.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
1228
+ _proto.getDetails = /*#__PURE__*/function () {
1229
+ var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
1230
+ var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio;
1073
1231
  return runtime_1.wrap(function _callee6$(_context6) {
1074
1232
  while (1) {
1075
1233
  switch (_context6.prev = _context6.next) {
1076
1234
  case 0:
1077
- return _context6.abrupt("return", {});
1235
+ promises = [];
1236
+ promises.push(this.getTotalTokenDeposited().then(function (res) {
1237
+ totalDeposited = res;
1238
+ }));
1239
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
1240
+ totalBorrowed = res;
1241
+ }));
1242
+ promises.push(this.getDepositAPY().then(function (res) {
1243
+ depositAPY = res.toNumber();
1244
+ }));
1245
+ promises.push(this.getBorrowAPY().then(function (res) {
1246
+ borrowAPY = res.toNumber();
1247
+ }));
1248
+ promises.push(this.getCollateralRatio().then(function (res) {
1249
+ collateralRatio = res.toNumber();
1250
+ }));
1251
+ _context6.next = 8;
1252
+ return Promise.all(promises);
1253
+
1254
+ case 8:
1255
+ return _context6.abrupt("return", {
1256
+ auTokenAddress: this.auToken.address,
1257
+ totalTokenDeposited: totalDeposited,
1258
+ totalTokenBorrowed: totalBorrowed,
1259
+ depositApy: depositAPY,
1260
+ depositPlyApy: 0.18,
1261
+ borrowApy: borrowAPY,
1262
+ borrowPlyApy: 0.18,
1263
+ collateralRatio: collateralRatio
1264
+ });
1078
1265
 
1079
- case 1:
1266
+ case 9:
1080
1267
  case "end":
1081
1268
  return _context6.stop();
1082
1269
  }
1083
1270
  }
1084
- }, _callee6);
1271
+ }, _callee6, this);
1085
1272
  }));
1086
- return _this;
1087
- }
1088
1273
 
1089
- var _proto2 = SdkReadWrite.prototype;
1274
+ function getDetails() {
1275
+ return _getDetails.apply(this, arguments);
1276
+ }
1090
1277
 
1091
- _proto2.claim = /*#__PURE__*/function () {
1092
- var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
1278
+ return getDetails;
1279
+ }();
1280
+
1281
+ _proto.getUserBorrowBalance = /*#__PURE__*/function () {
1282
+ var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(userAddress) {
1283
+ var totalBorrow;
1093
1284
  return runtime_1.wrap(function _callee7$(_context7) {
1094
1285
  while (1) {
1095
1286
  switch (_context7.prev = _context7.next) {
1096
1287
  case 0:
1097
- return _context7.abrupt("return", this.dummyTransaction());
1288
+ _context7.next = 2;
1289
+ return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
1098
1290
 
1099
- case 1:
1291
+ case 2:
1292
+ totalBorrow = _context7.sent;
1293
+ return _context7.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
1294
+
1295
+ case 4:
1100
1296
  case "end":
1101
1297
  return _context7.stop();
1102
1298
  }
@@ -1104,22 +1300,28 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
1104
1300
  }, _callee7, this);
1105
1301
  }));
1106
1302
 
1107
- function claim() {
1108
- return _claim.apply(this, arguments);
1303
+ function getUserBorrowBalance(_x) {
1304
+ return _getUserBorrowBalance.apply(this, arguments);
1109
1305
  }
1110
1306
 
1111
- return claim;
1307
+ return getUserBorrowBalance;
1112
1308
  }();
1113
1309
 
1114
- _proto2.stake = /*#__PURE__*/function () {
1115
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
1310
+ _proto.getUserDepositBalance = /*#__PURE__*/function () {
1311
+ var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddress) {
1312
+ var totalDeposit;
1116
1313
  return runtime_1.wrap(function _callee8$(_context8) {
1117
1314
  while (1) {
1118
1315
  switch (_context8.prev = _context8.next) {
1119
1316
  case 0:
1120
- return _context8.abrupt("return", this.dummyTransaction());
1317
+ _context8.next = 2;
1318
+ return this.auToken.callStatic.balanceOfUnderlying(userAddress);
1121
1319
 
1122
- case 1:
1320
+ case 2:
1321
+ totalDeposit = _context8.sent;
1322
+ return _context8.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
1323
+
1324
+ case 4:
1123
1325
  case "end":
1124
1326
  return _context8.stop();
1125
1327
  }
@@ -1127,22 +1329,43 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
1127
1329
  }, _callee8, this);
1128
1330
  }));
1129
1331
 
1130
- function stake(_x4) {
1131
- return _stake.apply(this, arguments);
1332
+ function getUserDepositBalance(_x2) {
1333
+ return _getUserDepositBalance.apply(this, arguments);
1132
1334
  }
1133
1335
 
1134
- return stake;
1336
+ return getUserDepositBalance;
1135
1337
  }();
1136
1338
 
1137
- _proto2.unstake = /*#__PURE__*/function () {
1138
- var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
1339
+ return MoneyMarketRead;
1340
+ }(BlockchainEntityRead);
1341
+ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
1342
+ _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
1343
+
1344
+ function MoneyMarketReadWrite() {
1345
+ return _MoneyMarketRead.apply(this, arguments) || this;
1346
+ }
1347
+
1348
+ var _proto2 = MoneyMarketReadWrite.prototype;
1349
+
1350
+ _proto2.deposit = /*#__PURE__*/function () {
1351
+ var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
1139
1352
  return runtime_1.wrap(function _callee9$(_context9) {
1140
1353
  while (1) {
1141
1354
  switch (_context9.prev = _context9.next) {
1142
1355
  case 0:
1143
- return _context9.abrupt("return", this.dummyTransaction());
1356
+ if (!isSameAddress(amount.token.address, ETHAddress)) {
1357
+ _context9.next = 4;
1358
+ break;
1359
+ }
1144
1360
 
1145
- case 1:
1361
+ return _context9.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
1362
+ value: amount.rawAmount()
1363
+ }));
1364
+
1365
+ case 4:
1366
+ return _context9.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
1367
+
1368
+ case 5:
1146
1369
  case "end":
1147
1370
  return _context9.stop();
1148
1371
  }
@@ -1150,148 +1373,168 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
1150
1373
  }, _callee9, this);
1151
1374
  }));
1152
1375
 
1153
- function unstake(_x5) {
1154
- return _unstake.apply(this, arguments);
1376
+ function deposit(_x3) {
1377
+ return _deposit.apply(this, arguments);
1155
1378
  }
1156
1379
 
1157
- return unstake;
1380
+ return deposit;
1158
1381
  }();
1159
1382
 
1160
- return SdkReadWrite;
1161
- }(SdkRead);
1162
- var SDK = /*#__PURE__*/function (_BlockchainEntity) {
1163
- _inheritsLoose(SDK, _BlockchainEntity);
1383
+ _proto2.borrow = /*#__PURE__*/function () {
1384
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(amount) {
1385
+ return runtime_1.wrap(function _callee10$(_context10) {
1386
+ while (1) {
1387
+ switch (_context10.prev = _context10.next) {
1388
+ case 0:
1389
+ return _context10.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
1164
1390
 
1165
- function SDK() {
1166
- return _BlockchainEntity.call(this) || this;
1167
- }
1391
+ case 1:
1392
+ case "end":
1393
+ return _context10.stop();
1394
+ }
1395
+ }
1396
+ }, _callee10, this);
1397
+ }));
1168
1398
 
1169
- var _proto3 = SDK.prototype;
1399
+ function borrow(_x4) {
1400
+ return _borrow.apply(this, arguments);
1401
+ }
1170
1402
 
1171
- _proto3.read = function read(provider) {
1172
- return new SdkRead(provider);
1173
- };
1403
+ return borrow;
1404
+ }();
1174
1405
 
1175
- SDK.defaultProvider = function defaultProvider() {
1176
- return new ethers$1.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
1177
- };
1406
+ _proto2.withdraw = /*#__PURE__*/function () {
1407
+ var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
1408
+ return runtime_1.wrap(function _callee11$(_context11) {
1409
+ while (1) {
1410
+ switch (_context11.prev = _context11.next) {
1411
+ case 0:
1412
+ return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
1178
1413
 
1179
- return SDK;
1180
- }(BlockchainEntity);
1414
+ case 1:
1415
+ case "end":
1416
+ return _context11.stop();
1417
+ }
1418
+ }
1419
+ }, _callee11, this);
1420
+ }));
1181
1421
 
1182
- var abi = [
1183
- {
1184
- inputs: [
1185
- {
1186
- internalType: "address",
1187
- name: "underlying_",
1188
- type: "address"
1189
- },
1190
- {
1191
- internalType: "contract ComptrollerInterface",
1192
- name: "comptroller_",
1193
- type: "address"
1194
- },
1195
- {
1196
- internalType: "contract InterestRateModel",
1197
- name: "interestRateModel_",
1198
- type: "address"
1199
- },
1200
- {
1201
- internalType: "uint256",
1202
- name: "initialExchangeRateMantissa_",
1203
- type: "uint256"
1204
- },
1205
- {
1206
- internalType: "string",
1207
- name: "name_",
1208
- type: "string"
1209
- },
1210
- {
1211
- internalType: "string",
1212
- name: "symbol_",
1213
- type: "string"
1214
- },
1215
- {
1216
- internalType: "uint8",
1217
- name: "decimals_",
1218
- type: "uint8"
1219
- },
1220
- {
1221
- internalType: "address payable",
1222
- name: "admin_",
1223
- type: "address"
1224
- },
1225
- {
1226
- internalType: "address",
1227
- name: "implementation_",
1228
- type: "address"
1229
- },
1230
- {
1231
- internalType: "bytes",
1232
- name: "becomeImplementationData",
1233
- type: "bytes"
1234
- }
1235
- ],
1236
- payable: false,
1237
- stateMutability: "nonpayable",
1238
- type: "constructor"
1239
- },
1240
- {
1241
- anonymous: false,
1242
- inputs: [
1243
- {
1244
- indexed: false,
1245
- internalType: "uint256",
1246
- name: "cashPrior",
1247
- type: "uint256"
1248
- },
1249
- {
1250
- indexed: false,
1251
- internalType: "uint256",
1252
- name: "interestAccumulated",
1253
- type: "uint256"
1254
- },
1255
- {
1256
- indexed: false,
1257
- internalType: "uint256",
1258
- name: "borrowIndex",
1259
- type: "uint256"
1260
- },
1261
- {
1262
- indexed: false,
1263
- internalType: "uint256",
1264
- name: "totalBorrows",
1265
- type: "uint256"
1266
- }
1267
- ],
1268
- name: "AccrueInterest",
1269
- type: "event"
1270
- },
1422
+ function withdraw(_x5) {
1423
+ return _withdraw.apply(this, arguments);
1424
+ }
1425
+
1426
+ return withdraw;
1427
+ }();
1428
+
1429
+ _proto2.repay = /*#__PURE__*/function () {
1430
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
1431
+ return runtime_1.wrap(function _callee12$(_context12) {
1432
+ while (1) {
1433
+ switch (_context12.prev = _context12.next) {
1434
+ case 0:
1435
+ if (!isSameAddress(amount.token.address, ETHAddress)) {
1436
+ _context12.next = 4;
1437
+ break;
1438
+ }
1439
+
1440
+ return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
1441
+ value: amount.rawAmount()
1442
+ }));
1443
+
1444
+ case 4:
1445
+ return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
1446
+
1447
+ case 5:
1448
+ case "end":
1449
+ return _context12.stop();
1450
+ }
1451
+ }
1452
+ }, _callee12, this);
1453
+ }));
1454
+
1455
+ function repay(_x6) {
1456
+ return _repay.apply(this, arguments);
1457
+ }
1458
+
1459
+ return repay;
1460
+ }();
1461
+
1462
+ _proto2.enableCollateral = /*#__PURE__*/function () {
1463
+ var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
1464
+ return runtime_1.wrap(function _callee13$(_context13) {
1465
+ while (1) {
1466
+ switch (_context13.prev = _context13.next) {
1467
+ case 0:
1468
+ return _context13.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
1469
+
1470
+ case 1:
1471
+ case "end":
1472
+ return _context13.stop();
1473
+ }
1474
+ }
1475
+ }, _callee13, this);
1476
+ }));
1477
+
1478
+ function enableCollateral() {
1479
+ return _enableCollateral.apply(this, arguments);
1480
+ }
1481
+
1482
+ return enableCollateral;
1483
+ }();
1484
+
1485
+ _proto2.disableCollateral = /*#__PURE__*/function () {
1486
+ var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14() {
1487
+ return runtime_1.wrap(function _callee14$(_context14) {
1488
+ while (1) {
1489
+ switch (_context14.prev = _context14.next) {
1490
+ case 0:
1491
+ return _context14.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
1492
+
1493
+ case 1:
1494
+ case "end":
1495
+ return _context14.stop();
1496
+ }
1497
+ }
1498
+ }, _callee14, this);
1499
+ }));
1500
+
1501
+ function disableCollateral() {
1502
+ return _disableCollateral.apply(this, arguments);
1503
+ }
1504
+
1505
+ return disableCollateral;
1506
+ }();
1507
+
1508
+ return MoneyMarketReadWrite;
1509
+ }(MoneyMarketRead);
1510
+ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
1511
+ _inheritsLoose(MoneyMarket, _BlockchainEntity);
1512
+
1513
+ function MoneyMarket(address, underlying) {
1514
+ var _this3;
1515
+
1516
+ _this3 = _BlockchainEntity.call(this) || this;
1517
+ _this3.address = validateAndParseAddress(address);
1518
+ _this3.underlying = validateAndParseAddress(underlying);
1519
+ return _this3;
1520
+ }
1521
+
1522
+ var _proto3 = MoneyMarket.prototype;
1523
+
1524
+ _proto3.read = function read(networkConnection) {
1525
+ return new MoneyMarketRead(networkConnection, this.address, this.underlying);
1526
+ };
1527
+
1528
+ return MoneyMarket;
1529
+ }(BlockchainEntity);
1530
+
1531
+ var abi = [
1271
1532
  {
1272
- anonymous: false,
1273
1533
  inputs: [
1274
- {
1275
- indexed: true,
1276
- internalType: "address",
1277
- name: "owner",
1278
- type: "address"
1279
- },
1280
- {
1281
- indexed: true,
1282
- internalType: "address",
1283
- name: "spender",
1284
- type: "address"
1285
- },
1286
- {
1287
- indexed: false,
1288
- internalType: "uint256",
1289
- name: "amount",
1290
- type: "uint256"
1291
- }
1292
1534
  ],
1293
- name: "Approval",
1294
- type: "event"
1535
+ payable: false,
1536
+ stateMutability: "nonpayable",
1537
+ type: "constructor"
1295
1538
  },
1296
1539
  {
1297
1540
  anonymous: false,
@@ -1299,54 +1542,17 @@ var abi = [
1299
1542
  {
1300
1543
  indexed: false,
1301
1544
  internalType: "address",
1302
- name: "borrower",
1545
+ name: "feed",
1303
1546
  type: "address"
1304
1547
  },
1305
1548
  {
1306
1549
  indexed: false,
1307
- internalType: "uint256",
1308
- name: "borrowAmount",
1309
- type: "uint256"
1310
- },
1311
- {
1312
- indexed: false,
1313
- internalType: "uint256",
1314
- name: "accountBorrows",
1315
- type: "uint256"
1316
- },
1317
- {
1318
- indexed: false,
1319
- internalType: "uint256",
1320
- name: "totalBorrows",
1321
- type: "uint256"
1322
- }
1323
- ],
1324
- name: "Borrow",
1325
- type: "event"
1326
- },
1327
- {
1328
- anonymous: false,
1329
- inputs: [
1330
- {
1331
- indexed: false,
1332
- internalType: "uint256",
1333
- name: "error",
1334
- type: "uint256"
1335
- },
1336
- {
1337
- indexed: false,
1338
- internalType: "uint256",
1339
- name: "info",
1340
- type: "uint256"
1341
- },
1342
- {
1343
- indexed: false,
1344
- internalType: "uint256",
1345
- name: "detail",
1346
- type: "uint256"
1550
+ internalType: "string",
1551
+ name: "symbol",
1552
+ type: "string"
1347
1553
  }
1348
1554
  ],
1349
- name: "Failure",
1555
+ name: "FeedSet",
1350
1556
  type: "event"
1351
1557
  },
1352
1558
  {
@@ -1355,35 +1561,17 @@ var abi = [
1355
1561
  {
1356
1562
  indexed: false,
1357
1563
  internalType: "address",
1358
- name: "liquidator",
1359
- type: "address"
1360
- },
1361
- {
1362
- indexed: false,
1363
- internalType: "address",
1364
- name: "borrower",
1564
+ name: "oldAdmin",
1365
1565
  type: "address"
1366
1566
  },
1367
- {
1368
- indexed: false,
1369
- internalType: "uint256",
1370
- name: "repayAmount",
1371
- type: "uint256"
1372
- },
1373
1567
  {
1374
1568
  indexed: false,
1375
1569
  internalType: "address",
1376
- name: "qiTokenCollateral",
1570
+ name: "newAdmin",
1377
1571
  type: "address"
1378
- },
1379
- {
1380
- indexed: false,
1381
- internalType: "uint256",
1382
- name: "seizeTokens",
1383
- type: "uint256"
1384
1572
  }
1385
1573
  ],
1386
- name: "LiquidateBorrow",
1574
+ name: "NewAdmin",
1387
1575
  type: "event"
1388
1576
  },
1389
1577
  {
@@ -1392,520 +1580,30 @@ var abi = [
1392
1580
  {
1393
1581
  indexed: false,
1394
1582
  internalType: "address",
1395
- name: "minter",
1583
+ name: "asset",
1396
1584
  type: "address"
1397
1585
  },
1398
1586
  {
1399
1587
  indexed: false,
1400
1588
  internalType: "uint256",
1401
- name: "mintAmount",
1589
+ name: "previousPriceMantissa",
1402
1590
  type: "uint256"
1403
1591
  },
1404
1592
  {
1405
1593
  indexed: false,
1406
1594
  internalType: "uint256",
1407
- name: "mintTokens",
1595
+ name: "requestedPriceMantissa",
1408
1596
  type: "uint256"
1409
- }
1410
- ],
1411
- name: "Mint",
1412
- type: "event"
1413
- },
1414
- {
1415
- anonymous: false,
1416
- inputs: [
1417
- {
1418
- indexed: false,
1419
- internalType: "address",
1420
- name: "oldAdmin",
1421
- type: "address"
1422
- },
1423
- {
1424
- indexed: false,
1425
- internalType: "address",
1426
- name: "newAdmin",
1427
- type: "address"
1428
- }
1429
- ],
1430
- name: "NewAdmin",
1431
- type: "event"
1432
- },
1433
- {
1434
- anonymous: false,
1435
- inputs: [
1436
- {
1437
- indexed: false,
1438
- internalType: "contract ComptrollerInterface",
1439
- name: "oldComptroller",
1440
- type: "address"
1441
- },
1442
- {
1443
- indexed: false,
1444
- internalType: "contract ComptrollerInterface",
1445
- name: "newComptroller",
1446
- type: "address"
1447
- }
1448
- ],
1449
- name: "NewComptroller",
1450
- type: "event"
1451
- },
1452
- {
1453
- anonymous: false,
1454
- inputs: [
1455
- {
1456
- indexed: false,
1457
- internalType: "address",
1458
- name: "oldImplementation",
1459
- type: "address"
1460
- },
1461
- {
1462
- indexed: false,
1463
- internalType: "address",
1464
- name: "newImplementation",
1465
- type: "address"
1466
- }
1467
- ],
1468
- name: "NewImplementation",
1469
- type: "event"
1470
- },
1471
- {
1472
- anonymous: false,
1473
- inputs: [
1474
- {
1475
- indexed: false,
1476
- internalType: "contract InterestRateModel",
1477
- name: "oldInterestRateModel",
1478
- type: "address"
1479
- },
1480
- {
1481
- indexed: false,
1482
- internalType: "contract InterestRateModel",
1483
- name: "newInterestRateModel",
1484
- type: "address"
1485
- }
1486
- ],
1487
- name: "NewMarketInterestRateModel",
1488
- type: "event"
1489
- },
1490
- {
1491
- anonymous: false,
1492
- inputs: [
1493
- {
1494
- indexed: false,
1495
- internalType: "address",
1496
- name: "oldPendingAdmin",
1497
- type: "address"
1498
1597
  },
1499
1598
  {
1500
- indexed: false,
1501
- internalType: "address",
1502
- name: "newPendingAdmin",
1503
- type: "address"
1504
- }
1505
- ],
1506
- name: "NewPendingAdmin",
1507
- type: "event"
1508
- },
1509
- {
1510
- anonymous: false,
1511
- inputs: [
1512
- {
1513
- indexed: false,
1514
- internalType: "uint256",
1515
- name: "oldProtocolSeizeShareMantissa",
1516
- type: "uint256"
1517
- },
1518
- {
1519
- indexed: false,
1520
- internalType: "uint256",
1521
- name: "newProtocolSeizeShareMantissa",
1522
- type: "uint256"
1523
- }
1524
- ],
1525
- name: "NewProtocolSeizeShare",
1526
- type: "event"
1527
- },
1528
- {
1529
- anonymous: false,
1530
- inputs: [
1531
- {
1532
- indexed: false,
1533
- internalType: "uint256",
1534
- name: "oldReserveFactorMantissa",
1535
- type: "uint256"
1536
- },
1537
- {
1538
- indexed: false,
1539
- internalType: "uint256",
1540
- name: "newReserveFactorMantissa",
1541
- type: "uint256"
1542
- }
1543
- ],
1544
- name: "NewReserveFactor",
1545
- type: "event"
1546
- },
1547
- {
1548
- anonymous: false,
1549
- inputs: [
1550
- {
1551
- indexed: false,
1552
- internalType: "address",
1553
- name: "redeemer",
1554
- type: "address"
1555
- },
1556
- {
1557
- indexed: false,
1558
- internalType: "uint256",
1559
- name: "redeemAmount",
1560
- type: "uint256"
1561
- },
1562
- {
1563
- indexed: false,
1564
- internalType: "uint256",
1565
- name: "redeemTokens",
1566
- type: "uint256"
1567
- }
1568
- ],
1569
- name: "Redeem",
1570
- type: "event"
1571
- },
1572
- {
1573
- anonymous: false,
1574
- inputs: [
1575
- {
1576
- indexed: false,
1577
- internalType: "address",
1578
- name: "payer",
1579
- type: "address"
1580
- },
1581
- {
1582
- indexed: false,
1583
- internalType: "address",
1584
- name: "borrower",
1585
- type: "address"
1586
- },
1587
- {
1588
- indexed: false,
1589
- internalType: "uint256",
1590
- name: "repayAmount",
1591
- type: "uint256"
1592
- },
1593
- {
1594
- indexed: false,
1595
- internalType: "uint256",
1596
- name: "accountBorrows",
1597
- type: "uint256"
1598
- },
1599
- {
1600
- indexed: false,
1601
- internalType: "uint256",
1602
- name: "totalBorrows",
1603
- type: "uint256"
1604
- }
1605
- ],
1606
- name: "RepayBorrow",
1607
- type: "event"
1608
- },
1609
- {
1610
- anonymous: false,
1611
- inputs: [
1612
- {
1613
- indexed: false,
1614
- internalType: "address",
1615
- name: "benefactor",
1616
- type: "address"
1617
- },
1618
- {
1619
- indexed: false,
1620
- internalType: "uint256",
1621
- name: "addAmount",
1622
- type: "uint256"
1623
- },
1624
- {
1625
- indexed: false,
1626
- internalType: "uint256",
1627
- name: "newTotalReserves",
1628
- type: "uint256"
1629
- }
1630
- ],
1631
- name: "ReservesAdded",
1632
- type: "event"
1633
- },
1634
- {
1635
- anonymous: false,
1636
- inputs: [
1637
- {
1638
- indexed: false,
1639
- internalType: "address",
1640
- name: "admin",
1641
- type: "address"
1642
- },
1643
- {
1644
- indexed: false,
1645
- internalType: "uint256",
1646
- name: "reduceAmount",
1647
- type: "uint256"
1648
- },
1649
- {
1650
- indexed: false,
1651
- internalType: "uint256",
1652
- name: "newTotalReserves",
1653
- type: "uint256"
1654
- }
1655
- ],
1656
- name: "ReservesReduced",
1657
- type: "event"
1658
- },
1659
- {
1660
- anonymous: false,
1661
- inputs: [
1662
- {
1663
- indexed: true,
1664
- internalType: "address",
1665
- name: "from",
1666
- type: "address"
1667
- },
1668
- {
1669
- indexed: true,
1670
- internalType: "address",
1671
- name: "to",
1672
- type: "address"
1673
- },
1674
- {
1675
- indexed: false,
1676
- internalType: "uint256",
1677
- name: "amount",
1678
- type: "uint256"
1679
- }
1680
- ],
1681
- name: "Transfer",
1682
- type: "event"
1683
- },
1684
- {
1685
- payable: true,
1686
- stateMutability: "payable",
1687
- type: "fallback"
1688
- },
1689
- {
1690
- constant: false,
1691
- inputs: [
1692
- ],
1693
- name: "_acceptAdmin",
1694
- outputs: [
1695
- {
1696
- internalType: "uint256",
1697
- name: "",
1698
- type: "uint256"
1699
- }
1700
- ],
1701
- payable: false,
1702
- stateMutability: "nonpayable",
1703
- type: "function"
1704
- },
1705
- {
1706
- constant: false,
1707
- inputs: [
1708
- {
1709
- internalType: "uint256",
1710
- name: "addAmount",
1711
- type: "uint256"
1712
- }
1713
- ],
1714
- name: "_addReserves",
1715
- outputs: [
1716
- {
1717
- internalType: "uint256",
1718
- name: "",
1719
- type: "uint256"
1720
- }
1721
- ],
1722
- payable: false,
1723
- stateMutability: "nonpayable",
1724
- type: "function"
1725
- },
1726
- {
1727
- constant: false,
1728
- inputs: [
1729
- {
1730
- internalType: "uint256",
1731
- name: "reduceAmount",
1732
- type: "uint256"
1733
- }
1734
- ],
1735
- name: "_reduceReserves",
1736
- outputs: [
1737
- {
1738
- internalType: "uint256",
1739
- name: "",
1740
- type: "uint256"
1741
- }
1742
- ],
1743
- payable: false,
1744
- stateMutability: "nonpayable",
1745
- type: "function"
1746
- },
1747
- {
1748
- constant: false,
1749
- inputs: [
1750
- {
1751
- internalType: "contract ComptrollerInterface",
1752
- name: "newComptroller",
1753
- type: "address"
1754
- }
1755
- ],
1756
- name: "_setComptroller",
1757
- outputs: [
1758
- {
1759
- internalType: "uint256",
1760
- name: "",
1761
- type: "uint256"
1762
- }
1763
- ],
1764
- payable: false,
1765
- stateMutability: "nonpayable",
1766
- type: "function"
1767
- },
1768
- {
1769
- constant: false,
1770
- inputs: [
1771
- {
1772
- internalType: "address",
1773
- name: "implementation_",
1774
- type: "address"
1775
- },
1776
- {
1777
- internalType: "bool",
1778
- name: "allowResign",
1779
- type: "bool"
1780
- },
1781
- {
1782
- internalType: "bytes",
1783
- name: "becomeImplementationData",
1784
- type: "bytes"
1785
- }
1786
- ],
1787
- name: "_setImplementation",
1788
- outputs: [
1789
- ],
1790
- payable: false,
1791
- stateMutability: "nonpayable",
1792
- type: "function"
1793
- },
1794
- {
1795
- constant: false,
1796
- inputs: [
1797
- {
1798
- internalType: "contract InterestRateModel",
1799
- name: "newInterestRateModel",
1800
- type: "address"
1801
- }
1802
- ],
1803
- name: "_setInterestRateModel",
1804
- outputs: [
1805
- {
1806
- internalType: "uint256",
1807
- name: "",
1808
- type: "uint256"
1809
- }
1810
- ],
1811
- payable: false,
1812
- stateMutability: "nonpayable",
1813
- type: "function"
1814
- },
1815
- {
1816
- constant: false,
1817
- inputs: [
1818
- {
1819
- internalType: "address payable",
1820
- name: "newPendingAdmin",
1821
- type: "address"
1822
- }
1823
- ],
1824
- name: "_setPendingAdmin",
1825
- outputs: [
1826
- {
1827
- internalType: "uint256",
1828
- name: "",
1829
- type: "uint256"
1830
- }
1831
- ],
1832
- payable: false,
1833
- stateMutability: "nonpayable",
1834
- type: "function"
1835
- },
1836
- {
1837
- constant: false,
1838
- inputs: [
1839
- {
1840
- internalType: "uint256",
1841
- name: "newProtocolSeizeShareMantissa",
1842
- type: "uint256"
1843
- }
1844
- ],
1845
- name: "_setProtocolSeizeShare",
1846
- outputs: [
1847
- {
1848
- internalType: "uint256",
1849
- name: "",
1850
- type: "uint256"
1851
- }
1852
- ],
1853
- payable: false,
1854
- stateMutability: "nonpayable",
1855
- type: "function"
1856
- },
1857
- {
1858
- constant: false,
1859
- inputs: [
1860
- {
1861
- internalType: "uint256",
1862
- name: "newReserveFactorMantissa",
1863
- type: "uint256"
1864
- }
1865
- ],
1866
- name: "_setReserveFactor",
1867
- outputs: [
1868
- {
1869
- internalType: "uint256",
1870
- name: "",
1871
- type: "uint256"
1872
- }
1873
- ],
1874
- payable: false,
1875
- stateMutability: "nonpayable",
1876
- type: "function"
1877
- },
1878
- {
1879
- constant: true,
1880
- inputs: [
1881
- ],
1882
- name: "accrualBlockTimestamp",
1883
- outputs: [
1884
- {
1885
- internalType: "uint256",
1886
- name: "",
1887
- type: "uint256"
1888
- }
1889
- ],
1890
- payable: false,
1891
- stateMutability: "view",
1892
- type: "function"
1893
- },
1894
- {
1895
- constant: false,
1896
- inputs: [
1897
- ],
1898
- name: "accrueInterest",
1899
- outputs: [
1900
- {
1599
+ indexed: false,
1901
1600
  internalType: "uint256",
1902
- name: "",
1601
+ name: "newPriceMantissa",
1903
1602
  type: "uint256"
1904
1603
  }
1905
1604
  ],
1906
- payable: false,
1907
- stateMutability: "nonpayable",
1908
- type: "function"
1605
+ name: "PricePosted",
1606
+ type: "event"
1909
1607
  },
1910
1608
  {
1911
1609
  constant: true,
@@ -1914,7 +1612,7 @@ var abi = [
1914
1612
  name: "admin",
1915
1613
  outputs: [
1916
1614
  {
1917
- internalType: "address payable",
1615
+ internalType: "address",
1918
1616
  name: "",
1919
1617
  type: "address"
1920
1618
  }
@@ -1928,16 +1626,11 @@ var abi = [
1928
1626
  inputs: [
1929
1627
  {
1930
1628
  internalType: "address",
1931
- name: "owner",
1932
- type: "address"
1933
- },
1934
- {
1935
- internalType: "address",
1936
- name: "spender",
1629
+ name: "asset",
1937
1630
  type: "address"
1938
1631
  }
1939
1632
  ],
1940
- name: "allowance",
1633
+ name: "assetPrices",
1941
1634
  outputs: [
1942
1635
  {
1943
1636
  internalType: "uint256",
@@ -1950,41 +1643,36 @@ var abi = [
1950
1643
  type: "function"
1951
1644
  },
1952
1645
  {
1953
- constant: false,
1646
+ constant: true,
1954
1647
  inputs: [
1955
1648
  {
1956
- internalType: "address",
1957
- name: "spender",
1958
- type: "address"
1959
- },
1960
- {
1961
- internalType: "uint256",
1962
- name: "amount",
1963
- type: "uint256"
1649
+ internalType: "string",
1650
+ name: "symbol",
1651
+ type: "string"
1964
1652
  }
1965
1653
  ],
1966
- name: "approve",
1654
+ name: "getFeed",
1967
1655
  outputs: [
1968
1656
  {
1969
- internalType: "bool",
1657
+ internalType: "contract AggregatorV2V3Interface",
1970
1658
  name: "",
1971
- type: "bool"
1659
+ type: "address"
1972
1660
  }
1973
1661
  ],
1974
1662
  payable: false,
1975
- stateMutability: "nonpayable",
1663
+ stateMutability: "view",
1976
1664
  type: "function"
1977
1665
  },
1978
1666
  {
1979
1667
  constant: true,
1980
1668
  inputs: [
1981
1669
  {
1982
- internalType: "address",
1983
- name: "owner",
1670
+ internalType: "contract QiToken",
1671
+ name: "qiToken",
1984
1672
  type: "address"
1985
1673
  }
1986
1674
  ],
1987
- name: "balanceOf",
1675
+ name: "getUnderlyingPrice",
1988
1676
  outputs: [
1989
1677
  {
1990
1678
  internalType: "uint256",
@@ -1997,42 +1685,32 @@ var abi = [
1997
1685
  type: "function"
1998
1686
  },
1999
1687
  {
2000
- constant: false,
1688
+ constant: true,
2001
1689
  inputs: [
2002
- {
2003
- internalType: "address",
2004
- name: "owner",
2005
- type: "address"
2006
- }
2007
1690
  ],
2008
- name: "balanceOfUnderlying",
1691
+ name: "isPriceOracle",
2009
1692
  outputs: [
2010
1693
  {
2011
- internalType: "uint256",
1694
+ internalType: "bool",
2012
1695
  name: "",
2013
- type: "uint256"
1696
+ type: "bool"
2014
1697
  }
2015
1698
  ],
2016
1699
  payable: false,
2017
- stateMutability: "nonpayable",
1700
+ stateMutability: "view",
2018
1701
  type: "function"
2019
1702
  },
2020
1703
  {
2021
1704
  constant: false,
2022
1705
  inputs: [
2023
1706
  {
2024
- internalType: "uint256",
2025
- name: "borrowAmount",
2026
- type: "uint256"
1707
+ internalType: "address",
1708
+ name: "newAdmin",
1709
+ type: "address"
2027
1710
  }
2028
1711
  ],
2029
- name: "borrow",
1712
+ name: "setAdmin",
2030
1713
  outputs: [
2031
- {
2032
- internalType: "uint256",
2033
- name: "",
2034
- type: "uint256"
2035
- }
2036
1714
  ],
2037
1715
  payable: false,
2038
1716
  stateMutability: "nonpayable",
@@ -2043,222 +1721,259 @@ var abi = [
2043
1721
  inputs: [
2044
1722
  {
2045
1723
  internalType: "address",
2046
- name: "account",
1724
+ name: "asset",
2047
1725
  type: "address"
2048
- }
2049
- ],
2050
- name: "borrowBalanceCurrent",
2051
- outputs: [
1726
+ },
2052
1727
  {
2053
1728
  internalType: "uint256",
2054
- name: "",
1729
+ name: "price",
2055
1730
  type: "uint256"
2056
1731
  }
2057
1732
  ],
1733
+ name: "setDirectPrice",
1734
+ outputs: [
1735
+ ],
2058
1736
  payable: false,
2059
1737
  stateMutability: "nonpayable",
2060
1738
  type: "function"
2061
1739
  },
2062
1740
  {
2063
- constant: true,
1741
+ constant: false,
2064
1742
  inputs: [
1743
+ {
1744
+ internalType: "string",
1745
+ name: "symbol",
1746
+ type: "string"
1747
+ },
2065
1748
  {
2066
1749
  internalType: "address",
2067
- name: "account",
1750
+ name: "feed",
2068
1751
  type: "address"
2069
1752
  }
2070
1753
  ],
2071
- name: "borrowBalanceStored",
1754
+ name: "setFeed",
2072
1755
  outputs: [
2073
- {
2074
- internalType: "uint256",
2075
- name: "",
2076
- type: "uint256"
2077
- }
2078
1756
  ],
2079
1757
  payable: false,
2080
- stateMutability: "view",
1758
+ stateMutability: "nonpayable",
2081
1759
  type: "function"
2082
1760
  },
2083
1761
  {
2084
- constant: true,
1762
+ constant: false,
2085
1763
  inputs: [
2086
- ],
2087
- name: "borrowIndex",
2088
- outputs: [
1764
+ {
1765
+ internalType: "contract QiToken",
1766
+ name: "qiToken",
1767
+ type: "address"
1768
+ },
2089
1769
  {
2090
1770
  internalType: "uint256",
2091
- name: "",
1771
+ name: "underlyingPriceMantissa",
2092
1772
  type: "uint256"
2093
1773
  }
2094
1774
  ],
1775
+ name: "setUnderlyingPrice",
1776
+ outputs: [
1777
+ ],
2095
1778
  payable: false,
2096
- stateMutability: "view",
1779
+ stateMutability: "nonpayable",
2097
1780
  type: "function"
2098
- },
1781
+ }
1782
+ ];
1783
+ var OracleABI = {
1784
+ abi: abi
1785
+ };
1786
+
1787
+ var _format = "hh-sol-artifact-1";
1788
+ var contractName = "IUniswapV2Pair";
1789
+ var sourceName = "contracts/interfaces/IUniswapV2Pair.sol";
1790
+ var abi$1 = [
2099
1791
  {
2100
- constant: true,
1792
+ anonymous: false,
2101
1793
  inputs: [
2102
- ],
2103
- name: "borrowRatePerTimestamp",
2104
- outputs: [
2105
1794
  {
1795
+ indexed: true,
1796
+ internalType: "address",
1797
+ name: "owner",
1798
+ type: "address"
1799
+ },
1800
+ {
1801
+ indexed: true,
1802
+ internalType: "address",
1803
+ name: "spender",
1804
+ type: "address"
1805
+ },
1806
+ {
1807
+ indexed: false,
2106
1808
  internalType: "uint256",
2107
- name: "",
1809
+ name: "value",
2108
1810
  type: "uint256"
2109
1811
  }
2110
1812
  ],
2111
- payable: false,
2112
- stateMutability: "view",
2113
- type: "function"
1813
+ name: "Approval",
1814
+ type: "event"
2114
1815
  },
2115
1816
  {
2116
- constant: true,
1817
+ anonymous: false,
2117
1818
  inputs: [
2118
- ],
2119
- name: "comptroller",
2120
- outputs: [
2121
1819
  {
2122
- internalType: "contract ComptrollerInterface",
2123
- name: "",
1820
+ indexed: true,
1821
+ internalType: "address",
1822
+ name: "sender",
2124
1823
  type: "address"
2125
- }
2126
- ],
2127
- payable: false,
2128
- stateMutability: "view",
2129
- type: "function"
2130
- },
2131
- {
2132
- constant: true,
2133
- inputs: [
2134
- ],
2135
- name: "decimals",
2136
- outputs: [
1824
+ },
2137
1825
  {
2138
- internalType: "uint8",
2139
- name: "",
2140
- type: "uint8"
2141
- }
2142
- ],
2143
- payable: false,
2144
- stateMutability: "view",
2145
- type: "function"
2146
- },
2147
- {
2148
- constant: false,
2149
- inputs: [
1826
+ indexed: false,
1827
+ internalType: "uint256",
1828
+ name: "amount0",
1829
+ type: "uint256"
1830
+ },
2150
1831
  {
2151
- internalType: "bytes",
2152
- name: "data",
2153
- type: "bytes"
2154
- }
2155
- ],
2156
- name: "delegateToImplementation",
2157
- outputs: [
1832
+ indexed: false,
1833
+ internalType: "uint256",
1834
+ name: "amount1",
1835
+ type: "uint256"
1836
+ },
2158
1837
  {
2159
- internalType: "bytes",
2160
- name: "",
2161
- type: "bytes"
1838
+ indexed: true,
1839
+ internalType: "address",
1840
+ name: "to",
1841
+ type: "address"
2162
1842
  }
2163
1843
  ],
2164
- payable: false,
2165
- stateMutability: "nonpayable",
2166
- type: "function"
1844
+ name: "Burn",
1845
+ type: "event"
2167
1846
  },
2168
1847
  {
2169
- constant: true,
1848
+ anonymous: false,
2170
1849
  inputs: [
2171
1850
  {
2172
- internalType: "bytes",
2173
- name: "data",
2174
- type: "bytes"
2175
- }
2176
- ],
2177
- name: "delegateToViewImplementation",
2178
- outputs: [
1851
+ indexed: true,
1852
+ internalType: "address",
1853
+ name: "sender",
1854
+ type: "address"
1855
+ },
2179
1856
  {
2180
- internalType: "bytes",
2181
- name: "",
2182
- type: "bytes"
1857
+ indexed: false,
1858
+ internalType: "uint256",
1859
+ name: "amount0",
1860
+ type: "uint256"
1861
+ },
1862
+ {
1863
+ indexed: false,
1864
+ internalType: "uint256",
1865
+ name: "amount1",
1866
+ type: "uint256"
2183
1867
  }
2184
1868
  ],
2185
- payable: false,
2186
- stateMutability: "view",
2187
- type: "function"
1869
+ name: "Mint",
1870
+ type: "event"
2188
1871
  },
2189
1872
  {
2190
- constant: false,
1873
+ anonymous: false,
2191
1874
  inputs: [
2192
- ],
2193
- name: "exchangeRateCurrent",
2194
- outputs: [
2195
1875
  {
1876
+ indexed: true,
1877
+ internalType: "address",
1878
+ name: "sender",
1879
+ type: "address"
1880
+ },
1881
+ {
1882
+ indexed: false,
2196
1883
  internalType: "uint256",
2197
- name: "",
1884
+ name: "amount0In",
1885
+ type: "uint256"
1886
+ },
1887
+ {
1888
+ indexed: false,
1889
+ internalType: "uint256",
1890
+ name: "amount1In",
1891
+ type: "uint256"
1892
+ },
1893
+ {
1894
+ indexed: false,
1895
+ internalType: "uint256",
1896
+ name: "amount0Out",
2198
1897
  type: "uint256"
1898
+ },
1899
+ {
1900
+ indexed: false,
1901
+ internalType: "uint256",
1902
+ name: "amount1Out",
1903
+ type: "uint256"
1904
+ },
1905
+ {
1906
+ indexed: true,
1907
+ internalType: "address",
1908
+ name: "to",
1909
+ type: "address"
2199
1910
  }
2200
1911
  ],
2201
- payable: false,
2202
- stateMutability: "nonpayable",
2203
- type: "function"
1912
+ name: "Swap",
1913
+ type: "event"
2204
1914
  },
2205
1915
  {
2206
- constant: true,
1916
+ anonymous: false,
2207
1917
  inputs: [
2208
- ],
2209
- name: "exchangeRateStored",
2210
- outputs: [
2211
1918
  {
2212
- internalType: "uint256",
2213
- name: "",
2214
- type: "uint256"
1919
+ indexed: false,
1920
+ internalType: "uint112",
1921
+ name: "reserve0",
1922
+ type: "uint112"
1923
+ },
1924
+ {
1925
+ indexed: false,
1926
+ internalType: "uint112",
1927
+ name: "reserve1",
1928
+ type: "uint112"
2215
1929
  }
2216
1930
  ],
2217
- payable: false,
2218
- stateMutability: "view",
2219
- type: "function"
1931
+ name: "Sync",
1932
+ type: "event"
2220
1933
  },
2221
1934
  {
2222
- constant: true,
1935
+ anonymous: false,
2223
1936
  inputs: [
2224
1937
  {
1938
+ indexed: true,
2225
1939
  internalType: "address",
2226
- name: "account",
1940
+ name: "from",
2227
1941
  type: "address"
2228
- }
2229
- ],
2230
- name: "getAccountSnapshot",
2231
- outputs: [
2232
- {
2233
- internalType: "uint256",
2234
- name: "",
2235
- type: "uint256"
2236
1942
  },
2237
1943
  {
2238
- internalType: "uint256",
2239
- name: "",
2240
- type: "uint256"
1944
+ indexed: true,
1945
+ internalType: "address",
1946
+ name: "to",
1947
+ type: "address"
2241
1948
  },
2242
1949
  {
1950
+ indexed: false,
2243
1951
  internalType: "uint256",
2244
- name: "",
1952
+ name: "value",
2245
1953
  type: "uint256"
2246
- },
1954
+ }
1955
+ ],
1956
+ name: "Transfer",
1957
+ type: "event"
1958
+ },
1959
+ {
1960
+ inputs: [
1961
+ ],
1962
+ name: "DOMAIN_SEPARATOR",
1963
+ outputs: [
2247
1964
  {
2248
- internalType: "uint256",
1965
+ internalType: "bytes32",
2249
1966
  name: "",
2250
- type: "uint256"
1967
+ type: "bytes32"
2251
1968
  }
2252
1969
  ],
2253
- payable: false,
2254
1970
  stateMutability: "view",
2255
1971
  type: "function"
2256
1972
  },
2257
1973
  {
2258
- constant: true,
2259
1974
  inputs: [
2260
1975
  ],
2261
- name: "getCash",
1976
+ name: "MINIMUM_LIQUIDITY",
2262
1977
  outputs: [
2263
1978
  {
2264
1979
  internalType: "uint256",
@@ -2266,47 +1981,61 @@ var abi = [
2266
1981
  type: "uint256"
2267
1982
  }
2268
1983
  ],
2269
- payable: false,
2270
- stateMutability: "view",
1984
+ stateMutability: "pure",
2271
1985
  type: "function"
2272
1986
  },
2273
1987
  {
2274
- constant: true,
2275
1988
  inputs: [
2276
1989
  ],
2277
- name: "implementation",
1990
+ name: "PERMIT_TYPEHASH",
2278
1991
  outputs: [
2279
1992
  {
2280
- internalType: "address",
1993
+ internalType: "bytes32",
2281
1994
  name: "",
2282
- type: "address"
1995
+ type: "bytes32"
2283
1996
  }
2284
1997
  ],
2285
- payable: false,
2286
- stateMutability: "view",
1998
+ stateMutability: "pure",
2287
1999
  type: "function"
2288
2000
  },
2289
2001
  {
2290
- constant: true,
2291
2002
  inputs: [
2003
+ {
2004
+ internalType: "address",
2005
+ name: "owner",
2006
+ type: "address"
2007
+ },
2008
+ {
2009
+ internalType: "address",
2010
+ name: "spender",
2011
+ type: "address"
2012
+ }
2292
2013
  ],
2293
- name: "interestRateModel",
2014
+ name: "allowance",
2294
2015
  outputs: [
2295
2016
  {
2296
- internalType: "contract InterestRateModel",
2017
+ internalType: "uint256",
2297
2018
  name: "",
2298
- type: "address"
2019
+ type: "uint256"
2299
2020
  }
2300
2021
  ],
2301
- payable: false,
2302
2022
  stateMutability: "view",
2303
2023
  type: "function"
2304
2024
  },
2305
2025
  {
2306
- constant: true,
2307
2026
  inputs: [
2027
+ {
2028
+ internalType: "address",
2029
+ name: "spender",
2030
+ type: "address"
2031
+ },
2032
+ {
2033
+ internalType: "uint256",
2034
+ name: "value",
2035
+ type: "uint256"
2036
+ }
2308
2037
  ],
2309
- name: "isQiToken",
2038
+ name: "approve",
2310
2039
  outputs: [
2311
2040
  {
2312
2041
  internalType: "bool",
@@ -2314,30 +2043,18 @@ var abi = [
2314
2043
  type: "bool"
2315
2044
  }
2316
2045
  ],
2317
- payable: false,
2318
- stateMutability: "view",
2046
+ stateMutability: "nonpayable",
2319
2047
  type: "function"
2320
2048
  },
2321
2049
  {
2322
- constant: false,
2323
2050
  inputs: [
2324
2051
  {
2325
2052
  internalType: "address",
2326
- name: "borrower",
2327
- type: "address"
2328
- },
2329
- {
2330
- internalType: "uint256",
2331
- name: "repayAmount",
2332
- type: "uint256"
2333
- },
2334
- {
2335
- internalType: "contract QiTokenInterface",
2336
- name: "qiTokenCollateral",
2053
+ name: "owner",
2337
2054
  type: "address"
2338
2055
  }
2339
2056
  ],
2340
- name: "liquidateBorrow",
2057
+ name: "balanceOf",
2341
2058
  outputs: [
2342
2059
  {
2343
2060
  internalType: "uint256",
@@ -2345,110 +2062,108 @@ var abi = [
2345
2062
  type: "uint256"
2346
2063
  }
2347
2064
  ],
2348
- payable: false,
2349
- stateMutability: "nonpayable",
2065
+ stateMutability: "view",
2350
2066
  type: "function"
2351
2067
  },
2352
2068
  {
2353
- constant: false,
2354
2069
  inputs: [
2355
2070
  {
2356
- internalType: "uint256",
2357
- name: "mintAmount",
2358
- type: "uint256"
2071
+ internalType: "address",
2072
+ name: "to",
2073
+ type: "address"
2359
2074
  }
2360
2075
  ],
2361
- name: "mint",
2076
+ name: "burn",
2362
2077
  outputs: [
2363
2078
  {
2364
2079
  internalType: "uint256",
2365
- name: "",
2080
+ name: "amount0",
2081
+ type: "uint256"
2082
+ },
2083
+ {
2084
+ internalType: "uint256",
2085
+ name: "amount1",
2366
2086
  type: "uint256"
2367
2087
  }
2368
2088
  ],
2369
- payable: false,
2370
2089
  stateMutability: "nonpayable",
2371
2090
  type: "function"
2372
2091
  },
2373
2092
  {
2374
- constant: true,
2375
2093
  inputs: [
2376
2094
  ],
2377
- name: "name",
2095
+ name: "decimals",
2378
2096
  outputs: [
2379
2097
  {
2380
- internalType: "string",
2098
+ internalType: "uint8",
2381
2099
  name: "",
2382
- type: "string"
2100
+ type: "uint8"
2383
2101
  }
2384
2102
  ],
2385
- payable: false,
2386
- stateMutability: "view",
2103
+ stateMutability: "pure",
2387
2104
  type: "function"
2388
2105
  },
2389
2106
  {
2390
- constant: true,
2391
2107
  inputs: [
2392
2108
  ],
2393
- name: "pendingAdmin",
2109
+ name: "factory",
2394
2110
  outputs: [
2395
2111
  {
2396
- internalType: "address payable",
2112
+ internalType: "address",
2397
2113
  name: "",
2398
2114
  type: "address"
2399
2115
  }
2400
2116
  ],
2401
- payable: false,
2402
2117
  stateMutability: "view",
2403
2118
  type: "function"
2404
2119
  },
2405
2120
  {
2406
- constant: true,
2407
2121
  inputs: [
2408
2122
  ],
2409
- name: "protocolSeizeShareMantissa",
2123
+ name: "getReserves",
2410
2124
  outputs: [
2411
2125
  {
2412
- internalType: "uint256",
2413
- name: "",
2414
- type: "uint256"
2126
+ internalType: "uint112",
2127
+ name: "reserve0",
2128
+ type: "uint112"
2129
+ },
2130
+ {
2131
+ internalType: "uint112",
2132
+ name: "reserve1",
2133
+ type: "uint112"
2134
+ },
2135
+ {
2136
+ internalType: "uint32",
2137
+ name: "blockTimestampLast",
2138
+ type: "uint32"
2415
2139
  }
2416
2140
  ],
2417
- payable: false,
2418
2141
  stateMutability: "view",
2419
2142
  type: "function"
2420
2143
  },
2421
2144
  {
2422
- constant: false,
2423
2145
  inputs: [
2424
2146
  {
2425
- internalType: "uint256",
2426
- name: "redeemTokens",
2427
- type: "uint256"
2428
- }
2429
- ],
2430
- name: "redeem",
2431
- outputs: [
2147
+ internalType: "address",
2148
+ name: "",
2149
+ type: "address"
2150
+ },
2432
2151
  {
2433
- internalType: "uint256",
2152
+ internalType: "address",
2434
2153
  name: "",
2435
- type: "uint256"
2154
+ type: "address"
2436
2155
  }
2437
2156
  ],
2438
- payable: false,
2157
+ name: "initialize",
2158
+ outputs: [
2159
+ ],
2439
2160
  stateMutability: "nonpayable",
2440
2161
  type: "function"
2441
2162
  },
2442
2163
  {
2443
- constant: false,
2444
2164
  inputs: [
2445
- {
2446
- internalType: "uint256",
2447
- name: "redeemAmount",
2448
- type: "uint256"
2449
- }
2450
2165
  ],
2451
- name: "redeemUnderlying",
2166
+ name: "kLast",
2452
2167
  outputs: [
2453
2168
  {
2454
2169
  internalType: "uint256",
@@ -2456,62 +2171,51 @@ var abi = [
2456
2171
  type: "uint256"
2457
2172
  }
2458
2173
  ],
2459
- payable: false,
2460
- stateMutability: "nonpayable",
2174
+ stateMutability: "view",
2461
2175
  type: "function"
2462
2176
  },
2463
2177
  {
2464
- constant: false,
2465
2178
  inputs: [
2466
2179
  {
2467
- internalType: "uint256",
2468
- name: "repayAmount",
2469
- type: "uint256"
2180
+ internalType: "address",
2181
+ name: "to",
2182
+ type: "address"
2470
2183
  }
2471
2184
  ],
2472
- name: "repayBorrow",
2185
+ name: "mint",
2473
2186
  outputs: [
2474
2187
  {
2475
2188
  internalType: "uint256",
2476
- name: "",
2189
+ name: "liquidity",
2477
2190
  type: "uint256"
2478
2191
  }
2479
2192
  ],
2480
- payable: false,
2481
2193
  stateMutability: "nonpayable",
2482
2194
  type: "function"
2483
2195
  },
2484
2196
  {
2485
- constant: false,
2486
2197
  inputs: [
2487
- {
2488
- internalType: "address",
2489
- name: "borrower",
2490
- type: "address"
2491
- },
2492
- {
2493
- internalType: "uint256",
2494
- name: "repayAmount",
2495
- type: "uint256"
2496
- }
2497
2198
  ],
2498
- name: "repayBorrowBehalf",
2199
+ name: "name",
2499
2200
  outputs: [
2500
2201
  {
2501
- internalType: "uint256",
2202
+ internalType: "string",
2502
2203
  name: "",
2503
- type: "uint256"
2204
+ type: "string"
2504
2205
  }
2505
2206
  ],
2506
- payable: false,
2507
- stateMutability: "nonpayable",
2207
+ stateMutability: "pure",
2508
2208
  type: "function"
2509
2209
  },
2510
2210
  {
2511
- constant: true,
2512
2211
  inputs: [
2212
+ {
2213
+ internalType: "address",
2214
+ name: "owner",
2215
+ type: "address"
2216
+ }
2513
2217
  ],
2514
- name: "reserveFactorMantissa",
2218
+ name: "nonces",
2515
2219
  outputs: [
2516
2220
  {
2517
2221
  internalType: "uint256",
@@ -2519,30 +2223,57 @@ var abi = [
2519
2223
  type: "uint256"
2520
2224
  }
2521
2225
  ],
2522
- payable: false,
2523
2226
  stateMutability: "view",
2524
2227
  type: "function"
2525
2228
  },
2526
2229
  {
2527
- constant: false,
2528
2230
  inputs: [
2529
2231
  {
2530
2232
  internalType: "address",
2531
- name: "liquidator",
2233
+ name: "owner",
2532
2234
  type: "address"
2533
2235
  },
2534
2236
  {
2535
2237
  internalType: "address",
2536
- name: "borrower",
2238
+ name: "spender",
2537
2239
  type: "address"
2538
2240
  },
2539
2241
  {
2540
2242
  internalType: "uint256",
2541
- name: "seizeTokens",
2243
+ name: "value",
2542
2244
  type: "uint256"
2245
+ },
2246
+ {
2247
+ internalType: "uint256",
2248
+ name: "deadline",
2249
+ type: "uint256"
2250
+ },
2251
+ {
2252
+ internalType: "uint8",
2253
+ name: "v",
2254
+ type: "uint8"
2255
+ },
2256
+ {
2257
+ internalType: "bytes32",
2258
+ name: "r",
2259
+ type: "bytes32"
2260
+ },
2261
+ {
2262
+ internalType: "bytes32",
2263
+ name: "s",
2264
+ type: "bytes32"
2543
2265
  }
2544
2266
  ],
2545
- name: "seize",
2267
+ name: "permit",
2268
+ outputs: [
2269
+ ],
2270
+ stateMutability: "nonpayable",
2271
+ type: "function"
2272
+ },
2273
+ {
2274
+ inputs: [
2275
+ ],
2276
+ name: "price0CumulativeLast",
2546
2277
  outputs: [
2547
2278
  {
2548
2279
  internalType: "uint256",
@@ -2550,15 +2281,13 @@ var abi = [
2550
2281
  type: "uint256"
2551
2282
  }
2552
2283
  ],
2553
- payable: false,
2554
- stateMutability: "nonpayable",
2284
+ stateMutability: "view",
2555
2285
  type: "function"
2556
2286
  },
2557
2287
  {
2558
- constant: true,
2559
2288
  inputs: [
2560
2289
  ],
2561
- name: "supplyRatePerTimestamp",
2290
+ name: "price1CumulativeLast",
2562
2291
  outputs: [
2563
2292
  {
2564
2293
  internalType: "uint256",
@@ -2566,28 +2295,53 @@ var abi = [
2566
2295
  type: "uint256"
2567
2296
  }
2568
2297
  ],
2569
- payable: false,
2570
2298
  stateMutability: "view",
2571
2299
  type: "function"
2572
2300
  },
2573
2301
  {
2574
- constant: false,
2575
2302
  inputs: [
2576
2303
  {
2577
- internalType: "contract EIP20NonStandardInterface",
2578
- name: "token",
2304
+ internalType: "address",
2305
+ name: "to",
2579
2306
  type: "address"
2580
2307
  }
2581
2308
  ],
2582
- name: "sweepToken",
2309
+ name: "skim",
2310
+ outputs: [
2311
+ ],
2312
+ stateMutability: "nonpayable",
2313
+ type: "function"
2314
+ },
2315
+ {
2316
+ inputs: [
2317
+ {
2318
+ internalType: "uint256",
2319
+ name: "amount0Out",
2320
+ type: "uint256"
2321
+ },
2322
+ {
2323
+ internalType: "uint256",
2324
+ name: "amount1Out",
2325
+ type: "uint256"
2326
+ },
2327
+ {
2328
+ internalType: "address",
2329
+ name: "to",
2330
+ type: "address"
2331
+ },
2332
+ {
2333
+ internalType: "bytes",
2334
+ name: "data",
2335
+ type: "bytes"
2336
+ }
2337
+ ],
2338
+ name: "swap",
2583
2339
  outputs: [
2584
2340
  ],
2585
- payable: false,
2586
2341
  stateMutability: "nonpayable",
2587
2342
  type: "function"
2588
2343
  },
2589
2344
  {
2590
- constant: true,
2591
2345
  inputs: [
2592
2346
  ],
2593
2347
  name: "symbol",
@@ -2598,60 +2352,47 @@ var abi = [
2598
2352
  type: "string"
2599
2353
  }
2600
2354
  ],
2601
- payable: false,
2602
- stateMutability: "view",
2355
+ stateMutability: "pure",
2603
2356
  type: "function"
2604
2357
  },
2605
2358
  {
2606
- constant: true,
2607
2359
  inputs: [
2608
2360
  ],
2609
- name: "totalBorrows",
2361
+ name: "sync",
2610
2362
  outputs: [
2611
- {
2612
- internalType: "uint256",
2613
- name: "",
2614
- type: "uint256"
2615
- }
2616
2363
  ],
2617
- payable: false,
2618
- stateMutability: "view",
2364
+ stateMutability: "nonpayable",
2619
2365
  type: "function"
2620
2366
  },
2621
2367
  {
2622
- constant: false,
2623
2368
  inputs: [
2624
2369
  ],
2625
- name: "totalBorrowsCurrent",
2370
+ name: "token0",
2626
2371
  outputs: [
2627
2372
  {
2628
- internalType: "uint256",
2373
+ internalType: "address",
2629
2374
  name: "",
2630
- type: "uint256"
2375
+ type: "address"
2631
2376
  }
2632
2377
  ],
2633
- payable: false,
2634
- stateMutability: "nonpayable",
2378
+ stateMutability: "view",
2635
2379
  type: "function"
2636
2380
  },
2637
2381
  {
2638
- constant: true,
2639
2382
  inputs: [
2640
2383
  ],
2641
- name: "totalReserves",
2384
+ name: "token1",
2642
2385
  outputs: [
2643
2386
  {
2644
- internalType: "uint256",
2387
+ internalType: "address",
2645
2388
  name: "",
2646
- type: "uint256"
2389
+ type: "address"
2647
2390
  }
2648
2391
  ],
2649
- payable: false,
2650
2392
  stateMutability: "view",
2651
2393
  type: "function"
2652
2394
  },
2653
2395
  {
2654
- constant: true,
2655
2396
  inputs: [
2656
2397
  ],
2657
2398
  name: "totalSupply",
@@ -2662,21 +2403,19 @@ var abi = [
2662
2403
  type: "uint256"
2663
2404
  }
2664
2405
  ],
2665
- payable: false,
2666
2406
  stateMutability: "view",
2667
2407
  type: "function"
2668
2408
  },
2669
2409
  {
2670
- constant: false,
2671
2410
  inputs: [
2672
2411
  {
2673
2412
  internalType: "address",
2674
- name: "dst",
2413
+ name: "to",
2675
2414
  type: "address"
2676
2415
  },
2677
2416
  {
2678
2417
  internalType: "uint256",
2679
- name: "amount",
2418
+ name: "value",
2680
2419
  type: "uint256"
2681
2420
  }
2682
2421
  ],
@@ -2688,26 +2427,24 @@ var abi = [
2688
2427
  type: "bool"
2689
2428
  }
2690
2429
  ],
2691
- payable: false,
2692
2430
  stateMutability: "nonpayable",
2693
2431
  type: "function"
2694
2432
  },
2695
2433
  {
2696
- constant: false,
2697
2434
  inputs: [
2698
2435
  {
2699
2436
  internalType: "address",
2700
- name: "src",
2437
+ name: "from",
2701
2438
  type: "address"
2702
2439
  },
2703
2440
  {
2704
2441
  internalType: "address",
2705
- name: "dst",
2442
+ name: "to",
2706
2443
  type: "address"
2707
2444
  },
2708
2445
  {
2709
2446
  internalType: "uint256",
2710
- name: "amount",
2447
+ name: "value",
2711
2448
  type: "uint256"
2712
2449
  }
2713
2450
  ],
@@ -2719,113 +2456,553 @@ var abi = [
2719
2456
  type: "bool"
2720
2457
  }
2721
2458
  ],
2722
- payable: false,
2723
2459
  stateMutability: "nonpayable",
2724
2460
  type: "function"
2725
- },
2726
- {
2727
- constant: true,
2728
- inputs: [
2729
- ],
2730
- name: "underlying",
2731
- outputs: [
2732
- {
2733
- internalType: "address",
2734
- name: "",
2735
- type: "address"
2736
- }
2737
- ],
2738
- payable: false,
2739
- stateMutability: "view",
2740
- type: "function"
2741
2461
  }
2742
2462
  ];
2743
- var AuToken = {
2744
- abi: abi
2463
+ var bytecode = "0x";
2464
+ var deployedBytecode = "0x";
2465
+ var linkReferences = {
2466
+ };
2467
+ var deployedLinkReferences = {
2468
+ };
2469
+ var IUniswapV2PairABI = {
2470
+ _format: _format,
2471
+ contractName: contractName,
2472
+ sourceName: sourceName,
2473
+ abi: abi$1,
2474
+ bytecode: bytecode,
2475
+ deployedBytecode: deployedBytecode,
2476
+ linkReferences: linkReferences,
2477
+ deployedLinkReferences: deployedLinkReferences
2745
2478
  };
2746
2479
 
2747
- var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2748
- _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
2480
+ var abi$2 = [
2481
+ ];
2482
+ var dummyABI = {
2483
+ abi: abi$2
2484
+ };
2485
+
2486
+ var axios = /*#__PURE__*/require('axios');
2487
+
2488
+ function fetchPriceFromCoingecko(_x) {
2489
+ return _fetchPriceFromCoingecko.apply(this, arguments);
2490
+ }
2491
+
2492
+ function _fetchPriceFromCoingecko() {
2493
+ _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
2494
+ var price;
2495
+ return runtime_1.wrap(function _callee$(_context) {
2496
+ while (1) {
2497
+ switch (_context.prev = _context.next) {
2498
+ case 0:
2499
+ _context.next = 2;
2500
+ return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
2501
+ return res.data;
2502
+ });
2503
+
2504
+ case 2:
2505
+ price = _context.sent;
2506
+ return _context.abrupt("return", new BigNumber(price[id].usd));
2507
+
2508
+ case 4:
2509
+ case "end":
2510
+ return _context.stop();
2511
+ }
2512
+ }
2513
+ }, _callee);
2514
+ }));
2515
+ return _fetchPriceFromCoingecko.apply(this, arguments);
2516
+ }
2517
+
2518
+ function fetchBasicTokenPrice(_x2) {
2519
+ return _fetchBasicTokenPrice.apply(this, arguments);
2520
+ }
2521
+
2522
+ function _fetchBasicTokenPrice() {
2523
+ _fetchBasicTokenPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
2524
+ return runtime_1.wrap(function _callee2$(_context2) {
2525
+ while (1) {
2526
+ switch (_context2.prev = _context2.next) {
2527
+ case 0:
2528
+ if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
2529
+ _context2.next = 4;
2530
+ break;
2531
+ }
2532
+
2533
+ return _context2.abrupt("return", fetchPriceFromCoingecko('aurora-near'));
2534
+
2535
+ case 4:
2536
+ throw Error("Unknown token " + address + " in fetchBasicTokenPrice");
2537
+
2538
+ case 5:
2539
+ case "end":
2540
+ return _context2.stop();
2541
+ }
2542
+ }
2543
+ }, _callee2);
2544
+ }));
2545
+ return _fetchBasicTokenPrice.apply(this, arguments);
2546
+ }
2547
+
2548
+ function fetchLPPositions(_x3, _x4) {
2549
+ return _fetchLPPositions.apply(this, arguments);
2550
+ }
2551
+
2552
+ function _fetchLPPositions() {
2553
+ _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(LPAddress, provider) {
2554
+ var promises, LPContract, values;
2555
+ return runtime_1.wrap(function _callee3$(_context3) {
2556
+ while (1) {
2557
+ switch (_context3.prev = _context3.next) {
2558
+ case 0:
2559
+ promises = [];
2560
+ LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
2561
+ promises.push(LPContract.token0());
2562
+ promises.push(LPContract.toekn1());
2563
+ promises.push(LPContract.getReserves());
2564
+ promises.push(LPContract.totalSupply());
2565
+ _context3.next = 8;
2566
+ return Promise.all(promises);
2567
+
2568
+ case 8:
2569
+ values = _context3.sent;
2570
+ return _context3.abrupt("return", {
2571
+ token0: values[0],
2572
+ token1: values[1],
2573
+ reserve0: values[2]._reserve0,
2574
+ reserve1: values[2]._reserve1,
2575
+ totalSupply: values[3]
2576
+ });
2577
+
2578
+ case 10:
2579
+ case "end":
2580
+ return _context3.stop();
2581
+ }
2582
+ }
2583
+ }, _callee3);
2584
+ }));
2585
+ return _fetchLPPositions.apply(this, arguments);
2586
+ }
2587
+
2588
+ function fetchLPPrice(_x5, _x6) {
2589
+ return _fetchLPPrice.apply(this, arguments);
2590
+ }
2591
+
2592
+ function _fetchLPPrice() {
2593
+ _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(address, provider) {
2594
+ var LPInfo, token0Price, reserveUSD, token1Price, _reserveUSD;
2595
+
2596
+ return runtime_1.wrap(function _callee4$(_context4) {
2597
+ while (1) {
2598
+ switch (_context4.prev = _context4.next) {
2599
+ case 0:
2600
+ _context4.next = 2;
2601
+ return fetchLPPositions(address, provider);
2602
+
2603
+ case 2:
2604
+ LPInfo = _context4.sent;
2605
+ _context4.prev = 3;
2606
+ _context4.next = 6;
2607
+ return fetchPrice(LPInfo.token0, provider);
2608
+
2609
+ case 6:
2610
+ token0Price = _context4.sent;
2611
+ reserveUSD = token0Price.multipliedBy(LPInfo.reserve0.toString()).multipliedBy(2);
2612
+ return _context4.abrupt("return", reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2613
+
2614
+ case 11:
2615
+ _context4.prev = 11;
2616
+ _context4.t0 = _context4["catch"](3);
2617
+ _context4.prev = 13;
2618
+ _context4.next = 16;
2619
+ return fetchPrice(LPInfo.token1, provider);
2620
+
2621
+ case 16:
2622
+ token1Price = _context4.sent;
2623
+ _reserveUSD = token1Price.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(2);
2624
+ return _context4.abrupt("return", _reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2625
+
2626
+ case 21:
2627
+ _context4.prev = 21;
2628
+ _context4.t1 = _context4["catch"](13);
2629
+ throw Error("Unable to fetch price for both tokens of LP " + address);
2630
+
2631
+ case 24:
2632
+ case "end":
2633
+ return _context4.stop();
2634
+ }
2635
+ }
2636
+ }, _callee4, null, [[3, 11], [13, 21]]);
2637
+ }));
2638
+ return _fetchLPPrice.apply(this, arguments);
2639
+ }
2640
+
2641
+ function processPriceFromOracle(rawPrice, underlyingDecimal) {
2642
+ return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
2643
+ }
2644
+
2645
+ function fetchPriceFromOracle(_x7, _x8, _x9) {
2646
+ return _fetchPriceFromOracle.apply(this, arguments);
2647
+ }
2648
+
2649
+ function _fetchPriceFromOracle() {
2650
+ _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(auTokenAddress, underlyingDecimal, provider) {
2651
+ var oracleContract, rawPrice;
2652
+ return runtime_1.wrap(function _callee5$(_context5) {
2653
+ while (1) {
2654
+ switch (_context5.prev = _context5.next) {
2655
+ case 0:
2656
+ oracleContract = new Contract(networkAddresses.misc.oracle, OracleABI.abi, provider);
2657
+ _context5.next = 3;
2658
+ return oracleContract.getUnderlyingPrice(auTokenAddress);
2659
+
2660
+ case 3:
2661
+ rawPrice = _context5.sent;
2662
+ return _context5.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2663
+
2664
+ case 5:
2665
+ case "end":
2666
+ return _context5.stop();
2667
+ }
2668
+ }
2669
+ }, _callee5);
2670
+ }));
2671
+ return _fetchPriceFromOracle.apply(this, arguments);
2672
+ }
2673
+
2674
+ function fetchUnderlyingTokensPrices(_x10) {
2675
+ return _fetchUnderlyingTokensPrices.apply(this, arguments);
2676
+ }
2677
+
2678
+ function _fetchUnderlyingTokensPrices() {
2679
+ _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
2680
+ var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
2681
+ return runtime_1.wrap(function _callee6$(_context6) {
2682
+ while (1) {
2683
+ switch (_context6.prev = _context6.next) {
2684
+ case 0:
2685
+ auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, provider);
2686
+ auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
2687
+ return auToken.address;
2688
+ });
2689
+ underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
2690
+ return getDecimal(auToken.underlying);
2691
+ });
2692
+ _context6.next = 5;
2693
+ return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
2694
+
2695
+ case 5:
2696
+ rawPrices = _context6.sent;
2697
+ return _context6.abrupt("return", rawPrices.map(function (res, ind) {
2698
+ return {
2699
+ auToken: res.auToken,
2700
+ underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
2701
+ };
2702
+ }));
2703
+
2704
+ case 7:
2705
+ case "end":
2706
+ return _context6.stop();
2707
+ }
2708
+ }
2709
+ }, _callee6);
2710
+ }));
2711
+ return _fetchUnderlyingTokensPrices.apply(this, arguments);
2712
+ }
2713
+
2714
+ function fetchPrice(_x11, _x12) {
2715
+ return _fetchPrice.apply(this, arguments);
2716
+ }
2717
+
2718
+ function _fetchPrice() {
2719
+ _fetchPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(address, provider) {
2720
+ var matchingAuToken;
2721
+ return runtime_1.wrap(function _callee7$(_context7) {
2722
+ while (1) {
2723
+ switch (_context7.prev = _context7.next) {
2724
+ case 0:
2725
+ matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2726
+ return isSameAddress(auToken.underlying, address);
2727
+ });
2728
+
2729
+ if (!(matchingAuToken !== undefined)) {
2730
+ _context7.next = 5;
2731
+ break;
2732
+ }
2733
+
2734
+ return _context7.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2735
+
2736
+ case 5:
2737
+ if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
2738
+ _context7.next = 9;
2739
+ break;
2740
+ }
2741
+
2742
+ return _context7.abrupt("return", fetchLPPrice(address, provider));
2743
+
2744
+ case 9:
2745
+ return _context7.abrupt("return", fetchBasicTokenPrice(address));
2746
+
2747
+ case 10:
2748
+ case "end":
2749
+ return _context7.stop();
2750
+ }
2751
+ }
2752
+ }, _callee7);
2753
+ }));
2754
+ return _fetchPrice.apply(this, arguments);
2755
+ }
2756
+
2757
+ function fetchValuation(_x13, _x14, _x15) {
2758
+ return _fetchValuation.apply(this, arguments);
2759
+ }
2760
+
2761
+ function _fetchValuation() {
2762
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(tokenAmount, provider, price) {
2763
+ return runtime_1.wrap(function _callee8$(_context8) {
2764
+ while (1) {
2765
+ switch (_context8.prev = _context8.next) {
2766
+ case 0:
2767
+ return _context8.abrupt("return", new BigNumber(0));
2768
+
2769
+ case 1:
2770
+ case "end":
2771
+ return _context8.stop();
2772
+ }
2773
+ }
2774
+ }, _callee8);
2775
+ }));
2776
+ return _fetchValuation.apply(this, arguments);
2777
+ }
2778
+
2779
+ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2780
+ _inheritsLoose(SdkRead, _BlockchainEntityRead);
2749
2781
 
2750
- function MoneyMarketRead(providerOrSigner, auToken) {
2782
+ function SdkRead(networkConnection) {
2751
2783
  var _this;
2752
2784
 
2753
- _this = _BlockchainEntityRead.call(this, providerOrSigner) || this;
2754
- _this._auToken = new Contract(auToken, AuToken.abi, providerOrSigner);
2785
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
2786
+ _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
2787
+ _this._tokenLock = new Contract(networkAddresses.misc.TOKENLOCK, TokenLockABI.abi, networkConnection.provider);
2788
+ _this._auriFairLaunch = new Contract(networkAddresses.misc.AURIFAIRLAUNCH, AuriFairLaunchABI.abi, networkConnection.provider);
2789
+ _this._auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, networkConnection.provider);
2755
2790
  return _this;
2756
2791
  }
2757
2792
 
2758
- var _proto = MoneyMarketRead.prototype;
2793
+ var _proto = SdkRead.prototype;
2759
2794
 
2760
- _proto.getDetails = /*#__PURE__*/function () {
2761
- var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2795
+ _proto.getLockingDetails = /*#__PURE__*/function () {
2796
+ var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2797
+ var currentTime, currentWeek, denominator, promises, values;
2762
2798
  return runtime_1.wrap(function _callee$(_context) {
2763
2799
  while (1) {
2764
2800
  switch (_context.prev = _context.next) {
2765
2801
  case 0:
2802
+ _context.next = 2;
2803
+ return getCurrentTimestamp(this._networkConnection.provider);
2804
+
2805
+ case 2:
2806
+ currentTime = _context.sent;
2807
+ currentWeek = BigNumber$1.from(currentTime - REWARDCLAIMSTART).div(7 * ONE_DAY).toNumber();
2808
+ denominator = 10000;
2809
+ promises = [];
2810
+ promises.push(this._tokenLock.percentageLock(currentWeek));
2811
+ promises.push(this._tokenLock.percentageLock(currentWeek + 1)["catch"](function (err) {
2812
+ return denominator;
2813
+ }));
2814
+ _context.next = 10;
2815
+ return Promise.all(promises).then(function (res) {
2816
+ return res.map(function (v) {
2817
+ return v.toString();
2818
+ });
2819
+ });
2820
+
2821
+ case 10:
2822
+ values = _context.sent;
2766
2823
  return _context.abrupt("return", {
2767
- auTokenAddress: '0x1111111111111111111111111111111111111111',
2768
- totalTokenDeposited: dummyTokenAmount,
2769
- totalTokenBorrowed: dummyTokenAmount2,
2770
- depositApy: 0.1234,
2771
- depositPlyApy: 0.2345,
2772
- borrowApy: 0.24,
2773
- borrowPlyApy: 0.18,
2774
- collateralRatio: 0.7
2824
+ vestingStart: REWARDCLAIMSTART,
2825
+ currentUnlockPortion: new BigNumber(values[0]).div(denominator).toNumber(),
2826
+ nextUnlockPortion: new BigNumber(values[1]).div(denominator).toNumber()
2775
2827
  });
2776
2828
 
2777
- case 1:
2829
+ case 12:
2778
2830
  case "end":
2779
2831
  return _context.stop();
2780
2832
  }
2781
2833
  }
2782
- }, _callee);
2834
+ }, _callee, this);
2783
2835
  }));
2784
2836
 
2785
- function getDetails() {
2786
- return _getDetails.apply(this, arguments);
2837
+ function getLockingDetails() {
2838
+ return _getLockingDetails.apply(this, arguments);
2787
2839
  }
2788
2840
 
2789
- return getDetails;
2841
+ return getLockingDetails;
2790
2842
  }();
2791
2843
 
2792
- return MoneyMarketRead;
2793
- }(BlockchainEntityRead);
2794
- var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2795
- _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
2844
+ _proto.getUserDetails = /*#__PURE__*/function () {
2845
+ var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
2846
+ var _this2 = this;
2796
2847
 
2797
- function MoneyMarketReadWrite() {
2798
- var _this2;
2848
+ var marketCount, userMarketDetails, assetsIn, collateralRatio, promises, totalBorrowLimit, pricePromises, _loop2, _iterator, _step, underlyingPrices, depositValuationPromises, _loop, i, depositValues, accountLiquidity, rewardBalancesMetadata, lockedAmount, values, borrowedvaluation, bufferedBorrowLimit, borrowableAmount, auToken, moneyMarket;
2799
2849
 
2800
- _this2 = _MoneyMarketRead.apply(this, arguments) || this;
2801
- _this2.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2802
2850
  return runtime_1.wrap(function _callee2$(_context2) {
2803
2851
  while (1) {
2804
2852
  switch (_context2.prev = _context2.next) {
2805
2853
  case 0:
2806
- return _context2.abrupt("return", {});
2854
+ marketCount = networkAddresses.auTokens.length;
2855
+ userMarketDetails = [];
2856
+ promises = [];
2857
+ totalBorrowLimit = new BigNumber(0);
2858
+ pricePromises = [];
2859
+
2860
+ _loop2 = function _loop2() {
2861
+ var auToken = _step.value;
2862
+ var userMarketDetail = {};
2863
+ userMarketDetails.push(userMarketDetail);
2864
+ userMarketDetail.market = auToken.underlying;
2865
+ var moneyMarket = new MoneyMarketRead(_this2._networkConnection, auToken.address, auToken.underlying);
2866
+ promises.push(moneyMarket.getUserDepositBalance(userAddress).then(function (res) {
2867
+ userMarketDetail.depositBalance = res;
2868
+ }));
2869
+ promises.push(moneyMarket.getUserBorrowBalance(userAddress).then(function (res) {
2870
+ userMarketDetail.borrowBalance = res;
2871
+ }));
2872
+ promises.push(moneyMarket.getCollateralRatio().then(function (res) {
2873
+ collateralRatio[i] = res;
2874
+ }));
2875
+ pricePromises.push(fetchPrice(moneyMarket.underlying.address, _this2._networkConnection.provider));
2876
+ };
2877
+
2878
+ for (_iterator = _createForOfIteratorHelperLoose(networkAddresses.auTokens); !(_step = _iterator()).done;) {
2879
+ _loop2();
2880
+ }
2807
2881
 
2808
- case 1:
2882
+ promises.push(this._comptroller.getAssetsIn(userAddress).then(function (res) {
2883
+ assetsIn = res;
2884
+ }));
2885
+ _context2.next = 10;
2886
+ return Promise.all(promises);
2887
+
2888
+ case 10:
2889
+ _context2.next = 12;
2890
+ return Promise.all(pricePromises);
2891
+
2892
+ case 12:
2893
+ underlyingPrices = _context2.sent;
2894
+ depositValuationPromises = [];
2895
+
2896
+ _loop = function _loop() {
2897
+ var auToken = networkAddresses.auTokens[i];
2898
+
2899
+ if (assetsIn.filter(function (auAddress) {
2900
+ isSameAddress(auToken.address, auAddress);
2901
+ }).length > 0) {
2902
+ userMarketDetails[i].isCollateral = true;
2903
+ }
2904
+
2905
+ depositValuationPromises.push(fetchValuation(userMarketDetails[i].depositBalance, _this2._networkConnection.provider, underlyingPrices[i]));
2906
+ };
2907
+
2908
+ for (i = 0; i < marketCount; i++) {
2909
+ _loop();
2910
+ }
2911
+
2912
+ _context2.next = 18;
2913
+ return Promise.all(depositValuationPromises);
2914
+
2915
+ case 18:
2916
+ depositValues = _context2.sent;
2917
+ totalBorrowLimit = depositValues.reduce(function (p, v, index) {
2918
+ if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(collateralRatio[index]));
2919
+ return p;
2920
+ });
2921
+ promises = [];
2922
+ promises.push(this._comptroller.getAccountLiquidity(userAddress));
2923
+ promises.push(this._auriLens.getRewardBalancesMetadata(this._comptroller.address, userAddress));
2924
+ promises.push(this._tokenLock.lockedAmounts(userAddress));
2925
+ _context2.next = 26;
2926
+ return Promise.all(promises);
2927
+
2928
+ case 26:
2929
+ values = _context2.sent;
2930
+ accountLiquidity = values[0];
2931
+ rewardBalancesMetadata = values[1];
2932
+ lockedAmount = values[2];
2933
+ borrowedvaluation = totalBorrowLimit.minus(new BigNumber(accountLiquidity[1].toString()).div(decimalFactor(18)));
2934
+ bufferedBorrowLimit = totalBorrowLimit.multipliedBy(BORROW_LIMIT_BUFFER);
2935
+
2936
+ if (bufferedBorrowLimit.lte(borrowedvaluation)) {
2937
+ borrowableAmount = new BigNumber(0);
2938
+ } else {
2939
+ borrowableAmount = bufferedBorrowLimit.minus(borrowedvaluation);
2940
+ }
2941
+
2942
+ for (i = 0; i < marketCount; i++) {
2943
+ auToken = networkAddresses.auTokens[i];
2944
+ moneyMarket = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
2945
+ userMarketDetails[i].maxWithdrawableAmount = new TokenAmount(moneyMarket.underlying, borrowableAmount.div(underlyingPrices[i]).toFixed(18));
2946
+ }
2947
+
2948
+ return _context2.abrupt("return", {
2949
+ markets: userMarketDetails,
2950
+ borrowLimit: {
2951
+ currency: "USD",
2952
+ amount: bufferedBorrowLimit.toFixed(DECIMAL_PRECISION)
2953
+ },
2954
+ accruedPly: new TokenAmount(PLYToken, rewardBalancesMetadata.plyAccrued.toString()),
2955
+ lockedPly: new TokenAmount(PLYToken, lockedAmount.toString()),
2956
+ borrowableAmount: {
2957
+ currency: "USD",
2958
+ amount: borrowableAmount.toFixed(DECIMAL_PRECISION)
2959
+ }
2960
+ });
2961
+
2962
+ case 35:
2809
2963
  case "end":
2810
2964
  return _context2.stop();
2811
2965
  }
2812
2966
  }
2813
- }, _callee2);
2967
+ }, _callee2, this);
2814
2968
  }));
2815
- return _this2;
2816
- }
2817
2969
 
2818
- var _proto2 = MoneyMarketReadWrite.prototype;
2970
+ function getUserDetails(_x) {
2971
+ return _getUserDetails.apply(this, arguments);
2972
+ }
2819
2973
 
2820
- _proto2.deposit = /*#__PURE__*/function () {
2821
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(amount) {
2974
+ return getUserDetails;
2975
+ }();
2976
+
2977
+ _proto.getPlyAuroraPoolDetails = /*#__PURE__*/function () {
2978
+ var _getPlyAuroraPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2979
+ var stakedLiquidity, rewardPerSecond, promises, rewardPerSecondValuation, totalStakeValuation;
2822
2980
  return runtime_1.wrap(function _callee3$(_context3) {
2823
2981
  while (1) {
2824
2982
  switch (_context3.prev = _context3.next) {
2825
2983
  case 0:
2826
- return _context3.abrupt("return", this.dummyTransaction());
2984
+ promises = [];
2985
+ promises.push(this._auriFairLaunch.getPoolInfo(AurPlyPid).then(function (res) {
2986
+ stakedLiquidity = res.totalStake;
2987
+ rewardPerSecond = res.rewardPerSecond;
2988
+ }));
2989
+ _context3.next = 4;
2990
+ return Promise.all(promises);
2991
+
2992
+ case 4:
2993
+ promises = [];
2994
+ promises.push(fetchValuation(new TokenAmount(PLYToken, rewardPerSecond.toString()), this._networkConnection.provider).then(function (res) {
2995
+ return rewardPerSecondValuation = res;
2996
+ }));
2997
+ promises.push(fetchValuation(new TokenAmount(AURPLYToken, stakedLiquidity.toString()), this._networkConnection.provider).then(function (res) {
2998
+ return totalStakeValuation = res;
2999
+ }));
3000
+ return _context3.abrupt("return", {
3001
+ totalStakedLiquidity: new TokenAmount(AURPLYToken, stakedLiquidity.toString()),
3002
+ apy: calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION)
3003
+ });
2827
3004
 
2828
- case 1:
3005
+ case 8:
2829
3006
  case "end":
2830
3007
  return _context3.stop();
2831
3008
  }
@@ -2833,22 +3010,31 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2833
3010
  }, _callee3, this);
2834
3011
  }));
2835
3012
 
2836
- function deposit(_x) {
2837
- return _deposit.apply(this, arguments);
3013
+ function getPlyAuroraPoolDetails() {
3014
+ return _getPlyAuroraPoolDetails.apply(this, arguments);
2838
3015
  }
2839
3016
 
2840
- return deposit;
3017
+ return getPlyAuroraPoolDetails;
2841
3018
  }();
2842
3019
 
2843
- _proto2.borrow = /*#__PURE__*/function () {
2844
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(amount) {
3020
+ _proto.getTokenPrice = /*#__PURE__*/function () {
3021
+ var _getTokenPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
3022
+ var price;
2845
3023
  return runtime_1.wrap(function _callee4$(_context4) {
2846
3024
  while (1) {
2847
3025
  switch (_context4.prev = _context4.next) {
2848
3026
  case 0:
2849
- return _context4.abrupt("return", this.dummyTransaction());
3027
+ _context4.next = 2;
3028
+ return fetchPrice(token.address, this._networkConnection.provider);
2850
3029
 
2851
- case 1:
3030
+ case 2:
3031
+ price = _context4.sent;
3032
+ return _context4.abrupt("return", {
3033
+ currency: "USD",
3034
+ amount: price.toFixed(DECIMAL_PRECISION)
3035
+ });
3036
+
3037
+ case 4:
2852
3038
  case "end":
2853
3039
  return _context4.stop();
2854
3040
  }
@@ -2856,22 +3042,28 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2856
3042
  }, _callee4, this);
2857
3043
  }));
2858
3044
 
2859
- function borrow(_x2) {
2860
- return _borrow.apply(this, arguments);
3045
+ function getTokenPrice(_x2) {
3046
+ return _getTokenPrice.apply(this, arguments);
2861
3047
  }
2862
3048
 
2863
- return borrow;
3049
+ return getTokenPrice;
2864
3050
  }();
2865
3051
 
2866
- _proto2.withdraw = /*#__PURE__*/function () {
2867
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(amount) {
3052
+ _proto.stakeBalanceOf = /*#__PURE__*/function () {
3053
+ var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
3054
+ var userInfo;
2868
3055
  return runtime_1.wrap(function _callee5$(_context5) {
2869
3056
  while (1) {
2870
3057
  switch (_context5.prev = _context5.next) {
2871
3058
  case 0:
2872
- return _context5.abrupt("return", this.dummyTransaction());
3059
+ _context5.next = 2;
3060
+ return this._auriFairLaunch.getUserInfo(AurPlyPid, user);
2873
3061
 
2874
- case 1:
3062
+ case 2:
3063
+ userInfo = _context5.sent;
3064
+ return _context5.abrupt("return", new TokenAmount(AURPLYToken, userInfo.amount.toString()));
3065
+
3066
+ case 4:
2875
3067
  case "end":
2876
3068
  return _context5.stop();
2877
3069
  }
@@ -2879,22 +3071,42 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2879
3071
  }, _callee5, this);
2880
3072
  }));
2881
3073
 
2882
- function withdraw(_x3) {
2883
- return _withdraw.apply(this, arguments);
3074
+ function stakeBalanceOf(_x3) {
3075
+ return _stakeBalanceOf.apply(this, arguments);
2884
3076
  }
2885
3077
 
2886
- return withdraw;
3078
+ return stakeBalanceOf;
2887
3079
  }();
2888
3080
 
2889
- _proto2.repay = /*#__PURE__*/function () {
2890
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(amount) {
3081
+ return SdkRead;
3082
+ }(BlockchainEntityRead);
3083
+ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
3084
+ _inheritsLoose(SdkReadWrite, _SdkRead);
3085
+
3086
+ function SdkReadWrite() {
3087
+ return _SdkRead.apply(this, arguments) || this;
3088
+ }
3089
+
3090
+ var _proto2 = SdkReadWrite.prototype;
3091
+
3092
+ _proto2.claim = /*#__PURE__*/function () {
3093
+ var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2891
3094
  return runtime_1.wrap(function _callee6$(_context6) {
2892
3095
  while (1) {
2893
3096
  switch (_context6.prev = _context6.next) {
2894
3097
  case 0:
2895
- return _context6.abrupt("return", this.dummyTransaction());
2896
-
2897
- case 1:
3098
+ _context6.t0 = this._auriLens.connect(this._networkConnection.signer);
3099
+ _context6.t1 = this._comptroller.address;
3100
+ _context6.t2 = this._auriFairLaunch.address;
3101
+ _context6.next = 5;
3102
+ return this._networkConnection.signer.getAddress();
3103
+
3104
+ case 5:
3105
+ _context6.t3 = _context6.sent;
3106
+ _context6.t4 = [AurPlyPid];
3107
+ return _context6.abrupt("return", _context6.t0.claimRewards.call(_context6.t0, _context6.t1, _context6.t2, _context6.t3, _context6.t4));
3108
+
3109
+ case 8:
2898
3110
  case "end":
2899
3111
  return _context6.stop();
2900
3112
  }
@@ -2902,20 +3114,20 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2902
3114
  }, _callee6, this);
2903
3115
  }));
2904
3116
 
2905
- function repay(_x4) {
2906
- return _repay.apply(this, arguments);
3117
+ function claim() {
3118
+ return _claim.apply(this, arguments);
2907
3119
  }
2908
3120
 
2909
- return repay;
3121
+ return claim;
2910
3122
  }();
2911
3123
 
2912
- _proto2.enableCollateral = /*#__PURE__*/function () {
2913
- var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
3124
+ _proto2.stake = /*#__PURE__*/function () {
3125
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount) {
2914
3126
  return runtime_1.wrap(function _callee7$(_context7) {
2915
3127
  while (1) {
2916
3128
  switch (_context7.prev = _context7.next) {
2917
3129
  case 0:
2918
- return _context7.abrupt("return", this.dummyTransaction());
3130
+ return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(AurPlyPid, amount.rawAmount(), false));
2919
3131
 
2920
3132
  case 1:
2921
3133
  case "end":
@@ -2925,20 +3137,20 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2925
3137
  }, _callee7, this);
2926
3138
  }));
2927
3139
 
2928
- function enableCollateral() {
2929
- return _enableCollateral.apply(this, arguments);
3140
+ function stake(_x4) {
3141
+ return _stake.apply(this, arguments);
2930
3142
  }
2931
3143
 
2932
- return enableCollateral;
3144
+ return stake;
2933
3145
  }();
2934
3146
 
2935
- _proto2.disableCollateral = /*#__PURE__*/function () {
2936
- var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
3147
+ _proto2.unstake = /*#__PURE__*/function () {
3148
+ var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
2937
3149
  return runtime_1.wrap(function _callee8$(_context8) {
2938
3150
  while (1) {
2939
3151
  switch (_context8.prev = _context8.next) {
2940
3152
  case 0:
2941
- return _context8.abrupt("return", this.dummyTransaction());
3153
+ return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(AurPlyPid, amount.rawAmount()));
2942
3154
 
2943
3155
  case 1:
2944
3156
  case "end":
@@ -2948,38 +3160,50 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2948
3160
  }, _callee8, this);
2949
3161
  }));
2950
3162
 
2951
- function disableCollateral() {
2952
- return _disableCollateral.apply(this, arguments);
3163
+ function unstake(_x5) {
3164
+ return _unstake.apply(this, arguments);
2953
3165
  }
2954
3166
 
2955
- return disableCollateral;
3167
+ return unstake;
2956
3168
  }();
2957
3169
 
2958
- return MoneyMarketReadWrite;
2959
- }(MoneyMarketRead);
2960
- var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
2961
- _inheritsLoose(MoneyMarket, _BlockchainEntity);
2962
-
2963
- function MoneyMarket(address) {
2964
- var _this3;
3170
+ return SdkReadWrite;
3171
+ }(SdkRead);
3172
+ var SDK = /*#__PURE__*/function (_BlockchainEntity) {
3173
+ _inheritsLoose(SDK, _BlockchainEntity);
2965
3174
 
2966
- _this3 = _BlockchainEntity.call(this) || this;
2967
- _this3.address = validateAndParseAddress(address);
2968
- return _this3;
3175
+ function SDK() {
3176
+ return _BlockchainEntity.call(this) || this;
2969
3177
  }
2970
3178
 
2971
- var _proto3 = MoneyMarket.prototype;
3179
+ var _proto3 = SDK.prototype;
2972
3180
 
2973
- _proto3.read = function read(provider) {
2974
- return new MoneyMarketRead(provider, this.address);
3181
+ _proto3.read = function read(networkConnection) {
3182
+ return new SdkRead(networkConnection);
2975
3183
  };
2976
3184
 
2977
- return MoneyMarket;
3185
+ SDK.defaultProvider = function defaultProvider() {
3186
+ return new ethers$1.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
3187
+ };
3188
+
3189
+ return SDK;
2978
3190
  }(BlockchainEntity);
2979
3191
 
2980
- function sum(a, b) {
2981
- return a + b;
2982
- }
3192
+ var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
3193
+ var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
3194
+ var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
3195
+ var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
3196
+ var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
3197
+ var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
3198
+ var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
3199
+ var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
3200
+ var dummyUserMarketDetails = {
3201
+ market: dummyMarketAddress,
3202
+ depositBalance: dummyTokenAmount2,
3203
+ borrowBalance: dummyZeroTokenAmount,
3204
+ isCollateral: true,
3205
+ maxWithdrawableAmount: dummyTokenAmount
3206
+ };
2983
3207
 
2984
- export { AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, DOLLAR, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, SDK, SdkRead, SdkReadWrite, decimalFactor, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, formatObject, sum, validateAndParseAddress };
3208
+ export { AURORA_CHAINID, AURPLYToken, AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, AurPlyPid, BORROW_LIMIT_BUFFER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, DECIMAL_PRECISION, ETHAddress, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, PLYToken, REWARDCLAIMSTART, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, calcLMRewardApr, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchBasicTokenPrice, fetchLPPositions, fetchLPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromOracle, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress };
2985
3209
  //# sourceMappingURL=sdk.esm.js.map