@aurigami/sdk 0.3.4 → 0.3.5
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/priceFetcher.d.ts +4 -1
- package/dist/sdk.cjs.development.js +8 -11
- 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 +8 -11
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/MoneyMarket.ts +1 -1
- package/src/SDK.ts +12 -4
- package/src/dummy.ts +1 -0
- package/src/priceFetcher.ts +6 -3
package/dist/priceFetcher.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare function fetchLPPositions(LPAddress: Address, provider: providers
|
|
|
13
13
|
}>;
|
|
14
14
|
export declare function fetchLPPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
|
|
15
15
|
export declare function fetchPriceFromOracle(auTokenAddress: Address, underlyingDecimal: number, provider: providers.Provider): Promise<BigNumber>;
|
|
16
|
-
export declare function fetchUnderlyingTokensPrices(provider: providers.Provider): Promise<
|
|
16
|
+
export declare function fetchUnderlyingTokensPrices(provider: providers.Provider): Promise<{
|
|
17
|
+
auToken: string;
|
|
18
|
+
underlyingPrice: BigNumber;
|
|
19
|
+
}[]>;
|
|
17
20
|
export declare function fetchPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
|
|
18
21
|
export declare function fetchValuation(tokenAmount: TokenAmount, provider: providers.Provider, price?: BigNumber): Promise<BigNumber>;
|
|
@@ -2009,12 +2009,6 @@ var IUniswapV2PairABI = {
|
|
|
2009
2009
|
deployedLinkReferences: deployedLinkReferences
|
|
2010
2010
|
};
|
|
2011
2011
|
|
|
2012
|
-
var abi$2 = [
|
|
2013
|
-
];
|
|
2014
|
-
var dummyABI = {
|
|
2015
|
-
abi: abi$2
|
|
2016
|
-
};
|
|
2017
|
-
|
|
2018
2012
|
var axios = /*#__PURE__*/require('axios');
|
|
2019
2013
|
|
|
2020
2014
|
function fetchPriceFromCoingeckoAPI(_x) {
|
|
@@ -2214,7 +2208,7 @@ function _fetchUnderlyingTokensPrices() {
|
|
|
2214
2208
|
while (1) {
|
|
2215
2209
|
switch (_context6.prev = _context6.next) {
|
|
2216
2210
|
case 0:
|
|
2217
|
-
auriLens = new ethers$1.Contract(networkAddresses.misc.AURILENS,
|
|
2211
|
+
auriLens = new ethers$1.Contract(networkAddresses.misc.AURILENS, AuriLensABI.abi, provider);
|
|
2218
2212
|
auTokenAddresses = networkAddresses.auTokens.map(function (auToken) {
|
|
2219
2213
|
return auToken.address;
|
|
2220
2214
|
});
|
|
@@ -3002,7 +2996,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3002
2996
|
var _getUserDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(userAddress) {
|
|
3003
2997
|
var _this2 = this;
|
|
3004
2998
|
|
|
3005
|
-
var marketCount, userMarketDetails, assetsIn, promises, totalBorrowLimit, pricePromises, _loop2, _iterator, _step, underlyingPrices, depositValuationPromises, _loop, i, depositValues, accountLiquidity, rewardBalancesMetadata, lockedAmount, values, borrowedvaluation, bufferedBorrowLimit, borrowableAmount, auToken, moneyMarket;
|
|
2999
|
+
var marketCount, userMarketDetails, assetsIn, promises, totalBorrowLimit, pricePromises, _loop2, _iterator, _step, underlyingPrices, depositValuationPromises, _loop, i, depositValues, accountLiquidity, rewardBalancesMetadata, lockedAmount, values, borrowedvaluation, bufferedBorrowLimit, minimumBorrowLimitAllowed, borrowableAmount, auToken, moneyMarket, maxWithdrawCap;
|
|
3006
3000
|
|
|
3007
3001
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
3008
3002
|
while (1) {
|
|
@@ -3091,6 +3085,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3091
3085
|
lockedAmount = values[2];
|
|
3092
3086
|
borrowedvaluation = totalBorrowLimit.minus(new BigNumber(accountLiquidity[1].toString()).div(decimalFactor(18)));
|
|
3093
3087
|
bufferedBorrowLimit = totalBorrowLimit.multipliedBy(BORROW_LIMIT_BUFFER);
|
|
3088
|
+
minimumBorrowLimitAllowed = borrowedvaluation.div(BORROW_LIMIT_BUFFER);
|
|
3094
3089
|
|
|
3095
3090
|
if (bufferedBorrowLimit.lte(borrowedvaluation)) {
|
|
3096
3091
|
borrowableAmount = new BigNumber(0);
|
|
@@ -3101,7 +3096,8 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3101
3096
|
for (i = 0; i < marketCount; i++) {
|
|
3102
3097
|
auToken = networkAddresses.auTokens[i];
|
|
3103
3098
|
moneyMarket = new MoneyMarketRead(this._networkConnection, auToken.address, auToken.underlying);
|
|
3104
|
-
|
|
3099
|
+
maxWithdrawCap = totalBorrowLimit.minus(minimumBorrowLimitAllowed).div(userMarketDetails[i].collateralRatio).div(underlyingPrices[i]);
|
|
3100
|
+
userMarketDetails[i].maxWithdrawableAmount = userMarketDetails[i].isCollateral && maxWithdrawCap.lt(userMarketDetails[i].depositBalance.formattedAmount()) ? new TokenAmount(moneyMarket.underlying, maxWithdrawCap.toFixed(24), false) : new TokenAmount(moneyMarket.underlying, userMarketDetails[i].depositBalance.rawAmount());
|
|
3105
3101
|
}
|
|
3106
3102
|
|
|
3107
3103
|
return _context2.abrupt("return", {
|
|
@@ -3118,7 +3114,7 @@ var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
|
|
|
3118
3114
|
}
|
|
3119
3115
|
});
|
|
3120
3116
|
|
|
3121
|
-
case
|
|
3117
|
+
case 36:
|
|
3122
3118
|
case "end":
|
|
3123
3119
|
return _context2.stop();
|
|
3124
3120
|
}
|
|
@@ -3356,7 +3352,8 @@ var dummyUserMarketDetails = {
|
|
|
3356
3352
|
depositBalance: dummyTokenAmount2,
|
|
3357
3353
|
borrowBalance: dummyZeroTokenAmount,
|
|
3358
3354
|
isCollateral: true,
|
|
3359
|
-
maxWithdrawableAmount: dummyTokenAmount
|
|
3355
|
+
maxWithdrawableAmount: dummyTokenAmount,
|
|
3356
|
+
collateralRatio: 0.5
|
|
3360
3357
|
};
|
|
3361
3358
|
|
|
3362
3359
|
exports.AURORA_CHAINID = AURORA_CHAINID;
|