@gearbox-protocol/sdk 3.0.0-vfour.110 → 3.0.0-vfour.112
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/sdk/index.cjs +227 -0
- package/dist/cjs/sdk/index.d.ts +25 -1
- package/dist/esm/sdk/index.d.mts +25 -1
- package/dist/esm/sdk/index.mjs +227 -1
- package/package.json +2 -2
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -14154,6 +14154,166 @@ var linearInterestRateModelV3Abi = [
|
|
|
14154
14154
|
{ type: "error", inputs: [], name: "BorrowingMoreThanU2ForbiddenException" },
|
|
14155
14155
|
{ type: "error", inputs: [], name: "IncorrectParameterException" }
|
|
14156
14156
|
];
|
|
14157
|
+
var partialLiquidationBotV3Abi = [
|
|
14158
|
+
{
|
|
14159
|
+
type: "constructor",
|
|
14160
|
+
inputs: [
|
|
14161
|
+
{ name: "addressProvider", internalType: "address", type: "address" },
|
|
14162
|
+
{ name: "minHealthFactor_", internalType: "uint16", type: "uint16" },
|
|
14163
|
+
{ name: "maxHealthFactor_", internalType: "uint16", type: "uint16" },
|
|
14164
|
+
{ name: "premiumScaleFactor_", internalType: "uint16", type: "uint16" },
|
|
14165
|
+
{ name: "feeScaleFactor_", internalType: "uint16", type: "uint16" }
|
|
14166
|
+
],
|
|
14167
|
+
stateMutability: "nonpayable"
|
|
14168
|
+
},
|
|
14169
|
+
{
|
|
14170
|
+
type: "function",
|
|
14171
|
+
inputs: [],
|
|
14172
|
+
name: "contractsRegister",
|
|
14173
|
+
outputs: [{ name: "", internalType: "address", type: "address" }],
|
|
14174
|
+
stateMutability: "view"
|
|
14175
|
+
},
|
|
14176
|
+
{
|
|
14177
|
+
type: "function",
|
|
14178
|
+
inputs: [],
|
|
14179
|
+
name: "feeScaleFactor",
|
|
14180
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14181
|
+
stateMutability: "view"
|
|
14182
|
+
},
|
|
14183
|
+
{
|
|
14184
|
+
type: "function",
|
|
14185
|
+
inputs: [
|
|
14186
|
+
{ name: "creditAccount", internalType: "address", type: "address" },
|
|
14187
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14188
|
+
{ name: "seizedAmount", internalType: "uint256", type: "uint256" },
|
|
14189
|
+
{ name: "maxRepaidAmount", internalType: "uint256", type: "uint256" },
|
|
14190
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
14191
|
+
{
|
|
14192
|
+
name: "priceUpdates",
|
|
14193
|
+
internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
|
|
14194
|
+
type: "tuple[]",
|
|
14195
|
+
components: [
|
|
14196
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14197
|
+
{ name: "reserve", internalType: "bool", type: "bool" },
|
|
14198
|
+
{ name: "data", internalType: "bytes", type: "bytes" }
|
|
14199
|
+
]
|
|
14200
|
+
}
|
|
14201
|
+
],
|
|
14202
|
+
name: "liquidateExactCollateral",
|
|
14203
|
+
outputs: [
|
|
14204
|
+
{ name: "repaidAmount", internalType: "uint256", type: "uint256" }
|
|
14205
|
+
],
|
|
14206
|
+
stateMutability: "nonpayable"
|
|
14207
|
+
},
|
|
14208
|
+
{
|
|
14209
|
+
type: "function",
|
|
14210
|
+
inputs: [
|
|
14211
|
+
{ name: "creditAccount", internalType: "address", type: "address" },
|
|
14212
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14213
|
+
{ name: "repaidAmount", internalType: "uint256", type: "uint256" },
|
|
14214
|
+
{ name: "minSeizedAmount", internalType: "uint256", type: "uint256" },
|
|
14215
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
14216
|
+
{
|
|
14217
|
+
name: "priceUpdates",
|
|
14218
|
+
internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
|
|
14219
|
+
type: "tuple[]",
|
|
14220
|
+
components: [
|
|
14221
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14222
|
+
{ name: "reserve", internalType: "bool", type: "bool" },
|
|
14223
|
+
{ name: "data", internalType: "bytes", type: "bytes" }
|
|
14224
|
+
]
|
|
14225
|
+
}
|
|
14226
|
+
],
|
|
14227
|
+
name: "liquidateExactDebt",
|
|
14228
|
+
outputs: [
|
|
14229
|
+
{ name: "seizedAmount", internalType: "uint256", type: "uint256" }
|
|
14230
|
+
],
|
|
14231
|
+
stateMutability: "nonpayable"
|
|
14232
|
+
},
|
|
14233
|
+
{
|
|
14234
|
+
type: "function",
|
|
14235
|
+
inputs: [],
|
|
14236
|
+
name: "maxHealthFactor",
|
|
14237
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14238
|
+
stateMutability: "view"
|
|
14239
|
+
},
|
|
14240
|
+
{
|
|
14241
|
+
type: "function",
|
|
14242
|
+
inputs: [],
|
|
14243
|
+
name: "minHealthFactor",
|
|
14244
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14245
|
+
stateMutability: "view"
|
|
14246
|
+
},
|
|
14247
|
+
{
|
|
14248
|
+
type: "function",
|
|
14249
|
+
inputs: [],
|
|
14250
|
+
name: "premiumScaleFactor",
|
|
14251
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14252
|
+
stateMutability: "view"
|
|
14253
|
+
},
|
|
14254
|
+
{
|
|
14255
|
+
type: "function",
|
|
14256
|
+
inputs: [],
|
|
14257
|
+
name: "treasury",
|
|
14258
|
+
outputs: [{ name: "", internalType: "address", type: "address" }],
|
|
14259
|
+
stateMutability: "view"
|
|
14260
|
+
},
|
|
14261
|
+
{
|
|
14262
|
+
type: "function",
|
|
14263
|
+
inputs: [],
|
|
14264
|
+
name: "version",
|
|
14265
|
+
outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
|
|
14266
|
+
stateMutability: "view"
|
|
14267
|
+
},
|
|
14268
|
+
{
|
|
14269
|
+
type: "event",
|
|
14270
|
+
anonymous: false,
|
|
14271
|
+
inputs: [
|
|
14272
|
+
{
|
|
14273
|
+
name: "creditManager",
|
|
14274
|
+
internalType: "address",
|
|
14275
|
+
type: "address",
|
|
14276
|
+
indexed: true
|
|
14277
|
+
},
|
|
14278
|
+
{
|
|
14279
|
+
name: "creditAccount",
|
|
14280
|
+
internalType: "address",
|
|
14281
|
+
type: "address",
|
|
14282
|
+
indexed: true
|
|
14283
|
+
},
|
|
14284
|
+
{
|
|
14285
|
+
name: "token",
|
|
14286
|
+
internalType: "address",
|
|
14287
|
+
type: "address",
|
|
14288
|
+
indexed: true
|
|
14289
|
+
},
|
|
14290
|
+
{
|
|
14291
|
+
name: "repaidDebt",
|
|
14292
|
+
internalType: "uint256",
|
|
14293
|
+
type: "uint256",
|
|
14294
|
+
indexed: false
|
|
14295
|
+
},
|
|
14296
|
+
{
|
|
14297
|
+
name: "seizedCollateral",
|
|
14298
|
+
internalType: "uint256",
|
|
14299
|
+
type: "uint256",
|
|
14300
|
+
indexed: false
|
|
14301
|
+
},
|
|
14302
|
+
{ name: "fee", internalType: "uint256", type: "uint256", indexed: false }
|
|
14303
|
+
],
|
|
14304
|
+
name: "LiquidatePartial"
|
|
14305
|
+
},
|
|
14306
|
+
{ type: "error", inputs: [], name: "CreditAccountNotLiquidatableException" },
|
|
14307
|
+
{ type: "error", inputs: [], name: "IncorrectParameterException" },
|
|
14308
|
+
{ type: "error", inputs: [], name: "LiquidatedLessThanNeededException" },
|
|
14309
|
+
{ type: "error", inputs: [], name: "LiquidatedMoreThanNeededException" },
|
|
14310
|
+
{ type: "error", inputs: [], name: "PriceFeedDoesNotExistException" },
|
|
14311
|
+
{ type: "error", inputs: [], name: "RegisteredCreditManagerOnlyException" },
|
|
14312
|
+
{ type: "error", inputs: [], name: "RepaidMoreThanAllowedException" },
|
|
14313
|
+
{ type: "error", inputs: [], name: "SeizedLessThanRequiredException" },
|
|
14314
|
+
{ type: "error", inputs: [], name: "UnderlyingNotLiquidatableException" },
|
|
14315
|
+
{ type: "error", inputs: [], name: "ZeroAddressException" }
|
|
14316
|
+
];
|
|
14157
14317
|
var poolQuotaKeeperV3Abi = [
|
|
14158
14318
|
{
|
|
14159
14319
|
type: "constructor",
|
|
@@ -27325,6 +27485,72 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
27325
27485
|
return this.sdk.marketRegister.pools.map((p) => p.pool.address);
|
|
27326
27486
|
}
|
|
27327
27487
|
};
|
|
27488
|
+
var BotsService = class extends SDKConstruct {
|
|
27489
|
+
/**
|
|
27490
|
+
* Returns bots data payload
|
|
27491
|
+
* @param addresses
|
|
27492
|
+
* @returns
|
|
27493
|
+
*/
|
|
27494
|
+
async getBotsData(addresses) {
|
|
27495
|
+
const addressesList = Object.entries(addresses);
|
|
27496
|
+
const BOT_INFO_LENGTH = 4;
|
|
27497
|
+
const infoResp = await this.provider.publicClient.multicall({
|
|
27498
|
+
allowFailure: false,
|
|
27499
|
+
multicallAddress: sdkGov.MULTICALL_ADDRESS,
|
|
27500
|
+
contracts: addressesList.map(([, address]) => [
|
|
27501
|
+
{
|
|
27502
|
+
address,
|
|
27503
|
+
abi: partialLiquidationBotV3Abi,
|
|
27504
|
+
functionName: "minHealthFactor",
|
|
27505
|
+
args: []
|
|
27506
|
+
},
|
|
27507
|
+
{
|
|
27508
|
+
address,
|
|
27509
|
+
abi: partialLiquidationBotV3Abi,
|
|
27510
|
+
functionName: "maxHealthFactor",
|
|
27511
|
+
args: []
|
|
27512
|
+
},
|
|
27513
|
+
{
|
|
27514
|
+
address,
|
|
27515
|
+
abi: partialLiquidationBotV3Abi,
|
|
27516
|
+
functionName: "premiumScaleFactor",
|
|
27517
|
+
args: []
|
|
27518
|
+
},
|
|
27519
|
+
{
|
|
27520
|
+
address,
|
|
27521
|
+
abi: partialLiquidationBotV3Abi,
|
|
27522
|
+
functionName: "feeScaleFactor",
|
|
27523
|
+
args: []
|
|
27524
|
+
}
|
|
27525
|
+
]).flat(1)
|
|
27526
|
+
});
|
|
27527
|
+
const currentType = "liquidationProtection";
|
|
27528
|
+
const bots = addressesList.reduce(
|
|
27529
|
+
(acc, [type, address], index) => {
|
|
27530
|
+
const from = index * BOT_INFO_LENGTH;
|
|
27531
|
+
const to = (index + 1) * BOT_INFO_LENGTH;
|
|
27532
|
+
const [
|
|
27533
|
+
minHealthFactor,
|
|
27534
|
+
maxHealthFactor,
|
|
27535
|
+
premiumScaleFactor,
|
|
27536
|
+
feeScaleFactor
|
|
27537
|
+
] = infoResp.slice(from, to);
|
|
27538
|
+
acc[currentType].push({
|
|
27539
|
+
address,
|
|
27540
|
+
baseType: currentType,
|
|
27541
|
+
detailedType: type,
|
|
27542
|
+
minHealthFactor,
|
|
27543
|
+
maxHealthFactor,
|
|
27544
|
+
premiumScaleFactor,
|
|
27545
|
+
feeScaleFactor
|
|
27546
|
+
});
|
|
27547
|
+
return acc;
|
|
27548
|
+
},
|
|
27549
|
+
{ liquidationProtection: [] }
|
|
27550
|
+
);
|
|
27551
|
+
return bots;
|
|
27552
|
+
}
|
|
27553
|
+
};
|
|
27328
27554
|
var AddressProviderContractV3_1 = class extends BaseContract {
|
|
27329
27555
|
#addresses = {};
|
|
27330
27556
|
versions = {};
|
|
@@ -27981,6 +28207,7 @@ exports.BalancerWeightedPriceFeedContract = BalancerWeightedPriceFeedContract;
|
|
|
27981
28207
|
exports.BaseContract = BaseContract;
|
|
27982
28208
|
exports.BotListContract = BotListContract;
|
|
27983
28209
|
exports.BotPermissions = BotPermissions;
|
|
28210
|
+
exports.BotsService = BotsService;
|
|
27984
28211
|
exports.BoundedPriceFeedContract = BoundedPriceFeedContract;
|
|
27985
28212
|
exports.CamelotV3AdapterContract = CamelotV3AdapterContract;
|
|
27986
28213
|
exports.ChainlinkPriceFeedContract = ChainlinkPriceFeedContract;
|
package/dist/cjs/sdk/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
2
|
import { Address, Chain, Transport, PublicClient, Abi, DecodeFunctionDataReturnType, GetEventArgs, Log, ContractEventName, Hex, ContractFunctionName, EncodeFunctionDataParameters, TransactionReceipt, UnionOmit, RequiredBy, GetContractReturnType, Client, ContractFunctionParameters, CallParameters, MulticallContracts, Narrow, AbiStateMutability, MulticallResults, GetChainContractAddressErrorType, ReadContractErrorType, GetContractErrorReturnType, EncodeFunctionDataErrorType, DecodeFunctionResultErrorType } from 'viem';
|
|
3
3
|
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
|
|
4
|
+
import { PartialRecord } from '@gearbox-protocol/sdk-gov';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Helper interface to ease v3.1 refactoring and migration from static methods
|
|
@@ -30684,6 +30685,29 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
30684
30685
|
private get pools();
|
|
30685
30686
|
}
|
|
30686
30687
|
|
|
30688
|
+
type BotBaseType = "liquidationProtection";
|
|
30689
|
+
type LiquidationBotType = "deleverageBotPegged" | "deleverageBotLV" | "deleverageBotHV";
|
|
30690
|
+
type BotDetailedType = LiquidationBotType;
|
|
30691
|
+
interface BotDataPayload {
|
|
30692
|
+
baseType: BotBaseType;
|
|
30693
|
+
detailedType: BotDetailedType;
|
|
30694
|
+
address: Address;
|
|
30695
|
+
minHealthFactor: number;
|
|
30696
|
+
maxHealthFactor: number;
|
|
30697
|
+
premiumScaleFactor: number;
|
|
30698
|
+
feeScaleFactor: number;
|
|
30699
|
+
}
|
|
30700
|
+
|
|
30701
|
+
type BotAddresses = PartialRecord<BotDetailedType, Address>;
|
|
30702
|
+
declare class BotsService extends SDKConstruct {
|
|
30703
|
+
/**
|
|
30704
|
+
* Returns bots data payload
|
|
30705
|
+
* @param addresses
|
|
30706
|
+
* @returns
|
|
30707
|
+
*/
|
|
30708
|
+
getBotsData(addresses: BotAddresses): Promise<Record<"liquidationProtection", BotDataPayload[]>>;
|
|
30709
|
+
}
|
|
30710
|
+
|
|
30687
30711
|
declare const NO_VERSION = 0;
|
|
30688
30712
|
declare const AP_ACL = "ACL";
|
|
30689
30713
|
declare const AP_CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
|
|
@@ -30826,4 +30850,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
30826
30850
|
*/
|
|
30827
30851
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
30828
30852
|
|
|
30829
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type ClaimFarmRewardsProps, type CloseCreditAccountResult, type ClosePathBalances, type CommonResult, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountDataSlice, type CreditAccountFilter, CreditAccountsService, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV300Contract, CreditConfiguratorV310Contract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, CreditManagerV300Contract, CreditManagerV310Contract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStakingDataPayload, GaugeStakingService, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, type IPriceOracleContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiVote, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, type PermitResult, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, type PriceOracleData, PriceOracleV300Contract, PriceOracleV310Contract, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, type RampEvent, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, assetsMap, balancesMap, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat, tokenToTicker };
|
|
30853
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, type BotAddresses, type BotBaseType, type BotDataPayload, type BotDetailedType, BotListContract, type BotListStateHuman, BotPermissions, BotsService, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type ClaimFarmRewardsProps, type CloseCreditAccountResult, type ClosePathBalances, type CommonResult, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountDataSlice, type CreditAccountFilter, CreditAccountsService, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV300Contract, CreditConfiguratorV310Contract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, CreditManagerV300Contract, CreditManagerV310Contract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStakingDataPayload, GaugeStakingService, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, type IPriceOracleContract, LinearModelContract, type LinearModelStateHuman, type LiquidationBotType, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiVote, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, type PermitResult, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, type PriceOracleData, PriceOracleV300Contract, PriceOracleV310Contract, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, type RampEvent, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, assetsMap, balancesMap, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat, tokenToTicker };
|
package/dist/esm/sdk/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
2
|
import { Address, Chain, Transport, PublicClient, Abi, DecodeFunctionDataReturnType, GetEventArgs, Log, ContractEventName, Hex, ContractFunctionName, EncodeFunctionDataParameters, TransactionReceipt, UnionOmit, RequiredBy, GetContractReturnType, Client, ContractFunctionParameters, CallParameters, MulticallContracts, Narrow, AbiStateMutability, MulticallResults, GetChainContractAddressErrorType, ReadContractErrorType, GetContractErrorReturnType, EncodeFunctionDataErrorType, DecodeFunctionResultErrorType } from 'viem';
|
|
3
3
|
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
|
|
4
|
+
import { PartialRecord } from '@gearbox-protocol/sdk-gov';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Helper interface to ease v3.1 refactoring and migration from static methods
|
|
@@ -30684,6 +30685,29 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
30684
30685
|
private get pools();
|
|
30685
30686
|
}
|
|
30686
30687
|
|
|
30688
|
+
type BotBaseType = "liquidationProtection";
|
|
30689
|
+
type LiquidationBotType = "deleverageBotPegged" | "deleverageBotLV" | "deleverageBotHV";
|
|
30690
|
+
type BotDetailedType = LiquidationBotType;
|
|
30691
|
+
interface BotDataPayload {
|
|
30692
|
+
baseType: BotBaseType;
|
|
30693
|
+
detailedType: BotDetailedType;
|
|
30694
|
+
address: Address;
|
|
30695
|
+
minHealthFactor: number;
|
|
30696
|
+
maxHealthFactor: number;
|
|
30697
|
+
premiumScaleFactor: number;
|
|
30698
|
+
feeScaleFactor: number;
|
|
30699
|
+
}
|
|
30700
|
+
|
|
30701
|
+
type BotAddresses = PartialRecord<BotDetailedType, Address>;
|
|
30702
|
+
declare class BotsService extends SDKConstruct {
|
|
30703
|
+
/**
|
|
30704
|
+
* Returns bots data payload
|
|
30705
|
+
* @param addresses
|
|
30706
|
+
* @returns
|
|
30707
|
+
*/
|
|
30708
|
+
getBotsData(addresses: BotAddresses): Promise<Record<"liquidationProtection", BotDataPayload[]>>;
|
|
30709
|
+
}
|
|
30710
|
+
|
|
30687
30711
|
declare const NO_VERSION = 0;
|
|
30688
30712
|
declare const AP_ACL = "ACL";
|
|
30689
30713
|
declare const AP_CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
|
|
@@ -30826,4 +30850,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
30826
30850
|
*/
|
|
30827
30851
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
30828
30852
|
|
|
30829
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type ClaimFarmRewardsProps, type CloseCreditAccountResult, type ClosePathBalances, type CommonResult, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountDataSlice, type CreditAccountFilter, CreditAccountsService, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV300Contract, CreditConfiguratorV310Contract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, CreditManagerV300Contract, CreditManagerV310Contract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStakingDataPayload, GaugeStakingService, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, type IPriceOracleContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiVote, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, type PermitResult, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, type PriceOracleData, PriceOracleV300Contract, PriceOracleV310Contract, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, type RampEvent, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, assetsMap, balancesMap, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat, tokenToTicker };
|
|
30853
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, type BotAddresses, type BotBaseType, type BotDataPayload, type BotDetailedType, BotListContract, type BotListStateHuman, BotPermissions, BotsService, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, type ClaimFarmRewardsProps, type CloseCreditAccountResult, type ClosePathBalances, type CommonResult, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountDataSlice, type CreditAccountFilter, CreditAccountsService, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV300Contract, CreditConfiguratorV310Contract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, CreditManagerV300Contract, CreditManagerV310Contract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStakingDataPayload, GaugeStakingService, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, type IPriceOracleContract, LinearModelContract, type LinearModelStateHuman, type LiquidationBotType, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiVote, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PartialPriceFeedTreeNode, type PathOption, type PathOptionSerie, type PermitResult, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, type PriceOracleData, PriceOracleV300Contract, PriceOracleV310Contract, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, type RampEvent, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKHooks, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, type ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, assetsMap, balancesMap, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat, tokenToTicker };
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -14152,6 +14152,166 @@ var linearInterestRateModelV3Abi = [
|
|
|
14152
14152
|
{ type: "error", inputs: [], name: "BorrowingMoreThanU2ForbiddenException" },
|
|
14153
14153
|
{ type: "error", inputs: [], name: "IncorrectParameterException" }
|
|
14154
14154
|
];
|
|
14155
|
+
var partialLiquidationBotV3Abi = [
|
|
14156
|
+
{
|
|
14157
|
+
type: "constructor",
|
|
14158
|
+
inputs: [
|
|
14159
|
+
{ name: "addressProvider", internalType: "address", type: "address" },
|
|
14160
|
+
{ name: "minHealthFactor_", internalType: "uint16", type: "uint16" },
|
|
14161
|
+
{ name: "maxHealthFactor_", internalType: "uint16", type: "uint16" },
|
|
14162
|
+
{ name: "premiumScaleFactor_", internalType: "uint16", type: "uint16" },
|
|
14163
|
+
{ name: "feeScaleFactor_", internalType: "uint16", type: "uint16" }
|
|
14164
|
+
],
|
|
14165
|
+
stateMutability: "nonpayable"
|
|
14166
|
+
},
|
|
14167
|
+
{
|
|
14168
|
+
type: "function",
|
|
14169
|
+
inputs: [],
|
|
14170
|
+
name: "contractsRegister",
|
|
14171
|
+
outputs: [{ name: "", internalType: "address", type: "address" }],
|
|
14172
|
+
stateMutability: "view"
|
|
14173
|
+
},
|
|
14174
|
+
{
|
|
14175
|
+
type: "function",
|
|
14176
|
+
inputs: [],
|
|
14177
|
+
name: "feeScaleFactor",
|
|
14178
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14179
|
+
stateMutability: "view"
|
|
14180
|
+
},
|
|
14181
|
+
{
|
|
14182
|
+
type: "function",
|
|
14183
|
+
inputs: [
|
|
14184
|
+
{ name: "creditAccount", internalType: "address", type: "address" },
|
|
14185
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14186
|
+
{ name: "seizedAmount", internalType: "uint256", type: "uint256" },
|
|
14187
|
+
{ name: "maxRepaidAmount", internalType: "uint256", type: "uint256" },
|
|
14188
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
14189
|
+
{
|
|
14190
|
+
name: "priceUpdates",
|
|
14191
|
+
internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
|
|
14192
|
+
type: "tuple[]",
|
|
14193
|
+
components: [
|
|
14194
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14195
|
+
{ name: "reserve", internalType: "bool", type: "bool" },
|
|
14196
|
+
{ name: "data", internalType: "bytes", type: "bytes" }
|
|
14197
|
+
]
|
|
14198
|
+
}
|
|
14199
|
+
],
|
|
14200
|
+
name: "liquidateExactCollateral",
|
|
14201
|
+
outputs: [
|
|
14202
|
+
{ name: "repaidAmount", internalType: "uint256", type: "uint256" }
|
|
14203
|
+
],
|
|
14204
|
+
stateMutability: "nonpayable"
|
|
14205
|
+
},
|
|
14206
|
+
{
|
|
14207
|
+
type: "function",
|
|
14208
|
+
inputs: [
|
|
14209
|
+
{ name: "creditAccount", internalType: "address", type: "address" },
|
|
14210
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14211
|
+
{ name: "repaidAmount", internalType: "uint256", type: "uint256" },
|
|
14212
|
+
{ name: "minSeizedAmount", internalType: "uint256", type: "uint256" },
|
|
14213
|
+
{ name: "to", internalType: "address", type: "address" },
|
|
14214
|
+
{
|
|
14215
|
+
name: "priceUpdates",
|
|
14216
|
+
internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
|
|
14217
|
+
type: "tuple[]",
|
|
14218
|
+
components: [
|
|
14219
|
+
{ name: "token", internalType: "address", type: "address" },
|
|
14220
|
+
{ name: "reserve", internalType: "bool", type: "bool" },
|
|
14221
|
+
{ name: "data", internalType: "bytes", type: "bytes" }
|
|
14222
|
+
]
|
|
14223
|
+
}
|
|
14224
|
+
],
|
|
14225
|
+
name: "liquidateExactDebt",
|
|
14226
|
+
outputs: [
|
|
14227
|
+
{ name: "seizedAmount", internalType: "uint256", type: "uint256" }
|
|
14228
|
+
],
|
|
14229
|
+
stateMutability: "nonpayable"
|
|
14230
|
+
},
|
|
14231
|
+
{
|
|
14232
|
+
type: "function",
|
|
14233
|
+
inputs: [],
|
|
14234
|
+
name: "maxHealthFactor",
|
|
14235
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14236
|
+
stateMutability: "view"
|
|
14237
|
+
},
|
|
14238
|
+
{
|
|
14239
|
+
type: "function",
|
|
14240
|
+
inputs: [],
|
|
14241
|
+
name: "minHealthFactor",
|
|
14242
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14243
|
+
stateMutability: "view"
|
|
14244
|
+
},
|
|
14245
|
+
{
|
|
14246
|
+
type: "function",
|
|
14247
|
+
inputs: [],
|
|
14248
|
+
name: "premiumScaleFactor",
|
|
14249
|
+
outputs: [{ name: "", internalType: "uint16", type: "uint16" }],
|
|
14250
|
+
stateMutability: "view"
|
|
14251
|
+
},
|
|
14252
|
+
{
|
|
14253
|
+
type: "function",
|
|
14254
|
+
inputs: [],
|
|
14255
|
+
name: "treasury",
|
|
14256
|
+
outputs: [{ name: "", internalType: "address", type: "address" }],
|
|
14257
|
+
stateMutability: "view"
|
|
14258
|
+
},
|
|
14259
|
+
{
|
|
14260
|
+
type: "function",
|
|
14261
|
+
inputs: [],
|
|
14262
|
+
name: "version",
|
|
14263
|
+
outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
|
|
14264
|
+
stateMutability: "view"
|
|
14265
|
+
},
|
|
14266
|
+
{
|
|
14267
|
+
type: "event",
|
|
14268
|
+
anonymous: false,
|
|
14269
|
+
inputs: [
|
|
14270
|
+
{
|
|
14271
|
+
name: "creditManager",
|
|
14272
|
+
internalType: "address",
|
|
14273
|
+
type: "address",
|
|
14274
|
+
indexed: true
|
|
14275
|
+
},
|
|
14276
|
+
{
|
|
14277
|
+
name: "creditAccount",
|
|
14278
|
+
internalType: "address",
|
|
14279
|
+
type: "address",
|
|
14280
|
+
indexed: true
|
|
14281
|
+
},
|
|
14282
|
+
{
|
|
14283
|
+
name: "token",
|
|
14284
|
+
internalType: "address",
|
|
14285
|
+
type: "address",
|
|
14286
|
+
indexed: true
|
|
14287
|
+
},
|
|
14288
|
+
{
|
|
14289
|
+
name: "repaidDebt",
|
|
14290
|
+
internalType: "uint256",
|
|
14291
|
+
type: "uint256",
|
|
14292
|
+
indexed: false
|
|
14293
|
+
},
|
|
14294
|
+
{
|
|
14295
|
+
name: "seizedCollateral",
|
|
14296
|
+
internalType: "uint256",
|
|
14297
|
+
type: "uint256",
|
|
14298
|
+
indexed: false
|
|
14299
|
+
},
|
|
14300
|
+
{ name: "fee", internalType: "uint256", type: "uint256", indexed: false }
|
|
14301
|
+
],
|
|
14302
|
+
name: "LiquidatePartial"
|
|
14303
|
+
},
|
|
14304
|
+
{ type: "error", inputs: [], name: "CreditAccountNotLiquidatableException" },
|
|
14305
|
+
{ type: "error", inputs: [], name: "IncorrectParameterException" },
|
|
14306
|
+
{ type: "error", inputs: [], name: "LiquidatedLessThanNeededException" },
|
|
14307
|
+
{ type: "error", inputs: [], name: "LiquidatedMoreThanNeededException" },
|
|
14308
|
+
{ type: "error", inputs: [], name: "PriceFeedDoesNotExistException" },
|
|
14309
|
+
{ type: "error", inputs: [], name: "RegisteredCreditManagerOnlyException" },
|
|
14310
|
+
{ type: "error", inputs: [], name: "RepaidMoreThanAllowedException" },
|
|
14311
|
+
{ type: "error", inputs: [], name: "SeizedLessThanRequiredException" },
|
|
14312
|
+
{ type: "error", inputs: [], name: "UnderlyingNotLiquidatableException" },
|
|
14313
|
+
{ type: "error", inputs: [], name: "ZeroAddressException" }
|
|
14314
|
+
];
|
|
14155
14315
|
var poolQuotaKeeperV3Abi = [
|
|
14156
14316
|
{
|
|
14157
14317
|
type: "constructor",
|
|
@@ -27323,6 +27483,72 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
27323
27483
|
return this.sdk.marketRegister.pools.map((p) => p.pool.address);
|
|
27324
27484
|
}
|
|
27325
27485
|
};
|
|
27486
|
+
var BotsService = class extends SDKConstruct {
|
|
27487
|
+
/**
|
|
27488
|
+
* Returns bots data payload
|
|
27489
|
+
* @param addresses
|
|
27490
|
+
* @returns
|
|
27491
|
+
*/
|
|
27492
|
+
async getBotsData(addresses) {
|
|
27493
|
+
const addressesList = Object.entries(addresses);
|
|
27494
|
+
const BOT_INFO_LENGTH = 4;
|
|
27495
|
+
const infoResp = await this.provider.publicClient.multicall({
|
|
27496
|
+
allowFailure: false,
|
|
27497
|
+
multicallAddress: MULTICALL_ADDRESS,
|
|
27498
|
+
contracts: addressesList.map(([, address]) => [
|
|
27499
|
+
{
|
|
27500
|
+
address,
|
|
27501
|
+
abi: partialLiquidationBotV3Abi,
|
|
27502
|
+
functionName: "minHealthFactor",
|
|
27503
|
+
args: []
|
|
27504
|
+
},
|
|
27505
|
+
{
|
|
27506
|
+
address,
|
|
27507
|
+
abi: partialLiquidationBotV3Abi,
|
|
27508
|
+
functionName: "maxHealthFactor",
|
|
27509
|
+
args: []
|
|
27510
|
+
},
|
|
27511
|
+
{
|
|
27512
|
+
address,
|
|
27513
|
+
abi: partialLiquidationBotV3Abi,
|
|
27514
|
+
functionName: "premiumScaleFactor",
|
|
27515
|
+
args: []
|
|
27516
|
+
},
|
|
27517
|
+
{
|
|
27518
|
+
address,
|
|
27519
|
+
abi: partialLiquidationBotV3Abi,
|
|
27520
|
+
functionName: "feeScaleFactor",
|
|
27521
|
+
args: []
|
|
27522
|
+
}
|
|
27523
|
+
]).flat(1)
|
|
27524
|
+
});
|
|
27525
|
+
const currentType = "liquidationProtection";
|
|
27526
|
+
const bots = addressesList.reduce(
|
|
27527
|
+
(acc, [type, address], index) => {
|
|
27528
|
+
const from = index * BOT_INFO_LENGTH;
|
|
27529
|
+
const to = (index + 1) * BOT_INFO_LENGTH;
|
|
27530
|
+
const [
|
|
27531
|
+
minHealthFactor,
|
|
27532
|
+
maxHealthFactor,
|
|
27533
|
+
premiumScaleFactor,
|
|
27534
|
+
feeScaleFactor
|
|
27535
|
+
] = infoResp.slice(from, to);
|
|
27536
|
+
acc[currentType].push({
|
|
27537
|
+
address,
|
|
27538
|
+
baseType: currentType,
|
|
27539
|
+
detailedType: type,
|
|
27540
|
+
minHealthFactor,
|
|
27541
|
+
maxHealthFactor,
|
|
27542
|
+
premiumScaleFactor,
|
|
27543
|
+
feeScaleFactor
|
|
27544
|
+
});
|
|
27545
|
+
return acc;
|
|
27546
|
+
},
|
|
27547
|
+
{ liquidationProtection: [] }
|
|
27548
|
+
);
|
|
27549
|
+
return bots;
|
|
27550
|
+
}
|
|
27551
|
+
};
|
|
27326
27552
|
var AddressProviderContractV3_1 = class extends BaseContract {
|
|
27327
27553
|
#addresses = {};
|
|
27328
27554
|
versions = {};
|
|
@@ -27936,4 +28162,4 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
27936
28162
|
}
|
|
27937
28163
|
};
|
|
27938
28164
|
|
|
27939
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, AddressLabeller, AddressMap, AddressProviderContractV3_1, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BotListContract, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountsService, CreditConfiguratorV300Contract, CreditConfiguratorV310Contract, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, CreditManagerV300Contract, CreditManagerV310Contract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, GaugeContract, GaugeStakingService, GearStakingContract, GearboxSDK, LinearModelContract, MAX_UINT16, MAX_UINT256, MIN_INT96, MarketFactory, MarketRegister, MellowLRTPriceFeedContract, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, PoolContract, PoolFactory, PoolQuotaKeeperContract, PriceFeedRef, PriceFeedRegister, PriceOracleV300Contract, PriceOracleV310Contract, Provider, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RedstonePriceFeedContract, RouterV3Contract, SDKConstruct, SUPPORTED_CHAINS, TIMELOCK, TokensMeta, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, assetsMap, balancesMap, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat, tokenToTicker };
|
|
28165
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, AddressLabeller, AddressMap, AddressProviderContractV3_1, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BotListContract, BotPermissions, BotsService, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountsService, CreditConfiguratorV300Contract, CreditConfiguratorV310Contract, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, CreditManagerV300Contract, CreditManagerV310Contract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, GaugeContract, GaugeStakingService, GearStakingContract, GearboxSDK, LinearModelContract, MAX_UINT16, MAX_UINT256, MIN_INT96, MarketFactory, MarketRegister, MellowLRTPriceFeedContract, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, PoolContract, PoolFactory, PoolQuotaKeeperContract, PriceFeedRef, PriceFeedRegister, PriceOracleV300Contract, PriceOracleV310Contract, Provider, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RedstonePriceFeedContract, RouterV3Contract, SDKConstruct, SUPPORTED_CHAINS, TIMELOCK, TokensMeta, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, assetsMap, balancesMap, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat, tokenToTicker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "3.0.0-vfour.
|
|
3
|
+
"version": "3.0.0-vfour.112",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/sdk/index.cjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typecheck:ci": "tsc --noEmit"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gearbox-protocol/sdk-gov": "^2.
|
|
50
|
+
"@gearbox-protocol/sdk-gov": "^2.26.1",
|
|
51
51
|
"@redstone-finance/evm-connector": "^0.6.2",
|
|
52
52
|
"abitype": "^1.0.6",
|
|
53
53
|
"date-fns": "^4.1.0",
|