@aurigami/sdk 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.cjs.development.js +9 -3
- 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 +9 -3
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/SDK.ts +6 -1
- package/src/dummy.ts +2 -1
- package/src/priceFetcher.ts +1 -1
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -104,7 +104,12 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
104
104
|
promises.push(this._tokenLock.lockedAmounts(userAddress));
|
|
105
105
|
var values = await Promise.all(promises);
|
|
106
106
|
accountLiquidity = values[0]; rewardBalancesMetadata = values[1]; lockedAmount = values[2];
|
|
107
|
-
|
|
107
|
+
var borrowedvaluation: BigNumber = totalBorrowLimit.minus(new BigNumber(accountLiquidity[1].toString()).div(decimalFactor(18)));
|
|
108
|
+
|
|
109
|
+
if (borrowedvaluation.lt("0.00001")) { // Igore dust, dust could be the result of network delay causing collateral valuation calc to be different on vs off chain
|
|
110
|
+
borrowedvaluation = new BigNumber(0);
|
|
111
|
+
}
|
|
112
|
+
|
|
108
113
|
const bufferedBorrowLimit: BigNumber = totalBorrowLimit.multipliedBy(BORROW_LIMIT_BUFFER);
|
|
109
114
|
const minimumBorrowLimitAllowed = borrowedvaluation.div(BORROW_LIMIT_BUFFER);
|
|
110
115
|
|
package/src/dummy.ts
CHANGED
package/src/priceFetcher.ts
CHANGED
|
@@ -106,7 +106,7 @@ export async function fetchPrice(address: Address, provider: providers.Provider)
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
export async function fetchValuation(tokenAmount: TokenAmount, provider: providers.Provider, price?: BigNumber): Promise<BigNumber> {
|
|
109
|
-
if (price ===
|
|
109
|
+
if (price === undefined) {
|
|
110
110
|
price = await fetchPrice(tokenAmount.token.address, provider);
|
|
111
111
|
}
|
|
112
112
|
return new BigNumber(tokenAmount.formattedAmount()).multipliedBy(price!);
|