impermax-sdk 2.1.300 → 2.1.301
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.
|
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const offchainAccountVault_1 = __importDefault(require("./vault/offchainAccountVault"));
|
|
7
7
|
const offchainTypes_1 = require("../offchainTypes");
|
|
8
|
+
// NOTE: Skipping supply positions earnings from blacklisted pools
|
|
9
|
+
// TODO: Vault earnings the same, move vault whitelist to sdk
|
|
8
10
|
class OffchainAccount {
|
|
9
11
|
constructor(offchain, account) {
|
|
10
12
|
this.getOffchain = () => this.offchain;
|
|
@@ -150,6 +152,9 @@ class OffchainAccount {
|
|
|
150
152
|
// Get pools of this factory
|
|
151
153
|
for (const poolAddress of poolsOfFactory) {
|
|
152
154
|
const pool = await this.getLendingPool(factory, poolAddress);
|
|
155
|
+
// Don't take into account earnings with blacklisted pools
|
|
156
|
+
if (pool.getLendingPool().isBlacklisted())
|
|
157
|
+
continue;
|
|
153
158
|
// Get earnings from both borrowables
|
|
154
159
|
const [earningsA, earningsB] = await Promise.all([
|
|
155
160
|
pool.getBorrowableA().getEarningsUSD(),
|
|
@@ -171,6 +176,9 @@ class OffchainAccount {
|
|
|
171
176
|
// Get pools of this factory
|
|
172
177
|
for (const poolAddress of poolsOfFactory) {
|
|
173
178
|
const pool = await this.getLendingPool(factory, poolAddress);
|
|
179
|
+
// Don't take into account earnings with blacklisted pools
|
|
180
|
+
if (pool.getLendingPool().isBlacklisted())
|
|
181
|
+
continue;
|
|
174
182
|
// Get yearly yield = value * APR
|
|
175
183
|
const [valueA, valueB, aprA, aprB] = await Promise.all([
|
|
176
184
|
pool.getBorrowableA().getValue(),
|