@aurigami/sdk 1.9.3 → 1.9.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/SDK.d.ts +1 -1
- package/dist/interactors/misc.d.ts +1 -1
- package/dist/sdk.cjs.development.js +26 -17
- 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 +26 -17
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/SDK.ts +3 -2
- package/src/interactors/MoneyMarket.ts +8 -4
- package/src/interactors/misc.ts +3 -3
package/package.json
CHANGED
package/src/SDK.ts
CHANGED
|
@@ -86,9 +86,10 @@ export class SdkRead extends BlockchainEntityRead {
|
|
|
86
86
|
|
|
87
87
|
public async sneakAccounts(
|
|
88
88
|
accounts: string[],
|
|
89
|
-
tokenAddresses: string[]
|
|
89
|
+
tokenAddresses: string[],
|
|
90
|
+
dust: BigNumber = new BigNumber(0.1)
|
|
90
91
|
): Promise<types.AccountAuTokensInfo[]> {
|
|
91
|
-
return this._misc.sneakAccounts(accounts, tokenAddresses);
|
|
92
|
+
return this._misc.sneakAccounts(accounts, tokenAddresses, dust);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -4,6 +4,7 @@ import BigNumber from 'bignumber.js';
|
|
|
4
4
|
import { BigNumber as BN, Contract } from 'ethers';
|
|
5
5
|
import * as abis from '../abis';
|
|
6
6
|
import * as consts from '../consts';
|
|
7
|
+
import { ONE_DAY } from '../consts';
|
|
7
8
|
import {
|
|
8
9
|
AuriEnv,
|
|
9
10
|
BlockchainEntity,
|
|
@@ -74,16 +75,19 @@ export class MoneyMarketRead extends BlockchainEntityRead {
|
|
|
74
75
|
|
|
75
76
|
public async getDepositAPY(): Promise<BigNumber> {
|
|
76
77
|
const supplyRatePerTimestamp = await this.auToken.supplyRatePerTimestamp();
|
|
77
|
-
|
|
78
|
-
.multipliedBy(
|
|
78
|
+
const supplyRatePerDay = new BigNumber(supplyRatePerTimestamp.toString())
|
|
79
|
+
.multipliedBy(ONE_DAY)
|
|
79
80
|
.div(helpers.decimalFactor(18));
|
|
81
|
+
|
|
82
|
+
return new BigNumber(supplyRatePerDay.plus(1)).pow(365).minus(1);
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
public async getBorrowAPY(): Promise<BigNumber> {
|
|
83
86
|
const borrowRatePerTimestamp = await this.auToken.borrowRatePerTimestamp();
|
|
84
|
-
|
|
85
|
-
.multipliedBy(
|
|
87
|
+
const borrowRatePerDay = new BigNumber(borrowRatePerTimestamp.toString())
|
|
88
|
+
.multipliedBy(ONE_DAY)
|
|
86
89
|
.div(helpers.decimalFactor(18));
|
|
90
|
+
return new BigNumber(borrowRatePerDay.plus(1)).pow(365).minus(1);
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
public async getCollateralRatio(): Promise<BigNumber> {
|
package/src/interactors/misc.ts
CHANGED
|
@@ -279,10 +279,10 @@ export class MiscRead extends BlockchainEntityRead {
|
|
|
279
279
|
|
|
280
280
|
public async sneakAccounts(
|
|
281
281
|
accounts: string[],
|
|
282
|
-
tokenAddresses: string[]
|
|
282
|
+
tokenAddresses: string[],
|
|
283
|
+
dust: BigNumber = new BigNumber(0.1)
|
|
283
284
|
): Promise<types.AccountAuTokensInfo[]> {
|
|
284
285
|
const _1E18 = BN.from(10).pow(18);
|
|
285
|
-
const dust = new BigNumber(0.1);
|
|
286
286
|
const oracle = this.env.getContract<PriceOracle>(
|
|
287
287
|
consts.networkAddresses.misc.oracle,
|
|
288
288
|
abis.AuriOracleABI.abi
|
|
@@ -305,7 +305,7 @@ export class MiscRead extends BlockchainEntityRead {
|
|
|
305
305
|
let balR = new BigNumber(bal.toString()).dividedBy(_1E18.toString());
|
|
306
306
|
let borR = new BigNumber(bor.toString()).dividedBy(_1E18.toString());
|
|
307
307
|
|
|
308
|
-
if (balR.
|
|
308
|
+
if (balR.lte(dust) && borR.lte(dust)) continue;
|
|
309
309
|
|
|
310
310
|
infos.push({
|
|
311
311
|
token: getSymbol(tokenAddresses[i]),
|