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