@gearbox-protocol/sdk 14.12.0-next.75 → 14.12.0-next.77
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/curators.js +1 -0
- package/dist/cjs/model/curators.schema.js +38 -0
- package/dist/cjs/model/index.js +4 -1
- package/dist/cjs/model/opportunities.schema.js +3 -1
- package/dist/cjs/model/primitives.schema.js +0 -9
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +13 -140
- package/dist/cjs/sdk/accounts/bots/AccountBotsService.js +132 -0
- package/dist/cjs/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
- package/dist/cjs/sdk/accounts/bots/abi.js +19 -0
- package/dist/cjs/sdk/accounts/bots/index.js +6 -0
- package/dist/cjs/sdk/accounts/bots/types.js +1 -0
- package/dist/cjs/sdk/accounts/index.js +5 -0
- package/dist/cjs/sdk/chain/chains.js +1 -1
- package/dist/cjs/sdk/index.js +4 -0
- package/dist/cjs/sdk/market/MarketConfiguratorContract.js +2 -14
- package/dist/cjs/sdk/market/MarketSuite.js +1 -0
- package/dist/cjs/sdk/market/ZapperRegister.js +1 -1
- package/dist/cjs/sdk/market/credit/CreditSuite.js +31 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/curators.js +1 -0
- package/dist/esm/model/curators.schema.js +36 -0
- package/dist/esm/model/index.js +4 -2
- package/dist/esm/model/opportunities.schema.js +3 -1
- package/dist/esm/model/primitives.schema.js +1 -9
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +17 -144
- package/dist/esm/sdk/accounts/bots/AccountBotsService.js +131 -0
- package/dist/esm/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
- package/dist/esm/sdk/accounts/bots/abi.js +18 -0
- package/dist/esm/sdk/accounts/bots/index.js +4 -0
- package/dist/esm/sdk/accounts/bots/types.js +1 -0
- package/dist/esm/sdk/accounts/index.js +4 -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 +2 -2
- package/dist/esm/sdk/chain/chains.js +1 -1
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +3 -1
- package/dist/esm/sdk/market/MarketConfiguratorContract.js +2 -14
- package/dist/esm/sdk/market/MarketSuite.js +1 -0
- package/dist/esm/sdk/market/ZapperRegister.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditSuite.js +31 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- 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/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/model/curators.d.ts +33 -0
- package/dist/types/model/curators.schema.d.ts +50 -0
- package/dist/types/model/index.d.ts +5 -3
- package/dist/types/model/opportunities.d.ts +6 -1
- package/dist/types/model/opportunities.schema.d.ts +160 -9
- package/dist/types/model/primitives.d.ts +1 -25
- package/dist/types/model/primitives.schema.d.ts +1 -9
- package/dist/types/new-sdk/AbstractNamespace.d.ts +2 -2
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
- package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +1 -1
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +9 -16
- package/dist/types/sdk/accounts/bots/AccountBotsService.d.ts +38 -0
- package/dist/types/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts +236 -0
- package/dist/types/sdk/accounts/bots/abi.d.ts +18 -0
- package/dist/types/sdk/accounts/bots/index.d.ts +4 -0
- package/dist/types/sdk/accounts/bots/types.d.ts +143 -0
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +1 -1
- package/dist/types/sdk/accounts/index.d.ts +6 -2
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +2 -2
- package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +10 -84
- package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
- package/dist/types/sdk/chain/chains.d.ts +7 -11
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +6 -3
- package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +3 -8
- package/dist/types/sdk/market/MarketSuite.d.ts +3 -2
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +1 -1
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +26 -1
- package/dist/types/sdk/market/credit/types.d.ts +1 -1
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +2 -2
- package/dist/types/sdk/market/oracle/types.d.ts +2 -2
- package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +1 -1
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +1 -1
- package/dist/types/sdk/market/pool/types.d.ts +1 -1
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +1 -1
- package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +2 -2
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
let zod_v4 = require("zod/v4");
|
|
4
|
+
//#region src/model/curators.schema.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runtime schemas for {@link ./curators.js}, see the note in
|
|
7
|
+
* `primitives.schema.ts` on why they are written by hand.
|
|
8
|
+
**/
|
|
9
|
+
/**
|
|
10
|
+
* {@link CuratorName}
|
|
11
|
+
**/
|
|
12
|
+
const curatorNameSchema = zod_v4.z.enum([
|
|
13
|
+
"Chaos Labs",
|
|
14
|
+
"K3",
|
|
15
|
+
"cp0x",
|
|
16
|
+
"Re7",
|
|
17
|
+
"Invariant Group",
|
|
18
|
+
"Tulipa",
|
|
19
|
+
"M11 Credit",
|
|
20
|
+
"KPK",
|
|
21
|
+
"Hyperithm",
|
|
22
|
+
"UltraYield",
|
|
23
|
+
"TelosC",
|
|
24
|
+
"Gami Labs",
|
|
25
|
+
"Securitize",
|
|
26
|
+
"Testnet Curator"
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* {@link Curator}
|
|
30
|
+
**/
|
|
31
|
+
const curatorSchema = zod_v4.z.object({
|
|
32
|
+
address: require_sdk_utils_zod.ZodAddress(),
|
|
33
|
+
name: curatorNameSchema.optional(),
|
|
34
|
+
url: zod_v4.z.string().nullable()
|
|
35
|
+
});
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.curatorNameSchema = curatorNameSchema;
|
|
38
|
+
exports.curatorSchema = curatorSchema;
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./curators.js");
|
|
3
|
+
const require_model_curators_schema = require("./curators.schema.js");
|
|
2
4
|
const require_model_history = require("./history.js");
|
|
3
5
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
6
|
const require_model_opportunities_schema = require("./opportunities.schema.js");
|
|
@@ -18,7 +20,8 @@ exports.apyBreakdownSchema = require_model_opportunities_schema.apyBreakdownSche
|
|
|
18
20
|
exports.assetTypeSchema = require_model_primitives_schema.assetTypeSchema;
|
|
19
21
|
exports.bpsSchema = require_model_primitives_schema.bpsSchema;
|
|
20
22
|
exports.chainIdSchema = require_model_primitives_schema.chainIdSchema;
|
|
21
|
-
exports.
|
|
23
|
+
exports.curatorNameSchema = require_model_curators_schema.curatorNameSchema;
|
|
24
|
+
exports.curatorSchema = require_model_curators_schema.curatorSchema;
|
|
22
25
|
exports.delayedReceivedAssetSchema = require_model_liquidations_schema.delayedReceivedAssetSchema;
|
|
23
26
|
exports.historyChartMetadataSchema = require_model_history_schema.historyChartMetadataSchema;
|
|
24
27
|
exports.historyMetricSchema = require_model_history_schema.historyMetricSchema;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_sdk_utils_zod = require("../sdk/utils/zod.js");
|
|
3
|
+
const require_model_curators_schema = require("./curators.schema.js");
|
|
3
4
|
const require_model_primitives_schema = require("./primitives.schema.js");
|
|
4
5
|
let zod_v4 = require("zod/v4");
|
|
5
6
|
//#region src/model/opportunities.schema.ts
|
|
@@ -53,7 +54,7 @@ const apyBreakdownSchema = zod_v4.z.object({
|
|
|
53
54
|
const opportunityBaseSchema = zod_v4.z.object({
|
|
54
55
|
chainId: require_model_primitives_schema.chainIdSchema,
|
|
55
56
|
name: zod_v4.z.string(),
|
|
56
|
-
curator:
|
|
57
|
+
curator: require_model_curators_schema.curatorSchema,
|
|
57
58
|
underlyingToken: require_model_primitives_schema.tokenSchema,
|
|
58
59
|
totalBorrow: require_model_primitives_schema.amountSchema,
|
|
59
60
|
collateralTokens: zod_v4.z.array(require_model_primitives_schema.tokenSchema),
|
|
@@ -69,6 +70,7 @@ const poolOpportunitySchema = zod_v4.z.object({
|
|
|
69
70
|
kind: zod_v4.z.literal("pool"),
|
|
70
71
|
pool: require_sdk_utils_zod.ZodAddress(),
|
|
71
72
|
totalSupply: require_model_primitives_schema.amountSchema,
|
|
73
|
+
availableLiquidity: require_model_primitives_schema.amountSchema,
|
|
72
74
|
utilization: require_model_primitives_schema.bpsSchema,
|
|
73
75
|
supplyApy: apyBreakdownSchema
|
|
74
76
|
});
|
|
@@ -64,20 +64,11 @@ const txCallSchema = zod_v4.z.object({
|
|
|
64
64
|
callData: require_sdk_utils_zod.ZodHex(),
|
|
65
65
|
value: zod_v4.z.bigint().optional()
|
|
66
66
|
});
|
|
67
|
-
/**
|
|
68
|
-
* {@link Curator}
|
|
69
|
-
**/
|
|
70
|
-
const curatorSchema = zod_v4.z.object({
|
|
71
|
-
address: require_sdk_utils_zod.ZodAddress(),
|
|
72
|
-
name: zod_v4.z.string(),
|
|
73
|
-
url: zod_v4.z.string().nullable()
|
|
74
|
-
});
|
|
75
67
|
//#endregion
|
|
76
68
|
exports.amountSchema = amountSchema;
|
|
77
69
|
exports.assetTypeSchema = assetTypeSchema;
|
|
78
70
|
exports.bpsSchema = bpsSchema;
|
|
79
71
|
exports.chainIdSchema = chainIdSchema;
|
|
80
|
-
exports.curatorSchema = curatorSchema;
|
|
81
72
|
exports.leverageSchema = leverageSchema;
|
|
82
73
|
exports.timestampSchema = timestampSchema;
|
|
83
74
|
exports.tokenAmountSchema = tokenAmountSchema;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_abi_iBaseRewardPool = require("../../abi/iBaseRewardPool.js");
|
|
3
3
|
const require_abi_ierc4626Adapter = require("../../abi/ierc4626Adapter.js");
|
|
4
|
-
const require_abi_310_generated = require("../../abi/310/generated.js");
|
|
5
|
-
const require_abi_compressors_peripheryCompressor = require("../../abi/compressors/peripheryCompressor.js");
|
|
6
|
-
const require_abi_compressors_rewardsCompressor = require("../../abi/compressors/rewardsCompressor.js");
|
|
7
4
|
const require_sdk_constants_address_provider = require("../constants/address-provider.js");
|
|
8
5
|
const require_sdk_constants_addresses = require("../constants/addresses.js");
|
|
9
6
|
const require_sdk_constants_math = require("../constants/math.js");
|
|
@@ -11,6 +8,9 @@ const require_sdk_constants_versions = require("../constants/versions.js");
|
|
|
11
8
|
require("../constants/index.js");
|
|
12
9
|
const require_sdk_base_SDKConstruct = require("../base/SDKConstruct.js");
|
|
13
10
|
require("../base/index.js");
|
|
11
|
+
const require_sdk_accounts_bots_AccountBotsService = require("./bots/AccountBotsService.js");
|
|
12
|
+
require("./bots/index.js");
|
|
13
|
+
const require_abi_compressors_rewardsCompressor = require("../../abi/compressors/rewardsCompressor.js");
|
|
14
14
|
const require_sdk_accounts_credit_account_compressor_CreditAccountCompressor = require("./credit-account-compressor/CreditAccountCompressor.js");
|
|
15
15
|
require("./credit-account-compressor/index.js");
|
|
16
16
|
const require_sdk_accounts_multicall_utils = require("./multicall-utils.js");
|
|
@@ -27,9 +27,14 @@ let viem = require("viem");
|
|
|
27
27
|
**/
|
|
28
28
|
var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKConstruct {
|
|
29
29
|
#compressor;
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc ICreditAccountsService.bots}
|
|
32
|
+
**/
|
|
33
|
+
bots;
|
|
30
34
|
constructor(sdk) {
|
|
31
35
|
super(sdk);
|
|
32
36
|
this.#compressor = new require_sdk_accounts_credit_account_compressor_CreditAccountCompressor.CreditAccountCompressor(sdk);
|
|
37
|
+
this.bots = new require_sdk_accounts_bots_AccountBotsService.AccountBotsService(sdk);
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* {@inheritDoc ICreditAccountsService.getCreditAccountData}
|
|
@@ -93,76 +98,6 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
93
98
|
return Object.values(r);
|
|
94
99
|
}
|
|
95
100
|
/**
|
|
96
|
-
* {@inheritDoc ICreditAccountsService.getConnectedBots}
|
|
97
|
-
**/
|
|
98
|
-
async getConnectedBots(accountsToCheck, legacyMigrationBot, additionalBots) {
|
|
99
|
-
const allResp = await this.client.multicall({
|
|
100
|
-
contracts: [
|
|
101
|
-
...accountsToCheck.map((o) => {
|
|
102
|
-
const pool = this.sdk.marketRegister.findByCreditManager(o.creditManager);
|
|
103
|
-
return {
|
|
104
|
-
abi: require_abi_compressors_peripheryCompressor.peripheryCompressorAbi,
|
|
105
|
-
address: this.peripheryCompressor,
|
|
106
|
-
functionName: "getConnectedBots",
|
|
107
|
-
args: [pool.configurator.address, o.creditAccount]
|
|
108
|
-
};
|
|
109
|
-
}),
|
|
110
|
-
...legacyMigrationBot ? accountsToCheck.map((ca) => {
|
|
111
|
-
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
112
|
-
return {
|
|
113
|
-
abi: require_abi_310_generated.iBotListV310Abi,
|
|
114
|
-
address: cm.creditFacade.botList,
|
|
115
|
-
functionName: "getBotStatus",
|
|
116
|
-
args: [legacyMigrationBot, ca.creditAccount]
|
|
117
|
-
};
|
|
118
|
-
}) : [],
|
|
119
|
-
...accountsToCheck.flatMap((ca) => {
|
|
120
|
-
const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
|
|
121
|
-
return additionalBots.map((bot) => {
|
|
122
|
-
return {
|
|
123
|
-
abi: require_abi_310_generated.iBotListV310Abi,
|
|
124
|
-
address: cm.creditFacade.botList,
|
|
125
|
-
functionName: "getBotStatus",
|
|
126
|
-
args: [bot, ca.creditAccount]
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
})
|
|
130
|
-
],
|
|
131
|
-
allowFailure: true,
|
|
132
|
-
batchSize: 0
|
|
133
|
-
});
|
|
134
|
-
const legacyStart = 0;
|
|
135
|
-
const legacyEnd = accountsToCheck.length;
|
|
136
|
-
const legacy = allResp.slice(legacyStart, legacyEnd);
|
|
137
|
-
const migrationStart = legacyEnd;
|
|
138
|
-
const migrationEnd = legacyMigrationBot ? migrationStart + accountsToCheck.length : migrationStart;
|
|
139
|
-
const migrationResp = allResp.slice(migrationStart, migrationEnd);
|
|
140
|
-
const additionalStart = migrationEnd;
|
|
141
|
-
const additionalResp = allResp.slice(additionalStart);
|
|
142
|
-
return {
|
|
143
|
-
legacy,
|
|
144
|
-
additionalBots: this.#getActiveBots(accountsToCheck, additionalBots, additionalResp),
|
|
145
|
-
legacyMigration: this.#getActiveMigrationBots(accountsToCheck, legacyMigrationBot, migrationResp)
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
#getActiveBots(accountsToCheck, bots, result) {
|
|
149
|
-
if (result.length !== bots.length * accountsToCheck.length) console.error("result length mismatch", result.length, bots.length * accountsToCheck.length);
|
|
150
|
-
return accountsToCheck.reduce((acc, _, index) => {
|
|
151
|
-
const r = result.slice(index * bots.length, (index + 1) * bots.length);
|
|
152
|
-
acc.push({ result: r });
|
|
153
|
-
return acc;
|
|
154
|
-
}, []);
|
|
155
|
-
}
|
|
156
|
-
#getActiveMigrationBots(accountsToCheck, bot, result) {
|
|
157
|
-
if (bot) {
|
|
158
|
-
if (result.length !== accountsToCheck.length) console.error("result length mismatch for migration bots", result.length, accountsToCheck.length);
|
|
159
|
-
return {
|
|
160
|
-
result,
|
|
161
|
-
botAddress: bot
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
101
|
* {@inheritDoc ICreditAccountsService.fullyLiquidate}
|
|
167
102
|
**/
|
|
168
103
|
async fullyLiquidate(props) {
|
|
@@ -289,15 +224,13 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
289
224
|
async getApprovalAddress(options) {
|
|
290
225
|
const { creditManager } = options;
|
|
291
226
|
const suite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
292
|
-
|
|
293
|
-
if (factory) return factory.getApprovalAddress(options);
|
|
294
|
-
return suite.creditManager.address;
|
|
227
|
+
return suite.rwaFactory ? suite.rwaFactory.getApprovalAddress(options) : suite.creditManager.address;
|
|
295
228
|
}
|
|
296
229
|
/**
|
|
297
230
|
* {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
|
|
298
231
|
*/
|
|
299
232
|
async getOpenAccountRequirements(borrower, creditManager, props) {
|
|
300
|
-
const { rwaFactory } = this.sdk.marketRegister.
|
|
233
|
+
const { rwaFactory } = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
301
234
|
if (!rwaFactory) return;
|
|
302
235
|
return rwaFactory.getOpenAccountRequirements(borrower, props);
|
|
303
236
|
}
|
|
@@ -324,9 +257,7 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
324
257
|
...callsAfter ?? []
|
|
325
258
|
];
|
|
326
259
|
const calls = await this.prependPriceUpdates(cm.address, operationCalls);
|
|
327
|
-
|
|
328
|
-
if (reopenCreditAccount) tx = await this.#multicallTx(cmSuite, reopenCreditAccount, calls);
|
|
329
|
-
else tx = await this.#openCreditAccountTx(cmSuite, to, calls, referralCode, rwaOptions);
|
|
260
|
+
const tx = reopenCreditAccount ? cmSuite.multicallTx(reopenCreditAccount, calls) : cmSuite.openCreditAccountTx(to, calls, referralCode, rwaOptions);
|
|
330
261
|
tx.value = ethAmount.toString(10);
|
|
331
262
|
return tx;
|
|
332
263
|
}
|
|
@@ -401,34 +332,6 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
401
332
|
return this.#rwaVaultCalls("depositDiff", amount, creditManager);
|
|
402
333
|
}
|
|
403
334
|
/**
|
|
404
|
-
* {@inheritDoc ICreditAccountsService.setBot}
|
|
405
|
-
*/
|
|
406
|
-
async setBot({ botAddress, permissions: defaultPermissions, targetContract }) {
|
|
407
|
-
const cm = this.sdk.marketRegister.findCreditManager(targetContract.creditManager);
|
|
408
|
-
const permissions = defaultPermissions !== null ? defaultPermissions : await (0, viem.getContract)({
|
|
409
|
-
address: botAddress,
|
|
410
|
-
client: this.sdk.client,
|
|
411
|
-
abi: [{
|
|
412
|
-
type: "function",
|
|
413
|
-
name: "requiredPermissions",
|
|
414
|
-
inputs: [],
|
|
415
|
-
outputs: [{
|
|
416
|
-
name: "",
|
|
417
|
-
type: "uint192",
|
|
418
|
-
internalType: "uint192"
|
|
419
|
-
}],
|
|
420
|
-
stateMutability: "view"
|
|
421
|
-
}]
|
|
422
|
-
}).read.requiredPermissions();
|
|
423
|
-
const addBotCall = cm.creditFacade.prepareSetBotPermissions(botAddress, permissions);
|
|
424
|
-
const calls = targetContract.type === "creditAccount" ? await this.prependPriceUpdates(targetContract.creditManager, [addBotCall], targetContract) : [addBotCall];
|
|
425
|
-
return {
|
|
426
|
-
tx: targetContract.type === "creditAccount" ? await this.#multicallTx(cm, targetContract.creditAccount, calls) : void 0,
|
|
427
|
-
calls,
|
|
428
|
-
creditFacade: cm.creditFacade
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
335
|
* {@inheritDoc ICreditAccountsService.assembleRepayCreditAccountCalls}
|
|
433
336
|
*/
|
|
434
337
|
async assembleRepayCreditAccountCalls({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, calls: wrapCalls = [] }) {
|
|
@@ -468,7 +371,7 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
468
371
|
averageQuota
|
|
469
372
|
})];
|
|
470
373
|
const calls = await this.prependPriceUpdates(ca.creditManager, operationCalls, ca);
|
|
471
|
-
return
|
|
374
|
+
return cm.multicallTx(ca.creditAccount, calls);
|
|
472
375
|
}
|
|
473
376
|
/**
|
|
474
377
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
@@ -541,7 +444,7 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
541
444
|
async executeCaUpdate(creditAccount, calls, options) {
|
|
542
445
|
const cm = this.sdk.marketRegister.findCreditManager(creditAccount.creditManager);
|
|
543
446
|
const callsWithPrices = await this.prependPriceUpdates(creditAccount.creditManager, calls, creditAccount, { ignoreReservePrices: options?.ignoreReservePrices });
|
|
544
|
-
const tx =
|
|
447
|
+
const tx = cm.multicallTx(creditAccount.creditAccount, callsWithPrices);
|
|
545
448
|
if (options?.ethAmount && options.ethAmount > 0n) tx.value = options.ethAmount.toString(10);
|
|
546
449
|
return tx;
|
|
547
450
|
}
|
|
@@ -578,36 +481,6 @@ var CreditAccountsServiceV310 = class extends require_sdk_base_SDKConstruct.SDKC
|
|
|
578
481
|
get rewardCompressor() {
|
|
579
482
|
return this.sdk.addressProvider.mustGetLatest(require_sdk_constants_address_provider.AP_REWARDS_COMPRESSOR, require_sdk_constants_versions.VERSION_RANGE_310)[0];
|
|
580
483
|
}
|
|
581
|
-
get peripheryCompressor() {
|
|
582
|
-
return this.sdk.addressProvider.mustGetLatest(require_sdk_constants_address_provider.AP_PERIPHERY_COMPRESSOR, require_sdk_constants_versions.VERSION_RANGE_310)[0];
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* Wrapper that selects between credit facade and RWA factory
|
|
586
|
-
* @param suite
|
|
587
|
-
* @param to
|
|
588
|
-
* @param calls
|
|
589
|
-
* @param referralCode
|
|
590
|
-
* @param rwaOptions
|
|
591
|
-
* @returns
|
|
592
|
-
*/
|
|
593
|
-
async #openCreditAccountTx(suite, to, calls, referralCode, rwaOptions) {
|
|
594
|
-
const factory = this.sdk.marketRegister.findByPool(suite.pool).rwaFactory;
|
|
595
|
-
if (factory) return factory.openCreditAccount(suite.creditManager.address, calls, rwaOptions);
|
|
596
|
-
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Wrapper that selects between credit facade and RWA factory
|
|
600
|
-
* @param suite
|
|
601
|
-
* @param creditAccount
|
|
602
|
-
* @param calls
|
|
603
|
-
* @param rwaOptions
|
|
604
|
-
* @returns
|
|
605
|
-
*/
|
|
606
|
-
async #multicallTx(suite, creditAccount, calls, rwaOptions) {
|
|
607
|
-
const factory = this.sdk.marketRegister.findByCreditManager(suite.creditManager.address).rwaFactory;
|
|
608
|
-
if (factory) return factory.multicall(creditAccount, calls, rwaOptions);
|
|
609
|
-
return suite.creditFacade.multicall(creditAccount, calls);
|
|
610
|
-
}
|
|
611
484
|
/**
|
|
612
485
|
* Withdrawal compressor of the current chain.
|
|
613
486
|
* @throws If no withdrawal compressor is supported on the current chain.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_abi_310_generated = require("../../../abi/310/generated.js");
|
|
3
|
+
const require_sdk_constants_address_provider = require("../../constants/address-provider.js");
|
|
4
|
+
const require_sdk_constants_versions = require("../../constants/versions.js");
|
|
5
|
+
require("../../constants/index.js");
|
|
6
|
+
const require_sdk_base_SDKConstruct = require("../../base/SDKConstruct.js");
|
|
7
|
+
require("../../base/index.js");
|
|
8
|
+
const require_sdk_accounts_bots_abi = require("./abi.js");
|
|
9
|
+
const require_sdk_accounts_bots_PeripheryCompressorV310Contract = require("./PeripheryCompressorV310Contract.js");
|
|
10
|
+
//#region src/sdk/accounts/bots/AccountBotsService.ts
|
|
11
|
+
/**
|
|
12
|
+
* Bots of credit accounts.
|
|
13
|
+
*
|
|
14
|
+
* Reads which bots are connected to an account and with which permissions,
|
|
15
|
+
* and builds the transactions that connect or disconnect one.
|
|
16
|
+
**/
|
|
17
|
+
var AccountBotsService = class extends require_sdk_base_SDKConstruct.SDKConstruct {
|
|
18
|
+
/**
|
|
19
|
+
* Reads the bots connected to each of the given credit accounts.
|
|
20
|
+
*
|
|
21
|
+
* All reads go out as a single multicall, split into three groups: the
|
|
22
|
+
* periphery compressor's view of each account, the status of the legacy
|
|
23
|
+
* migration bot on each account, and the status of every bot in
|
|
24
|
+
* `additionalBots` on every account.
|
|
25
|
+
*
|
|
26
|
+
* @param accountsToCheck - Accounts to read, with their credit managers.
|
|
27
|
+
* @param legacyMigrationBot - Legacy migration bot to check, if any.
|
|
28
|
+
* @param additionalBots - Bots to check on every account.
|
|
29
|
+
**/
|
|
30
|
+
async getConnectedBots(accountsToCheck, legacyMigrationBot, additionalBots) {
|
|
31
|
+
const compressor = this.#compressor;
|
|
32
|
+
const compressorCalls = accountsToCheck.map(({ creditManager, creditAccount }) => {
|
|
33
|
+
const { configurator } = this.sdk.marketRegister.findByCreditManager(creditManager);
|
|
34
|
+
return compressor.connectedBotsCall(configurator.address, creditAccount);
|
|
35
|
+
});
|
|
36
|
+
const migrationCalls = legacyMigrationBot ? accountsToCheck.map((account) => this.#botStatusCall(account, legacyMigrationBot)) : [];
|
|
37
|
+
const additionalCalls = accountsToCheck.flatMap((account) => additionalBots.map((bot) => this.#botStatusCall(account, bot)));
|
|
38
|
+
const responses = await this.client.multicall({
|
|
39
|
+
contracts: [
|
|
40
|
+
...compressorCalls,
|
|
41
|
+
...migrationCalls,
|
|
42
|
+
...additionalCalls
|
|
43
|
+
],
|
|
44
|
+
allowFailure: true,
|
|
45
|
+
batchSize: 0
|
|
46
|
+
});
|
|
47
|
+
const migrationStart = compressorCalls.length;
|
|
48
|
+
const additionalStart = migrationStart + migrationCalls.length;
|
|
49
|
+
return {
|
|
50
|
+
legacy: responses.slice(0, migrationStart),
|
|
51
|
+
legacyMigration: this.#migrationBotStatuses(legacyMigrationBot, accountsToCheck.length, responses.slice(migrationStart, additionalStart)),
|
|
52
|
+
additionalBots: this.#botStatusesPerAccount(accountsToCheck.length, additionalBots.length, responses.slice(additionalStart))
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Connects or disconnects a bot, and updates prices when the bot is set on a
|
|
57
|
+
* credit account.
|
|
58
|
+
*
|
|
59
|
+
* @param props - {@link SetBotProps}
|
|
60
|
+
* @returns Everything needed to execute the operation. Setting a bot on a
|
|
61
|
+
* credit manager only yields calls, since it is not a standalone transaction.
|
|
62
|
+
**/
|
|
63
|
+
async setBot({ botAddress, permissions: defaultPermissions, targetContract }) {
|
|
64
|
+
const cm = this.sdk.marketRegister.findCreditManager(targetContract.creditManager);
|
|
65
|
+
const permissions = defaultPermissions !== null ? defaultPermissions : await this.client.readContract({
|
|
66
|
+
address: botAddress,
|
|
67
|
+
abi: require_sdk_accounts_bots_abi.iBotAbi,
|
|
68
|
+
functionName: "requiredPermissions"
|
|
69
|
+
});
|
|
70
|
+
const addBotCall = cm.creditFacade.prepareSetBotPermissions(botAddress, permissions);
|
|
71
|
+
if (targetContract.type !== "creditAccount") return {
|
|
72
|
+
calls: [addBotCall],
|
|
73
|
+
creditFacade: cm.creditFacade
|
|
74
|
+
};
|
|
75
|
+
const calls = await this.sdk.accounts.prependPriceUpdates(targetContract.creditManager, [addBotCall], targetContract);
|
|
76
|
+
return {
|
|
77
|
+
tx: cm.multicallTx(targetContract.creditAccount, calls),
|
|
78
|
+
calls,
|
|
79
|
+
creditFacade: cm.creditFacade
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Descriptor of a `getBotStatus` call on the bot list of an account's
|
|
84
|
+
* credit facade.
|
|
85
|
+
**/
|
|
86
|
+
#botStatusCall({ creditManager, creditAccount }, bot) {
|
|
87
|
+
const { creditFacade } = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
88
|
+
return {
|
|
89
|
+
abi: require_abi_310_generated.iBotListV310Abi,
|
|
90
|
+
address: creditFacade.botList,
|
|
91
|
+
functionName: "getBotStatus",
|
|
92
|
+
args: [bot, creditAccount]
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Regroups the flat `additionalBots` responses into one entry per account,
|
|
97
|
+
* keeping the order the bots were requested in.
|
|
98
|
+
**/
|
|
99
|
+
#botStatusesPerAccount(accounts, botsPerAccount, responses) {
|
|
100
|
+
this.#checkLength(responses, accounts * botsPerAccount, "bots");
|
|
101
|
+
const perAccount = [];
|
|
102
|
+
for (let i = 0; i < accounts; i++) perAccount.push({ result: responses.slice(i * botsPerAccount, (i + 1) * botsPerAccount) });
|
|
103
|
+
return perAccount;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Migration bot statuses, or `undefined` when no migration bot was queried.
|
|
107
|
+
**/
|
|
108
|
+
#migrationBotStatuses(bot, accounts, responses) {
|
|
109
|
+
if (!bot) return;
|
|
110
|
+
this.#checkLength(responses, accounts, "migration bots");
|
|
111
|
+
return {
|
|
112
|
+
result: responses,
|
|
113
|
+
botAddress: bot
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
#checkLength(responses, expected, what) {
|
|
117
|
+
if (responses.length !== expected) this.logger?.error(`result length mismatch for ${what}: got ${responses.length}, expected ${expected}`);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Periphery compressor of the current chain.
|
|
121
|
+
*
|
|
122
|
+
* Resolved on every access, because the address provider is only populated
|
|
123
|
+
* once the SDK is attached or hydrated; the contracts register acts as the
|
|
124
|
+
* cache.
|
|
125
|
+
**/
|
|
126
|
+
get #compressor() {
|
|
127
|
+
const [address] = this.sdk.addressProvider.mustGetLatest(require_sdk_constants_address_provider.AP_PERIPHERY_COMPRESSOR, require_sdk_constants_versions.VERSION_RANGE_310);
|
|
128
|
+
return this.sdk.getContract(address) ?? new require_sdk_accounts_bots_PeripheryCompressorV310Contract.PeripheryCompressorV310Contract(this.sdk, address);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.AccountBotsService = AccountBotsService;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_base_BaseContract = require("../../base/BaseContract.js");
|
|
3
|
+
require("../../base/index.js");
|
|
4
|
+
//#region src/sdk/accounts/bots/PeripheryCompressorV310Contract.ts
|
|
5
|
+
const abi = require("../../../abi/compressors/peripheryCompressor.js").peripheryCompressorAbi;
|
|
6
|
+
var PeripheryCompressorV310Contract = class extends require_sdk_base_BaseContract.BaseContract {
|
|
7
|
+
constructor(sdk, address) {
|
|
8
|
+
super(sdk, {
|
|
9
|
+
addr: address,
|
|
10
|
+
name: "PeripheryCompressorV310",
|
|
11
|
+
abi,
|
|
12
|
+
version: 310
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Descriptor of a `getConnectedBots` call on this compressor.
|
|
17
|
+
*
|
|
18
|
+
* @param marketConfigurator - Configurator that governs the account's market.
|
|
19
|
+
* @param creditAccount - Credit account to list the connected bots of.
|
|
20
|
+
**/
|
|
21
|
+
connectedBotsCall(marketConfigurator, creditAccount) {
|
|
22
|
+
return {
|
|
23
|
+
abi,
|
|
24
|
+
address: this.address,
|
|
25
|
+
functionName: "getConnectedBots",
|
|
26
|
+
args: [marketConfigurator, creditAccount]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.PeripheryCompressorV310Contract = PeripheryCompressorV310Contract;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/sdk/accounts/bots/abi.ts
|
|
3
|
+
/**
|
|
4
|
+
* Minimal bot interface: the permissions a bot needs to operate on a credit
|
|
5
|
+
* account, which the SDK reads when the caller does not specify them.
|
|
6
|
+
**/
|
|
7
|
+
const iBotAbi = [{
|
|
8
|
+
type: "function",
|
|
9
|
+
name: "requiredPermissions",
|
|
10
|
+
inputs: [],
|
|
11
|
+
outputs: [{
|
|
12
|
+
name: "",
|
|
13
|
+
type: "uint192",
|
|
14
|
+
internalType: "uint192"
|
|
15
|
+
}],
|
|
16
|
+
stateMutability: "view"
|
|
17
|
+
}];
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.iBotAbi = iBotAbi;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_accounts_bots_PeripheryCompressorV310Contract = require("./PeripheryCompressorV310Contract.js");
|
|
3
|
+
const require_sdk_accounts_bots_AccountBotsService = require("./AccountBotsService.js");
|
|
4
|
+
require("./types.js");
|
|
5
|
+
exports.AccountBotsService = require_sdk_accounts_bots_AccountBotsService.AccountBotsService;
|
|
6
|
+
exports.PeripheryCompressorV310Contract = require_sdk_accounts_bots_PeripheryCompressorV310Contract.PeripheryCompressorV310Contract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_accounts_bots_PeripheryCompressorV310Contract = require("./bots/PeripheryCompressorV310Contract.js");
|
|
3
|
+
const require_sdk_accounts_bots_AccountBotsService = require("./bots/AccountBotsService.js");
|
|
4
|
+
require("./bots/index.js");
|
|
2
5
|
const require_sdk_accounts_credit_account_compressor_CreditAccountCompressorV310Contract = require("./credit-account-compressor/CreditAccountCompressorV310Contract.js");
|
|
3
6
|
const require_sdk_accounts_credit_account_compressor_CreditAccountCompressor = require("./credit-account-compressor/CreditAccountCompressor.js");
|
|
4
7
|
require("./credit-account-compressor/index.js");
|
|
@@ -23,6 +26,7 @@ const require_sdk_accounts_withdrawal_compressor_WithdrawalCompressorV313Contrac
|
|
|
23
26
|
const require_sdk_accounts_withdrawal_compressor_createWithdrawalCompressor = require("./withdrawal-compressor/createWithdrawalCompressor.js");
|
|
24
27
|
require("./withdrawal-compressor/index.js");
|
|
25
28
|
exports.AbstractWithdrawalCompressorContract = require_sdk_accounts_withdrawal_compressor_AbstractWithdrawalCompressorContract.AbstractWithdrawalCompressorContract;
|
|
29
|
+
exports.AccountBotsService = require_sdk_accounts_bots_AccountBotsService.AccountBotsService;
|
|
26
30
|
exports.CreditAccountCompressor = require_sdk_accounts_credit_account_compressor_CreditAccountCompressor.CreditAccountCompressor;
|
|
27
31
|
exports.CreditAccountCompressorV310Contract = require_sdk_accounts_credit_account_compressor_CreditAccountCompressorV310Contract.CreditAccountCompressorV310Contract;
|
|
28
32
|
exports.CreditAccountOperationsService = require_sdk_accounts_intents_index.CreditAccountOperationsService;
|
|
@@ -34,6 +38,7 @@ exports.LIQUIDATION_APPROVAL_BUFFER = require_sdk_accounts_liquidations_constant
|
|
|
34
38
|
exports.LIQUIDATION_COMPRESSOR_V313_ADDRESS = require_sdk_accounts_liquidations_constants.LIQUIDATION_COMPRESSOR_V313_ADDRESS;
|
|
35
39
|
exports.LiquidationsService = require_sdk_accounts_liquidations_LiquidationsService.LiquidationsService;
|
|
36
40
|
exports.MultichainLiquidationsService = require_sdk_accounts_liquidations_MultichainLiquidationsService.MultichainLiquidationsService;
|
|
41
|
+
exports.PeripheryCompressorV310Contract = require_sdk_accounts_bots_PeripheryCompressorV310Contract.PeripheryCompressorV310Contract;
|
|
37
42
|
exports.RedemptionLoggerV310Contract = require_sdk_accounts_withdrawal_compressor_RedemptionLoggerV310Contract.RedemptionLoggerV310Contract;
|
|
38
43
|
exports.WithdrawalCompressorV310Contract = require_sdk_accounts_withdrawal_compressor_WithdrawalCompressorV310Contract.WithdrawalCompressorV310Contract;
|
|
39
44
|
exports.WithdrawalCompressorV311Contract = require_sdk_accounts_withdrawal_compressor_WithdrawalCompressorV311Contract.WithdrawalCompressorV311Contract;
|
|
@@ -375,7 +375,7 @@ function isPublicNetwork(networkOrChainId) {
|
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
|
-
* Looks up the {@link
|
|
378
|
+
* Looks up the {@link CuratorName} name for a market configurator address.
|
|
379
379
|
*
|
|
380
380
|
* Searches default and test market configurators across all chains, or
|
|
381
381
|
* a single network if provided.
|
package/dist/cjs/sdk/index.js
CHANGED
|
@@ -43,6 +43,8 @@ const require_sdk_base_SDKConstruct = require("./base/SDKConstruct.js");
|
|
|
43
43
|
const require_sdk_base_token_types = require("./base/token-types.js");
|
|
44
44
|
const require_sdk_base_types = require("./base/types.js");
|
|
45
45
|
require("./base/index.js");
|
|
46
|
+
const require_sdk_accounts_bots_PeripheryCompressorV310Contract = require("./accounts/bots/PeripheryCompressorV310Contract.js");
|
|
47
|
+
const require_sdk_accounts_bots_AccountBotsService = require("./accounts/bots/AccountBotsService.js");
|
|
46
48
|
const require_sdk_market_adapters_PlaceholderAdapterContracts = require("./market/adapters/PlaceholderAdapterContracts.js");
|
|
47
49
|
const require_sdk_market_adapters_createAdapter = require("./market/adapters/createAdapter.js");
|
|
48
50
|
const require_sdk_market_credit_CreditConfiguratorV310Contract = require("./market/credit/CreditConfiguratorV310Contract.js");
|
|
@@ -185,6 +187,7 @@ exports.AP_ZERO_PRICE_FEED = require_sdk_constants_address_provider.AP_ZERO_PRIC
|
|
|
185
187
|
exports.AbstractLPPriceFeedContract = require_sdk_market_pricefeeds_AbstractLPPriceFeed.AbstractLPPriceFeedContract;
|
|
186
188
|
exports.AbstractPriceFeedContract = require_sdk_market_pricefeeds_AbstractPriceFeed.AbstractPriceFeedContract;
|
|
187
189
|
exports.AbstractWithdrawalCompressorContract = require_sdk_accounts_withdrawal_compressor_AbstractWithdrawalCompressorContract.AbstractWithdrawalCompressorContract;
|
|
190
|
+
exports.AccountBotsService = require_sdk_accounts_bots_AccountBotsService.AccountBotsService;
|
|
188
191
|
exports.AddressMap = require_sdk_utils_AddressMap.AddressMap;
|
|
189
192
|
exports.AddressProviderV310Contract = require_sdk_core_AddressProviderV310Contract.AddressProviderV310Contract;
|
|
190
193
|
exports.AddressSet = require_sdk_utils_AddressSet.AddressSet;
|
|
@@ -261,6 +264,7 @@ exports.PRICE_DECIMALS = require_sdk_constants_math.PRICE_DECIMALS;
|
|
|
261
264
|
exports.PRICE_DECIMALS_POW = require_sdk_constants_math.PRICE_DECIMALS_POW;
|
|
262
265
|
exports.PartialPriceFeedInitError = require_sdk_market_pricefeeds_AbstractPriceFeed.PartialPriceFeedInitError;
|
|
263
266
|
exports.PendleTWAPPTPriceFeed = require_sdk_market_pricefeeds_PendleTWAPPTPriceFeed.PendleTWAPPTPriceFeed;
|
|
267
|
+
exports.PeripheryCompressorV310Contract = require_sdk_accounts_bots_PeripheryCompressorV310Contract.PeripheryCompressorV310Contract;
|
|
264
268
|
exports.PlaceholderAdapterContract = require_sdk_market_adapters_PlaceholderAdapterContracts.PlaceholderAdapterContract;
|
|
265
269
|
exports.PlaceholderContract = require_sdk_base_PlaceholderContract.PlaceholderContract;
|
|
266
270
|
exports.PluginStateVersionError = require_sdk_plugins_errors.PluginStateVersionError;
|
|
@@ -9,7 +9,6 @@ let viem = require("viem");
|
|
|
9
9
|
//#region src/sdk/market/MarketConfiguratorContract.ts
|
|
10
10
|
const abi = require_abi_310_generated.iMarketConfiguratorV310Abi;
|
|
11
11
|
var MarketConfiguratorContract = class extends require_sdk_base_BaseContract.BaseContract {
|
|
12
|
-
#curatorName;
|
|
13
12
|
constructor(options, address) {
|
|
14
13
|
super(options, {
|
|
15
14
|
abi,
|
|
@@ -18,24 +17,13 @@ var MarketConfiguratorContract = class extends require_sdk_base_BaseContract.Bas
|
|
|
18
17
|
version: 0
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
async loadCuratorName() {
|
|
22
|
-
this.#curatorName = await this.client.readContract({
|
|
23
|
-
address: this.address,
|
|
24
|
-
abi: this.abi,
|
|
25
|
-
functionName: "curatorName"
|
|
26
|
-
});
|
|
27
|
-
this.register.setAddressLabel(this.address, `Market configurator ${this.#curatorName}`);
|
|
28
|
-
}
|
|
29
20
|
/**
|
|
30
|
-
* The entity operating this configurator
|
|
31
|
-
* it. The curated per-chain table wins over the name the contract reports,
|
|
32
|
-
* because the two sources must agree across services and only the table is
|
|
33
|
-
* shared with the backend.
|
|
21
|
+
* The entity operating this configurator
|
|
34
22
|
*/
|
|
35
23
|
get curator() {
|
|
36
24
|
return {
|
|
37
25
|
address: this.address,
|
|
38
|
-
name: require_sdk_chain_chains.getCuratorName(this.address, this.networkType)
|
|
26
|
+
name: require_sdk_chain_chains.getCuratorName(this.address, this.networkType),
|
|
39
27
|
url: null
|
|
40
28
|
};
|
|
41
29
|
}
|
|
@@ -223,6 +223,7 @@ var MarketSuite = class extends require_sdk_base_SDKConstruct.SDKConstruct {
|
|
|
223
223
|
curator: this.curator,
|
|
224
224
|
underlyingToken: this.underlyingToken,
|
|
225
225
|
totalSupply: oracle.toAmount(pool.underlying, pool.totalAssets),
|
|
226
|
+
availableLiquidity: oracle.toAmount(pool.underlying, pool.availableLiquidity),
|
|
226
227
|
totalBorrow: oracle.toAmount(pool.underlying, pool.totalBorrowed),
|
|
227
228
|
utilization: pool.utilization,
|
|
228
229
|
supplyApy: { organicApy: require_sdk_market_math.rayToBps(pool.supplyRate) },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_abi_compressors_peripheryCompressor = require("../../abi/compressors/peripheryCompressor.js");
|
|
3
2
|
const require_sdk_utils_AddressMap = require("../utils/AddressMap.js");
|
|
4
3
|
const require_sdk_constants_address_provider = require("../constants/address-provider.js");
|
|
5
4
|
const require_sdk_constants_versions = require("../constants/versions.js");
|
|
@@ -8,6 +7,7 @@ const require_sdk_utils_hex = require("../utils/hex.js");
|
|
|
8
7
|
require("../utils/index.js");
|
|
9
8
|
const require_sdk_base_SDKConstruct = require("../base/SDKConstruct.js");
|
|
10
9
|
require("../base/index.js");
|
|
10
|
+
const require_abi_compressors_peripheryCompressor = require("../../abi/compressors/peripheryCompressor.js");
|
|
11
11
|
const require_sdk_market_zapper_createZapper = require("./zapper/createZapper.js");
|
|
12
12
|
require("./zapper/index.js");
|
|
13
13
|
//#region src/sdk/market/ZapperRegister.ts
|