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