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