@sodax/types 2.2.0-rc.5 → 2.2.0-rc.7
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/README.md +49 -1
- package/dist/backend/backendApiV2.js +4 -3
- package/dist/chains/chains.d.ts +621 -0
- package/dist/chains/chains.js +55 -0
- package/dist/chains/tokens.d.ts +1045 -1
- package/dist/chains/tokens.js +478 -0
- package/dist/index.d.ts +37 -1
- package/dist/index.js +67 -1
- package/dist/leverageYield/leverageYield.d.ts +104 -3
- package/dist/leverageYield/leverageYield.js +1 -0
- package/dist/moneyMarket/moneyMarket.d.ts +48 -0
- package/dist/moneyMarket/moneyMarket.js +3 -0
- package/dist/sodax-config/sodax-config.d.ts +1098 -0
- package/dist/swap/swap.d.ts +905 -9
- package/dist/swap/swap.js +55 -4
- package/package.json +4 -4
|
@@ -120,19 +120,119 @@ export declare const leverageYieldVaults: readonly [{
|
|
|
120
120
|
readonly label: "Sky (sUSDS)";
|
|
121
121
|
};
|
|
122
122
|
}];
|
|
123
|
+
/**
|
|
124
|
+
* A leverage position's operation slot.
|
|
125
|
+
*
|
|
126
|
+
* `kind` mirrors the contract's `PendingKind`: 0 none, 1 leverage, 2 deleverage, 3 debt-side open.
|
|
127
|
+
* The pair matters because they can disagree — see `needsSettle`.
|
|
128
|
+
*/
|
|
129
|
+
export type LeveragePositionPendingState = {
|
|
130
|
+
kind: number;
|
|
131
|
+
/** The intent is still registered on `Intents`, so no second operation is permitted. */
|
|
132
|
+
isLive: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* An operation is recorded but its intent is gone, so the position still holds an open grant and
|
|
135
|
+
* any debt-side contribution. Cleared by `buildSettlePosition`, which anyone may call.
|
|
136
|
+
*/
|
|
137
|
+
needsSettle: boolean;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Static descriptor of a single leverage position — one owner-controlled AAVE account
|
|
141
|
+
* deployed as a clone by `LeveragePositionFactory`.
|
|
142
|
+
*
|
|
143
|
+
* Positions are the unpooled counterpart to {@link LeverageYieldVault}: instead of many
|
|
144
|
+
* depositors sharing one ERC-4626 vault at a single target LTV, each position is its own
|
|
145
|
+
* AAVE account with its own eMode category, health factor and liquidation risk. That is
|
|
146
|
+
* what lets one owner hold several positions at different leverage tiers at once, which a
|
|
147
|
+
* pooled vault cannot express because AAVE allows one eMode category per address.
|
|
148
|
+
*
|
|
149
|
+
* Unlike vaults there is no registry of these: positions are created per user at runtime
|
|
150
|
+
* and discovered through `LeverageYieldService.listPositions(owner)`.
|
|
151
|
+
*/
|
|
152
|
+
export type LeveragePosition = {
|
|
153
|
+
/** Deployed `LeveragePosition` clone address on the Sonic hub. */
|
|
154
|
+
address: Address;
|
|
155
|
+
/** Address permitted to operate the position — a hub EOA, the solver, or a hub Wallet. */
|
|
156
|
+
owner: Address;
|
|
157
|
+
/** Hub-side collateral supplied to AAVE, a Sodax vault token (e.g. sodaSUSDS). */
|
|
158
|
+
collateral: Address;
|
|
159
|
+
/** Hub-side asset borrowed against the collateral, a Sodax vault token (e.g. sodaUSSD). */
|
|
160
|
+
borrowToken: Address;
|
|
161
|
+
/** AAVE eMode category, fixed at creation. `0` means no eMode. */
|
|
162
|
+
eModeCategory: number;
|
|
163
|
+
/**
|
|
164
|
+
* The position's own partner fee in basis points, FIXED AT CREATION.
|
|
165
|
+
*
|
|
166
|
+
* Read from the position, not from config: config can change and an open can pass a per-call
|
|
167
|
+
* override, so what a new position would carry is not what this one does. The fee is borrowed on
|
|
168
|
+
* top of what the solver is paid, so any projection of an adjust or exit has to charge it.
|
|
169
|
+
*/
|
|
170
|
+
feeBps: number;
|
|
171
|
+
/** Who that fee is paid to. Zero address when none is charged. */
|
|
172
|
+
feeReceiver: Address;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Live AAVE account snapshot for a leverage position. Read from the pool rather than the
|
|
176
|
+
* position contract, which holds no accounting of its own.
|
|
177
|
+
*
|
|
178
|
+
* All base-currency figures use the pool's oracle base unit (8 decimals on the Sodax fork).
|
|
179
|
+
*/
|
|
180
|
+
export type LeveragePositionAccount = {
|
|
181
|
+
/** Total collateral in the pool's base currency. */
|
|
182
|
+
totalCollateralBase: bigint;
|
|
183
|
+
/** Total debt in the pool's base currency. */
|
|
184
|
+
totalDebtBase: bigint;
|
|
185
|
+
/** Remaining borrowing power in the pool's base currency. */
|
|
186
|
+
availableBorrowsBase: bigint;
|
|
187
|
+
/** Liquidation threshold in basis points, reflecting the position's eMode category. */
|
|
188
|
+
currentLiquidationThreshold: bigint;
|
|
189
|
+
/** Current loan-to-value in basis points. */
|
|
190
|
+
ltv: bigint;
|
|
191
|
+
/** Health factor in WAD (1e18). Below 1e18 the position is liquidatable. */
|
|
192
|
+
healthFactor: bigint;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* A position's collateral holding, read straight off the aToken.
|
|
196
|
+
*
|
|
197
|
+
* The counterpart to {@link LeveragePositionAccount}'s `totalCollateralBase`, which is an oracle
|
|
198
|
+
* base-currency figure at 8 decimals — right for display, useless for sizing a full exit, because
|
|
199
|
+
* converting it back through a price lands near the balance rather than on it.
|
|
200
|
+
*/
|
|
201
|
+
export type LeveragePositionCollateral = {
|
|
202
|
+
/** The reserve's aToken. Holding this *is* the collateral position. */
|
|
203
|
+
aToken: Address;
|
|
204
|
+
/** Exact aToken balance, in the collateral reserve's own decimals. */
|
|
205
|
+
balance: bigint;
|
|
206
|
+
};
|
|
123
207
|
export type LeverageYieldOptions = {
|
|
124
208
|
partnerFee?: PartnerFee;
|
|
209
|
+
/**
|
|
210
|
+
* Overrides the deployed `LeveragePositionFactory` in {@link leverageYieldConfig}.
|
|
211
|
+
*
|
|
212
|
+
* Only needed to point at a different deployment — a fork, a staging factory, or a new
|
|
213
|
+
* one before the default catches up. Omitting it (or passing `undefined`) keeps the
|
|
214
|
+
* default: config merging skips `undefined`, so an absent override cannot blank it.
|
|
215
|
+
*/
|
|
216
|
+
positionFactory?: Address;
|
|
125
217
|
/**
|
|
126
218
|
* Route `vaultSwap()` (and so `deposit`/`withdraw`) through the backend submit-tx flow. Default
|
|
127
|
-
* `
|
|
128
|
-
*
|
|
129
|
-
* Read the effective value via `sodax.config.leverageYieldUseBackendSubmitTx`.
|
|
219
|
+
* `true`, like the swaps/bridge toggles — omitting it leaves the backend path ON. Set `false` to
|
|
220
|
+
* opt out and force the fully client-side relay. Client-side only — not part of backend
|
|
221
|
+
* SodaxDefaultConfig. Read the effective value via `sodax.config.leverageYieldUseBackendSubmitTx`.
|
|
130
222
|
*/
|
|
131
223
|
useBackendSubmitTx?: boolean;
|
|
132
224
|
};
|
|
133
225
|
export type LeverageYieldConfig = Prettify<LeverageYieldDefaultConfig & LeverageYieldOptions>;
|
|
134
226
|
export type LeverageYieldDefaultConfig = {
|
|
135
227
|
vaults: readonly LeverageYieldVault[];
|
|
228
|
+
/**
|
|
229
|
+
* Deployed `LeveragePositionFactory` on the Sonic hub.
|
|
230
|
+
*
|
|
231
|
+
* Defaulted so the position methods work out of the box: they fail closed on a missing
|
|
232
|
+
* factory rather than guessing an address, which previously meant every integrator had
|
|
233
|
+
* to supply this before a single position call would run.
|
|
234
|
+
*/
|
|
235
|
+
positionFactory: Address;
|
|
136
236
|
};
|
|
137
237
|
export declare const leverageYieldConfig: {
|
|
138
238
|
readonly vaults: readonly [{
|
|
@@ -176,4 +276,5 @@ export declare const leverageYieldConfig: {
|
|
|
176
276
|
readonly label: "Sky (sUSDS)";
|
|
177
277
|
};
|
|
178
278
|
}];
|
|
279
|
+
readonly positionFactory: "0xF8fB7F200B6545295e1729Cf254482d7c116031C";
|
|
179
280
|
};
|
|
@@ -212,6 +212,14 @@ export declare const moneyMarketSupportedTokens: {
|
|
|
212
212
|
readonly chainKey: "0x2105.base";
|
|
213
213
|
readonly hubAsset: "0xFE9b81eF40419Ef9Ce62cCff197345D78c552945";
|
|
214
214
|
readonly vault: "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e";
|
|
215
|
+
}, {
|
|
216
|
+
readonly symbol: "sUSDS";
|
|
217
|
+
readonly name: "staked USDS";
|
|
218
|
+
readonly decimals: 18;
|
|
219
|
+
readonly address: "0x5875eEE11Cf8398102FdAd704C9E96607675467a";
|
|
220
|
+
readonly chainKey: "0x2105.base";
|
|
221
|
+
readonly hubAsset: "0x807cC73f69F1aCCC50511a0390A8544cEA71baA9";
|
|
222
|
+
readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
|
|
215
223
|
}];
|
|
216
224
|
readonly "0xa.optimism": [{
|
|
217
225
|
readonly symbol: "ETH";
|
|
@@ -269,6 +277,14 @@ export declare const moneyMarketSupportedTokens: {
|
|
|
269
277
|
readonly chainKey: "0xa.optimism";
|
|
270
278
|
readonly hubAsset: "0x0eD0d274dC77ef460DC96b9fBaFF3EDB074e0471";
|
|
271
279
|
readonly vault: "0x21685E341DE7844135329914Be6Bd8D16982d834";
|
|
280
|
+
}, {
|
|
281
|
+
readonly symbol: "sUSDS";
|
|
282
|
+
readonly name: "staked USDS";
|
|
283
|
+
readonly decimals: 18;
|
|
284
|
+
readonly address: "0xb5B2dc7fd34C249F4be7fB1fCea07950784229e0";
|
|
285
|
+
readonly chainKey: "0xa.optimism";
|
|
286
|
+
readonly hubAsset: "0xb9a9cb8A61D30a8F6b7E24491ab83f43E817b0E2";
|
|
287
|
+
readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
|
|
272
288
|
}];
|
|
273
289
|
readonly "0x89.polygon": [{
|
|
274
290
|
readonly symbol: "POL";
|
|
@@ -1266,6 +1282,14 @@ export declare const moneyMarketSupportedTokens: {
|
|
|
1266
1282
|
readonly chainKey: "ethereum";
|
|
1267
1283
|
readonly hubAsset: "0x31D3a9319C76EC4A474721966dA65b94e6bFc9eF";
|
|
1268
1284
|
readonly vault: "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e";
|
|
1285
|
+
}, {
|
|
1286
|
+
readonly symbol: "sUSDS";
|
|
1287
|
+
readonly name: "staked USDS";
|
|
1288
|
+
readonly decimals: 18;
|
|
1289
|
+
readonly address: "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD";
|
|
1290
|
+
readonly chainKey: "ethereum";
|
|
1291
|
+
readonly hubAsset: "0x1Bb5128A4837A78cb60bc52cc19079eD3F00A624";
|
|
1292
|
+
readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
|
|
1269
1293
|
}];
|
|
1270
1294
|
readonly redbelly: [{
|
|
1271
1295
|
readonly symbol: "bnUSD";
|
|
@@ -1841,6 +1865,14 @@ export declare const moneyMarketConfig: {
|
|
|
1841
1865
|
readonly chainKey: "0x2105.base";
|
|
1842
1866
|
readonly hubAsset: "0xFE9b81eF40419Ef9Ce62cCff197345D78c552945";
|
|
1843
1867
|
readonly vault: "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e";
|
|
1868
|
+
}, {
|
|
1869
|
+
readonly symbol: "sUSDS";
|
|
1870
|
+
readonly name: "staked USDS";
|
|
1871
|
+
readonly decimals: 18;
|
|
1872
|
+
readonly address: "0x5875eEE11Cf8398102FdAd704C9E96607675467a";
|
|
1873
|
+
readonly chainKey: "0x2105.base";
|
|
1874
|
+
readonly hubAsset: "0x807cC73f69F1aCCC50511a0390A8544cEA71baA9";
|
|
1875
|
+
readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
|
|
1844
1876
|
}];
|
|
1845
1877
|
readonly "0xa.optimism": [{
|
|
1846
1878
|
readonly symbol: "ETH";
|
|
@@ -1898,6 +1930,14 @@ export declare const moneyMarketConfig: {
|
|
|
1898
1930
|
readonly chainKey: "0xa.optimism";
|
|
1899
1931
|
readonly hubAsset: "0x0eD0d274dC77ef460DC96b9fBaFF3EDB074e0471";
|
|
1900
1932
|
readonly vault: "0x21685E341DE7844135329914Be6Bd8D16982d834";
|
|
1933
|
+
}, {
|
|
1934
|
+
readonly symbol: "sUSDS";
|
|
1935
|
+
readonly name: "staked USDS";
|
|
1936
|
+
readonly decimals: 18;
|
|
1937
|
+
readonly address: "0xb5B2dc7fd34C249F4be7fB1fCea07950784229e0";
|
|
1938
|
+
readonly chainKey: "0xa.optimism";
|
|
1939
|
+
readonly hubAsset: "0xb9a9cb8A61D30a8F6b7E24491ab83f43E817b0E2";
|
|
1940
|
+
readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
|
|
1901
1941
|
}];
|
|
1902
1942
|
readonly "0x89.polygon": [{
|
|
1903
1943
|
readonly symbol: "POL";
|
|
@@ -2895,6 +2935,14 @@ export declare const moneyMarketConfig: {
|
|
|
2895
2935
|
readonly chainKey: "ethereum";
|
|
2896
2936
|
readonly hubAsset: "0x31D3a9319C76EC4A474721966dA65b94e6bFc9eF";
|
|
2897
2937
|
readonly vault: "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e";
|
|
2938
|
+
}, {
|
|
2939
|
+
readonly symbol: "sUSDS";
|
|
2940
|
+
readonly name: "staked USDS";
|
|
2941
|
+
readonly decimals: 18;
|
|
2942
|
+
readonly address: "0xa3931d71877C0E7a3148CB7Eb4463524FEc27fbD";
|
|
2943
|
+
readonly chainKey: "ethereum";
|
|
2944
|
+
readonly hubAsset: "0x1Bb5128A4837A78cb60bc52cc19079eD3F00A624";
|
|
2945
|
+
readonly vault: "0x243b0c26c8b38793908d7C64e8510f21B19B4613";
|
|
2898
2946
|
}];
|
|
2899
2947
|
readonly redbelly: [{
|
|
2900
2948
|
readonly symbol: "bnUSD";
|
|
@@ -66,6 +66,7 @@ export const moneyMarketSupportedTokens = {
|
|
|
66
66
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.SODA,
|
|
67
67
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.USDT,
|
|
68
68
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.USDS,
|
|
69
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.sUSDS,
|
|
69
70
|
],
|
|
70
71
|
[ChainKeys.OPTIMISM_MAINNET]: [
|
|
71
72
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.ETH,
|
|
@@ -75,6 +76,7 @@ export const moneyMarketSupportedTokens = {
|
|
|
75
76
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.weETH,
|
|
76
77
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.USDT,
|
|
77
78
|
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.SODA,
|
|
79
|
+
spokeChainConfig[ChainKeys.OPTIMISM_MAINNET].supportedTokens.sUSDS,
|
|
78
80
|
],
|
|
79
81
|
[ChainKeys.POLYGON_MAINNET]: [
|
|
80
82
|
spokeChainConfig[ChainKeys.POLYGON_MAINNET].supportedTokens.POL,
|
|
@@ -197,6 +199,7 @@ export const moneyMarketSupportedTokens = {
|
|
|
197
199
|
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.WBTC_LEGACY,
|
|
198
200
|
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.LL,
|
|
199
201
|
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.USDS,
|
|
202
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.sUSDS,
|
|
200
203
|
],
|
|
201
204
|
[ChainKeys.REDBELLY_MAINNET]: [
|
|
202
205
|
spokeChainConfig[ChainKeys.REDBELLY_MAINNET].supportedTokens.bnUSD,
|