@gearbox-protocol/sdk 13.6.0-apy-plugin.2 → 13.6.0-apy-plugin.4
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.
|
@@ -148,8 +148,9 @@ class ApyPlugin extends import_sdk.BasePlugin {
|
|
|
148
148
|
for (const market of markets) {
|
|
149
149
|
const pool = market.pool.pool;
|
|
150
150
|
const poolAddr = pool.address.toLowerCase();
|
|
151
|
+
const underlyingLc = pool.underlying.toLowerCase();
|
|
151
152
|
const depositAPY = (0, import_formatter.rayToNumber)(pool.supplyRate) * Number(import_sdk.PERCENTAGE_DECIMALS);
|
|
152
|
-
const underlyingAPY = apy.apyList?.[pool.underlying] ?? 0;
|
|
153
|
+
const underlyingAPY = apy.apyList?.[underlyingLc] ?? apy.apyList?.[pool.underlying] ?? 0;
|
|
153
154
|
const lookupAddresses = this.#getExtraAPYLookupAddresses(poolAddr);
|
|
154
155
|
const extraAPY = (0, import_pool_apy_utils.getPoolExtraAPY)(lookupAddresses, apy.poolExtraAPYList);
|
|
155
156
|
const currentExternalList = apy.poolExternalAPYList?.[poolAddr];
|
|
@@ -178,7 +179,7 @@ class ApyPlugin extends import_sdk.BasePlugin {
|
|
|
178
179
|
tokensList: this.sdk.tokensMeta
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
|
-
return { data, data7DAgo, points };
|
|
182
|
+
return { data, data7DAgo, pointsBase: poolPointsBase, points };
|
|
182
183
|
}
|
|
183
184
|
// ---------------------------------------------------------------------------
|
|
184
185
|
// Plugin lifecycle
|
|
@@ -138,8 +138,9 @@ class ApyPlugin extends BasePlugin {
|
|
|
138
138
|
for (const market of markets) {
|
|
139
139
|
const pool = market.pool.pool;
|
|
140
140
|
const poolAddr = pool.address.toLowerCase();
|
|
141
|
+
const underlyingLc = pool.underlying.toLowerCase();
|
|
141
142
|
const depositAPY = rayToNumber(pool.supplyRate) * Number(PERCENTAGE_DECIMALS);
|
|
142
|
-
const underlyingAPY = apy.apyList?.[pool.underlying] ?? 0;
|
|
143
|
+
const underlyingAPY = apy.apyList?.[underlyingLc] ?? apy.apyList?.[pool.underlying] ?? 0;
|
|
143
144
|
const lookupAddresses = this.#getExtraAPYLookupAddresses(poolAddr);
|
|
144
145
|
const extraAPY = getPoolExtraAPY(lookupAddresses, apy.poolExtraAPYList);
|
|
145
146
|
const currentExternalList = apy.poolExternalAPYList?.[poolAddr];
|
|
@@ -168,7 +169,7 @@ class ApyPlugin extends BasePlugin {
|
|
|
168
169
|
tokensList: this.sdk.tokensMeta
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
|
-
return { data, data7DAgo, points };
|
|
172
|
+
return { data, data7DAgo, pointsBase: poolPointsBase, points };
|
|
172
173
|
}
|
|
173
174
|
// ---------------------------------------------------------------------------
|
|
174
175
|
// Plugin lifecycle
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { ExternalApy as ExternalApySDK, PoolExtraApy, PoolPointsInfo } from "../../rewards/apy/index.js";
|
|
3
|
+
import type { PoolPointsBase } from "../../rewards/index.js";
|
|
3
4
|
export interface PoolBaseAPY {
|
|
4
5
|
type: "supplyAPY" | "tokenYield";
|
|
5
6
|
apy: number;
|
|
@@ -34,6 +35,7 @@ type AllPoolsPoints = Record<Address, PoolPointsWithTips[] | undefined>;
|
|
|
34
35
|
export interface GetPoolsAPYResult {
|
|
35
36
|
data: AllPoolsAPY;
|
|
36
37
|
data7DAgo: AllPoolsAPY7DAgo;
|
|
38
|
+
pointsBase: PoolPointsBase;
|
|
37
39
|
points: AllPoolsPoints;
|
|
38
40
|
}
|
|
39
41
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { ExternalApy, PoolExtraApy } from "../../rewards/apy/index.js";
|
|
3
3
|
import type { PoolPointsBase } from "../../rewards/rewards/extra-apy.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { AddressMap } from "../../sdk/index.js";
|
|
5
5
|
import type { PoolFullAPY, PoolFullAPY7DAgo, PoolPointsWithTips } from "./pool-apy-types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Collects extra APY entries for the given token addresses from the
|
|
@@ -61,7 +61,9 @@ export declare function calculatePoolFullAPY7DAgo({ supplyAPY7DAgo, depositAPY,
|
|
|
61
61
|
interface CalculatePoolPointsProps {
|
|
62
62
|
poolTokenSymbol: string | undefined;
|
|
63
63
|
points: PoolPointsBase[Address] | undefined;
|
|
64
|
-
tokensList:
|
|
64
|
+
tokensList: AddressMap<{
|
|
65
|
+
decimals: number;
|
|
66
|
+
}>;
|
|
65
67
|
}
|
|
66
68
|
/**
|
|
67
69
|
* Transforms raw `PoolPointsBase` entries into consumer-friendly
|