@aurigami/sdk 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.esm.js CHANGED
@@ -4,6 +4,7 @@ import { BigNumber as BigNumber$1, utils, Contract, ethers as ethers$1 } from 'e
4
4
  import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
5
  import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
6
6
  import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
7
+ import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
7
8
  import TokenLockABI from '@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json';
8
9
  import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
9
10
 
@@ -898,70 +899,71 @@ var AURORA_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(
898
899
  var dummyAddress = "0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE";
899
900
  var ETHAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
900
901
  var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
901
- var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
902
+ var AURORA_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey, AURORA_DEFAULT_PROVIDER);
902
903
  var AURORA_CHAINID = 1313161554;
903
904
  var DECIMAL_PRECISION = 6;
904
905
  var networkAddresses = {
905
906
  auTokens: [{
906
- address: '0x7967532568bef9ec96cfad6badea4c63add5888a',
907
- underlying: '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8'
907
+ address: /*#__PURE__*/'0xA21d86e113f161fa05d3cf767ef19Ccec1BD4889'.toLowerCase(),
908
+ underlying: /*#__PURE__*/'0x9Daf3f62cE9e53B8cd850a1ad392b632eAF7419F'.toLowerCase()
908
909
  }, {
909
- address: '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60',
910
- underlying: ETHAddress
910
+ address: /*#__PURE__*/'0xFa4A1B4137B66d69E5af8a0f63591D62A8c14446'.toLowerCase(),
911
+ underlying: /*#__PURE__*/ETHAddress.toLowerCase()
911
912
  }, {
912
- address: '0xccf005cfc3669d806a03f0617885648c397c456e',
913
- underlying: '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6'
913
+ address: /*#__PURE__*/'0x1B8A94C4C9A1496E274B153e0756F1836AeaBB30'.toLowerCase(),
914
+ underlying: /*#__PURE__*/'0x68862668FEdd002dA008596A56C5ea29921E94e6'.toLowerCase()
914
915
  }, {
915
- address: '0x55a4c111c007f39326edf22cfd63bbbb21a35b35',
916
- underlying: '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369'
916
+ address: /*#__PURE__*/'0x5f8E0b6b049fecabC16AD7d23b5F311c48555fA6'.toLowerCase(),
917
+ underlying: /*#__PURE__*/'0xc0a00D761E569007a707aA84A9A08837cb6A04c1'.toLowerCase()
917
918
  }, {
918
- address: '0x77b088236c071ab5bd4e0bd21240b093275adffc',
919
- underlying: '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18'
919
+ address: /*#__PURE__*/'0xeee0A0BC4dc3999136f35f82DdaAC3c27Ed05017'.toLowerCase(),
920
+ underlying: /*#__PURE__*/'0x5231CfaF5BD3Aa0C9423703a72706B2D40f0b783'.toLowerCase()
920
921
  }, {
921
- address: '0xaa68274f87fd9ae940f1dec31b643486838481c1',
922
- underlying: '0x7a80df8230c5aa711e2702a275ab31aeb32754bf'
922
+ address: /*#__PURE__*/'0x9Fc4f60DC140645978C53703acE6241448cFEaA8'.toLowerCase(),
923
+ underlying: /*#__PURE__*/'0xf7c51293c5eE5c76867d8Cf400627627a4Bd8697'.toLowerCase()
923
924
  }, {
924
- address: '0x6970167dfaa2aaa67404204102cbbd18b405eca9',
925
- underlying: '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428'
925
+ address: /*#__PURE__*/'0x533dBEC840f10f51B868453f86BDF211Fbc52Ba4'.toLowerCase(),
926
+ underlying: /*#__PURE__*/'0xaa847c16359bAA930ba8a5E8b6e41D6b63ABe505'.toLowerCase()
926
927
  }, {
927
- address: '0x9630a6c5b729194972199805075fd76707a9713a',
928
- underlying: '0x6f8a1daa158e08f75711a64e5a3073e959d688a6'
928
+ address: /*#__PURE__*/'0xDA748E324F4e05e1D9f517242C928A01C418c910'.toLowerCase(),
929
+ underlying: /*#__PURE__*/'0x206EA0Ae49F80d0376d04932479e33Cf2098211A'.toLowerCase()
929
930
  }],
930
931
  misc: {
931
- COMPTROLLER: "0xb51028d4f3fc69e3f9e3118ce067a4562c595aad",
932
- oracle: "0xf1ebfaa2af93f4d82215fd7817c1835853c62fb8",
933
- AURIFAIRLAUNCH: "0x7942874a9ef8059c5de259625a883dc61f03320d",
934
- AURILENS: '0xa2635a23a7688cd3acdd07713c4943b2f0f9082c'
932
+ COMPTROLLER: /*#__PURE__*/"0x77499F2F82cF45F34287816875794363098cD3e1".toLowerCase(),
933
+ oracle: /*#__PURE__*/"0x38d71afF809941Cd67938f44a827E11F322e8859".toLowerCase(),
934
+ AURIFAIRLAUNCH: /*#__PURE__*/"0x7B0a44390d6be7772438767c392868Db493f85e5".toLowerCase(),
935
+ AURILENS: /*#__PURE__*/'0xF48698990DaEA17a5efAca49293e68c589E292D4'.toLowerCase(),
936
+ TOKENLOCK: /*#__PURE__*/'0x5D2Be450734e880776D21942A6297F6492A35cfD'.toLowerCase()
935
937
  },
936
938
  tokens: {
937
- AURORA: "0x7a80df8230c5aa711e2702a275ab31aeb32754bf",
938
- PLY: "0x6f8a1daa158e08f75711a64e5a3073e959d688a6",
939
- AURPLY: dummyAddress
939
+ AURORA: /*#__PURE__*/"0xf7c51293c5eE5c76867d8Cf400627627a4Bd8697".toLowerCase(),
940
+ PLY: /*#__PURE__*/"0x206EA0Ae49F80d0376d04932479e33Cf2098211A".toLowerCase(),
941
+ AURPLY: /*#__PURE__*/dummyAddress.toLowerCase()
940
942
  }
941
943
  };
942
944
  var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
943
- var REWARDCLAIMSTART = 1673280000;
945
+ var REWARDCLAIMSTART = 1640995200;
944
946
  var ONE_DAY = 86400;
945
947
  var ONE_YEAR = ONE_DAY * 365;
946
- var AurPlyPid = 1;
948
+ var AurPlyPid = 0;
947
949
 
948
950
  var decimalRecords = {
949
951
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
950
- '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8': 18,
951
- '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428': 18,
952
- '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369': 18,
953
- '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18': 18,
954
- '0xaa68274f87fd9ae940f1dec31b643486838481c1': 8,
955
- '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60': 8,
956
- '0x6970167dfaa2aaa67404204102cbbd18b405eca9': 8,
957
- '0x6f8a1daa158e08f75711a64e5a3073e959d688a6': 18,
958
- '0xccf005cfc3669d806a03f0617885648c397c456e': 8,
959
- '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6': 18,
960
- '0x7a80df8230c5aa711e2702a275ab31aeb32754bf': 18,
961
- '0x9630a6c5b729194972199805075fd76707a9713a': 8,
962
- '0x77b088236c071ab5bd4e0bd21240b093275adffc': 8,
963
- '0x7967532568bef9ec96cfad6badea4c63add5888a': 8,
964
- '0x55a4c111c007f39326edf22cfd63bbbb21a35b35': 8
952
+ '0x5231cfaf5bd3aa0c9423703a72706b2d40f0b783': 18,
953
+ '0x5f8e0b6b049fecabc16ad7d23b5f311c48555fa6': 8,
954
+ '0xfa4a1b4137b66d69e5af8a0f63591d62a8c14446': 8,
955
+ '0xa21d86e113f161fa05d3cf767ef19ccec1bd4889': 8,
956
+ '0xf7c51293c5ee5c76867d8cf400627627a4bd8697': 18,
957
+ '0xc0a00d761e569007a707aa84a9a08837cb6a04c1': 18,
958
+ '0x206ea0ae49f80d0376d04932479e33cf2098211a': 18,
959
+ '0x9fc4f60dc140645978c53703ace6241448cfeaa8': 8,
960
+ '0xeee0a0bc4dc3999136f35f82ddaac3c27ed05017': 8,
961
+ '0x1b8a94c4c9a1496e274b153e0756f1836aeabb30': 8,
962
+ '0x533dbec840f10f51b868453f86bdf211fbc52ba4': 8,
963
+ '0xaa847c16359baa930ba8a5e8b6e41d6b63abe505': 18,
964
+ '0x9daf3f62ce9e53b8cd850a1ad392b632eaf7419f': 18,
965
+ '0x68862668fedd002da008596a56c5ea29921e94e6': 18,
966
+ '0xda748e324f4e05e1d9f517242c928a01c418c910': 8
965
967
  };
966
968
 
967
969
  function formatObject(object) {
@@ -975,24 +977,13 @@ var isSameAddress = function isSameAddress(address1, address2) {
975
977
  };
976
978
  var getCurrentTimestamp = /*#__PURE__*/function () {
977
979
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider) {
978
- var latestBlockNumber, currentTime;
979
980
  return runtime_1.wrap(function _callee$(_context) {
980
981
  while (1) {
981
982
  switch (_context.prev = _context.next) {
982
983
  case 0:
983
- _context.next = 2;
984
- return provider.getBlockNumber();
985
-
986
- case 2:
987
- latestBlockNumber = _context.sent;
988
- _context.next = 5;
989
- return provider.getBlock(latestBlockNumber);
990
-
991
- case 5:
992
- currentTime = _context.sent.timestamp;
993
- return _context.abrupt("return", currentTime);
984
+ return _context.abrupt("return", Math.trunc(Date.now() / 1000));
994
985
 
995
- case 7:
986
+ case 1:
996
987
  case "end":
997
988
  return _context.stop();
998
989
  }
@@ -1064,573 +1055,6 @@ var TokenAmount = /*#__PURE__*/function () {
1064
1055
  return TokenAmount;
1065
1056
  }();
1066
1057
 
1067
- var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
1068
- _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
1069
-
1070
- function MoneyMarketRead(networkConnection, auToken, underlyingAsset) {
1071
- var _this;
1072
-
1073
- _this = _BlockchainEntityRead.call(this, networkConnection) || this;
1074
-
1075
- if (isSameAddress(underlyingAsset, ETHAddress)) {
1076
- _this.auToken = new Contract(auToken, AuETHABI.abi, networkConnection.provider);
1077
- } else {
1078
- _this.auToken = new Contract(auToken, AuErc20ABI.abi, networkConnection.provider);
1079
- }
1080
-
1081
- _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
1082
- _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
1083
- return _this;
1084
- }
1085
-
1086
- var _proto = MoneyMarketRead.prototype;
1087
-
1088
- _proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
1089
- var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1090
- return runtime_1.wrap(function _callee$(_context) {
1091
- while (1) {
1092
- switch (_context.prev = _context.next) {
1093
- case 0:
1094
- _context.t0 = TokenAmount;
1095
- _context.t1 = this.underlying;
1096
- _context.next = 4;
1097
- return this.auToken.totalBorrows();
1098
-
1099
- case 4:
1100
- _context.t2 = _context.sent.toString();
1101
- return _context.abrupt("return", new _context.t0(_context.t1, _context.t2));
1102
-
1103
- case 6:
1104
- case "end":
1105
- return _context.stop();
1106
- }
1107
- }
1108
- }, _callee, this);
1109
- }));
1110
-
1111
- function getTotalTokenBorrowed() {
1112
- return _getTotalTokenBorrowed.apply(this, arguments);
1113
- }
1114
-
1115
- return getTotalTokenBorrowed;
1116
- }();
1117
-
1118
- _proto.getTotalTokenDeposited = /*#__PURE__*/function () {
1119
- var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1120
- var _this2 = this;
1121
-
1122
- var promises, totalBorrow, totalCash;
1123
- return runtime_1.wrap(function _callee2$(_context2) {
1124
- while (1) {
1125
- switch (_context2.prev = _context2.next) {
1126
- case 0:
1127
- promises = [];
1128
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
1129
- totalBorrow = res;
1130
- }));
1131
- promises.push(this.auToken.getCash().then(function (res) {
1132
- totalCash = new TokenAmount(_this2.underlying, res.toString());
1133
- }));
1134
- _context2.next = 5;
1135
- return Promise.all(promises);
1136
-
1137
- case 5:
1138
- return _context2.abrupt("return", new TokenAmount(this.underlying, BigNumber$1.from(totalCash.rawAmount()).add(totalBorrow.rawAmount()).toString()));
1139
-
1140
- case 6:
1141
- case "end":
1142
- return _context2.stop();
1143
- }
1144
- }
1145
- }, _callee2, this);
1146
- }));
1147
-
1148
- function getTotalTokenDeposited() {
1149
- return _getTotalTokenDeposited.apply(this, arguments);
1150
- }
1151
-
1152
- return getTotalTokenDeposited;
1153
- }();
1154
-
1155
- _proto.getDepositAPY = /*#__PURE__*/function () {
1156
- var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1157
- var supplyRatePerTimestamp;
1158
- return runtime_1.wrap(function _callee3$(_context3) {
1159
- while (1) {
1160
- switch (_context3.prev = _context3.next) {
1161
- case 0:
1162
- _context3.next = 2;
1163
- return this.auToken.supplyRatePerTimestamp();
1164
-
1165
- case 2:
1166
- supplyRatePerTimestamp = _context3.sent;
1167
- return _context3.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1168
-
1169
- case 4:
1170
- case "end":
1171
- return _context3.stop();
1172
- }
1173
- }
1174
- }, _callee3, this);
1175
- }));
1176
-
1177
- function getDepositAPY() {
1178
- return _getDepositAPY.apply(this, arguments);
1179
- }
1180
-
1181
- return getDepositAPY;
1182
- }();
1183
-
1184
- _proto.getBorrowAPY = /*#__PURE__*/function () {
1185
- var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
1186
- var borrowRatePerTimestamp;
1187
- return runtime_1.wrap(function _callee4$(_context4) {
1188
- while (1) {
1189
- switch (_context4.prev = _context4.next) {
1190
- case 0:
1191
- _context4.next = 2;
1192
- return this.auToken.borrowRatePerTimestamp();
1193
-
1194
- case 2:
1195
- borrowRatePerTimestamp = _context4.sent;
1196
- return _context4.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1197
-
1198
- case 4:
1199
- case "end":
1200
- return _context4.stop();
1201
- }
1202
- }
1203
- }, _callee4, this);
1204
- }));
1205
-
1206
- function getBorrowAPY() {
1207
- return _getBorrowAPY.apply(this, arguments);
1208
- }
1209
-
1210
- return getBorrowAPY;
1211
- }();
1212
-
1213
- _proto.getCollateralRatio = /*#__PURE__*/function () {
1214
- var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
1215
- return runtime_1.wrap(function _callee5$(_context5) {
1216
- while (1) {
1217
- switch (_context5.prev = _context5.next) {
1218
- case 0:
1219
- return _context5.abrupt("return", this._comptroller.markets(this.auToken.address).then(function (res) {
1220
- return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
1221
- }));
1222
-
1223
- case 1:
1224
- case "end":
1225
- return _context5.stop();
1226
- }
1227
- }
1228
- }, _callee5, this);
1229
- }));
1230
-
1231
- function getCollateralRatio() {
1232
- return _getCollateralRatio.apply(this, arguments);
1233
- }
1234
-
1235
- return getCollateralRatio;
1236
- }();
1237
-
1238
- _proto.getBorrowPlyAPY = /*#__PURE__*/function () {
1239
- var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
1240
- var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
1241
- return runtime_1.wrap(function _callee6$(_context6) {
1242
- while (1) {
1243
- switch (_context6.prev = _context6.next) {
1244
- case 0:
1245
- promises = [];
1246
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
1247
- totalBorrowed = res;
1248
- }));
1249
- promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
1250
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
1251
- }));
1252
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
1253
- plyPrice = res;
1254
- }));
1255
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
1256
- underlyingPrice = res;
1257
- }));
1258
- _context6.next = 7;
1259
- return Promise.all(promises);
1260
-
1261
- case 7:
1262
- return _context6.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
1263
-
1264
- case 8:
1265
- case "end":
1266
- return _context6.stop();
1267
- }
1268
- }
1269
- }, _callee6, this);
1270
- }));
1271
-
1272
- function getBorrowPlyAPY() {
1273
- return _getBorrowPlyAPY.apply(this, arguments);
1274
- }
1275
-
1276
- return getBorrowPlyAPY;
1277
- }();
1278
-
1279
- _proto.getDepositPlyAPY = /*#__PURE__*/function () {
1280
- var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
1281
- var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
1282
- return runtime_1.wrap(function _callee7$(_context7) {
1283
- while (1) {
1284
- switch (_context7.prev = _context7.next) {
1285
- case 0:
1286
- promises = [];
1287
- promises.push(this.getTotalTokenDeposited().then(function (res) {
1288
- totalDeposited = res;
1289
- }));
1290
- promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
1291
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
1292
- }));
1293
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
1294
- plyPrice = res;
1295
- }));
1296
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
1297
- underlyingPrice = res;
1298
- }));
1299
- _context7.next = 7;
1300
- return Promise.all(promises);
1301
-
1302
- case 7:
1303
- return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
1304
-
1305
- case 8:
1306
- case "end":
1307
- return _context7.stop();
1308
- }
1309
- }
1310
- }, _callee7, this);
1311
- }));
1312
-
1313
- function getDepositPlyAPY() {
1314
- return _getDepositPlyAPY.apply(this, arguments);
1315
- }
1316
-
1317
- return getDepositPlyAPY;
1318
- }();
1319
-
1320
- _proto.getDetails = /*#__PURE__*/function () {
1321
- var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
1322
- var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeed, plyPrice, underlyingPrice, borrowPlyApy, depositPlyApy;
1323
- return runtime_1.wrap(function _callee8$(_context8) {
1324
- while (1) {
1325
- switch (_context8.prev = _context8.next) {
1326
- case 0:
1327
- promises = [];
1328
- promises.push(this.getTotalTokenDeposited().then(function (res) {
1329
- totalDeposited = res;
1330
- }));
1331
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
1332
- totalBorrowed = res;
1333
- }));
1334
- promises.push(this.getDepositAPY().then(function (res) {
1335
- depositAPY = res.toNumber();
1336
- }));
1337
- promises.push(this.getBorrowAPY().then(function (res) {
1338
- borrowAPY = res.toNumber();
1339
- }));
1340
- promises.push(this.getCollateralRatio().then(function (res) {
1341
- collateralRatio = res.toNumber();
1342
- }));
1343
- promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
1344
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
1345
- }));
1346
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
1347
- plyPrice = res;
1348
- }));
1349
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
1350
- underlyingPrice = res;
1351
- }));
1352
- _context8.next = 11;
1353
- return Promise.all(promises);
1354
-
1355
- case 11:
1356
- borrowPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
1357
- depositPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
1358
- return _context8.abrupt("return", {
1359
- auTokenAddress: this.auToken.address,
1360
- totalTokenDeposited: totalDeposited,
1361
- totalTokenBorrowed: totalBorrowed,
1362
- depositApy: depositAPY,
1363
- depositPlyApy: depositPlyApy.toNumber(),
1364
- borrowApy: borrowAPY,
1365
- borrowPlyApy: borrowPlyApy.toNumber(),
1366
- collateralRatio: collateralRatio
1367
- });
1368
-
1369
- case 14:
1370
- case "end":
1371
- return _context8.stop();
1372
- }
1373
- }
1374
- }, _callee8, this);
1375
- }));
1376
-
1377
- function getDetails() {
1378
- return _getDetails.apply(this, arguments);
1379
- }
1380
-
1381
- return getDetails;
1382
- }();
1383
-
1384
- _proto.getUserBorrowBalance = /*#__PURE__*/function () {
1385
- var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(userAddress) {
1386
- var totalBorrow;
1387
- return runtime_1.wrap(function _callee9$(_context9) {
1388
- while (1) {
1389
- switch (_context9.prev = _context9.next) {
1390
- case 0:
1391
- _context9.next = 2;
1392
- return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
1393
-
1394
- case 2:
1395
- totalBorrow = _context9.sent;
1396
- return _context9.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
1397
-
1398
- case 4:
1399
- case "end":
1400
- return _context9.stop();
1401
- }
1402
- }
1403
- }, _callee9, this);
1404
- }));
1405
-
1406
- function getUserBorrowBalance(_x) {
1407
- return _getUserBorrowBalance.apply(this, arguments);
1408
- }
1409
-
1410
- return getUserBorrowBalance;
1411
- }();
1412
-
1413
- _proto.getUserDepositBalance = /*#__PURE__*/function () {
1414
- var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
1415
- var totalDeposit;
1416
- return runtime_1.wrap(function _callee10$(_context10) {
1417
- while (1) {
1418
- switch (_context10.prev = _context10.next) {
1419
- case 0:
1420
- _context10.next = 2;
1421
- return this.auToken.callStatic.balanceOfUnderlying(userAddress);
1422
-
1423
- case 2:
1424
- totalDeposit = _context10.sent;
1425
- return _context10.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
1426
-
1427
- case 4:
1428
- case "end":
1429
- return _context10.stop();
1430
- }
1431
- }
1432
- }, _callee10, this);
1433
- }));
1434
-
1435
- function getUserDepositBalance(_x2) {
1436
- return _getUserDepositBalance.apply(this, arguments);
1437
- }
1438
-
1439
- return getUserDepositBalance;
1440
- }();
1441
-
1442
- return MoneyMarketRead;
1443
- }(BlockchainEntityRead);
1444
- var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
1445
- _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
1446
-
1447
- function MoneyMarketReadWrite() {
1448
- return _MoneyMarketRead.apply(this, arguments) || this;
1449
- }
1450
-
1451
- var _proto2 = MoneyMarketReadWrite.prototype;
1452
-
1453
- _proto2.deposit = /*#__PURE__*/function () {
1454
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
1455
- return runtime_1.wrap(function _callee11$(_context11) {
1456
- while (1) {
1457
- switch (_context11.prev = _context11.next) {
1458
- case 0:
1459
- if (!isSameAddress(amount.token.address, ETHAddress)) {
1460
- _context11.next = 4;
1461
- break;
1462
- }
1463
-
1464
- return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
1465
- value: amount.rawAmount()
1466
- }));
1467
-
1468
- case 4:
1469
- return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
1470
-
1471
- case 5:
1472
- case "end":
1473
- return _context11.stop();
1474
- }
1475
- }
1476
- }, _callee11, this);
1477
- }));
1478
-
1479
- function deposit(_x3) {
1480
- return _deposit.apply(this, arguments);
1481
- }
1482
-
1483
- return deposit;
1484
- }();
1485
-
1486
- _proto2.borrow = /*#__PURE__*/function () {
1487
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
1488
- return runtime_1.wrap(function _callee12$(_context12) {
1489
- while (1) {
1490
- switch (_context12.prev = _context12.next) {
1491
- case 0:
1492
- return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
1493
-
1494
- case 1:
1495
- case "end":
1496
- return _context12.stop();
1497
- }
1498
- }
1499
- }, _callee12, this);
1500
- }));
1501
-
1502
- function borrow(_x4) {
1503
- return _borrow.apply(this, arguments);
1504
- }
1505
-
1506
- return borrow;
1507
- }();
1508
-
1509
- _proto2.withdraw = /*#__PURE__*/function () {
1510
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
1511
- return runtime_1.wrap(function _callee13$(_context13) {
1512
- while (1) {
1513
- switch (_context13.prev = _context13.next) {
1514
- case 0:
1515
- return _context13.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
1516
-
1517
- case 1:
1518
- case "end":
1519
- return _context13.stop();
1520
- }
1521
- }
1522
- }, _callee13, this);
1523
- }));
1524
-
1525
- function withdraw(_x5) {
1526
- return _withdraw.apply(this, arguments);
1527
- }
1528
-
1529
- return withdraw;
1530
- }();
1531
-
1532
- _proto2.repay = /*#__PURE__*/function () {
1533
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
1534
- return runtime_1.wrap(function _callee14$(_context14) {
1535
- while (1) {
1536
- switch (_context14.prev = _context14.next) {
1537
- case 0:
1538
- if (!isSameAddress(amount.token.address, ETHAddress)) {
1539
- _context14.next = 4;
1540
- break;
1541
- }
1542
-
1543
- return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
1544
- value: amount.rawAmount()
1545
- }));
1546
-
1547
- case 4:
1548
- return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
1549
-
1550
- case 5:
1551
- case "end":
1552
- return _context14.stop();
1553
- }
1554
- }
1555
- }, _callee14, this);
1556
- }));
1557
-
1558
- function repay(_x6) {
1559
- return _repay.apply(this, arguments);
1560
- }
1561
-
1562
- return repay;
1563
- }();
1564
-
1565
- _proto2.enableCollateral = /*#__PURE__*/function () {
1566
- var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
1567
- return runtime_1.wrap(function _callee15$(_context15) {
1568
- while (1) {
1569
- switch (_context15.prev = _context15.next) {
1570
- case 0:
1571
- return _context15.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
1572
-
1573
- case 1:
1574
- case "end":
1575
- return _context15.stop();
1576
- }
1577
- }
1578
- }, _callee15, this);
1579
- }));
1580
-
1581
- function enableCollateral() {
1582
- return _enableCollateral.apply(this, arguments);
1583
- }
1584
-
1585
- return enableCollateral;
1586
- }();
1587
-
1588
- _proto2.disableCollateral = /*#__PURE__*/function () {
1589
- var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
1590
- return runtime_1.wrap(function _callee16$(_context16) {
1591
- while (1) {
1592
- switch (_context16.prev = _context16.next) {
1593
- case 0:
1594
- return _context16.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
1595
-
1596
- case 1:
1597
- case "end":
1598
- return _context16.stop();
1599
- }
1600
- }
1601
- }, _callee16, this);
1602
- }));
1603
-
1604
- function disableCollateral() {
1605
- return _disableCollateral.apply(this, arguments);
1606
- }
1607
-
1608
- return disableCollateral;
1609
- }();
1610
-
1611
- return MoneyMarketReadWrite;
1612
- }(MoneyMarketRead);
1613
- var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
1614
- _inheritsLoose(MoneyMarket, _BlockchainEntity);
1615
-
1616
- function MoneyMarket(address, underlying) {
1617
- var _this3;
1618
-
1619
- _this3 = _BlockchainEntity.call(this) || this;
1620
- _this3.address = validateAndParseAddress(address);
1621
- _this3.underlying = validateAndParseAddress(underlying);
1622
- return _this3;
1623
- }
1624
-
1625
- var _proto3 = MoneyMarket.prototype;
1626
-
1627
- _proto3.read = function read(networkConnection) {
1628
- return new MoneyMarketRead(networkConnection, this.address, this.underlying);
1629
- };
1630
-
1631
- return MoneyMarket;
1632
- }(BlockchainEntity);
1633
-
1634
1058
  var abi = [
1635
1059
  {
1636
1060
  inputs: [
@@ -2580,305 +2004,942 @@ var IUniswapV2PairABI = {
2580
2004
  deployedLinkReferences: deployedLinkReferences
2581
2005
  };
2582
2006
 
2583
- var abi$2 = [
2584
- ];
2585
- var dummyABI = {
2586
- abi: abi$2
2587
- };
2007
+ var abi$2 = [
2008
+ ];
2009
+ var dummyABI = {
2010
+ abi: abi$2
2011
+ };
2012
+
2013
+ var axios = /*#__PURE__*/require('axios');
2014
+
2015
+ function fetchPriceFromCoingeckoAPI(_x) {
2016
+ return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
2017
+ }
2018
+
2019
+ function _fetchPriceFromCoingeckoAPI() {
2020
+ _fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
2021
+ var price;
2022
+ return runtime_1.wrap(function _callee$(_context) {
2023
+ while (1) {
2024
+ switch (_context.prev = _context.next) {
2025
+ case 0:
2026
+ _context.next = 2;
2027
+ return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
2028
+ return res.data;
2029
+ });
2030
+
2031
+ case 2:
2032
+ price = _context.sent;
2033
+ return _context.abrupt("return", new BigNumber(price[id].usd));
2034
+
2035
+ case 4:
2036
+ case "end":
2037
+ return _context.stop();
2038
+ }
2039
+ }
2040
+ }, _callee);
2041
+ }));
2042
+ return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
2043
+ }
2044
+
2045
+ function fetchPriceFromCoingecko(_x2) {
2046
+ return _fetchPriceFromCoingecko.apply(this, arguments);
2047
+ }
2048
+
2049
+ function _fetchPriceFromCoingecko() {
2050
+ _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
2051
+ return runtime_1.wrap(function _callee2$(_context2) {
2052
+ while (1) {
2053
+ switch (_context2.prev = _context2.next) {
2054
+ case 0:
2055
+ if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
2056
+ _context2.next = 4;
2057
+ break;
2058
+ }
2059
+
2060
+ return _context2.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
2061
+
2062
+ case 4:
2063
+ throw Error("Unknown token " + address + " in fetchPriceFromCoingecko");
2064
+
2065
+ case 5:
2066
+ case "end":
2067
+ return _context2.stop();
2068
+ }
2069
+ }
2070
+ }, _callee2);
2071
+ }));
2072
+ return _fetchPriceFromCoingecko.apply(this, arguments);
2073
+ }
2074
+
2075
+ function fetchLPPositions(_x3, _x4) {
2076
+ return _fetchLPPositions.apply(this, arguments);
2077
+ }
2078
+
2079
+ function _fetchLPPositions() {
2080
+ _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(LPAddress, provider) {
2081
+ var promises, LPContract, values;
2082
+ return runtime_1.wrap(function _callee3$(_context3) {
2083
+ while (1) {
2084
+ switch (_context3.prev = _context3.next) {
2085
+ case 0:
2086
+ promises = [];
2087
+ LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
2088
+ promises.push(LPContract.token0());
2089
+ promises.push(LPContract.toekn1());
2090
+ promises.push(LPContract.getReserves());
2091
+ promises.push(LPContract.totalSupply());
2092
+ _context3.next = 8;
2093
+ return Promise.all(promises);
2094
+
2095
+ case 8:
2096
+ values = _context3.sent;
2097
+ return _context3.abrupt("return", {
2098
+ token0: values[0],
2099
+ token1: values[1],
2100
+ reserve0: values[2].reserve0,
2101
+ reserve1: values[2].reserve1,
2102
+ totalSupply: values[3]
2103
+ });
2104
+
2105
+ case 10:
2106
+ case "end":
2107
+ return _context3.stop();
2108
+ }
2109
+ }
2110
+ }, _callee3);
2111
+ }));
2112
+ return _fetchLPPositions.apply(this, arguments);
2113
+ }
2114
+
2115
+ function fetchLPPrice(_x5, _x6) {
2116
+ return _fetchLPPrice.apply(this, arguments);
2117
+ }
2118
+
2119
+ function _fetchLPPrice() {
2120
+ _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(address, provider) {
2121
+ var LPInfo, token0Price, reserveUSD, token1Price, _reserveUSD;
2122
+
2123
+ return runtime_1.wrap(function _callee4$(_context4) {
2124
+ while (1) {
2125
+ switch (_context4.prev = _context4.next) {
2126
+ case 0:
2127
+ _context4.next = 2;
2128
+ return fetchLPPositions(address, provider);
2129
+
2130
+ case 2:
2131
+ LPInfo = _context4.sent;
2132
+ _context4.prev = 3;
2133
+ _context4.next = 6;
2134
+ return fetchPrice(LPInfo.token0, provider);
2135
+
2136
+ case 6:
2137
+ token0Price = _context4.sent;
2138
+ reserveUSD = token0Price.multipliedBy(LPInfo.reserve0.toString()).multipliedBy(2);
2139
+ return _context4.abrupt("return", reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2140
+
2141
+ case 11:
2142
+ _context4.prev = 11;
2143
+ _context4.t0 = _context4["catch"](3);
2144
+ _context4.prev = 13;
2145
+ _context4.next = 16;
2146
+ return fetchPrice(LPInfo.token1, provider);
2147
+
2148
+ case 16:
2149
+ token1Price = _context4.sent;
2150
+ _reserveUSD = token1Price.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(2);
2151
+ return _context4.abrupt("return", _reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2152
+
2153
+ case 21:
2154
+ _context4.prev = 21;
2155
+ _context4.t1 = _context4["catch"](13);
2156
+ throw Error("Unable to fetch price for both tokens of LP " + address);
2157
+
2158
+ case 24:
2159
+ case "end":
2160
+ return _context4.stop();
2161
+ }
2162
+ }
2163
+ }, _callee4, null, [[3, 11], [13, 21]]);
2164
+ }));
2165
+ return _fetchLPPrice.apply(this, arguments);
2166
+ }
2167
+
2168
+ function processPriceFromOracle(rawPrice, underlyingDecimal) {
2169
+ return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
2170
+ }
2171
+
2172
+ function fetchPriceFromOracle(_x7, _x8, _x9) {
2173
+ return _fetchPriceFromOracle.apply(this, arguments);
2174
+ }
2175
+
2176
+ function _fetchPriceFromOracle() {
2177
+ _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(auTokenAddress, underlyingDecimal, provider) {
2178
+ var oracleContract, rawPrice;
2179
+ return runtime_1.wrap(function _callee5$(_context5) {
2180
+ while (1) {
2181
+ switch (_context5.prev = _context5.next) {
2182
+ case 0:
2183
+ oracleContract = new Contract(networkAddresses.misc.oracle, OracleABI.abi, provider);
2184
+ _context5.next = 3;
2185
+ return oracleContract.getUnderlyingPrice(auTokenAddress);
2186
+
2187
+ case 3:
2188
+ rawPrice = _context5.sent;
2189
+ return _context5.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2190
+
2191
+ case 5:
2192
+ case "end":
2193
+ return _context5.stop();
2194
+ }
2195
+ }
2196
+ }, _callee5);
2197
+ }));
2198
+ return _fetchPriceFromOracle.apply(this, arguments);
2199
+ }
2200
+
2201
+ function fetchUnderlyingTokensPrices(_x10) {
2202
+ return _fetchUnderlyingTokensPrices.apply(this, arguments);
2203
+ }
2204
+
2205
+ function _fetchUnderlyingTokensPrices() {
2206
+ _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
2207
+ var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
2208
+ return runtime_1.wrap(function _callee6$(_context6) {
2209
+ while (1) {
2210
+ switch (_context6.prev = _context6.next) {
2211
+ case 0:
2212
+ auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, provider);
2213
+ auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
2214
+ return auToken.address;
2215
+ });
2216
+ underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
2217
+ return getDecimal(auToken.underlying);
2218
+ });
2219
+ _context6.next = 5;
2220
+ return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
2221
+
2222
+ case 5:
2223
+ rawPrices = _context6.sent;
2224
+ return _context6.abrupt("return", rawPrices.map(function (res, ind) {
2225
+ return {
2226
+ auToken: res.auToken,
2227
+ underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
2228
+ };
2229
+ }));
2230
+
2231
+ case 7:
2232
+ case "end":
2233
+ return _context6.stop();
2234
+ }
2235
+ }
2236
+ }, _callee6);
2237
+ }));
2238
+ return _fetchUnderlyingTokensPrices.apply(this, arguments);
2239
+ }
2240
+
2241
+ function fetchPrice(_x11, _x12) {
2242
+ return _fetchPrice.apply(this, arguments);
2243
+ }
2244
+
2245
+ function _fetchPrice() {
2246
+ _fetchPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(address, provider) {
2247
+ var matchingAuToken;
2248
+ return runtime_1.wrap(function _callee7$(_context7) {
2249
+ while (1) {
2250
+ switch (_context7.prev = _context7.next) {
2251
+ case 0:
2252
+ matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2253
+ return isSameAddress(auToken.underlying, address);
2254
+ });
2255
+
2256
+ if (!(matchingAuToken !== undefined)) {
2257
+ _context7.next = 5;
2258
+ break;
2259
+ }
2260
+
2261
+ return _context7.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2262
+
2263
+ case 5:
2264
+ if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
2265
+ _context7.next = 9;
2266
+ break;
2267
+ }
2268
+
2269
+ return _context7.abrupt("return", fetchLPPrice(address, provider));
2270
+
2271
+ case 9:
2272
+ return _context7.abrupt("return", fetchPriceFromCoingecko(address));
2273
+
2274
+ case 10:
2275
+ case "end":
2276
+ return _context7.stop();
2277
+ }
2278
+ }
2279
+ }, _callee7);
2280
+ }));
2281
+ return _fetchPrice.apply(this, arguments);
2282
+ }
2283
+
2284
+ function fetchValuation(_x13, _x14, _x15) {
2285
+ return _fetchValuation.apply(this, arguments);
2286
+ }
2287
+
2288
+ function _fetchValuation() {
2289
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(tokenAmount, provider, price) {
2290
+ return runtime_1.wrap(function _callee8$(_context8) {
2291
+ while (1) {
2292
+ switch (_context8.prev = _context8.next) {
2293
+ case 0:
2294
+ if (!(price === null)) {
2295
+ _context8.next = 4;
2296
+ break;
2297
+ }
2298
+
2299
+ _context8.next = 3;
2300
+ return fetchPrice(tokenAmount.token.address, provider);
2301
+
2302
+ case 3:
2303
+ price = _context8.sent;
2304
+
2305
+ case 4:
2306
+ return _context8.abrupt("return", new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price));
2307
+
2308
+ case 5:
2309
+ case "end":
2310
+ return _context8.stop();
2311
+ }
2312
+ }
2313
+ }, _callee8);
2314
+ }));
2315
+ return _fetchValuation.apply(this, arguments);
2316
+ }
2317
+
2318
+ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2319
+ _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
2320
+
2321
+ function MoneyMarketRead(networkConnection, auToken, underlyingAsset) {
2322
+ var _this;
2323
+
2324
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
2325
+
2326
+ if (isSameAddress(underlyingAsset, ETHAddress)) {
2327
+ _this.auToken = new Contract(auToken, AuETHABI.abi, networkConnection.provider);
2328
+ } else {
2329
+ _this.auToken = new Contract(auToken, AuErc20ABI.abi, networkConnection.provider);
2330
+ }
2331
+
2332
+ _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
2333
+ _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
2334
+ _this._auriLens = new Contract(networkAddresses.misc.AURILENS, AuriLensABI.abi, networkConnection.provider);
2335
+ return _this;
2336
+ }
2337
+
2338
+ var _proto = MoneyMarketRead.prototype;
2339
+
2340
+ _proto.getRewardSpeeds = /*#__PURE__*/function () {
2341
+ var _getRewardSpeeds = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2342
+ var promises, speeds;
2343
+ return runtime_1.wrap(function _callee$(_context) {
2344
+ while (1) {
2345
+ switch (_context.prev = _context.next) {
2346
+ case 0:
2347
+ promises = [];
2348
+ speeds = {};
2349
+ promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address, true).then(function (res) {
2350
+ speeds.plyRewardSupplySpeed = res;
2351
+ }));
2352
+ promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address, false).then(function (res) {
2353
+ speeds.plyRewardBorrowSpeed = res;
2354
+ }));
2355
+ promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.AURORA, this.auToken.address, true).then(function (res) {
2356
+ speeds.auroraRewardSupplySpeed = res;
2357
+ }));
2358
+ promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.AURORA, this.auToken.address, false).then(function (res) {
2359
+ speeds.auroraRewardBorrowSpeed = res;
2360
+ }));
2361
+ _context.next = 8;
2362
+ return Promise.all(promises);
2363
+
2364
+ case 8:
2365
+ return _context.abrupt("return", speeds);
2366
+
2367
+ case 9:
2368
+ case "end":
2369
+ return _context.stop();
2370
+ }
2371
+ }
2372
+ }, _callee, this);
2373
+ }));
2374
+
2375
+ function getRewardSpeeds() {
2376
+ return _getRewardSpeeds.apply(this, arguments);
2377
+ }
2378
+
2379
+ return getRewardSpeeds;
2380
+ }();
2381
+
2382
+ _proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
2383
+ var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2384
+ return runtime_1.wrap(function _callee2$(_context2) {
2385
+ while (1) {
2386
+ switch (_context2.prev = _context2.next) {
2387
+ case 0:
2388
+ _context2.t0 = TokenAmount;
2389
+ _context2.t1 = this.underlying;
2390
+ _context2.next = 4;
2391
+ return this.auToken.totalBorrows();
2392
+
2393
+ case 4:
2394
+ _context2.t2 = _context2.sent.toString();
2395
+ return _context2.abrupt("return", new _context2.t0(_context2.t1, _context2.t2));
2396
+
2397
+ case 6:
2398
+ case "end":
2399
+ return _context2.stop();
2400
+ }
2401
+ }
2402
+ }, _callee2, this);
2403
+ }));
2404
+
2405
+ function getTotalTokenBorrowed() {
2406
+ return _getTotalTokenBorrowed.apply(this, arguments);
2407
+ }
2408
+
2409
+ return getTotalTokenBorrowed;
2410
+ }();
2411
+
2412
+ _proto.getTotalTokenDeposited = /*#__PURE__*/function () {
2413
+ var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2414
+ var _this2 = this;
2415
+
2416
+ var promises, totalBorrow, totalCash;
2417
+ return runtime_1.wrap(function _callee3$(_context3) {
2418
+ while (1) {
2419
+ switch (_context3.prev = _context3.next) {
2420
+ case 0:
2421
+ promises = [];
2422
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
2423
+ totalBorrow = res;
2424
+ }));
2425
+ promises.push(this.auToken.getCash().then(function (res) {
2426
+ totalCash = new TokenAmount(_this2.underlying, res.toString());
2427
+ }));
2428
+ _context3.next = 5;
2429
+ return Promise.all(promises);
2430
+
2431
+ case 5:
2432
+ return _context3.abrupt("return", new TokenAmount(this.underlying, BigNumber$1.from(totalCash.rawAmount()).add(totalBorrow.rawAmount()).toString()));
2433
+
2434
+ case 6:
2435
+ case "end":
2436
+ return _context3.stop();
2437
+ }
2438
+ }
2439
+ }, _callee3, this);
2440
+ }));
2441
+
2442
+ function getTotalTokenDeposited() {
2443
+ return _getTotalTokenDeposited.apply(this, arguments);
2444
+ }
2445
+
2446
+ return getTotalTokenDeposited;
2447
+ }();
2448
+
2449
+ _proto.getDepositAPY = /*#__PURE__*/function () {
2450
+ var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2451
+ var supplyRatePerTimestamp;
2452
+ return runtime_1.wrap(function _callee4$(_context4) {
2453
+ while (1) {
2454
+ switch (_context4.prev = _context4.next) {
2455
+ case 0:
2456
+ _context4.next = 2;
2457
+ return this.auToken.supplyRatePerTimestamp();
2458
+
2459
+ case 2:
2460
+ supplyRatePerTimestamp = _context4.sent;
2461
+ return _context4.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
2462
+
2463
+ case 4:
2464
+ case "end":
2465
+ return _context4.stop();
2466
+ }
2467
+ }
2468
+ }, _callee4, this);
2469
+ }));
2470
+
2471
+ function getDepositAPY() {
2472
+ return _getDepositAPY.apply(this, arguments);
2473
+ }
2474
+
2475
+ return getDepositAPY;
2476
+ }();
2477
+
2478
+ _proto.getBorrowAPY = /*#__PURE__*/function () {
2479
+ var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2480
+ var borrowRatePerTimestamp;
2481
+ return runtime_1.wrap(function _callee5$(_context5) {
2482
+ while (1) {
2483
+ switch (_context5.prev = _context5.next) {
2484
+ case 0:
2485
+ _context5.next = 2;
2486
+ return this.auToken.borrowRatePerTimestamp();
2487
+
2488
+ case 2:
2489
+ borrowRatePerTimestamp = _context5.sent;
2490
+ return _context5.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
2491
+
2492
+ case 4:
2493
+ case "end":
2494
+ return _context5.stop();
2495
+ }
2496
+ }
2497
+ }, _callee5, this);
2498
+ }));
2499
+
2500
+ function getBorrowAPY() {
2501
+ return _getBorrowAPY.apply(this, arguments);
2502
+ }
2503
+
2504
+ return getBorrowAPY;
2505
+ }();
2506
+
2507
+ _proto.getCollateralRatio = /*#__PURE__*/function () {
2508
+ var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2509
+ return runtime_1.wrap(function _callee6$(_context6) {
2510
+ while (1) {
2511
+ switch (_context6.prev = _context6.next) {
2512
+ case 0:
2513
+ return _context6.abrupt("return", this._comptroller.markets(this.auToken.address).then(function (res) {
2514
+ return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
2515
+ }));
2516
+
2517
+ case 1:
2518
+ case "end":
2519
+ return _context6.stop();
2520
+ }
2521
+ }
2522
+ }, _callee6, this);
2523
+ }));
2524
+
2525
+ function getCollateralRatio() {
2526
+ return _getCollateralRatio.apply(this, arguments);
2527
+ }
2528
+
2529
+ return getCollateralRatio;
2530
+ }();
2531
+
2532
+ _proto.getBorrowPlyAPY = /*#__PURE__*/function () {
2533
+ var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
2534
+ var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
2535
+ return runtime_1.wrap(function _callee7$(_context7) {
2536
+ while (1) {
2537
+ switch (_context7.prev = _context7.next) {
2538
+ case 0:
2539
+ promises = [];
2540
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
2541
+ totalBorrowed = res;
2542
+ }));
2543
+ promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address, false).then(function (res) {
2544
+ rewardSpeed = new TokenAmount(PLYToken, res.toString());
2545
+ }));
2546
+ promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
2547
+ plyPrice = res;
2548
+ }));
2549
+ promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
2550
+ underlyingPrice = res;
2551
+ }));
2552
+ _context7.next = 7;
2553
+ return Promise.all(promises);
2554
+
2555
+ case 7:
2556
+ return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
2557
+
2558
+ case 8:
2559
+ case "end":
2560
+ return _context7.stop();
2561
+ }
2562
+ }
2563
+ }, _callee7, this);
2564
+ }));
2565
+
2566
+ function getBorrowPlyAPY() {
2567
+ return _getBorrowPlyAPY.apply(this, arguments);
2568
+ }
2569
+
2570
+ return getBorrowPlyAPY;
2571
+ }();
2572
+
2573
+ _proto.getDepositPlyAPY = /*#__PURE__*/function () {
2574
+ var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
2575
+ var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
2576
+ return runtime_1.wrap(function _callee8$(_context8) {
2577
+ while (1) {
2578
+ switch (_context8.prev = _context8.next) {
2579
+ case 0:
2580
+ promises = [];
2581
+ promises.push(this.getTotalTokenDeposited().then(function (res) {
2582
+ totalDeposited = res;
2583
+ }));
2584
+ promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address, true).then(function (res) {
2585
+ rewardSpeed = new TokenAmount(PLYToken, res.toString());
2586
+ }));
2587
+ promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
2588
+ plyPrice = res;
2589
+ }));
2590
+ promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
2591
+ underlyingPrice = res;
2592
+ }));
2593
+ _context8.next = 7;
2594
+ return Promise.all(promises);
2595
+
2596
+ case 7:
2597
+ return _context8.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
2588
2598
 
2589
- var axios = /*#__PURE__*/require('axios');
2599
+ case 8:
2600
+ case "end":
2601
+ return _context8.stop();
2602
+ }
2603
+ }
2604
+ }, _callee8, this);
2605
+ }));
2590
2606
 
2591
- function fetchPriceFromCoingeckoAPI(_x) {
2592
- return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
2593
- }
2607
+ function getDepositPlyAPY() {
2608
+ return _getDepositPlyAPY.apply(this, arguments);
2609
+ }
2594
2610
 
2595
- function _fetchPriceFromCoingeckoAPI() {
2596
- _fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
2597
- var price;
2598
- return runtime_1.wrap(function _callee$(_context) {
2599
- while (1) {
2600
- switch (_context.prev = _context.next) {
2601
- case 0:
2602
- _context.next = 2;
2603
- return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
2604
- return res.data;
2605
- });
2611
+ return getDepositPlyAPY;
2612
+ }();
2606
2613
 
2607
- case 2:
2608
- price = _context.sent;
2609
- return _context.abrupt("return", new BigNumber(price[id].usd));
2614
+ _proto.getDetails = /*#__PURE__*/function () {
2615
+ var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
2616
+ var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, plyPrice, underlyingPrice, rewardSpeeds, borrowPlyApy, depositPlyApy;
2617
+ return runtime_1.wrap(function _callee9$(_context9) {
2618
+ while (1) {
2619
+ switch (_context9.prev = _context9.next) {
2620
+ case 0:
2621
+ promises = [];
2622
+ promises.push(this.getTotalTokenDeposited().then(function (res) {
2623
+ totalDeposited = res;
2624
+ }));
2625
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
2626
+ totalBorrowed = res;
2627
+ }));
2628
+ promises.push(this.getDepositAPY().then(function (res) {
2629
+ depositAPY = res.toNumber();
2630
+ }));
2631
+ promises.push(this.getBorrowAPY().then(function (res) {
2632
+ borrowAPY = res.toNumber();
2633
+ }));
2634
+ promises.push(this.getCollateralRatio().then(function (res) {
2635
+ collateralRatio = res.toNumber();
2636
+ }));
2637
+ promises.push(this.getRewardSpeeds().then(function (res) {
2638
+ rewardSpeeds = res;
2639
+ }));
2640
+ promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
2641
+ plyPrice = res;
2642
+ }));
2643
+ promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
2644
+ underlyingPrice = res;
2645
+ }));
2646
+ _context9.next = 11;
2647
+ return Promise.all(promises);
2610
2648
 
2611
- case 4:
2612
- case "end":
2613
- return _context.stop();
2649
+ case 11:
2650
+ _context9.t0 = calcLMRewardApr;
2651
+ _context9.next = 14;
2652
+ return fetchValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardBorrowSpeed.toString()), this._networkConnection.provider, plyPrice);
2653
+
2654
+ case 14:
2655
+ _context9.t1 = _context9.sent;
2656
+ _context9.t2 = underlyingPrice.multipliedBy(totalBorrowed.formattedAmount());
2657
+ _context9.t3 = ONE_YEAR;
2658
+ borrowPlyApy = (0, _context9.t0)(_context9.t1, _context9.t2, _context9.t3);
2659
+ _context9.t4 = calcLMRewardApr;
2660
+ _context9.next = 21;
2661
+ return fetchValuation(new TokenAmount(PLYToken, rewardSpeeds.plyRewardSupplySpeed.toString()), this._networkConnection.provider, plyPrice);
2662
+
2663
+ case 21:
2664
+ _context9.t5 = _context9.sent;
2665
+ _context9.t6 = underlyingPrice.multipliedBy(totalDeposited.formattedAmount());
2666
+ _context9.t7 = ONE_YEAR;
2667
+ depositPlyApy = (0, _context9.t4)(_context9.t5, _context9.t6, _context9.t7);
2668
+ return _context9.abrupt("return", {
2669
+ auTokenAddress: this.auToken.address,
2670
+ totalTokenDeposited: totalDeposited,
2671
+ totalTokenBorrowed: totalBorrowed,
2672
+ depositApy: depositAPY,
2673
+ depositPlyApy: depositPlyApy.toNumber(),
2674
+ borrowApy: borrowAPY,
2675
+ borrowPlyApy: borrowPlyApy.toNumber(),
2676
+ collateralRatio: collateralRatio
2677
+ });
2678
+
2679
+ case 26:
2680
+ case "end":
2681
+ return _context9.stop();
2682
+ }
2614
2683
  }
2615
- }
2616
- }, _callee);
2617
- }));
2618
- return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
2619
- }
2684
+ }, _callee9, this);
2685
+ }));
2620
2686
 
2621
- function fetchPriceFromCoingecko(_x2) {
2622
- return _fetchPriceFromCoingecko.apply(this, arguments);
2623
- }
2687
+ function getDetails() {
2688
+ return _getDetails.apply(this, arguments);
2689
+ }
2624
2690
 
2625
- function _fetchPriceFromCoingecko() {
2626
- _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
2627
- return runtime_1.wrap(function _callee2$(_context2) {
2628
- while (1) {
2629
- switch (_context2.prev = _context2.next) {
2630
- case 0:
2631
- if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
2632
- _context2.next = 4;
2633
- break;
2634
- }
2691
+ return getDetails;
2692
+ }();
2635
2693
 
2636
- return _context2.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
2694
+ _proto.getUserBorrowBalance = /*#__PURE__*/function () {
2695
+ var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
2696
+ var totalBorrow;
2697
+ return runtime_1.wrap(function _callee10$(_context10) {
2698
+ while (1) {
2699
+ switch (_context10.prev = _context10.next) {
2700
+ case 0:
2701
+ _context10.next = 2;
2702
+ return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
2637
2703
 
2638
- case 4:
2639
- throw Error("Unknown token " + address + " in fetchPriceFromCoingecko");
2704
+ case 2:
2705
+ totalBorrow = _context10.sent;
2706
+ return _context10.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
2640
2707
 
2641
- case 5:
2642
- case "end":
2643
- return _context2.stop();
2708
+ case 4:
2709
+ case "end":
2710
+ return _context10.stop();
2711
+ }
2644
2712
  }
2645
- }
2646
- }, _callee2);
2647
- }));
2648
- return _fetchPriceFromCoingecko.apply(this, arguments);
2649
- }
2713
+ }, _callee10, this);
2714
+ }));
2650
2715
 
2651
- function fetchLPPositions(_x3, _x4) {
2652
- return _fetchLPPositions.apply(this, arguments);
2653
- }
2716
+ function getUserBorrowBalance(_x) {
2717
+ return _getUserBorrowBalance.apply(this, arguments);
2718
+ }
2654
2719
 
2655
- function _fetchLPPositions() {
2656
- _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(LPAddress, provider) {
2657
- var promises, LPContract, values;
2658
- return runtime_1.wrap(function _callee3$(_context3) {
2659
- while (1) {
2660
- switch (_context3.prev = _context3.next) {
2661
- case 0:
2662
- promises = [];
2663
- LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
2664
- promises.push(LPContract.token0());
2665
- promises.push(LPContract.toekn1());
2666
- promises.push(LPContract.getReserves());
2667
- promises.push(LPContract.totalSupply());
2668
- _context3.next = 8;
2669
- return Promise.all(promises);
2720
+ return getUserBorrowBalance;
2721
+ }();
2670
2722
 
2671
- case 8:
2672
- values = _context3.sent;
2673
- return _context3.abrupt("return", {
2674
- token0: values[0],
2675
- token1: values[1],
2676
- reserve0: values[2].reserve0,
2677
- reserve1: values[2].reserve1,
2678
- totalSupply: values[3]
2679
- });
2723
+ _proto.getUserDepositBalance = /*#__PURE__*/function () {
2724
+ var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(userAddress) {
2725
+ var totalDeposit;
2726
+ return runtime_1.wrap(function _callee11$(_context11) {
2727
+ while (1) {
2728
+ switch (_context11.prev = _context11.next) {
2729
+ case 0:
2730
+ _context11.next = 2;
2731
+ return this.auToken.callStatic.balanceOfUnderlying(userAddress);
2680
2732
 
2681
- case 10:
2682
- case "end":
2683
- return _context3.stop();
2733
+ case 2:
2734
+ totalDeposit = _context11.sent;
2735
+ return _context11.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
2736
+
2737
+ case 4:
2738
+ case "end":
2739
+ return _context11.stop();
2740
+ }
2684
2741
  }
2685
- }
2686
- }, _callee3);
2687
- }));
2688
- return _fetchLPPositions.apply(this, arguments);
2689
- }
2742
+ }, _callee11, this);
2743
+ }));
2690
2744
 
2691
- function fetchLPPrice(_x5, _x6) {
2692
- return _fetchLPPrice.apply(this, arguments);
2693
- }
2745
+ function getUserDepositBalance(_x2) {
2746
+ return _getUserDepositBalance.apply(this, arguments);
2747
+ }
2694
2748
 
2695
- function _fetchLPPrice() {
2696
- _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(address, provider) {
2697
- var LPInfo, token0Price, reserveUSD, token1Price, _reserveUSD;
2749
+ return getUserDepositBalance;
2750
+ }();
2698
2751
 
2699
- return runtime_1.wrap(function _callee4$(_context4) {
2700
- while (1) {
2701
- switch (_context4.prev = _context4.next) {
2702
- case 0:
2703
- _context4.next = 2;
2704
- return fetchLPPositions(address, provider);
2752
+ return MoneyMarketRead;
2753
+ }(BlockchainEntityRead);
2754
+ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2755
+ _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
2705
2756
 
2706
- case 2:
2707
- LPInfo = _context4.sent;
2708
- _context4.prev = 3;
2709
- _context4.next = 6;
2710
- return fetchPrice(LPInfo.token0, provider);
2757
+ function MoneyMarketReadWrite() {
2758
+ return _MoneyMarketRead.apply(this, arguments) || this;
2759
+ }
2760
+
2761
+ var _proto2 = MoneyMarketReadWrite.prototype;
2762
+
2763
+ _proto2.deposit = /*#__PURE__*/function () {
2764
+ var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
2765
+ return runtime_1.wrap(function _callee12$(_context12) {
2766
+ while (1) {
2767
+ switch (_context12.prev = _context12.next) {
2768
+ case 0:
2769
+ if (!isSameAddress(amount.token.address, ETHAddress)) {
2770
+ _context12.next = 4;
2771
+ break;
2772
+ }
2773
+
2774
+ return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
2775
+ value: amount.rawAmount()
2776
+ }));
2777
+
2778
+ case 4:
2779
+ return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
2780
+
2781
+ case 5:
2782
+ case "end":
2783
+ return _context12.stop();
2784
+ }
2785
+ }
2786
+ }, _callee12, this);
2787
+ }));
2788
+
2789
+ function deposit(_x3) {
2790
+ return _deposit.apply(this, arguments);
2791
+ }
2792
+
2793
+ return deposit;
2794
+ }();
2795
+
2796
+ _proto2.borrow = /*#__PURE__*/function () {
2797
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
2798
+ return runtime_1.wrap(function _callee13$(_context13) {
2799
+ while (1) {
2800
+ switch (_context13.prev = _context13.next) {
2801
+ case 0:
2802
+ return _context13.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
2711
2803
 
2712
- case 6:
2713
- token0Price = _context4.sent;
2714
- reserveUSD = token0Price.multipliedBy(LPInfo.reserve0.toString()).multipliedBy(2);
2715
- return _context4.abrupt("return", reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2804
+ case 1:
2805
+ case "end":
2806
+ return _context13.stop();
2807
+ }
2808
+ }
2809
+ }, _callee13, this);
2810
+ }));
2716
2811
 
2717
- case 11:
2718
- _context4.prev = 11;
2719
- _context4.t0 = _context4["catch"](3);
2720
- _context4.prev = 13;
2721
- _context4.next = 16;
2722
- return fetchPrice(LPInfo.token1, provider);
2812
+ function borrow(_x4) {
2813
+ return _borrow.apply(this, arguments);
2814
+ }
2723
2815
 
2724
- case 16:
2725
- token1Price = _context4.sent;
2726
- _reserveUSD = token1Price.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(2);
2727
- return _context4.abrupt("return", _reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2816
+ return borrow;
2817
+ }();
2728
2818
 
2729
- case 21:
2730
- _context4.prev = 21;
2731
- _context4.t1 = _context4["catch"](13);
2732
- throw Error("Unable to fetch price for both tokens of LP " + address);
2819
+ _proto2.withdraw = /*#__PURE__*/function () {
2820
+ var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
2821
+ return runtime_1.wrap(function _callee14$(_context14) {
2822
+ while (1) {
2823
+ switch (_context14.prev = _context14.next) {
2824
+ case 0:
2825
+ return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
2733
2826
 
2734
- case 24:
2735
- case "end":
2736
- return _context4.stop();
2827
+ case 1:
2828
+ case "end":
2829
+ return _context14.stop();
2830
+ }
2737
2831
  }
2738
- }
2739
- }, _callee4, null, [[3, 11], [13, 21]]);
2740
- }));
2741
- return _fetchLPPrice.apply(this, arguments);
2742
- }
2832
+ }, _callee14, this);
2833
+ }));
2743
2834
 
2744
- function processPriceFromOracle(rawPrice, underlyingDecimal) {
2745
- return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
2746
- }
2835
+ function withdraw(_x5) {
2836
+ return _withdraw.apply(this, arguments);
2837
+ }
2747
2838
 
2748
- function fetchPriceFromOracle(_x7, _x8, _x9) {
2749
- return _fetchPriceFromOracle.apply(this, arguments);
2750
- }
2839
+ return withdraw;
2840
+ }();
2751
2841
 
2752
- function _fetchPriceFromOracle() {
2753
- _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(auTokenAddress, underlyingDecimal, provider) {
2754
- var oracleContract, rawPrice;
2755
- return runtime_1.wrap(function _callee5$(_context5) {
2756
- while (1) {
2757
- switch (_context5.prev = _context5.next) {
2758
- case 0:
2759
- oracleContract = new Contract(networkAddresses.misc.oracle, OracleABI.abi, provider);
2760
- console.log(oracleContract.address, auTokenAddress);
2761
- _context5.next = 4;
2762
- return oracleContract.getUnderlyingPrice(auTokenAddress);
2842
+ _proto2.repay = /*#__PURE__*/function () {
2843
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15(amount) {
2844
+ return runtime_1.wrap(function _callee15$(_context15) {
2845
+ while (1) {
2846
+ switch (_context15.prev = _context15.next) {
2847
+ case 0:
2848
+ if (!isSameAddress(amount.token.address, ETHAddress)) {
2849
+ _context15.next = 4;
2850
+ break;
2851
+ }
2763
2852
 
2764
- case 4:
2765
- rawPrice = _context5.sent;
2766
- return _context5.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2853
+ return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
2854
+ value: amount.rawAmount()
2855
+ }));
2767
2856
 
2768
- case 6:
2769
- case "end":
2770
- return _context5.stop();
2857
+ case 4:
2858
+ return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
2859
+
2860
+ case 5:
2861
+ case "end":
2862
+ return _context15.stop();
2863
+ }
2771
2864
  }
2772
- }
2773
- }, _callee5);
2774
- }));
2775
- return _fetchPriceFromOracle.apply(this, arguments);
2776
- }
2865
+ }, _callee15, this);
2866
+ }));
2777
2867
 
2778
- function fetchUnderlyingTokensPrices(_x10) {
2779
- return _fetchUnderlyingTokensPrices.apply(this, arguments);
2780
- }
2868
+ function repay(_x6) {
2869
+ return _repay.apply(this, arguments);
2870
+ }
2781
2871
 
2782
- function _fetchUnderlyingTokensPrices() {
2783
- _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
2784
- var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
2785
- return runtime_1.wrap(function _callee6$(_context6) {
2786
- while (1) {
2787
- switch (_context6.prev = _context6.next) {
2788
- case 0:
2789
- auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, provider);
2790
- auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
2791
- return auToken.address;
2792
- });
2793
- underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
2794
- return getDecimal(auToken.underlying);
2795
- });
2796
- _context6.next = 5;
2797
- return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
2872
+ return repay;
2873
+ }();
2798
2874
 
2799
- case 5:
2800
- rawPrices = _context6.sent;
2801
- return _context6.abrupt("return", rawPrices.map(function (res, ind) {
2802
- return {
2803
- auToken: res.auToken,
2804
- underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
2805
- };
2806
- }));
2875
+ _proto2.enableCollateral = /*#__PURE__*/function () {
2876
+ var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
2877
+ return runtime_1.wrap(function _callee16$(_context16) {
2878
+ while (1) {
2879
+ switch (_context16.prev = _context16.next) {
2880
+ case 0:
2881
+ return _context16.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
2807
2882
 
2808
- case 7:
2809
- case "end":
2810
- return _context6.stop();
2883
+ case 1:
2884
+ case "end":
2885
+ return _context16.stop();
2886
+ }
2811
2887
  }
2812
- }
2813
- }, _callee6);
2814
- }));
2815
- return _fetchUnderlyingTokensPrices.apply(this, arguments);
2816
- }
2888
+ }, _callee16, this);
2889
+ }));
2817
2890
 
2818
- function fetchPrice(_x11, _x12) {
2819
- return _fetchPrice.apply(this, arguments);
2820
- }
2891
+ function enableCollateral() {
2892
+ return _enableCollateral.apply(this, arguments);
2893
+ }
2821
2894
 
2822
- function _fetchPrice() {
2823
- _fetchPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(address, provider) {
2824
- var matchingAuToken;
2825
- return runtime_1.wrap(function _callee7$(_context7) {
2826
- while (1) {
2827
- switch (_context7.prev = _context7.next) {
2828
- case 0:
2829
- matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2830
- return isSameAddress(auToken.underlying, address);
2831
- });
2895
+ return enableCollateral;
2896
+ }();
2832
2897
 
2833
- if (!(matchingAuToken !== undefined)) {
2834
- _context7.next = 5;
2835
- break;
2836
- }
2898
+ _proto2.disableCollateral = /*#__PURE__*/function () {
2899
+ var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee17() {
2900
+ return runtime_1.wrap(function _callee17$(_context17) {
2901
+ while (1) {
2902
+ switch (_context17.prev = _context17.next) {
2903
+ case 0:
2904
+ return _context17.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
2837
2905
 
2838
- return _context7.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2906
+ case 1:
2907
+ case "end":
2908
+ return _context17.stop();
2909
+ }
2910
+ }
2911
+ }, _callee17, this);
2912
+ }));
2839
2913
 
2840
- case 5:
2841
- if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
2842
- _context7.next = 9;
2843
- break;
2844
- }
2914
+ function disableCollateral() {
2915
+ return _disableCollateral.apply(this, arguments);
2916
+ }
2845
2917
 
2846
- return _context7.abrupt("return", fetchLPPrice(address, provider));
2918
+ return disableCollateral;
2919
+ }();
2847
2920
 
2848
- case 9:
2849
- return _context7.abrupt("return", fetchPriceFromCoingecko(address));
2921
+ return MoneyMarketReadWrite;
2922
+ }(MoneyMarketRead);
2923
+ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
2924
+ _inheritsLoose(MoneyMarket, _BlockchainEntity);
2850
2925
 
2851
- case 10:
2852
- case "end":
2853
- return _context7.stop();
2854
- }
2855
- }
2856
- }, _callee7);
2857
- }));
2858
- return _fetchPrice.apply(this, arguments);
2859
- }
2926
+ function MoneyMarket(address, underlying) {
2927
+ var _this3;
2860
2928
 
2861
- function fetchValuation(_x13, _x14, _x15) {
2862
- return _fetchValuation.apply(this, arguments);
2863
- }
2929
+ _this3 = _BlockchainEntity.call(this) || this;
2930
+ _this3.address = validateAndParseAddress(address);
2931
+ _this3.underlying = validateAndParseAddress(underlying);
2932
+ return _this3;
2933
+ }
2864
2934
 
2865
- function _fetchValuation() {
2866
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(tokenAmount, provider, price) {
2867
- return runtime_1.wrap(function _callee8$(_context8) {
2868
- while (1) {
2869
- switch (_context8.prev = _context8.next) {
2870
- case 0:
2871
- return _context8.abrupt("return", new BigNumber(0));
2935
+ var _proto3 = MoneyMarket.prototype;
2872
2936
 
2873
- case 1:
2874
- case "end":
2875
- return _context8.stop();
2876
- }
2877
- }
2878
- }, _callee8);
2879
- }));
2880
- return _fetchValuation.apply(this, arguments);
2881
- }
2937
+ _proto3.read = function read(networkConnection) {
2938
+ return new MoneyMarketRead(networkConnection, this.address, this.underlying);
2939
+ };
2940
+
2941
+ return MoneyMarket;
2942
+ }(BlockchainEntity);
2882
2943
 
2883
2944
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2884
2945
  _inheritsLoose(SdkRead, _BlockchainEntityRead);
@@ -2890,7 +2951,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2890
2951
  _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
2891
2952
  _this._tokenLock = new Contract(networkAddresses.misc.TOKENLOCK, TokenLockABI.abi, networkConnection.provider);
2892
2953
  _this._auriFairLaunch = new Contract(networkAddresses.misc.AURIFAIRLAUNCH, AuriFairLaunchABI.abi, networkConnection.provider);
2893
- _this._auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, networkConnection.provider);
2954
+ _this._auriLens = new Contract(networkAddresses.misc.AURILENS, AuriLensABI.abi, networkConnection.provider);
2894
2955
  return _this;
2895
2956
  }
2896
2957
 
@@ -2903,10 +2964,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2903
2964
  while (1) {
2904
2965
  switch (_context.prev = _context.next) {
2905
2966
  case 0:
2906
- _context.next = 2;
2967
+ console.log(this._networkConnection.provider);
2968
+ _context.next = 3;
2907
2969
  return getCurrentTimestamp(this._networkConnection.provider);
2908
2970
 
2909
- case 2:
2971
+ case 3:
2910
2972
  currentTime = _context.sent;
2911
2973
  currentWeek = BigNumber$1.from(currentTime - REWARDCLAIMSTART).div(7 * ONE_DAY).toNumber();
2912
2974
  denominator = 10000;
@@ -2915,22 +2977,22 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2915
2977
  promises.push(this._tokenLock.percentageLock(currentWeek + 1)["catch"](function (err) {
2916
2978
  return denominator;
2917
2979
  }));
2918
- _context.next = 10;
2980
+ _context.next = 11;
2919
2981
  return Promise.all(promises).then(function (res) {
2920
2982
  return res.map(function (v) {
2921
2983
  return v.toString();
2922
2984
  });
2923
2985
  });
2924
2986
 
2925
- case 10:
2987
+ case 11:
2926
2988
  values = _context.sent;
2927
2989
  return _context.abrupt("return", {
2928
2990
  vestingStart: REWARDCLAIMSTART,
2929
- currentUnlockPortion: new BigNumber(values[0]).div(denominator).toNumber(),
2930
- nextUnlockPortion: new BigNumber(values[1]).div(denominator).toNumber()
2991
+ currentUnlockPortion: new BigNumber(denominator).minus(values[0]).div(denominator).toNumber(),
2992
+ nextUnlockPortion: new BigNumber(denominator).minus(values[1]).div(denominator).toNumber()
2931
2993
  });
2932
2994
 
2933
- case 12:
2995
+ case 13:
2934
2996
  case "end":
2935
2997
  return _context.stop();
2936
2998
  }
@@ -2957,6 +3019,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2957
3019
  case 0:
2958
3020
  marketCount = networkAddresses.auTokens.length;
2959
3021
  userMarketDetails = [];
3022
+ collateralRatio = new Array(marketCount);
2960
3023
  promises = [];
2961
3024
  totalBorrowLimit = new BigNumber(0);
2962
3025
  pricePromises = [];
@@ -2986,14 +3049,14 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2986
3049
  promises.push(this._comptroller.getAssetsIn(userAddress).then(function (res) {
2987
3050
  assetsIn = res;
2988
3051
  }));
2989
- _context2.next = 10;
3052
+ _context2.next = 11;
2990
3053
  return Promise.all(promises);
2991
3054
 
2992
- case 10:
2993
- _context2.next = 12;
3055
+ case 11:
3056
+ _context2.next = 13;
2994
3057
  return Promise.all(pricePromises);
2995
3058
 
2996
- case 12:
3059
+ case 13:
2997
3060
  underlyingPrices = _context2.sent;
2998
3061
  depositValuationPromises = [];
2999
3062
 
@@ -3013,10 +3076,10 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3013
3076
  _loop();
3014
3077
  }
3015
3078
 
3016
- _context2.next = 18;
3079
+ _context2.next = 19;
3017
3080
  return Promise.all(depositValuationPromises);
3018
3081
 
3019
- case 18:
3082
+ case 19:
3020
3083
  depositValues = _context2.sent;
3021
3084
  totalBorrowLimit = depositValues.reduce(function (p, v, index) {
3022
3085
  if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(collateralRatio[index]));
@@ -3024,12 +3087,12 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3024
3087
  });
3025
3088
  promises = [];
3026
3089
  promises.push(this._comptroller.getAccountLiquidity(userAddress));
3027
- promises.push(this._auriLens.getRewardBalancesMetadata(this._comptroller.address, userAddress));
3090
+ promises.push(this._auriLens.callStatic.getRewardBalancesMetadata(this._comptroller.address, this._auriFairLaunch.address, userAddress, [AurPlyPid]));
3028
3091
  promises.push(this._tokenLock.lockedAmounts(userAddress));
3029
- _context2.next = 26;
3092
+ _context2.next = 27;
3030
3093
  return Promise.all(promises);
3031
3094
 
3032
- case 26:
3095
+ case 27:
3033
3096
  values = _context2.sent;
3034
3097
  accountLiquidity = values[0];
3035
3098
  rewardBalancesMetadata = values[1];
@@ -3063,7 +3126,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3063
3126
  }
3064
3127
  });
3065
3128
 
3066
- case 35:
3129
+ case 36:
3067
3130
  case "end":
3068
3131
  return _context2.stop();
3069
3132
  }
@@ -3087,6 +3150,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3087
3150
  case 0:
3088
3151
  promises = [];
3089
3152
  promises.push(this._auriFairLaunch.getPoolInfo(AurPlyPid).then(function (res) {
3153
+ console.log(res);
3090
3154
  stakedLiquidity = res.totalStake;
3091
3155
  rewardPerSecond = res.rewardPerSecond;
3092
3156
  }));
@@ -3101,12 +3165,16 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3101
3165
  promises.push(fetchValuation(new TokenAmount(AURPLYToken, stakedLiquidity.toString()), this._networkConnection.provider).then(function (res) {
3102
3166
  return totalStakeValuation = res;
3103
3167
  }));
3168
+ _context3.next = 9;
3169
+ return Promise.all(promises);
3170
+
3171
+ case 9:
3104
3172
  return _context3.abrupt("return", {
3105
3173
  totalStakedLiquidity: new TokenAmount(AURPLYToken, stakedLiquidity.toString()),
3106
3174
  apy: calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION)
3107
3175
  });
3108
3176
 
3109
- case 8:
3177
+ case 10:
3110
3178
  case "end":
3111
3179
  return _context3.stop();
3112
3180
  }
@@ -3199,18 +3267,9 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
3199
3267
  while (1) {
3200
3268
  switch (_context6.prev = _context6.next) {
3201
3269
  case 0:
3202
- _context6.t0 = this._auriLens.connect(this._networkConnection.signer);
3203
- _context6.t1 = this._comptroller.address;
3204
- _context6.t2 = this._auriFairLaunch.address;
3205
- _context6.next = 5;
3206
- return this._networkConnection.signer.getAddress();
3270
+ return _context6.abrupt("return", this._auriLens.connect(this._networkConnection.signer).claimRewards(this._comptroller.address, this._auriFairLaunch.address, [AurPlyPid]));
3207
3271
 
3208
- case 5:
3209
- _context6.t3 = _context6.sent;
3210
- _context6.t4 = [AurPlyPid];
3211
- return _context6.abrupt("return", _context6.t0.claimRewards.call(_context6.t0, _context6.t1, _context6.t2, _context6.t3, _context6.t4));
3212
-
3213
- case 8:
3272
+ case 1:
3214
3273
  case "end":
3215
3274
  return _context6.stop();
3216
3275
  }
@@ -3309,5 +3368,5 @@ var dummyUserMarketDetails = {
3309
3368
  maxWithdrawableAmount: dummyTokenAmount
3310
3369
  };
3311
3370
 
3312
- export { AURORA_CHAINID, AURORA_DEFAULT_PROVIDER, AURORA_DEFAULT_PROVIDER_URL, AURPLYToken, AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, AurPlyPid, BORROW_LIMIT_BUFFER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, ETHAddress, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_YEAR, PLYToken, REWARDCLAIMSTART, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, calcLMRewardApr, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress };
3371
+ export { AURORA_CHAINID, AURORA_DEFAULT_PROVIDER, AURORA_DEFAULT_PROVIDER_URL, AURORA_DEFAULT_SIGNER, AURPLYToken, AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AurPlyPid, BORROW_LIMIT_BUFFER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, ComptrollerRewardType, DECIMAL_PRECISION, ETHAddress, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, ONE_YEAR, PLYToken, REWARDCLAIMSTART, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, calcLMRewardApr, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchLPPositions, fetchLPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromCoingeckoAPI, fetchPriceFromOracle, fetchUnderlyingTokensPrices, fetchValuation, formatObject, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress };
3313
3372
  //# sourceMappingURL=sdk.esm.js.map