@aurigami/sdk 0.1.6 → 0.2.3
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/BlockchainEntity.d.ts +6 -7
- package/dist/MoneyMarket.d.ts +25 -12
- package/dist/SDK.d.ts +15 -9
- package/dist/constants.d.ts +19 -2
- package/dist/decimals.d.ts +1 -0
- package/dist/dummy.d.ts +6 -5
- package/dist/helpers.d.ts +9 -0
- package/dist/index.d.ts +4 -1
- package/dist/priceFetcher.d.ts +18 -0
- package/dist/sdk.cjs.development.js +2210 -312
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +2184 -310
- package/dist/sdk.esm.js.map +1 -1
- package/dist/token.d.ts +7 -0
- package/dist/tokenAmount.d.ts +8 -0
- package/dist/types.d.ts +23 -11
- package/package.json +8 -7
- package/src/BlockchainEntity.ts +13 -10
- package/src/MoneyMarket.ts +178 -47
- package/src/SDK.ts +163 -72
- package/src/abis/IUniswapV2Pair.json +663 -0
- package/src/abis/Oracle.json +247 -0
- package/src/abis/dummy.json +3 -0
- package/src/constants.ts +75 -8
- package/src/decimals.ts +18 -0
- package/src/dummy.ts +30 -44
- package/src/helpers.ts +37 -0
- package/src/index.ts +4 -4
- package/src/priceFetcher.ts +108 -0
- package/src/token.ts +21 -0
- package/src/tokenAmount.ts +29 -0
- package/src/types.ts +26 -12
|
@@ -4,9 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
7
|
+
var abstractSigner = require('@ethersproject/abstract-signer');
|
|
8
|
+
var BigNumber = _interopDefault(require('bignumber.js'));
|
|
9
|
+
var ethers$1 = require('ethers');
|
|
10
|
+
var AuErc20ABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuErc20.sol/AuErc20.json'));
|
|
11
|
+
var AuETHABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuETH.sol/AuETH.json'));
|
|
12
|
+
var ComptrollerABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/Comptroller.sol/Comptroller.json'));
|
|
13
|
+
var TokenLockABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/TokenLock.sol/TokenLock.json'));
|
|
14
|
+
var AuriFairLaunchABI = _interopDefault(require('@aurigami/contracts/artifacts/contracts/AuriFairLaunch.sol/AuriFairLaunch.json'));
|
|
10
15
|
|
|
11
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
12
17
|
try {
|
|
@@ -60,6 +65,44 @@ function _setPrototypeOf(o, p) {
|
|
|
60
65
|
return _setPrototypeOf(o, p);
|
|
61
66
|
}
|
|
62
67
|
|
|
68
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
69
|
+
if (!o) return;
|
|
70
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
71
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
72
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
73
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
74
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function _arrayLikeToArray(arr, len) {
|
|
78
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
79
|
+
|
|
80
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
81
|
+
|
|
82
|
+
return arr2;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
86
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
87
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
88
|
+
|
|
89
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
90
|
+
if (it) o = it;
|
|
91
|
+
var i = 0;
|
|
92
|
+
return function () {
|
|
93
|
+
if (i >= o.length) return {
|
|
94
|
+
done: true
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
done: false,
|
|
98
|
+
value: o[i++]
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
104
|
+
}
|
|
105
|
+
|
|
63
106
|
function createCommonjsModule(fn, module) {
|
|
64
107
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
65
108
|
}
|
|
@@ -820,14 +863,18 @@ try {
|
|
|
820
863
|
}
|
|
821
864
|
});
|
|
822
865
|
|
|
823
|
-
var BlockchainEntityRead = function BlockchainEntityRead(
|
|
824
|
-
this.
|
|
866
|
+
var BlockchainEntityRead = function BlockchainEntityRead(networkConnection) {
|
|
867
|
+
this._networkConnection = networkConnection;
|
|
825
868
|
};
|
|
826
869
|
var BlockchainEntityReadWrite = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
827
870
|
_inheritsLoose(BlockchainEntityReadWrite, _BlockchainEntityRead);
|
|
828
871
|
|
|
829
|
-
function BlockchainEntityReadWrite(
|
|
830
|
-
|
|
872
|
+
function BlockchainEntityReadWrite(networkConnection) {
|
|
873
|
+
if (!(networkConnection.signer instanceof abstractSigner.Signer)) {
|
|
874
|
+
throw Error("Signer is not provided when constructing BlockchainEntityReadWrite");
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
return _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
831
878
|
}
|
|
832
879
|
|
|
833
880
|
return BlockchainEntityReadWrite;
|
|
@@ -837,230 +884,342 @@ var BlockchainEntity = /*#__PURE__*/function () {
|
|
|
837
884
|
|
|
838
885
|
var _proto = BlockchainEntity.prototype;
|
|
839
886
|
|
|
840
|
-
_proto.read = function read(
|
|
841
|
-
return new BlockchainEntityRead(
|
|
887
|
+
_proto.read = function read(networkConnection) {
|
|
888
|
+
return new BlockchainEntityRead(networkConnection);
|
|
842
889
|
};
|
|
843
890
|
|
|
844
|
-
_proto.readWrite = function readWrite(
|
|
845
|
-
return new BlockchainEntityReadWrite(
|
|
891
|
+
_proto.readWrite = function readWrite(networkConnection) {
|
|
892
|
+
return new BlockchainEntityReadWrite(networkConnection);
|
|
846
893
|
};
|
|
847
894
|
|
|
848
895
|
return BlockchainEntity;
|
|
849
896
|
}();
|
|
850
897
|
|
|
851
|
-
var dummyToken = /*#__PURE__*/new sdkCore.Token({
|
|
852
|
-
chainId: 43114,
|
|
853
|
-
decimal: 6,
|
|
854
|
-
symbol: 'USDC',
|
|
855
|
-
address: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'
|
|
856
|
-
});
|
|
857
|
-
var dummyPly = /*#__PURE__*/new sdkCore.Token({
|
|
858
|
-
chainId: 43114,
|
|
859
|
-
decimal: 18,
|
|
860
|
-
symbol: 'QI',
|
|
861
|
-
address: '0x8729438eb15e2c8b576fcc6aecda6a148776c0f5'
|
|
862
|
-
});
|
|
863
|
-
var dummyPlyAurora = /*#__PURE__*/new sdkCore.Token({
|
|
864
|
-
chainId: 43114,
|
|
865
|
-
decimal: 18,
|
|
866
|
-
symbol: 'QIWAVAX',
|
|
867
|
-
address: '0xE530dC2095Ef5653205CF5ea79F8979a7028065c'
|
|
868
|
-
});
|
|
869
|
-
var dummyTokenAmount = /*#__PURE__*/new sdkCore.CurrencyAmount({
|
|
870
|
-
currency: dummyToken,
|
|
871
|
-
amount: '123.456',
|
|
872
|
-
isRaw: false
|
|
873
|
-
});
|
|
874
|
-
var dummyZeroTokenAmount = /*#__PURE__*/new sdkCore.CurrencyAmount({
|
|
875
|
-
currency: dummyToken,
|
|
876
|
-
amount: '0'
|
|
877
|
-
});
|
|
878
|
-
var dummyTokenAmount2 = /*#__PURE__*/new sdkCore.CurrencyAmount({
|
|
879
|
-
currency: dummyToken,
|
|
880
|
-
amount: '456.123',
|
|
881
|
-
isRaw: false
|
|
882
|
-
});
|
|
883
|
-
var dummyTokenAmount3 = /*#__PURE__*/new sdkCore.CurrencyAmount({
|
|
884
|
-
currency: dummyToken,
|
|
885
|
-
amount: '1000.123',
|
|
886
|
-
isRaw: false
|
|
887
|
-
});
|
|
888
|
-
var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
|
|
889
|
-
var dummyUserMarketDetails = {
|
|
890
|
-
market: dummyMarketAddress,
|
|
891
|
-
depositBalance: dummyTokenAmount2,
|
|
892
|
-
borrowBalance: dummyZeroTokenAmount,
|
|
893
|
-
isCollateral: true,
|
|
894
|
-
maxWithdrawableAmount: dummyTokenAmount
|
|
895
|
-
};
|
|
896
|
-
|
|
897
898
|
var ethers = /*#__PURE__*/require('ethers');
|
|
898
899
|
|
|
899
|
-
var DOLLAR = /*#__PURE__*/new sdkCore.Token({
|
|
900
|
-
chainId: 43114,
|
|
901
|
-
decimal: 2,
|
|
902
|
-
symbol: 'USDC',
|
|
903
|
-
address: '0x0000000000000000000000000000000000000001'
|
|
904
|
-
});
|
|
905
900
|
var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
|
|
906
901
|
var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
|
|
902
|
+
var dummyAddress = "0xDEADbeEfEEeEEEeEEEeEEeeeeeEeEEeeeeEEEEeE";
|
|
903
|
+
var ETHAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
907
904
|
var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
|
|
908
905
|
var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
|
|
906
|
+
var AURORA_CHAINID = 1313161554;
|
|
907
|
+
var DECIMAL_PRECISION = 6;
|
|
908
|
+
var networkAddresses = {
|
|
909
|
+
auTokens: [{
|
|
910
|
+
address: '0x7967532568bef9ec96cfad6badea4c63add5888a',
|
|
911
|
+
underlying: '0x9738319d4b8a95a9b3cfd99419dbf859904f23d8'
|
|
912
|
+
}, {
|
|
913
|
+
address: '0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60',
|
|
914
|
+
underlying: ETHAddress
|
|
915
|
+
}, {
|
|
916
|
+
address: '0xccf005cfc3669d806a03f0617885648c397c456e',
|
|
917
|
+
underlying: '0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6'
|
|
918
|
+
}, {
|
|
919
|
+
address: '0x55a4c111c007f39326edf22cfd63bbbb21a35b35',
|
|
920
|
+
underlying: '0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369'
|
|
921
|
+
}, {
|
|
922
|
+
address: '0x77b088236c071ab5bd4e0bd21240b093275adffc',
|
|
923
|
+
underlying: '0x675c7e1d48f88329c6b4cd3867db5f10a69cda18'
|
|
924
|
+
}, {
|
|
925
|
+
address: '0xaa68274f87fd9ae940f1dec31b643486838481c1',
|
|
926
|
+
underlying: '0x7a80df8230c5aa711e2702a275ab31aeb32754bf'
|
|
927
|
+
}, {
|
|
928
|
+
address: '0x6970167dfaa2aaa67404204102cbbd18b405eca9',
|
|
929
|
+
underlying: '0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428'
|
|
930
|
+
}, {
|
|
931
|
+
address: '0x9630a6c5b729194972199805075fd76707a9713a',
|
|
932
|
+
underlying: '0x6f8a1daa158e08f75711a64e5a3073e959d688a6'
|
|
933
|
+
}],
|
|
934
|
+
misc: {
|
|
935
|
+
COMPTROLLER: "0xb51028d4f3fc69e3f9e3118ce067a4562c595aad",
|
|
936
|
+
oracle: "0xf1ebfaa2af93f4d82215fd7817c1835853c62fb8",
|
|
937
|
+
AURIFAIRLAUNCH: "0x7942874a9ef8059c5de259625a883dc61f03320d",
|
|
938
|
+
AURILENS: '0xa2635a23a7688cd3acdd07713c4943b2f0f9082c'
|
|
939
|
+
},
|
|
940
|
+
tokens: {
|
|
941
|
+
AURORA: "0x7a80df8230c5aa711e2702a275ab31aeb32754bf",
|
|
942
|
+
PLY: "0x6f8a1daa158e08f75711a64e5a3073e959d688a6",
|
|
943
|
+
AURPLY: dummyAddress
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
var BORROW_LIMIT_BUFFER = /*#__PURE__*/new BigNumber(0.95);
|
|
947
|
+
var REWARDCLAIMSTART = 1673280000;
|
|
948
|
+
var ONE_DAY = 86400;
|
|
949
|
+
var ONE_YEAR = ONE_DAY * 365;
|
|
950
|
+
var AurPlyPid = 1;
|
|
951
|
+
|
|
952
|
+
var decimalRecords = {
|
|
953
|
+
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 18,
|
|
954
|
+
'0x9738319d4b8a95a9b3cfd99419dbf859904f23d8': 18,
|
|
955
|
+
'0x1dc7d4990b1edb9a88f3fa7d899864b69ee2c428': 18,
|
|
956
|
+
'0x1c67cb984abdf7f0a6bce2fd5d5e662e0b983369': 18,
|
|
957
|
+
'0x675c7e1d48f88329c6b4cd3867db5f10a69cda18': 18,
|
|
958
|
+
'0xaa68274f87fd9ae940f1dec31b643486838481c1': 8,
|
|
959
|
+
'0x96AAD2c3fde982627d531f45D1Bebd8bE3b86f60': 8,
|
|
960
|
+
'0x6970167dfaa2aaa67404204102cbbd18b405eca9': 8,
|
|
961
|
+
'0x6f8a1daa158e08f75711a64e5a3073e959d688a6': 18,
|
|
962
|
+
'0xccf005cfc3669d806a03f0617885648c397c456e': 8,
|
|
963
|
+
'0x959bf9bf41062e9cac0e60cacbaa441fbc8946c6': 18,
|
|
964
|
+
'0x7a80df8230c5aa711e2702a275ab31aeb32754bf': 18,
|
|
965
|
+
'0x9630a6c5b729194972199805075fd76707a9713a': 8,
|
|
966
|
+
'0x77b088236c071ab5bd4e0bd21240b093275adffc': 8,
|
|
967
|
+
'0x7967532568bef9ec96cfad6badea4c63add5888a': 8,
|
|
968
|
+
'0x55a4c111c007f39326edf22cfd63bbbb21a35b35': 8
|
|
969
|
+
};
|
|
909
970
|
|
|
910
|
-
|
|
971
|
+
function formatObject(object) {
|
|
972
|
+
return JSON.stringify(object, null, ' ');
|
|
973
|
+
}
|
|
974
|
+
function decimalFactor(decimal) {
|
|
975
|
+
return ethers$1.BigNumber.from(10).pow(decimal).toString();
|
|
976
|
+
}
|
|
977
|
+
var isSameAddress = function isSameAddress(address1, address2) {
|
|
978
|
+
return address1.toLowerCase() == address2.toLowerCase();
|
|
979
|
+
};
|
|
980
|
+
var getCurrentTimestamp = /*#__PURE__*/function () {
|
|
981
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(provider) {
|
|
982
|
+
var latestBlockNumber, currentTime;
|
|
983
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
984
|
+
while (1) {
|
|
985
|
+
switch (_context.prev = _context.next) {
|
|
986
|
+
case 0:
|
|
987
|
+
_context.next = 2;
|
|
988
|
+
return provider.getBlockNumber();
|
|
989
|
+
|
|
990
|
+
case 2:
|
|
991
|
+
latestBlockNumber = _context.sent;
|
|
992
|
+
_context.next = 5;
|
|
993
|
+
return provider.getBlock(latestBlockNumber);
|
|
994
|
+
|
|
995
|
+
case 5:
|
|
996
|
+
currentTime = _context.sent.timestamp;
|
|
997
|
+
return _context.abrupt("return", currentTime);
|
|
998
|
+
|
|
999
|
+
case 7:
|
|
1000
|
+
case "end":
|
|
1001
|
+
return _context.stop();
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
}, _callee);
|
|
1005
|
+
}));
|
|
911
1006
|
|
|
912
|
-
|
|
913
|
-
|
|
1007
|
+
return function getCurrentTimestamp(_x) {
|
|
1008
|
+
return _ref.apply(this, arguments);
|
|
1009
|
+
};
|
|
1010
|
+
}();
|
|
1011
|
+
function validateAndParseAddress(address) {
|
|
1012
|
+
try {
|
|
1013
|
+
return ethers$1.utils.getAddress(address);
|
|
1014
|
+
} catch (error) {
|
|
1015
|
+
throw new Error("Invalid address: " + address);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
function getDecimal(address) {
|
|
1019
|
+
return decimalRecords[address.toLowerCase()];
|
|
1020
|
+
}
|
|
1021
|
+
function calcLMRewardApr(rewardsValue, totalStakeValue, frequencyPerYear) {
|
|
1022
|
+
if (totalStakeValue.lte(0)) {
|
|
1023
|
+
return new BigNumber('999999999');
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
return rewardsValue.multipliedBy(frequencyPerYear).dividedBy(totalStakeValue);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
(function (ComptrollerRewardType) {
|
|
1030
|
+
ComptrollerRewardType[ComptrollerRewardType["PLY"] = 0] = "PLY";
|
|
1031
|
+
ComptrollerRewardType[ComptrollerRewardType["AURORA"] = 1] = "AURORA";
|
|
1032
|
+
})(exports.ComptrollerRewardType || (exports.ComptrollerRewardType = {}));
|
|
914
1033
|
|
|
915
|
-
|
|
916
|
-
|
|
1034
|
+
var Token = function Token(address, decimals) {
|
|
1035
|
+
this.address = address.toLowerCase();
|
|
1036
|
+
this.decimals = decimals;
|
|
1037
|
+
};
|
|
1038
|
+
var PLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.PLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.PLY));
|
|
1039
|
+
var AURPLYToken = /*#__PURE__*/new Token(networkAddresses.tokens.AURPLY, /*#__PURE__*/getDecimal(networkAddresses.tokens.AURPLY));
|
|
1040
|
+
|
|
1041
|
+
var TokenAmount = /*#__PURE__*/function () {
|
|
1042
|
+
function TokenAmount(token, amount, isRaw) {
|
|
1043
|
+
if (isRaw === void 0) {
|
|
1044
|
+
isRaw = true;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
if (isRaw) {
|
|
1048
|
+
this.rawAmnt = amount;
|
|
1049
|
+
} else {
|
|
1050
|
+
this.rawAmnt = new BigNumber(amount).times(decimalFactor(token.decimals)).toFixed(0);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
this.token = token;
|
|
917
1054
|
}
|
|
918
1055
|
|
|
919
|
-
var _proto =
|
|
1056
|
+
var _proto = TokenAmount.prototype;
|
|
920
1057
|
|
|
921
|
-
_proto.
|
|
922
|
-
|
|
1058
|
+
_proto.formattedAmount = function formattedAmount() {
|
|
1059
|
+
return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
_proto.rawAmount = function rawAmount() {
|
|
1063
|
+
return this.rawAmnt;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
return TokenAmount;
|
|
1067
|
+
}();
|
|
1068
|
+
|
|
1069
|
+
var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
1070
|
+
_inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
|
|
1071
|
+
|
|
1072
|
+
function MoneyMarketRead(networkConnection, auToken, underlyingAsset) {
|
|
1073
|
+
var _this;
|
|
1074
|
+
|
|
1075
|
+
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
1076
|
+
|
|
1077
|
+
if (isSameAddress(underlyingAsset, ETHAddress)) {
|
|
1078
|
+
_this.auToken = new ethers$1.Contract(auToken, AuETHABI.abi, networkConnection.provider);
|
|
1079
|
+
} else {
|
|
1080
|
+
_this.auToken = new ethers$1.Contract(auToken, AuErc20ABI.abi, networkConnection.provider);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
_this.underlying = new Token(underlyingAsset, getDecimal(underlyingAsset));
|
|
1084
|
+
_this._comptroller = new ethers$1.Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
|
|
1085
|
+
return _this;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
var _proto = MoneyMarketRead.prototype;
|
|
1089
|
+
|
|
1090
|
+
_proto.getTotalTokenBorrowed = /*#__PURE__*/function () {
|
|
1091
|
+
var _getTotalTokenBorrowed = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
923
1092
|
return runtime_1.wrap(function _callee$(_context) {
|
|
924
1093
|
while (1) {
|
|
925
1094
|
switch (_context.prev = _context.next) {
|
|
926
1095
|
case 0:
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
});
|
|
1096
|
+
_context.t0 = TokenAmount;
|
|
1097
|
+
_context.t1 = this.underlying;
|
|
1098
|
+
_context.next = 4;
|
|
1099
|
+
return this.auToken.totalBorrows();
|
|
932
1100
|
|
|
933
|
-
case
|
|
1101
|
+
case 4:
|
|
1102
|
+
_context.t2 = _context.sent.toString();
|
|
1103
|
+
return _context.abrupt("return", new _context.t0(_context.t1, _context.t2));
|
|
1104
|
+
|
|
1105
|
+
case 6:
|
|
934
1106
|
case "end":
|
|
935
1107
|
return _context.stop();
|
|
936
1108
|
}
|
|
937
1109
|
}
|
|
938
|
-
}, _callee);
|
|
1110
|
+
}, _callee, this);
|
|
939
1111
|
}));
|
|
940
1112
|
|
|
941
|
-
function
|
|
942
|
-
return
|
|
1113
|
+
function getTotalTokenBorrowed() {
|
|
1114
|
+
return _getTotalTokenBorrowed.apply(this, arguments);
|
|
943
1115
|
}
|
|
944
1116
|
|
|
945
|
-
return
|
|
1117
|
+
return getTotalTokenBorrowed;
|
|
946
1118
|
}();
|
|
947
1119
|
|
|
948
|
-
_proto.
|
|
949
|
-
var
|
|
1120
|
+
_proto.getTotalTokenDeposited = /*#__PURE__*/function () {
|
|
1121
|
+
var _getTotalTokenDeposited = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1122
|
+
var _this2 = this;
|
|
1123
|
+
|
|
1124
|
+
var promises, totalBorrow, totalCash;
|
|
950
1125
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
951
1126
|
while (1) {
|
|
952
1127
|
switch (_context2.prev = _context2.next) {
|
|
953
1128
|
case 0:
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
currency: dummyPly,
|
|
964
|
-
amount: '200.12',
|
|
965
|
-
isRaw: false
|
|
966
|
-
}),
|
|
967
|
-
borrowableAmount: dummyTokenAmount2
|
|
968
|
-
});
|
|
1129
|
+
promises = [];
|
|
1130
|
+
promises.push(this.getTotalTokenBorrowed().then(function (res) {
|
|
1131
|
+
totalBorrow = res;
|
|
1132
|
+
}));
|
|
1133
|
+
promises.push(this.auToken.getCash().then(function (res) {
|
|
1134
|
+
totalCash = new TokenAmount(_this2.underlying, res.toString());
|
|
1135
|
+
}));
|
|
1136
|
+
_context2.next = 5;
|
|
1137
|
+
return Promise.all(promises);
|
|
969
1138
|
|
|
970
|
-
case
|
|
1139
|
+
case 5:
|
|
1140
|
+
return _context2.abrupt("return", new TokenAmount(this.underlying, ethers$1.BigNumber.from(totalCash.rawAmount).add(totalBorrow.rawAmount()).toString()));
|
|
1141
|
+
|
|
1142
|
+
case 6:
|
|
971
1143
|
case "end":
|
|
972
1144
|
return _context2.stop();
|
|
973
1145
|
}
|
|
974
1146
|
}
|
|
975
|
-
}, _callee2);
|
|
1147
|
+
}, _callee2, this);
|
|
976
1148
|
}));
|
|
977
1149
|
|
|
978
|
-
function
|
|
979
|
-
return
|
|
1150
|
+
function getTotalTokenDeposited() {
|
|
1151
|
+
return _getTotalTokenDeposited.apply(this, arguments);
|
|
980
1152
|
}
|
|
981
1153
|
|
|
982
|
-
return
|
|
1154
|
+
return getTotalTokenDeposited;
|
|
983
1155
|
}();
|
|
984
1156
|
|
|
985
|
-
_proto.
|
|
986
|
-
var
|
|
1157
|
+
_proto.getDepositAPY = /*#__PURE__*/function () {
|
|
1158
|
+
var _getDepositAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1159
|
+
var supplyRatePerTimestamp;
|
|
987
1160
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
988
1161
|
while (1) {
|
|
989
1162
|
switch (_context3.prev = _context3.next) {
|
|
990
1163
|
case 0:
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
currency: dummyPlyAurora,
|
|
994
|
-
amount: '12.1',
|
|
995
|
-
isRaw: false
|
|
996
|
-
}),
|
|
997
|
-
apy: 1.21
|
|
998
|
-
});
|
|
1164
|
+
_context3.next = 2;
|
|
1165
|
+
return this.auToken.supplyRatePerTimestamp();
|
|
999
1166
|
|
|
1000
|
-
case
|
|
1167
|
+
case 2:
|
|
1168
|
+
supplyRatePerTimestamp = _context3.sent;
|
|
1169
|
+
return _context3.abrupt("return", new BigNumber(supplyRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
|
|
1170
|
+
|
|
1171
|
+
case 4:
|
|
1001
1172
|
case "end":
|
|
1002
1173
|
return _context3.stop();
|
|
1003
1174
|
}
|
|
1004
1175
|
}
|
|
1005
|
-
}, _callee3);
|
|
1176
|
+
}, _callee3, this);
|
|
1006
1177
|
}));
|
|
1007
1178
|
|
|
1008
|
-
function
|
|
1009
|
-
return
|
|
1179
|
+
function getDepositAPY() {
|
|
1180
|
+
return _getDepositAPY.apply(this, arguments);
|
|
1010
1181
|
}
|
|
1011
1182
|
|
|
1012
|
-
return
|
|
1183
|
+
return getDepositAPY;
|
|
1013
1184
|
}();
|
|
1014
1185
|
|
|
1015
|
-
_proto.
|
|
1016
|
-
var
|
|
1186
|
+
_proto.getBorrowAPY = /*#__PURE__*/function () {
|
|
1187
|
+
var _getBorrowAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
1188
|
+
var borrowRatePerTimestamp;
|
|
1017
1189
|
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1018
1190
|
while (1) {
|
|
1019
1191
|
switch (_context4.prev = _context4.next) {
|
|
1020
1192
|
case 0:
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
break;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
return _context4.abrupt("return", new sdkCore.CurrencyAmount({
|
|
1027
|
-
currency: DOLLAR,
|
|
1028
|
-
amount: '1',
|
|
1029
|
-
isRaw: false
|
|
1030
|
-
}));
|
|
1193
|
+
_context4.next = 2;
|
|
1194
|
+
return this.auToken.borrowRatePerTimestamp();
|
|
1031
1195
|
|
|
1032
1196
|
case 2:
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
amount: '12.1',
|
|
1036
|
-
isRaw: false
|
|
1037
|
-
}));
|
|
1197
|
+
borrowRatePerTimestamp = _context4.sent;
|
|
1198
|
+
return _context4.abrupt("return", new BigNumber(borrowRatePerTimestamp.toString()).multipliedBy(60 * 60 * 24 * 365).div(decimalFactor(18)));
|
|
1038
1199
|
|
|
1039
|
-
case
|
|
1200
|
+
case 4:
|
|
1040
1201
|
case "end":
|
|
1041
1202
|
return _context4.stop();
|
|
1042
1203
|
}
|
|
1043
1204
|
}
|
|
1044
|
-
}, _callee4);
|
|
1205
|
+
}, _callee4, this);
|
|
1045
1206
|
}));
|
|
1046
1207
|
|
|
1047
|
-
function
|
|
1048
|
-
return
|
|
1208
|
+
function getBorrowAPY() {
|
|
1209
|
+
return _getBorrowAPY.apply(this, arguments);
|
|
1049
1210
|
}
|
|
1050
1211
|
|
|
1051
|
-
return
|
|
1212
|
+
return getBorrowAPY;
|
|
1052
1213
|
}();
|
|
1053
1214
|
|
|
1054
|
-
_proto.
|
|
1055
|
-
var
|
|
1215
|
+
_proto.getCollateralRatio = /*#__PURE__*/function () {
|
|
1216
|
+
var _getCollateralRatio = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
1056
1217
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1057
1218
|
while (1) {
|
|
1058
1219
|
switch (_context5.prev = _context5.next) {
|
|
1059
1220
|
case 0:
|
|
1060
|
-
return _context5.abrupt("return",
|
|
1061
|
-
|
|
1062
|
-
amount: '103.4',
|
|
1063
|
-
isRaw: false
|
|
1221
|
+
return _context5.abrupt("return", this._comptroller.markets(this.auToken.address).then(function (res) {
|
|
1222
|
+
return new BigNumber(res.collateralFactorMantissa.toString()).div(decimalFactor(18));
|
|
1064
1223
|
}));
|
|
1065
1224
|
|
|
1066
1225
|
case 1:
|
|
@@ -1068,53 +1227,84 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
1068
1227
|
return _context5.stop();
|
|
1069
1228
|
}
|
|
1070
1229
|
}
|
|
1071
|
-
}, _callee5);
|
|
1230
|
+
}, _callee5, this);
|
|
1072
1231
|
}));
|
|
1073
1232
|
|
|
1074
|
-
function
|
|
1075
|
-
return
|
|
1233
|
+
function getCollateralRatio() {
|
|
1234
|
+
return _getCollateralRatio.apply(this, arguments);
|
|
1076
1235
|
}
|
|
1077
1236
|
|
|
1078
|
-
return
|
|
1237
|
+
return getCollateralRatio;
|
|
1079
1238
|
}();
|
|
1080
1239
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
var
|
|
1084
|
-
_inheritsLoose(SdkReadWrite, _SdkRead);
|
|
1085
|
-
|
|
1086
|
-
function SdkReadWrite() {
|
|
1087
|
-
var _this;
|
|
1088
|
-
|
|
1089
|
-
_this = _SdkRead.apply(this, arguments) || this;
|
|
1090
|
-
_this.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
1240
|
+
_proto.getBorrowPlyAPY = /*#__PURE__*/function () {
|
|
1241
|
+
var _getBorrowPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
1242
|
+
var promises, totalBorrowed, rewardSpeed, plyPrice, underlyingPrice;
|
|
1091
1243
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1092
1244
|
while (1) {
|
|
1093
1245
|
switch (_context6.prev = _context6.next) {
|
|
1094
1246
|
case 0:
|
|
1095
|
-
|
|
1247
|
+
promises = [];
|
|
1248
|
+
promises.push(this.getTotalTokenBorrowed().then(function (res) {
|
|
1249
|
+
totalBorrowed = res;
|
|
1250
|
+
}));
|
|
1251
|
+
promises.push(this._comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1252
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1253
|
+
}));
|
|
1254
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1255
|
+
plyPrice = res;
|
|
1256
|
+
}));
|
|
1257
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1258
|
+
underlyingPrice = res;
|
|
1259
|
+
}));
|
|
1260
|
+
_context6.next = 7;
|
|
1261
|
+
return Promise.all(promises);
|
|
1096
1262
|
|
|
1097
|
-
case
|
|
1263
|
+
case 7:
|
|
1264
|
+
return _context6.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR));
|
|
1265
|
+
|
|
1266
|
+
case 8:
|
|
1098
1267
|
case "end":
|
|
1099
1268
|
return _context6.stop();
|
|
1100
1269
|
}
|
|
1101
1270
|
}
|
|
1102
|
-
}, _callee6);
|
|
1271
|
+
}, _callee6, this);
|
|
1103
1272
|
}));
|
|
1104
|
-
return _this;
|
|
1105
|
-
}
|
|
1106
1273
|
|
|
1107
|
-
|
|
1274
|
+
function getBorrowPlyAPY() {
|
|
1275
|
+
return _getBorrowPlyAPY.apply(this, arguments);
|
|
1276
|
+
}
|
|
1108
1277
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1278
|
+
return getBorrowPlyAPY;
|
|
1279
|
+
}();
|
|
1280
|
+
|
|
1281
|
+
_proto.getDepositPlyAPY = /*#__PURE__*/function () {
|
|
1282
|
+
var _getDepositPlyAPY = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7() {
|
|
1283
|
+
var promises, totalDeposited, rewardSpeed, plyPrice, underlyingPrice;
|
|
1111
1284
|
return runtime_1.wrap(function _callee7$(_context7) {
|
|
1112
1285
|
while (1) {
|
|
1113
1286
|
switch (_context7.prev = _context7.next) {
|
|
1114
1287
|
case 0:
|
|
1115
|
-
|
|
1288
|
+
promises = [];
|
|
1289
|
+
promises.push(this.getTotalTokenDeposited().then(function (res) {
|
|
1290
|
+
totalDeposited = res;
|
|
1291
|
+
}));
|
|
1292
|
+
promises.push(this._comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1293
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1294
|
+
}));
|
|
1295
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1296
|
+
plyPrice = res;
|
|
1297
|
+
}));
|
|
1298
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1299
|
+
underlyingPrice = res;
|
|
1300
|
+
}));
|
|
1301
|
+
_context7.next = 7;
|
|
1302
|
+
return Promise.all(promises);
|
|
1116
1303
|
|
|
1117
|
-
case
|
|
1304
|
+
case 7:
|
|
1305
|
+
return _context7.abrupt("return", calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR));
|
|
1306
|
+
|
|
1307
|
+
case 8:
|
|
1118
1308
|
case "end":
|
|
1119
1309
|
return _context7.stop();
|
|
1120
1310
|
}
|
|
@@ -1122,22 +1312,63 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
1122
1312
|
}, _callee7, this);
|
|
1123
1313
|
}));
|
|
1124
1314
|
|
|
1125
|
-
function
|
|
1126
|
-
return
|
|
1315
|
+
function getDepositPlyAPY() {
|
|
1316
|
+
return _getDepositPlyAPY.apply(this, arguments);
|
|
1127
1317
|
}
|
|
1128
1318
|
|
|
1129
|
-
return
|
|
1319
|
+
return getDepositPlyAPY;
|
|
1130
1320
|
}();
|
|
1131
1321
|
|
|
1132
|
-
|
|
1133
|
-
var
|
|
1322
|
+
_proto.getDetails = /*#__PURE__*/function () {
|
|
1323
|
+
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8() {
|
|
1324
|
+
var promises, totalDeposited, totalBorrowed, depositAPY, borrowAPY, collateralRatio, rewardSpeed, plyPrice, underlyingPrice, borrowPlyApy, depositPlyApy;
|
|
1134
1325
|
return runtime_1.wrap(function _callee8$(_context8) {
|
|
1135
1326
|
while (1) {
|
|
1136
1327
|
switch (_context8.prev = _context8.next) {
|
|
1137
1328
|
case 0:
|
|
1138
|
-
|
|
1329
|
+
promises = [];
|
|
1330
|
+
promises.push(this.getTotalTokenDeposited().then(function (res) {
|
|
1331
|
+
totalDeposited = res;
|
|
1332
|
+
}));
|
|
1333
|
+
promises.push(this.getTotalTokenBorrowed().then(function (res) {
|
|
1334
|
+
totalBorrowed = res;
|
|
1335
|
+
}));
|
|
1336
|
+
promises.push(this.getDepositAPY().then(function (res) {
|
|
1337
|
+
depositAPY = res.toNumber();
|
|
1338
|
+
}));
|
|
1339
|
+
promises.push(this.getBorrowAPY().then(function (res) {
|
|
1340
|
+
borrowAPY = res.toNumber();
|
|
1341
|
+
}));
|
|
1342
|
+
promises.push(this.getCollateralRatio().then(function (res) {
|
|
1343
|
+
collateralRatio = res.toNumber();
|
|
1344
|
+
}));
|
|
1345
|
+
promises.push(this._comptroller.rewardSpeeds(exports.ComptrollerRewardType.PLY, this.auToken.address).then(function (res) {
|
|
1346
|
+
rewardSpeed = new TokenAmount(PLYToken, res.toString());
|
|
1347
|
+
}));
|
|
1348
|
+
promises.push(fetchPrice(networkAddresses.tokens.PLY, this._networkConnection.provider).then(function (res) {
|
|
1349
|
+
plyPrice = res;
|
|
1350
|
+
}));
|
|
1351
|
+
promises.push(fetchPrice(this.underlying.address, this._networkConnection.provider).then(function (res) {
|
|
1352
|
+
underlyingPrice = res;
|
|
1353
|
+
}));
|
|
1354
|
+
_context8.next = 11;
|
|
1355
|
+
return Promise.all(promises);
|
|
1356
|
+
|
|
1357
|
+
case 11:
|
|
1358
|
+
borrowPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalBorrowed.formattedAmount()), ONE_YEAR);
|
|
1359
|
+
depositPlyApy = calcLMRewardApr(plyPrice.multipliedBy(rewardSpeed.formattedAmount()), underlyingPrice.multipliedBy(totalDeposited.formattedAmount()), ONE_YEAR);
|
|
1360
|
+
return _context8.abrupt("return", {
|
|
1361
|
+
auTokenAddress: this.auToken.address,
|
|
1362
|
+
totalTokenDeposited: totalDeposited,
|
|
1363
|
+
totalTokenBorrowed: totalBorrowed,
|
|
1364
|
+
depositApy: depositAPY,
|
|
1365
|
+
depositPlyApy: depositPlyApy.toNumber(),
|
|
1366
|
+
borrowApy: borrowAPY,
|
|
1367
|
+
borrowPlyApy: borrowPlyApy.toNumber(),
|
|
1368
|
+
collateralRatio: collateralRatio
|
|
1369
|
+
});
|
|
1139
1370
|
|
|
1140
|
-
case
|
|
1371
|
+
case 14:
|
|
1141
1372
|
case "end":
|
|
1142
1373
|
return _context8.stop();
|
|
1143
1374
|
}
|
|
@@ -1145,22 +1376,28 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
1145
1376
|
}, _callee8, this);
|
|
1146
1377
|
}));
|
|
1147
1378
|
|
|
1148
|
-
function
|
|
1149
|
-
return
|
|
1379
|
+
function getDetails() {
|
|
1380
|
+
return _getDetails.apply(this, arguments);
|
|
1150
1381
|
}
|
|
1151
1382
|
|
|
1152
|
-
return
|
|
1383
|
+
return getDetails;
|
|
1153
1384
|
}();
|
|
1154
1385
|
|
|
1155
|
-
|
|
1156
|
-
var
|
|
1386
|
+
_proto.getUserBorrowBalance = /*#__PURE__*/function () {
|
|
1387
|
+
var _getUserBorrowBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(userAddress) {
|
|
1388
|
+
var totalBorrow;
|
|
1157
1389
|
return runtime_1.wrap(function _callee9$(_context9) {
|
|
1158
1390
|
while (1) {
|
|
1159
1391
|
switch (_context9.prev = _context9.next) {
|
|
1160
1392
|
case 0:
|
|
1161
|
-
|
|
1393
|
+
_context9.next = 2;
|
|
1394
|
+
return this.auToken.callStatic.borrowBalanceCurrent(userAddress);
|
|
1162
1395
|
|
|
1163
|
-
case
|
|
1396
|
+
case 2:
|
|
1397
|
+
totalBorrow = _context9.sent;
|
|
1398
|
+
return _context9.abrupt("return", new TokenAmount(this.underlying, totalBorrow.toString()));
|
|
1399
|
+
|
|
1400
|
+
case 4:
|
|
1164
1401
|
case "end":
|
|
1165
1402
|
return _context9.stop();
|
|
1166
1403
|
}
|
|
@@ -1168,78 +1405,40 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
|
1168
1405
|
}, _callee9, this);
|
|
1169
1406
|
}));
|
|
1170
1407
|
|
|
1171
|
-
function
|
|
1172
|
-
return
|
|
1408
|
+
function getUserBorrowBalance(_x) {
|
|
1409
|
+
return _getUserBorrowBalance.apply(this, arguments);
|
|
1173
1410
|
}
|
|
1174
1411
|
|
|
1175
|
-
return
|
|
1412
|
+
return getUserBorrowBalance;
|
|
1176
1413
|
}();
|
|
1177
1414
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
var
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
function SDK() {
|
|
1184
|
-
return _BlockchainEntity.call(this) || this;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
var _proto3 = SDK.prototype;
|
|
1188
|
-
|
|
1189
|
-
_proto3.read = function read(provider) {
|
|
1190
|
-
return new SdkRead(provider);
|
|
1191
|
-
};
|
|
1192
|
-
|
|
1193
|
-
SDK.defaultProvider = function defaultProvider() {
|
|
1194
|
-
return new ethers$1.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
return SDK;
|
|
1198
|
-
}(BlockchainEntity);
|
|
1199
|
-
|
|
1200
|
-
var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
1201
|
-
_inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
|
|
1202
|
-
|
|
1203
|
-
function MoneyMarketRead(providerOrSigner, auToken) {
|
|
1204
|
-
var _this;
|
|
1205
|
-
|
|
1206
|
-
_this = _BlockchainEntityRead.call(this, providerOrSigner) || this;
|
|
1207
|
-
_this._auToken = new ethers$2.Contract(auToken, AuToken.abi, providerOrSigner);
|
|
1208
|
-
return _this;
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
var _proto = MoneyMarketRead.prototype;
|
|
1212
|
-
|
|
1213
|
-
_proto.getDetails = /*#__PURE__*/function () {
|
|
1214
|
-
var _getDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1215
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1415
|
+
_proto.getUserDepositBalance = /*#__PURE__*/function () {
|
|
1416
|
+
var _getUserDepositBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(userAddress) {
|
|
1417
|
+
var totalDeposit;
|
|
1418
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
1216
1419
|
while (1) {
|
|
1217
|
-
switch (
|
|
1420
|
+
switch (_context10.prev = _context10.next) {
|
|
1218
1421
|
case 0:
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
totalTokenDeposited: dummyTokenAmount,
|
|
1222
|
-
totalTokenBorrowed: dummyTokenAmount2,
|
|
1223
|
-
depositApy: 0.1234,
|
|
1224
|
-
depositPlyApy: 0.2345,
|
|
1225
|
-
borrowApy: 0.24,
|
|
1226
|
-
borrowPlyApy: 0.18,
|
|
1227
|
-
collateralRatio: 0.7
|
|
1228
|
-
});
|
|
1422
|
+
_context10.next = 2;
|
|
1423
|
+
return this.auToken.callStatic.balanceOfUnderlying(userAddress);
|
|
1229
1424
|
|
|
1230
|
-
case
|
|
1425
|
+
case 2:
|
|
1426
|
+
totalDeposit = _context10.sent;
|
|
1427
|
+
return _context10.abrupt("return", new TokenAmount(this.underlying, totalDeposit.toString()));
|
|
1428
|
+
|
|
1429
|
+
case 4:
|
|
1231
1430
|
case "end":
|
|
1232
|
-
return
|
|
1431
|
+
return _context10.stop();
|
|
1233
1432
|
}
|
|
1234
1433
|
}
|
|
1235
|
-
},
|
|
1434
|
+
}, _callee10, this);
|
|
1236
1435
|
}));
|
|
1237
1436
|
|
|
1238
|
-
function
|
|
1239
|
-
return
|
|
1437
|
+
function getUserDepositBalance(_x2) {
|
|
1438
|
+
return _getUserDepositBalance.apply(this, arguments);
|
|
1240
1439
|
}
|
|
1241
1440
|
|
|
1242
|
-
return
|
|
1441
|
+
return getUserDepositBalance;
|
|
1243
1442
|
}();
|
|
1244
1443
|
|
|
1245
1444
|
return MoneyMarketRead;
|
|
@@ -1248,45 +1447,38 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1248
1447
|
_inheritsLoose(MoneyMarketReadWrite, _MoneyMarketRead);
|
|
1249
1448
|
|
|
1250
1449
|
function MoneyMarketReadWrite() {
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
_this2 = _MoneyMarketRead.apply(this, arguments) || this;
|
|
1254
|
-
_this2.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1255
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1256
|
-
while (1) {
|
|
1257
|
-
switch (_context2.prev = _context2.next) {
|
|
1258
|
-
case 0:
|
|
1259
|
-
return _context2.abrupt("return", {});
|
|
1260
|
-
|
|
1261
|
-
case 1:
|
|
1262
|
-
case "end":
|
|
1263
|
-
return _context2.stop();
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
}, _callee2);
|
|
1267
|
-
}));
|
|
1268
|
-
return _this2;
|
|
1450
|
+
return _MoneyMarketRead.apply(this, arguments) || this;
|
|
1269
1451
|
}
|
|
1270
1452
|
|
|
1271
1453
|
var _proto2 = MoneyMarketReadWrite.prototype;
|
|
1272
1454
|
|
|
1273
1455
|
_proto2.deposit = /*#__PURE__*/function () {
|
|
1274
|
-
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1275
|
-
return runtime_1.wrap(function
|
|
1456
|
+
var _deposit = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(amount) {
|
|
1457
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
1276
1458
|
while (1) {
|
|
1277
|
-
switch (
|
|
1459
|
+
switch (_context11.prev = _context11.next) {
|
|
1278
1460
|
case 0:
|
|
1279
|
-
|
|
1461
|
+
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
1462
|
+
_context11.next = 4;
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1280
1465
|
|
|
1281
|
-
|
|
1466
|
+
return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint({
|
|
1467
|
+
value: amount.rawAmount()
|
|
1468
|
+
}));
|
|
1469
|
+
|
|
1470
|
+
case 4:
|
|
1471
|
+
return _context11.abrupt("return", this.auToken.connect(this._networkConnection.signer).mint(amount.rawAmount()));
|
|
1472
|
+
|
|
1473
|
+
case 5:
|
|
1282
1474
|
case "end":
|
|
1283
|
-
return
|
|
1475
|
+
return _context11.stop();
|
|
1284
1476
|
}
|
|
1285
1477
|
}
|
|
1286
|
-
},
|
|
1478
|
+
}, _callee11, this);
|
|
1287
1479
|
}));
|
|
1288
1480
|
|
|
1289
|
-
function deposit(
|
|
1481
|
+
function deposit(_x3) {
|
|
1290
1482
|
return _deposit.apply(this, arguments);
|
|
1291
1483
|
}
|
|
1292
1484
|
|
|
@@ -1294,22 +1486,22 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1294
1486
|
}();
|
|
1295
1487
|
|
|
1296
1488
|
_proto2.borrow = /*#__PURE__*/function () {
|
|
1297
|
-
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1298
|
-
return runtime_1.wrap(function
|
|
1489
|
+
var _borrow = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(amount) {
|
|
1490
|
+
return runtime_1.wrap(function _callee12$(_context12) {
|
|
1299
1491
|
while (1) {
|
|
1300
|
-
switch (
|
|
1492
|
+
switch (_context12.prev = _context12.next) {
|
|
1301
1493
|
case 0:
|
|
1302
|
-
return
|
|
1494
|
+
return _context12.abrupt("return", this.auToken.connect(this._networkConnection.signer).borrow(amount.rawAmount()));
|
|
1303
1495
|
|
|
1304
1496
|
case 1:
|
|
1305
1497
|
case "end":
|
|
1306
|
-
return
|
|
1498
|
+
return _context12.stop();
|
|
1307
1499
|
}
|
|
1308
1500
|
}
|
|
1309
|
-
},
|
|
1501
|
+
}, _callee12, this);
|
|
1310
1502
|
}));
|
|
1311
1503
|
|
|
1312
|
-
function borrow(
|
|
1504
|
+
function borrow(_x4) {
|
|
1313
1505
|
return _borrow.apply(this, arguments);
|
|
1314
1506
|
}
|
|
1315
1507
|
|
|
@@ -1317,22 +1509,22 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1317
1509
|
}();
|
|
1318
1510
|
|
|
1319
1511
|
_proto2.withdraw = /*#__PURE__*/function () {
|
|
1320
|
-
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1321
|
-
return runtime_1.wrap(function
|
|
1512
|
+
var _withdraw = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(amount) {
|
|
1513
|
+
return runtime_1.wrap(function _callee13$(_context13) {
|
|
1322
1514
|
while (1) {
|
|
1323
|
-
switch (
|
|
1515
|
+
switch (_context13.prev = _context13.next) {
|
|
1324
1516
|
case 0:
|
|
1325
|
-
return
|
|
1517
|
+
return _context13.abrupt("return", this.auToken.connect(this._networkConnection.signer).redeemUnderlying(amount.rawAmount()));
|
|
1326
1518
|
|
|
1327
1519
|
case 1:
|
|
1328
1520
|
case "end":
|
|
1329
|
-
return
|
|
1521
|
+
return _context13.stop();
|
|
1330
1522
|
}
|
|
1331
1523
|
}
|
|
1332
|
-
},
|
|
1524
|
+
}, _callee13, this);
|
|
1333
1525
|
}));
|
|
1334
1526
|
|
|
1335
|
-
function withdraw(
|
|
1527
|
+
function withdraw(_x5) {
|
|
1336
1528
|
return _withdraw.apply(this, arguments);
|
|
1337
1529
|
}
|
|
1338
1530
|
|
|
@@ -1340,22 +1532,32 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1340
1532
|
}();
|
|
1341
1533
|
|
|
1342
1534
|
_proto2.repay = /*#__PURE__*/function () {
|
|
1343
|
-
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1344
|
-
return runtime_1.wrap(function
|
|
1535
|
+
var _repay = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee14(amount) {
|
|
1536
|
+
return runtime_1.wrap(function _callee14$(_context14) {
|
|
1345
1537
|
while (1) {
|
|
1346
|
-
switch (
|
|
1538
|
+
switch (_context14.prev = _context14.next) {
|
|
1347
1539
|
case 0:
|
|
1348
|
-
|
|
1540
|
+
if (!isSameAddress(amount.token.address, ETHAddress)) {
|
|
1541
|
+
_context14.next = 4;
|
|
1542
|
+
break;
|
|
1543
|
+
}
|
|
1349
1544
|
|
|
1350
|
-
|
|
1545
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow({
|
|
1546
|
+
value: amount.rawAmount()
|
|
1547
|
+
}));
|
|
1548
|
+
|
|
1549
|
+
case 4:
|
|
1550
|
+
return _context14.abrupt("return", this.auToken.connect(this._networkConnection.signer).repayBorrow(amount.rawAmount()));
|
|
1551
|
+
|
|
1552
|
+
case 5:
|
|
1351
1553
|
case "end":
|
|
1352
|
-
return
|
|
1554
|
+
return _context14.stop();
|
|
1353
1555
|
}
|
|
1354
1556
|
}
|
|
1355
|
-
},
|
|
1557
|
+
}, _callee14, this);
|
|
1356
1558
|
}));
|
|
1357
1559
|
|
|
1358
|
-
function repay(
|
|
1560
|
+
function repay(_x6) {
|
|
1359
1561
|
return _repay.apply(this, arguments);
|
|
1360
1562
|
}
|
|
1361
1563
|
|
|
@@ -1363,19 +1565,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1363
1565
|
}();
|
|
1364
1566
|
|
|
1365
1567
|
_proto2.enableCollateral = /*#__PURE__*/function () {
|
|
1366
|
-
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1367
|
-
return runtime_1.wrap(function
|
|
1568
|
+
var _enableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee15() {
|
|
1569
|
+
return runtime_1.wrap(function _callee15$(_context15) {
|
|
1368
1570
|
while (1) {
|
|
1369
|
-
switch (
|
|
1571
|
+
switch (_context15.prev = _context15.next) {
|
|
1370
1572
|
case 0:
|
|
1371
|
-
return
|
|
1573
|
+
return _context15.abrupt("return", this._comptroller.connect(this._networkConnection.signer).enterMarkets([this.auToken.address]));
|
|
1372
1574
|
|
|
1373
1575
|
case 1:
|
|
1374
1576
|
case "end":
|
|
1375
|
-
return
|
|
1577
|
+
return _context15.stop();
|
|
1376
1578
|
}
|
|
1377
1579
|
}
|
|
1378
|
-
},
|
|
1580
|
+
}, _callee15, this);
|
|
1379
1581
|
}));
|
|
1380
1582
|
|
|
1381
1583
|
function enableCollateral() {
|
|
@@ -1386,19 +1588,19 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1386
1588
|
}();
|
|
1387
1589
|
|
|
1388
1590
|
_proto2.disableCollateral = /*#__PURE__*/function () {
|
|
1389
|
-
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1390
|
-
return runtime_1.wrap(function
|
|
1591
|
+
var _disableCollateral = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee16() {
|
|
1592
|
+
return runtime_1.wrap(function _callee16$(_context16) {
|
|
1391
1593
|
while (1) {
|
|
1392
|
-
switch (
|
|
1594
|
+
switch (_context16.prev = _context16.next) {
|
|
1393
1595
|
case 0:
|
|
1394
|
-
return
|
|
1596
|
+
return _context16.abrupt("return", this._comptroller.connect(this._networkConnection.signer).exitMarket(this.auToken.address));
|
|
1395
1597
|
|
|
1396
1598
|
case 1:
|
|
1397
1599
|
case "end":
|
|
1398
|
-
return
|
|
1600
|
+
return _context16.stop();
|
|
1399
1601
|
}
|
|
1400
1602
|
}
|
|
1401
|
-
},
|
|
1603
|
+
}, _callee16, this);
|
|
1402
1604
|
}));
|
|
1403
1605
|
|
|
1404
1606
|
function disableCollateral() {
|
|
@@ -1413,44 +1615,1728 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
|
|
|
1413
1615
|
var MoneyMarket = /*#__PURE__*/function (_BlockchainEntity) {
|
|
1414
1616
|
_inheritsLoose(MoneyMarket, _BlockchainEntity);
|
|
1415
1617
|
|
|
1416
|
-
function MoneyMarket(address) {
|
|
1618
|
+
function MoneyMarket(address, underlying) {
|
|
1417
1619
|
var _this3;
|
|
1418
1620
|
|
|
1419
1621
|
_this3 = _BlockchainEntity.call(this) || this;
|
|
1420
|
-
_this3.address =
|
|
1622
|
+
_this3.address = validateAndParseAddress(address);
|
|
1623
|
+
_this3.underlying = validateAndParseAddress(underlying);
|
|
1421
1624
|
return _this3;
|
|
1422
1625
|
}
|
|
1423
1626
|
|
|
1424
1627
|
var _proto3 = MoneyMarket.prototype;
|
|
1425
1628
|
|
|
1426
|
-
_proto3.read = function read(
|
|
1427
|
-
return new MoneyMarketRead(
|
|
1629
|
+
_proto3.read = function read(networkConnection) {
|
|
1630
|
+
return new MoneyMarketRead(networkConnection, this.address, this.underlying);
|
|
1428
1631
|
};
|
|
1429
1632
|
|
|
1430
1633
|
return MoneyMarket;
|
|
1431
1634
|
}(BlockchainEntity);
|
|
1432
1635
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1636
|
+
var abi = [
|
|
1637
|
+
{
|
|
1638
|
+
inputs: [
|
|
1639
|
+
],
|
|
1640
|
+
payable: false,
|
|
1641
|
+
stateMutability: "nonpayable",
|
|
1642
|
+
type: "constructor"
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
anonymous: false,
|
|
1646
|
+
inputs: [
|
|
1647
|
+
{
|
|
1648
|
+
indexed: false,
|
|
1649
|
+
internalType: "address",
|
|
1650
|
+
name: "feed",
|
|
1651
|
+
type: "address"
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
indexed: false,
|
|
1655
|
+
internalType: "string",
|
|
1656
|
+
name: "symbol",
|
|
1657
|
+
type: "string"
|
|
1658
|
+
}
|
|
1659
|
+
],
|
|
1660
|
+
name: "FeedSet",
|
|
1661
|
+
type: "event"
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
anonymous: false,
|
|
1665
|
+
inputs: [
|
|
1666
|
+
{
|
|
1667
|
+
indexed: false,
|
|
1668
|
+
internalType: "address",
|
|
1669
|
+
name: "oldAdmin",
|
|
1670
|
+
type: "address"
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
indexed: false,
|
|
1674
|
+
internalType: "address",
|
|
1675
|
+
name: "newAdmin",
|
|
1676
|
+
type: "address"
|
|
1677
|
+
}
|
|
1678
|
+
],
|
|
1679
|
+
name: "NewAdmin",
|
|
1680
|
+
type: "event"
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
anonymous: false,
|
|
1684
|
+
inputs: [
|
|
1685
|
+
{
|
|
1686
|
+
indexed: false,
|
|
1687
|
+
internalType: "address",
|
|
1688
|
+
name: "asset",
|
|
1689
|
+
type: "address"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
indexed: false,
|
|
1693
|
+
internalType: "uint256",
|
|
1694
|
+
name: "previousPriceMantissa",
|
|
1695
|
+
type: "uint256"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
indexed: false,
|
|
1699
|
+
internalType: "uint256",
|
|
1700
|
+
name: "requestedPriceMantissa",
|
|
1701
|
+
type: "uint256"
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
indexed: false,
|
|
1705
|
+
internalType: "uint256",
|
|
1706
|
+
name: "newPriceMantissa",
|
|
1707
|
+
type: "uint256"
|
|
1708
|
+
}
|
|
1709
|
+
],
|
|
1710
|
+
name: "PricePosted",
|
|
1711
|
+
type: "event"
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
constant: true,
|
|
1715
|
+
inputs: [
|
|
1716
|
+
],
|
|
1717
|
+
name: "admin",
|
|
1718
|
+
outputs: [
|
|
1719
|
+
{
|
|
1720
|
+
internalType: "address",
|
|
1721
|
+
name: "",
|
|
1722
|
+
type: "address"
|
|
1723
|
+
}
|
|
1724
|
+
],
|
|
1725
|
+
payable: false,
|
|
1726
|
+
stateMutability: "view",
|
|
1727
|
+
type: "function"
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
constant: true,
|
|
1731
|
+
inputs: [
|
|
1732
|
+
{
|
|
1733
|
+
internalType: "address",
|
|
1734
|
+
name: "asset",
|
|
1735
|
+
type: "address"
|
|
1736
|
+
}
|
|
1737
|
+
],
|
|
1738
|
+
name: "assetPrices",
|
|
1739
|
+
outputs: [
|
|
1740
|
+
{
|
|
1741
|
+
internalType: "uint256",
|
|
1742
|
+
name: "",
|
|
1743
|
+
type: "uint256"
|
|
1744
|
+
}
|
|
1745
|
+
],
|
|
1746
|
+
payable: false,
|
|
1747
|
+
stateMutability: "view",
|
|
1748
|
+
type: "function"
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
constant: true,
|
|
1752
|
+
inputs: [
|
|
1753
|
+
{
|
|
1754
|
+
internalType: "string",
|
|
1755
|
+
name: "symbol",
|
|
1756
|
+
type: "string"
|
|
1757
|
+
}
|
|
1758
|
+
],
|
|
1759
|
+
name: "getFeed",
|
|
1760
|
+
outputs: [
|
|
1761
|
+
{
|
|
1762
|
+
internalType: "contract AggregatorV2V3Interface",
|
|
1763
|
+
name: "",
|
|
1764
|
+
type: "address"
|
|
1765
|
+
}
|
|
1766
|
+
],
|
|
1767
|
+
payable: false,
|
|
1768
|
+
stateMutability: "view",
|
|
1769
|
+
type: "function"
|
|
1770
|
+
},
|
|
1771
|
+
{
|
|
1772
|
+
constant: true,
|
|
1773
|
+
inputs: [
|
|
1774
|
+
{
|
|
1775
|
+
internalType: "contract QiToken",
|
|
1776
|
+
name: "qiToken",
|
|
1777
|
+
type: "address"
|
|
1778
|
+
}
|
|
1779
|
+
],
|
|
1780
|
+
name: "getUnderlyingPrice",
|
|
1781
|
+
outputs: [
|
|
1782
|
+
{
|
|
1783
|
+
internalType: "uint256",
|
|
1784
|
+
name: "",
|
|
1785
|
+
type: "uint256"
|
|
1786
|
+
}
|
|
1787
|
+
],
|
|
1788
|
+
payable: false,
|
|
1789
|
+
stateMutability: "view",
|
|
1790
|
+
type: "function"
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
constant: true,
|
|
1794
|
+
inputs: [
|
|
1795
|
+
],
|
|
1796
|
+
name: "isPriceOracle",
|
|
1797
|
+
outputs: [
|
|
1798
|
+
{
|
|
1799
|
+
internalType: "bool",
|
|
1800
|
+
name: "",
|
|
1801
|
+
type: "bool"
|
|
1802
|
+
}
|
|
1803
|
+
],
|
|
1804
|
+
payable: false,
|
|
1805
|
+
stateMutability: "view",
|
|
1806
|
+
type: "function"
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
constant: false,
|
|
1810
|
+
inputs: [
|
|
1811
|
+
{
|
|
1812
|
+
internalType: "address",
|
|
1813
|
+
name: "newAdmin",
|
|
1814
|
+
type: "address"
|
|
1815
|
+
}
|
|
1816
|
+
],
|
|
1817
|
+
name: "setAdmin",
|
|
1818
|
+
outputs: [
|
|
1819
|
+
],
|
|
1820
|
+
payable: false,
|
|
1821
|
+
stateMutability: "nonpayable",
|
|
1822
|
+
type: "function"
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
constant: false,
|
|
1826
|
+
inputs: [
|
|
1827
|
+
{
|
|
1828
|
+
internalType: "address",
|
|
1829
|
+
name: "asset",
|
|
1830
|
+
type: "address"
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
internalType: "uint256",
|
|
1834
|
+
name: "price",
|
|
1835
|
+
type: "uint256"
|
|
1836
|
+
}
|
|
1837
|
+
],
|
|
1838
|
+
name: "setDirectPrice",
|
|
1839
|
+
outputs: [
|
|
1840
|
+
],
|
|
1841
|
+
payable: false,
|
|
1842
|
+
stateMutability: "nonpayable",
|
|
1843
|
+
type: "function"
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
constant: false,
|
|
1847
|
+
inputs: [
|
|
1848
|
+
{
|
|
1849
|
+
internalType: "string",
|
|
1850
|
+
name: "symbol",
|
|
1851
|
+
type: "string"
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
internalType: "address",
|
|
1855
|
+
name: "feed",
|
|
1856
|
+
type: "address"
|
|
1857
|
+
}
|
|
1858
|
+
],
|
|
1859
|
+
name: "setFeed",
|
|
1860
|
+
outputs: [
|
|
1861
|
+
],
|
|
1862
|
+
payable: false,
|
|
1863
|
+
stateMutability: "nonpayable",
|
|
1864
|
+
type: "function"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
constant: false,
|
|
1868
|
+
inputs: [
|
|
1869
|
+
{
|
|
1870
|
+
internalType: "contract QiToken",
|
|
1871
|
+
name: "qiToken",
|
|
1872
|
+
type: "address"
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
internalType: "uint256",
|
|
1876
|
+
name: "underlyingPriceMantissa",
|
|
1877
|
+
type: "uint256"
|
|
1878
|
+
}
|
|
1879
|
+
],
|
|
1880
|
+
name: "setUnderlyingPrice",
|
|
1881
|
+
outputs: [
|
|
1882
|
+
],
|
|
1883
|
+
payable: false,
|
|
1884
|
+
stateMutability: "nonpayable",
|
|
1885
|
+
type: "function"
|
|
1886
|
+
}
|
|
1887
|
+
];
|
|
1888
|
+
var OracleABI = {
|
|
1889
|
+
abi: abi
|
|
1890
|
+
};
|
|
1891
|
+
|
|
1892
|
+
var _format = "hh-sol-artifact-1";
|
|
1893
|
+
var contractName = "IUniswapV2Pair";
|
|
1894
|
+
var sourceName = "contracts/interfaces/IUniswapV2Pair.sol";
|
|
1895
|
+
var abi$1 = [
|
|
1896
|
+
{
|
|
1897
|
+
anonymous: false,
|
|
1898
|
+
inputs: [
|
|
1899
|
+
{
|
|
1900
|
+
indexed: true,
|
|
1901
|
+
internalType: "address",
|
|
1902
|
+
name: "owner",
|
|
1903
|
+
type: "address"
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
indexed: true,
|
|
1907
|
+
internalType: "address",
|
|
1908
|
+
name: "spender",
|
|
1909
|
+
type: "address"
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
indexed: false,
|
|
1913
|
+
internalType: "uint256",
|
|
1914
|
+
name: "value",
|
|
1915
|
+
type: "uint256"
|
|
1916
|
+
}
|
|
1917
|
+
],
|
|
1918
|
+
name: "Approval",
|
|
1919
|
+
type: "event"
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
anonymous: false,
|
|
1923
|
+
inputs: [
|
|
1924
|
+
{
|
|
1925
|
+
indexed: true,
|
|
1926
|
+
internalType: "address",
|
|
1927
|
+
name: "sender",
|
|
1928
|
+
type: "address"
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
indexed: false,
|
|
1932
|
+
internalType: "uint256",
|
|
1933
|
+
name: "amount0",
|
|
1934
|
+
type: "uint256"
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
indexed: false,
|
|
1938
|
+
internalType: "uint256",
|
|
1939
|
+
name: "amount1",
|
|
1940
|
+
type: "uint256"
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
indexed: true,
|
|
1944
|
+
internalType: "address",
|
|
1945
|
+
name: "to",
|
|
1946
|
+
type: "address"
|
|
1947
|
+
}
|
|
1948
|
+
],
|
|
1949
|
+
name: "Burn",
|
|
1950
|
+
type: "event"
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
anonymous: false,
|
|
1954
|
+
inputs: [
|
|
1955
|
+
{
|
|
1956
|
+
indexed: true,
|
|
1957
|
+
internalType: "address",
|
|
1958
|
+
name: "sender",
|
|
1959
|
+
type: "address"
|
|
1960
|
+
},
|
|
1961
|
+
{
|
|
1962
|
+
indexed: false,
|
|
1963
|
+
internalType: "uint256",
|
|
1964
|
+
name: "amount0",
|
|
1965
|
+
type: "uint256"
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
indexed: false,
|
|
1969
|
+
internalType: "uint256",
|
|
1970
|
+
name: "amount1",
|
|
1971
|
+
type: "uint256"
|
|
1972
|
+
}
|
|
1973
|
+
],
|
|
1974
|
+
name: "Mint",
|
|
1975
|
+
type: "event"
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
anonymous: false,
|
|
1979
|
+
inputs: [
|
|
1980
|
+
{
|
|
1981
|
+
indexed: true,
|
|
1982
|
+
internalType: "address",
|
|
1983
|
+
name: "sender",
|
|
1984
|
+
type: "address"
|
|
1985
|
+
},
|
|
1986
|
+
{
|
|
1987
|
+
indexed: false,
|
|
1988
|
+
internalType: "uint256",
|
|
1989
|
+
name: "amount0In",
|
|
1990
|
+
type: "uint256"
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
indexed: false,
|
|
1994
|
+
internalType: "uint256",
|
|
1995
|
+
name: "amount1In",
|
|
1996
|
+
type: "uint256"
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
indexed: false,
|
|
2000
|
+
internalType: "uint256",
|
|
2001
|
+
name: "amount0Out",
|
|
2002
|
+
type: "uint256"
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
indexed: false,
|
|
2006
|
+
internalType: "uint256",
|
|
2007
|
+
name: "amount1Out",
|
|
2008
|
+
type: "uint256"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
indexed: true,
|
|
2012
|
+
internalType: "address",
|
|
2013
|
+
name: "to",
|
|
2014
|
+
type: "address"
|
|
2015
|
+
}
|
|
2016
|
+
],
|
|
2017
|
+
name: "Swap",
|
|
2018
|
+
type: "event"
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
anonymous: false,
|
|
2022
|
+
inputs: [
|
|
2023
|
+
{
|
|
2024
|
+
indexed: false,
|
|
2025
|
+
internalType: "uint112",
|
|
2026
|
+
name: "reserve0",
|
|
2027
|
+
type: "uint112"
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
indexed: false,
|
|
2031
|
+
internalType: "uint112",
|
|
2032
|
+
name: "reserve1",
|
|
2033
|
+
type: "uint112"
|
|
2034
|
+
}
|
|
2035
|
+
],
|
|
2036
|
+
name: "Sync",
|
|
2037
|
+
type: "event"
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
anonymous: false,
|
|
2041
|
+
inputs: [
|
|
2042
|
+
{
|
|
2043
|
+
indexed: true,
|
|
2044
|
+
internalType: "address",
|
|
2045
|
+
name: "from",
|
|
2046
|
+
type: "address"
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
indexed: true,
|
|
2050
|
+
internalType: "address",
|
|
2051
|
+
name: "to",
|
|
2052
|
+
type: "address"
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
indexed: false,
|
|
2056
|
+
internalType: "uint256",
|
|
2057
|
+
name: "value",
|
|
2058
|
+
type: "uint256"
|
|
2059
|
+
}
|
|
2060
|
+
],
|
|
2061
|
+
name: "Transfer",
|
|
2062
|
+
type: "event"
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
inputs: [
|
|
2066
|
+
],
|
|
2067
|
+
name: "DOMAIN_SEPARATOR",
|
|
2068
|
+
outputs: [
|
|
2069
|
+
{
|
|
2070
|
+
internalType: "bytes32",
|
|
2071
|
+
name: "",
|
|
2072
|
+
type: "bytes32"
|
|
2073
|
+
}
|
|
2074
|
+
],
|
|
2075
|
+
stateMutability: "view",
|
|
2076
|
+
type: "function"
|
|
2077
|
+
},
|
|
2078
|
+
{
|
|
2079
|
+
inputs: [
|
|
2080
|
+
],
|
|
2081
|
+
name: "MINIMUM_LIQUIDITY",
|
|
2082
|
+
outputs: [
|
|
2083
|
+
{
|
|
2084
|
+
internalType: "uint256",
|
|
2085
|
+
name: "",
|
|
2086
|
+
type: "uint256"
|
|
2087
|
+
}
|
|
2088
|
+
],
|
|
2089
|
+
stateMutability: "pure",
|
|
2090
|
+
type: "function"
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
inputs: [
|
|
2094
|
+
],
|
|
2095
|
+
name: "PERMIT_TYPEHASH",
|
|
2096
|
+
outputs: [
|
|
2097
|
+
{
|
|
2098
|
+
internalType: "bytes32",
|
|
2099
|
+
name: "",
|
|
2100
|
+
type: "bytes32"
|
|
2101
|
+
}
|
|
2102
|
+
],
|
|
2103
|
+
stateMutability: "pure",
|
|
2104
|
+
type: "function"
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
inputs: [
|
|
2108
|
+
{
|
|
2109
|
+
internalType: "address",
|
|
2110
|
+
name: "owner",
|
|
2111
|
+
type: "address"
|
|
2112
|
+
},
|
|
2113
|
+
{
|
|
2114
|
+
internalType: "address",
|
|
2115
|
+
name: "spender",
|
|
2116
|
+
type: "address"
|
|
2117
|
+
}
|
|
2118
|
+
],
|
|
2119
|
+
name: "allowance",
|
|
2120
|
+
outputs: [
|
|
2121
|
+
{
|
|
2122
|
+
internalType: "uint256",
|
|
2123
|
+
name: "",
|
|
2124
|
+
type: "uint256"
|
|
2125
|
+
}
|
|
2126
|
+
],
|
|
2127
|
+
stateMutability: "view",
|
|
2128
|
+
type: "function"
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
inputs: [
|
|
2132
|
+
{
|
|
2133
|
+
internalType: "address",
|
|
2134
|
+
name: "spender",
|
|
2135
|
+
type: "address"
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
internalType: "uint256",
|
|
2139
|
+
name: "value",
|
|
2140
|
+
type: "uint256"
|
|
2141
|
+
}
|
|
2142
|
+
],
|
|
2143
|
+
name: "approve",
|
|
2144
|
+
outputs: [
|
|
2145
|
+
{
|
|
2146
|
+
internalType: "bool",
|
|
2147
|
+
name: "",
|
|
2148
|
+
type: "bool"
|
|
2149
|
+
}
|
|
2150
|
+
],
|
|
2151
|
+
stateMutability: "nonpayable",
|
|
2152
|
+
type: "function"
|
|
2153
|
+
},
|
|
2154
|
+
{
|
|
2155
|
+
inputs: [
|
|
2156
|
+
{
|
|
2157
|
+
internalType: "address",
|
|
2158
|
+
name: "owner",
|
|
2159
|
+
type: "address"
|
|
2160
|
+
}
|
|
2161
|
+
],
|
|
2162
|
+
name: "balanceOf",
|
|
2163
|
+
outputs: [
|
|
2164
|
+
{
|
|
2165
|
+
internalType: "uint256",
|
|
2166
|
+
name: "",
|
|
2167
|
+
type: "uint256"
|
|
2168
|
+
}
|
|
2169
|
+
],
|
|
2170
|
+
stateMutability: "view",
|
|
2171
|
+
type: "function"
|
|
2172
|
+
},
|
|
2173
|
+
{
|
|
2174
|
+
inputs: [
|
|
2175
|
+
{
|
|
2176
|
+
internalType: "address",
|
|
2177
|
+
name: "to",
|
|
2178
|
+
type: "address"
|
|
2179
|
+
}
|
|
2180
|
+
],
|
|
2181
|
+
name: "burn",
|
|
2182
|
+
outputs: [
|
|
2183
|
+
{
|
|
2184
|
+
internalType: "uint256",
|
|
2185
|
+
name: "amount0",
|
|
2186
|
+
type: "uint256"
|
|
2187
|
+
},
|
|
2188
|
+
{
|
|
2189
|
+
internalType: "uint256",
|
|
2190
|
+
name: "amount1",
|
|
2191
|
+
type: "uint256"
|
|
2192
|
+
}
|
|
2193
|
+
],
|
|
2194
|
+
stateMutability: "nonpayable",
|
|
2195
|
+
type: "function"
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
inputs: [
|
|
2199
|
+
],
|
|
2200
|
+
name: "decimals",
|
|
2201
|
+
outputs: [
|
|
2202
|
+
{
|
|
2203
|
+
internalType: "uint8",
|
|
2204
|
+
name: "",
|
|
2205
|
+
type: "uint8"
|
|
2206
|
+
}
|
|
2207
|
+
],
|
|
2208
|
+
stateMutability: "pure",
|
|
2209
|
+
type: "function"
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
inputs: [
|
|
2213
|
+
],
|
|
2214
|
+
name: "factory",
|
|
2215
|
+
outputs: [
|
|
2216
|
+
{
|
|
2217
|
+
internalType: "address",
|
|
2218
|
+
name: "",
|
|
2219
|
+
type: "address"
|
|
2220
|
+
}
|
|
2221
|
+
],
|
|
2222
|
+
stateMutability: "view",
|
|
2223
|
+
type: "function"
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
inputs: [
|
|
2227
|
+
],
|
|
2228
|
+
name: "getReserves",
|
|
2229
|
+
outputs: [
|
|
2230
|
+
{
|
|
2231
|
+
internalType: "uint112",
|
|
2232
|
+
name: "reserve0",
|
|
2233
|
+
type: "uint112"
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
internalType: "uint112",
|
|
2237
|
+
name: "reserve1",
|
|
2238
|
+
type: "uint112"
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
internalType: "uint32",
|
|
2242
|
+
name: "blockTimestampLast",
|
|
2243
|
+
type: "uint32"
|
|
2244
|
+
}
|
|
2245
|
+
],
|
|
2246
|
+
stateMutability: "view",
|
|
2247
|
+
type: "function"
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
inputs: [
|
|
2251
|
+
{
|
|
2252
|
+
internalType: "address",
|
|
2253
|
+
name: "",
|
|
2254
|
+
type: "address"
|
|
2255
|
+
},
|
|
2256
|
+
{
|
|
2257
|
+
internalType: "address",
|
|
2258
|
+
name: "",
|
|
2259
|
+
type: "address"
|
|
2260
|
+
}
|
|
2261
|
+
],
|
|
2262
|
+
name: "initialize",
|
|
2263
|
+
outputs: [
|
|
2264
|
+
],
|
|
2265
|
+
stateMutability: "nonpayable",
|
|
2266
|
+
type: "function"
|
|
2267
|
+
},
|
|
2268
|
+
{
|
|
2269
|
+
inputs: [
|
|
2270
|
+
],
|
|
2271
|
+
name: "kLast",
|
|
2272
|
+
outputs: [
|
|
2273
|
+
{
|
|
2274
|
+
internalType: "uint256",
|
|
2275
|
+
name: "",
|
|
2276
|
+
type: "uint256"
|
|
2277
|
+
}
|
|
2278
|
+
],
|
|
2279
|
+
stateMutability: "view",
|
|
2280
|
+
type: "function"
|
|
2281
|
+
},
|
|
2282
|
+
{
|
|
2283
|
+
inputs: [
|
|
2284
|
+
{
|
|
2285
|
+
internalType: "address",
|
|
2286
|
+
name: "to",
|
|
2287
|
+
type: "address"
|
|
2288
|
+
}
|
|
2289
|
+
],
|
|
2290
|
+
name: "mint",
|
|
2291
|
+
outputs: [
|
|
2292
|
+
{
|
|
2293
|
+
internalType: "uint256",
|
|
2294
|
+
name: "liquidity",
|
|
2295
|
+
type: "uint256"
|
|
2296
|
+
}
|
|
2297
|
+
],
|
|
2298
|
+
stateMutability: "nonpayable",
|
|
2299
|
+
type: "function"
|
|
2300
|
+
},
|
|
2301
|
+
{
|
|
2302
|
+
inputs: [
|
|
2303
|
+
],
|
|
2304
|
+
name: "name",
|
|
2305
|
+
outputs: [
|
|
2306
|
+
{
|
|
2307
|
+
internalType: "string",
|
|
2308
|
+
name: "",
|
|
2309
|
+
type: "string"
|
|
2310
|
+
}
|
|
2311
|
+
],
|
|
2312
|
+
stateMutability: "pure",
|
|
2313
|
+
type: "function"
|
|
2314
|
+
},
|
|
2315
|
+
{
|
|
2316
|
+
inputs: [
|
|
2317
|
+
{
|
|
2318
|
+
internalType: "address",
|
|
2319
|
+
name: "owner",
|
|
2320
|
+
type: "address"
|
|
2321
|
+
}
|
|
2322
|
+
],
|
|
2323
|
+
name: "nonces",
|
|
2324
|
+
outputs: [
|
|
2325
|
+
{
|
|
2326
|
+
internalType: "uint256",
|
|
2327
|
+
name: "",
|
|
2328
|
+
type: "uint256"
|
|
2329
|
+
}
|
|
2330
|
+
],
|
|
2331
|
+
stateMutability: "view",
|
|
2332
|
+
type: "function"
|
|
2333
|
+
},
|
|
2334
|
+
{
|
|
2335
|
+
inputs: [
|
|
2336
|
+
{
|
|
2337
|
+
internalType: "address",
|
|
2338
|
+
name: "owner",
|
|
2339
|
+
type: "address"
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
internalType: "address",
|
|
2343
|
+
name: "spender",
|
|
2344
|
+
type: "address"
|
|
2345
|
+
},
|
|
2346
|
+
{
|
|
2347
|
+
internalType: "uint256",
|
|
2348
|
+
name: "value",
|
|
2349
|
+
type: "uint256"
|
|
2350
|
+
},
|
|
2351
|
+
{
|
|
2352
|
+
internalType: "uint256",
|
|
2353
|
+
name: "deadline",
|
|
2354
|
+
type: "uint256"
|
|
2355
|
+
},
|
|
2356
|
+
{
|
|
2357
|
+
internalType: "uint8",
|
|
2358
|
+
name: "v",
|
|
2359
|
+
type: "uint8"
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
internalType: "bytes32",
|
|
2363
|
+
name: "r",
|
|
2364
|
+
type: "bytes32"
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
internalType: "bytes32",
|
|
2368
|
+
name: "s",
|
|
2369
|
+
type: "bytes32"
|
|
2370
|
+
}
|
|
2371
|
+
],
|
|
2372
|
+
name: "permit",
|
|
2373
|
+
outputs: [
|
|
2374
|
+
],
|
|
2375
|
+
stateMutability: "nonpayable",
|
|
2376
|
+
type: "function"
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
inputs: [
|
|
2380
|
+
],
|
|
2381
|
+
name: "price0CumulativeLast",
|
|
2382
|
+
outputs: [
|
|
2383
|
+
{
|
|
2384
|
+
internalType: "uint256",
|
|
2385
|
+
name: "",
|
|
2386
|
+
type: "uint256"
|
|
2387
|
+
}
|
|
2388
|
+
],
|
|
2389
|
+
stateMutability: "view",
|
|
2390
|
+
type: "function"
|
|
2391
|
+
},
|
|
2392
|
+
{
|
|
2393
|
+
inputs: [
|
|
2394
|
+
],
|
|
2395
|
+
name: "price1CumulativeLast",
|
|
2396
|
+
outputs: [
|
|
2397
|
+
{
|
|
2398
|
+
internalType: "uint256",
|
|
2399
|
+
name: "",
|
|
2400
|
+
type: "uint256"
|
|
2401
|
+
}
|
|
2402
|
+
],
|
|
2403
|
+
stateMutability: "view",
|
|
2404
|
+
type: "function"
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
inputs: [
|
|
2408
|
+
{
|
|
2409
|
+
internalType: "address",
|
|
2410
|
+
name: "to",
|
|
2411
|
+
type: "address"
|
|
2412
|
+
}
|
|
2413
|
+
],
|
|
2414
|
+
name: "skim",
|
|
2415
|
+
outputs: [
|
|
2416
|
+
],
|
|
2417
|
+
stateMutability: "nonpayable",
|
|
2418
|
+
type: "function"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
inputs: [
|
|
2422
|
+
{
|
|
2423
|
+
internalType: "uint256",
|
|
2424
|
+
name: "amount0Out",
|
|
2425
|
+
type: "uint256"
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
internalType: "uint256",
|
|
2429
|
+
name: "amount1Out",
|
|
2430
|
+
type: "uint256"
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
internalType: "address",
|
|
2434
|
+
name: "to",
|
|
2435
|
+
type: "address"
|
|
2436
|
+
},
|
|
2437
|
+
{
|
|
2438
|
+
internalType: "bytes",
|
|
2439
|
+
name: "data",
|
|
2440
|
+
type: "bytes"
|
|
2441
|
+
}
|
|
2442
|
+
],
|
|
2443
|
+
name: "swap",
|
|
2444
|
+
outputs: [
|
|
2445
|
+
],
|
|
2446
|
+
stateMutability: "nonpayable",
|
|
2447
|
+
type: "function"
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
inputs: [
|
|
2451
|
+
],
|
|
2452
|
+
name: "symbol",
|
|
2453
|
+
outputs: [
|
|
2454
|
+
{
|
|
2455
|
+
internalType: "string",
|
|
2456
|
+
name: "",
|
|
2457
|
+
type: "string"
|
|
2458
|
+
}
|
|
2459
|
+
],
|
|
2460
|
+
stateMutability: "pure",
|
|
2461
|
+
type: "function"
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
inputs: [
|
|
2465
|
+
],
|
|
2466
|
+
name: "sync",
|
|
2467
|
+
outputs: [
|
|
2468
|
+
],
|
|
2469
|
+
stateMutability: "nonpayable",
|
|
2470
|
+
type: "function"
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
inputs: [
|
|
2474
|
+
],
|
|
2475
|
+
name: "token0",
|
|
2476
|
+
outputs: [
|
|
2477
|
+
{
|
|
2478
|
+
internalType: "address",
|
|
2479
|
+
name: "",
|
|
2480
|
+
type: "address"
|
|
2481
|
+
}
|
|
2482
|
+
],
|
|
2483
|
+
stateMutability: "view",
|
|
2484
|
+
type: "function"
|
|
2485
|
+
},
|
|
2486
|
+
{
|
|
2487
|
+
inputs: [
|
|
2488
|
+
],
|
|
2489
|
+
name: "token1",
|
|
2490
|
+
outputs: [
|
|
2491
|
+
{
|
|
2492
|
+
internalType: "address",
|
|
2493
|
+
name: "",
|
|
2494
|
+
type: "address"
|
|
2495
|
+
}
|
|
2496
|
+
],
|
|
2497
|
+
stateMutability: "view",
|
|
2498
|
+
type: "function"
|
|
2499
|
+
},
|
|
2500
|
+
{
|
|
2501
|
+
inputs: [
|
|
2502
|
+
],
|
|
2503
|
+
name: "totalSupply",
|
|
2504
|
+
outputs: [
|
|
2505
|
+
{
|
|
2506
|
+
internalType: "uint256",
|
|
2507
|
+
name: "",
|
|
2508
|
+
type: "uint256"
|
|
2509
|
+
}
|
|
2510
|
+
],
|
|
2511
|
+
stateMutability: "view",
|
|
2512
|
+
type: "function"
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
inputs: [
|
|
2516
|
+
{
|
|
2517
|
+
internalType: "address",
|
|
2518
|
+
name: "to",
|
|
2519
|
+
type: "address"
|
|
2520
|
+
},
|
|
2521
|
+
{
|
|
2522
|
+
internalType: "uint256",
|
|
2523
|
+
name: "value",
|
|
2524
|
+
type: "uint256"
|
|
2525
|
+
}
|
|
2526
|
+
],
|
|
2527
|
+
name: "transfer",
|
|
2528
|
+
outputs: [
|
|
2529
|
+
{
|
|
2530
|
+
internalType: "bool",
|
|
2531
|
+
name: "",
|
|
2532
|
+
type: "bool"
|
|
2533
|
+
}
|
|
2534
|
+
],
|
|
2535
|
+
stateMutability: "nonpayable",
|
|
2536
|
+
type: "function"
|
|
2537
|
+
},
|
|
2538
|
+
{
|
|
2539
|
+
inputs: [
|
|
2540
|
+
{
|
|
2541
|
+
internalType: "address",
|
|
2542
|
+
name: "from",
|
|
2543
|
+
type: "address"
|
|
2544
|
+
},
|
|
2545
|
+
{
|
|
2546
|
+
internalType: "address",
|
|
2547
|
+
name: "to",
|
|
2548
|
+
type: "address"
|
|
2549
|
+
},
|
|
2550
|
+
{
|
|
2551
|
+
internalType: "uint256",
|
|
2552
|
+
name: "value",
|
|
2553
|
+
type: "uint256"
|
|
2554
|
+
}
|
|
2555
|
+
],
|
|
2556
|
+
name: "transferFrom",
|
|
2557
|
+
outputs: [
|
|
2558
|
+
{
|
|
2559
|
+
internalType: "bool",
|
|
2560
|
+
name: "",
|
|
2561
|
+
type: "bool"
|
|
2562
|
+
}
|
|
2563
|
+
],
|
|
2564
|
+
stateMutability: "nonpayable",
|
|
2565
|
+
type: "function"
|
|
2566
|
+
}
|
|
2567
|
+
];
|
|
2568
|
+
var bytecode = "0x";
|
|
2569
|
+
var deployedBytecode = "0x";
|
|
2570
|
+
var linkReferences = {
|
|
2571
|
+
};
|
|
2572
|
+
var deployedLinkReferences = {
|
|
2573
|
+
};
|
|
2574
|
+
var IUniswapV2PairABI = {
|
|
2575
|
+
_format: _format,
|
|
2576
|
+
contractName: contractName,
|
|
2577
|
+
sourceName: sourceName,
|
|
2578
|
+
abi: abi$1,
|
|
2579
|
+
bytecode: bytecode,
|
|
2580
|
+
deployedBytecode: deployedBytecode,
|
|
2581
|
+
linkReferences: linkReferences,
|
|
2582
|
+
deployedLinkReferences: deployedLinkReferences
|
|
2583
|
+
};
|
|
2584
|
+
|
|
2585
|
+
var abi$2 = [
|
|
2586
|
+
];
|
|
2587
|
+
var dummyABI = {
|
|
2588
|
+
abi: abi$2
|
|
2589
|
+
};
|
|
2590
|
+
|
|
2591
|
+
var axios = /*#__PURE__*/require('axios');
|
|
2592
|
+
|
|
2593
|
+
function fetchPriceFromCoingeckoAPI(_x) {
|
|
2594
|
+
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
function _fetchPriceFromCoingeckoAPI() {
|
|
2598
|
+
_fetchPriceFromCoingeckoAPI = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(id) {
|
|
2599
|
+
var price;
|
|
2600
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2601
|
+
while (1) {
|
|
2602
|
+
switch (_context.prev = _context.next) {
|
|
2603
|
+
case 0:
|
|
2604
|
+
_context.next = 2;
|
|
2605
|
+
return axios.get("https://api.coingecko.com/api/v3/simple/price?ids=" + id + "&vs_currencies=usd").then(function (res) {
|
|
2606
|
+
return res.data;
|
|
2607
|
+
});
|
|
2608
|
+
|
|
2609
|
+
case 2:
|
|
2610
|
+
price = _context.sent;
|
|
2611
|
+
return _context.abrupt("return", new BigNumber(price[id].usd));
|
|
2612
|
+
|
|
2613
|
+
case 4:
|
|
2614
|
+
case "end":
|
|
2615
|
+
return _context.stop();
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
}, _callee);
|
|
2619
|
+
}));
|
|
2620
|
+
return _fetchPriceFromCoingeckoAPI.apply(this, arguments);
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
function fetchPriceFromCoingecko(_x2) {
|
|
2624
|
+
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
function _fetchPriceFromCoingecko() {
|
|
2628
|
+
_fetchPriceFromCoingecko = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(address) {
|
|
2629
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2630
|
+
while (1) {
|
|
2631
|
+
switch (_context2.prev = _context2.next) {
|
|
2632
|
+
case 0:
|
|
2633
|
+
if (!isSameAddress(address, networkAddresses.tokens.AURORA)) {
|
|
2634
|
+
_context2.next = 4;
|
|
2635
|
+
break;
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
return _context2.abrupt("return", fetchPriceFromCoingeckoAPI('aurora-near'));
|
|
2639
|
+
|
|
2640
|
+
case 4:
|
|
2641
|
+
throw Error("Unknown token " + address + " in fetchPriceFromCoingecko");
|
|
2642
|
+
|
|
2643
|
+
case 5:
|
|
2644
|
+
case "end":
|
|
2645
|
+
return _context2.stop();
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
}, _callee2);
|
|
2649
|
+
}));
|
|
2650
|
+
return _fetchPriceFromCoingecko.apply(this, arguments);
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
function fetchLPPositions(_x3, _x4) {
|
|
2654
|
+
return _fetchLPPositions.apply(this, arguments);
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
function _fetchLPPositions() {
|
|
2658
|
+
_fetchLPPositions = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(LPAddress, provider) {
|
|
2659
|
+
var promises, LPContract, values;
|
|
2660
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2661
|
+
while (1) {
|
|
2662
|
+
switch (_context3.prev = _context3.next) {
|
|
2663
|
+
case 0:
|
|
2664
|
+
promises = [];
|
|
2665
|
+
LPContract = new ethers$1.Contract(LPAddress, IUniswapV2PairABI.abi, provider);
|
|
2666
|
+
promises.push(LPContract.token0());
|
|
2667
|
+
promises.push(LPContract.toekn1());
|
|
2668
|
+
promises.push(LPContract.getReserves());
|
|
2669
|
+
promises.push(LPContract.totalSupply());
|
|
2670
|
+
_context3.next = 8;
|
|
2671
|
+
return Promise.all(promises);
|
|
2672
|
+
|
|
2673
|
+
case 8:
|
|
2674
|
+
values = _context3.sent;
|
|
2675
|
+
return _context3.abrupt("return", {
|
|
2676
|
+
token0: values[0],
|
|
2677
|
+
token1: values[1],
|
|
2678
|
+
reserve0: values[2]._reserve0,
|
|
2679
|
+
reserve1: values[2]._reserve1,
|
|
2680
|
+
totalSupply: values[3]
|
|
2681
|
+
});
|
|
2682
|
+
|
|
2683
|
+
case 10:
|
|
2684
|
+
case "end":
|
|
2685
|
+
return _context3.stop();
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
}, _callee3);
|
|
2689
|
+
}));
|
|
2690
|
+
return _fetchLPPositions.apply(this, arguments);
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
function fetchLPPrice(_x5, _x6) {
|
|
2694
|
+
return _fetchLPPrice.apply(this, arguments);
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
function _fetchLPPrice() {
|
|
2698
|
+
_fetchLPPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(address, provider) {
|
|
2699
|
+
var LPInfo, token0Price, reserveUSD, token1Price, _reserveUSD;
|
|
2700
|
+
|
|
2701
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2702
|
+
while (1) {
|
|
2703
|
+
switch (_context4.prev = _context4.next) {
|
|
2704
|
+
case 0:
|
|
2705
|
+
_context4.next = 2;
|
|
2706
|
+
return fetchLPPositions(address, provider);
|
|
2707
|
+
|
|
2708
|
+
case 2:
|
|
2709
|
+
LPInfo = _context4.sent;
|
|
2710
|
+
_context4.prev = 3;
|
|
2711
|
+
_context4.next = 6;
|
|
2712
|
+
return fetchPrice(LPInfo.token0, provider);
|
|
2713
|
+
|
|
2714
|
+
case 6:
|
|
2715
|
+
token0Price = _context4.sent;
|
|
2716
|
+
reserveUSD = token0Price.multipliedBy(LPInfo.reserve0.toString()).multipliedBy(2);
|
|
2717
|
+
return _context4.abrupt("return", reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
|
|
2718
|
+
|
|
2719
|
+
case 11:
|
|
2720
|
+
_context4.prev = 11;
|
|
2721
|
+
_context4.t0 = _context4["catch"](3);
|
|
2722
|
+
_context4.prev = 13;
|
|
2723
|
+
_context4.next = 16;
|
|
2724
|
+
return fetchPrice(LPInfo.token1, provider);
|
|
2725
|
+
|
|
2726
|
+
case 16:
|
|
2727
|
+
token1Price = _context4.sent;
|
|
2728
|
+
_reserveUSD = token1Price.multipliedBy(LPInfo.reserve1.toString()).multipliedBy(2);
|
|
2729
|
+
return _context4.abrupt("return", _reserveUSD.multipliedBy(decimalFactor(18)).dividedBy(new BigNumber(LPInfo.totalSupply.toString())));
|
|
2730
|
+
|
|
2731
|
+
case 21:
|
|
2732
|
+
_context4.prev = 21;
|
|
2733
|
+
_context4.t1 = _context4["catch"](13);
|
|
2734
|
+
throw Error("Unable to fetch price for both tokens of LP " + address);
|
|
2735
|
+
|
|
2736
|
+
case 24:
|
|
2737
|
+
case "end":
|
|
2738
|
+
return _context4.stop();
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
}, _callee4, null, [[3, 11], [13, 21]]);
|
|
2742
|
+
}));
|
|
2743
|
+
return _fetchLPPrice.apply(this, arguments);
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
function processPriceFromOracle(rawPrice, underlyingDecimal) {
|
|
2747
|
+
return new BigNumber(rawPrice.toString()).div(decimalFactor(36 - underlyingDecimal));
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
function fetchPriceFromOracle(_x7, _x8, _x9) {
|
|
2751
|
+
return _fetchPriceFromOracle.apply(this, arguments);
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
function _fetchPriceFromOracle() {
|
|
2755
|
+
_fetchPriceFromOracle = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(auTokenAddress, underlyingDecimal, provider) {
|
|
2756
|
+
var oracleContract, rawPrice;
|
|
2757
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2758
|
+
while (1) {
|
|
2759
|
+
switch (_context5.prev = _context5.next) {
|
|
2760
|
+
case 0:
|
|
2761
|
+
oracleContract = new ethers$1.Contract(networkAddresses.misc.oracle, OracleABI.abi, provider);
|
|
2762
|
+
_context5.next = 3;
|
|
2763
|
+
return oracleContract.getUnderlyingPrice(auTokenAddress);
|
|
2764
|
+
|
|
2765
|
+
case 3:
|
|
2766
|
+
rawPrice = _context5.sent;
|
|
2767
|
+
return _context5.abrupt("return", processPriceFromOracle(rawPrice, underlyingDecimal));
|
|
2768
|
+
|
|
2769
|
+
case 5:
|
|
2770
|
+
case "end":
|
|
2771
|
+
return _context5.stop();
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
}, _callee5);
|
|
2775
|
+
}));
|
|
2776
|
+
return _fetchPriceFromOracle.apply(this, arguments);
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
function fetchUnderlyingTokensPrices(_x10) {
|
|
2780
|
+
return _fetchUnderlyingTokensPrices.apply(this, arguments);
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
function _fetchUnderlyingTokensPrices() {
|
|
2784
|
+
_fetchUnderlyingTokensPrices = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(provider) {
|
|
2785
|
+
var auriLens, auTokenAddresses, underlyingDecimals, rawPrices;
|
|
2786
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2787
|
+
while (1) {
|
|
2788
|
+
switch (_context6.prev = _context6.next) {
|
|
2789
|
+
case 0:
|
|
2790
|
+
auriLens = new ethers$1.Contract(networkAddresses.misc.AURILENS, dummyABI.abi, provider);
|
|
2791
|
+
auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
|
|
2792
|
+
return auToken.address;
|
|
2793
|
+
});
|
|
2794
|
+
underlyingDecimals = networkAddresses.auTokens.map(function (auToken) {
|
|
2795
|
+
return getDecimal(auToken.underlying);
|
|
2796
|
+
});
|
|
2797
|
+
_context6.next = 5;
|
|
2798
|
+
return auriLens.auTokenUnderlyingPriceAll(auTokenAddresses);
|
|
2799
|
+
|
|
2800
|
+
case 5:
|
|
2801
|
+
rawPrices = _context6.sent;
|
|
2802
|
+
return _context6.abrupt("return", rawPrices.map(function (res, ind) {
|
|
2803
|
+
return {
|
|
2804
|
+
auToken: res.auToken,
|
|
2805
|
+
underlyingPrice: processPriceFromOracle(res.underlyingPrice, underlyingDecimals[ind])
|
|
2806
|
+
};
|
|
2807
|
+
}));
|
|
2808
|
+
|
|
2809
|
+
case 7:
|
|
2810
|
+
case "end":
|
|
2811
|
+
return _context6.stop();
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
}, _callee6);
|
|
2815
|
+
}));
|
|
2816
|
+
return _fetchUnderlyingTokensPrices.apply(this, arguments);
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
function fetchPrice(_x11, _x12) {
|
|
2820
|
+
return _fetchPrice.apply(this, arguments);
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
function _fetchPrice() {
|
|
2824
|
+
_fetchPrice = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(address, provider) {
|
|
2825
|
+
var matchingAuToken;
|
|
2826
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
2827
|
+
while (1) {
|
|
2828
|
+
switch (_context7.prev = _context7.next) {
|
|
2829
|
+
case 0:
|
|
2830
|
+
matchingAuToken = networkAddresses.auTokens.find(function (auToken) {
|
|
2831
|
+
return isSameAddress(auToken.underlying, address);
|
|
2832
|
+
});
|
|
2833
|
+
|
|
2834
|
+
if (!(matchingAuToken !== undefined)) {
|
|
2835
|
+
_context7.next = 5;
|
|
2836
|
+
break;
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
return _context7.abrupt("return", fetchPriceFromOracle(matchingAuToken.address, getDecimal(address), provider));
|
|
2840
|
+
|
|
2841
|
+
case 5:
|
|
2842
|
+
if (!isSameAddress(address, networkAddresses.misc.AUPLYLP)) {
|
|
2843
|
+
_context7.next = 9;
|
|
2844
|
+
break;
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
return _context7.abrupt("return", fetchLPPrice(address, provider));
|
|
2848
|
+
|
|
2849
|
+
case 9:
|
|
2850
|
+
return _context7.abrupt("return", fetchPriceFromCoingecko(address));
|
|
2851
|
+
|
|
2852
|
+
case 10:
|
|
2853
|
+
case "end":
|
|
2854
|
+
return _context7.stop();
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
}, _callee7);
|
|
2858
|
+
}));
|
|
2859
|
+
return _fetchPrice.apply(this, arguments);
|
|
1435
2860
|
}
|
|
1436
2861
|
|
|
1437
|
-
function
|
|
1438
|
-
return
|
|
2862
|
+
function fetchValuation(_x13, _x14, _x15) {
|
|
2863
|
+
return _fetchValuation.apply(this, arguments);
|
|
1439
2864
|
}
|
|
1440
2865
|
|
|
2866
|
+
function _fetchValuation() {
|
|
2867
|
+
_fetchValuation = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(tokenAmount, provider, price) {
|
|
2868
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
2869
|
+
while (1) {
|
|
2870
|
+
switch (_context8.prev = _context8.next) {
|
|
2871
|
+
case 0:
|
|
2872
|
+
return _context8.abrupt("return", new BigNumber(0));
|
|
2873
|
+
|
|
2874
|
+
case 1:
|
|
2875
|
+
case "end":
|
|
2876
|
+
return _context8.stop();
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
}, _callee8);
|
|
2880
|
+
}));
|
|
2881
|
+
return _fetchValuation.apply(this, arguments);
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
2885
|
+
_inheritsLoose(SdkRead, _BlockchainEntityRead);
|
|
2886
|
+
|
|
2887
|
+
function SdkRead(networkConnection) {
|
|
2888
|
+
var _this;
|
|
2889
|
+
|
|
2890
|
+
_this = _BlockchainEntityRead.call(this, networkConnection) || this;
|
|
2891
|
+
_this._comptroller = new ethers$1.Contract(networkAddresses.misc.COMPTROLLER, ComptrollerABI.abi, networkConnection.provider);
|
|
2892
|
+
_this._tokenLock = new ethers$1.Contract(networkAddresses.misc.TOKENLOCK, TokenLockABI.abi, networkConnection.provider);
|
|
2893
|
+
_this._auriFairLaunch = new ethers$1.Contract(networkAddresses.misc.AURIFAIRLAUNCH, AuriFairLaunchABI.abi, networkConnection.provider);
|
|
2894
|
+
_this._auriLens = new ethers$1.Contract(networkAddresses.misc.AURILENS, dummyABI.abi, networkConnection.provider);
|
|
2895
|
+
return _this;
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
var _proto = SdkRead.prototype;
|
|
2899
|
+
|
|
2900
|
+
_proto.getLockingDetails = /*#__PURE__*/function () {
|
|
2901
|
+
var _getLockingDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2902
|
+
var currentTime, currentWeek, denominator, promises, values;
|
|
2903
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2904
|
+
while (1) {
|
|
2905
|
+
switch (_context.prev = _context.next) {
|
|
2906
|
+
case 0:
|
|
2907
|
+
_context.next = 2;
|
|
2908
|
+
return getCurrentTimestamp(this._networkConnection.provider);
|
|
2909
|
+
|
|
2910
|
+
case 2:
|
|
2911
|
+
currentTime = _context.sent;
|
|
2912
|
+
currentWeek = ethers$1.BigNumber.from(currentTime - REWARDCLAIMSTART).div(7 * ONE_DAY).toNumber();
|
|
2913
|
+
denominator = 10000;
|
|
2914
|
+
promises = [];
|
|
2915
|
+
promises.push(this._tokenLock.percentageLock(currentWeek));
|
|
2916
|
+
promises.push(this._tokenLock.percentageLock(currentWeek + 1)["catch"](function (err) {
|
|
2917
|
+
return denominator;
|
|
2918
|
+
}));
|
|
2919
|
+
_context.next = 10;
|
|
2920
|
+
return Promise.all(promises).then(function (res) {
|
|
2921
|
+
return res.map(function (v) {
|
|
2922
|
+
return v.toString();
|
|
2923
|
+
});
|
|
2924
|
+
});
|
|
2925
|
+
|
|
2926
|
+
case 10:
|
|
2927
|
+
values = _context.sent;
|
|
2928
|
+
return _context.abrupt("return", {
|
|
2929
|
+
vestingStart: REWARDCLAIMSTART,
|
|
2930
|
+
currentUnlockPortion: new BigNumber(values[0]).div(denominator).toNumber(),
|
|
2931
|
+
nextUnlockPortion: new BigNumber(values[1]).div(denominator).toNumber()
|
|
2932
|
+
});
|
|
2933
|
+
|
|
2934
|
+
case 12:
|
|
2935
|
+
case "end":
|
|
2936
|
+
return _context.stop();
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
}, _callee, this);
|
|
2940
|
+
}));
|
|
2941
|
+
|
|
2942
|
+
function getLockingDetails() {
|
|
2943
|
+
return _getLockingDetails.apply(this, arguments);
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
return getLockingDetails;
|
|
2947
|
+
}();
|
|
2948
|
+
|
|
2949
|
+
_proto.getUserDetails = /*#__PURE__*/function () {
|
|
2950
|
+
var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
|
|
2951
|
+
var _this2 = this;
|
|
2952
|
+
|
|
2953
|
+
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;
|
|
2954
|
+
|
|
2955
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2956
|
+
while (1) {
|
|
2957
|
+
switch (_context2.prev = _context2.next) {
|
|
2958
|
+
case 0:
|
|
2959
|
+
marketCount = networkAddresses.auTokens.length;
|
|
2960
|
+
userMarketDetails = [];
|
|
2961
|
+
promises = [];
|
|
2962
|
+
totalBorrowLimit = new BigNumber(0);
|
|
2963
|
+
pricePromises = [];
|
|
2964
|
+
|
|
2965
|
+
_loop2 = function _loop2() {
|
|
2966
|
+
var auToken = _step.value;
|
|
2967
|
+
var userMarketDetail = {};
|
|
2968
|
+
userMarketDetails.push(userMarketDetail);
|
|
2969
|
+
userMarketDetail.market = auToken.underlying;
|
|
2970
|
+
var moneyMarket = new MoneyMarketRead(_this2._networkConnection, auToken.address, auToken.underlying);
|
|
2971
|
+
promises.push(moneyMarket.getUserDepositBalance(userAddress).then(function (res) {
|
|
2972
|
+
userMarketDetail.depositBalance = res;
|
|
2973
|
+
}));
|
|
2974
|
+
promises.push(moneyMarket.getUserBorrowBalance(userAddress).then(function (res) {
|
|
2975
|
+
userMarketDetail.borrowBalance = res;
|
|
2976
|
+
}));
|
|
2977
|
+
promises.push(moneyMarket.getCollateralRatio().then(function (res) {
|
|
2978
|
+
collateralRatio[i] = res;
|
|
2979
|
+
}));
|
|
2980
|
+
pricePromises.push(fetchPrice(moneyMarket.underlying.address, _this2._networkConnection.provider));
|
|
2981
|
+
};
|
|
2982
|
+
|
|
2983
|
+
for (_iterator = _createForOfIteratorHelperLoose(networkAddresses.auTokens); !(_step = _iterator()).done;) {
|
|
2984
|
+
_loop2();
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
promises.push(this._comptroller.getAssetsIn(userAddress).then(function (res) {
|
|
2988
|
+
assetsIn = res;
|
|
2989
|
+
}));
|
|
2990
|
+
_context2.next = 10;
|
|
2991
|
+
return Promise.all(promises);
|
|
2992
|
+
|
|
2993
|
+
case 10:
|
|
2994
|
+
_context2.next = 12;
|
|
2995
|
+
return Promise.all(pricePromises);
|
|
2996
|
+
|
|
2997
|
+
case 12:
|
|
2998
|
+
underlyingPrices = _context2.sent;
|
|
2999
|
+
depositValuationPromises = [];
|
|
3000
|
+
|
|
3001
|
+
_loop = function _loop() {
|
|
3002
|
+
var auToken = networkAddresses.auTokens[i];
|
|
3003
|
+
|
|
3004
|
+
if (assetsIn.filter(function (auAddress) {
|
|
3005
|
+
isSameAddress(auToken.address, auAddress);
|
|
3006
|
+
}).length > 0) {
|
|
3007
|
+
userMarketDetails[i].isCollateral = true;
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
depositValuationPromises.push(fetchValuation(userMarketDetails[i].depositBalance, _this2._networkConnection.provider, underlyingPrices[i]));
|
|
3011
|
+
};
|
|
3012
|
+
|
|
3013
|
+
for (i = 0; i < marketCount; i++) {
|
|
3014
|
+
_loop();
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
_context2.next = 18;
|
|
3018
|
+
return Promise.all(depositValuationPromises);
|
|
3019
|
+
|
|
3020
|
+
case 18:
|
|
3021
|
+
depositValues = _context2.sent;
|
|
3022
|
+
totalBorrowLimit = depositValues.reduce(function (p, v, index) {
|
|
3023
|
+
if (userMarketDetails[index].isCollateral) return p.plus(v.multipliedBy(collateralRatio[index]));
|
|
3024
|
+
return p;
|
|
3025
|
+
});
|
|
3026
|
+
promises = [];
|
|
3027
|
+
promises.push(this._comptroller.getAccountLiquidity(userAddress));
|
|
3028
|
+
promises.push(this._auriLens.getRewardBalancesMetadata(this._comptroller.address, userAddress));
|
|
3029
|
+
promises.push(this._tokenLock.lockedAmounts(userAddress));
|
|
3030
|
+
_context2.next = 26;
|
|
3031
|
+
return Promise.all(promises);
|
|
3032
|
+
|
|
3033
|
+
case 26:
|
|
3034
|
+
values = _context2.sent;
|
|
3035
|
+
accountLiquidity = values[0];
|
|
3036
|
+
rewardBalancesMetadata = values[1];
|
|
3037
|
+
lockedAmount = values[2];
|
|
3038
|
+
borrowedvaluation = totalBorrowLimit.minus(new BigNumber(accountLiquidity[1].toString()).div(decimalFactor(18)));
|
|
3039
|
+
bufferedBorrowLimit = totalBorrowLimit.multipliedBy(BORROW_LIMIT_BUFFER);
|
|
3040
|
+
|
|
3041
|
+
if (bufferedBorrowLimit.lte(borrowedvaluation)) {
|
|
3042
|
+
borrowableAmount = new BigNumber(0);
|
|
3043
|
+
} else {
|
|
3044
|
+
borrowableAmount = bufferedBorrowLimit.minus(borrowedvaluation);
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
for (i = 0; i < marketCount; i++) {
|
|
3048
|
+
auToken = networkAddresses.auTokens[i];
|
|
3049
|
+
moneyMarket = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
|
|
3050
|
+
userMarketDetails[i].maxWithdrawableAmount = new TokenAmount(moneyMarket.underlying, borrowableAmount.div(underlyingPrices[i]).toFixed(18));
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
return _context2.abrupt("return", {
|
|
3054
|
+
markets: userMarketDetails,
|
|
3055
|
+
borrowLimit: {
|
|
3056
|
+
currency: "USD",
|
|
3057
|
+
amount: bufferedBorrowLimit.toFixed(DECIMAL_PRECISION)
|
|
3058
|
+
},
|
|
3059
|
+
accruedPly: new TokenAmount(PLYToken, rewardBalancesMetadata.plyAccrued.toString()),
|
|
3060
|
+
lockedPly: new TokenAmount(PLYToken, lockedAmount.toString()),
|
|
3061
|
+
borrowableAmount: {
|
|
3062
|
+
currency: "USD",
|
|
3063
|
+
amount: borrowableAmount.toFixed(DECIMAL_PRECISION)
|
|
3064
|
+
}
|
|
3065
|
+
});
|
|
3066
|
+
|
|
3067
|
+
case 35:
|
|
3068
|
+
case "end":
|
|
3069
|
+
return _context2.stop();
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
}, _callee2, this);
|
|
3073
|
+
}));
|
|
3074
|
+
|
|
3075
|
+
function getUserDetails(_x) {
|
|
3076
|
+
return _getUserDetails.apply(this, arguments);
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
return getUserDetails;
|
|
3080
|
+
}();
|
|
3081
|
+
|
|
3082
|
+
_proto.getPlyAuroraPoolDetails = /*#__PURE__*/function () {
|
|
3083
|
+
var _getPlyAuroraPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
3084
|
+
var stakedLiquidity, rewardPerSecond, promises, rewardPerSecondValuation, totalStakeValuation;
|
|
3085
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
3086
|
+
while (1) {
|
|
3087
|
+
switch (_context3.prev = _context3.next) {
|
|
3088
|
+
case 0:
|
|
3089
|
+
promises = [];
|
|
3090
|
+
promises.push(this._auriFairLaunch.getPoolInfo(AurPlyPid).then(function (res) {
|
|
3091
|
+
stakedLiquidity = res.totalStake;
|
|
3092
|
+
rewardPerSecond = res.rewardPerSecond;
|
|
3093
|
+
}));
|
|
3094
|
+
_context3.next = 4;
|
|
3095
|
+
return Promise.all(promises);
|
|
3096
|
+
|
|
3097
|
+
case 4:
|
|
3098
|
+
promises = [];
|
|
3099
|
+
promises.push(fetchValuation(new TokenAmount(PLYToken, rewardPerSecond.toString()), this._networkConnection.provider).then(function (res) {
|
|
3100
|
+
return rewardPerSecondValuation = res;
|
|
3101
|
+
}));
|
|
3102
|
+
promises.push(fetchValuation(new TokenAmount(AURPLYToken, stakedLiquidity.toString()), this._networkConnection.provider).then(function (res) {
|
|
3103
|
+
return totalStakeValuation = res;
|
|
3104
|
+
}));
|
|
3105
|
+
return _context3.abrupt("return", {
|
|
3106
|
+
totalStakedLiquidity: new TokenAmount(AURPLYToken, stakedLiquidity.toString()),
|
|
3107
|
+
apy: calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION)
|
|
3108
|
+
});
|
|
3109
|
+
|
|
3110
|
+
case 8:
|
|
3111
|
+
case "end":
|
|
3112
|
+
return _context3.stop();
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
}, _callee3, this);
|
|
3116
|
+
}));
|
|
3117
|
+
|
|
3118
|
+
function getPlyAuroraPoolDetails() {
|
|
3119
|
+
return _getPlyAuroraPoolDetails.apply(this, arguments);
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
return getPlyAuroraPoolDetails;
|
|
3123
|
+
}();
|
|
3124
|
+
|
|
3125
|
+
_proto.getTokenPrice = /*#__PURE__*/function () {
|
|
3126
|
+
var _getTokenPrice = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(token) {
|
|
3127
|
+
var price;
|
|
3128
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
3129
|
+
while (1) {
|
|
3130
|
+
switch (_context4.prev = _context4.next) {
|
|
3131
|
+
case 0:
|
|
3132
|
+
_context4.next = 2;
|
|
3133
|
+
return fetchPrice(token.address, this._networkConnection.provider);
|
|
3134
|
+
|
|
3135
|
+
case 2:
|
|
3136
|
+
price = _context4.sent;
|
|
3137
|
+
return _context4.abrupt("return", {
|
|
3138
|
+
currency: "USD",
|
|
3139
|
+
amount: price.toFixed(DECIMAL_PRECISION)
|
|
3140
|
+
});
|
|
3141
|
+
|
|
3142
|
+
case 4:
|
|
3143
|
+
case "end":
|
|
3144
|
+
return _context4.stop();
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
}, _callee4, this);
|
|
3148
|
+
}));
|
|
3149
|
+
|
|
3150
|
+
function getTokenPrice(_x2) {
|
|
3151
|
+
return _getTokenPrice.apply(this, arguments);
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
return getTokenPrice;
|
|
3155
|
+
}();
|
|
3156
|
+
|
|
3157
|
+
_proto.stakeBalanceOf = /*#__PURE__*/function () {
|
|
3158
|
+
var _stakeBalanceOf = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(user) {
|
|
3159
|
+
var userInfo;
|
|
3160
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
3161
|
+
while (1) {
|
|
3162
|
+
switch (_context5.prev = _context5.next) {
|
|
3163
|
+
case 0:
|
|
3164
|
+
_context5.next = 2;
|
|
3165
|
+
return this._auriFairLaunch.getUserInfo(AurPlyPid, user);
|
|
3166
|
+
|
|
3167
|
+
case 2:
|
|
3168
|
+
userInfo = _context5.sent;
|
|
3169
|
+
return _context5.abrupt("return", new TokenAmount(AURPLYToken, userInfo.amount.toString()));
|
|
3170
|
+
|
|
3171
|
+
case 4:
|
|
3172
|
+
case "end":
|
|
3173
|
+
return _context5.stop();
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
}, _callee5, this);
|
|
3177
|
+
}));
|
|
3178
|
+
|
|
3179
|
+
function stakeBalanceOf(_x3) {
|
|
3180
|
+
return _stakeBalanceOf.apply(this, arguments);
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
return stakeBalanceOf;
|
|
3184
|
+
}();
|
|
3185
|
+
|
|
3186
|
+
return SdkRead;
|
|
3187
|
+
}(BlockchainEntityRead);
|
|
3188
|
+
var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
|
|
3189
|
+
_inheritsLoose(SdkReadWrite, _SdkRead);
|
|
3190
|
+
|
|
3191
|
+
function SdkReadWrite() {
|
|
3192
|
+
return _SdkRead.apply(this, arguments) || this;
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3195
|
+
var _proto2 = SdkReadWrite.prototype;
|
|
3196
|
+
|
|
3197
|
+
_proto2.claim = /*#__PURE__*/function () {
|
|
3198
|
+
var _claim = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
|
|
3199
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
3200
|
+
while (1) {
|
|
3201
|
+
switch (_context6.prev = _context6.next) {
|
|
3202
|
+
case 0:
|
|
3203
|
+
_context6.t0 = this._auriLens.connect(this._networkConnection.signer);
|
|
3204
|
+
_context6.t1 = this._comptroller.address;
|
|
3205
|
+
_context6.t2 = this._auriFairLaunch.address;
|
|
3206
|
+
_context6.next = 5;
|
|
3207
|
+
return this._networkConnection.signer.getAddress();
|
|
3208
|
+
|
|
3209
|
+
case 5:
|
|
3210
|
+
_context6.t3 = _context6.sent;
|
|
3211
|
+
_context6.t4 = [AurPlyPid];
|
|
3212
|
+
return _context6.abrupt("return", _context6.t0.claimRewards.call(_context6.t0, _context6.t1, _context6.t2, _context6.t3, _context6.t4));
|
|
3213
|
+
|
|
3214
|
+
case 8:
|
|
3215
|
+
case "end":
|
|
3216
|
+
return _context6.stop();
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
}, _callee6, this);
|
|
3220
|
+
}));
|
|
3221
|
+
|
|
3222
|
+
function claim() {
|
|
3223
|
+
return _claim.apply(this, arguments);
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
return claim;
|
|
3227
|
+
}();
|
|
3228
|
+
|
|
3229
|
+
_proto2.stake = /*#__PURE__*/function () {
|
|
3230
|
+
var _stake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(amount) {
|
|
3231
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
3232
|
+
while (1) {
|
|
3233
|
+
switch (_context7.prev = _context7.next) {
|
|
3234
|
+
case 0:
|
|
3235
|
+
return _context7.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).deposit(AurPlyPid, amount.rawAmount(), false));
|
|
3236
|
+
|
|
3237
|
+
case 1:
|
|
3238
|
+
case "end":
|
|
3239
|
+
return _context7.stop();
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
}, _callee7, this);
|
|
3243
|
+
}));
|
|
3244
|
+
|
|
3245
|
+
function stake(_x4) {
|
|
3246
|
+
return _stake.apply(this, arguments);
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
return stake;
|
|
3250
|
+
}();
|
|
3251
|
+
|
|
3252
|
+
_proto2.unstake = /*#__PURE__*/function () {
|
|
3253
|
+
var _unstake = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(amount) {
|
|
3254
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
3255
|
+
while (1) {
|
|
3256
|
+
switch (_context8.prev = _context8.next) {
|
|
3257
|
+
case 0:
|
|
3258
|
+
return _context8.abrupt("return", this._auriFairLaunch.connect(this._networkConnection.signer).withdraw(AurPlyPid, amount.rawAmount()));
|
|
3259
|
+
|
|
3260
|
+
case 1:
|
|
3261
|
+
case "end":
|
|
3262
|
+
return _context8.stop();
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
}, _callee8, this);
|
|
3266
|
+
}));
|
|
3267
|
+
|
|
3268
|
+
function unstake(_x5) {
|
|
3269
|
+
return _unstake.apply(this, arguments);
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
return unstake;
|
|
3273
|
+
}();
|
|
3274
|
+
|
|
3275
|
+
return SdkReadWrite;
|
|
3276
|
+
}(SdkRead);
|
|
3277
|
+
var SDK = /*#__PURE__*/function (_BlockchainEntity) {
|
|
3278
|
+
_inheritsLoose(SDK, _BlockchainEntity);
|
|
3279
|
+
|
|
3280
|
+
function SDK() {
|
|
3281
|
+
return _BlockchainEntity.call(this) || this;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
var _proto3 = SDK.prototype;
|
|
3285
|
+
|
|
3286
|
+
_proto3.read = function read(networkConnection) {
|
|
3287
|
+
return new SdkRead(networkConnection);
|
|
3288
|
+
};
|
|
3289
|
+
|
|
3290
|
+
SDK.defaultProvider = function defaultProvider() {
|
|
3291
|
+
return new ethers$1.ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
|
|
3292
|
+
};
|
|
3293
|
+
|
|
3294
|
+
return SDK;
|
|
3295
|
+
}(BlockchainEntity);
|
|
3296
|
+
|
|
3297
|
+
var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
|
|
3298
|
+
var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
|
|
3299
|
+
var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
|
|
3300
|
+
var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
|
|
3301
|
+
var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
|
|
3302
|
+
var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
|
|
3303
|
+
var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
|
|
3304
|
+
var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
|
|
3305
|
+
var dummyUserMarketDetails = {
|
|
3306
|
+
market: dummyMarketAddress,
|
|
3307
|
+
depositBalance: dummyTokenAmount2,
|
|
3308
|
+
borrowBalance: dummyZeroTokenAmount,
|
|
3309
|
+
isCollateral: true,
|
|
3310
|
+
maxWithdrawableAmount: dummyTokenAmount
|
|
3311
|
+
};
|
|
3312
|
+
|
|
3313
|
+
exports.AURORA_CHAINID = AURORA_CHAINID;
|
|
3314
|
+
exports.AURPLYToken = AURPLYToken;
|
|
1441
3315
|
exports.AVAX_DEFAULT_PROVIDER = AVAX_DEFAULT_PROVIDER;
|
|
1442
3316
|
exports.AVAX_DEFAULT_PROVIDER_URL = AVAX_DEFAULT_PROVIDER_URL;
|
|
1443
3317
|
exports.AVAX_DEFAULT_SIGNER = AVAX_DEFAULT_SIGNER;
|
|
3318
|
+
exports.AurPlyPid = AurPlyPid;
|
|
3319
|
+
exports.BORROW_LIMIT_BUFFER = BORROW_LIMIT_BUFFER;
|
|
1444
3320
|
exports.BlockchainEntity = BlockchainEntity;
|
|
1445
3321
|
exports.BlockchainEntityRead = BlockchainEntityRead;
|
|
1446
3322
|
exports.BlockchainEntityReadWrite = BlockchainEntityReadWrite;
|
|
1447
|
-
exports.
|
|
3323
|
+
exports.DECIMAL_PRECISION = DECIMAL_PRECISION;
|
|
3324
|
+
exports.ETHAddress = ETHAddress;
|
|
1448
3325
|
exports.MoneyMarket = MoneyMarket;
|
|
1449
3326
|
exports.MoneyMarketRead = MoneyMarketRead;
|
|
1450
3327
|
exports.MoneyMarketReadWrite = MoneyMarketReadWrite;
|
|
3328
|
+
exports.ONE_DAY = ONE_DAY;
|
|
3329
|
+
exports.ONE_YEAR = ONE_YEAR;
|
|
3330
|
+
exports.PLYToken = PLYToken;
|
|
3331
|
+
exports.REWARDCLAIMSTART = REWARDCLAIMSTART;
|
|
1451
3332
|
exports.SDK = SDK;
|
|
1452
3333
|
exports.SdkRead = SdkRead;
|
|
1453
3334
|
exports.SdkReadWrite = SdkReadWrite;
|
|
3335
|
+
exports.Token = Token;
|
|
3336
|
+
exports.TokenAmount = TokenAmount;
|
|
3337
|
+
exports.calcLMRewardApr = calcLMRewardApr;
|
|
3338
|
+
exports.decimalFactor = decimalFactor;
|
|
3339
|
+
exports.dummyAddress = dummyAddress;
|
|
1454
3340
|
exports.dummyMarketAddress = dummyMarketAddress;
|
|
1455
3341
|
exports.dummyPly = dummyPly;
|
|
1456
3342
|
exports.dummyPlyAurora = dummyPlyAurora;
|
|
@@ -1460,6 +3346,18 @@ exports.dummyTokenAmount2 = dummyTokenAmount2;
|
|
|
1460
3346
|
exports.dummyTokenAmount3 = dummyTokenAmount3;
|
|
1461
3347
|
exports.dummyUserMarketDetails = dummyUserMarketDetails;
|
|
1462
3348
|
exports.dummyZeroTokenAmount = dummyZeroTokenAmount;
|
|
3349
|
+
exports.fetchLPPositions = fetchLPPositions;
|
|
3350
|
+
exports.fetchLPPrice = fetchLPPrice;
|
|
3351
|
+
exports.fetchPrice = fetchPrice;
|
|
3352
|
+
exports.fetchPriceFromCoingecko = fetchPriceFromCoingecko;
|
|
3353
|
+
exports.fetchPriceFromCoingeckoAPI = fetchPriceFromCoingeckoAPI;
|
|
3354
|
+
exports.fetchPriceFromOracle = fetchPriceFromOracle;
|
|
3355
|
+
exports.fetchUnderlyingTokensPrices = fetchUnderlyingTokensPrices;
|
|
3356
|
+
exports.fetchValuation = fetchValuation;
|
|
1463
3357
|
exports.formatObject = formatObject;
|
|
1464
|
-
exports.
|
|
3358
|
+
exports.getCurrentTimestamp = getCurrentTimestamp;
|
|
3359
|
+
exports.getDecimal = getDecimal;
|
|
3360
|
+
exports.isSameAddress = isSameAddress;
|
|
3361
|
+
exports.networkAddresses = networkAddresses;
|
|
3362
|
+
exports.validateAndParseAddress = validateAndParseAddress;
|
|
1465
3363
|
//# sourceMappingURL=sdk.cjs.development.js.map
|