@gearbox-protocol/sdk 3.0.0-vfour.310 → 3.0.0-vfour.312

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.
Files changed (55) hide show
  1. package/dist/cjs/adapters/{GearboxAdaptersPlugin.js → AdaptersPlugin.js} +6 -6
  2. package/dist/cjs/adapters/index.js +2 -2
  3. package/dist/cjs/bots/BotsPlugin.js +191 -0
  4. package/dist/cjs/bots/PartialLiquidationBotV300Contract.js +55 -0
  5. package/dist/cjs/bots/abi/iPartialLiquidationBotV300.js +164 -0
  6. package/dist/cjs/{sdk/bots → bots/abi}/index.js +4 -6
  7. package/dist/cjs/bots/index.js +28 -0
  8. package/dist/cjs/bots/package.json +1 -0
  9. package/dist/cjs/{sdk/bots/utils.js → bots/types.js} +19 -2
  10. package/dist/cjs/sdk/index.js +0 -2
  11. package/dist/cjs/sdk/market/MarketRegister.js +2 -2
  12. package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +20 -6
  13. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +43 -40
  14. package/dist/cjs/sdk/market/pricefeeds/RedstonePriceFeed.js +7 -2
  15. package/dist/cjs/zappers/{GearboxZappersPlugin.js → ZappersPlugin.js} +6 -6
  16. package/dist/cjs/zappers/index.js +3 -3
  17. package/dist/esm/adapters/{GearboxAdaptersPlugin.js → AdaptersPlugin.js} +2 -2
  18. package/dist/esm/adapters/index.js +1 -1
  19. package/dist/esm/bots/BotsPlugin.js +171 -0
  20. package/dist/esm/bots/PartialLiquidationBotV300Contract.js +31 -0
  21. package/dist/esm/bots/abi/iPartialLiquidationBotV300.js +140 -0
  22. package/dist/esm/bots/abi/index.js +1 -0
  23. package/dist/esm/bots/index.js +4 -0
  24. package/dist/esm/bots/package.json +1 -0
  25. package/dist/esm/bots/types.js +9 -0
  26. package/dist/esm/sdk/index.js +0 -1
  27. package/dist/esm/sdk/market/MarketRegister.js +2 -2
  28. package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +18 -5
  29. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +46 -41
  30. package/dist/esm/sdk/market/pricefeeds/RedstonePriceFeed.js +5 -1
  31. package/dist/esm/zappers/{GearboxZappersPlugin.js → ZappersPlugin.js} +2 -2
  32. package/dist/esm/zappers/index.js +1 -1
  33. package/dist/types/adapters/{GearboxAdaptersPlugin.d.ts → AdaptersPlugin.d.ts} +1 -1
  34. package/dist/types/adapters/index.d.ts +1 -1
  35. package/dist/types/bots/BotsPlugin.d.ts +18 -0
  36. package/dist/types/bots/PartialLiquidationBotV300Contract.d.ts +223 -0
  37. package/dist/types/bots/abi/iPartialLiquidationBotV300.d.ts +210 -0
  38. package/dist/types/bots/abi/index.d.ts +1 -0
  39. package/dist/types/bots/index.d.ts +4 -0
  40. package/dist/types/bots/types.d.ts +23 -0
  41. package/dist/types/sdk/base/types.d.ts +0 -1
  42. package/dist/types/sdk/index.d.ts +0 -1
  43. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +4 -0
  44. package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +6 -3
  45. package/dist/types/sdk/market/pricefeeds/RedstonePriceFeed.d.ts +2 -0
  46. package/dist/types/zappers/{GearboxZappersPlugin.d.ts → ZappersPlugin.d.ts} +1 -1
  47. package/dist/types/zappers/index.d.ts +1 -1
  48. package/package.json +6 -1
  49. package/dist/cjs/sdk/bots/BotsService.js +0 -100
  50. package/dist/esm/sdk/bots/BotsService.js +0 -76
  51. package/dist/esm/sdk/bots/index.js +0 -2
  52. package/dist/esm/sdk/bots/utils.js +0 -0
  53. package/dist/types/sdk/bots/BotsService.d.ts +0 -12
  54. package/dist/types/sdk/bots/index.d.ts +0 -2
  55. package/dist/types/sdk/bots/utils.d.ts +0 -13
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var GearboxAdaptersPlugin_exports = {};
20
- __export(GearboxAdaptersPlugin_exports, {
21
- GearboxAdaptersPlugin: () => GearboxAdaptersPlugin
19
+ var AdaptersPlugin_exports = {};
20
+ __export(AdaptersPlugin_exports, {
21
+ AdaptersPlugin: () => AdaptersPlugin
22
22
  });
23
- module.exports = __toCommonJS(GearboxAdaptersPlugin_exports);
23
+ module.exports = __toCommonJS(AdaptersPlugin_exports);
24
24
  var import_sdk = require("../sdk/index.js");
25
25
  var import_BalancerV2VaultAdapterContract = require("./BalancerV2VaultAdapterContract.js");
26
26
  var import_BalancerV3RouterAdapterContract = require("./BalancerV3RouterAdapterContract.js");
@@ -45,7 +45,7 @@ var import_UniswapV3AdapterContract = require("./UniswapV3AdapterContract.js");
45
45
  var import_VelodromeV2AdapterContract = require("./VelodromeV2AdapterContract.js");
46
46
  var import_WstETHV1AdapterContract = require("./WstETHV1AdapterContract.js");
47
47
  var import_YearnV2AdapterContract = require("./YearnV2AdapterContract.js");
48
- class GearboxAdaptersPlugin extends import_sdk.SDKConstruct {
48
+ class AdaptersPlugin extends import_sdk.SDKConstruct {
49
49
  name = "Adapters";
50
50
  createContract(data) {
51
51
  const args = data;
@@ -117,5 +117,5 @@ class GearboxAdaptersPlugin extends import_sdk.SDKConstruct {
117
117
  }
118
118
  // Annotate the CommonJS export names for ESM import in node:
119
119
  0 && (module.exports = {
120
- GearboxAdaptersPlugin
120
+ AdaptersPlugin
121
121
  });
@@ -17,6 +17,7 @@ var adapters_exports = {};
17
17
  module.exports = __toCommonJS(adapters_exports);
18
18
  __reExport(adapters_exports, require("./abi/index.js"), module.exports);
19
19
  __reExport(adapters_exports, require("./AbstractAdapter.js"), module.exports);
20
+ __reExport(adapters_exports, require("./AdaptersPlugin.js"), module.exports);
20
21
  __reExport(adapters_exports, require("./BalancerV2VaultAdapterContract.js"), module.exports);
21
22
  __reExport(adapters_exports, require("./BalancerV3RouterAdapterContract.js"), module.exports);
22
23
  __reExport(adapters_exports, require("./CamelotV3AdapterContract.js"), module.exports);
@@ -31,7 +32,6 @@ __reExport(adapters_exports, require("./CurveV1StableNGAdapterContract.js"), mod
31
32
  __reExport(adapters_exports, require("./DaiUsdsAdapterContract.js"), module.exports);
32
33
  __reExport(adapters_exports, require("./EqualizerRouterAdapterContract.js"), module.exports);
33
34
  __reExport(adapters_exports, require("./ERC4626AdapterContract.js"), module.exports);
34
- __reExport(adapters_exports, require("./GearboxAdaptersPlugin.js"), module.exports);
35
35
  __reExport(adapters_exports, require("./MellowERC4626VaultAdapterContract.js"), module.exports);
36
36
  __reExport(adapters_exports, require("./MellowVaultAdapterContract.js"), module.exports);
37
37
  __reExport(adapters_exports, require("./PendleRouterAdapterContract.js"), module.exports);
@@ -46,6 +46,7 @@ __reExport(adapters_exports, require("./YearnV2AdapterContract.js"), module.expo
46
46
  0 && (module.exports = {
47
47
  ...require("./abi/index.js"),
48
48
  ...require("./AbstractAdapter.js"),
49
+ ...require("./AdaptersPlugin.js"),
49
50
  ...require("./BalancerV2VaultAdapterContract.js"),
50
51
  ...require("./BalancerV3RouterAdapterContract.js"),
51
52
  ...require("./CamelotV3AdapterContract.js"),
@@ -60,7 +61,6 @@ __reExport(adapters_exports, require("./YearnV2AdapterContract.js"), module.expo
60
61
  ...require("./DaiUsdsAdapterContract.js"),
61
62
  ...require("./EqualizerRouterAdapterContract.js"),
62
63
  ...require("./ERC4626AdapterContract.js"),
63
- ...require("./GearboxAdaptersPlugin.js"),
64
64
  ...require("./MellowERC4626VaultAdapterContract.js"),
65
65
  ...require("./MellowVaultAdapterContract.js"),
66
66
  ...require("./PendleRouterAdapterContract.js"),
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var BotsPlugin_exports = {};
20
+ __export(BotsPlugin_exports, {
21
+ BotsPlugin: () => BotsPlugin,
22
+ UnsupportedBotVersionError: () => UnsupportedBotVersionError
23
+ });
24
+ module.exports = __toCommonJS(BotsPlugin_exports);
25
+ var import_compressors = require("../abi/compressors.js");
26
+ var import_sdk = require("../sdk/index.js");
27
+ var import_abi = require("./abi/index.js");
28
+ var import_PartialLiquidationBotV300Contract = require("./PartialLiquidationBotV300Contract.js");
29
+ var import_types = require("./types.js");
30
+ class UnsupportedBotVersionError extends Error {
31
+ state;
32
+ constructor(state) {
33
+ super(
34
+ `unsupported bot version ${state.baseParams.version} for bot at ${state.baseParams.addr}`
35
+ );
36
+ this.state = state;
37
+ }
38
+ }
39
+ class BotsPlugin extends import_sdk.SDKConstruct {
40
+ #logger;
41
+ #botsByMarket = new import_sdk.AddressMap();
42
+ constructor(sdk) {
43
+ super(sdk);
44
+ this.#logger = sdk.logger?.child?.({ name: "BotsPlugin" }) ?? sdk.logger;
45
+ }
46
+ async attach() {
47
+ await this.#load();
48
+ }
49
+ async syncState() {
50
+ await this.#load();
51
+ }
52
+ botsByMarketConfigurator(mc) {
53
+ return this.#botsByMarket.get(mc) ?? [];
54
+ }
55
+ get allBots() {
56
+ return this.#botsByMarket.values().flat();
57
+ }
58
+ async #load() {
59
+ this.#botsByMarket.clear();
60
+ const pcAddr = this.sdk.addressProvider.getAddress(
61
+ import_sdk.AP_PERIPHERY_COMPRESSOR,
62
+ 310
63
+ );
64
+ this.#logger?.debug(`loading bots with periphery compressor ${pcAddr}`);
65
+ const mcs = this.sdk.marketRegister.marketConfigurators.map(
66
+ (mc) => mc.address
67
+ );
68
+ const botsData = await this.client.multicall({
69
+ contracts: mcs.map(
70
+ (mc) => ({
71
+ address: pcAddr,
72
+ abi: import_compressors.iPeripheryCompressorAbi,
73
+ functionName: "getBots",
74
+ args: [mc]
75
+ })
76
+ ),
77
+ allowFailure: false
78
+ });
79
+ const botsByMcV300 = {};
80
+ for (let i = 0; i < mcs.length; i++) {
81
+ const mc = mcs[i];
82
+ const marketBotData = botsData[i];
83
+ const marketBots = [];
84
+ for (const bot of marketBotData) {
85
+ if (bot.baseParams.version === 300n) {
86
+ marketBots.push(bot);
87
+ } else {
88
+ this.#logger?.warn(new UnsupportedBotVersionError(bot));
89
+ }
90
+ }
91
+ if (marketBots.length === 4) {
92
+ botsByMcV300[mc] = marketBots;
93
+ } else {
94
+ this.#logger?.warn(
95
+ `each market configurator should have 4 v300 bots, but ${mc} has ${marketBots.length}`
96
+ );
97
+ }
98
+ }
99
+ const botAddrsV300 = Object.values(botsByMcV300).flatMap(
100
+ (b) => b.map((b2) => b2.baseParams.addr)
101
+ );
102
+ this.#logger?.debug(`loaded ${botAddrsV300.length} v300 bots`);
103
+ const params = await this.#getBotsV300Parameters(botAddrsV300);
104
+ for (const [mc, botStates] of import_sdk.TypedObjectUtils.entries(botsByMcV300)) {
105
+ this.#botsByMarket.upsert(
106
+ mc,
107
+ botStates.map((state, i) => ({
108
+ state,
109
+ params: params[state.baseParams.addr],
110
+ type: import_types.BOT_TYPES[i]
111
+ })).sort((a, b) => a.params.minHealthFactor - b.params.minHealthFactor).map(
112
+ ({ state, params: params2, type }) => new import_PartialLiquidationBotV300Contract.PartialLiquidationBotV300Contract(
113
+ this.sdk,
114
+ state,
115
+ params2,
116
+ type
117
+ )
118
+ )
119
+ );
120
+ }
121
+ }
122
+ async #getBotsV300Parameters(addresses) {
123
+ const BOT_INFO_LENGTH = 4;
124
+ const resp = await this.provider.publicClient.multicall({
125
+ allowFailure: false,
126
+ contracts: addresses.map(
127
+ (address) => [
128
+ {
129
+ address,
130
+ abi: import_abi.iPartialLiquidationBotV300Abi,
131
+ functionName: "minHealthFactor",
132
+ args: []
133
+ },
134
+ {
135
+ address,
136
+ abi: import_abi.iPartialLiquidationBotV300Abi,
137
+ functionName: "maxHealthFactor",
138
+ args: []
139
+ },
140
+ {
141
+ address,
142
+ abi: import_abi.iPartialLiquidationBotV300Abi,
143
+ functionName: "premiumScaleFactor",
144
+ args: []
145
+ },
146
+ {
147
+ address,
148
+ abi: import_abi.iPartialLiquidationBotV300Abi,
149
+ functionName: "feeScaleFactor",
150
+ args: []
151
+ }
152
+ ]
153
+ ).flat(1)
154
+ });
155
+ return addresses.reduce(
156
+ (acc, address, index) => {
157
+ const from = index * BOT_INFO_LENGTH;
158
+ const to = (index + 1) * BOT_INFO_LENGTH;
159
+ const [
160
+ minHealthFactor,
161
+ maxHealthFactor,
162
+ premiumScaleFactor,
163
+ feeScaleFactor
164
+ ] = resp.slice(from, to);
165
+ acc[address] = {
166
+ minHealthFactor,
167
+ maxHealthFactor,
168
+ premiumScaleFactor,
169
+ feeScaleFactor
170
+ };
171
+ return acc;
172
+ },
173
+ {}
174
+ );
175
+ }
176
+ stateHuman(raw) {
177
+ return {
178
+ bots: Object.fromEntries(
179
+ this.#botsByMarket.entries().map(([mc, bots]) => [
180
+ this.labelAddress(mc),
181
+ bots.map((b) => b.stateHuman(raw))
182
+ ])
183
+ )
184
+ };
185
+ }
186
+ }
187
+ // Annotate the CommonJS export names for ESM import in node:
188
+ 0 && (module.exports = {
189
+ BotsPlugin,
190
+ UnsupportedBotVersionError
191
+ });
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var PartialLiquidationBotV300Contract_exports = {};
20
+ __export(PartialLiquidationBotV300Contract_exports, {
21
+ PartialLiquidationBotV300Contract: () => PartialLiquidationBotV300Contract
22
+ });
23
+ module.exports = __toCommonJS(PartialLiquidationBotV300Contract_exports);
24
+ var import_sdk = require("../sdk/index.js");
25
+ var import_abi = require("./abi/index.js");
26
+ const abi = import_abi.iPartialLiquidationBotV300Abi;
27
+ class PartialLiquidationBotV300Contract extends import_sdk.BaseContract {
28
+ requiredPermissions;
29
+ botType;
30
+ constructor(sdk, args, params, type) {
31
+ super(sdk, {
32
+ abi,
33
+ ...args.baseParams,
34
+ name: `PartialLiquidationBotV300 (${type})`
35
+ });
36
+ this.requiredPermissions = args.requiredPermissions;
37
+ Object.assign(this, params);
38
+ this.botType = type;
39
+ }
40
+ stateHuman(raw) {
41
+ return {
42
+ ...super.stateHuman(raw),
43
+ botType: this.botType,
44
+ minHealthFactor: (0, import_sdk.formatPercentage)(this.minHealthFactor),
45
+ maxHealthFactor: (0, import_sdk.formatPercentage)(this.maxHealthFactor),
46
+ premiumScaleFactor: (0, import_sdk.formatPercentage)(this.premiumScaleFactor),
47
+ feeScaleFactor: (0, import_sdk.formatPercentage)(this.feeScaleFactor),
48
+ requiredPermissions: this.requiredPermissions.toString(10)
49
+ };
50
+ }
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ PartialLiquidationBotV300Contract
55
+ });
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var iPartialLiquidationBotV300_exports = {};
20
+ __export(iPartialLiquidationBotV300_exports, {
21
+ iPartialLiquidationBotV300Abi: () => iPartialLiquidationBotV300Abi
22
+ });
23
+ module.exports = __toCommonJS(iPartialLiquidationBotV300_exports);
24
+ const iPartialLiquidationBotV300Abi = [
25
+ {
26
+ type: "function",
27
+ name: "feeScaleFactor",
28
+ inputs: [],
29
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
30
+ stateMutability: "view"
31
+ },
32
+ {
33
+ type: "function",
34
+ name: "liquidateExactCollateral",
35
+ inputs: [
36
+ { name: "creditAccount", type: "address", internalType: "address" },
37
+ { name: "token", type: "address", internalType: "address" },
38
+ { name: "seizedAmount", type: "uint256", internalType: "uint256" },
39
+ { name: "maxRepaidAmount", type: "uint256", internalType: "uint256" },
40
+ { name: "to", type: "address", internalType: "address" },
41
+ {
42
+ name: "priceUpdates",
43
+ type: "tuple[]",
44
+ internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
45
+ components: [
46
+ { name: "token", type: "address", internalType: "address" },
47
+ { name: "reserve", type: "bool", internalType: "bool" },
48
+ { name: "data", type: "bytes", internalType: "bytes" }
49
+ ]
50
+ }
51
+ ],
52
+ outputs: [
53
+ { name: "repaidAmount", type: "uint256", internalType: "uint256" }
54
+ ],
55
+ stateMutability: "nonpayable"
56
+ },
57
+ {
58
+ type: "function",
59
+ name: "liquidateExactDebt",
60
+ inputs: [
61
+ { name: "creditAccount", type: "address", internalType: "address" },
62
+ { name: "token", type: "address", internalType: "address" },
63
+ { name: "repaidAmount", type: "uint256", internalType: "uint256" },
64
+ { name: "minSeizedAmount", type: "uint256", internalType: "uint256" },
65
+ { name: "to", type: "address", internalType: "address" },
66
+ {
67
+ name: "priceUpdates",
68
+ type: "tuple[]",
69
+ internalType: "struct IPartialLiquidationBotV3.PriceUpdate[]",
70
+ components: [
71
+ { name: "token", type: "address", internalType: "address" },
72
+ { name: "reserve", type: "bool", internalType: "bool" },
73
+ { name: "data", type: "bytes", internalType: "bytes" }
74
+ ]
75
+ }
76
+ ],
77
+ outputs: [
78
+ { name: "seizedAmount", type: "uint256", internalType: "uint256" }
79
+ ],
80
+ stateMutability: "nonpayable"
81
+ },
82
+ {
83
+ type: "function",
84
+ name: "maxHealthFactor",
85
+ inputs: [],
86
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
87
+ stateMutability: "view"
88
+ },
89
+ {
90
+ type: "function",
91
+ name: "minHealthFactor",
92
+ inputs: [],
93
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
94
+ stateMutability: "view"
95
+ },
96
+ {
97
+ type: "function",
98
+ name: "premiumScaleFactor",
99
+ inputs: [],
100
+ outputs: [{ name: "", type: "uint16", internalType: "uint16" }],
101
+ stateMutability: "view"
102
+ },
103
+ {
104
+ type: "function",
105
+ name: "treasury",
106
+ inputs: [],
107
+ outputs: [{ name: "", type: "address", internalType: "address" }],
108
+ stateMutability: "view"
109
+ },
110
+ {
111
+ type: "function",
112
+ name: "version",
113
+ inputs: [],
114
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
115
+ stateMutability: "view"
116
+ },
117
+ {
118
+ type: "event",
119
+ name: "LiquidatePartial",
120
+ inputs: [
121
+ {
122
+ name: "creditManager",
123
+ type: "address",
124
+ indexed: true,
125
+ internalType: "address"
126
+ },
127
+ {
128
+ name: "creditAccount",
129
+ type: "address",
130
+ indexed: true,
131
+ internalType: "address"
132
+ },
133
+ {
134
+ name: "token",
135
+ type: "address",
136
+ indexed: true,
137
+ internalType: "address"
138
+ },
139
+ {
140
+ name: "repaidDebt",
141
+ type: "uint256",
142
+ indexed: false,
143
+ internalType: "uint256"
144
+ },
145
+ {
146
+ name: "seizedCollateral",
147
+ type: "uint256",
148
+ indexed: false,
149
+ internalType: "uint256"
150
+ },
151
+ { name: "fee", type: "uint256", indexed: false, internalType: "uint256" }
152
+ ],
153
+ anonymous: false
154
+ },
155
+ { type: "error", name: "LiquidatedLessThanNeededException", inputs: [] },
156
+ { type: "error", name: "LiquidatedMoreThanNeededException", inputs: [] },
157
+ { type: "error", name: "RepaidMoreThanAllowedException", inputs: [] },
158
+ { type: "error", name: "SeizedLessThanRequiredException", inputs: [] },
159
+ { type: "error", name: "UnderlyingNotLiquidatableException", inputs: [] }
160
+ ];
161
+ // Annotate the CommonJS export names for ESM import in node:
162
+ 0 && (module.exports = {
163
+ iPartialLiquidationBotV300Abi
164
+ });
@@ -13,12 +13,10 @@ var __copyProps = (to, from, except, desc) => {
13
13
  };
14
14
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var bots_exports = {};
17
- module.exports = __toCommonJS(bots_exports);
18
- __reExport(bots_exports, require("./BotsService.js"), module.exports);
19
- __reExport(bots_exports, require("./utils.js"), module.exports);
16
+ var abi_exports = {};
17
+ module.exports = __toCommonJS(abi_exports);
18
+ __reExport(abi_exports, require("./iPartialLiquidationBotV300.js"), module.exports);
20
19
  // Annotate the CommonJS export names for ESM import in node:
21
20
  0 && (module.exports = {
22
- ...require("./BotsService.js"),
23
- ...require("./utils.js")
21
+ ...require("./iPartialLiquidationBotV300.js")
24
22
  });
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var bots_exports = {};
17
+ module.exports = __toCommonJS(bots_exports);
18
+ __reExport(bots_exports, require("./abi/index.js"), module.exports);
19
+ __reExport(bots_exports, require("./BotsPlugin.js"), module.exports);
20
+ __reExport(bots_exports, require("./PartialLiquidationBotV300Contract.js"), module.exports);
21
+ __reExport(bots_exports, require("./types.js"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./abi/index.js"),
25
+ ...require("./BotsPlugin.js"),
26
+ ...require("./PartialLiquidationBotV300Contract.js"),
27
+ ...require("./types.js")
28
+ });
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -12,5 +16,18 @@ var __copyProps = (to, from, except, desc) => {
12
16
  return to;
13
17
  };
14
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var utils_exports = {};
16
- module.exports = __toCommonJS(utils_exports);
19
+ var types_exports = {};
20
+ __export(types_exports, {
21
+ BOT_TYPES: () => BOT_TYPES
22
+ });
23
+ module.exports = __toCommonJS(types_exports);
24
+ const BOT_TYPES = [
25
+ "PARTIAL_LIQUIDATION_BOT",
26
+ "DELEVERAGE_BOT_PEGGED",
27
+ "DELEVERAGE_BOT_LV",
28
+ "DELEVERAGE_BOT_HV"
29
+ ];
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ BOT_TYPES
33
+ });
@@ -17,7 +17,6 @@ var sdk_exports = {};
17
17
  module.exports = __toCommonJS(sdk_exports);
18
18
  __reExport(sdk_exports, require("./accounts/index.js"), module.exports);
19
19
  __reExport(sdk_exports, require("./base/index.js"), module.exports);
20
- __reExport(sdk_exports, require("./bots/index.js"), module.exports);
21
20
  __reExport(sdk_exports, require("./chain/index.js"), module.exports);
22
21
  __reExport(sdk_exports, require("./constants/index.js"), module.exports);
23
22
  __reExport(sdk_exports, require("./core/index.js"), module.exports);
@@ -35,7 +34,6 @@ __reExport(sdk_exports, require("./utils/viem/index.js"), module.exports);
35
34
  0 && (module.exports = {
36
35
  ...require("./accounts/index.js"),
37
36
  ...require("./base/index.js"),
38
- ...require("./bots/index.js"),
39
37
  ...require("./chain/index.js"),
40
38
  ...require("./constants/index.js"),
41
39
  ...require("./core/index.js"),
@@ -76,11 +76,11 @@ class MarketRegister extends import_base.SDKConstruct {
76
76
  );
77
77
  let txs = [];
78
78
  if (!ignoreUpdateablePrices) {
79
- await this.sdk.priceFeeds.preloadUpdatablePriceFeeds(
79
+ const updatables = await this.sdk.priceFeeds.getPartialUpdatablePriceFeeds(
80
80
  configurators,
81
81
  pools
82
82
  );
83
- const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
83
+ const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(updatables);
84
84
  txs = updates.txs;
85
85
  }
86
86
  this.#logger?.debug(
@@ -18,12 +18,23 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var AbstractPriceFeed_exports = {};
20
20
  __export(AbstractPriceFeed_exports, {
21
- AbstractPriceFeedContract: () => AbstractPriceFeedContract
21
+ AbstractPriceFeedContract: () => AbstractPriceFeedContract,
22
+ PartialPriceFeedInitError: () => PartialPriceFeedInitError
22
23
  });
23
24
  module.exports = __toCommonJS(AbstractPriceFeed_exports);
24
25
  var import_abi = require("../../abi/index.js");
25
26
  var import_base = require("../../base/index.js");
26
27
  var import_PriceFeedRef = require("./PriceFeedRef.js");
28
+ class PartialPriceFeedInitError extends Error {
29
+ priceFeed;
30
+ constructor(priceFeed) {
31
+ super(
32
+ `price feed ${priceFeed.baseParams.addr} has been initialized with BaseParams only`
33
+ );
34
+ this.name = "ErrPartialPriceFeed";
35
+ this.priceFeed = priceFeed;
36
+ }
37
+ }
27
38
  class AbstractPriceFeedContract extends import_base.BaseContract {
28
39
  /**
29
40
  * True if the contract deployed at this address implements IUpdatablePriceFeed interface
@@ -32,6 +43,7 @@ class AbstractPriceFeedContract extends import_base.BaseContract {
32
43
  #decimals;
33
44
  #underlyingPriceFeeds;
34
45
  #skipCheck;
46
+ #args;
35
47
  hasLowerBoundCap = false;
36
48
  description;
37
49
  constructor(sdk, args) {
@@ -42,6 +54,7 @@ class AbstractPriceFeedContract extends import_base.BaseContract {
42
54
  contractType: args.baseParams.contractType,
43
55
  version: args.baseParams.version
44
56
  });
57
+ this.#args = args;
45
58
  this.description = args.description;
46
59
  this.#decimals = args.decimals;
47
60
  this.#updatable = args.updatable;
@@ -61,25 +74,25 @@ class AbstractPriceFeedContract extends import_base.BaseContract {
61
74
  }
62
75
  get decimals() {
63
76
  if (this.#decimals === void 0) {
64
- throw new Error("price feed has been initialized with BaseParams only");
77
+ throw new PartialPriceFeedInitError(this);
65
78
  }
66
79
  return this.#decimals;
67
80
  }
68
81
  get updatable() {
69
82
  if (this.#updatable === void 0) {
70
- throw new Error("price feed has been initialized with BaseParams only");
83
+ throw new PartialPriceFeedInitError(this.#args);
71
84
  }
72
85
  return this.#updatable;
73
86
  }
74
87
  get skipCheck() {
75
88
  if (this.#skipCheck === void 0) {
76
- throw new Error("price feed has been initialized with BaseParams only");
89
+ throw new PartialPriceFeedInitError(this.#args);
77
90
  }
78
91
  return this.#skipCheck;
79
92
  }
80
93
  get underlyingPriceFeeds() {
81
94
  if (!this.#underlyingPriceFeeds) {
82
- throw new Error("price feed has been initialized with BaseParams only");
95
+ throw new PartialPriceFeedInitError(this.#args);
83
96
  }
84
97
  return this.#underlyingPriceFeeds;
85
98
  }
@@ -120,5 +133,6 @@ class AbstractPriceFeedContract extends import_base.BaseContract {
120
133
  }
121
134
  // Annotate the CommonJS export names for ESM import in node:
122
135
  0 && (module.exports = {
123
- AbstractPriceFeedContract
136
+ AbstractPriceFeedContract,
137
+ PartialPriceFeedInitError
124
138
  });