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