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