@gearbox-protocol/sdk 15.1.0-next.24 → 15.1.0-next.25
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/cjs/model/charts.js +20 -34
- package/dist/cjs/model/opportunities.schema.js +14 -12
- package/dist/cjs/sdk/OnchainSDK.js +16 -0
- package/dist/cjs/sdk/accounts/intents/utils/pick-token.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +33 -1
- package/dist/cjs/sdk/base/index.js +1 -0
- package/dist/cjs/sdk/base/token-types.js +13 -0
- package/dist/cjs/sdk/chain/chains.js +9 -12
- package/dist/cjs/sdk/chain/index.js +0 -1
- package/dist/cjs/sdk/index.js +1 -2
- package/dist/cjs/sdk/market/MarketSuite.js +11 -5
- package/dist/cjs/sdk/market/credit/CreditSuite.js +1 -1
- package/dist/cjs/sdk/market/credit/collateralUtils.js +2 -14
- package/dist/cjs/sdk/market/credit/index.js +0 -1
- package/dist/cjs/sdk/market/index.js +0 -1
- package/dist/cjs/sdk/market/strategyName.js +4 -6
- package/dist/cjs/sdk/positions/PositionsService.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/charts.js +20 -34
- package/dist/esm/model/opportunities.schema.js +14 -12
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/OnchainSDK.js +16 -0
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/intents/utils/pick-token.js +1 -1
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +36 -4
- package/dist/esm/sdk/base/index.js +2 -2
- package/dist/esm/sdk/base/token-types.js +13 -1
- package/dist/esm/sdk/chain/chains.js +10 -12
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/chain/index.js +2 -2
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +4 -4
- package/dist/esm/sdk/market/MarketSuite.js +11 -5
- package/dist/esm/sdk/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/sdk/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditSuite.js +1 -1
- package/dist/esm/sdk/market/credit/collateralUtils.js +2 -13
- package/dist/esm/sdk/market/credit/index.js +2 -2
- package/dist/esm/sdk/market/index.js +2 -2
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/strategyName.js +4 -6
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/positions/PositionsService.js +1 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/model/charts.d.ts +16 -23
- package/dist/types/model/charts.schema.d.ts +24 -52
- package/dist/types/model/opportunities.d.ts +18 -4
- package/dist/types/model/opportunities.schema.d.ts +101 -38
- package/dist/types/model/primitives.d.ts +4 -0
- package/dist/types/new-sdk/opportunities/types.d.ts +1 -1
- package/dist/types/new-sdk/positions/types.d.ts +1 -1
- package/dist/types/sdk/base/TokensMeta.d.ts +31 -2
- package/dist/types/sdk/base/index.d.ts +3 -3
- package/dist/types/sdk/base/token-types.d.ts +14 -1
- package/dist/types/sdk/chain/chains.d.ts +3 -11
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +5 -5
- package/dist/types/sdk/market/credit/collateralUtils.d.ts +1 -7
- package/dist/types/sdk/market/credit/index.d.ts +2 -2
- package/dist/types/sdk/market/index.d.ts +2 -2
- package/dist/types/sdk/market/strategyName.d.ts +3 -5
- package/package.json +1 -1
|
@@ -65,6 +65,17 @@ const opportunityBaseSchema = z.object({
|
|
|
65
65
|
sunset: z.boolean()
|
|
66
66
|
});
|
|
67
67
|
/**
|
|
68
|
+
* {@link QuotaAsset}
|
|
69
|
+
**/
|
|
70
|
+
const quotaAssetSchema = z.object({
|
|
71
|
+
token: tokenSchema,
|
|
72
|
+
quotaRate: tolerance(bpsSchema, "bps"),
|
|
73
|
+
limit: amountSchema,
|
|
74
|
+
used: tolerance(amountSchema, "amount"),
|
|
75
|
+
allocationShare: tolerance(bpsSchema, "bps"),
|
|
76
|
+
allocatedDebt: tolerance(amountSchema, "amount")
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
68
79
|
* {@link PoolOpportunity}
|
|
69
80
|
**/
|
|
70
81
|
const poolOpportunitySchema = z.object({
|
|
@@ -75,7 +86,8 @@ const poolOpportunitySchema = z.object({
|
|
|
75
86
|
availableLiquidity: tolerance(amountSchema, "amount"),
|
|
76
87
|
utilization: tolerance(bpsSchema, "bps"),
|
|
77
88
|
supplyApy: apyBreakdownSchema,
|
|
78
|
-
supplyApyAvg7D: offchainOnly(apyBreakdownSchema).optional()
|
|
89
|
+
supplyApyAvg7D: offchainOnly(apyBreakdownSchema).optional(),
|
|
90
|
+
quotaAssets: z.array(quotaAssetSchema)
|
|
79
91
|
});
|
|
80
92
|
/**
|
|
81
93
|
* {@link StrategyOpportunity}
|
|
@@ -169,15 +181,6 @@ const rateCurveSchema = z.object({
|
|
|
169
181
|
borrowingLimitUtilization: bpsSchema.nullable()
|
|
170
182
|
});
|
|
171
183
|
/**
|
|
172
|
-
* {@link QuotaAsset}
|
|
173
|
-
**/
|
|
174
|
-
const quotaAssetSchema = z.object({
|
|
175
|
-
token: tokenSchema,
|
|
176
|
-
quotaRate: bpsSchema,
|
|
177
|
-
limit: amountSchema,
|
|
178
|
-
used: amountSchema
|
|
179
|
-
});
|
|
180
|
-
/**
|
|
181
184
|
* {@link PriceFeedData}. Recursive: a composite feed lists the feeds it reads.
|
|
182
185
|
**/
|
|
183
186
|
const priceFeedDataSchema = z.object({
|
|
@@ -203,8 +206,7 @@ const priceFeedSummarySchema = z.object({
|
|
|
203
206
|
**/
|
|
204
207
|
const poolOpportunityDetailSchema = z.object({
|
|
205
208
|
...poolOpportunitySchema.shape,
|
|
206
|
-
rateCurve: rateCurveSchema
|
|
207
|
-
quotaAssets: z.array(quotaAssetSchema)
|
|
209
|
+
rateCurve: rateCurveSchema
|
|
208
210
|
});
|
|
209
211
|
/**
|
|
210
212
|
* {@link StrategyOpportunityDetail}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
|
+
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
3
3
|
import { asPreviewSimulationError } from "./errors.js";
|
|
4
4
|
//#region src/preview/simulate/simulatePoolOperation.ts
|
|
5
5
|
function previewRead(operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../sdk/utils/AddressMap.js";
|
|
3
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
4
4
|
import "../../sdk/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
6
6
|
import { getAddress, isAddressEqual, parseEventLogs } from "viem";
|
|
@@ -228,6 +228,21 @@ var OnchainSDK = class extends ChainContractsRegister {
|
|
|
228
228
|
...this.#withdrawalCompressor ? [this.#withdrawalCompressor.getLoadWithdrawableAssetsMulticall(force)] : [],
|
|
229
229
|
this.tokensMeta.getLoadTokenDataMulticall()
|
|
230
230
|
], { blockNumber: this.currentBlock });
|
|
231
|
+
this.#renameRedemptionPhantoms();
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Rewrites redemption phantom display symbols from the withdrawal
|
|
235
|
+
* compressor's source/target mapping. No-op when the compressor is missing
|
|
236
|
+
* or its assets cache has not been loaded.
|
|
237
|
+
**/
|
|
238
|
+
#renameRedemptionPhantoms() {
|
|
239
|
+
const compressor = this.#withdrawalCompressor;
|
|
240
|
+
if (!compressor?.state) return;
|
|
241
|
+
this.tokensMeta.renameRedemptionPhantoms(compressor.getWithdrawableAssets().map((a) => ({
|
|
242
|
+
phantom: a.withdrawalPhantomToken,
|
|
243
|
+
source: a.token,
|
|
244
|
+
target: a.underlying
|
|
245
|
+
})));
|
|
231
246
|
}
|
|
232
247
|
/**
|
|
233
248
|
* Restores SDK state from a previously serialised {@link GearboxState}
|
|
@@ -256,6 +271,7 @@ var OnchainSDK = class extends ChainContractsRegister {
|
|
|
256
271
|
this.#rwa.setState(state.rwa);
|
|
257
272
|
if (state.withdrawals) this.#withdrawalCompressor?.hydrate(state.withdrawals);
|
|
258
273
|
if (state.tokens) this.tokensMeta.hydrate(state.tokens);
|
|
274
|
+
this.#renameRedemptionPhantoms();
|
|
259
275
|
for (const [name, plugin] of TypedObjectUtils.entries(this.plugins)) {
|
|
260
276
|
const pluginState = state.plugins[name];
|
|
261
277
|
if (plugin.hydrate && pluginState) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
-
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
3
1
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
4
2
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
5
3
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
@@ -10,6 +8,8 @@ import "../base/index.js";
|
|
|
10
8
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
11
9
|
import "./bots/index.js";
|
|
12
10
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
11
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
13
13
|
import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
|
|
14
14
|
import "../market/index.js";
|
|
15
15
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES } from "../../../
|
|
1
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES } from "../../../base/token-types.js";
|
|
2
2
|
import { eq } from "./common.js";
|
|
3
3
|
import { convertAmount } from "./convert-amount.js";
|
|
4
4
|
//#region src/sdk/accounts/intents/utils/pick-token.ts
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
2
1
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
3
2
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
4
3
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -20,6 +19,7 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
|
|
|
20
19
|
import "../../market/rwa/securitize/index.js";
|
|
21
20
|
import "../../market/index.js";
|
|
22
21
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
22
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
23
23
|
//#region src/sdk/accounts/liquidations/LiquidationsService.ts
|
|
24
24
|
/**
|
|
25
25
|
* Service for discovering liquidatable credit accounts and previewing manual
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
4
3
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
4
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
5
5
|
import { InvalidDelayedIntentError } from "./errors.js";
|
|
6
6
|
//#region src/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
7
7
|
const abi = iRedemptionLoggerV310Abi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
3
3
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
3
3
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV311Abi;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
3
2
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import { toWithdrawalStatus } from "./types.js";
|
|
5
5
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
|
|
6
6
|
const abi = iWithdrawalCompressorV313Abi;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
2
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
3
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
4
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
5
2
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
6
3
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
7
4
|
import { getAssetType } from "../chain/chains.js";
|
|
8
5
|
import { formatBN } from "../utils/formatter.js";
|
|
9
6
|
import "../utils/index.js";
|
|
7
|
+
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
8
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
9
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
10
10
|
import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
|
|
11
11
|
//#region src/sdk/base/TokensMeta.ts
|
|
12
12
|
/**
|
|
@@ -40,10 +40,21 @@ var TokensMeta = class extends AddressMap {
|
|
|
40
40
|
...existing,
|
|
41
41
|
...v
|
|
42
42
|
};
|
|
43
|
+
if (v) {
|
|
44
|
+
const pretty = this.#prettyName(address);
|
|
45
|
+
if (pretty) v = {
|
|
46
|
+
...v,
|
|
47
|
+
symbol: pretty
|
|
48
|
+
};
|
|
49
|
+
}
|
|
43
50
|
super.upsert(address, v);
|
|
44
51
|
}
|
|
45
52
|
/**
|
|
46
|
-
* Returns the symbol
|
|
53
|
+
* Returns the display symbol for a token.
|
|
54
|
+
*
|
|
55
|
+
* This is not always the on-chain ERC-20 `symbol()`: curated pretty names
|
|
56
|
+
* and redemption phantom tokens (`"source -> target"`) replace it.
|
|
57
|
+
*
|
|
47
58
|
* @param token - Token address.
|
|
48
59
|
* @throws If the token is not in the registry.
|
|
49
60
|
*/
|
|
@@ -138,11 +149,32 @@ var TokensMeta = class extends AddressMap {
|
|
|
138
149
|
}
|
|
139
150
|
return meta.asset;
|
|
140
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Rewrites display symbols of redemption phantom tokens to
|
|
154
|
+
* `"${source} -> ${target}"`.
|
|
155
|
+
*
|
|
156
|
+
* @param renames - Phantom / source / target address triples.
|
|
157
|
+
**/
|
|
158
|
+
renameRedemptionPhantoms(renames) {
|
|
159
|
+
for (const { phantom, source, target } of renames) {
|
|
160
|
+
const meta = this.get(phantom);
|
|
161
|
+
if (!meta || !this.has(source) || !this.has(target)) continue;
|
|
162
|
+
this.upsert(phantom, {
|
|
163
|
+
...meta,
|
|
164
|
+
symbol: `${this.symbol(source)} -> ${this.symbol(target)}`
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
141
168
|
get #networkType() {
|
|
142
169
|
const { chain } = this.#client;
|
|
143
170
|
if ("network" in chain) return chain.network;
|
|
144
171
|
throw new Error(`chain ${chain.id} is not a Gearbox SDK chain`);
|
|
145
172
|
}
|
|
173
|
+
#prettyName(token) {
|
|
174
|
+
const { chain } = this.#client;
|
|
175
|
+
if (!("network" in chain)) return;
|
|
176
|
+
return chain.tokenPrettyNames?.get(token);
|
|
177
|
+
}
|
|
146
178
|
formatBN(arg0, arg1, arg2) {
|
|
147
179
|
const token = typeof arg0 === "object" ? arg0.token : arg0;
|
|
148
180
|
const amount = typeof arg0 === "object" ? arg0.balance : arg1;
|
|
@@ -5,6 +5,6 @@ import { BaseContract, ContractParseError } from "./BaseContract.js";
|
|
|
5
5
|
import { MissingSerializedParamsError } from "./errors.js";
|
|
6
6
|
import { MultichainConstruct } from "./MultichainConstruct.js";
|
|
7
7
|
import { SDKConstruct } from "./SDKConstruct.js";
|
|
8
|
-
import { PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./token-types.js";
|
|
8
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES, PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./token-types.js";
|
|
9
9
|
import { VotingContractStatus } from "./types.js";
|
|
10
|
-
export { BaseContract, ChainContractsRegister, Construct, ContractParseError, MissingSerializedParamsError, MultichainConstruct, PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, SDKConstruct, TokensMeta, VotingContractStatus };
|
|
10
|
+
export { BaseContract, ChainContractsRegister, Construct, ContractParseError, MissingSerializedParamsError, MultichainConstruct, NON_STRATEGY_PHANTOM_TOKEN_TYPES, PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, SDKConstruct, TokensMeta, VotingContractStatus };
|
|
@@ -12,5 +12,17 @@ const PHANTOM_TOKEN_CONTRACT_TYPES = [
|
|
|
12
12
|
const RWA_UNDERLYING_DEFAULT = "RWA_UNDERLYING::DEFAULT";
|
|
13
13
|
const RWA_UNDERLYING_ON_DEMAND = "RWA_UNDERLYING::ON_DEMAND";
|
|
14
14
|
const RWA_ON_DEMAND_LP_MONOPOLIZED = "ON_DEMAND_LP::MONOPOLIZED";
|
|
15
|
+
/**
|
|
16
|
+
* Withdrawal and redemption phantom tokens that can never be acquired as a
|
|
17
|
+
* strategy target. Other `PHANTOM_TOKEN::*` types (Convex, Infrared, staking
|
|
18
|
+
* rewards) can.
|
|
19
|
+
*/
|
|
20
|
+
const NON_STRATEGY_PHANTOM_TOKEN_TYPES = [
|
|
21
|
+
"PHANTOM_TOKEN::INFINIFI_UNWIND",
|
|
22
|
+
"PHANTOM_TOKEN::MELLOW_WITHDRAWAL",
|
|
23
|
+
"PHANTOM_TOKEN::MIDAS_REDEMPTION",
|
|
24
|
+
"PHANTOM_TOKEN::SECURITIZE_RD",
|
|
25
|
+
"PHANTOM_TOKEN::UPSHIFT_WITHDRAW"
|
|
26
|
+
];
|
|
15
27
|
//#endregion
|
|
16
|
-
export { PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND };
|
|
28
|
+
export { NON_STRATEGY_PHANTOM_TOKEN_TYPES, PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND };
|
|
@@ -106,7 +106,15 @@ const chains = {
|
|
|
106
106
|
"0xb46edf298989F0F106EDD80E4ae8f59a13531dB4",
|
|
107
107
|
"0xd98e31C67c7C21f233C37c9AC9Ae656dcb0d5d25"
|
|
108
108
|
]),
|
|
109
|
-
sunsetStrategies: new AddressSet([
|
|
109
|
+
sunsetStrategies: new AddressSet([
|
|
110
|
+
"0x1840056a2bdbe949e017a3716e3fdd4a0d327bf0",
|
|
111
|
+
"0x187C5022002d45107dB72B0b59E72111f69Bd513",
|
|
112
|
+
"0x9fF97B167Dd442bd5f277098bf1154C5807D3566",
|
|
113
|
+
"0xa4c644f3180d10cd3b2121d455a2a88e1bda2928",
|
|
114
|
+
"0xb79d6544839d169869476589d2e54014a074317b",
|
|
115
|
+
"0xc307a074bd5aec2d6ad1d9b74465c24a59b490fd",
|
|
116
|
+
"0xf5edc34204e67e592bdcb84114571c9e4bd0bdf7"
|
|
117
|
+
]),
|
|
110
118
|
isPublic: true,
|
|
111
119
|
wellKnownToken: {
|
|
112
120
|
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
@@ -542,15 +550,5 @@ function getLegacyStrategyTarget(creditManager, network) {
|
|
|
542
550
|
function getAccountTargetCollateral(creditAccount, network) {
|
|
543
551
|
return getChain(network).accountTargetCollaterals?.get(creditAccount);
|
|
544
552
|
}
|
|
545
|
-
/**
|
|
546
|
-
* Curated display name of a token, or `undefined` when the token has none and
|
|
547
|
-
* its ticker symbol should be used instead.
|
|
548
|
-
*
|
|
549
|
-
* @param token - Token address.
|
|
550
|
-
* @param network - Chain id or {@link NetworkType} label.
|
|
551
|
-
**/
|
|
552
|
-
function getTokenPrettyName(token, network) {
|
|
553
|
-
return getChain(network).tokenPrettyNames?.get(token);
|
|
554
|
-
}
|
|
555
553
|
//#endregion
|
|
556
|
-
export { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType,
|
|
554
|
+
export { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType,
|
|
1
|
+
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds } from "./chains.js";
|
|
2
2
|
import { detectNetwork } from "./detectNetwork.js";
|
|
3
|
-
export { NetworkType, SUPPORTED_NETWORKS, chains, detectNetwork, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType,
|
|
3
|
+
export { NetworkType, SUPPORTED_NETWORKS, chains, detectNetwork, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
2
1
|
import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
|
|
3
2
|
import { isV310 } from "../constants/versions.js";
|
|
4
3
|
import "../constants/index.js";
|
|
5
4
|
import { hexEq } from "../utils/hex.js";
|
|
5
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
6
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
7
7
|
//#region src/sdk/core/createAddressProvider.ts
|
|
8
8
|
const OVERRIDE_ADDRESSES = { Mainnet: {
|
package/dist/esm/sdk/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { BigIntMath } from "./utils/bigint-math.js";
|
|
|
7
7
|
import { bytes32ToString } from "./utils/bytes32ToString.js";
|
|
8
8
|
import { childLogger } from "./utils/childLogger.js";
|
|
9
9
|
import { createRawTx } from "./utils/createRawTx.js";
|
|
10
|
-
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType,
|
|
10
|
+
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAccountTargetCollateral, getAssetType, getChain, getCuratorName, getLegacyStrategyTarget, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds } from "./chain/chains.js";
|
|
11
11
|
import { detectNetwork } from "./chain/detectNetwork.js";
|
|
12
12
|
import "./chain/index.js";
|
|
13
13
|
import { etherscanApiUrl, etherscanUrl } from "./utils/etherscan.js";
|
|
@@ -38,7 +38,7 @@ import { BaseContract, ContractParseError } from "./base/BaseContract.js";
|
|
|
38
38
|
import { MissingSerializedParamsError } from "./base/errors.js";
|
|
39
39
|
import { MultichainConstruct } from "./base/MultichainConstruct.js";
|
|
40
40
|
import { SDKConstruct } from "./base/SDKConstruct.js";
|
|
41
|
-
import { PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./base/token-types.js";
|
|
41
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES, PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./base/token-types.js";
|
|
42
42
|
import { VotingContractStatus } from "./base/types.js";
|
|
43
43
|
import "./base/index.js";
|
|
44
44
|
import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
|
|
@@ -134,7 +134,7 @@ import { CreditFacadeV310Contract } from "./market/credit/CreditFacadeV310Contra
|
|
|
134
134
|
import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./market/math.js";
|
|
135
135
|
import { CreditManagerV310Contract } from "./market/credit/CreditManagerV310Contract.js";
|
|
136
136
|
import { strategyName } from "./market/strategyName.js";
|
|
137
|
-
import {
|
|
137
|
+
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./market/credit/collateralUtils.js";
|
|
138
138
|
import { CreditSuite } from "./market/credit/CreditSuite.js";
|
|
139
139
|
import { expectedBalanceDeltas } from "./market/credit/expectedBalanceDeltas.js";
|
|
140
140
|
import { simulateMulticall } from "./utils/viem/simulateMulticall.js";
|
|
@@ -238,4 +238,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
|
|
|
238
238
|
import { MultichainSDK } from "./MultichainSDK.js";
|
|
239
239
|
import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
240
240
|
import "./types/index.js";
|
|
241
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError,
|
|
241
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, IntentPreviewError, InvalidDelayedIntentError, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcBorrowApy, calcBorrowRate, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, chains, childLogger, classifyCurveOperation, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, rayToBps, rayToNumber, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
2
2
|
import { isRWAToken, isSunsetPool } from "../chain/chains.js";
|
|
3
|
+
import { PERCENTAGE_FACTOR } from "../constants/math.js";
|
|
3
4
|
import "../utils/index.js";
|
|
4
5
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
5
6
|
import "../base/index.js";
|
|
@@ -164,11 +165,16 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
164
165
|
quotaAssets() {
|
|
165
166
|
const oracle = this.priceOracle;
|
|
166
167
|
const { underlying } = this;
|
|
167
|
-
|
|
168
|
+
const quotas = this.pool.pqk.quotas.entries();
|
|
169
|
+
const sumUsed = quotas.reduce((sum, [, quota]) => sum + quota.totalQuoted, 0n);
|
|
170
|
+
const { totalBorrowed } = this.pool.pool;
|
|
171
|
+
return quotas.map(([token, quota]) => ({
|
|
168
172
|
token: this.tokensMeta.mustGetToken(token),
|
|
169
173
|
quotaRate: quota.rate,
|
|
170
174
|
limit: oracle.toAmount(underlying, quota.limit),
|
|
171
|
-
used: oracle.toAmount(underlying, quota.totalQuoted)
|
|
175
|
+
used: oracle.toAmount(underlying, quota.totalQuoted),
|
|
176
|
+
allocationShare: sumUsed === 0n ? 0 : Number(quota.totalQuoted * PERCENTAGE_FACTOR / sumUsed),
|
|
177
|
+
allocatedDebt: oracle.toAmount(underlying, sumUsed === 0n ? 0n : totalBorrowed * quota.totalQuoted / sumUsed)
|
|
172
178
|
}));
|
|
173
179
|
}
|
|
174
180
|
/**
|
|
@@ -223,7 +229,8 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
223
229
|
collateralTokens: this.collateralTokens,
|
|
224
230
|
paused: pool.isPaused,
|
|
225
231
|
rwa: this.rwa,
|
|
226
|
-
sunset: this.sunset
|
|
232
|
+
sunset: this.sunset,
|
|
233
|
+
quotaAssets: this.quotaAssets()
|
|
227
234
|
};
|
|
228
235
|
}
|
|
229
236
|
/**
|
|
@@ -232,8 +239,7 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
232
239
|
poolOpportunityDetail() {
|
|
233
240
|
return {
|
|
234
241
|
...this.poolOpportunity(),
|
|
235
|
-
rateCurve: this.pool.rateCurve
|
|
236
|
-
quotaAssets: this.quotaAssets()
|
|
242
|
+
rateCurve: this.pool.rateCurve
|
|
237
243
|
};
|
|
238
244
|
}
|
|
239
245
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
1
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
|
+
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
3
3
|
//#region src/sdk/market/adapters/contracts/AccountMigratorAdapterContract.ts
|
|
4
4
|
const abi = accountMigratorAbi;
|
|
5
5
|
const protocolAbi = accountMigratorAbi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
2
1
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
3
2
|
import "../../../base/index.js";
|
|
3
|
+
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
4
4
|
import { iERC4626Abi } from "../abi/targetContractAbi.js";
|
|
5
5
|
import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
|
|
6
6
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
3
|
import "../../base/index.js";
|
|
4
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/sdk/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -220,7 +220,7 @@ var CreditSuite = class extends SDKConstruct {
|
|
|
220
220
|
get strategyName() {
|
|
221
221
|
const collateral = this.strategyTargetCollateral;
|
|
222
222
|
if (!collateral) return;
|
|
223
|
-
return strategyName(this.tokensMeta.mustGetToken(collateral), this.market.underlyingToken
|
|
223
|
+
return strategyName(this.tokensMeta.mustGetToken(collateral), this.market.underlyingToken);
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Describes this suite's leveraged strategy as the shared read model does,
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import "../../constants/math.js";
|
|
2
2
|
import "../../constants/index.js";
|
|
3
|
+
import { NON_STRATEGY_PHANTOM_TOKEN_TYPES } from "../../base/token-types.js";
|
|
3
4
|
import { isAddressEqual } from "viem";
|
|
4
5
|
//#region src/sdk/market/credit/collateralUtils.ts
|
|
5
|
-
/**
|
|
6
|
-
* Withdrawal and redemption phantom tokens that can never be acquired as a
|
|
7
|
-
* strategy target. Other `PHANTOM_TOKEN::*` types (Convex, Infrared, staking
|
|
8
|
-
* rewards) can.
|
|
9
|
-
*/
|
|
10
|
-
const NON_STRATEGY_PHANTOM_TOKEN_TYPES = [
|
|
11
|
-
"PHANTOM_TOKEN::INFINIFI_UNWIND",
|
|
12
|
-
"PHANTOM_TOKEN::MELLOW_WITHDRAWAL",
|
|
13
|
-
"PHANTOM_TOKEN::MIDAS_REDEMPTION",
|
|
14
|
-
"PHANTOM_TOKEN::SECURITIZE_RD",
|
|
15
|
-
"PHANTOM_TOKEN::UPSHIFT_WITHDRAW"
|
|
16
|
-
];
|
|
17
6
|
const NON_STRATEGY_PHANTOM_TOKEN_TYPE_SET = new Set(NON_STRATEGY_PHANTOM_TOKEN_TYPES);
|
|
18
7
|
const RWA_UNDERLYING_PREFIX = "RWA_UNDERLYING::";
|
|
19
8
|
/**
|
|
@@ -90,4 +79,4 @@ function dominantCollateral(account, market) {
|
|
|
90
79
|
return dominant;
|
|
91
80
|
}
|
|
92
81
|
//#endregion
|
|
93
|
-
export {
|
|
82
|
+
export { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
@@ -2,8 +2,8 @@ import { CreditConfiguratorV310Contract } from "./CreditConfiguratorV310Contract
|
|
|
2
2
|
import { CreditFacadeV310BaseContract, creditFacadeV310Abi as abi } from "./CreditFacadeV310BaseContract.js";
|
|
3
3
|
import { CreditFacadeV310Contract } from "./CreditFacadeV310Contract.js";
|
|
4
4
|
import { CreditManagerV310Contract } from "./CreditManagerV310Contract.js";
|
|
5
|
-
import {
|
|
5
|
+
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
|
|
6
6
|
import { CreditSuite } from "./CreditSuite.js";
|
|
7
7
|
import { expectedBalanceDeltas } from "./expectedBalanceDeltas.js";
|
|
8
8
|
import "./types.js";
|
|
9
|
-
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite,
|
|
9
|
+
export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
|
|
@@ -90,7 +90,7 @@ import { CreditFacadeV310Contract } from "./credit/CreditFacadeV310Contract.js";
|
|
|
90
90
|
import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, PARTIAL_LIQUIDATION_BUFFER_BPS, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./math.js";
|
|
91
91
|
import { CreditManagerV310Contract } from "./credit/CreditManagerV310Contract.js";
|
|
92
92
|
import { strategyName } from "./strategyName.js";
|
|
93
|
-
import {
|
|
93
|
+
import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./credit/collateralUtils.js";
|
|
94
94
|
import { CreditSuite } from "./credit/CreditSuite.js";
|
|
95
95
|
import { expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
|
|
96
96
|
import "./credit/index.js";
|
|
@@ -144,4 +144,4 @@ import { RWARegistry } from "./rwa/RWARegistry.js";
|
|
|
144
144
|
import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
|
|
145
145
|
import "./rwa/index.js";
|
|
146
146
|
import "./types.js";
|
|
147
|
-
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract,
|
|
147
|
+
export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, classifyCurveOperation, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
4
3
|
import { RAY } from "../../constants/math.js";
|
|
@@ -7,6 +6,7 @@ import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
|
|
|
7
6
|
import "../../utils/index.js";
|
|
8
7
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
8
|
import "../../base/index.js";
|
|
9
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
10
10
|
import { calcUtilization } from "../math.js";
|
|
11
11
|
//#region src/sdk/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { getTokenPrettyName } from "../chain/chains.js";
|
|
2
1
|
//#region src/sdk/market/strategyName.ts
|
|
3
2
|
/**
|
|
4
3
|
* Display name of a leveraged strategy: the target collateral over the
|
|
5
4
|
* borrowed underlying, e.g. `"wstETH / WETH"`.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Uses each token's display {@link Token.symbol}, which may already be a
|
|
7
|
+
* curated pretty name or a `"source -> target"` redemption rewrite.
|
|
9
8
|
*
|
|
10
9
|
* @param target - Collateral the position is built around.
|
|
11
10
|
* @param underlying - Token the position borrows.
|
|
12
|
-
* @param network - Chain id or network type label of the market.
|
|
13
11
|
**/
|
|
14
|
-
function strategyName(target, underlying
|
|
15
|
-
return `${
|
|
12
|
+
function strategyName(target, underlying) {
|
|
13
|
+
return `${target.symbol} / ${underlying.symbol}`;
|
|
16
14
|
}
|
|
17
15
|
//#endregion
|
|
18
16
|
export { strategyName };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
1
|
import { ZapperContract } from "./ZapperContract.js";
|
|
2
|
+
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
3
3
|
//#region src/sdk/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|