@aurigami/sdk 0.1.4 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.esm.js CHANGED
@@ -1,5 +1,11 @@
1
+ import { Signer } from '@ethersproject/abstract-signer';
1
2
  import BigNumber from 'bignumber.js';
2
- import { Contract, BigNumber as BigNumber$1, utils } from 'ethers';
3
+ import { BigNumber as BigNumber$1, utils, Contract, ethers as ethers$1 } from 'ethers';
4
+ import AuErc20ABI from '@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json';
5
+ import AuETHABI from '@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json';
6
+ import ComptrollerABI from '@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json';
7
+ import TokenLockABI from '@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json';
8
+ import AuriFairLaunchABI from '@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json';
3
9
 
4
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
5
11
  try {
@@ -53,6 +59,44 @@ function _setPrototypeOf(o, p) {
53
59
  return _setPrototypeOf(o, p);
54
60
  }
55
61
 
62
+ function _unsupportedIterableToArray(o, minLen) {
63
+ if (!o) return;
64
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
65
+ var n = Object.prototype.toString.call(o).slice(8, -1);
66
+ if (n === "Object" && o.constructor) n = o.constructor.name;
67
+ if (n === "Map" || n === "Set") return Array.from(o);
68
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
69
+ }
70
+
71
+ function _arrayLikeToArray(arr, len) {
72
+ if (len == null || len > arr.length) len = arr.length;
73
+
74
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
75
+
76
+ return arr2;
77
+ }
78
+
79
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
80
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
81
+ if (it) return (it = it.call(o)).next.bind(it);
82
+
83
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
84
+ if (it) o = it;
85
+ var i = 0;
86
+ return function () {
87
+ if (i >= o.length) return {
88
+ done: true
89
+ };
90
+ return {
91
+ done: false,
92
+ value: o[i++]
93
+ };
94
+ };
95
+ }
96
+
97
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
98
+ }
99
+
56
100
  function createCommonjsModule(fn, module) {
57
101
  return module = { exports: {} }, fn(module, module.exports), module.exports;
58
102
  }
@@ -813,14 +857,18 @@ try {
813
857
  }
814
858
  });
815
859
 
816
- var BlockchainEntityRead = function BlockchainEntityRead(providerOrSigner) {
817
- this._providerOrSigner = providerOrSigner;
860
+ var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
861
+ this._networkConnection = networkConnection;
818
862
  };
819
863
  var BlockchainEntityReadWrite = /*#__PURE__*/function (_BlockchainEntityRead) {
820
864
  _inheritsLoose(BlockchainEntityReadWrite, _BlockchainEntityRead);
821
865
 
822
- function BlockchainEntityReadWrite(signer) {
823
- return _BlockchainEntityRead.call(this, signer) || this;
866
+ function BlockchainEntityReadWrite(networkConnection) {
867
+ if (!(networkConnection.signer instanceof Signer)) {
868
+ throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");
869
+ }
870
+
871
+ return _BlockchainEntityRead.call(this, networkConnection) || this;
824
872
  }
825
873
 
826
874
  return BlockchainEntityReadWrite;
@@ -830,22 +878,153 @@ var BlockchainEntity = /*#__PURE__*/function () {
830
878
 
831
879
  var _proto = BlockchainEntity.prototype;
832
880
 
833
- _proto.read = function read(provider) {
834
- return new BlockchainEntityRead(provider);
881
+ _proto.read = function read(networkConnection) {
882
+ return new BlockchainEntityRead(networkConnection);
835
883
  };
836
884
 
837
- _proto.readWrite = function readWrite(signer) {
838
- return new BlockchainEntityReadWrite(signer);
885
+ _proto.readWrite = function readWrite(networkConnection) {
886
+ return new BlockchainEntityReadWrite(networkConnection);
839
887
  };
840
888
 
841
889
  return BlockchainEntity;
842
890
  }();
843
891
 
844
- var Token = function Token(address, decimals, expiry) {
892
+ var ethers = /*#__PURE__*/require('ethers');
893
+
894
+ var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
895
+ var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
896
+ var dummyAddress = "0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE";
897
+ var ETHAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
898
+ var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
899
+ var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
900
+ var AURORA_CHAINID = 1313161554;
901
+ var DECIMAL_PRECISION = 6;
902
+ var networkAddresses = {
903
+ auTokens: [{
904
+ address: '0x7967532568bef9ec96cfad6badea4c63add5888a',
905
+ underlying: '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8'
906
+ }, {
907
+ address: '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60',
908
+ underlying: ETHAddress
909
+ }, {
910
+ address: '0xccf005cfc3669d806a03f0617885648c397c456e',
911
+ underlying: '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6'
912
+ }, {
913
+ address: '0x55a4c111c007f39326edf22cfd63bbbb21a35b35',
914
+ underlying: '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369'
915
+ }, {
916
+ address: '0x77b088236c071ab5bd4e0bd21240b093275adffc',
917
+ underlying: '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18'
918
+ }, {
919
+ address: '0xaa68274f87fd9ae940f1dec31b643486838481c1',
920
+ underlying: '0x7a80df8230c5aa711e2702a275ab31aeb32754bf'
921
+ }, {
922
+ address: '0x6970167dfaa2aaa67404204102cbbd18b405eca9',
923
+ underlying: '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428'
924
+ }, {
925
+ address: '0x9630a6c5b729194972199805075fd76707a9713a',
926
+ underlying: '0x6f8a1daa158e08f75711a64e5a3073e959d688a6'
927
+ }],
928
+ misc: {
929
+ COMPTROLLER: "0xb51028d4f3fc69e3f9e3118ce067a4562c595aad",
930
+ oracle: "0xf1ebfaa2af93f4d82215fd7817c1835853c62fb8",
931
+ AURIFAIRLAUNCH: "0x7942874a9ef8059c5de259625a883dc61f03320d",
932
+ AURILENS: dummyAddress
933
+ },
934
+ tokens: {
935
+ AURORA: "0x7a80df8230c5aa711e2702a275ab31aeb32754bf",
936
+ PLY: "0x6f8a1daa158e08f75711a64e5a3073e959d688a6",
937
+ AURPLY: dummyAddress
938
+ }
939
+ };
940
+ var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
941
+ var REWARDCLAIMSTART = 1673280000;
942
+ var ONE_DAY = 86400;
943
+ var AurPlyPid = 1;
944
+
945
+ var decimalRecords = {
946
+ '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
947
+ '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8': 18,
948
+ '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428': 18,
949
+ '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369': 18,
950
+ '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18': 18,
951
+ '0xaa68274f87fd9ae940f1dec31b643486838481c1': 8,
952
+ '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60': 8,
953
+ '0x6970167dfaa2aaa67404204102cbbd18b405eca9': 8,
954
+ '0x6f8a1daa158e08f75711a64e5a3073e959d688a6': 18,
955
+ '0xccf005cfc3669d806a03f0617885648c397c456e': 8,
956
+ '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6': 18,
957
+ '0x7a80df8230c5aa711e2702a275ab31aeb32754bf': 18,
958
+ '0x9630a6c5b729194972199805075fd76707a9713a': 8,
959
+ '0x77b088236c071ab5bd4e0bd21240b093275adffc': 8,
960
+ '0x7967532568bef9ec96cfad6badea4c63add5888a': 8,
961
+ '0x55a4c111c007f39326edf22cfd63bbbb21a35b35': 8
962
+ };
963
+
964
+ function formatObject(object) {
965
+ return JSON.stringify(object, null, ' ');
966
+ }
967
+ function decimalFactor(decimal) {
968
+ return BigNumber$1.from(10).pow(decimal).toString();
969
+ }
970
+ var isSameAddress = function isSameAddress(address1, address2) {
971
+ return address1.toLowerCase() == address2.toLowerCase();
972
+ };
973
+ var getCurrentTimestamp = /*#__PURE__*/function () {
974
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider) {
975
+ var latestBlockNumber, currentTime;
976
+ return runtime_1.wrap(function _callee$(_context) {
977
+ while (1) {
978
+ switch (_context.prev = _context.next) {
979
+ case 0:
980
+ _context.next = 2;
981
+ return provider.getBlockNumber();
982
+
983
+ case 2:
984
+ latestBlockNumber = _context.sent;
985
+ _context.next = 5;
986
+ return provider.getBlock(latestBlockNumber);
987
+
988
+ case 5:
989
+ currentTime = _context.sent.timestamp;
990
+ return _context.abrupt("return", currentTime);
991
+
992
+ case 7:
993
+ case "end":
994
+ return _context.stop();
995
+ }
996
+ }
997
+ }, _callee);
998
+ }));
999
+
1000
+ return function getCurrentTimestamp(_x) {
1001
+ return _ref.apply(this, arguments);
1002
+ };
1003
+ }();
1004
+ function validateAndParseAddress(address) {
1005
+ try {
1006
+ return utils.getAddress(address);
1007
+ } catch (error) {
1008
+ throw new Error("Invalid address: " + address);
1009
+ }
1010
+ }
1011
+ function getDecimal(address) {
1012
+ return decimalRecords[address.toLowerCase()];
1013
+ }
1014
+ function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
1015
+ if (totalStakeValue.lte(0)) {
1016
+ return new BigNumber('999999999');
1017
+ }
1018
+
1019
+ return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
1020
+ }
1021
+
1022
+ var Token = function Token(address, decimals) {
845
1023
  this.address = address.toLowerCase();
846
1024
  this.decimals = decimals;
847
- this.expiry = expiry;
848
1025
  };
1026
+ var PLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.PLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.PLY));
1027
+ var AURPLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.AURPLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.AURPLY));
849
1028
 
850
1029
  var TokenAmount = /*#__PURE__*/function () {
851
1030
  function TokenAmount(token, amount, isRaw) {
@@ -875,2472 +1054,571 @@ var TokenAmount = /*#__PURE__*/function () {
875
1054
  return TokenAmount;
876
1055
  }();
877
1056
 
878
- var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
879
- var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
880
- var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
881
- var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
882
- var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
883
- var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
884
- var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
885
- var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
886
- var dummyUserMarketDetails = {
887
- market: dummyMarketAddress,
888
- depositBalance: dummyTokenAmount2,
889
- borrowBalance: dummyZeroTokenAmount,
890
- isCollateral: true,
891
- maxWithdrawableAmount: dummyTokenAmount
892
- };
1057
+ var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
1058
+ _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
893
1059
 
894
- var ethers = /*#__PURE__*/require('ethers');
1060
+ function MoneyMarketRead(networkConnection, auToken, underlyingAsset) {
1061
+ var _this;
895
1062
 
896
- var DOLLAR = /*#__PURE__*/new Token('0x0000000000000000000000000000000000000001', 2);
897
- var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
898
- var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
899
- var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
900
- var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
1063
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
901
1064
 
902
- var abi = [
903
- {
904
- inputs: [
905
- {
906
- internalType: "string",
907
- name: "_name",
908
- type: "string"
909
- },
910
- {
911
- internalType: "string",
912
- name: "_symbol",
913
- type: "string"
914
- },
915
- {
916
- internalType: "uint8",
917
- name: "_decimals",
918
- type: "uint8"
919
- },
920
- {
921
- internalType: "address",
922
- name: "_underlying",
923
- type: "address"
924
- },
925
- {
926
- internalType: "address",
927
- name: "_vault",
928
- type: "address"
929
- }
930
- ],
931
- stateMutability: "nonpayable",
932
- type: "constructor"
933
- },
934
- {
935
- anonymous: false,
936
- inputs: [
937
- {
938
- indexed: true,
939
- internalType: "address",
940
- name: "owner",
941
- type: "address"
942
- },
943
- {
944
- indexed: true,
945
- internalType: "address",
946
- name: "spender",
947
- type: "address"
948
- },
949
- {
950
- indexed: false,
951
- internalType: "uint256",
952
- name: "value",
953
- type: "uint256"
954
- }
955
- ],
956
- name: "Approval",
957
- type: "event"
958
- },
959
- {
960
- anonymous: false,
961
- inputs: [
962
- {
963
- indexed: true,
964
- internalType: "address",
965
- name: "auth",
966
- type: "address"
967
- },
968
- {
969
- indexed: false,
970
- internalType: "uint256",
971
- name: "timestamp",
972
- type: "uint256"
973
- }
974
- ],
975
- name: "LogAddAuth",
976
- type: "event"
977
- },
978
- {
979
- anonymous: false,
980
- inputs: [
981
- {
982
- indexed: true,
983
- internalType: "address",
984
- name: "oldOwner",
985
- type: "address"
986
- },
987
- {
988
- indexed: true,
989
- internalType: "address",
990
- name: "newOwner",
991
- type: "address"
992
- },
993
- {
994
- indexed: true,
995
- internalType: "uint256",
996
- name: "effectiveHeight",
997
- type: "uint256"
998
- }
999
- ],
1000
- name: "LogChangeMPCOwner",
1001
- type: "event"
1002
- },
1003
- {
1004
- anonymous: false,
1005
- inputs: [
1006
- {
1007
- indexed: true,
1008
- internalType: "address",
1009
- name: "oldVault",
1010
- type: "address"
1011
- },
1012
- {
1013
- indexed: true,
1014
- internalType: "address",
1015
- name: "newVault",
1016
- type: "address"
1017
- },
1018
- {
1019
- indexed: true,
1020
- internalType: "uint256",
1021
- name: "effectiveTime",
1022
- type: "uint256"
1023
- }
1024
- ],
1025
- name: "LogChangeVault",
1026
- type: "event"
1027
- },
1028
- {
1029
- anonymous: false,
1030
- inputs: [
1031
- {
1032
- indexed: true,
1033
- internalType: "bytes32",
1034
- name: "txhash",
1035
- type: "bytes32"
1036
- },
1037
- {
1038
- indexed: true,
1039
- internalType: "address",
1040
- name: "account",
1041
- type: "address"
1042
- },
1043
- {
1044
- indexed: false,
1045
- internalType: "uint256",
1046
- name: "amount",
1047
- type: "uint256"
1048
- }
1049
- ],
1050
- name: "LogSwapin",
1051
- type: "event"
1052
- },
1053
- {
1054
- anonymous: false,
1055
- inputs: [
1056
- {
1057
- indexed: true,
1058
- internalType: "address",
1059
- name: "account",
1060
- type: "address"
1061
- },
1062
- {
1063
- indexed: true,
1064
- internalType: "address",
1065
- name: "bindaddr",
1066
- type: "address"
1067
- },
1068
- {
1069
- indexed: false,
1070
- internalType: "uint256",
1071
- name: "amount",
1072
- type: "uint256"
1073
- }
1074
- ],
1075
- name: "LogSwapout",
1076
- type: "event"
1077
- },
1078
- {
1079
- anonymous: false,
1080
- inputs: [
1081
- {
1082
- indexed: true,
1083
- internalType: "address",
1084
- name: "from",
1085
- type: "address"
1086
- },
1087
- {
1088
- indexed: true,
1089
- internalType: "address",
1090
- name: "to",
1091
- type: "address"
1092
- },
1093
- {
1094
- indexed: false,
1095
- internalType: "uint256",
1096
- name: "value",
1097
- type: "uint256"
1098
- }
1099
- ],
1100
- name: "Transfer",
1101
- type: "event"
1102
- },
1103
- {
1104
- inputs: [
1105
- ],
1106
- name: "DOMAIN_SEPARATOR",
1107
- outputs: [
1108
- {
1109
- internalType: "bytes32",
1110
- name: "",
1111
- type: "bytes32"
1112
- }
1113
- ],
1114
- stateMutability: "view",
1115
- type: "function"
1116
- },
1117
- {
1118
- inputs: [
1119
- ],
1120
- name: "PERMIT_TYPEHASH",
1121
- outputs: [
1122
- {
1123
- internalType: "bytes32",
1124
- name: "",
1125
- type: "bytes32"
1126
- }
1127
- ],
1128
- stateMutability: "view",
1129
- type: "function"
1130
- },
1131
- {
1132
- inputs: [
1133
- {
1134
- internalType: "bytes32",
1135
- name: "txhash",
1136
- type: "bytes32"
1137
- },
1138
- {
1139
- internalType: "address",
1140
- name: "account",
1141
- type: "address"
1142
- },
1143
- {
1144
- internalType: "uint256",
1145
- name: "amount",
1146
- type: "uint256"
1147
- }
1148
- ],
1149
- name: "Swapin",
1150
- outputs: [
1151
- {
1152
- internalType: "bool",
1153
- name: "",
1154
- type: "bool"
1155
- }
1156
- ],
1157
- stateMutability: "nonpayable",
1158
- type: "function"
1159
- },
1160
- {
1161
- inputs: [
1162
- {
1163
- internalType: "uint256",
1164
- name: "amount",
1165
- type: "uint256"
1166
- },
1167
- {
1168
- internalType: "address",
1169
- name: "bindaddr",
1170
- type: "address"
1171
- }
1172
- ],
1173
- name: "Swapout",
1174
- outputs: [
1175
- {
1176
- internalType: "bool",
1177
- name: "",
1178
- type: "bool"
1179
- }
1180
- ],
1181
- stateMutability: "nonpayable",
1182
- type: "function"
1183
- },
1184
- {
1185
- inputs: [
1186
- ],
1187
- name: "TRANSFER_TYPEHASH",
1188
- outputs: [
1189
- {
1190
- internalType: "bytes32",
1191
- name: "",
1192
- type: "bytes32"
1193
- }
1194
- ],
1195
- stateMutability: "view",
1196
- type: "function"
1197
- },
1198
- {
1199
- inputs: [
1200
- {
1201
- internalType: "address",
1202
- name: "",
1203
- type: "address"
1204
- },
1205
- {
1206
- internalType: "address",
1207
- name: "",
1208
- type: "address"
1209
- }
1210
- ],
1211
- name: "allowance",
1212
- outputs: [
1213
- {
1214
- internalType: "uint256",
1215
- name: "",
1216
- type: "uint256"
1217
- }
1218
- ],
1219
- stateMutability: "view",
1220
- type: "function"
1221
- },
1222
- {
1223
- inputs: [
1224
- ],
1225
- name: "applyMinter",
1226
- outputs: [
1227
- ],
1228
- stateMutability: "nonpayable",
1229
- type: "function"
1230
- },
1231
- {
1232
- inputs: [
1233
- ],
1234
- name: "applyVault",
1235
- outputs: [
1236
- ],
1237
- stateMutability: "nonpayable",
1238
- type: "function"
1239
- },
1240
- {
1241
- inputs: [
1242
- {
1243
- internalType: "address",
1244
- name: "spender",
1245
- type: "address"
1246
- },
1247
- {
1248
- internalType: "uint256",
1249
- name: "value",
1250
- type: "uint256"
1251
- }
1252
- ],
1253
- name: "approve",
1254
- outputs: [
1255
- {
1256
- internalType: "bool",
1257
- name: "",
1258
- type: "bool"
1259
- }
1260
- ],
1261
- stateMutability: "nonpayable",
1262
- type: "function"
1263
- },
1264
- {
1265
- inputs: [
1266
- {
1267
- internalType: "address",
1268
- name: "spender",
1269
- type: "address"
1270
- },
1271
- {
1272
- internalType: "uint256",
1273
- name: "value",
1274
- type: "uint256"
1275
- },
1276
- {
1277
- internalType: "bytes",
1278
- name: "data",
1279
- type: "bytes"
1280
- }
1281
- ],
1282
- name: "approveAndCall",
1283
- outputs: [
1284
- {
1285
- internalType: "bool",
1286
- name: "",
1287
- type: "bool"
1288
- }
1289
- ],
1290
- stateMutability: "nonpayable",
1291
- type: "function"
1292
- },
1293
- {
1294
- inputs: [
1295
- {
1296
- internalType: "address",
1297
- name: "",
1298
- type: "address"
1299
- }
1300
- ],
1301
- name: "balanceOf",
1302
- outputs: [
1303
- {
1304
- internalType: "uint256",
1305
- name: "",
1306
- type: "uint256"
1307
- }
1308
- ],
1309
- stateMutability: "view",
1310
- type: "function"
1311
- },
1312
- {
1313
- inputs: [
1314
- {
1315
- internalType: "address",
1316
- name: "from",
1317
- type: "address"
1318
- },
1319
- {
1320
- internalType: "uint256",
1321
- name: "amount",
1322
- type: "uint256"
1323
- }
1324
- ],
1325
- name: "burn",
1326
- outputs: [
1327
- {
1328
- internalType: "bool",
1329
- name: "",
1330
- type: "bool"
1331
- }
1332
- ],
1333
- stateMutability: "nonpayable",
1334
- type: "function"
1335
- },
1336
- {
1337
- inputs: [
1338
- {
1339
- internalType: "address",
1340
- name: "newVault",
1341
- type: "address"
1342
- }
1343
- ],
1344
- name: "changeMPCOwner",
1345
- outputs: [
1346
- {
1347
- internalType: "bool",
1348
- name: "",
1349
- type: "bool"
1350
- }
1351
- ],
1352
- stateMutability: "nonpayable",
1353
- type: "function"
1354
- },
1355
- {
1356
- inputs: [
1357
- {
1358
- internalType: "address",
1359
- name: "newVault",
1360
- type: "address"
1361
- }
1362
- ],
1363
- name: "changeVault",
1364
- outputs: [
1365
- {
1366
- internalType: "bool",
1367
- name: "",
1368
- type: "bool"
1369
- }
1370
- ],
1371
- stateMutability: "nonpayable",
1372
- type: "function"
1373
- },
1374
- {
1375
- inputs: [
1376
- ],
1377
- name: "decimals",
1378
- outputs: [
1379
- {
1380
- internalType: "uint8",
1381
- name: "",
1382
- type: "uint8"
1383
- }
1384
- ],
1385
- stateMutability: "view",
1386
- type: "function"
1387
- },
1388
- {
1389
- inputs: [
1390
- ],
1391
- name: "delay",
1392
- outputs: [
1393
- {
1394
- internalType: "uint256",
1395
- name: "",
1396
- type: "uint256"
1397
- }
1398
- ],
1399
- stateMutability: "view",
1400
- type: "function"
1401
- },
1402
- {
1403
- inputs: [
1404
- ],
1405
- name: "delayDelay",
1406
- outputs: [
1407
- {
1408
- internalType: "uint256",
1409
- name: "",
1410
- type: "uint256"
1411
- }
1412
- ],
1413
- stateMutability: "view",
1414
- type: "function"
1415
- },
1416
- {
1417
- inputs: [
1418
- ],
1419
- name: "delayMinter",
1420
- outputs: [
1421
- {
1422
- internalType: "uint256",
1423
- name: "",
1424
- type: "uint256"
1425
- }
1426
- ],
1427
- stateMutability: "view",
1428
- type: "function"
1429
- },
1430
- {
1431
- inputs: [
1432
- ],
1433
- name: "delayVault",
1434
- outputs: [
1435
- {
1436
- internalType: "uint256",
1437
- name: "",
1438
- type: "uint256"
1439
- }
1440
- ],
1441
- stateMutability: "view",
1442
- type: "function"
1443
- },
1444
- {
1445
- inputs: [
1446
- {
1447
- internalType: "uint256",
1448
- name: "amount",
1449
- type: "uint256"
1450
- },
1451
- {
1452
- internalType: "address",
1453
- name: "to",
1454
- type: "address"
1455
- }
1456
- ],
1457
- name: "deposit",
1458
- outputs: [
1459
- {
1460
- internalType: "uint256",
1461
- name: "",
1462
- type: "uint256"
1463
- }
1464
- ],
1465
- stateMutability: "nonpayable",
1466
- type: "function"
1467
- },
1468
- {
1469
- inputs: [
1470
- {
1471
- internalType: "uint256",
1472
- name: "amount",
1473
- type: "uint256"
1474
- }
1475
- ],
1476
- name: "deposit",
1477
- outputs: [
1478
- {
1479
- internalType: "uint256",
1480
- name: "",
1481
- type: "uint256"
1482
- }
1483
- ],
1484
- stateMutability: "nonpayable",
1485
- type: "function"
1486
- },
1487
- {
1488
- inputs: [
1489
- ],
1490
- name: "deposit",
1491
- outputs: [
1492
- {
1493
- internalType: "uint256",
1494
- name: "",
1495
- type: "uint256"
1496
- }
1497
- ],
1498
- stateMutability: "nonpayable",
1499
- type: "function"
1500
- },
1501
- {
1502
- inputs: [
1503
- {
1504
- internalType: "uint256",
1505
- name: "amount",
1506
- type: "uint256"
1507
- },
1508
- {
1509
- internalType: "address",
1510
- name: "to",
1511
- type: "address"
1512
- }
1513
- ],
1514
- name: "depositVault",
1515
- outputs: [
1516
- {
1517
- internalType: "uint256",
1518
- name: "",
1519
- type: "uint256"
1520
- }
1521
- ],
1522
- stateMutability: "nonpayable",
1523
- type: "function"
1524
- },
1525
- {
1526
- inputs: [
1527
- {
1528
- internalType: "address",
1529
- name: "target",
1530
- type: "address"
1531
- },
1532
- {
1533
- internalType: "uint256",
1534
- name: "value",
1535
- type: "uint256"
1536
- },
1537
- {
1538
- internalType: "uint256",
1539
- name: "deadline",
1540
- type: "uint256"
1541
- },
1542
- {
1543
- internalType: "uint8",
1544
- name: "v",
1545
- type: "uint8"
1546
- },
1547
- {
1548
- internalType: "bytes32",
1549
- name: "r",
1550
- type: "bytes32"
1551
- },
1552
- {
1553
- internalType: "bytes32",
1554
- name: "s",
1555
- type: "bytes32"
1556
- },
1557
- {
1558
- internalType: "address",
1559
- name: "to",
1560
- type: "address"
1561
- }
1562
- ],
1563
- name: "depositWithPermit",
1564
- outputs: [
1565
- {
1566
- internalType: "uint256",
1567
- name: "",
1568
- type: "uint256"
1569
- }
1570
- ],
1571
- stateMutability: "nonpayable",
1572
- type: "function"
1573
- },
1574
- {
1575
- inputs: [
1576
- {
1577
- internalType: "address",
1578
- name: "target",
1579
- type: "address"
1580
- },
1581
- {
1582
- internalType: "uint256",
1583
- name: "value",
1584
- type: "uint256"
1585
- },
1586
- {
1587
- internalType: "uint256",
1588
- name: "deadline",
1589
- type: "uint256"
1590
- },
1591
- {
1592
- internalType: "uint8",
1593
- name: "v",
1594
- type: "uint8"
1595
- },
1596
- {
1597
- internalType: "bytes32",
1598
- name: "r",
1599
- type: "bytes32"
1600
- },
1601
- {
1602
- internalType: "bytes32",
1603
- name: "s",
1604
- type: "bytes32"
1605
- },
1606
- {
1607
- internalType: "address",
1608
- name: "to",
1609
- type: "address"
1610
- }
1611
- ],
1612
- name: "depositWithTransferPermit",
1613
- outputs: [
1614
- {
1615
- internalType: "uint256",
1616
- name: "",
1617
- type: "uint256"
1618
- }
1619
- ],
1620
- stateMutability: "nonpayable",
1621
- type: "function"
1622
- },
1623
- {
1624
- inputs: [
1625
- ],
1626
- name: "getAllMinters",
1627
- outputs: [
1628
- {
1629
- internalType: "address[]",
1630
- name: "",
1631
- type: "address[]"
1632
- }
1633
- ],
1634
- stateMutability: "view",
1635
- type: "function"
1636
- },
1637
- {
1638
- inputs: [
1639
- {
1640
- internalType: "address",
1641
- name: "_vault",
1642
- type: "address"
1643
- }
1644
- ],
1645
- name: "initVault",
1646
- outputs: [
1647
- ],
1648
- stateMutability: "nonpayable",
1649
- type: "function"
1650
- },
1651
- {
1652
- inputs: [
1653
- {
1654
- internalType: "address",
1655
- name: "",
1656
- type: "address"
1657
- }
1658
- ],
1659
- name: "isMinter",
1660
- outputs: [
1661
- {
1662
- internalType: "bool",
1663
- name: "",
1664
- type: "bool"
1665
- }
1666
- ],
1667
- stateMutability: "view",
1668
- type: "function"
1669
- },
1670
- {
1671
- inputs: [
1672
- {
1673
- internalType: "address",
1674
- name: "to",
1675
- type: "address"
1676
- },
1677
- {
1678
- internalType: "uint256",
1679
- name: "amount",
1680
- type: "uint256"
1681
- }
1682
- ],
1683
- name: "mint",
1684
- outputs: [
1685
- {
1686
- internalType: "bool",
1687
- name: "",
1688
- type: "bool"
1689
- }
1690
- ],
1691
- stateMutability: "nonpayable",
1692
- type: "function"
1693
- },
1694
- {
1695
- inputs: [
1696
- {
1697
- internalType: "uint256",
1698
- name: "",
1699
- type: "uint256"
1700
- }
1701
- ],
1702
- name: "minters",
1703
- outputs: [
1704
- {
1705
- internalType: "address",
1706
- name: "",
1707
- type: "address"
1708
- }
1709
- ],
1710
- stateMutability: "view",
1711
- type: "function"
1712
- },
1713
- {
1714
- inputs: [
1715
- ],
1716
- name: "mpc",
1717
- outputs: [
1718
- {
1719
- internalType: "address",
1720
- name: "",
1721
- type: "address"
1722
- }
1723
- ],
1724
- stateMutability: "view",
1725
- type: "function"
1726
- },
1727
- {
1728
- inputs: [
1729
- ],
1730
- name: "name",
1731
- outputs: [
1732
- {
1733
- internalType: "string",
1734
- name: "",
1735
- type: "string"
1736
- }
1737
- ],
1738
- stateMutability: "view",
1739
- type: "function"
1740
- },
1741
- {
1742
- inputs: [
1743
- {
1744
- internalType: "address",
1745
- name: "",
1746
- type: "address"
1747
- }
1748
- ],
1749
- name: "nonces",
1750
- outputs: [
1751
- {
1752
- internalType: "uint256",
1753
- name: "",
1754
- type: "uint256"
1755
- }
1756
- ],
1757
- stateMutability: "view",
1758
- type: "function"
1759
- },
1760
- {
1761
- inputs: [
1762
- ],
1763
- name: "owner",
1764
- outputs: [
1765
- {
1766
- internalType: "address",
1767
- name: "",
1768
- type: "address"
1769
- }
1770
- ],
1771
- stateMutability: "view",
1772
- type: "function"
1773
- },
1774
- {
1775
- inputs: [
1776
- ],
1777
- name: "pendingDelay",
1778
- outputs: [
1779
- {
1780
- internalType: "uint256",
1781
- name: "",
1782
- type: "uint256"
1783
- }
1784
- ],
1785
- stateMutability: "view",
1786
- type: "function"
1787
- },
1788
- {
1789
- inputs: [
1790
- ],
1791
- name: "pendingMinter",
1792
- outputs: [
1793
- {
1794
- internalType: "address",
1795
- name: "",
1796
- type: "address"
1797
- }
1798
- ],
1799
- stateMutability: "view",
1800
- type: "function"
1801
- },
1802
- {
1803
- inputs: [
1804
- ],
1805
- name: "pendingVault",
1806
- outputs: [
1807
- {
1808
- internalType: "address",
1809
- name: "",
1810
- type: "address"
1811
- }
1812
- ],
1813
- stateMutability: "view",
1814
- type: "function"
1815
- },
1816
- {
1817
- inputs: [
1818
- {
1819
- internalType: "address",
1820
- name: "target",
1821
- type: "address"
1822
- },
1823
- {
1824
- internalType: "address",
1825
- name: "spender",
1826
- type: "address"
1827
- },
1828
- {
1829
- internalType: "uint256",
1830
- name: "value",
1831
- type: "uint256"
1832
- },
1833
- {
1834
- internalType: "uint256",
1835
- name: "deadline",
1836
- type: "uint256"
1837
- },
1838
- {
1839
- internalType: "uint8",
1840
- name: "v",
1841
- type: "uint8"
1842
- },
1843
- {
1844
- internalType: "bytes32",
1845
- name: "r",
1846
- type: "bytes32"
1847
- },
1848
- {
1849
- internalType: "bytes32",
1850
- name: "s",
1851
- type: "bytes32"
1852
- }
1853
- ],
1854
- name: "permit",
1855
- outputs: [
1856
- ],
1857
- stateMutability: "nonpayable",
1858
- type: "function"
1859
- },
1860
- {
1861
- inputs: [
1862
- {
1863
- internalType: "address",
1864
- name: "_auth",
1865
- type: "address"
1866
- }
1867
- ],
1868
- name: "revokeMinter",
1869
- outputs: [
1870
- ],
1871
- stateMutability: "nonpayable",
1872
- type: "function"
1873
- },
1874
- {
1875
- inputs: [
1876
- {
1877
- internalType: "address",
1878
- name: "_auth",
1879
- type: "address"
1880
- }
1881
- ],
1882
- name: "setMinter",
1883
- outputs: [
1884
- ],
1885
- stateMutability: "nonpayable",
1886
- type: "function"
1887
- },
1888
- {
1889
- inputs: [
1890
- {
1891
- internalType: "address",
1892
- name: "_vault",
1893
- type: "address"
1894
- }
1895
- ],
1896
- name: "setVault",
1897
- outputs: [
1898
- ],
1899
- stateMutability: "nonpayable",
1900
- type: "function"
1901
- },
1902
- {
1903
- inputs: [
1904
- {
1905
- internalType: "bool",
1906
- name: "enabled",
1907
- type: "bool"
1908
- }
1909
- ],
1910
- name: "setVaultOnly",
1911
- outputs: [
1912
- ],
1913
- stateMutability: "nonpayable",
1914
- type: "function"
1915
- },
1916
- {
1917
- inputs: [
1918
- ],
1919
- name: "symbol",
1920
- outputs: [
1921
- {
1922
- internalType: "string",
1923
- name: "",
1924
- type: "string"
1925
- }
1926
- ],
1927
- stateMutability: "view",
1928
- type: "function"
1929
- },
1930
- {
1931
- inputs: [
1932
- ],
1933
- name: "totalSupply",
1934
- outputs: [
1935
- {
1936
- internalType: "uint256",
1937
- name: "",
1938
- type: "uint256"
1939
- }
1940
- ],
1941
- stateMutability: "view",
1942
- type: "function"
1943
- },
1944
- {
1945
- inputs: [
1946
- {
1947
- internalType: "address",
1948
- name: "to",
1949
- type: "address"
1950
- },
1951
- {
1952
- internalType: "uint256",
1953
- name: "value",
1954
- type: "uint256"
1955
- }
1956
- ],
1957
- name: "transfer",
1958
- outputs: [
1959
- {
1960
- internalType: "bool",
1961
- name: "",
1962
- type: "bool"
1963
- }
1964
- ],
1965
- stateMutability: "nonpayable",
1966
- type: "function"
1967
- },
1968
- {
1969
- inputs: [
1970
- {
1971
- internalType: "address",
1972
- name: "to",
1973
- type: "address"
1974
- },
1975
- {
1976
- internalType: "uint256",
1977
- name: "value",
1978
- type: "uint256"
1979
- },
1980
- {
1981
- internalType: "bytes",
1982
- name: "data",
1983
- type: "bytes"
1984
- }
1985
- ],
1986
- name: "transferAndCall",
1987
- outputs: [
1988
- {
1989
- internalType: "bool",
1990
- name: "",
1991
- type: "bool"
1992
- }
1993
- ],
1994
- stateMutability: "nonpayable",
1995
- type: "function"
1996
- },
1997
- {
1998
- inputs: [
1999
- {
2000
- internalType: "address",
2001
- name: "from",
2002
- type: "address"
2003
- },
2004
- {
2005
- internalType: "address",
2006
- name: "to",
2007
- type: "address"
2008
- },
2009
- {
2010
- internalType: "uint256",
2011
- name: "value",
2012
- type: "uint256"
2013
- }
2014
- ],
2015
- name: "transferFrom",
2016
- outputs: [
2017
- {
2018
- internalType: "bool",
2019
- name: "",
2020
- type: "bool"
2021
- }
2022
- ],
2023
- stateMutability: "nonpayable",
2024
- type: "function"
2025
- },
2026
- {
2027
- inputs: [
2028
- {
2029
- internalType: "address",
2030
- name: "target",
2031
- type: "address"
2032
- },
2033
- {
2034
- internalType: "address",
2035
- name: "to",
2036
- type: "address"
2037
- },
2038
- {
2039
- internalType: "uint256",
2040
- name: "value",
2041
- type: "uint256"
2042
- },
2043
- {
2044
- internalType: "uint256",
2045
- name: "deadline",
2046
- type: "uint256"
2047
- },
2048
- {
2049
- internalType: "uint8",
2050
- name: "v",
2051
- type: "uint8"
2052
- },
2053
- {
2054
- internalType: "bytes32",
2055
- name: "r",
2056
- type: "bytes32"
2057
- },
2058
- {
2059
- internalType: "bytes32",
2060
- name: "s",
2061
- type: "bytes32"
2062
- }
2063
- ],
2064
- name: "transferWithPermit",
2065
- outputs: [
2066
- {
2067
- internalType: "bool",
2068
- name: "",
2069
- type: "bool"
2070
- }
2071
- ],
2072
- stateMutability: "nonpayable",
2073
- type: "function"
2074
- },
2075
- {
2076
- inputs: [
2077
- ],
2078
- name: "underlying",
2079
- outputs: [
2080
- {
2081
- internalType: "address",
2082
- name: "",
2083
- type: "address"
2084
- }
2085
- ],
2086
- stateMutability: "view",
2087
- type: "function"
2088
- },
2089
- {
2090
- inputs: [
2091
- ],
2092
- name: "vault",
2093
- outputs: [
2094
- {
2095
- internalType: "address",
2096
- name: "",
2097
- type: "address"
2098
- }
2099
- ],
2100
- stateMutability: "view",
2101
- type: "function"
2102
- },
2103
- {
2104
- inputs: [
2105
- {
2106
- internalType: "uint256",
2107
- name: "amount",
2108
- type: "uint256"
2109
- },
2110
- {
2111
- internalType: "address",
2112
- name: "to",
2113
- type: "address"
2114
- }
2115
- ],
2116
- name: "withdraw",
2117
- outputs: [
2118
- {
2119
- internalType: "uint256",
2120
- name: "",
2121
- type: "uint256"
2122
- }
2123
- ],
2124
- stateMutability: "nonpayable",
2125
- type: "function"
2126
- },
2127
- {
2128
- inputs: [
2129
- {
2130
- internalType: "uint256",
2131
- name: "amount",
2132
- type: "uint256"
2133
- }
2134
- ],
2135
- name: "withdraw",
2136
- outputs: [
2137
- {
2138
- internalType: "uint256",
2139
- name: "",
2140
- type: "uint256"
2141
- }
2142
- ],
2143
- stateMutability: "nonpayable",
2144
- type: "function"
2145
- },
2146
- {
2147
- inputs: [
2148
- ],
2149
- name: "withdraw",
2150
- outputs: [
2151
- {
2152
- internalType: "uint256",
2153
- name: "",
2154
- type: "uint256"
2155
- }
2156
- ],
2157
- stateMutability: "nonpayable",
2158
- type: "function"
2159
- },
2160
- {
2161
- inputs: [
2162
- {
2163
- internalType: "address",
2164
- name: "from",
2165
- type: "address"
2166
- },
2167
- {
2168
- internalType: "uint256",
2169
- name: "amount",
2170
- type: "uint256"
2171
- },
2172
- {
2173
- internalType: "address",
2174
- name: "to",
2175
- type: "address"
2176
- }
2177
- ],
2178
- name: "withdrawVault",
2179
- outputs: [
2180
- {
2181
- internalType: "uint256",
2182
- name: "",
2183
- type: "uint256"
2184
- }
2185
- ],
2186
- stateMutability: "nonpayable",
2187
- type: "function"
2188
- }
2189
- ];
2190
- var IERC20 = {
2191
- abi: abi
2192
- };
2193
-
2194
- var ethers$1 = /*#__PURE__*/require('ethers');
2195
-
2196
- var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2197
- _inheritsLoose(SdkRead, _BlockchainEntityRead);
2198
-
2199
- function SdkRead(providerOrSigner) {
2200
- return _BlockchainEntityRead.call(this, providerOrSigner) || this;
2201
- }
2202
-
2203
- var _proto = SdkRead.prototype;
2204
-
2205
- _proto.getLockingDetails = /*#__PURE__*/function () {
2206
- var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2207
- return runtime_1.wrap(function _callee$(_context) {
2208
- while (1) {
2209
- switch (_context.prev = _context.next) {
2210
- case 0:
2211
- return _context.abrupt("return", {
2212
- vestingStart: 1673280000,
2213
- currentUnlockPortion: 0.17,
2214
- nextUnlockPortion: 0.19
2215
- });
2216
-
2217
- case 1:
2218
- case "end":
2219
- return _context.stop();
2220
- }
2221
- }
2222
- }, _callee);
2223
- }));
2224
-
2225
- function getLockingDetails() {
2226
- return _getLockingDetails.apply(this, arguments);
2227
- }
2228
-
2229
- return getLockingDetails;
2230
- }();
2231
-
2232
- _proto.getUserDetails = /*#__PURE__*/function () {
2233
- var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
2234
- return runtime_1.wrap(function _callee2$(_context2) {
2235
- while (1) {
2236
- switch (_context2.prev = _context2.next) {
2237
- case 0:
2238
- return _context2.abrupt("return", {
2239
- markets: [dummyUserMarketDetails],
2240
- borrowLimit: dummyTokenAmount3,
2241
- accruedPly: new TokenAmount(dummyPly, '100.12', false),
2242
- lockedPly: new TokenAmount(dummyPly, '200.12', false),
2243
- borrowableAmount: dummyTokenAmount2
2244
- });
2245
-
2246
- case 1:
2247
- case "end":
2248
- return _context2.stop();
2249
- }
2250
- }
2251
- }, _callee2);
2252
- }));
2253
-
2254
- function getUserDetails(_x) {
2255
- return _getUserDetails.apply(this, arguments);
2256
- }
2257
-
2258
- return getUserDetails;
2259
- }();
2260
-
2261
- _proto.getPlyAuroraPoolDetails = /*#__PURE__*/function () {
2262
- var _getPlyAuroraPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2263
- return runtime_1.wrap(function _callee3$(_context3) {
2264
- while (1) {
2265
- switch (_context3.prev = _context3.next) {
2266
- case 0:
2267
- return _context3.abrupt("return", {
2268
- totalStakedLiquidity: new TokenAmount(dummyPlyAurora, '12.1', false),
2269
- apy: 1.21
2270
- });
2271
-
2272
- case 1:
2273
- case "end":
2274
- return _context3.stop();
2275
- }
2276
- }
2277
- }, _callee3);
2278
- }));
2279
-
2280
- function getPlyAuroraPoolDetails() {
2281
- return _getPlyAuroraPoolDetails.apply(this, arguments);
2282
- }
2283
-
2284
- return getPlyAuroraPoolDetails;
2285
- }();
2286
-
2287
- _proto.getTokenPrice = /*#__PURE__*/function () {
2288
- var _getTokenPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
2289
- return runtime_1.wrap(function _callee4$(_context4) {
2290
- while (1) {
2291
- switch (_context4.prev = _context4.next) {
2292
- case 0:
2293
- if (!(token.address == dummyToken.address)) {
2294
- _context4.next = 2;
2295
- break;
2296
- }
2297
-
2298
- return _context4.abrupt("return", new TokenAmount(DOLLAR, '1', false));
2299
-
2300
- case 2:
2301
- return _context4.abrupt("return", new TokenAmount(DOLLAR, '12.1', false));
2302
-
2303
- case 3:
2304
- case "end":
2305
- return _context4.stop();
2306
- }
2307
- }
2308
- }, _callee4);
2309
- }));
2310
-
2311
- function getTokenPrice(_x2) {
2312
- return _getTokenPrice.apply(this, arguments);
2313
- }
2314
-
2315
- return getTokenPrice;
2316
- }();
2317
-
2318
- _proto.stakeBalanceOf = /*#__PURE__*/function () {
2319
- var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
2320
- return runtime_1.wrap(function _callee5$(_context5) {
2321
- while (1) {
2322
- switch (_context5.prev = _context5.next) {
2323
- case 0:
2324
- return _context5.abrupt("return", new TokenAmount(dummyPlyAurora, '103.4', false));
2325
-
2326
- case 1:
2327
- case "end":
2328
- return _context5.stop();
2329
- }
2330
- }
2331
- }, _callee5);
2332
- }));
2333
-
2334
- function stakeBalanceOf(_x3) {
2335
- return _stakeBalanceOf.apply(this, arguments);
2336
- }
2337
-
2338
- return stakeBalanceOf;
2339
- }();
2340
-
2341
- return SdkRead;
2342
- }(BlockchainEntityRead);
2343
- var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
2344
- _inheritsLoose(SdkReadWrite, _SdkRead);
2345
-
2346
- function SdkReadWrite() {
2347
- var _this;
2348
-
2349
- _this = _SdkRead.apply(this, arguments) || this;
2350
- _this.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2351
- var dummyErc20Token;
2352
- return runtime_1.wrap(function _callee6$(_context6) {
2353
- while (1) {
2354
- switch (_context6.prev = _context6.next) {
2355
- case 0:
2356
- dummyErc20Token = new Contract(dummyToken.address, IERC20.abi, _this._providerOrSigner);
2357
- _context6.next = 3;
2358
- return dummyErc20Token.approve(dummyToken.address, 123);
2359
-
2360
- case 3:
2361
- return _context6.abrupt("return", _context6.sent);
2362
-
2363
- case 4:
2364
- case "end":
2365
- return _context6.stop();
2366
- }
2367
- }
2368
- }, _callee6);
2369
- }));
2370
- return _this;
2371
- }
2372
-
2373
- var _proto2 = SdkReadWrite.prototype;
2374
-
2375
- _proto2.claim = /*#__PURE__*/function () {
2376
- var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
2377
- return runtime_1.wrap(function _callee7$(_context7) {
2378
- while (1) {
2379
- switch (_context7.prev = _context7.next) {
2380
- case 0:
2381
- return _context7.abrupt("return", this.dummyTransaction());
2382
-
2383
- case 1:
2384
- case "end":
2385
- return _context7.stop();
2386
- }
2387
- }
2388
- }, _callee7, this);
2389
- }));
2390
-
2391
- function claim() {
2392
- return _claim.apply(this, arguments);
2393
- }
2394
-
2395
- return claim;
2396
- }();
2397
-
2398
- _proto2.stake = /*#__PURE__*/function () {
2399
- var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
2400
- return runtime_1.wrap(function _callee8$(_context8) {
2401
- while (1) {
2402
- switch (_context8.prev = _context8.next) {
2403
- case 0:
2404
- return _context8.abrupt("return", this.dummyTransaction());
2405
-
2406
- case 1:
2407
- case "end":
2408
- return _context8.stop();
2409
- }
2410
- }
2411
- }, _callee8, this);
2412
- }));
2413
-
2414
- function stake(_x4) {
2415
- return _stake.apply(this, arguments);
2416
- }
2417
-
2418
- return stake;
2419
- }();
2420
-
2421
- _proto2.unstake = /*#__PURE__*/function () {
2422
- var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
2423
- return runtime_1.wrap(function _callee9$(_context9) {
2424
- while (1) {
2425
- switch (_context9.prev = _context9.next) {
2426
- case 0:
2427
- return _context9.abrupt("return", this.dummyTransaction());
2428
-
2429
- case 1:
2430
- case "end":
2431
- return _context9.stop();
2432
- }
2433
- }
2434
- }, _callee9, this);
2435
- }));
2436
-
2437
- function unstake(_x5) {
2438
- return _unstake.apply(this, arguments);
2439
- }
2440
-
2441
- return unstake;
2442
- }();
2443
-
2444
- return SdkReadWrite;
2445
- }(SdkRead);
2446
- var SDK = /*#__PURE__*/function (_BlockchainEntity) {
2447
- _inheritsLoose(SDK, _BlockchainEntity);
2448
-
2449
- function SDK() {
2450
- return _BlockchainEntity.call(this) || this;
2451
- }
2452
-
2453
- var _proto3 = SDK.prototype;
2454
-
2455
- _proto3.read = function read(provider) {
2456
- return new SdkRead(provider);
2457
- };
2458
-
2459
- SDK.defaultProvider = function defaultProvider() {
2460
- return new ethers$1.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
2461
- };
2462
-
2463
- return SDK;
2464
- }(BlockchainEntity);
2465
-
2466
- var abi$1 = [
2467
- {
2468
- inputs: [
2469
- {
2470
- internalType: "address",
2471
- name: "underlying_",
2472
- type: "address"
2473
- },
2474
- {
2475
- internalType: "contract ComptrollerInterface",
2476
- name: "comptroller_",
2477
- type: "address"
2478
- },
2479
- {
2480
- internalType: "contract InterestRateModel",
2481
- name: "interestRateModel_",
2482
- type: "address"
2483
- },
2484
- {
2485
- internalType: "uint256",
2486
- name: "initialExchangeRateMantissa_",
2487
- type: "uint256"
2488
- },
2489
- {
2490
- internalType: "string",
2491
- name: "name_",
2492
- type: "string"
2493
- },
2494
- {
2495
- internalType: "string",
2496
- name: "symbol_",
2497
- type: "string"
2498
- },
2499
- {
2500
- internalType: "uint8",
2501
- name: "decimals_",
2502
- type: "uint8"
2503
- },
2504
- {
2505
- internalType: "address payable",
2506
- name: "admin_",
2507
- type: "address"
2508
- },
2509
- {
2510
- internalType: "address",
2511
- name: "implementation_",
2512
- type: "address"
2513
- },
2514
- {
2515
- internalType: "bytes",
2516
- name: "becomeImplementationData",
2517
- type: "bytes"
2518
- }
2519
- ],
2520
- payable: false,
2521
- stateMutability: "nonpayable",
2522
- type: "constructor"
2523
- },
2524
- {
2525
- anonymous: false,
2526
- inputs: [
2527
- {
2528
- indexed: false,
2529
- internalType: "uint256",
2530
- name: "cashPrior",
2531
- type: "uint256"
2532
- },
2533
- {
2534
- indexed: false,
2535
- internalType: "uint256",
2536
- name: "interestAccumulated",
2537
- type: "uint256"
2538
- },
2539
- {
2540
- indexed: false,
2541
- internalType: "uint256",
2542
- name: "borrowIndex",
2543
- type: "uint256"
2544
- },
2545
- {
2546
- indexed: false,
2547
- internalType: "uint256",
2548
- name: "totalBorrows",
2549
- type: "uint256"
2550
- }
2551
- ],
2552
- name: "AccrueInterest",
2553
- type: "event"
2554
- },
2555
- {
2556
- anonymous: false,
2557
- inputs: [
2558
- {
2559
- indexed: true,
2560
- internalType: "address",
2561
- name: "owner",
2562
- type: "address"
2563
- },
2564
- {
2565
- indexed: true,
2566
- internalType: "address",
2567
- name: "spender",
2568
- type: "address"
2569
- },
2570
- {
2571
- indexed: false,
2572
- internalType: "uint256",
2573
- name: "amount",
2574
- type: "uint256"
2575
- }
2576
- ],
2577
- name: "Approval",
2578
- type: "event"
2579
- },
2580
- {
2581
- anonymous: false,
2582
- inputs: [
2583
- {
2584
- indexed: false,
2585
- internalType: "address",
2586
- name: "borrower",
2587
- type: "address"
2588
- },
2589
- {
2590
- indexed: false,
2591
- internalType: "uint256",
2592
- name: "borrowAmount",
2593
- type: "uint256"
2594
- },
2595
- {
2596
- indexed: false,
2597
- internalType: "uint256",
2598
- name: "accountBorrows",
2599
- type: "uint256"
2600
- },
2601
- {
2602
- indexed: false,
2603
- internalType: "uint256",
2604
- name: "totalBorrows",
2605
- type: "uint256"
2606
- }
2607
- ],
2608
- name: "Borrow",
2609
- type: "event"
2610
- },
2611
- {
2612
- anonymous: false,
2613
- inputs: [
2614
- {
2615
- indexed: false,
2616
- internalType: "uint256",
2617
- name: "error",
2618
- type: "uint256"
2619
- },
2620
- {
2621
- indexed: false,
2622
- internalType: "uint256",
2623
- name: "info",
2624
- type: "uint256"
2625
- },
2626
- {
2627
- indexed: false,
2628
- internalType: "uint256",
2629
- name: "detail",
2630
- type: "uint256"
2631
- }
2632
- ],
2633
- name: "Failure",
2634
- type: "event"
2635
- },
2636
- {
2637
- anonymous: false,
2638
- inputs: [
2639
- {
2640
- indexed: false,
2641
- internalType: "address",
2642
- name: "liquidator",
2643
- type: "address"
2644
- },
2645
- {
2646
- indexed: false,
2647
- internalType: "address",
2648
- name: "borrower",
2649
- type: "address"
2650
- },
2651
- {
2652
- indexed: false,
2653
- internalType: "uint256",
2654
- name: "repayAmount",
2655
- type: "uint256"
2656
- },
2657
- {
2658
- indexed: false,
2659
- internalType: "address",
2660
- name: "qiTokenCollateral",
2661
- type: "address"
2662
- },
2663
- {
2664
- indexed: false,
2665
- internalType: "uint256",
2666
- name: "seizeTokens",
2667
- type: "uint256"
2668
- }
2669
- ],
2670
- name: "LiquidateBorrow",
2671
- type: "event"
2672
- },
2673
- {
2674
- anonymous: false,
2675
- inputs: [
2676
- {
2677
- indexed: false,
2678
- internalType: "address",
2679
- name: "minter",
2680
- type: "address"
2681
- },
2682
- {
2683
- indexed: false,
2684
- internalType: "uint256",
2685
- name: "mintAmount",
2686
- type: "uint256"
2687
- },
2688
- {
2689
- indexed: false,
2690
- internalType: "uint256",
2691
- name: "mintTokens",
2692
- type: "uint256"
2693
- }
2694
- ],
2695
- name: "Mint",
2696
- type: "event"
2697
- },
2698
- {
2699
- anonymous: false,
2700
- inputs: [
2701
- {
2702
- indexed: false,
2703
- internalType: "address",
2704
- name: "oldAdmin",
2705
- type: "address"
2706
- },
2707
- {
2708
- indexed: false,
2709
- internalType: "address",
2710
- name: "newAdmin",
2711
- type: "address"
2712
- }
2713
- ],
2714
- name: "NewAdmin",
2715
- type: "event"
2716
- },
2717
- {
2718
- anonymous: false,
2719
- inputs: [
2720
- {
2721
- indexed: false,
2722
- internalType: "contract ComptrollerInterface",
2723
- name: "oldComptroller",
2724
- type: "address"
2725
- },
2726
- {
2727
- indexed: false,
2728
- internalType: "contract ComptrollerInterface",
2729
- name: "newComptroller",
2730
- type: "address"
2731
- }
2732
- ],
2733
- name: "NewComptroller",
2734
- type: "event"
2735
- },
2736
- {
2737
- anonymous: false,
2738
- inputs: [
2739
- {
2740
- indexed: false,
2741
- internalType: "address",
2742
- name: "oldImplementation",
2743
- type: "address"
2744
- },
2745
- {
2746
- indexed: false,
2747
- internalType: "address",
2748
- name: "newImplementation",
2749
- type: "address"
2750
- }
2751
- ],
2752
- name: "NewImplementation",
2753
- type: "event"
2754
- },
2755
- {
2756
- anonymous: false,
2757
- inputs: [
2758
- {
2759
- indexed: false,
2760
- internalType: "contract InterestRateModel",
2761
- name: "oldInterestRateModel",
2762
- type: "address"
2763
- },
2764
- {
2765
- indexed: false,
2766
- internalType: "contract InterestRateModel",
2767
- name: "newInterestRateModel",
2768
- type: "address"
2769
- }
2770
- ],
2771
- name: "NewMarketInterestRateModel",
2772
- type: "event"
2773
- },
2774
- {
2775
- anonymous: false,
2776
- inputs: [
2777
- {
2778
- indexed: false,
2779
- internalType: "address",
2780
- name: "oldPendingAdmin",
2781
- type: "address"
2782
- },
2783
- {
2784
- indexed: false,
2785
- internalType: "address",
2786
- name: "newPendingAdmin",
2787
- type: "address"
2788
- }
2789
- ],
2790
- name: "NewPendingAdmin",
2791
- type: "event"
2792
- },
2793
- {
2794
- anonymous: false,
2795
- inputs: [
2796
- {
2797
- indexed: false,
2798
- internalType: "uint256",
2799
- name: "oldProtocolSeizeShareMantissa",
2800
- type: "uint256"
2801
- },
2802
- {
2803
- indexed: false,
2804
- internalType: "uint256",
2805
- name: "newProtocolSeizeShareMantissa",
2806
- type: "uint256"
2807
- }
2808
- ],
2809
- name: "NewProtocolSeizeShare",
2810
- type: "event"
2811
- },
2812
- {
2813
- anonymous: false,
2814
- inputs: [
2815
- {
2816
- indexed: false,
2817
- internalType: "uint256",
2818
- name: "oldReserveFactorMantissa",
2819
- type: "uint256"
2820
- },
2821
- {
2822
- indexed: false,
2823
- internalType: "uint256",
2824
- name: "newReserveFactorMantissa",
2825
- type: "uint256"
2826
- }
2827
- ],
2828
- name: "NewReserveFactor",
2829
- type: "event"
2830
- },
2831
- {
2832
- anonymous: false,
2833
- inputs: [
2834
- {
2835
- indexed: false,
2836
- internalType: "address",
2837
- name: "redeemer",
2838
- type: "address"
2839
- },
2840
- {
2841
- indexed: false,
2842
- internalType: "uint256",
2843
- name: "redeemAmount",
2844
- type: "uint256"
2845
- },
2846
- {
2847
- indexed: false,
2848
- internalType: "uint256",
2849
- name: "redeemTokens",
2850
- type: "uint256"
2851
- }
2852
- ],
2853
- name: "Redeem",
2854
- type: "event"
2855
- },
2856
- {
2857
- anonymous: false,
2858
- inputs: [
2859
- {
2860
- indexed: false,
2861
- internalType: "address",
2862
- name: "payer",
2863
- type: "address"
2864
- },
2865
- {
2866
- indexed: false,
2867
- internalType: "address",
2868
- name: "borrower",
2869
- type: "address"
2870
- },
2871
- {
2872
- indexed: false,
2873
- internalType: "uint256",
2874
- name: "repayAmount",
2875
- type: "uint256"
2876
- },
2877
- {
2878
- indexed: false,
2879
- internalType: "uint256",
2880
- name: "accountBorrows",
2881
- type: "uint256"
2882
- },
2883
- {
2884
- indexed: false,
2885
- internalType: "uint256",
2886
- name: "totalBorrows",
2887
- type: "uint256"
2888
- }
2889
- ],
2890
- name: "RepayBorrow",
2891
- type: "event"
2892
- },
2893
- {
2894
- anonymous: false,
2895
- inputs: [
2896
- {
2897
- indexed: false,
2898
- internalType: "address",
2899
- name: "benefactor",
2900
- type: "address"
2901
- },
2902
- {
2903
- indexed: false,
2904
- internalType: "uint256",
2905
- name: "addAmount",
2906
- type: "uint256"
2907
- },
2908
- {
2909
- indexed: false,
2910
- internalType: "uint256",
2911
- name: "newTotalReserves",
2912
- type: "uint256"
2913
- }
2914
- ],
2915
- name: "ReservesAdded",
2916
- type: "event"
2917
- },
2918
- {
2919
- anonymous: false,
2920
- inputs: [
2921
- {
2922
- indexed: false,
2923
- internalType: "address",
2924
- name: "admin",
2925
- type: "address"
2926
- },
2927
- {
2928
- indexed: false,
2929
- internalType: "uint256",
2930
- name: "reduceAmount",
2931
- type: "uint256"
2932
- },
2933
- {
2934
- indexed: false,
2935
- internalType: "uint256",
2936
- name: "newTotalReserves",
2937
- type: "uint256"
2938
- }
2939
- ],
2940
- name: "ReservesReduced",
2941
- type: "event"
2942
- },
2943
- {
2944
- anonymous: false,
2945
- inputs: [
2946
- {
2947
- indexed: true,
2948
- internalType: "address",
2949
- name: "from",
2950
- type: "address"
2951
- },
2952
- {
2953
- indexed: true,
2954
- internalType: "address",
2955
- name: "to",
2956
- type: "address"
2957
- },
2958
- {
2959
- indexed: false,
2960
- internalType: "uint256",
2961
- name: "amount",
2962
- type: "uint256"
2963
- }
2964
- ],
2965
- name: "Transfer",
2966
- type: "event"
2967
- },
2968
- {
2969
- payable: true,
2970
- stateMutability: "payable",
2971
- type: "fallback"
2972
- },
2973
- {
2974
- constant: false,
2975
- inputs: [
2976
- ],
2977
- name: "_acceptAdmin",
2978
- outputs: [
2979
- {
2980
- internalType: "uint256",
2981
- name: "",
2982
- type: "uint256"
2983
- }
2984
- ],
2985
- payable: false,
2986
- stateMutability: "nonpayable",
2987
- type: "function"
2988
- },
2989
- {
2990
- constant: false,
2991
- inputs: [
2992
- {
2993
- internalType: "uint256",
2994
- name: "addAmount",
2995
- type: "uint256"
2996
- }
2997
- ],
2998
- name: "_addReserves",
2999
- outputs: [
3000
- {
3001
- internalType: "uint256",
3002
- name: "",
3003
- type: "uint256"
3004
- }
3005
- ],
3006
- payable: false,
3007
- stateMutability: "nonpayable",
3008
- type: "function"
3009
- },
3010
- {
3011
- constant: false,
3012
- inputs: [
3013
- {
3014
- internalType: "uint256",
3015
- name: "reduceAmount",
3016
- type: "uint256"
3017
- }
3018
- ],
3019
- name: "_reduceReserves",
3020
- outputs: [
3021
- {
3022
- internalType: "uint256",
3023
- name: "",
3024
- type: "uint256"
3025
- }
3026
- ],
3027
- payable: false,
3028
- stateMutability: "nonpayable",
3029
- type: "function"
3030
- },
3031
- {
3032
- constant: false,
3033
- inputs: [
3034
- {
3035
- internalType: "contract ComptrollerInterface",
3036
- name: "newComptroller",
3037
- type: "address"
3038
- }
3039
- ],
3040
- name: "_setComptroller",
3041
- outputs: [
3042
- {
3043
- internalType: "uint256",
3044
- name: "",
3045
- type: "uint256"
3046
- }
3047
- ],
3048
- payable: false,
3049
- stateMutability: "nonpayable",
3050
- type: "function"
3051
- },
3052
- {
3053
- constant: false,
3054
- inputs: [
3055
- {
3056
- internalType: "address",
3057
- name: "implementation_",
3058
- type: "address"
3059
- },
3060
- {
3061
- internalType: "bool",
3062
- name: "allowResign",
3063
- type: "bool"
3064
- },
3065
- {
3066
- internalType: "bytes",
3067
- name: "becomeImplementationData",
3068
- type: "bytes"
3069
- }
3070
- ],
3071
- name: "_setImplementation",
3072
- outputs: [
3073
- ],
3074
- payable: false,
3075
- stateMutability: "nonpayable",
3076
- type: "function"
3077
- },
3078
- {
3079
- constant: false,
3080
- inputs: [
3081
- {
3082
- internalType: "contract InterestRateModel",
3083
- name: "newInterestRateModel",
3084
- type: "address"
3085
- }
3086
- ],
3087
- name: "_setInterestRateModel",
3088
- outputs: [
3089
- {
3090
- internalType: "uint256",
3091
- name: "",
3092
- type: "uint256"
3093
- }
3094
- ],
3095
- payable: false,
3096
- stateMutability: "nonpayable",
3097
- type: "function"
3098
- },
3099
- {
3100
- constant: false,
3101
- inputs: [
3102
- {
3103
- internalType: "address payable",
3104
- name: "newPendingAdmin",
3105
- type: "address"
3106
- }
3107
- ],
3108
- name: "_setPendingAdmin",
3109
- outputs: [
3110
- {
3111
- internalType: "uint256",
3112
- name: "",
3113
- type: "uint256"
3114
- }
3115
- ],
3116
- payable: false,
3117
- stateMutability: "nonpayable",
3118
- type: "function"
3119
- },
3120
- {
3121
- constant: false,
3122
- inputs: [
3123
- {
3124
- internalType: "uint256",
3125
- name: "newProtocolSeizeShareMantissa",
3126
- type: "uint256"
3127
- }
3128
- ],
3129
- name: "_setProtocolSeizeShare",
3130
- outputs: [
3131
- {
3132
- internalType: "uint256",
3133
- name: "",
3134
- type: "uint256"
3135
- }
3136
- ],
3137
- payable: false,
3138
- stateMutability: "nonpayable",
3139
- type: "function"
3140
- },
3141
- {
3142
- constant: false,
3143
- inputs: [
3144
- {
3145
- internalType: "uint256",
3146
- name: "newReserveFactorMantissa",
3147
- type: "uint256"
3148
- }
3149
- ],
3150
- name: "_setReserveFactor",
3151
- outputs: [
3152
- {
3153
- internalType: "uint256",
3154
- name: "",
3155
- type: "uint256"
3156
- }
3157
- ],
3158
- payable: false,
3159
- stateMutability: "nonpayable",
3160
- type: "function"
3161
- },
3162
- {
3163
- constant: true,
3164
- inputs: [
3165
- ],
3166
- name: "accrualBlockTimestamp",
3167
- outputs: [
3168
- {
3169
- internalType: "uint256",
3170
- name: "",
3171
- type: "uint256"
3172
- }
3173
- ],
3174
- payable: false,
3175
- stateMutability: "view",
3176
- type: "function"
3177
- },
1065
+ if (isSameAddress(underlyingAsset, ETHAddress)) {
1066
+ _this.auToken = new Contract(auToken, AuETHABI.abi, networkConnection.provider);
1067
+ } else {
1068
+ _this.auToken = new Contract(auToken, AuErc20ABI.abi, networkConnection.provider);
1069
+ }
1070
+
1071
+ _this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
1072
+ _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
1073
+ return _this;
1074
+ }
1075
+
1076
+ var _proto = MoneyMarketRead.prototype;
1077
+
1078
+ _proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
1079
+ var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1080
+ return runtime_1.wrap(function _callee$(_context) {
1081
+ while (1) {
1082
+ switch (_context.prev = _context.next) {
1083
+ case 0:
1084
+ _context.t0 = TokenAmount;
1085
+ _context.t1 = this.underlying;
1086
+ _context.next = 4;
1087
+ return this.auToken.totalBorrows();
1088
+
1089
+ case 4:
1090
+ _context.t2 = _context.sent.toString();
1091
+ return _context.abrupt("return", new _context.t0(_context.t1, _context.t2));
1092
+
1093
+ case 6:
1094
+ case "end":
1095
+ return _context.stop();
1096
+ }
1097
+ }
1098
+ }, _callee, this);
1099
+ }));
1100
+
1101
+ function getTotalTokenBorrowed() {
1102
+ return _getTotalTokenBorrowed.apply(this, arguments);
1103
+ }
1104
+
1105
+ return getTotalTokenBorrowed;
1106
+ }();
1107
+
1108
+ _proto.getTotalTokenDeposited = /*#__PURE__*/function () {
1109
+ var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1110
+ var _this2 = this;
1111
+
1112
+ var promises, totalBorrow, totalCash;
1113
+ return runtime_1.wrap(function _callee2$(_context2) {
1114
+ while (1) {
1115
+ switch (_context2.prev = _context2.next) {
1116
+ case 0:
1117
+ promises = [];
1118
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
1119
+ totalBorrow = res;
1120
+ }));
1121
+ promises.push(this.auToken.getCash().then(function (res) {
1122
+ totalCash = new TokenAmount(_this2.underlying, res.toString());
1123
+ }));
1124
+ _context2.next = 5;
1125
+ return Promise.all(promises);
1126
+
1127
+ case 5:
1128
+ return _context2.abrupt("return", new TokenAmount(this.underlying, BigNumber$1.from(totalCash.rawAmount).add(totalBorrow.rawAmount()).toString()));
1129
+
1130
+ case 6:
1131
+ case "end":
1132
+ return _context2.stop();
1133
+ }
1134
+ }
1135
+ }, _callee2, this);
1136
+ }));
1137
+
1138
+ function getTotalTokenDeposited() {
1139
+ return _getTotalTokenDeposited.apply(this, arguments);
1140
+ }
1141
+
1142
+ return getTotalTokenDeposited;
1143
+ }();
1144
+
1145
+ _proto.getDepositAPY = /*#__PURE__*/function () {
1146
+ var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1147
+ var supplyRatePerTimestamp;
1148
+ return runtime_1.wrap(function _callee3$(_context3) {
1149
+ while (1) {
1150
+ switch (_context3.prev = _context3.next) {
1151
+ case 0:
1152
+ _context3.next = 2;
1153
+ return this.auToken.supplyRatePerTimestamp();
1154
+
1155
+ case 2:
1156
+ supplyRatePerTimestamp = _context3.sent;
1157
+ return _context3.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1158
+
1159
+ case 4:
1160
+ case "end":
1161
+ return _context3.stop();
1162
+ }
1163
+ }
1164
+ }, _callee3, this);
1165
+ }));
1166
+
1167
+ function getDepositAPY() {
1168
+ return _getDepositAPY.apply(this, arguments);
1169
+ }
1170
+
1171
+ return getDepositAPY;
1172
+ }();
1173
+
1174
+ _proto.getBorrowAPY = /*#__PURE__*/function () {
1175
+ var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
1176
+ var borrowRatePerTimestamp;
1177
+ return runtime_1.wrap(function _callee4$(_context4) {
1178
+ while (1) {
1179
+ switch (_context4.prev = _context4.next) {
1180
+ case 0:
1181
+ _context4.next = 2;
1182
+ return this.auToken.borrowRatePerTimestamp();
1183
+
1184
+ case 2:
1185
+ borrowRatePerTimestamp = _context4.sent;
1186
+ return _context4.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
1187
+
1188
+ case 4:
1189
+ case "end":
1190
+ return _context4.stop();
1191
+ }
1192
+ }
1193
+ }, _callee4, this);
1194
+ }));
1195
+
1196
+ function getBorrowAPY() {
1197
+ return _getBorrowAPY.apply(this, arguments);
1198
+ }
1199
+
1200
+ return getBorrowAPY;
1201
+ }();
1202
+
1203
+ _proto.getCollateralRatio = /*#__PURE__*/function () {
1204
+ var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
1205
+ return runtime_1.wrap(function _callee5$(_context5) {
1206
+ while (1) {
1207
+ switch (_context5.prev = _context5.next) {
1208
+ case 0:
1209
+ return _context5.abrupt("return", this._comptroller.markets(this.auToken.address).then(function (res) {
1210
+ return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
1211
+ }));
1212
+
1213
+ case 1:
1214
+ case "end":
1215
+ return _context5.stop();
1216
+ }
1217
+ }
1218
+ }, _callee5, this);
1219
+ }));
1220
+
1221
+ function getCollateralRatio() {
1222
+ return _getCollateralRatio.apply(this, arguments);
1223
+ }
1224
+
1225
+ return getCollateralRatio;
1226
+ }();
1227
+
1228
+ _proto.getDetails = /*#__PURE__*/function () {
1229
+ var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
1230
+ var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio;
1231
+ return runtime_1.wrap(function _callee6$(_context6) {
1232
+ while (1) {
1233
+ switch (_context6.prev = _context6.next) {
1234
+ case 0:
1235
+ promises = [];
1236
+ promises.push(this.getTotalTokenDeposited().then(function (res) {
1237
+ totalDeposited = res;
1238
+ }));
1239
+ promises.push(this.getTotalTokenBorrowed().then(function (res) {
1240
+ totalBorrowed = res;
1241
+ }));
1242
+ promises.push(this.getDepositAPY().then(function (res) {
1243
+ depositAPY = res.toNumber();
1244
+ }));
1245
+ promises.push(this.getBorrowAPY().then(function (res) {
1246
+ borrowAPY = res.toNumber();
1247
+ }));
1248
+ promises.push(this.getCollateralRatio().then(function (res) {
1249
+ collateralRatio = res.toNumber();
1250
+ }));
1251
+ _context6.next = 8;
1252
+ return Promise.all(promises);
1253
+
1254
+ case 8:
1255
+ return _context6.abrupt("return", {
1256
+ auTokenAddress: this.auToken.address,
1257
+ totalTokenDeposited: totalDeposited,
1258
+ totalTokenBorrowed: totalBorrowed,
1259
+ depositApy: depositAPY,
1260
+ depositPlyApy: 0.18,
1261
+ borrowApy: borrowAPY,
1262
+ borrowPlyApy: 0.18,
1263
+ collateralRatio: collateralRatio
1264
+ });
1265
+
1266
+ case 9:
1267
+ case "end":
1268
+ return _context6.stop();
1269
+ }
1270
+ }
1271
+ }, _callee6, this);
1272
+ }));
1273
+
1274
+ function getDetails() {
1275
+ return _getDetails.apply(this, arguments);
1276
+ }
1277
+
1278
+ return getDetails;
1279
+ }();
1280
+
1281
+ _proto.getUserBorrowBalance = /*#__PURE__*/function () {
1282
+ var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(userAddress) {
1283
+ var totalBorrow;
1284
+ return runtime_1.wrap(function _callee7$(_context7) {
1285
+ while (1) {
1286
+ switch (_context7.prev = _context7.next) {
1287
+ case 0:
1288
+ _context7.next = 2;
1289
+ return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
1290
+
1291
+ case 2:
1292
+ totalBorrow = _context7.sent;
1293
+ return _context7.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
1294
+
1295
+ case 4:
1296
+ case "end":
1297
+ return _context7.stop();
1298
+ }
1299
+ }
1300
+ }, _callee7, this);
1301
+ }));
1302
+
1303
+ function getUserBorrowBalance(_x) {
1304
+ return _getUserBorrowBalance.apply(this, arguments);
1305
+ }
1306
+
1307
+ return getUserBorrowBalance;
1308
+ }();
1309
+
1310
+ _proto.getUserDepositBalance = /*#__PURE__*/function () {
1311
+ var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(userAddress) {
1312
+ var totalDeposit;
1313
+ return runtime_1.wrap(function _callee8$(_context8) {
1314
+ while (1) {
1315
+ switch (_context8.prev = _context8.next) {
1316
+ case 0:
1317
+ _context8.next = 2;
1318
+ return this.auToken.callStatic.balanceOfUnderlying(userAddress);
1319
+
1320
+ case 2:
1321
+ totalDeposit = _context8.sent;
1322
+ return _context8.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
1323
+
1324
+ case 4:
1325
+ case "end":
1326
+ return _context8.stop();
1327
+ }
1328
+ }
1329
+ }, _callee8, this);
1330
+ }));
1331
+
1332
+ function getUserDepositBalance(_x2) {
1333
+ return _getUserDepositBalance.apply(this, arguments);
1334
+ }
1335
+
1336
+ return getUserDepositBalance;
1337
+ }();
1338
+
1339
+ return MoneyMarketRead;
1340
+ }(BlockchainEntityRead);
1341
+ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
1342
+ _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
1343
+
1344
+ function MoneyMarketReadWrite() {
1345
+ return _MoneyMarketRead.apply(this, arguments) || this;
1346
+ }
1347
+
1348
+ var _proto2 = MoneyMarketReadWrite.prototype;
1349
+
1350
+ _proto2.deposit = /*#__PURE__*/function () {
1351
+ var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(amount) {
1352
+ return runtime_1.wrap(function _callee9$(_context9) {
1353
+ while (1) {
1354
+ switch (_context9.prev = _context9.next) {
1355
+ case 0:
1356
+ if (!isSameAddress(amount.token.address, ETHAddress)) {
1357
+ _context9.next = 4;
1358
+ break;
1359
+ }
1360
+
1361
+ return _context9.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
1362
+ value: amount.rawAmount()
1363
+ }));
1364
+
1365
+ case 4:
1366
+ return _context9.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
1367
+
1368
+ case 5:
1369
+ case "end":
1370
+ return _context9.stop();
1371
+ }
1372
+ }
1373
+ }, _callee9, this);
1374
+ }));
1375
+
1376
+ function deposit(_x3) {
1377
+ return _deposit.apply(this, arguments);
1378
+ }
1379
+
1380
+ return deposit;
1381
+ }();
1382
+
1383
+ _proto2.borrow = /*#__PURE__*/function () {
1384
+ var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(amount) {
1385
+ return runtime_1.wrap(function _callee10$(_context10) {
1386
+ while (1) {
1387
+ switch (_context10.prev = _context10.next) {
1388
+ case 0:
1389
+ return _context10.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
1390
+
1391
+ case 1:
1392
+ case "end":
1393
+ return _context10.stop();
1394
+ }
1395
+ }
1396
+ }, _callee10, this);
1397
+ }));
1398
+
1399
+ function borrow(_x4) {
1400
+ return _borrow.apply(this, arguments);
1401
+ }
1402
+
1403
+ return borrow;
1404
+ }();
1405
+
1406
+ _proto2.withdraw = /*#__PURE__*/function () {
1407
+ var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
1408
+ return runtime_1.wrap(function _callee11$(_context11) {
1409
+ while (1) {
1410
+ switch (_context11.prev = _context11.next) {
1411
+ case 0:
1412
+ return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
1413
+
1414
+ case 1:
1415
+ case "end":
1416
+ return _context11.stop();
1417
+ }
1418
+ }
1419
+ }, _callee11, this);
1420
+ }));
1421
+
1422
+ function withdraw(_x5) {
1423
+ return _withdraw.apply(this, arguments);
1424
+ }
1425
+
1426
+ return withdraw;
1427
+ }();
1428
+
1429
+ _proto2.repay = /*#__PURE__*/function () {
1430
+ var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
1431
+ return runtime_1.wrap(function _callee12$(_context12) {
1432
+ while (1) {
1433
+ switch (_context12.prev = _context12.next) {
1434
+ case 0:
1435
+ if (!isSameAddress(amount.token.address, ETHAddress)) {
1436
+ _context12.next = 4;
1437
+ break;
1438
+ }
1439
+
1440
+ return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
1441
+ value: amount.rawAmount()
1442
+ }));
1443
+
1444
+ case 4:
1445
+ return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
1446
+
1447
+ case 5:
1448
+ case "end":
1449
+ return _context12.stop();
1450
+ }
1451
+ }
1452
+ }, _callee12, this);
1453
+ }));
1454
+
1455
+ function repay(_x6) {
1456
+ return _repay.apply(this, arguments);
1457
+ }
1458
+
1459
+ return repay;
1460
+ }();
1461
+
1462
+ _proto2.enableCollateral = /*#__PURE__*/function () {
1463
+ var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13() {
1464
+ return runtime_1.wrap(function _callee13$(_context13) {
1465
+ while (1) {
1466
+ switch (_context13.prev = _context13.next) {
1467
+ case 0:
1468
+ return _context13.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
1469
+
1470
+ case 1:
1471
+ case "end":
1472
+ return _context13.stop();
1473
+ }
1474
+ }
1475
+ }, _callee13, this);
1476
+ }));
1477
+
1478
+ function enableCollateral() {
1479
+ return _enableCollateral.apply(this, arguments);
1480
+ }
1481
+
1482
+ return enableCollateral;
1483
+ }();
1484
+
1485
+ _proto2.disableCollateral = /*#__PURE__*/function () {
1486
+ var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14() {
1487
+ return runtime_1.wrap(function _callee14$(_context14) {
1488
+ while (1) {
1489
+ switch (_context14.prev = _context14.next) {
1490
+ case 0:
1491
+ return _context14.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
1492
+
1493
+ case 1:
1494
+ case "end":
1495
+ return _context14.stop();
1496
+ }
1497
+ }
1498
+ }, _callee14, this);
1499
+ }));
1500
+
1501
+ function disableCollateral() {
1502
+ return _disableCollateral.apply(this, arguments);
1503
+ }
1504
+
1505
+ return disableCollateral;
1506
+ }();
1507
+
1508
+ return MoneyMarketReadWrite;
1509
+ }(MoneyMarketRead);
1510
+ var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
1511
+ _inheritsLoose(MoneyMarket, _BlockchainEntity);
1512
+
1513
+ function MoneyMarket(address, underlying) {
1514
+ var _this3;
1515
+
1516
+ _this3 = _BlockchainEntity.call(this) || this;
1517
+ _this3.address = validateAndParseAddress(address);
1518
+ _this3.underlying = validateAndParseAddress(underlying);
1519
+ return _this3;
1520
+ }
1521
+
1522
+ var _proto3 = MoneyMarket.prototype;
1523
+
1524
+ _proto3.read = function read(networkConnection) {
1525
+ return new MoneyMarketRead(networkConnection, this.address, this.underlying);
1526
+ };
1527
+
1528
+ return MoneyMarket;
1529
+ }(BlockchainEntity);
1530
+
1531
+ var abi = [
3178
1532
  {
3179
- constant: false,
3180
1533
  inputs: [
3181
1534
  ],
3182
- name: "accrueInterest",
3183
- outputs: [
3184
- {
3185
- internalType: "uint256",
3186
- name: "",
3187
- type: "uint256"
3188
- }
3189
- ],
3190
1535
  payable: false,
3191
1536
  stateMutability: "nonpayable",
3192
- type: "function"
3193
- },
3194
- {
3195
- constant: true,
3196
- inputs: [
3197
- ],
3198
- name: "admin",
3199
- outputs: [
3200
- {
3201
- internalType: "address payable",
3202
- name: "",
3203
- type: "address"
3204
- }
3205
- ],
3206
- payable: false,
3207
- stateMutability: "view",
3208
- type: "function"
3209
- },
3210
- {
3211
- constant: true,
3212
- inputs: [
3213
- {
3214
- internalType: "address",
3215
- name: "owner",
3216
- type: "address"
3217
- },
3218
- {
3219
- internalType: "address",
3220
- name: "spender",
3221
- type: "address"
3222
- }
3223
- ],
3224
- name: "allowance",
3225
- outputs: [
3226
- {
3227
- internalType: "uint256",
3228
- name: "",
3229
- type: "uint256"
3230
- }
3231
- ],
3232
- payable: false,
3233
- stateMutability: "view",
3234
- type: "function"
1537
+ type: "constructor"
3235
1538
  },
3236
1539
  {
3237
- constant: false,
1540
+ anonymous: false,
3238
1541
  inputs: [
3239
1542
  {
1543
+ indexed: false,
3240
1544
  internalType: "address",
3241
- name: "spender",
1545
+ name: "feed",
3242
1546
  type: "address"
3243
1547
  },
3244
1548
  {
3245
- internalType: "uint256",
3246
- name: "amount",
3247
- type: "uint256"
3248
- }
3249
- ],
3250
- name: "approve",
3251
- outputs: [
3252
- {
3253
- internalType: "bool",
3254
- name: "",
3255
- type: "bool"
3256
- }
3257
- ],
3258
- payable: false,
3259
- stateMutability: "nonpayable",
3260
- type: "function"
3261
- },
3262
- {
3263
- constant: true,
3264
- inputs: [
3265
- {
3266
- internalType: "address",
3267
- name: "owner",
3268
- type: "address"
3269
- }
3270
- ],
3271
- name: "balanceOf",
3272
- outputs: [
3273
- {
3274
- internalType: "uint256",
3275
- name: "",
3276
- type: "uint256"
1549
+ indexed: false,
1550
+ internalType: "string",
1551
+ name: "symbol",
1552
+ type: "string"
3277
1553
  }
3278
1554
  ],
3279
- payable: false,
3280
- stateMutability: "view",
3281
- type: "function"
1555
+ name: "FeedSet",
1556
+ type: "event"
3282
1557
  },
3283
1558
  {
3284
- constant: false,
1559
+ anonymous: false,
3285
1560
  inputs: [
3286
1561
  {
1562
+ indexed: false,
3287
1563
  internalType: "address",
3288
- name: "owner",
1564
+ name: "oldAdmin",
3289
1565
  type: "address"
3290
- }
3291
- ],
3292
- name: "balanceOfUnderlying",
3293
- outputs: [
1566
+ },
3294
1567
  {
3295
- internalType: "uint256",
3296
- name: "",
3297
- type: "uint256"
1568
+ indexed: false,
1569
+ internalType: "address",
1570
+ name: "newAdmin",
1571
+ type: "address"
3298
1572
  }
3299
1573
  ],
3300
- payable: false,
3301
- stateMutability: "nonpayable",
3302
- type: "function"
1574
+ name: "NewAdmin",
1575
+ type: "event"
3303
1576
  },
3304
1577
  {
3305
- constant: false,
1578
+ anonymous: false,
3306
1579
  inputs: [
3307
1580
  {
1581
+ indexed: false,
1582
+ internalType: "address",
1583
+ name: "asset",
1584
+ type: "address"
1585
+ },
1586
+ {
1587
+ indexed: false,
3308
1588
  internalType: "uint256",
3309
- name: "borrowAmount",
1589
+ name: "previousPriceMantissa",
3310
1590
  type: "uint256"
3311
- }
3312
- ],
3313
- name: "borrow",
3314
- outputs: [
1591
+ },
3315
1592
  {
1593
+ indexed: false,
3316
1594
  internalType: "uint256",
3317
- name: "",
1595
+ name: "requestedPriceMantissa",
1596
+ type: "uint256"
1597
+ },
1598
+ {
1599
+ indexed: false,
1600
+ internalType: "uint256",
1601
+ name: "newPriceMantissa",
3318
1602
  type: "uint256"
3319
1603
  }
3320
1604
  ],
3321
- payable: false,
3322
- stateMutability: "nonpayable",
3323
- type: "function"
1605
+ name: "PricePosted",
1606
+ type: "event"
3324
1607
  },
3325
1608
  {
3326
- constant: false,
1609
+ constant: true,
3327
1610
  inputs: [
3328
- {
3329
- internalType: "address",
3330
- name: "account",
3331
- type: "address"
3332
- }
3333
1611
  ],
3334
- name: "borrowBalanceCurrent",
1612
+ name: "admin",
3335
1613
  outputs: [
3336
1614
  {
3337
- internalType: "uint256",
1615
+ internalType: "address",
3338
1616
  name: "",
3339
- type: "uint256"
1617
+ type: "address"
3340
1618
  }
3341
1619
  ],
3342
1620
  payable: false,
3343
- stateMutability: "nonpayable",
1621
+ stateMutability: "view",
3344
1622
  type: "function"
3345
1623
  },
3346
1624
  {
@@ -3348,11 +1626,11 @@ var abi$1 = [
3348
1626
  inputs: [
3349
1627
  {
3350
1628
  internalType: "address",
3351
- name: "account",
1629
+ name: "asset",
3352
1630
  type: "address"
3353
1631
  }
3354
1632
  ],
3355
- name: "borrowBalanceStored",
1633
+ name: "assetPrices",
3356
1634
  outputs: [
3357
1635
  {
3358
1636
  internalType: "uint256",
@@ -3367,13 +1645,18 @@ var abi$1 = [
3367
1645
  {
3368
1646
  constant: true,
3369
1647
  inputs: [
1648
+ {
1649
+ internalType: "string",
1650
+ name: "symbol",
1651
+ type: "string"
1652
+ }
3370
1653
  ],
3371
- name: "borrowIndex",
1654
+ name: "getFeed",
3372
1655
  outputs: [
3373
1656
  {
3374
- internalType: "uint256",
1657
+ internalType: "contract AggregatorV2V3Interface",
3375
1658
  name: "",
3376
- type: "uint256"
1659
+ type: "address"
3377
1660
  }
3378
1661
  ],
3379
1662
  payable: false,
@@ -3383,8 +1666,13 @@ var abi$1 = [
3383
1666
  {
3384
1667
  constant: true,
3385
1668
  inputs: [
1669
+ {
1670
+ internalType: "contract QiToken",
1671
+ name: "qiToken",
1672
+ type: "address"
1673
+ }
3386
1674
  ],
3387
- name: "borrowRatePerTimestamp",
1675
+ name: "getUnderlyingPrice",
3388
1676
  outputs: [
3389
1677
  {
3390
1678
  internalType: "uint256",
@@ -3400,12 +1688,12 @@ var abi$1 = [
3400
1688
  constant: true,
3401
1689
  inputs: [
3402
1690
  ],
3403
- name: "comptroller",
1691
+ name: "isPriceOracle",
3404
1692
  outputs: [
3405
1693
  {
3406
- internalType: "contract ComptrollerInterface",
1694
+ internalType: "bool",
3407
1695
  name: "",
3408
- type: "address"
1696
+ type: "bool"
3409
1697
  }
3410
1698
  ],
3411
1699
  payable: false,
@@ -3413,215 +1701,360 @@ var abi$1 = [
3413
1701
  type: "function"
3414
1702
  },
3415
1703
  {
3416
- constant: true,
1704
+ constant: false,
3417
1705
  inputs: [
3418
- ],
3419
- name: "decimals",
3420
- outputs: [
3421
1706
  {
3422
- internalType: "uint8",
3423
- name: "",
3424
- type: "uint8"
1707
+ internalType: "address",
1708
+ name: "newAdmin",
1709
+ type: "address"
3425
1710
  }
3426
1711
  ],
1712
+ name: "setAdmin",
1713
+ outputs: [
1714
+ ],
3427
1715
  payable: false,
3428
- stateMutability: "view",
1716
+ stateMutability: "nonpayable",
3429
1717
  type: "function"
3430
1718
  },
3431
1719
  {
3432
1720
  constant: false,
3433
1721
  inputs: [
3434
1722
  {
3435
- internalType: "bytes",
3436
- name: "data",
3437
- type: "bytes"
1723
+ internalType: "address",
1724
+ name: "asset",
1725
+ type: "address"
1726
+ },
1727
+ {
1728
+ internalType: "uint256",
1729
+ name: "price",
1730
+ type: "uint256"
3438
1731
  }
3439
1732
  ],
3440
- name: "delegateToImplementation",
1733
+ name: "setDirectPrice",
3441
1734
  outputs: [
3442
- {
3443
- internalType: "bytes",
3444
- name: "",
3445
- type: "bytes"
3446
- }
3447
1735
  ],
3448
1736
  payable: false,
3449
1737
  stateMutability: "nonpayable",
3450
1738
  type: "function"
3451
1739
  },
3452
1740
  {
3453
- constant: true,
1741
+ constant: false,
3454
1742
  inputs: [
3455
1743
  {
3456
- internalType: "bytes",
3457
- name: "data",
3458
- type: "bytes"
1744
+ internalType: "string",
1745
+ name: "symbol",
1746
+ type: "string"
1747
+ },
1748
+ {
1749
+ internalType: "address",
1750
+ name: "feed",
1751
+ type: "address"
3459
1752
  }
3460
1753
  ],
3461
- name: "delegateToViewImplementation",
1754
+ name: "setFeed",
3462
1755
  outputs: [
3463
- {
3464
- internalType: "bytes",
3465
- name: "",
3466
- type: "bytes"
3467
- }
3468
1756
  ],
3469
1757
  payable: false,
3470
- stateMutability: "view",
1758
+ stateMutability: "nonpayable",
3471
1759
  type: "function"
3472
1760
  },
3473
1761
  {
3474
1762
  constant: false,
3475
1763
  inputs: [
3476
- ],
3477
- name: "exchangeRateCurrent",
3478
- outputs: [
1764
+ {
1765
+ internalType: "contract QiToken",
1766
+ name: "qiToken",
1767
+ type: "address"
1768
+ },
3479
1769
  {
3480
1770
  internalType: "uint256",
3481
- name: "",
1771
+ name: "underlyingPriceMantissa",
3482
1772
  type: "uint256"
3483
1773
  }
3484
1774
  ],
1775
+ name: "setUnderlyingPrice",
1776
+ outputs: [
1777
+ ],
3485
1778
  payable: false,
3486
1779
  stateMutability: "nonpayable",
3487
1780
  type: "function"
3488
- },
1781
+ }
1782
+ ];
1783
+ var OracleABI = {
1784
+ abi: abi
1785
+ };
1786
+
1787
+ var _format = "hh-sol-artifact-1";
1788
+ var contractName = "IUniswapV2Pair";
1789
+ var sourceName = "contracts/interfaces/IUniswapV2Pair.sol";
1790
+ var abi$1 = [
3489
1791
  {
3490
- constant: true,
1792
+ anonymous: false,
3491
1793
  inputs: [
1794
+ {
1795
+ indexed: true,
1796
+ internalType: "address",
1797
+ name: "owner",
1798
+ type: "address"
1799
+ },
1800
+ {
1801
+ indexed: true,
1802
+ internalType: "address",
1803
+ name: "spender",
1804
+ type: "address"
1805
+ },
1806
+ {
1807
+ indexed: false,
1808
+ internalType: "uint256",
1809
+ name: "value",
1810
+ type: "uint256"
1811
+ }
3492
1812
  ],
3493
- name: "exchangeRateStored",
3494
- outputs: [
1813
+ name: "Approval",
1814
+ type: "event"
1815
+ },
1816
+ {
1817
+ anonymous: false,
1818
+ inputs: [
1819
+ {
1820
+ indexed: true,
1821
+ internalType: "address",
1822
+ name: "sender",
1823
+ type: "address"
1824
+ },
3495
1825
  {
1826
+ indexed: false,
3496
1827
  internalType: "uint256",
3497
- name: "",
1828
+ name: "amount0",
1829
+ type: "uint256"
1830
+ },
1831
+ {
1832
+ indexed: false,
1833
+ internalType: "uint256",
1834
+ name: "amount1",
3498
1835
  type: "uint256"
1836
+ },
1837
+ {
1838
+ indexed: true,
1839
+ internalType: "address",
1840
+ name: "to",
1841
+ type: "address"
3499
1842
  }
3500
1843
  ],
3501
- payable: false,
3502
- stateMutability: "view",
3503
- type: "function"
1844
+ name: "Burn",
1845
+ type: "event"
3504
1846
  },
3505
1847
  {
3506
- constant: true,
1848
+ anonymous: false,
3507
1849
  inputs: [
3508
1850
  {
1851
+ indexed: true,
3509
1852
  internalType: "address",
3510
- name: "account",
1853
+ name: "sender",
3511
1854
  type: "address"
1855
+ },
1856
+ {
1857
+ indexed: false,
1858
+ internalType: "uint256",
1859
+ name: "amount0",
1860
+ type: "uint256"
1861
+ },
1862
+ {
1863
+ indexed: false,
1864
+ internalType: "uint256",
1865
+ name: "amount1",
1866
+ type: "uint256"
3512
1867
  }
3513
1868
  ],
3514
- name: "getAccountSnapshot",
3515
- outputs: [
1869
+ name: "Mint",
1870
+ type: "event"
1871
+ },
1872
+ {
1873
+ anonymous: false,
1874
+ inputs: [
1875
+ {
1876
+ indexed: true,
1877
+ internalType: "address",
1878
+ name: "sender",
1879
+ type: "address"
1880
+ },
3516
1881
  {
1882
+ indexed: false,
3517
1883
  internalType: "uint256",
3518
- name: "",
1884
+ name: "amount0In",
3519
1885
  type: "uint256"
3520
1886
  },
3521
1887
  {
1888
+ indexed: false,
3522
1889
  internalType: "uint256",
3523
- name: "",
1890
+ name: "amount1In",
3524
1891
  type: "uint256"
3525
1892
  },
3526
1893
  {
1894
+ indexed: false,
3527
1895
  internalType: "uint256",
3528
- name: "",
1896
+ name: "amount0Out",
3529
1897
  type: "uint256"
3530
1898
  },
3531
1899
  {
1900
+ indexed: false,
3532
1901
  internalType: "uint256",
3533
- name: "",
1902
+ name: "amount1Out",
1903
+ type: "uint256"
1904
+ },
1905
+ {
1906
+ indexed: true,
1907
+ internalType: "address",
1908
+ name: "to",
1909
+ type: "address"
1910
+ }
1911
+ ],
1912
+ name: "Swap",
1913
+ type: "event"
1914
+ },
1915
+ {
1916
+ anonymous: false,
1917
+ inputs: [
1918
+ {
1919
+ indexed: false,
1920
+ internalType: "uint112",
1921
+ name: "reserve0",
1922
+ type: "uint112"
1923
+ },
1924
+ {
1925
+ indexed: false,
1926
+ internalType: "uint112",
1927
+ name: "reserve1",
1928
+ type: "uint112"
1929
+ }
1930
+ ],
1931
+ name: "Sync",
1932
+ type: "event"
1933
+ },
1934
+ {
1935
+ anonymous: false,
1936
+ inputs: [
1937
+ {
1938
+ indexed: true,
1939
+ internalType: "address",
1940
+ name: "from",
1941
+ type: "address"
1942
+ },
1943
+ {
1944
+ indexed: true,
1945
+ internalType: "address",
1946
+ name: "to",
1947
+ type: "address"
1948
+ },
1949
+ {
1950
+ indexed: false,
1951
+ internalType: "uint256",
1952
+ name: "value",
3534
1953
  type: "uint256"
3535
1954
  }
3536
1955
  ],
3537
- payable: false,
3538
- stateMutability: "view",
3539
- type: "function"
1956
+ name: "Transfer",
1957
+ type: "event"
3540
1958
  },
3541
1959
  {
3542
- constant: true,
3543
1960
  inputs: [
3544
1961
  ],
3545
- name: "getCash",
1962
+ name: "DOMAIN_SEPARATOR",
3546
1963
  outputs: [
3547
1964
  {
3548
- internalType: "uint256",
1965
+ internalType: "bytes32",
3549
1966
  name: "",
3550
- type: "uint256"
1967
+ type: "bytes32"
3551
1968
  }
3552
1969
  ],
3553
- payable: false,
3554
1970
  stateMutability: "view",
3555
1971
  type: "function"
3556
1972
  },
3557
1973
  {
3558
- constant: true,
3559
1974
  inputs: [
3560
1975
  ],
3561
- name: "implementation",
1976
+ name: "MINIMUM_LIQUIDITY",
3562
1977
  outputs: [
3563
1978
  {
3564
- internalType: "address",
1979
+ internalType: "uint256",
3565
1980
  name: "",
3566
- type: "address"
1981
+ type: "uint256"
3567
1982
  }
3568
1983
  ],
3569
- payable: false,
3570
- stateMutability: "view",
1984
+ stateMutability: "pure",
3571
1985
  type: "function"
3572
1986
  },
3573
1987
  {
3574
- constant: true,
3575
1988
  inputs: [
3576
1989
  ],
3577
- name: "interestRateModel",
1990
+ name: "PERMIT_TYPEHASH",
3578
1991
  outputs: [
3579
1992
  {
3580
- internalType: "contract InterestRateModel",
1993
+ internalType: "bytes32",
3581
1994
  name: "",
3582
- type: "address"
1995
+ type: "bytes32"
3583
1996
  }
3584
1997
  ],
3585
- payable: false,
3586
- stateMutability: "view",
1998
+ stateMutability: "pure",
3587
1999
  type: "function"
3588
2000
  },
3589
2001
  {
3590
- constant: true,
3591
2002
  inputs: [
2003
+ {
2004
+ internalType: "address",
2005
+ name: "owner",
2006
+ type: "address"
2007
+ },
2008
+ {
2009
+ internalType: "address",
2010
+ name: "spender",
2011
+ type: "address"
2012
+ }
3592
2013
  ],
3593
- name: "isQiToken",
2014
+ name: "allowance",
3594
2015
  outputs: [
3595
2016
  {
3596
- internalType: "bool",
2017
+ internalType: "uint256",
3597
2018
  name: "",
3598
- type: "bool"
2019
+ type: "uint256"
3599
2020
  }
3600
2021
  ],
3601
- payable: false,
3602
2022
  stateMutability: "view",
3603
2023
  type: "function"
3604
2024
  },
3605
2025
  {
3606
- constant: false,
3607
2026
  inputs: [
3608
2027
  {
3609
2028
  internalType: "address",
3610
- name: "borrower",
2029
+ name: "spender",
3611
2030
  type: "address"
3612
2031
  },
3613
2032
  {
3614
2033
  internalType: "uint256",
3615
- name: "repayAmount",
2034
+ name: "value",
3616
2035
  type: "uint256"
3617
- },
2036
+ }
2037
+ ],
2038
+ name: "approve",
2039
+ outputs: [
2040
+ {
2041
+ internalType: "bool",
2042
+ name: "",
2043
+ type: "bool"
2044
+ }
2045
+ ],
2046
+ stateMutability: "nonpayable",
2047
+ type: "function"
2048
+ },
2049
+ {
2050
+ inputs: [
3618
2051
  {
3619
- internalType: "contract QiTokenInterface",
3620
- name: "qiTokenCollateral",
2052
+ internalType: "address",
2053
+ name: "owner",
3621
2054
  type: "address"
3622
2055
  }
3623
2056
  ],
3624
- name: "liquidateBorrow",
2057
+ name: "balanceOf",
3625
2058
  outputs: [
3626
2059
  {
3627
2060
  internalType: "uint256",
@@ -3629,110 +2062,108 @@ var abi$1 = [
3629
2062
  type: "uint256"
3630
2063
  }
3631
2064
  ],
3632
- payable: false,
3633
- stateMutability: "nonpayable",
2065
+ stateMutability: "view",
3634
2066
  type: "function"
3635
2067
  },
3636
2068
  {
3637
- constant: false,
3638
2069
  inputs: [
3639
2070
  {
3640
- internalType: "uint256",
3641
- name: "mintAmount",
3642
- type: "uint256"
2071
+ internalType: "address",
2072
+ name: "to",
2073
+ type: "address"
3643
2074
  }
3644
2075
  ],
3645
- name: "mint",
2076
+ name: "burn",
3646
2077
  outputs: [
3647
2078
  {
3648
2079
  internalType: "uint256",
3649
- name: "",
2080
+ name: "amount0",
2081
+ type: "uint256"
2082
+ },
2083
+ {
2084
+ internalType: "uint256",
2085
+ name: "amount1",
3650
2086
  type: "uint256"
3651
2087
  }
3652
2088
  ],
3653
- payable: false,
3654
2089
  stateMutability: "nonpayable",
3655
2090
  type: "function"
3656
2091
  },
3657
2092
  {
3658
- constant: true,
3659
2093
  inputs: [
3660
2094
  ],
3661
- name: "name",
2095
+ name: "decimals",
3662
2096
  outputs: [
3663
2097
  {
3664
- internalType: "string",
2098
+ internalType: "uint8",
3665
2099
  name: "",
3666
- type: "string"
2100
+ type: "uint8"
3667
2101
  }
3668
2102
  ],
3669
- payable: false,
3670
- stateMutability: "view",
2103
+ stateMutability: "pure",
3671
2104
  type: "function"
3672
2105
  },
3673
2106
  {
3674
- constant: true,
3675
2107
  inputs: [
3676
2108
  ],
3677
- name: "pendingAdmin",
2109
+ name: "factory",
3678
2110
  outputs: [
3679
2111
  {
3680
- internalType: "address payable",
2112
+ internalType: "address",
3681
2113
  name: "",
3682
2114
  type: "address"
3683
2115
  }
3684
2116
  ],
3685
- payable: false,
3686
2117
  stateMutability: "view",
3687
2118
  type: "function"
3688
2119
  },
3689
2120
  {
3690
- constant: true,
3691
2121
  inputs: [
3692
2122
  ],
3693
- name: "protocolSeizeShareMantissa",
2123
+ name: "getReserves",
3694
2124
  outputs: [
3695
2125
  {
3696
- internalType: "uint256",
3697
- name: "",
3698
- type: "uint256"
2126
+ internalType: "uint112",
2127
+ name: "reserve0",
2128
+ type: "uint112"
2129
+ },
2130
+ {
2131
+ internalType: "uint112",
2132
+ name: "reserve1",
2133
+ type: "uint112"
2134
+ },
2135
+ {
2136
+ internalType: "uint32",
2137
+ name: "blockTimestampLast",
2138
+ type: "uint32"
3699
2139
  }
3700
2140
  ],
3701
- payable: false,
3702
2141
  stateMutability: "view",
3703
2142
  type: "function"
3704
2143
  },
3705
2144
  {
3706
- constant: false,
3707
2145
  inputs: [
3708
2146
  {
3709
- internalType: "uint256",
3710
- name: "redeemTokens",
3711
- type: "uint256"
3712
- }
3713
- ],
3714
- name: "redeem",
3715
- outputs: [
2147
+ internalType: "address",
2148
+ name: "",
2149
+ type: "address"
2150
+ },
3716
2151
  {
3717
- internalType: "uint256",
2152
+ internalType: "address",
3718
2153
  name: "",
3719
- type: "uint256"
2154
+ type: "address"
3720
2155
  }
3721
2156
  ],
3722
- payable: false,
2157
+ name: "initialize",
2158
+ outputs: [
2159
+ ],
3723
2160
  stateMutability: "nonpayable",
3724
2161
  type: "function"
3725
2162
  },
3726
2163
  {
3727
- constant: false,
3728
2164
  inputs: [
3729
- {
3730
- internalType: "uint256",
3731
- name: "redeemAmount",
3732
- type: "uint256"
3733
- }
3734
2165
  ],
3735
- name: "redeemUnderlying",
2166
+ name: "kLast",
3736
2167
  outputs: [
3737
2168
  {
3738
2169
  internalType: "uint256",
@@ -3740,62 +2171,51 @@ var abi$1 = [
3740
2171
  type: "uint256"
3741
2172
  }
3742
2173
  ],
3743
- payable: false,
3744
- stateMutability: "nonpayable",
2174
+ stateMutability: "view",
3745
2175
  type: "function"
3746
2176
  },
3747
2177
  {
3748
- constant: false,
3749
2178
  inputs: [
3750
2179
  {
3751
- internalType: "uint256",
3752
- name: "repayAmount",
3753
- type: "uint256"
2180
+ internalType: "address",
2181
+ name: "to",
2182
+ type: "address"
3754
2183
  }
3755
2184
  ],
3756
- name: "repayBorrow",
2185
+ name: "mint",
3757
2186
  outputs: [
3758
2187
  {
3759
2188
  internalType: "uint256",
3760
- name: "",
2189
+ name: "liquidity",
3761
2190
  type: "uint256"
3762
2191
  }
3763
2192
  ],
3764
- payable: false,
3765
2193
  stateMutability: "nonpayable",
3766
2194
  type: "function"
3767
2195
  },
3768
2196
  {
3769
- constant: false,
3770
2197
  inputs: [
3771
- {
3772
- internalType: "address",
3773
- name: "borrower",
3774
- type: "address"
3775
- },
3776
- {
3777
- internalType: "uint256",
3778
- name: "repayAmount",
3779
- type: "uint256"
3780
- }
3781
2198
  ],
3782
- name: "repayBorrowBehalf",
2199
+ name: "name",
3783
2200
  outputs: [
3784
2201
  {
3785
- internalType: "uint256",
2202
+ internalType: "string",
3786
2203
  name: "",
3787
- type: "uint256"
2204
+ type: "string"
3788
2205
  }
3789
2206
  ],
3790
- payable: false,
3791
- stateMutability: "nonpayable",
2207
+ stateMutability: "pure",
3792
2208
  type: "function"
3793
2209
  },
3794
2210
  {
3795
- constant: true,
3796
2211
  inputs: [
2212
+ {
2213
+ internalType: "address",
2214
+ name: "owner",
2215
+ type: "address"
2216
+ }
3797
2217
  ],
3798
- name: "reserveFactorMantissa",
2218
+ name: "nonces",
3799
2219
  outputs: [
3800
2220
  {
3801
2221
  internalType: "uint256",
@@ -3803,30 +2223,57 @@ var abi$1 = [
3803
2223
  type: "uint256"
3804
2224
  }
3805
2225
  ],
3806
- payable: false,
3807
2226
  stateMutability: "view",
3808
2227
  type: "function"
3809
2228
  },
3810
2229
  {
3811
- constant: false,
3812
2230
  inputs: [
3813
2231
  {
3814
2232
  internalType: "address",
3815
- name: "liquidator",
2233
+ name: "owner",
3816
2234
  type: "address"
3817
2235
  },
3818
2236
  {
3819
2237
  internalType: "address",
3820
- name: "borrower",
2238
+ name: "spender",
3821
2239
  type: "address"
3822
2240
  },
3823
2241
  {
3824
2242
  internalType: "uint256",
3825
- name: "seizeTokens",
2243
+ name: "value",
2244
+ type: "uint256"
2245
+ },
2246
+ {
2247
+ internalType: "uint256",
2248
+ name: "deadline",
3826
2249
  type: "uint256"
2250
+ },
2251
+ {
2252
+ internalType: "uint8",
2253
+ name: "v",
2254
+ type: "uint8"
2255
+ },
2256
+ {
2257
+ internalType: "bytes32",
2258
+ name: "r",
2259
+ type: "bytes32"
2260
+ },
2261
+ {
2262
+ internalType: "bytes32",
2263
+ name: "s",
2264
+ type: "bytes32"
3827
2265
  }
3828
2266
  ],
3829
- name: "seize",
2267
+ name: "permit",
2268
+ outputs: [
2269
+ ],
2270
+ stateMutability: "nonpayable",
2271
+ type: "function"
2272
+ },
2273
+ {
2274
+ inputs: [
2275
+ ],
2276
+ name: "price0CumulativeLast",
3830
2277
  outputs: [
3831
2278
  {
3832
2279
  internalType: "uint256",
@@ -3834,15 +2281,13 @@ var abi$1 = [
3834
2281
  type: "uint256"
3835
2282
  }
3836
2283
  ],
3837
- payable: false,
3838
- stateMutability: "nonpayable",
2284
+ stateMutability: "view",
3839
2285
  type: "function"
3840
2286
  },
3841
2287
  {
3842
- constant: true,
3843
2288
  inputs: [
3844
2289
  ],
3845
- name: "supplyRatePerTimestamp",
2290
+ name: "price1CumulativeLast",
3846
2291
  outputs: [
3847
2292
  {
3848
2293
  internalType: "uint256",
@@ -3850,28 +2295,53 @@ var abi$1 = [
3850
2295
  type: "uint256"
3851
2296
  }
3852
2297
  ],
3853
- payable: false,
3854
2298
  stateMutability: "view",
3855
2299
  type: "function"
3856
2300
  },
3857
2301
  {
3858
- constant: false,
3859
2302
  inputs: [
3860
2303
  {
3861
- internalType: "contract EIP20NonStandardInterface",
3862
- name: "token",
2304
+ internalType: "address",
2305
+ name: "to",
3863
2306
  type: "address"
3864
2307
  }
3865
2308
  ],
3866
- name: "sweepToken",
2309
+ name: "skim",
2310
+ outputs: [
2311
+ ],
2312
+ stateMutability: "nonpayable",
2313
+ type: "function"
2314
+ },
2315
+ {
2316
+ inputs: [
2317
+ {
2318
+ internalType: "uint256",
2319
+ name: "amount0Out",
2320
+ type: "uint256"
2321
+ },
2322
+ {
2323
+ internalType: "uint256",
2324
+ name: "amount1Out",
2325
+ type: "uint256"
2326
+ },
2327
+ {
2328
+ internalType: "address",
2329
+ name: "to",
2330
+ type: "address"
2331
+ },
2332
+ {
2333
+ internalType: "bytes",
2334
+ name: "data",
2335
+ type: "bytes"
2336
+ }
2337
+ ],
2338
+ name: "swap",
3867
2339
  outputs: [
3868
2340
  ],
3869
- payable: false,
3870
2341
  stateMutability: "nonpayable",
3871
2342
  type: "function"
3872
2343
  },
3873
2344
  {
3874
- constant: true,
3875
2345
  inputs: [
3876
2346
  ],
3877
2347
  name: "symbol",
@@ -3882,60 +2352,47 @@ var abi$1 = [
3882
2352
  type: "string"
3883
2353
  }
3884
2354
  ],
3885
- payable: false,
3886
- stateMutability: "view",
2355
+ stateMutability: "pure",
3887
2356
  type: "function"
3888
2357
  },
3889
2358
  {
3890
- constant: true,
3891
2359
  inputs: [
3892
2360
  ],
3893
- name: "totalBorrows",
2361
+ name: "sync",
3894
2362
  outputs: [
3895
- {
3896
- internalType: "uint256",
3897
- name: "",
3898
- type: "uint256"
3899
- }
3900
2363
  ],
3901
- payable: false,
3902
- stateMutability: "view",
2364
+ stateMutability: "nonpayable",
3903
2365
  type: "function"
3904
2366
  },
3905
2367
  {
3906
- constant: false,
3907
2368
  inputs: [
3908
2369
  ],
3909
- name: "totalBorrowsCurrent",
2370
+ name: "token0",
3910
2371
  outputs: [
3911
2372
  {
3912
- internalType: "uint256",
2373
+ internalType: "address",
3913
2374
  name: "",
3914
- type: "uint256"
2375
+ type: "address"
3915
2376
  }
3916
2377
  ],
3917
- payable: false,
3918
- stateMutability: "nonpayable",
2378
+ stateMutability: "view",
3919
2379
  type: "function"
3920
2380
  },
3921
2381
  {
3922
- constant: true,
3923
2382
  inputs: [
3924
2383
  ],
3925
- name: "totalReserves",
2384
+ name: "token1",
3926
2385
  outputs: [
3927
2386
  {
3928
- internalType: "uint256",
2387
+ internalType: "address",
3929
2388
  name: "",
3930
- type: "uint256"
2389
+ type: "address"
3931
2390
  }
3932
2391
  ],
3933
- payable: false,
3934
2392
  stateMutability: "view",
3935
2393
  type: "function"
3936
2394
  },
3937
2395
  {
3938
- constant: true,
3939
2396
  inputs: [
3940
2397
  ],
3941
2398
  name: "totalSupply",
@@ -3946,21 +2403,19 @@ var abi$1 = [
3946
2403
  type: "uint256"
3947
2404
  }
3948
2405
  ],
3949
- payable: false,
3950
2406
  stateMutability: "view",
3951
2407
  type: "function"
3952
2408
  },
3953
2409
  {
3954
- constant: false,
3955
2410
  inputs: [
3956
2411
  {
3957
2412
  internalType: "address",
3958
- name: "dst",
2413
+ name: "to",
3959
2414
  type: "address"
3960
2415
  },
3961
2416
  {
3962
2417
  internalType: "uint256",
3963
- name: "amount",
2418
+ name: "value",
3964
2419
  type: "uint256"
3965
2420
  }
3966
2421
  ],
@@ -3972,26 +2427,24 @@ var abi$1 = [
3972
2427
  type: "bool"
3973
2428
  }
3974
2429
  ],
3975
- payable: false,
3976
2430
  stateMutability: "nonpayable",
3977
2431
  type: "function"
3978
2432
  },
3979
2433
  {
3980
- constant: false,
3981
2434
  inputs: [
3982
2435
  {
3983
2436
  internalType: "address",
3984
- name: "src",
2437
+ name: "from",
3985
2438
  type: "address"
3986
2439
  },
3987
2440
  {
3988
2441
  internalType: "address",
3989
- name: "dst",
2442
+ name: "to",
3990
2443
  type: "address"
3991
2444
  },
3992
2445
  {
3993
2446
  internalType: "uint256",
3994
- name: "amount",
2447
+ name: "value",
3995
2448
  type: "uint256"
3996
2449
  }
3997
2450
  ],
@@ -4003,133 +2456,509 @@ var abi$1 = [
4003
2456
  type: "bool"
4004
2457
  }
4005
2458
  ],
4006
- payable: false,
4007
2459
  stateMutability: "nonpayable",
4008
2460
  type: "function"
4009
- },
4010
- {
4011
- constant: true,
4012
- inputs: [
4013
- ],
4014
- name: "underlying",
4015
- outputs: [
4016
- {
4017
- internalType: "address",
4018
- name: "",
4019
- type: "address"
4020
- }
4021
- ],
4022
- payable: false,
4023
- stateMutability: "view",
4024
- type: "function"
4025
2461
  }
4026
2462
  ];
4027
- var AuToken = {
4028
- abi: abi$1
2463
+ var bytecode = "0x";
2464
+ var deployedBytecode = "0x";
2465
+ var linkReferences = {
2466
+ };
2467
+ var deployedLinkReferences = {
2468
+ };
2469
+ var IUniswapV2PairABI = {
2470
+ _format: _format,
2471
+ contractName: contractName,
2472
+ sourceName: sourceName,
2473
+ abi: abi$1,
2474
+ bytecode: bytecode,
2475
+ deployedBytecode: deployedBytecode,
2476
+ linkReferences: linkReferences,
2477
+ deployedLinkReferences: deployedLinkReferences
4029
2478
  };
4030
2479
 
4031
- function formatObject(object) {
4032
- return JSON.stringify(object, null, ' ');
2480
+ var axios = /*#__PURE__*/require('axios');
2481
+
2482
+ function fetchPriceFromCoingecko(_x) {
2483
+ return _fetchPriceFromCoingecko.apply(this, arguments);
4033
2484
  }
4034
- var decimalFactor = function decimalFactor(decimal) {
4035
- return BigNumber$1.from(10).pow(decimal).toString();
4036
- };
4037
- function validateAndParseAddress(address) {
4038
- try {
4039
- return utils.getAddress(address);
4040
- } catch (error) {
4041
- throw new Error("Invalid address " + address);
4042
- }
2485
+
2486
+ function _fetchPriceFromCoingecko() {
2487
+ _fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
2488
+ var price;
2489
+ return runtime_1.wrap(function _callee$(_context) {
2490
+ while (1) {
2491
+ switch (_context.prev = _context.next) {
2492
+ case 0:
2493
+ _context.next = 2;
2494
+ return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
2495
+ return res.data;
2496
+ });
2497
+
2498
+ case 2:
2499
+ price = _context.sent;
2500
+ return _context.abrupt("return", new BigNumber(price[id].usd));
2501
+
2502
+ case 4:
2503
+ case "end":
2504
+ return _context.stop();
2505
+ }
2506
+ }
2507
+ }, _callee);
2508
+ }));
2509
+ return _fetchPriceFromCoingecko.apply(this, arguments);
4043
2510
  }
4044
2511
 
4045
- var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4046
- _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
2512
+ function fetchBasicTokenPrice(_x2) {
2513
+ return _fetchBasicTokenPrice.apply(this, arguments);
2514
+ }
2515
+
2516
+ function _fetchBasicTokenPrice() {
2517
+ _fetchBasicTokenPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
2518
+ return runtime_1.wrap(function _callee2$(_context2) {
2519
+ while (1) {
2520
+ switch (_context2.prev = _context2.next) {
2521
+ case 0:
2522
+ if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
2523
+ _context2.next = 4;
2524
+ break;
2525
+ }
2526
+
2527
+ return _context2.abrupt("return", fetchPriceFromCoingecko('aurora-near'));
2528
+
2529
+ case 4:
2530
+ throw Error("Unknown token " + address + " in fetchBasicTokenPrice");
2531
+
2532
+ case 5:
2533
+ case "end":
2534
+ return _context2.stop();
2535
+ }
2536
+ }
2537
+ }, _callee2);
2538
+ }));
2539
+ return _fetchBasicTokenPrice.apply(this, arguments);
2540
+ }
2541
+
2542
+ function fetchLPPositions(_x3, _x4) {
2543
+ return _fetchLPPositions.apply(this, arguments);
2544
+ }
2545
+
2546
+ function _fetchLPPositions() {
2547
+ _fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(LPAddress, provider) {
2548
+ var promises, LPContract, values;
2549
+ return runtime_1.wrap(function _callee3$(_context3) {
2550
+ while (1) {
2551
+ switch (_context3.prev = _context3.next) {
2552
+ case 0:
2553
+ promises = [];
2554
+ LPContract = new Contract(LPAddress, IUniswapV2PairABI.abi, provider);
2555
+ promises.push(LPContract.token0());
2556
+ promises.push(LPContract.toekn1());
2557
+ promises.push(LPContract.getReserves());
2558
+ promises.push(LPContract.totalSupply());
2559
+ _context3.next = 8;
2560
+ return Promise.all(promises);
2561
+
2562
+ case 8:
2563
+ values = _context3.sent;
2564
+ return _context3.abrupt("return", {
2565
+ token0: values[0],
2566
+ token1: values[1],
2567
+ reserve0: values[2]._reserve0,
2568
+ reserve1: values[2]._reserve1,
2569
+ totalSupply: values[3]
2570
+ });
2571
+
2572
+ case 10:
2573
+ case "end":
2574
+ return _context3.stop();
2575
+ }
2576
+ }
2577
+ }, _callee3);
2578
+ }));
2579
+ return _fetchLPPositions.apply(this, arguments);
2580
+ }
2581
+
2582
+ function fetchLPPrice(_x5, _x6) {
2583
+ return _fetchLPPrice.apply(this, arguments);
2584
+ }
2585
+
2586
+ function _fetchLPPrice() {
2587
+ _fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(address, provider) {
2588
+ var LPInfo, token0Price, reserveUSD, token1Price, _reserveUSD;
2589
+
2590
+ return runtime_1.wrap(function _callee4$(_context4) {
2591
+ while (1) {
2592
+ switch (_context4.prev = _context4.next) {
2593
+ case 0:
2594
+ _context4.next = 2;
2595
+ return fetchLPPositions(address, provider);
2596
+
2597
+ case 2:
2598
+ LPInfo = _context4.sent;
2599
+ _context4.prev = 3;
2600
+ _context4.next = 6;
2601
+ return fetchPrice(LPInfo.token0, provider);
2602
+
2603
+ case 6:
2604
+ token0Price = _context4.sent;
2605
+ reserveUSD = token0Price.multipliedBy(LPInfo.reserve0.toString()).multipliedBy(2);
2606
+ return _context4.abrupt("return", reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2607
+
2608
+ case 11:
2609
+ _context4.prev = 11;
2610
+ _context4.t0 = _context4["catch"](3);
2611
+ _context4.prev = 13;
2612
+ _context4.next = 16;
2613
+ return fetchPrice(LPInfo.token1, provider);
2614
+
2615
+ case 16:
2616
+ token1Price = _context4.sent;
2617
+ _reserveUSD = token1Price.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(2);
2618
+ return _context4.abrupt("return", _reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
2619
+
2620
+ case 21:
2621
+ _context4.prev = 21;
2622
+ _context4.t1 = _context4["catch"](13);
2623
+ throw Error("Unable to fetch price for both tokens of LP " + address);
2624
+
2625
+ case 24:
2626
+ case "end":
2627
+ return _context4.stop();
2628
+ }
2629
+ }
2630
+ }, _callee4, null, [[3, 11], [13, 21]]);
2631
+ }));
2632
+ return _fetchLPPrice.apply(this, arguments);
2633
+ }
2634
+
2635
+ function fetchPriceFromOracle(_x7, _x8, _x9) {
2636
+ return _fetchPriceFromOracle.apply(this, arguments);
2637
+ }
2638
+
2639
+ function _fetchPriceFromOracle() {
2640
+ _fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(auTokenAddress, underlyingDecimals, provider) {
2641
+ var oracleContract, rawPrice;
2642
+ return runtime_1.wrap(function _callee5$(_context5) {
2643
+ while (1) {
2644
+ switch (_context5.prev = _context5.next) {
2645
+ case 0:
2646
+ oracleContract = new Contract(networkAddresses.misc.oracle, OracleABI.abi, provider);
2647
+ _context5.next = 3;
2648
+ return oracleContract.getUnderlyingPrice(auTokenAddress);
2649
+
2650
+ case 3:
2651
+ rawPrice = _context5.sent;
2652
+ return _context5.abrupt("return", new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimals)));
2653
+
2654
+ case 5:
2655
+ case "end":
2656
+ return _context5.stop();
2657
+ }
2658
+ }
2659
+ }, _callee5);
2660
+ }));
2661
+ return _fetchPriceFromOracle.apply(this, arguments);
2662
+ }
2663
+
2664
+ function fetchPrice(_x10, _x11) {
2665
+ return _fetchPrice.apply(this, arguments);
2666
+ }
2667
+
2668
+ function _fetchPrice() {
2669
+ _fetchPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(address, provider) {
2670
+ var matchingAuToken;
2671
+ return runtime_1.wrap(function _callee6$(_context6) {
2672
+ while (1) {
2673
+ switch (_context6.prev = _context6.next) {
2674
+ case 0:
2675
+ matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
2676
+ return isSameAddress(auToken.underlying, address);
2677
+ });
2678
+
2679
+ if (!(matchingAuToken !== undefined)) {
2680
+ _context6.next = 5;
2681
+ break;
2682
+ }
2683
+
2684
+ return _context6.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
2685
+
2686
+ case 5:
2687
+ if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
2688
+ _context6.next = 9;
2689
+ break;
2690
+ }
2691
+
2692
+ return _context6.abrupt("return", fetchLPPrice(address, provider));
2693
+
2694
+ case 9:
2695
+ return _context6.abrupt("return", fetchBasicTokenPrice(address));
2696
+
2697
+ case 10:
2698
+ case "end":
2699
+ return _context6.stop();
2700
+ }
2701
+ }
2702
+ }, _callee6);
2703
+ }));
2704
+ return _fetchPrice.apply(this, arguments);
2705
+ }
2706
+
2707
+ function fetchValuation(_x12, _x13, _x14) {
2708
+ return _fetchValuation.apply(this, arguments);
2709
+ }
2710
+
2711
+ function _fetchValuation() {
2712
+ _fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(tokenAmount, provider, price) {
2713
+ return runtime_1.wrap(function _callee7$(_context7) {
2714
+ while (1) {
2715
+ switch (_context7.prev = _context7.next) {
2716
+ case 0:
2717
+ return _context7.abrupt("return", new BigNumber(0));
2718
+
2719
+ case 1:
2720
+ case "end":
2721
+ return _context7.stop();
2722
+ }
2723
+ }
2724
+ }, _callee7);
2725
+ }));
2726
+ return _fetchValuation.apply(this, arguments);
2727
+ }
4047
2728
 
4048
- function MoneyMarketRead(providerOrSigner, auToken) {
2729
+ var abi$2 = [
2730
+ ];
2731
+ var dummyABI = {
2732
+ abi: abi$2
2733
+ };
2734
+
2735
+ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
2736
+ _inheritsLoose(SdkRead, _BlockchainEntityRead);
2737
+
2738
+ function SdkRead(networkConnection) {
4049
2739
  var _this;
4050
2740
 
4051
- _this = _BlockchainEntityRead.call(this, providerOrSigner) || this;
4052
- _this._auToken = new Contract(auToken, AuToken.abi, providerOrSigner);
2741
+ _this = _BlockchainEntityRead.call(this, networkConnection) || this;
2742
+ _this._comptroller = new Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
2743
+ _this._tokenLock = new Contract(networkAddresses.misc.TOKENLOCK, TokenLockABI.abi, networkConnection.provider);
2744
+ _this._auriFairLaunch = new Contract(networkAddresses.misc.AURIFAIRLAUNCH, AuriFairLaunchABI.abi, networkConnection.provider);
2745
+ _this._auriLens = new Contract(networkAddresses.misc.AURILENS, dummyABI.abi, networkConnection.provider);
4053
2746
  return _this;
4054
2747
  }
4055
2748
 
4056
- var _proto = MoneyMarketRead.prototype;
2749
+ var _proto = SdkRead.prototype;
4057
2750
 
4058
- _proto.getDetails = /*#__PURE__*/function () {
4059
- var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2751
+ _proto.getLockingDetails = /*#__PURE__*/function () {
2752
+ var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2753
+ var currentTime, currentWeek, denominator, promises, values;
4060
2754
  return runtime_1.wrap(function _callee$(_context) {
4061
2755
  while (1) {
4062
2756
  switch (_context.prev = _context.next) {
4063
2757
  case 0:
2758
+ _context.next = 2;
2759
+ return getCurrentTimestamp(this._networkConnection.provider);
2760
+
2761
+ case 2:
2762
+ currentTime = _context.sent;
2763
+ currentWeek = BigNumber$1.from(currentTime - REWARDCLAIMSTART).div(7 * ONE_DAY).toNumber();
2764
+ denominator = 10000;
2765
+ promises = [];
2766
+ promises.push(this._tokenLock.percentageLock(currentWeek));
2767
+ promises.push(this._tokenLock.percentageLock(currentWeek + 1)["catch"](function (err) {
2768
+ return denominator;
2769
+ }));
2770
+ _context.next = 10;
2771
+ return Promise.all(promises).then(function (res) {
2772
+ return res.map(function (v) {
2773
+ return v.toString();
2774
+ });
2775
+ });
2776
+
2777
+ case 10:
2778
+ values = _context.sent;
4064
2779
  return _context.abrupt("return", {
4065
- auTokenAddress: '0x1111111111111111111111111111111111111111',
4066
- totalTokenDeposited: dummyTokenAmount,
4067
- totalTokenBorrowed: dummyTokenAmount2,
4068
- depositApy: 0.1234,
4069
- depositPlyApy: 0.2345,
4070
- borrowApy: 0.24,
4071
- borrowPlyApy: 0.18,
4072
- collateralRatio: 0.7
2780
+ vestingStart: REWARDCLAIMSTART,
2781
+ currentUnlockPortion: new BigNumber(values[0]).div(denominator).toNumber(),
2782
+ nextUnlockPortion: new BigNumber(values[1]).div(denominator).toNumber()
4073
2783
  });
4074
2784
 
4075
- case 1:
2785
+ case 12:
4076
2786
  case "end":
4077
2787
  return _context.stop();
4078
2788
  }
4079
2789
  }
4080
- }, _callee);
2790
+ }, _callee, this);
4081
2791
  }));
4082
2792
 
4083
- function getDetails() {
4084
- return _getDetails.apply(this, arguments);
2793
+ function getLockingDetails() {
2794
+ return _getLockingDetails.apply(this, arguments);
4085
2795
  }
4086
2796
 
4087
- return getDetails;
2797
+ return getLockingDetails;
4088
2798
  }();
4089
2799
 
4090
- return MoneyMarketRead;
4091
- }(BlockchainEntityRead);
4092
- var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4093
- _inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
2800
+ _proto.getUserDetails = /*#__PURE__*/function () {
2801
+ var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
2802
+ var _this2 = this;
4094
2803
 
4095
- function MoneyMarketReadWrite() {
4096
- var _this2;
2804
+ var marketCount, userMarketDetails, assetsIn, collateralRatio, promises, totalBorrowLimit, pricePromises, _loop2, _iterator, _step, underlyingPrices, depositValuationPromises, _loop, i, depositValues, accountLiquidity, rewardBalancesMetadata, lockedAmount, values, borrowedvaluation, bufferedBorrowLimit, borrowableAmount, auToken, moneyMarket;
4097
2805
 
4098
- _this2 = _MoneyMarketRead.apply(this, arguments) || this;
4099
- _this2.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
4100
- var dummyErc20Token;
4101
2806
  return runtime_1.wrap(function _callee2$(_context2) {
4102
2807
  while (1) {
4103
2808
  switch (_context2.prev = _context2.next) {
4104
2809
  case 0:
4105
- dummyErc20Token = new Contract(dummyToken.address, IERC20.abi, _this2._providerOrSigner);
4106
- _context2.next = 3;
4107
- return dummyErc20Token.approve(dummyToken.address, 123);
2810
+ marketCount = networkAddresses.auTokens.length;
2811
+ userMarketDetails = [];
2812
+ promises = [];
2813
+ totalBorrowLimit = new BigNumber(0);
2814
+ pricePromises = [];
2815
+
2816
+ _loop2 = function _loop2() {
2817
+ var auToken = _step.value;
2818
+ var userMarketDetail = {};
2819
+ userMarketDetails.push(userMarketDetail);
2820
+ userMarketDetail.market = auToken.underlying;
2821
+ var moneyMarket = new MoneyMarketRead(_this2._networkConnection, auToken.address, auToken.underlying);
2822
+ promises.push(moneyMarket.getUserDepositBalance(userAddress).then(function (res) {
2823
+ userMarketDetail.depositBalance = res;
2824
+ }));
2825
+ promises.push(moneyMarket.getUserBorrowBalance(userAddress).then(function (res) {
2826
+ userMarketDetail.borrowBalance = res;
2827
+ }));
2828
+ promises.push(moneyMarket.getCollateralRatio().then(function (res) {
2829
+ collateralRatio[i] = res;
2830
+ }));
2831
+ pricePromises.push(fetchPrice(moneyMarket.underlying.address, _this2._networkConnection.provider));
2832
+ };
2833
+
2834
+ for (_iterator = _createForOfIteratorHelperLoose(networkAddresses.auTokens); !(_step = _iterator()).done;) {
2835
+ _loop2();
2836
+ }
4108
2837
 
4109
- case 3:
4110
- return _context2.abrupt("return", _context2.sent);
2838
+ promises.push(this._comptroller.getAssetsIn(userAddress).then(function (res) {
2839
+ assetsIn = res;
2840
+ }));
2841
+ _context2.next = 10;
2842
+ return Promise.all(promises);
4111
2843
 
4112
- case 4:
2844
+ case 10:
2845
+ _context2.next = 12;
2846
+ return Promise.all(pricePromises);
2847
+
2848
+ case 12:
2849
+ underlyingPrices = _context2.sent;
2850
+ depositValuationPromises = [];
2851
+
2852
+ _loop = function _loop() {
2853
+ var auToken = networkAddresses.auTokens[i];
2854
+
2855
+ if (assetsIn.filter(function (auAddress) {
2856
+ isSameAddress(auToken.address, auAddress);
2857
+ }).length > 0) {
2858
+ userMarketDetails[i].isCollateral = true;
2859
+ }
2860
+
2861
+ depositValuationPromises.push(fetchValuation(userMarketDetails[i].depositBalance, _this2._networkConnection.provider, underlyingPrices[i]));
2862
+ };
2863
+
2864
+ for (i = 0; i < marketCount; i++) {
2865
+ _loop();
2866
+ }
2867
+
2868
+ _context2.next = 18;
2869
+ return Promise.all(depositValuationPromises);
2870
+
2871
+ case 18:
2872
+ depositValues = _context2.sent;
2873
+ totalBorrowLimit = depositValues.reduce(function (p, v, index) {
2874
+ if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(collateralRatio[index]));
2875
+ return p;
2876
+ });
2877
+ promises = [];
2878
+ promises.push(this._comptroller.getAccountLiquidity(userAddress));
2879
+ promises.push(this._auriLens.getRewardBalancesMetadata(this._comptroller.address, userAddress));
2880
+ promises.push(this._tokenLock.lockedAmounts(userAddress));
2881
+ _context2.next = 26;
2882
+ return Promise.all(promises);
2883
+
2884
+ case 26:
2885
+ values = _context2.sent;
2886
+ accountLiquidity = values[0];
2887
+ rewardBalancesMetadata = values[1];
2888
+ lockedAmount = values[2];
2889
+ borrowedvaluation = totalBorrowLimit.minus(new BigNumber(accountLiquidity[1].toString()).div(decimalFactor(18)));
2890
+ bufferedBorrowLimit = totalBorrowLimit.multipliedBy(BORROW_LIMIT_BUFFER);
2891
+
2892
+ if (bufferedBorrowLimit.lte(borrowedvaluation)) {
2893
+ borrowableAmount = new BigNumber(0);
2894
+ } else {
2895
+ borrowableAmount = bufferedBorrowLimit.minus(borrowedvaluation);
2896
+ }
2897
+
2898
+ for (i = 0; i < marketCount; i++) {
2899
+ auToken = networkAddresses.auTokens[i];
2900
+ moneyMarket = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
2901
+ userMarketDetails[i].maxWithdrawableAmount = new TokenAmount(moneyMarket.underlying, borrowableAmount.div(underlyingPrices[i]).toFixed(18));
2902
+ }
2903
+
2904
+ return _context2.abrupt("return", {
2905
+ markets: userMarketDetails,
2906
+ borrowLimit: {
2907
+ currency: "USD",
2908
+ amount: bufferedBorrowLimit.toFixed(DECIMAL_PRECISION)
2909
+ },
2910
+ accruedPly: new TokenAmount(PLYToken, rewardBalancesMetadata.plyAccrued.toString()),
2911
+ lockedPly: new TokenAmount(PLYToken, lockedAmount.toString()),
2912
+ borrowableAmount: {
2913
+ currency: "USD",
2914
+ amount: borrowableAmount.toFixed(DECIMAL_PRECISION)
2915
+ }
2916
+ });
2917
+
2918
+ case 35:
4113
2919
  case "end":
4114
2920
  return _context2.stop();
4115
2921
  }
4116
2922
  }
4117
- }, _callee2);
2923
+ }, _callee2, this);
4118
2924
  }));
4119
- return _this2;
4120
- }
4121
2925
 
4122
- var _proto2 = MoneyMarketReadWrite.prototype;
2926
+ function getUserDetails(_x) {
2927
+ return _getUserDetails.apply(this, arguments);
2928
+ }
4123
2929
 
4124
- _proto2.deposit = /*#__PURE__*/function () {
4125
- var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(amount) {
2930
+ return getUserDetails;
2931
+ }();
2932
+
2933
+ _proto.getPlyAuroraPoolDetails = /*#__PURE__*/function () {
2934
+ var _getPlyAuroraPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2935
+ var stakedLiquidity, rewardPerSecond, promises, rewardPerSecondValuation, totalStakeValuation;
4126
2936
  return runtime_1.wrap(function _callee3$(_context3) {
4127
2937
  while (1) {
4128
2938
  switch (_context3.prev = _context3.next) {
4129
2939
  case 0:
4130
- return _context3.abrupt("return", this.dummyTransaction());
2940
+ promises = [];
2941
+ promises.push(this._auriFairLaunch.getPoolInfo(AurPlyPid).then(function (res) {
2942
+ stakedLiquidity = res.totalStake;
2943
+ rewardPerSecond = res.rewardPerSecond;
2944
+ }));
2945
+ _context3.next = 4;
2946
+ return Promise.all(promises);
4131
2947
 
4132
- case 1:
2948
+ case 4:
2949
+ promises = [];
2950
+ promises.push(fetchValuation(new TokenAmount(PLYToken, rewardPerSecond.toString()), this._networkConnection.provider).then(function (res) {
2951
+ return rewardPerSecondValuation = res;
2952
+ }));
2953
+ promises.push(fetchValuation(new TokenAmount(AURPLYToken, stakedLiquidity.toString()), this._networkConnection.provider).then(function (res) {
2954
+ return totalStakeValuation = res;
2955
+ }));
2956
+ return _context3.abrupt("return", {
2957
+ totalStakedLiquidity: new TokenAmount(AURPLYToken, stakedLiquidity.toString()),
2958
+ apy: calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION)
2959
+ });
2960
+
2961
+ case 8:
4133
2962
  case "end":
4134
2963
  return _context3.stop();
4135
2964
  }
@@ -4137,22 +2966,31 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4137
2966
  }, _callee3, this);
4138
2967
  }));
4139
2968
 
4140
- function deposit(_x) {
4141
- return _deposit.apply(this, arguments);
2969
+ function getPlyAuroraPoolDetails() {
2970
+ return _getPlyAuroraPoolDetails.apply(this, arguments);
4142
2971
  }
4143
2972
 
4144
- return deposit;
2973
+ return getPlyAuroraPoolDetails;
4145
2974
  }();
4146
2975
 
4147
- _proto2.borrow = /*#__PURE__*/function () {
4148
- var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(amount) {
2976
+ _proto.getTokenPrice = /*#__PURE__*/function () {
2977
+ var _getTokenPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
2978
+ var price;
4149
2979
  return runtime_1.wrap(function _callee4$(_context4) {
4150
2980
  while (1) {
4151
2981
  switch (_context4.prev = _context4.next) {
4152
2982
  case 0:
4153
- return _context4.abrupt("return", this.dummyTransaction());
2983
+ _context4.next = 2;
2984
+ return fetchPrice(token.address, this._networkConnection.provider);
4154
2985
 
4155
- case 1:
2986
+ case 2:
2987
+ price = _context4.sent;
2988
+ return _context4.abrupt("return", {
2989
+ currency: "USD",
2990
+ amount: price.toFixed(DECIMAL_PRECISION)
2991
+ });
2992
+
2993
+ case 4:
4156
2994
  case "end":
4157
2995
  return _context4.stop();
4158
2996
  }
@@ -4160,22 +2998,28 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4160
2998
  }, _callee4, this);
4161
2999
  }));
4162
3000
 
4163
- function borrow(_x2) {
4164
- return _borrow.apply(this, arguments);
3001
+ function getTokenPrice(_x2) {
3002
+ return _getTokenPrice.apply(this, arguments);
4165
3003
  }
4166
3004
 
4167
- return borrow;
3005
+ return getTokenPrice;
4168
3006
  }();
4169
3007
 
4170
- _proto2.withdraw = /*#__PURE__*/function () {
4171
- var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(amount) {
3008
+ _proto.stakeBalanceOf = /*#__PURE__*/function () {
3009
+ var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
3010
+ var userInfo;
4172
3011
  return runtime_1.wrap(function _callee5$(_context5) {
4173
3012
  while (1) {
4174
3013
  switch (_context5.prev = _context5.next) {
4175
3014
  case 0:
4176
- return _context5.abrupt("return", this.dummyTransaction());
3015
+ _context5.next = 2;
3016
+ return this._auriFairLaunch.getUserInfo(AurPlyPid, user);
4177
3017
 
4178
- case 1:
3018
+ case 2:
3019
+ userInfo = _context5.sent;
3020
+ return _context5.abrupt("return", new TokenAmount(AURPLYToken, userInfo.amount.toString()));
3021
+
3022
+ case 4:
4179
3023
  case "end":
4180
3024
  return _context5.stop();
4181
3025
  }
@@ -4183,22 +3027,42 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4183
3027
  }, _callee5, this);
4184
3028
  }));
4185
3029
 
4186
- function withdraw(_x3) {
4187
- return _withdraw.apply(this, arguments);
3030
+ function stakeBalanceOf(_x3) {
3031
+ return _stakeBalanceOf.apply(this, arguments);
4188
3032
  }
4189
3033
 
4190
- return withdraw;
3034
+ return stakeBalanceOf;
4191
3035
  }();
4192
3036
 
4193
- _proto2.repay = /*#__PURE__*/function () {
4194
- var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(amount) {
3037
+ return SdkRead;
3038
+ }(BlockchainEntityRead);
3039
+ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
3040
+ _inheritsLoose(SdkReadWrite, _SdkRead);
3041
+
3042
+ function SdkReadWrite() {
3043
+ return _SdkRead.apply(this, arguments) || this;
3044
+ }
3045
+
3046
+ var _proto2 = SdkReadWrite.prototype;
3047
+
3048
+ _proto2.claim = /*#__PURE__*/function () {
3049
+ var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
4195
3050
  return runtime_1.wrap(function _callee6$(_context6) {
4196
3051
  while (1) {
4197
3052
  switch (_context6.prev = _context6.next) {
4198
3053
  case 0:
4199
- return _context6.abrupt("return", this.dummyTransaction());
4200
-
4201
- case 1:
3054
+ _context6.t0 = this._auriLens.connect(this._networkConnection.signer);
3055
+ _context6.t1 = this._comptroller.address;
3056
+ _context6.t2 = this._auriFairLaunch.address;
3057
+ _context6.next = 5;
3058
+ return this._networkConnection.signer.getAddress();
3059
+
3060
+ case 5:
3061
+ _context6.t3 = _context6.sent;
3062
+ _context6.t4 = [AurPlyPid];
3063
+ return _context6.abrupt("return", _context6.t0.claimRewards.call(_context6.t0, _context6.t1, _context6.t2, _context6.t3, _context6.t4));
3064
+
3065
+ case 8:
4202
3066
  case "end":
4203
3067
  return _context6.stop();
4204
3068
  }
@@ -4206,20 +3070,20 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4206
3070
  }, _callee6, this);
4207
3071
  }));
4208
3072
 
4209
- function repay(_x4) {
4210
- return _repay.apply(this, arguments);
3073
+ function claim() {
3074
+ return _claim.apply(this, arguments);
4211
3075
  }
4212
3076
 
4213
- return repay;
3077
+ return claim;
4214
3078
  }();
4215
3079
 
4216
- _proto2.enableCollateral = /*#__PURE__*/function () {
4217
- var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
3080
+ _proto2.stake = /*#__PURE__*/function () {
3081
+ var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount) {
4218
3082
  return runtime_1.wrap(function _callee7$(_context7) {
4219
3083
  while (1) {
4220
3084
  switch (_context7.prev = _context7.next) {
4221
3085
  case 0:
4222
- return _context7.abrupt("return", this.dummyTransaction());
3086
+ return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(AurPlyPid, amount.rawAmount(), false));
4223
3087
 
4224
3088
  case 1:
4225
3089
  case "end":
@@ -4229,20 +3093,20 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4229
3093
  }, _callee7, this);
4230
3094
  }));
4231
3095
 
4232
- function enableCollateral() {
4233
- return _enableCollateral.apply(this, arguments);
3096
+ function stake(_x4) {
3097
+ return _stake.apply(this, arguments);
4234
3098
  }
4235
3099
 
4236
- return enableCollateral;
3100
+ return stake;
4237
3101
  }();
4238
3102
 
4239
- _proto2.disableCollateral = /*#__PURE__*/function () {
4240
- var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
3103
+ _proto2.unstake = /*#__PURE__*/function () {
3104
+ var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
4241
3105
  return runtime_1.wrap(function _callee8$(_context8) {
4242
3106
  while (1) {
4243
3107
  switch (_context8.prev = _context8.next) {
4244
3108
  case 0:
4245
- return _context8.abrupt("return", this.dummyTransaction());
3109
+ return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(AurPlyPid, amount.rawAmount()));
4246
3110
 
4247
3111
  case 1:
4248
3112
  case "end":
@@ -4252,38 +3116,50 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4252
3116
  }, _callee8, this);
4253
3117
  }));
4254
3118
 
4255
- function disableCollateral() {
4256
- return _disableCollateral.apply(this, arguments);
3119
+ function unstake(_x5) {
3120
+ return _unstake.apply(this, arguments);
4257
3121
  }
4258
3122
 
4259
- return disableCollateral;
3123
+ return unstake;
4260
3124
  }();
4261
3125
 
4262
- return MoneyMarketReadWrite;
4263
- }(MoneyMarketRead);
4264
- var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
4265
- _inheritsLoose(MoneyMarket, _BlockchainEntity);
4266
-
4267
- function MoneyMarket(address) {
4268
- var _this3;
3126
+ return SdkReadWrite;
3127
+ }(SdkRead);
3128
+ var SDK = /*#__PURE__*/function (_BlockchainEntity) {
3129
+ _inheritsLoose(SDK, _BlockchainEntity);
4269
3130
 
4270
- _this3 = _BlockchainEntity.call(this) || this;
4271
- _this3.address = validateAndParseAddress(address);
4272
- return _this3;
3131
+ function SDK() {
3132
+ return _BlockchainEntity.call(this) || this;
4273
3133
  }
4274
3134
 
4275
- var _proto3 = MoneyMarket.prototype;
3135
+ var _proto3 = SDK.prototype;
4276
3136
 
4277
- _proto3.read = function read(provider) {
4278
- return new MoneyMarketRead(provider, this.address);
3137
+ _proto3.read = function read(networkConnection) {
3138
+ return new SdkRead(networkConnection);
4279
3139
  };
4280
3140
 
4281
- return MoneyMarket;
3141
+ SDK.defaultProvider = function defaultProvider() {
3142
+ return new ethers$1.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
3143
+ };
3144
+
3145
+ return SDK;
4282
3146
  }(BlockchainEntity);
4283
3147
 
4284
- function sum(a, b) {
4285
- return a + b;
4286
- }
3148
+ var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
3149
+ var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
3150
+ var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
3151
+ var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
3152
+ var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
3153
+ var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
3154
+ var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
3155
+ var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
3156
+ var dummyUserMarketDetails = {
3157
+ market: dummyMarketAddress,
3158
+ depositBalance: dummyTokenAmount2,
3159
+ borrowBalance: dummyZeroTokenAmount,
3160
+ isCollateral: true,
3161
+ maxWithdrawableAmount: dummyTokenAmount
3162
+ };
4287
3163
 
4288
- export { AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, DOLLAR, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, SDK, SdkRead, SdkReadWrite, decimalFactor, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, formatObject, sum, validateAndParseAddress };
3164
+ export { AURORA_CHAINID, AURPLYToken, AVAX_DEFAULT_PROVIDER, AVAX_DEFAULT_PROVIDER_URL, AVAX_DEFAULT_SIGNER, AurPlyPid, BORROW_LIMIT_BUFFER, BlockchainEntity, BlockchainEntityRead, BlockchainEntityReadWrite, DECIMAL_PRECISION, ETHAddress, MoneyMarket, MoneyMarketRead, MoneyMarketReadWrite, ONE_DAY, PLYToken, REWARDCLAIMSTART, SDK, SdkRead, SdkReadWrite, Token, TokenAmount, calcLMRewardApr, decimalFactor, dummyAddress, dummyMarketAddress, dummyPly, dummyPlyAurora, dummyToken, dummyTokenAmount, dummyTokenAmount2, dummyTokenAmount3, dummyUserMarketDetails, dummyZeroTokenAmount, fetchBasicTokenPrice, fetchLPPositions, fetchLPPrice, fetchPrice, fetchPriceFromCoingecko, fetchPriceFromOracle, fetchValuation, formatObject, getCurrentTimestamp, getDecimal, isSameAddress, networkAddresses, validateAndParseAddress };
4289
3165
  //# sourceMappingURL=sdk.esm.js.map