@aurigami/sdk 0.2.3 → 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
 
@@ -893,73 +894,76 @@ var ethers = /*#__PURE__*/require('ethers');
893
894
 
894
895
  var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
895
896
  var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
897
+ var AURORA_DEFAULT_PROVIDER_URL = "https://testnet.aurora.dev";
898
+ var AURORA_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AURORA_DEFAULT_PROVIDER_URL);
896
899
  var dummyAddress = "0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE";
897
900
  var ETHAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
898
901
  var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
899
- var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
902
+ var AURORA_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey, AURORA_DEFAULT_PROVIDER);
900
903
  var AURORA_CHAINID = 1313161554;
901
904
  var DECIMAL_PRECISION = 6;
902
905
  var networkAddresses = {
903
906
  auTokens: [{
904
- address: '0x7967532568bef9ec96cfad6badea4c63add5888a',
905
- underlying: '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8'
907
+ address: /*#__PURE__*/'0xA21d86e113f161fa05d3cf767ef19Ccec1BD4889'.toLowerCase(),
908
+ underlying: /*#__PURE__*/'0x9Daf3f62cE9e53B8cd850a1ad392b632eAF7419F'.toLowerCase()
906
909
  }, {
907
- address: '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60',
908
- underlying: ETHAddress
910
+ address: /*#__PURE__*/'0xFa4A1B4137B66d69E5af8a0f63591D62A8c14446'.toLowerCase(),
911
+ underlying: /*#__PURE__*/ETHAddress.toLowerCase()
909
912
  }, {
910
- address: '0xccf005cfc3669d806a03f0617885648c397c456e',
911
- underlying: '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6'
913
+ address: /*#__PURE__*/'0x1B8A94C4C9A1496E274B153e0756F1836AeaBB30'.toLowerCase(),
914
+ underlying: /*#__PURE__*/'0x68862668FEdd002dA008596A56C5ea29921E94e6'.toLowerCase()
912
915
  }, {
913
- address: '0x55a4c111c007f39326edf22cfd63bbbb21a35b35',
914
- underlying: '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369'
916
+ address: /*#__PURE__*/'0x5f8E0b6b049fecabC16AD7d23b5F311c48555fA6'.toLowerCase(),
917
+ underlying: /*#__PURE__*/'0xc0a00D761E569007a707aA84A9A08837cb6A04c1'.toLowerCase()
915
918
  }, {
916
- address: '0x77b088236c071ab5bd4e0bd21240b093275adffc',
917
- underlying: '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18'
919
+ address: /*#__PURE__*/'0xeee0A0BC4dc3999136f35f82DdaAC3c27Ed05017'.toLowerCase(),
920
+ underlying: /*#__PURE__*/'0x5231CfaF5BD3Aa0C9423703a72706B2D40f0b783'.toLowerCase()
918
921
  }, {
919
- address: '0xaa68274f87fd9ae940f1dec31b643486838481c1',
920
- underlying: '0x7a80df8230c5aa711e2702a275ab31aeb32754bf'
922
+ address: /*#__PURE__*/'0x9Fc4f60DC140645978C53703acE6241448cFEaA8'.toLowerCase(),
923
+ underlying: /*#__PURE__*/'0xf7c51293c5eE5c76867d8Cf400627627a4Bd8697'.toLowerCase()
921
924
  }, {
922
- address: '0x6970167dfaa2aaa67404204102cbbd18b405eca9',
923
- underlying: '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428'
925
+ address: /*#__PURE__*/'0x533dBEC840f10f51B868453f86BDF211Fbc52Ba4'.toLowerCase(),
926
+ underlying: /*#__PURE__*/'0xaa847c16359bAA930ba8a5E8b6e41D6b63ABe505'.toLowerCase()
924
927
  }, {
925
- address: '0x9630a6c5b729194972199805075fd76707a9713a',
926
- underlying: '0x6f8a1daa158e08f75711a64e5a3073e959d688a6'
928
+ address: /*#__PURE__*/'0xDA748E324F4e05e1D9f517242C928A01C418c910'.toLowerCase(),
929
+ underlying: /*#__PURE__*/'0x206EA0Ae49F80d0376d04932479e33Cf2098211A'.toLowerCase()
927
930
  }],
928
931
  misc: {
929
- COMPTROLLER: "0xb51028d4f3fc69e3f9e3118ce067a4562c595aad",
930
- oracle: "0xf1ebfaa2af93f4d82215fd7817c1835853c62fb8",
931
- AURIFAIRLAUNCH: "0x7942874a9ef8059c5de259625a883dc61f03320d",
932
- 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()
933
937
  },
934
938
  tokens: {
935
- AURORA: "0x7a80df8230c5aa711e2702a275ab31aeb32754bf",
936
- PLY: "0x6f8a1daa158e08f75711a64e5a3073e959d688a6",
937
- AURPLY: dummyAddress
939
+ AURORA: /*#__PURE__*/"0xf7c51293c5eE5c76867d8Cf400627627a4Bd8697".toLowerCase(),
940
+ PLY: /*#__PURE__*/"0x206EA0Ae49F80d0376d04932479e33Cf2098211A".toLowerCase(),
941
+ AURPLY: /*#__PURE__*/dummyAddress.toLowerCase()
938
942
  }
939
943
  };
940
944
  var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
941
- var REWARDCLAIMSTART = 1673280000;
945
+ var REWARDCLAIMSTART = 1640995200;
942
946
  var ONE_DAY = 86400;
943
947
  var ONE_YEAR = ONE_DAY * 365;
944
- var AurPlyPid = 1;
948
+ var AurPlyPid = 0;
945
949
 
946
950
  var decimalRecords = {
947
951
  '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
948
- '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8': 18,
949
- '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428': 18,
950
- '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369': 18,
951
- '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18': 18,
952
- '0xaa68274f87fd9ae940f1dec31b643486838481c1': 8,
953
- '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60': 8,
954
- '0x6970167dfaa2aaa67404204102cbbd18b405eca9': 8,
955
- '0x6f8a1daa158e08f75711a64e5a3073e959d688a6': 18,
956
- '0xccf005cfc3669d806a03f0617885648c397c456e': 8,
957
- '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6': 18,
958
- '0x7a80df8230c5aa711e2702a275ab31aeb32754bf': 18,
959
- '0x9630a6c5b729194972199805075fd76707a9713a': 8,
960
- '0x77b088236c071ab5bd4e0bd21240b093275adffc': 8,
961
- '0x7967532568bef9ec96cfad6badea4c63add5888a': 8,
962
- '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
963
967
  };
964
968
 
965
969
  function formatObject(object) {
@@ -973,24 +977,13 @@ var isSameAddress = function isSameAddress(address1, address2) {
973
977
  };
974
978
  var getCurrentTimestamp = /*#__PURE__*/function () {
975
979
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider) {
976
- var latestBlockNumber, currentTime;
977
980
  return runtime_1.wrap(function _callee$(_context) {
978
981
  while (1) {
979
982
  switch (_context.prev = _context.next) {
980
983
  case 0:
981
- _context.next = 2;
982
- return provider.getBlockNumber();
983
-
984
- case 2:
985
- latestBlockNumber = _context.sent;
986
- _context.next = 5;
987
- return provider.getBlock(latestBlockNumber);
988
-
989
- case 5:
990
- currentTime = _context.sent.timestamp;
991
- return _context.abrupt("return", currentTime);
984
+ return _context.abrupt("return", Math.trunc(Date.now() / 1000));
992
985
 
993
- case 7:
986
+ case 1:
994
987
  case "end":
995
988
  return _context.stop();
996
989
  }
@@ -1062,573 +1055,6 @@ var TokenAmount = /*#__PURE__*/function () {
1062
1055
  return TokenAmount;
1063
1056
  }();
1064
1057
 
1065
- var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
1066
- _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
1067
-
1068
- function MoneyMarketRead(networkConnection, auToken, underlyingAsset) {
1069
- var _this;
1070
-
1071
- _this = _BlockchainEntityRead.call(this, networkConnection) || this;
1072
-
1073
- if (isSameAddress(underlyingAsset, ETHAddress)) {
1074
- _this.auToken = new Contract(auToken, AuETHABI.abi, networkConnection.provider);
1075
- } else {
1076
- _this.auToken = new Contract(auToken, AuErc20ABI.abi, networkConnection.provider);
1077
- }
1078
-
1079
- _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
1080
- _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
1081
- return _this;
1082
- }
1083
-
1084
- var _proto = MoneyMarketRead.prototype;
1085
-
1086
- _proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
1087
- var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1088
- return runtime_1.wrap(function _callee$(_context) {
1089
- while (1) {
1090
- switch (_context.prev = _context.next) {
1091
- case 0:
1092
- _context.t0 = TokenAmount;
1093
- _context.t1 = this.underlying;
1094
- _context.next = 4;
1095
- return this.auToken.totalBorrows();
1096
-
1097
- case 4:
1098
- _context.t2 = _context.sent.toString();
1099
- return _context.abrupt("return", new _context.t0(_context.t1, _context.t2));
1100
-
1101
- case 6:
1102
- case "end":
1103
- return _context.stop();
1104
- }
1105
- }
1106
- }, _callee, this);
1107
- }));
1108
-
1109
- function getTotalTokenBorrowed() {
1110
- return _getTotalTokenBorrowed.apply(this, arguments);
1111
- }
1112
-
1113
- return getTotalTokenBorrowed;
1114
- }();
1115
-
1116
- _proto.getTotalTokenDeposited = /*#__PURE__*/function () {
1117
- var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1118
- var _this2 = this;
1119
-
1120
- var promises, totalBorrow, totalCash;
1121
- return runtime_1.wrap(function _callee2$(_context2) {
1122
- while (1) {
1123
- switch (_context2.prev = _context2.next) {
1124
- case 0:
1125
- promises = [];
1126
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
1127
- totalBorrow = res;
1128
- }));
1129
- promises.push(this.auToken.getCash().then(function (res) {
1130
- totalCash = new TokenAmount(_this2.underlying, res.toString());
1131
- }));
1132
- _context2.next = 5;
1133
- return Promise.all(promises);
1134
-
1135
- case 5:
1136
- return _context2.abrupt("return", new TokenAmount(this.underlying, BigNumber$1.from(totalCash.rawAmount).add(totalBorrow.rawAmount()).toString()));
1137
-
1138
- case 6:
1139
- case "end":
1140
- return _context2.stop();
1141
- }
1142
- }
1143
- }, _callee2, this);
1144
- }));
1145
-
1146
- function getTotalTokenDeposited() {
1147
- return _getTotalTokenDeposited.apply(this, arguments);
1148
- }
1149
-
1150
- return getTotalTokenDeposited;
1151
- }();
1152
-
1153
- _proto.getDepositAPY = /*#__PURE__*/function () {
1154
- var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1155
- var supplyRatePerTimestamp;
1156
- return runtime_1.wrap(function _callee3$(_context3) {
1157
- while (1) {
1158
- switch (_context3.prev = _context3.next) {
1159
- case 0:
1160
- _context3.next = 2;
1161
- return this.auToken.supplyRatePerTimestamp();
1162
-
1163
- case 2:
1164
- supplyRatePerTimestamp = _context3.sent;
1165
- return _context3.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1166
-
1167
- case 4:
1168
- case "end":
1169
- return _context3.stop();
1170
- }
1171
- }
1172
- }, _callee3, this);
1173
- }));
1174
-
1175
- function getDepositAPY() {
1176
- return _getDepositAPY.apply(this, arguments);
1177
- }
1178
-
1179
- return getDepositAPY;
1180
- }();
1181
-
1182
- _proto.getBorrowAPY = /*#__PURE__*/function () {
1183
- var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
1184
- var borrowRatePerTimestamp;
1185
- return runtime_1.wrap(function _callee4$(_context4) {
1186
- while (1) {
1187
- switch (_context4.prev = _context4.next) {
1188
- case 0:
1189
- _context4.next = 2;
1190
- return this.auToken.borrowRatePerTimestamp();
1191
-
1192
- case 2:
1193
- borrowRatePerTimestamp = _context4.sent;
1194
- return _context4.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1195
-
1196
- case 4:
1197
- case "end":
1198
- return _context4.stop();
1199
- }
1200
- }
1201
- }, _callee4, this);
1202
- }));
1203
-
1204
- function getBorrowAPY() {
1205
- return _getBorrowAPY.apply(this, arguments);
1206
- }
1207
-
1208
- return getBorrowAPY;
1209
- }();
1210
-
1211
- _proto.getCollateralRatio = /*#__PURE__*/function () {
1212
- var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
1213
- return runtime_1.wrap(function _callee5$(_context5) {
1214
- while (1) {
1215
- switch (_context5.prev = _context5.next) {
1216
- case 0:
1217
- return _context5.abrupt("return", this._comptroller.markets(this.auToken.address).then(function (res) {
1218
- return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
1219
- }));
1220
-
1221
- case 1:
1222
- case "end":
1223
- return _context5.stop();
1224
- }
1225
- }
1226
- }, _callee5, this);
1227
- }));
1228
-
1229
- function getCollateralRatio() {
1230
- return _getCollateralRatio.apply(this, arguments);
1231
- }
1232
-
1233
- return getCollateralRatio;
1234
- }();
1235
-
1236
- _proto.getBorrowPlyAPY = /*#__PURE__*/function () {
1237
- var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
1238
- var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
1239
- return runtime_1.wrap(function _callee6$(_context6) {
1240
- while (1) {
1241
- switch (_context6.prev = _context6.next) {
1242
- case 0:
1243
- promises = [];
1244
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
1245
- totalBorrowed = res;
1246
- }));
1247
- promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
1248
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
1249
- }));
1250
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
1251
- plyPrice = res;
1252
- }));
1253
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
1254
- underlyingPrice = res;
1255
- }));
1256
- _context6.next = 7;
1257
- return Promise.all(promises);
1258
-
1259
- case 7:
1260
- return _context6.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
1261
-
1262
- case 8:
1263
- case "end":
1264
- return _context6.stop();
1265
- }
1266
- }
1267
- }, _callee6, this);
1268
- }));
1269
-
1270
- function getBorrowPlyAPY() {
1271
- return _getBorrowPlyAPY.apply(this, arguments);
1272
- }
1273
-
1274
- return getBorrowPlyAPY;
1275
- }();
1276
-
1277
- _proto.getDepositPlyAPY = /*#__PURE__*/function () {
1278
- var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
1279
- var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
1280
- return runtime_1.wrap(function _callee7$(_context7) {
1281
- while (1) {
1282
- switch (_context7.prev = _context7.next) {
1283
- case 0:
1284
- promises = [];
1285
- promises.push(this.getTotalTokenDeposited().then(function (res) {
1286
- totalDeposited = res;
1287
- }));
1288
- promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
1289
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
1290
- }));
1291
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
1292
- plyPrice = res;
1293
- }));
1294
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
1295
- underlyingPrice = res;
1296
- }));
1297
- _context7.next = 7;
1298
- return Promise.all(promises);
1299
-
1300
- case 7:
1301
- return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
1302
-
1303
- case 8:
1304
- case "end":
1305
- return _context7.stop();
1306
- }
1307
- }
1308
- }, _callee7, this);
1309
- }));
1310
-
1311
- function getDepositPlyAPY() {
1312
- return _getDepositPlyAPY.apply(this, arguments);
1313
- }
1314
-
1315
- return getDepositPlyAPY;
1316
- }();
1317
-
1318
- _proto.getDetails = /*#__PURE__*/function () {
1319
- var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
1320
- var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeed, plyPrice, underlyingPrice, borrowPlyApy, depositPlyApy;
1321
- return runtime_1.wrap(function _callee8$(_context8) {
1322
- while (1) {
1323
- switch (_context8.prev = _context8.next) {
1324
- case 0:
1325
- promises = [];
1326
- promises.push(this.getTotalTokenDeposited().then(function (res) {
1327
- totalDeposited = res;
1328
- }));
1329
- promises.push(this.getTotalTokenBorrowed().then(function (res) {
1330
- totalBorrowed = res;
1331
- }));
1332
- promises.push(this.getDepositAPY().then(function (res) {
1333
- depositAPY = res.toNumber();
1334
- }));
1335
- promises.push(this.getBorrowAPY().then(function (res) {
1336
- borrowAPY = res.toNumber();
1337
- }));
1338
- promises.push(this.getCollateralRatio().then(function (res) {
1339
- collateralRatio = res.toNumber();
1340
- }));
1341
- promises.push(this._comptroller.rewardSpeeds(ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
1342
- rewardSpeed = new TokenAmount(PLYToken, res.toString());
1343
- }));
1344
- promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
1345
- plyPrice = res;
1346
- }));
1347
- promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
1348
- underlyingPrice = res;
1349
- }));
1350
- _context8.next = 11;
1351
- return Promise.all(promises);
1352
-
1353
- case 11:
1354
- borrowPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
1355
- depositPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
1356
- return _context8.abrupt("return", {
1357
- auTokenAddress: this.auToken.address,
1358
- totalTokenDeposited: totalDeposited,
1359
- totalTokenBorrowed: totalBorrowed,
1360
- depositApy: depositAPY,
1361
- depositPlyApy: depositPlyApy.toNumber(),
1362
- borrowApy: borrowAPY,
1363
- borrowPlyApy: borrowPlyApy.toNumber(),
1364
- collateralRatio: collateralRatio
1365
- });
1366
-
1367
- case 14:
1368
- case "end":
1369
- return _context8.stop();
1370
- }
1371
- }
1372
- }, _callee8, this);
1373
- }));
1374
-
1375
- function getDetails() {
1376
- return _getDetails.apply(this, arguments);
1377
- }
1378
-
1379
- return getDetails;
1380
- }();
1381
-
1382
- _proto.getUserBorrowBalance = /*#__PURE__*/function () {
1383
- var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(userAddress) {
1384
- var totalBorrow;
1385
- return runtime_1.wrap(function _callee9$(_context9) {
1386
- while (1) {
1387
- switch (_context9.prev = _context9.next) {
1388
- case 0:
1389
- _context9.next = 2;
1390
- return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
1391
-
1392
- case 2:
1393
- totalBorrow = _context9.sent;
1394
- return _context9.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
1395
-
1396
- case 4:
1397
- case "end":
1398
- return _context9.stop();
1399
- }
1400
- }
1401
- }, _callee9, this);
1402
- }));
1403
-
1404
- function getUserBorrowBalance(_x) {
1405
- return _getUserBorrowBalance.apply(this, arguments);
1406
- }
1407
-
1408
- return getUserBorrowBalance;
1409
- }();
1410
-
1411
- _proto.getUserDepositBalance = /*#__PURE__*/function () {
1412
- var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
1413
- var totalDeposit;
1414
- return runtime_1.wrap(function _callee10$(_context10) {
1415
- while (1) {
1416
- switch (_context10.prev = _context10.next) {
1417
- case 0:
1418
- _context10.next = 2;
1419
- return this.auToken.callStatic.balanceOfUnderlying(userAddress);
1420
-
1421
- case 2:
1422
- totalDeposit = _context10.sent;
1423
- return _context10.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
1424
-
1425
- case 4:
1426
- case "end":
1427
- return _context10.stop();
1428
- }
1429
- }
1430
- }, _callee10, this);
1431
- }));
1432
-
1433
- function getUserDepositBalance(_x2) {
1434
- return _getUserDepositBalance.apply(this, arguments);
1435
- }
1436
-
1437
- return getUserDepositBalance;
1438
- }();
1439
-
1440
- return MoneyMarketRead;
1441
- }(BlockchainEntityRead);
1442
- var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
1443
- _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
1444
-
1445
- function MoneyMarketReadWrite() {
1446
- return _MoneyMarketRead.apply(this, arguments) || this;
1447
- }
1448
-
1449
- var _proto2 = MoneyMarketReadWrite.prototype;
1450
-
1451
- _proto2.deposit = /*#__PURE__*/function () {
1452
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
1453
- return runtime_1.wrap(function _callee11$(_context11) {
1454
- while (1) {
1455
- switch (_context11.prev = _context11.next) {
1456
- case 0:
1457
- if (!isSameAddress(amount.token.address, ETHAddress)) {
1458
- _context11.next = 4;
1459
- break;
1460
- }
1461
-
1462
- return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
1463
- value: amount.rawAmount()
1464
- }));
1465
-
1466
- case 4:
1467
- return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
1468
-
1469
- case 5:
1470
- case "end":
1471
- return _context11.stop();
1472
- }
1473
- }
1474
- }, _callee11, this);
1475
- }));
1476
-
1477
- function deposit(_x3) {
1478
- return _deposit.apply(this, arguments);
1479
- }
1480
-
1481
- return deposit;
1482
- }();
1483
-
1484
- _proto2.borrow = /*#__PURE__*/function () {
1485
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
1486
- return runtime_1.wrap(function _callee12$(_context12) {
1487
- while (1) {
1488
- switch (_context12.prev = _context12.next) {
1489
- case 0:
1490
- return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
1491
-
1492
- case 1:
1493
- case "end":
1494
- return _context12.stop();
1495
- }
1496
- }
1497
- }, _callee12, this);
1498
- }));
1499
-
1500
- function borrow(_x4) {
1501
- return _borrow.apply(this, arguments);
1502
- }
1503
-
1504
- return borrow;
1505
- }();
1506
-
1507
- _proto2.withdraw = /*#__PURE__*/function () {
1508
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
1509
- return runtime_1.wrap(function _callee13$(_context13) {
1510
- while (1) {
1511
- switch (_context13.prev = _context13.next) {
1512
- case 0:
1513
- return _context13.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
1514
-
1515
- case 1:
1516
- case "end":
1517
- return _context13.stop();
1518
- }
1519
- }
1520
- }, _callee13, this);
1521
- }));
1522
-
1523
- function withdraw(_x5) {
1524
- return _withdraw.apply(this, arguments);
1525
- }
1526
-
1527
- return withdraw;
1528
- }();
1529
-
1530
- _proto2.repay = /*#__PURE__*/function () {
1531
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
1532
- return runtime_1.wrap(function _callee14$(_context14) {
1533
- while (1) {
1534
- switch (_context14.prev = _context14.next) {
1535
- case 0:
1536
- if (!isSameAddress(amount.token.address, ETHAddress)) {
1537
- _context14.next = 4;
1538
- break;
1539
- }
1540
-
1541
- return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
1542
- value: amount.rawAmount()
1543
- }));
1544
-
1545
- case 4:
1546
- return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
1547
-
1548
- case 5:
1549
- case "end":
1550
- return _context14.stop();
1551
- }
1552
- }
1553
- }, _callee14, this);
1554
- }));
1555
-
1556
- function repay(_x6) {
1557
- return _repay.apply(this, arguments);
1558
- }
1559
-
1560
- return repay;
1561
- }();
1562
-
1563
- _proto2.enableCollateral = /*#__PURE__*/function () {
1564
- var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
1565
- return runtime_1.wrap(function _callee15$(_context15) {
1566
- while (1) {
1567
- switch (_context15.prev = _context15.next) {
1568
- case 0:
1569
- return _context15.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
1570
-
1571
- case 1:
1572
- case "end":
1573
- return _context15.stop();
1574
- }
1575
- }
1576
- }, _callee15, this);
1577
- }));
1578
-
1579
- function enableCollateral() {
1580
- return _enableCollateral.apply(this, arguments);
1581
- }
1582
-
1583
- return enableCollateral;
1584
- }();
1585
-
1586
- _proto2.disableCollateral = /*#__PURE__*/function () {
1587
- var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
1588
- return runtime_1.wrap(function _callee16$(_context16) {
1589
- while (1) {
1590
- switch (_context16.prev = _context16.next) {
1591
- case 0:
1592
- return _context16.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
1593
-
1594
- case 1:
1595
- case "end":
1596
- return _context16.stop();
1597
- }
1598
- }
1599
- }, _callee16, this);
1600
- }));
1601
-
1602
- function disableCollateral() {
1603
- return _disableCollateral.apply(this, arguments);
1604
- }
1605
-
1606
- return disableCollateral;
1607
- }();
1608
-
1609
- return MoneyMarketReadWrite;
1610
- }(MoneyMarketRead);
1611
- var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
1612
- _inheritsLoose(MoneyMarket, _BlockchainEntity);
1613
-
1614
- function MoneyMarket(address, underlying) {
1615
- var _this3;
1616
-
1617
- _this3 = _BlockchainEntity.call(this) || this;
1618
- _this3.address = validateAndParseAddress(address);
1619
- _this3.underlying = validateAndParseAddress(underlying);
1620
- return _this3;
1621
- }
1622
-
1623
- var _proto3 = MoneyMarket.prototype;
1624
-
1625
- _proto3.read = function read(networkConnection) {
1626
- return new MoneyMarketRead(networkConnection, this.address, this.underlying);
1627
- };
1628
-
1629
- return MoneyMarket;
1630
- }(BlockchainEntity);
1631
-
1632
1058
  var abi = [
1633
1059
  {
1634
1060
  inputs: [
@@ -2578,304 +2004,942 @@ var IUniswapV2PairABI = {
2578
2004
  deployedLinkReferences: deployedLinkReferences
2579
2005
  };
2580
2006
 
2581
- var abi$2 = [
2582
- ];
2583
- var dummyABI = {
2584
- abi: abi$2
2585
- };
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));
2586
2598
 
2587
- var axios = /*#__PURE__*/require('axios');
2599
+ case 8:
2600
+ case "end":
2601
+ return _context8.stop();
2602
+ }
2603
+ }
2604
+ }, _callee8, this);
2605
+ }));
2588
2606
 
2589
- function fetchPriceFromCoingeckoAPI(_x) {
2590
- return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
2591
- }
2607
+ function getDepositPlyAPY() {
2608
+ return _getDepositPlyAPY.apply(this, arguments);
2609
+ }
2592
2610
 
2593
- function _fetchPriceFromCoingeckoAPI() {
2594
- _fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
2595
- var price;
2596
- return runtime_1.wrap(function _callee$(_context) {
2597
- while (1) {
2598
- switch (_context.prev = _context.next) {
2599
- case 0:
2600
- _context.next = 2;
2601
- return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
2602
- return res.data;
2603
- });
2611
+ return getDepositPlyAPY;
2612
+ }();
2604
2613
 
2605
- case 2:
2606
- price = _context.sent;
2607
- 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);
2608
2648
 
2609
- case 4:
2610
- case "end":
2611
- 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
+ }
2612
2683
  }
2613
- }
2614
- }, _callee);
2615
- }));
2616
- return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
2617
- }
2684
+ }, _callee9, this);
2685
+ }));
2618
2686
 
2619
- function fetchPriceFromCoingecko(_x2) {
2620
- return _fetchPriceFromCoingecko.apply(this, arguments);
2621
- }
2687
+ function getDetails() {
2688
+ return _getDetails.apply(this, arguments);
2689
+ }
2622
2690
 
2623
- function _fetchPriceFromCoingecko() {
2624
- _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
2625
- return runtime_1.wrap(function _callee2$(_context2) {
2626
- while (1) {
2627
- switch (_context2.prev = _context2.next) {
2628
- case 0:
2629
- if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
2630
- _context2.next = 4;
2631
- break;
2632
- }
2691
+ return getDetails;
2692
+ }();
2633
2693
 
2634
- 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);
2635
2703
 
2636
- case 4:
2637
- 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()));
2638
2707
 
2639
- case 5:
2640
- case "end":
2641
- return _context2.stop();
2708
+ case 4:
2709
+ case "end":
2710
+ return _context10.stop();
2711
+ }
2642
2712
  }
2643
- }
2644
- }, _callee2);
2645
- }));
2646
- return _fetchPriceFromCoingecko.apply(this, arguments);
2647
- }
2713
+ }, _callee10, this);
2714
+ }));
2648
2715
 
2649
- function fetchLPPositions(_x3, _x4) {
2650
- return _fetchLPPositions.apply(this, arguments);
2651
- }
2716
+ function getUserBorrowBalance(_x) {
2717
+ return _getUserBorrowBalance.apply(this, arguments);
2718
+ }
2652
2719
 
2653
- function _fetchLPPositions() {
2654
- _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(LPAddress, provider) {
2655
- var promises, LPContract, values;
2656
- return runtime_1.wrap(function _callee3$(_context3) {
2657
- while (1) {
2658
- switch (_context3.prev = _context3.next) {
2659
- case 0:
2660
- promises = [];
2661
- LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
2662
- promises.push(LPContract.token0());
2663
- promises.push(LPContract.toekn1());
2664
- promises.push(LPContract.getReserves());
2665
- promises.push(LPContract.totalSupply());
2666
- _context3.next = 8;
2667
- return Promise.all(promises);
2720
+ return getUserBorrowBalance;
2721
+ }();
2668
2722
 
2669
- case 8:
2670
- values = _context3.sent;
2671
- return _context3.abrupt("return", {
2672
- token0: values[0],
2673
- token1: values[1],
2674
- reserve0: values[2]._reserve0,
2675
- reserve1: values[2]._reserve1,
2676
- totalSupply: values[3]
2677
- });
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);
2678
2732
 
2679
- case 10:
2680
- case "end":
2681
- 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
+ }
2682
2741
  }
2683
- }
2684
- }, _callee3);
2685
- }));
2686
- return _fetchLPPositions.apply(this, arguments);
2687
- }
2742
+ }, _callee11, this);
2743
+ }));
2688
2744
 
2689
- function fetchLPPrice(_x5, _x6) {
2690
- return _fetchLPPrice.apply(this, arguments);
2691
- }
2745
+ function getUserDepositBalance(_x2) {
2746
+ return _getUserDepositBalance.apply(this, arguments);
2747
+ }
2692
2748
 
2693
- function _fetchLPPrice() {
2694
- _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(address, provider) {
2695
- var LPInfo, token0Price, reserveUSD, token1Price, _reserveUSD;
2749
+ return getUserDepositBalance;
2750
+ }();
2696
2751
 
2697
- return runtime_1.wrap(function _callee4$(_context4) {
2698
- while (1) {
2699
- switch (_context4.prev = _context4.next) {
2700
- case 0:
2701
- _context4.next = 2;
2702
- return fetchLPPositions(address, provider);
2752
+ return MoneyMarketRead;
2753
+ }(BlockchainEntityRead);
2754
+ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
2755
+ _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
2703
2756
 
2704
- case 2:
2705
- LPInfo = _context4.sent;
2706
- _context4.prev = 3;
2707
- _context4.next = 6;
2708
- 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()));
2709
2803
 
2710
- case 6:
2711
- token0Price = _context4.sent;
2712
- reserveUSD = token0Price.multipliedBy(LPInfo.reserve0.toString()).multipliedBy(2);
2713
- 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
+ }));
2714
2811
 
2715
- case 11:
2716
- _context4.prev = 11;
2717
- _context4.t0 = _context4["catch"](3);
2718
- _context4.prev = 13;
2719
- _context4.next = 16;
2720
- return fetchPrice(LPInfo.token1, provider);
2812
+ function borrow(_x4) {
2813
+ return _borrow.apply(this, arguments);
2814
+ }
2721
2815
 
2722
- case 16:
2723
- token1Price = _context4.sent;
2724
- _reserveUSD = token1Price.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(2);
2725
- return _context4.abrupt("return", _reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2816
+ return borrow;
2817
+ }();
2726
2818
 
2727
- case 21:
2728
- _context4.prev = 21;
2729
- _context4.t1 = _context4["catch"](13);
2730
- 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()));
2731
2826
 
2732
- case 24:
2733
- case "end":
2734
- return _context4.stop();
2827
+ case 1:
2828
+ case "end":
2829
+ return _context14.stop();
2830
+ }
2735
2831
  }
2736
- }
2737
- }, _callee4, null, [[3, 11], [13, 21]]);
2738
- }));
2739
- return _fetchLPPrice.apply(this, arguments);
2740
- }
2832
+ }, _callee14, this);
2833
+ }));
2741
2834
 
2742
- function processPriceFromOracle(rawPrice, underlyingDecimal) {
2743
- return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
2744
- }
2835
+ function withdraw(_x5) {
2836
+ return _withdraw.apply(this, arguments);
2837
+ }
2745
2838
 
2746
- function fetchPriceFromOracle(_x7, _x8, _x9) {
2747
- return _fetchPriceFromOracle.apply(this, arguments);
2748
- }
2839
+ return withdraw;
2840
+ }();
2749
2841
 
2750
- function _fetchPriceFromOracle() {
2751
- _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(auTokenAddress, underlyingDecimal, provider) {
2752
- var oracleContract, rawPrice;
2753
- return runtime_1.wrap(function _callee5$(_context5) {
2754
- while (1) {
2755
- switch (_context5.prev = _context5.next) {
2756
- case 0:
2757
- oracleContract = new Contract(networkAddresses.misc.oracle, OracleABI.abi, provider);
2758
- _context5.next = 3;
2759
- 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
+ }
2760
2852
 
2761
- case 3:
2762
- rawPrice = _context5.sent;
2763
- return _context5.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
2853
+ return _context15.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
2854
+ value: amount.rawAmount()
2855
+ }));
2764
2856
 
2765
- case 5:
2766
- case "end":
2767
- 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
+ }
2768
2864
  }
2769
- }
2770
- }, _callee5);
2771
- }));
2772
- return _fetchPriceFromOracle.apply(this, arguments);
2773
- }
2865
+ }, _callee15, this);
2866
+ }));
2774
2867
 
2775
- function fetchUnderlyingTokensPrices(_x10) {
2776
- return _fetchUnderlyingTokensPrices.apply(this, arguments);
2777
- }
2868
+ function repay(_x6) {
2869
+ return _repay.apply(this, arguments);
2870
+ }
2778
2871
 
2779
- function _fetchUnderlyingTokensPrices() {
2780
- _fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
2781
- var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
2782
- return runtime_1.wrap(function _callee6$(_context6) {
2783
- while (1) {
2784
- switch (_context6.prev = _context6.next) {
2785
- case 0:
2786
- auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, provider);
2787
- auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
2788
- return auToken.address;
2789
- });
2790
- underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
2791
- return getDecimal(auToken.underlying);
2792
- });
2793
- _context6.next = 5;
2794
- return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
2872
+ return repay;
2873
+ }();
2795
2874
 
2796
- case 5:
2797
- rawPrices = _context6.sent;
2798
- return _context6.abrupt("return", rawPrices.map(function (res, ind) {
2799
- return {
2800
- auToken: res.auToken,
2801
- underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
2802
- };
2803
- }));
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]));
2804
2882
 
2805
- case 7:
2806
- case "end":
2807
- return _context6.stop();
2883
+ case 1:
2884
+ case "end":
2885
+ return _context16.stop();
2886
+ }
2808
2887
  }
2809
- }
2810
- }, _callee6);
2811
- }));
2812
- return _fetchUnderlyingTokensPrices.apply(this, arguments);
2813
- }
2888
+ }, _callee16, this);
2889
+ }));
2814
2890
 
2815
- function fetchPrice(_x11, _x12) {
2816
- return _fetchPrice.apply(this, arguments);
2817
- }
2891
+ function enableCollateral() {
2892
+ return _enableCollateral.apply(this, arguments);
2893
+ }
2818
2894
 
2819
- function _fetchPrice() {
2820
- _fetchPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(address, provider) {
2821
- var matchingAuToken;
2822
- return runtime_1.wrap(function _callee7$(_context7) {
2823
- while (1) {
2824
- switch (_context7.prev = _context7.next) {
2825
- case 0:
2826
- matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2827
- return isSameAddress(auToken.underlying, address);
2828
- });
2895
+ return enableCollateral;
2896
+ }();
2829
2897
 
2830
- if (!(matchingAuToken !== undefined)) {
2831
- _context7.next = 5;
2832
- break;
2833
- }
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));
2834
2905
 
2835
- 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
+ }));
2836
2913
 
2837
- case 5:
2838
- if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
2839
- _context7.next = 9;
2840
- break;
2841
- }
2914
+ function disableCollateral() {
2915
+ return _disableCollateral.apply(this, arguments);
2916
+ }
2842
2917
 
2843
- return _context7.abrupt("return", fetchLPPrice(address, provider));
2918
+ return disableCollateral;
2919
+ }();
2844
2920
 
2845
- case 9:
2846
- return _context7.abrupt("return", fetchPriceFromCoingecko(address));
2921
+ return MoneyMarketReadWrite;
2922
+ }(MoneyMarketRead);
2923
+ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
2924
+ _inheritsLoose(MoneyMarket, _BlockchainEntity);
2847
2925
 
2848
- case 10:
2849
- case "end":
2850
- return _context7.stop();
2851
- }
2852
- }
2853
- }, _callee7);
2854
- }));
2855
- return _fetchPrice.apply(this, arguments);
2856
- }
2926
+ function MoneyMarket(address, underlying) {
2927
+ var _this3;
2857
2928
 
2858
- function fetchValuation(_x13, _x14, _x15) {
2859
- return _fetchValuation.apply(this, arguments);
2860
- }
2929
+ _this3 = _BlockchainEntity.call(this) || this;
2930
+ _this3.address = validateAndParseAddress(address);
2931
+ _this3.underlying = validateAndParseAddress(underlying);
2932
+ return _this3;
2933
+ }
2861
2934
 
2862
- function _fetchValuation() {
2863
- _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(tokenAmount, provider, price) {
2864
- return runtime_1.wrap(function _callee8$(_context8) {
2865
- while (1) {
2866
- switch (_context8.prev = _context8.next) {
2867
- case 0:
2868
- return _context8.abrupt("return", new BigNumber(0));
2935
+ var _proto3 = MoneyMarket.prototype;
2869
2936
 
2870
- case 1:
2871
- case "end":
2872
- return _context8.stop();
2873
- }
2874
- }
2875
- }, _callee8);
2876
- }));
2877
- return _fetchValuation.apply(this, arguments);
2878
- }
2937
+ _proto3.read = function read(networkConnection) {
2938
+ return new MoneyMarketRead(networkConnection, this.address, this.underlying);
2939
+ };
2940
+
2941
+ return MoneyMarket;
2942
+ }(BlockchainEntity);
2879
2943
 
2880
2944
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2881
2945
  _inheritsLoose(SdkRead, _BlockchainEntityRead);
@@ -2887,7 +2951,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2887
2951
  _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
2888
2952
  _this._tokenLock = new Contract(networkAddresses.misc.TOKENLOCK, TokenLockABI.abi, networkConnection.provider);
2889
2953
  _this._auriFairLaunch = new Contract(networkAddresses.misc.AURIFAIRLAUNCH, AuriFairLaunchABI.abi, networkConnection.provider);
2890
- _this._auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, networkConnection.provider);
2954
+ _this._auriLens = new Contract(networkAddresses.misc.AURILENS, AuriLensABI.abi, networkConnection.provider);
2891
2955
  return _this;
2892
2956
  }
2893
2957
 
@@ -2900,10 +2964,11 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2900
2964
  while (1) {
2901
2965
  switch (_context.prev = _context.next) {
2902
2966
  case 0:
2903
- _context.next = 2;
2967
+ console.log(this._networkConnection.provider);
2968
+ _context.next = 3;
2904
2969
  return getCurrentTimestamp(this._networkConnection.provider);
2905
2970
 
2906
- case 2:
2971
+ case 3:
2907
2972
  currentTime = _context.sent;
2908
2973
  currentWeek = BigNumber$1.from(currentTime - REWARDCLAIMSTART).div(7 * ONE_DAY).toNumber();
2909
2974
  denominator = 10000;
@@ -2912,22 +2977,22 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2912
2977
  promises.push(this._tokenLock.percentageLock(currentWeek + 1)["catch"](function (err) {
2913
2978
  return denominator;
2914
2979
  }));
2915
- _context.next = 10;
2980
+ _context.next = 11;
2916
2981
  return Promise.all(promises).then(function (res) {
2917
2982
  return res.map(function (v) {
2918
2983
  return v.toString();
2919
2984
  });
2920
2985
  });
2921
2986
 
2922
- case 10:
2987
+ case 11:
2923
2988
  values = _context.sent;
2924
2989
  return _context.abrupt("return", {
2925
2990
  vestingStart: REWARDCLAIMSTART,
2926
- currentUnlockPortion: new BigNumber(values[0]).div(denominator).toNumber(),
2927
- 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()
2928
2993
  });
2929
2994
 
2930
- case 12:
2995
+ case 13:
2931
2996
  case "end":
2932
2997
  return _context.stop();
2933
2998
  }
@@ -2954,6 +3019,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2954
3019
  case 0:
2955
3020
  marketCount = networkAddresses.auTokens.length;
2956
3021
  userMarketDetails = [];
3022
+ collateralRatio = new Array(marketCount);
2957
3023
  promises = [];
2958
3024
  totalBorrowLimit = new BigNumber(0);
2959
3025
  pricePromises = [];
@@ -2983,14 +3049,14 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2983
3049
  promises.push(this._comptroller.getAssetsIn(userAddress).then(function (res) {
2984
3050
  assetsIn = res;
2985
3051
  }));
2986
- _context2.next = 10;
3052
+ _context2.next = 11;
2987
3053
  return Promise.all(promises);
2988
3054
 
2989
- case 10:
2990
- _context2.next = 12;
3055
+ case 11:
3056
+ _context2.next = 13;
2991
3057
  return Promise.all(pricePromises);
2992
3058
 
2993
- case 12:
3059
+ case 13:
2994
3060
  underlyingPrices = _context2.sent;
2995
3061
  depositValuationPromises = [];
2996
3062
 
@@ -3010,10 +3076,10 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3010
3076
  _loop();
3011
3077
  }
3012
3078
 
3013
- _context2.next = 18;
3079
+ _context2.next = 19;
3014
3080
  return Promise.all(depositValuationPromises);
3015
3081
 
3016
- case 18:
3082
+ case 19:
3017
3083
  depositValues = _context2.sent;
3018
3084
  totalBorrowLimit = depositValues.reduce(function (p, v, index) {
3019
3085
  if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(collateralRatio[index]));
@@ -3021,12 +3087,12 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3021
3087
  });
3022
3088
  promises = [];
3023
3089
  promises.push(this._comptroller.getAccountLiquidity(userAddress));
3024
- promises.push(this._auriLens.getRewardBalancesMetadata(this._comptroller.address, userAddress));
3090
+ promises.push(this._auriLens.callStatic.getRewardBalancesMetadata(this._comptroller.address, this._auriFairLaunch.address, userAddress, [AurPlyPid]));
3025
3091
  promises.push(this._tokenLock.lockedAmounts(userAddress));
3026
- _context2.next = 26;
3092
+ _context2.next = 27;
3027
3093
  return Promise.all(promises);
3028
3094
 
3029
- case 26:
3095
+ case 27:
3030
3096
  values = _context2.sent;
3031
3097
  accountLiquidity = values[0];
3032
3098
  rewardBalancesMetadata = values[1];
@@ -3060,7 +3126,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3060
3126
  }
3061
3127
  });
3062
3128
 
3063
- case 35:
3129
+ case 36:
3064
3130
  case "end":
3065
3131
  return _context2.stop();
3066
3132
  }
@@ -3084,6 +3150,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3084
3150
  case 0:
3085
3151
  promises = [];
3086
3152
  promises.push(this._auriFairLaunch.getPoolInfo(AurPlyPid).then(function (res) {
3153
+ console.log(res);
3087
3154
  stakedLiquidity = res.totalStake;
3088
3155
  rewardPerSecond = res.rewardPerSecond;
3089
3156
  }));
@@ -3098,12 +3165,16 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
3098
3165
  promises.push(fetchValuation(new TokenAmount(AURPLYToken, stakedLiquidity.toString()), this._networkConnection.provider).then(function (res) {
3099
3166
  return totalStakeValuation = res;
3100
3167
  }));
3168
+ _context3.next = 9;
3169
+ return Promise.all(promises);
3170
+
3171
+ case 9:
3101
3172
  return _context3.abrupt("return", {
3102
3173
  totalStakedLiquidity: new TokenAmount(AURPLYToken, stakedLiquidity.toString()),
3103
3174
  apy: calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION)
3104
3175
  });
3105
3176
 
3106
- case 8:
3177
+ case 10:
3107
3178
  case "end":
3108
3179
  return _context3.stop();
3109
3180
  }
@@ -3196,18 +3267,9 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
3196
3267
  while (1) {
3197
3268
  switch (_context6.prev = _context6.next) {
3198
3269
  case 0:
3199
- _context6.t0 = this._auriLens.connect(this._networkConnection.signer);
3200
- _context6.t1 = this._comptroller.address;
3201
- _context6.t2 = this._auriFairLaunch.address;
3202
- _context6.next = 5;
3203
- return this._networkConnection.signer.getAddress();
3270
+ return _context6.abrupt("return", this._auriLens.connect(this._networkConnection.signer).claimRewards(this._comptroller.address, this._auriFairLaunch.address, [AurPlyPid]));
3204
3271
 
3205
- case 5:
3206
- _context6.t3 = _context6.sent;
3207
- _context6.t4 = [AurPlyPid];
3208
- return _context6.abrupt("return", _context6.t0.claimRewards.call(_context6.t0, _context6.t1, _context6.t2, _context6.t3, _context6.t4));
3209
-
3210
- case 8:
3272
+ case 1:
3211
3273
  case "end":
3212
3274
  return _context6.stop();
3213
3275
  }
@@ -3306,5 +3368,5 @@ var dummyUserMarketDetails = {
3306
3368
  maxWithdrawableAmount: dummyTokenAmount
3307
3369
  };
3308
3370
 
3309
- export { AURORA_CHAINID, 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 };
3310
3372
  //# sourceMappingURL=sdk.esm.js.map