@varla/sdk 1.1.0 → 1.2.0
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/events/decode.d.ts +14 -0
- package/dist/events/decode.d.ts.map +1 -0
- package/dist/events/decode.js +26 -0
- package/dist/events/defs.d.ts +24 -0
- package/dist/events/defs.d.ts.map +1 -0
- package/dist/events/defs.js +61 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -0
- package/dist/events/oracleRegistrySync.d.ts +6 -6
- package/dist/events/oracleRegistrySync.d.ts.map +1 -1
- package/dist/events/oracleRegistrySync.js +94 -30
- package/dist/events/recent.d.ts +19 -0
- package/dist/events/recent.d.ts.map +1 -0
- package/dist/events/recent.js +24 -0
- package/dist/format.d.ts +36 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/views/accessManager.d.ts +124 -0
- package/dist/views/accessManager.d.ts.map +1 -0
- package/dist/views/accessManager.js +178 -0
- package/dist/views/admin.d.ts +13606 -0
- package/dist/views/admin.d.ts.map +1 -0
- package/dist/views/admin.js +25 -0
- package/dist/views/core.d.ts +150 -0
- package/dist/views/core.d.ts.map +1 -1
- package/dist/views/core.js +156 -0
- package/dist/views/index.d.ts +3 -0
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +3 -0
- package/dist/views/liquidators.d.ts +40 -0
- package/dist/views/liquidators.d.ts.map +1 -0
- package/dist/views/liquidators.js +20 -0
- package/dist/views/oracle.d.ts +50 -0
- package/dist/views/oracle.d.ts.map +1 -1
- package/dist/views/oracle.js +72 -0
- package/dist/views/pool.d.ts +43 -8
- package/dist/views/pool.d.ts.map +1 -1
- package/dist/views/pool.js +27 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.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G,OAAO,CAAC,OAAO,CAAC,CAEnB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Note: explicit .js extension is required for Node ESM resolution.
|
|
2
|
+
import { getContract } from "viem";
|
|
3
|
+
import { abis } from "../generated.js";
|
|
4
|
+
export async function readInterestRateStrategyBasics(params) {
|
|
5
|
+
const [pool, rateParams] = await Promise.all([
|
|
6
|
+
params.strategy.read.pool(),
|
|
7
|
+
params.strategy.read.getRateParams(),
|
|
8
|
+
]);
|
|
9
|
+
return { pool, rateParams };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convenience: some deployments may not export `interestRateStrategy` via the SDK addressbook.
|
|
13
|
+
* This resolves it from the pool, then returns a typed readonly contract.
|
|
14
|
+
*/
|
|
15
|
+
export async function getInterestRateStrategyFromPool(params) {
|
|
16
|
+
const address = await params.pool.read.interestRateStrategy();
|
|
17
|
+
return getContract({
|
|
18
|
+
address,
|
|
19
|
+
abi: abis.VARLAINTERESTRATESTRATEGY_ABI,
|
|
20
|
+
client: params.client,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export async function readProxyAdminPaused(params) {
|
|
24
|
+
return params.proxyAdmin.read.paused();
|
|
25
|
+
}
|
package/dist/views/core.d.ts
CHANGED
|
@@ -30,4 +30,154 @@ export declare function readAccountPositions(params: {
|
|
|
30
30
|
positionIds: bigint[];
|
|
31
31
|
balances: bigint[];
|
|
32
32
|
}>;
|
|
33
|
+
export type ReadHealthFactor = {
|
|
34
|
+
healthFactor: bigint;
|
|
35
|
+
canBeLiquidated: boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Read the user's health factor and whether liquidation is currently allowed.
|
|
39
|
+
*
|
|
40
|
+
* Normalizes `VarlaCore.getHealthFactor(user)` tuple return.
|
|
41
|
+
*/
|
|
42
|
+
export declare function readHealthFactor(params: {
|
|
43
|
+
core: {
|
|
44
|
+
read: {
|
|
45
|
+
getHealthFactor: (args: readonly [Address]) => Promise<unknown>;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
user: Address;
|
|
49
|
+
}): Promise<ReadHealthFactor>;
|
|
50
|
+
export type ReadLiquidationConfig = {
|
|
51
|
+
targetHealthFactor: bigint;
|
|
52
|
+
healthFactorForMaxBonus: bigint;
|
|
53
|
+
liquidationBonusFactorBps: bigint;
|
|
54
|
+
dustThreshold: bigint;
|
|
55
|
+
collateralDustThreshold: bigint;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Normalized wrapper over `VarlaCore.getLiquidationConfig()`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function readLiquidationConfig(params: {
|
|
61
|
+
core: {
|
|
62
|
+
read: {
|
|
63
|
+
getLiquidationConfig: () => Promise<unknown>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}): Promise<ReadLiquidationConfig>;
|
|
67
|
+
export type ReadDefaultLtvConfig = {
|
|
68
|
+
conservative: bigint;
|
|
69
|
+
moderate: bigint;
|
|
70
|
+
risk: bigint;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Normalized wrapper over `VarlaCore.getDefaultLtvConfig()`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function readDefaultLtvConfig(params: {
|
|
76
|
+
core: {
|
|
77
|
+
read: {
|
|
78
|
+
getDefaultLtvConfig: () => Promise<unknown>;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
}): Promise<ReadDefaultLtvConfig>;
|
|
82
|
+
export type ReadTierLiquidationConfig = {
|
|
83
|
+
tier: number;
|
|
84
|
+
maxLiquidationBonusBps: bigint;
|
|
85
|
+
liquidationFeeBps: bigint;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Normalized wrapper over `VarlaCore.getTierLiquidationConfig(tier)`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function readTierLiquidationConfig(params: {
|
|
91
|
+
core: {
|
|
92
|
+
read: {
|
|
93
|
+
getTierLiquidationConfig: (args: readonly [number]) => Promise<unknown>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
tier: number;
|
|
97
|
+
}): Promise<ReadTierLiquidationConfig>;
|
|
98
|
+
export type ReadLiquidationParamsForPosition = {
|
|
99
|
+
positionId: bigint;
|
|
100
|
+
maxLiquidationBonusBps: bigint;
|
|
101
|
+
liquidationFeeBps: bigint;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Normalized wrapper over `VarlaCore.getLiquidationParamsForPosition(positionId)`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function readLiquidationParamsForPosition(params: {
|
|
107
|
+
core: {
|
|
108
|
+
read: {
|
|
109
|
+
getLiquidationParamsForPosition: (args: readonly [bigint]) => Promise<unknown>;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
positionId: bigint;
|
|
113
|
+
}): Promise<ReadLiquidationParamsForPosition>;
|
|
114
|
+
export type ReadPositionLtvOverride = {
|
|
115
|
+
positionId: bigint;
|
|
116
|
+
isSet: boolean;
|
|
117
|
+
ltv: bigint;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Normalized wrapper over `VarlaCore.getPositionLtvOverride(positionId)`.
|
|
121
|
+
*/
|
|
122
|
+
export declare function readPositionLtvOverride(params: {
|
|
123
|
+
core: {
|
|
124
|
+
read: {
|
|
125
|
+
getPositionLtvOverride: (args: readonly [bigint]) => Promise<unknown>;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
positionId: bigint;
|
|
129
|
+
}): Promise<ReadPositionLtvOverride>;
|
|
130
|
+
/**
|
|
131
|
+
* Thin wrapper over `VarlaCore.getLtvForPosition(positionId)`.
|
|
132
|
+
*
|
|
133
|
+
* This is the *effective* LTV for the position (includes early-closure factor and overrides).
|
|
134
|
+
*/
|
|
135
|
+
export declare function readLtvForPosition(params: {
|
|
136
|
+
core: {
|
|
137
|
+
read: {
|
|
138
|
+
getLtvForPosition: (args: readonly [bigint]) => Promise<bigint>;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
positionId: bigint;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
positionId: bigint;
|
|
144
|
+
ltvWad: bigint;
|
|
145
|
+
}>;
|
|
146
|
+
/**
|
|
147
|
+
* Thin wrapper over `VarlaCore.getLiquidationBonusBps(positionId, healthFactor)`.
|
|
148
|
+
*/
|
|
149
|
+
export declare function readLiquidationBonusBps(params: {
|
|
150
|
+
core: {
|
|
151
|
+
read: {
|
|
152
|
+
getLiquidationBonusBps: (args: readonly [bigint, bigint]) => Promise<bigint>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
positionId: bigint;
|
|
156
|
+
healthFactor: bigint;
|
|
157
|
+
}): Promise<{
|
|
158
|
+
positionId: bigint;
|
|
159
|
+
healthFactor: bigint;
|
|
160
|
+
bonusBps: bigint;
|
|
161
|
+
}>;
|
|
162
|
+
export type ReadManyLiquidationBonusBpsRow = {
|
|
163
|
+
positionId: bigint;
|
|
164
|
+
/** bonusesBps aligned to input `healthFactors` order */
|
|
165
|
+
bonusesBps: bigint[];
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Computes a (positionIds × healthFactors) grid of liquidation bonuses.
|
|
169
|
+
*
|
|
170
|
+
* Useful for UIs that need to visualize liquidation incentive curves.
|
|
171
|
+
*/
|
|
172
|
+
export declare function readManyLiquidationBonusBps(params: {
|
|
173
|
+
core: {
|
|
174
|
+
address: Address;
|
|
175
|
+
};
|
|
176
|
+
client: {
|
|
177
|
+
multicall: (args: any) => Promise<any>;
|
|
178
|
+
};
|
|
179
|
+
positionIds: readonly bigint[];
|
|
180
|
+
healthFactors: readonly bigint[];
|
|
181
|
+
chunkSize?: number;
|
|
182
|
+
}): Promise<ReadManyLiquidationBonusBpsRow[]>;
|
|
33
183
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/views/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/views/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,MAAM,EAAE;IAChD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,iBAAiB,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;SACnE,CAAC;KACH,CAAC;IACF,IAAI,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAyB/B;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,IAAI,EAAE;QACJ,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE;YACJ,cAAc,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;SAC1E,CAAC;KACH,CAAC;IACF,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;KACxC,CAAC;IACF,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA8BzD"}
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/views/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,M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,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAGlD;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,sBAAsB,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;SAC9E,CAAC;KACH,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAM1E;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,2BAA2B,CAAC,MAAM,EAAE;IACxD,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3B,MAAM,EAAE;QAAE,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;IACnD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,8BAA8B,EAAE,CAAC,CA2C5C"}
|
package/dist/views/core.js
CHANGED
|
@@ -48,3 +48,159 @@ export async function readAccountPositions(params) {
|
|
|
48
48
|
}
|
|
49
49
|
return { positionIds, balances };
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Read the user's health factor and whether liquidation is currently allowed.
|
|
53
|
+
*
|
|
54
|
+
* Normalizes `VarlaCore.getHealthFactor(user)` tuple return.
|
|
55
|
+
*/
|
|
56
|
+
export async function readHealthFactor(params) {
|
|
57
|
+
const raw = await params.core.read.getHealthFactor([params.user]);
|
|
58
|
+
const r = raw;
|
|
59
|
+
const healthFactor = r.healthFactor ?? r[0];
|
|
60
|
+
const canBeLiquidated = r.canBeLiquidated ?? r[1];
|
|
61
|
+
if (typeof healthFactor !== "bigint" || typeof canBeLiquidated !== "boolean") {
|
|
62
|
+
throw new Error("Unexpected getHealthFactor() return shape");
|
|
63
|
+
}
|
|
64
|
+
return { healthFactor, canBeLiquidated };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Normalized wrapper over `VarlaCore.getLiquidationConfig()`.
|
|
68
|
+
*/
|
|
69
|
+
export async function readLiquidationConfig(params) {
|
|
70
|
+
const raw = await params.core.read.getLiquidationConfig();
|
|
71
|
+
const r = raw;
|
|
72
|
+
const targetHealthFactor = r.targetHealthFactor ?? r[0];
|
|
73
|
+
const healthFactorForMaxBonus = r.healthFactorForMaxBonus ?? r[1];
|
|
74
|
+
const liquidationBonusFactorBps = r.liquidationBonusFactorBps ?? r[2];
|
|
75
|
+
const dustThreshold = r.dustThreshold ?? r[3];
|
|
76
|
+
const collateralDustThreshold = r.collateralDustThreshold ?? r[4];
|
|
77
|
+
if (typeof targetHealthFactor !== "bigint" ||
|
|
78
|
+
typeof healthFactorForMaxBonus !== "bigint" ||
|
|
79
|
+
typeof liquidationBonusFactorBps !== "bigint" ||
|
|
80
|
+
typeof dustThreshold !== "bigint" ||
|
|
81
|
+
typeof collateralDustThreshold !== "bigint") {
|
|
82
|
+
throw new Error("Unexpected getLiquidationConfig() return shape");
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
targetHealthFactor,
|
|
86
|
+
healthFactorForMaxBonus,
|
|
87
|
+
liquidationBonusFactorBps,
|
|
88
|
+
dustThreshold,
|
|
89
|
+
collateralDustThreshold,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Normalized wrapper over `VarlaCore.getDefaultLtvConfig()`.
|
|
94
|
+
*/
|
|
95
|
+
export async function readDefaultLtvConfig(params) {
|
|
96
|
+
const raw = await params.core.read.getDefaultLtvConfig();
|
|
97
|
+
const r = raw;
|
|
98
|
+
const conservative = r.conservative ?? r[0];
|
|
99
|
+
const moderate = r.moderate ?? r[1];
|
|
100
|
+
const risk = r.risk ?? r[2];
|
|
101
|
+
if (typeof conservative !== "bigint" ||
|
|
102
|
+
typeof moderate !== "bigint" ||
|
|
103
|
+
typeof risk !== "bigint") {
|
|
104
|
+
throw new Error("Unexpected getDefaultLtvConfig() return shape");
|
|
105
|
+
}
|
|
106
|
+
return { conservative, moderate, risk };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Normalized wrapper over `VarlaCore.getTierLiquidationConfig(tier)`.
|
|
110
|
+
*/
|
|
111
|
+
export async function readTierLiquidationConfig(params) {
|
|
112
|
+
const raw = await params.core.read.getTierLiquidationConfig([params.tier]);
|
|
113
|
+
const r = raw;
|
|
114
|
+
const maxLiquidationBonusBps = r.maxLiquidationBonusBps ?? r[0];
|
|
115
|
+
const liquidationFeeBps = r.liquidationFeeBps ?? r[1];
|
|
116
|
+
if (typeof maxLiquidationBonusBps !== "bigint" || typeof liquidationFeeBps !== "bigint") {
|
|
117
|
+
throw new Error("Unexpected getTierLiquidationConfig() return shape");
|
|
118
|
+
}
|
|
119
|
+
return { tier: params.tier, maxLiquidationBonusBps, liquidationFeeBps };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Normalized wrapper over `VarlaCore.getLiquidationParamsForPosition(positionId)`.
|
|
123
|
+
*/
|
|
124
|
+
export async function readLiquidationParamsForPosition(params) {
|
|
125
|
+
const raw = await params.core.read.getLiquidationParamsForPosition([params.positionId]);
|
|
126
|
+
const r = raw;
|
|
127
|
+
const maxLiquidationBonusBps = r.maxLiquidationBonusBps ?? r[0];
|
|
128
|
+
const liquidationFeeBps = r.liquidationFeeBps ?? r[1];
|
|
129
|
+
if (typeof maxLiquidationBonusBps !== "bigint" || typeof liquidationFeeBps !== "bigint") {
|
|
130
|
+
throw new Error("Unexpected getLiquidationParamsForPosition() return shape");
|
|
131
|
+
}
|
|
132
|
+
return { positionId: params.positionId, maxLiquidationBonusBps, liquidationFeeBps };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Normalized wrapper over `VarlaCore.getPositionLtvOverride(positionId)`.
|
|
136
|
+
*/
|
|
137
|
+
export async function readPositionLtvOverride(params) {
|
|
138
|
+
const raw = await params.core.read.getPositionLtvOverride([params.positionId]);
|
|
139
|
+
const r = raw;
|
|
140
|
+
const isSet = r.isSet ?? r[0];
|
|
141
|
+
const ltv = r.ltv ?? r[1];
|
|
142
|
+
if (typeof isSet !== "boolean" || typeof ltv !== "bigint") {
|
|
143
|
+
throw new Error("Unexpected getPositionLtvOverride() return shape");
|
|
144
|
+
}
|
|
145
|
+
return { positionId: params.positionId, isSet, ltv };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Thin wrapper over `VarlaCore.getLtvForPosition(positionId)`.
|
|
149
|
+
*
|
|
150
|
+
* This is the *effective* LTV for the position (includes early-closure factor and overrides).
|
|
151
|
+
*/
|
|
152
|
+
export async function readLtvForPosition(params) {
|
|
153
|
+
const ltvWad = await params.core.read.getLtvForPosition([params.positionId]);
|
|
154
|
+
return { positionId: params.positionId, ltvWad };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Thin wrapper over `VarlaCore.getLiquidationBonusBps(positionId, healthFactor)`.
|
|
158
|
+
*/
|
|
159
|
+
export async function readLiquidationBonusBps(params) {
|
|
160
|
+
const bonusBps = await params.core.read.getLiquidationBonusBps([
|
|
161
|
+
params.positionId,
|
|
162
|
+
params.healthFactor,
|
|
163
|
+
]);
|
|
164
|
+
return { positionId: params.positionId, healthFactor: params.healthFactor, bonusBps };
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Computes a (positionIds × healthFactors) grid of liquidation bonuses.
|
|
168
|
+
*
|
|
169
|
+
* Useful for UIs that need to visualize liquidation incentive curves.
|
|
170
|
+
*/
|
|
171
|
+
export async function readManyLiquidationBonusBps(params) {
|
|
172
|
+
const chunkSize = params.chunkSize ?? 256;
|
|
173
|
+
if (params.positionIds.length === 0)
|
|
174
|
+
return [];
|
|
175
|
+
if (params.healthFactors.length === 0) {
|
|
176
|
+
return params.positionIds.map((positionId) => ({ positionId, bonusesBps: [] }));
|
|
177
|
+
}
|
|
178
|
+
const calls = params.positionIds.flatMap((pid) => params.healthFactors.map((hf) => ({
|
|
179
|
+
address: params.core.address,
|
|
180
|
+
abi: abis.VARLACORE_ABI,
|
|
181
|
+
functionName: "getLiquidationBonusBps",
|
|
182
|
+
args: [pid, hf],
|
|
183
|
+
})));
|
|
184
|
+
const res = await multicallChunks({
|
|
185
|
+
client: params.client,
|
|
186
|
+
contracts: calls,
|
|
187
|
+
chunkSize,
|
|
188
|
+
});
|
|
189
|
+
const stride = params.healthFactors.length;
|
|
190
|
+
const out = [];
|
|
191
|
+
for (let i = 0; i < params.positionIds.length; i++) {
|
|
192
|
+
const bonusesBps = [];
|
|
193
|
+
for (let j = 0; j < stride; j++) {
|
|
194
|
+
const r = res[i * stride + j];
|
|
195
|
+
if (r.status !== "success") {
|
|
196
|
+
throw new Error(`Core getLiquidationBonusBps multicall failed: ${String(r.error ?? "unknown")}`);
|
|
197
|
+
}
|
|
198
|
+
if (typeof r.result !== "bigint") {
|
|
199
|
+
throw new Error("Unexpected getLiquidationBonusBps return type");
|
|
200
|
+
}
|
|
201
|
+
bonusesBps.push(r.result);
|
|
202
|
+
}
|
|
203
|
+
out.push({ positionId: params.positionIds[i], bonusesBps });
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
package/dist/views/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/views/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
package/dist/views/index.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
type LiquidatorLike = {
|
|
3
|
+
read: {
|
|
4
|
+
core: () => Promise<Address>;
|
|
5
|
+
treasury: () => Promise<Address>;
|
|
6
|
+
collateralToken: () => Promise<Address>;
|
|
7
|
+
positionsToken: () => Promise<Address>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type ReadLiquidatorBasics = {
|
|
11
|
+
core: Address;
|
|
12
|
+
treasury: Address;
|
|
13
|
+
collateralToken: Address;
|
|
14
|
+
positionsToken: Address;
|
|
15
|
+
};
|
|
16
|
+
export declare function readLiquidatorBasics(params: {
|
|
17
|
+
liquidator: LiquidatorLike;
|
|
18
|
+
}): Promise<ReadLiquidatorBasics>;
|
|
19
|
+
type MergeLiquidatorLike = LiquidatorLike & {
|
|
20
|
+
read: LiquidatorLike["read"] & {
|
|
21
|
+
marketAdapter: () => Promise<Address>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function readMergeLiquidatorBasics(params: {
|
|
25
|
+
liquidator: MergeLiquidatorLike;
|
|
26
|
+
}): Promise<ReadLiquidatorBasics & {
|
|
27
|
+
marketAdapter: Address;
|
|
28
|
+
}>;
|
|
29
|
+
type ConvertLiquidatorLike = LiquidatorLike & {
|
|
30
|
+
read: LiquidatorLike["read"] & {
|
|
31
|
+
negRiskAdapter: () => Promise<Address>;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function readConvertLiquidatorBasics(params: {
|
|
35
|
+
liquidator: ConvertLiquidatorLike;
|
|
36
|
+
}): Promise<ReadLiquidatorBasics & {
|
|
37
|
+
negRiskAdapter: Address;
|
|
38
|
+
}>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=liquidators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquidators.d.ts","sourceRoot":"","sources":["../../src/views/liquidators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7B,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QACjC,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QACxC,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;KACxC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,UAAU,EAAE,cAAc,CAAC;CAC5B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAQhC;AAED,KAAK,mBAAmB,GAAG,cAAc,GAAG;IAC1C,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;QAC7B,aAAa,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;KACvC,CAAC;CACH,CAAC;AAEF,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,UAAU,EAAE,mBAAmB,CAAC;CACjC,GAAG,OAAO,CAAC,oBAAoB,GAAG;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,CAAC,CAI7D;AAED,KAAK,qBAAqB,GAAG,cAAc,GAAG;IAC5C,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;QAC7B,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;KACxC,CAAC;CACH,CAAC;AAEF,wBAAsB,2BAA2B,CAAC,MAAM,EAAE;IACxD,UAAU,EAAE,qBAAqB,CAAC;CACnC,GAAG,OAAO,CAAC,oBAAoB,GAAG;IAAE,cAAc,EAAE,OAAO,CAAA;CAAE,CAAC,CAI9D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Note: explicit .js extension is required for Node ESM resolution.
|
|
2
|
+
export async function readLiquidatorBasics(params) {
|
|
3
|
+
const [core, treasury, collateralToken, positionsToken] = await Promise.all([
|
|
4
|
+
params.liquidator.read.core(),
|
|
5
|
+
params.liquidator.read.treasury(),
|
|
6
|
+
params.liquidator.read.collateralToken(),
|
|
7
|
+
params.liquidator.read.positionsToken(),
|
|
8
|
+
]);
|
|
9
|
+
return { core, treasury, collateralToken, positionsToken };
|
|
10
|
+
}
|
|
11
|
+
export async function readMergeLiquidatorBasics(params) {
|
|
12
|
+
const base = await readLiquidatorBasics(params);
|
|
13
|
+
const marketAdapter = await params.liquidator.read.marketAdapter();
|
|
14
|
+
return { ...base, marketAdapter };
|
|
15
|
+
}
|
|
16
|
+
export async function readConvertLiquidatorBasics(params) {
|
|
17
|
+
const base = await readLiquidatorBasics(params);
|
|
18
|
+
const negRiskAdapter = await params.liquidator.read.negRiskAdapter();
|
|
19
|
+
return { ...base, negRiskAdapter };
|
|
20
|
+
}
|
package/dist/views/oracle.d.ts
CHANGED
|
@@ -23,4 +23,54 @@ export type ReadOracleRegistryParams = {
|
|
|
23
23
|
* - `getConfiguredPositionAt(i)` via multicall
|
|
24
24
|
*/
|
|
25
25
|
export declare function readOracleRegistry(params: ReadOracleRegistryParams): Promise<bigint[]>;
|
|
26
|
+
export type ReadOracleConfig = {
|
|
27
|
+
maxStaleness: bigint;
|
|
28
|
+
liquidationGracePeriod: bigint;
|
|
29
|
+
defaultEarlyClosureWindow: bigint;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Reads key global oracle config values used by UIs and monitoring.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readOracleConfig(params: {
|
|
35
|
+
oracle: {
|
|
36
|
+
read: {
|
|
37
|
+
maxStaleness: () => Promise<bigint>;
|
|
38
|
+
liquidationGracePeriod: () => Promise<bigint>;
|
|
39
|
+
defaultEarlyClosureWindow: () => Promise<bigint>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}): Promise<ReadOracleConfig>;
|
|
43
|
+
export type ReadPositionSnapshot = {
|
|
44
|
+
positionId: bigint;
|
|
45
|
+
priceOk: boolean;
|
|
46
|
+
priceE8: bigint;
|
|
47
|
+
manuallyInvalidated: boolean;
|
|
48
|
+
riskTier: number;
|
|
49
|
+
earlyClosureFactorWad: bigint;
|
|
50
|
+
lastRecoveryFromStale: bigint;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Normalized wrapper over `VarlaOracle.getPositionSnapshot(positionId)`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function readPositionSnapshot(params: {
|
|
56
|
+
oracle: {
|
|
57
|
+
read: {
|
|
58
|
+
getPositionSnapshot: (args: readonly [bigint]) => Promise<unknown>;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
positionId: bigint;
|
|
62
|
+
}): Promise<ReadPositionSnapshot>;
|
|
63
|
+
/**
|
|
64
|
+
* Multicall-chunked `getPositionSnapshot` for many ids.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readManyPositionSnapshots(params: {
|
|
67
|
+
oracle: {
|
|
68
|
+
address: Address;
|
|
69
|
+
};
|
|
70
|
+
client: {
|
|
71
|
+
multicall: (args: any) => Promise<any>;
|
|
72
|
+
};
|
|
73
|
+
positionIds: readonly bigint[];
|
|
74
|
+
chunkSize?: number;
|
|
75
|
+
}): Promise<ReadPositionSnapshot[]>;
|
|
26
76
|
//# sourceMappingURL=oracle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../../src/views/oracle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE;YACJ,2BAA2B,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;SACpD,CAAC;KACH,CAAC;IACF,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;KACxC,CAAC;IACF;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiC5F"}
|
|
1
|
+
{"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../../src/views/oracle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE;YACJ,2BAA2B,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;SACpD,CAAC;KACH,CAAC;IACF,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;KACxC,CAAC;IACF;;;OAGG;IACH,SAAS,CAAC,EA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AAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7B,MAAM,EAAE;QAAE,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;IACnD,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA4BlC"}
|
package/dist/views/oracle.js
CHANGED
|
@@ -39,3 +39,75 @@ export async function readOracleRegistry(params) {
|
|
|
39
39
|
}
|
|
40
40
|
return ids;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Reads key global oracle config values used by UIs and monitoring.
|
|
44
|
+
*/
|
|
45
|
+
export async function readOracleConfig(params) {
|
|
46
|
+
const [maxStaleness, liquidationGracePeriod, defaultEarlyClosureWindow] = await Promise.all([
|
|
47
|
+
params.oracle.read.maxStaleness(),
|
|
48
|
+
params.oracle.read.liquidationGracePeriod(),
|
|
49
|
+
params.oracle.read.defaultEarlyClosureWindow(),
|
|
50
|
+
]);
|
|
51
|
+
return { maxStaleness, liquidationGracePeriod, defaultEarlyClosureWindow };
|
|
52
|
+
}
|
|
53
|
+
function normalizePositionSnapshot(raw, positionId) {
|
|
54
|
+
const r = raw;
|
|
55
|
+
const priceOk = r.priceOk ?? r[0];
|
|
56
|
+
const priceE8 = r.priceE8 ?? r[1];
|
|
57
|
+
const manuallyInvalidated = r.manuallyInvalidated ?? r[2];
|
|
58
|
+
const riskTier = r.riskTier ?? r[3];
|
|
59
|
+
const earlyClosureFactorWad = r.earlyClosureFactorWad ?? r[4];
|
|
60
|
+
const lastRecoveryFromStale = r.lastRecoveryFromStale_ ?? r.lastRecoveryFromStale ?? r[5];
|
|
61
|
+
if (typeof priceOk !== "boolean" ||
|
|
62
|
+
typeof priceE8 !== "bigint" ||
|
|
63
|
+
typeof manuallyInvalidated !== "boolean" ||
|
|
64
|
+
(typeof riskTier !== "number" && typeof riskTier !== "bigint") ||
|
|
65
|
+
typeof earlyClosureFactorWad !== "bigint" ||
|
|
66
|
+
typeof lastRecoveryFromStale !== "bigint") {
|
|
67
|
+
throw new Error("Unexpected getPositionSnapshot() return shape");
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
positionId,
|
|
71
|
+
priceOk,
|
|
72
|
+
priceE8,
|
|
73
|
+
manuallyInvalidated,
|
|
74
|
+
riskTier: Number(riskTier),
|
|
75
|
+
earlyClosureFactorWad,
|
|
76
|
+
lastRecoveryFromStale,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Normalized wrapper over `VarlaOracle.getPositionSnapshot(positionId)`.
|
|
81
|
+
*/
|
|
82
|
+
export async function readPositionSnapshot(params) {
|
|
83
|
+
const raw = await params.oracle.read.getPositionSnapshot([params.positionId]);
|
|
84
|
+
return normalizePositionSnapshot(raw, params.positionId);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Multicall-chunked `getPositionSnapshot` for many ids.
|
|
88
|
+
*/
|
|
89
|
+
export async function readManyPositionSnapshots(params) {
|
|
90
|
+
const chunkSize = params.chunkSize ?? 256;
|
|
91
|
+
if (params.positionIds.length === 0)
|
|
92
|
+
return [];
|
|
93
|
+
const calls = params.positionIds.map((pid) => ({
|
|
94
|
+
address: params.oracle.address,
|
|
95
|
+
abi: abis.VARLAORACLE_ABI,
|
|
96
|
+
functionName: "getPositionSnapshot",
|
|
97
|
+
args: [pid],
|
|
98
|
+
}));
|
|
99
|
+
const res = await multicallChunks({
|
|
100
|
+
client: params.client,
|
|
101
|
+
contracts: calls,
|
|
102
|
+
chunkSize,
|
|
103
|
+
});
|
|
104
|
+
const out = [];
|
|
105
|
+
for (let i = 0; i < res.length; i++) {
|
|
106
|
+
const r = res[i];
|
|
107
|
+
if (r.status !== "success") {
|
|
108
|
+
throw new Error(`Oracle getPositionSnapshot multicall failed: ${String(r.error ?? "unknown")}`);
|
|
109
|
+
}
|
|
110
|
+
out.push(normalizePositionSnapshot(r.result, params.positionIds[i]));
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
package/dist/views/pool.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
pool: {
|
|
3
|
-
read: {
|
|
4
|
-
getPoolStats: () => Promise<unknown>;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
}): Promise<{
|
|
1
|
+
export type ReadPoolSnapshot = {
|
|
8
2
|
totalAssets: bigint;
|
|
9
3
|
totalBorrowed: bigint;
|
|
10
4
|
available: bigint;
|
|
@@ -12,5 +6,46 @@ export declare function readPoolSnapshot(params: {
|
|
|
12
6
|
borrowRate: bigint;
|
|
13
7
|
supplyAPY: bigint;
|
|
14
8
|
borrowIndex: bigint;
|
|
15
|
-
}
|
|
9
|
+
};
|
|
10
|
+
export declare function readPoolSnapshot(params: {
|
|
11
|
+
pool: {
|
|
12
|
+
read: {
|
|
13
|
+
getPoolStats: () => Promise<unknown>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}): Promise<ReadPoolSnapshot>;
|
|
17
|
+
export type ReadPoolCaps = {
|
|
18
|
+
depositCap: bigint;
|
|
19
|
+
borrowCap: bigint;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Reads depositCap/borrowCap (useful for frontends + monitoring).
|
|
23
|
+
*/
|
|
24
|
+
export declare function readPoolCaps(params: {
|
|
25
|
+
pool: {
|
|
26
|
+
read: {
|
|
27
|
+
depositCap: () => Promise<bigint>;
|
|
28
|
+
borrowCap: () => Promise<bigint>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}): Promise<ReadPoolCaps>;
|
|
32
|
+
export type ReadPoolAccounting = {
|
|
33
|
+
reserveBalance: bigint;
|
|
34
|
+
scaledTotalBorrowed: bigint;
|
|
35
|
+
borrowIndex: bigint;
|
|
36
|
+
lastUpdateTimestamp: bigint;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Reads accounting/index variables that are commonly required in analytics.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readPoolAccounting(params: {
|
|
42
|
+
pool: {
|
|
43
|
+
read: {
|
|
44
|
+
reserveBalance: () => Promise<bigint>;
|
|
45
|
+
scaledTotalBorrowed: () => Promise<bigint>;
|
|
46
|
+
borrowIndex: () => Promise<bigint>;
|
|
47
|
+
lastUpdateTimestamp: () => Promise<bigint | number>;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}): Promise<ReadPoolAccounting>;
|
|
16
51
|
//# sourceMappingURL=pool.d.ts.map
|