@gearbox-protocol/sdk 14.12.0-next.47 → 14.12.0-next.49

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 (53) hide show
  1. package/dist/cjs/abi/ILiquidationCompressorV313.js +103 -0
  2. package/dist/cjs/abi/compressors/liquidationCompressor.js +215 -0
  3. package/dist/cjs/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.js +104 -0
  4. package/dist/cjs/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.js +104 -0
  5. package/dist/cjs/dev/withdrawalAbi.js +104 -66
  6. package/dist/cjs/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +2 -306
  7. package/dist/cjs/plugins/adapters/abi/index.js +2 -0
  8. package/dist/cjs/plugins/adapters/abi/midas/iMidasGatewayV311.js +194 -0
  9. package/dist/cjs/plugins/adapters/abi/midas/index.js +22 -0
  10. package/dist/cjs/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayV311.js +184 -24
  11. package/dist/cjs/plugins/adapters/contracts/MidasGatewayAdapterContract.js +2 -1
  12. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +81 -58
  13. package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +6 -0
  14. package/dist/cjs/sdk/accounts/liquidations/constants.js +29 -0
  15. package/dist/cjs/sdk/accounts/liquidations/helpers.js +49 -2
  16. package/dist/cjs/sdk/accounts/liquidations/index.js +2 -2
  17. package/dist/esm/abi/ILiquidationCompressorV313.js +79 -0
  18. package/dist/esm/abi/compressors/liquidationCompressor.js +191 -0
  19. package/dist/esm/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.js +80 -0
  20. package/dist/esm/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.js +80 -0
  21. package/dist/esm/dev/withdrawalAbi.js +104 -66
  22. package/dist/esm/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.js +1 -304
  23. package/dist/esm/plugins/adapters/abi/index.js +1 -0
  24. package/dist/esm/plugins/adapters/abi/midas/iMidasGatewayV311.js +170 -0
  25. package/dist/esm/plugins/adapters/abi/midas/index.js +1 -0
  26. package/dist/esm/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayV311.js +184 -24
  27. package/dist/esm/plugins/adapters/contracts/MidasGatewayAdapterContract.js +2 -4
  28. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +87 -61
  29. package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +6 -0
  30. package/dist/esm/sdk/accounts/liquidations/constants.js +5 -0
  31. package/dist/esm/sdk/accounts/liquidations/helpers.js +46 -2
  32. package/dist/esm/sdk/accounts/liquidations/index.js +1 -1
  33. package/dist/types/abi/ILiquidationCompressorV313.d.ts +107 -0
  34. package/dist/types/abi/compressors/liquidationCompressor.d.ts +262 -0
  35. package/dist/types/abi/compressors/subcompressors/liquidation/midasLiquidationSubcompressor.d.ts +111 -0
  36. package/dist/types/abi/compressors/subcompressors/liquidation/securitizeLiquidationSubcompressor.d.ts +111 -0
  37. package/dist/types/dev/withdrawalAbi.d.ts +81 -53
  38. package/dist/types/plugins/adapters/abi/adapters/iMidasGatewayAdapterV311.d.ts +0 -233
  39. package/dist/types/plugins/adapters/abi/index.d.ts +1 -0
  40. package/dist/types/plugins/adapters/abi/midas/iMidasGatewayV311.d.ts +261 -0
  41. package/dist/types/plugins/adapters/abi/midas/index.d.ts +1 -0
  42. package/dist/types/plugins/adapters/abi/securitize/iSecuritizeRedemptionGatewayV311.d.ts +24 -0
  43. package/dist/types/plugins/adapters/contracts/MidasGatewayAdapterContract.d.ts +28 -0
  44. package/dist/types/plugins/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +24 -0
  45. package/dist/types/rewards/rewards/merkl-api.d.ts +1 -1
  46. package/dist/types/sdk/MultichainSDK.d.ts +1 -1
  47. package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +6 -1
  48. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +11 -6
  49. package/dist/types/sdk/accounts/liquidations/constants.d.ts +6 -0
  50. package/dist/types/sdk/accounts/liquidations/helpers.d.ts +73 -2
  51. package/dist/types/sdk/accounts/liquidations/index.d.ts +1 -1
  52. package/dist/types/sdk/accounts/liquidations/types.d.ts +142 -30
  53. package/package.json +9 -9
@@ -21,18 +21,17 @@ __export(LiquidationsService_exports, {
21
21
  LiquidationsService: () => LiquidationsService
22
22
  });
23
23
  module.exports = __toCommonJS(LiquidationsService_exports);
24
+ var import_ILiquidationCompressorV313 = require("../../../abi/ILiquidationCompressorV313.js");
24
25
  var import_base = require("../../base/index.js");
25
26
  var import_constants = require("../../constants/index.js");
26
27
  var import_utils = require("../../utils/index.js");
28
+ var import_constants2 = require("./constants.js");
27
29
  var import_helpers = require("./helpers.js");
28
30
  class LiquidationsService extends import_base.SDKConstruct {
29
31
  /**
30
32
  * {@inheritDoc ILiquidationsService.getLiquidatableAccounts}
31
33
  **/
32
34
  async getLiquidatableAccounts(props) {
33
- if (props?.networks && !props.networks.includes(this.sdk.networkType)) {
34
- return [];
35
- }
36
35
  await this.sdk.withdrawalCompressor?.loadWithdrawableAssets();
37
36
  const accounts = await this.sdk.accounts.getCreditAccounts({
38
37
  maxHealthFactor: import_constants.WAD - 1n,
@@ -67,67 +66,58 @@ class LiquidationsService extends import_base.SDKConstruct {
67
66
  * {@inheritDoc ILiquidationsService.getLiquidationDetails}
68
67
  **/
69
68
  async getLiquidationDetails(props) {
70
- const { network, creditAccount } = props;
71
- if (network !== this.sdk.networkType) {
72
- throw new Error(
73
- `network mismatch: this SDK is attached to ${this.sdk.networkType}, requested ${network}`
74
- );
75
- }
76
- const ca = await this.sdk.accounts.getCreditAccountData(creditAccount);
77
- if (!ca) {
78
- throw new Error(`credit account ${creditAccount} not found`);
79
- }
80
- if (!ca.success) {
81
- throw new Error(
82
- `cannot compute liquidation details for ${creditAccount}: collateral computation failed`
83
- );
84
- }
85
- const compressor = this.sdk.withdrawalCompressor;
86
- await compressor?.loadWithdrawableAssets();
69
+ const { creditAccount, liquidator, ignoreReservePrices } = props;
70
+ const ca = await this.#getCreditAccountData(creditAccount);
71
+ await this.sdk.withdrawalCompressor?.loadWithdrawableAssets();
87
72
  const account = this.#buildAccount(ca);
88
- const receivedAssets = [];
89
- for (const t of ca.tokens) {
90
- if (t.balance > import_helpers.DUST_THRESHOLD && !compressor?.getWithdrawalSourceToken(t.token)) {
91
- receivedAssets.push({
92
- isDelayed: false,
93
- token: t.token,
94
- amount: t.balance
95
- });
96
- }
97
- }
98
- if (account.isDelayed && compressor) {
99
- const { claimable, pending } = await compressor.getCurrentWithdrawals(creditAccount);
100
- for (const w of claimable) {
101
- for (const o of w.outputs) {
102
- receivedAssets.push({
103
- isDelayed: true,
104
- token: o.token,
105
- amount: o.amount,
106
- sourceToken: w.token
107
- });
108
- }
109
- }
110
- for (const w of pending) {
111
- for (const o of w.expectedOutputs) {
112
- receivedAssets.push({
113
- isDelayed: true,
114
- token: o.token,
115
- amount: o.amount,
116
- sourceToken: w.token,
117
- claimableAt: w.claimableAt
118
- });
119
- }
120
- }
121
- }
122
- return { ...account, receivedAssets };
73
+ const data = await this.#getLiquidationData(
74
+ ca,
75
+ liquidator,
76
+ ignoreReservePrices
77
+ );
78
+ const suite = this.sdk.marketRegister.findCreditManager(ca.creditManager);
79
+ return {
80
+ ...account,
81
+ // the compressor reports the exact amounts of the liquidation path it
82
+ // selected, which supersede the estimates of the list row
83
+ repaymentAmount: {
84
+ token: account.totalValue.token,
85
+ balance: data.requiredUnderlyingAmount
86
+ },
87
+ isDelayed: data.expectedOutputs.some((o) => o.delayed),
88
+ receivedAssets: (0, import_helpers.toReceivedAssets)(data.expectedOutputs),
89
+ isLiquidatorEligible: data.isLiquidatorEligible,
90
+ kycProtocol: data.kycProtocol || void 0,
91
+ kycToken: (0, import_utils.hexEq)(data.kycToken, import_constants.ADDRESS_0X0) ? void 0 : data.kycToken,
92
+ approve: (0, import_helpers.toLiquidationApproval)({
93
+ target: data.liquidationCall.target,
94
+ creditFacade: suite.creditFacade.address,
95
+ creditManager: ca.creditManager,
96
+ token: suite.underlying,
97
+ amount: data.requiredUnderlyingAmount
98
+ })
99
+ };
100
+ }
101
+ /**
102
+ * {@inheritDoc ILiquidationsService.buildLiquidationTx}
103
+ **/
104
+ async buildLiquidationTx(props) {
105
+ const { creditAccount, liquidator, ignoreReservePrices } = props;
106
+ const ca = await this.#getCreditAccountData(creditAccount);
107
+ const data = await this.#getLiquidationData(
108
+ ca,
109
+ liquidator,
110
+ ignoreReservePrices
111
+ );
112
+ return (0, import_helpers.liquidationCallToRawTx)(
113
+ data.liquidationCall,
114
+ `liquidate credit account ${this.labelAddress(creditAccount)} to ${this.labelAddress(liquidator)}`
115
+ );
123
116
  }
124
117
  /**
125
118
  * {@inheritDoc ILiquidationsService.getLiquidatorWithdrawals}
126
119
  **/
127
120
  async getLiquidatorWithdrawals(props) {
128
- if (props.networks && !props.networks.includes(this.sdk.networkType)) {
129
- return [];
130
- }
131
121
  const compressor = this.sdk.withdrawalCompressor;
132
122
  if (!compressor) {
133
123
  return [];
@@ -142,6 +132,39 @@ class LiquidationsService extends import_base.SDKConstruct {
142
132
  );
143
133
  return (0, import_helpers.toLiquidatorWithdrawals)(current, this.sdk.networkType);
144
134
  }
135
+ async #getCreditAccountData(creditAccount) {
136
+ const ca = await this.sdk.accounts.getCreditAccountData(creditAccount);
137
+ if (!ca) {
138
+ throw new Error(`credit account ${creditAccount} not found`);
139
+ }
140
+ if (!ca.success) {
141
+ throw new Error(
142
+ `cannot compute liquidation details for ${creditAccount}: collateral computation failed`
143
+ );
144
+ }
145
+ return ca;
146
+ }
147
+ /**
148
+ * Previews the liquidation via the liquidation compressor.
149
+ *
150
+ * @param ca - Credit account to liquidate
151
+ * @param liquidator - Liquidator wallet, zero address when not known: it only
152
+ * affects the KYC eligibility fields and the receiver encoded into the calls
153
+ * @param ignoreReservePrices - Exclude reserve price feeds from the updates
154
+ **/
155
+ async #getLiquidationData(ca, liquidator = import_constants.ADDRESS_0X0, ignoreReservePrices) {
156
+ const priceUpdates = await this.sdk.accounts.getOnDemandPriceUpdates(
157
+ ca,
158
+ ignoreReservePrices
159
+ );
160
+ const { result } = await this.client.simulateContract({
161
+ address: import_constants2.LIQUIDATION_COMPRESSOR_V313_ADDRESS,
162
+ abi: import_ILiquidationCompressorV313.iLiquidationCompressorV313Abi,
163
+ functionName: "getLiquidationData",
164
+ args: [liquidator, ca.creditAccount, priceUpdates]
165
+ });
166
+ return result;
167
+ }
145
168
  /**
146
169
  * Accounts of expired credit managers with outstanding debt are liquidatable
147
170
  * regardless of their health factor.
@@ -58,6 +58,12 @@ class MultichainLiquidationsService {
58
58
  async getLiquidationDetails(props) {
59
59
  return this.#sdk.chain(props.network).liquidations.getLiquidationDetails(props);
60
60
  }
61
+ /**
62
+ * {@inheritDoc ILiquidationsService.buildLiquidationTx}
63
+ **/
64
+ async buildLiquidationTx(props) {
65
+ return this.#sdk.chain(props.network).liquidations.buildLiquidationTx(props);
66
+ }
61
67
  /**
62
68
  * {@inheritDoc ILiquidationsService.getLiquidatorWithdrawals}
63
69
  **/
@@ -0,0 +1,29 @@
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 constants_exports = {};
20
+ __export(constants_exports, {
21
+ LIQUIDATION_COMPRESSOR_V313_ADDRESS: () => LIQUIDATION_COMPRESSOR_V313_ADDRESS
22
+ });
23
+ module.exports = __toCommonJS(constants_exports);
24
+ var import_constants = require("../../constants/index.js");
25
+ const LIQUIDATION_COMPRESSOR_V313_ADDRESS = import_constants.ADDRESS_0X0;
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ LIQUIDATION_COMPRESSOR_V313_ADDRESS
29
+ });
@@ -21,10 +21,14 @@ __export(helpers_exports, {
21
21
  DUST_THRESHOLD: () => DUST_THRESHOLD,
22
22
  calcEstimatedProfit: () => calcEstimatedProfit,
23
23
  calcRepaymentAmount: () => calcRepaymentAmount,
24
+ liquidationCallToRawTx: () => liquidationCallToRawTx,
24
25
  pickMainAsset: () => pickMainAsset,
25
- toLiquidatorWithdrawals: () => toLiquidatorWithdrawals
26
+ toLiquidationApproval: () => toLiquidationApproval,
27
+ toLiquidatorWithdrawals: () => toLiquidatorWithdrawals,
28
+ toReceivedAssets: () => toReceivedAssets
26
29
  });
27
30
  module.exports = __toCommonJS(helpers_exports);
31
+ var import_viem = require("viem");
28
32
  var import_constants = require("../../constants/index.js");
29
33
  var import_utils = require("../../utils/index.js");
30
34
  const DUST_THRESHOLD = 10n;
@@ -80,11 +84,54 @@ function toLiquidatorWithdrawals(current, network) {
80
84
  }
81
85
  return rows;
82
86
  }
87
+ function toReceivedAssets(outputs) {
88
+ return outputs.map((o) => {
89
+ if (!o.delayed) {
90
+ return { isDelayed: false, token: o.token, amount: o.amount };
91
+ }
92
+ return {
93
+ isDelayed: true,
94
+ token: o.token,
95
+ amount: o.amount,
96
+ redeemerAddress: (0, import_utils.hexEq)(o.redeemerAddress, import_constants.ADDRESS_0X0) ? void 0 : o.redeemerAddress,
97
+ claimableAt: o.claimableAt === 0n ? void 0 : o.claimableAt
98
+ };
99
+ });
100
+ }
101
+ function toLiquidationApproval(props) {
102
+ const { target, creditFacade, creditManager, token, amount } = props;
103
+ if (amount === 0n) {
104
+ return void 0;
105
+ }
106
+ return {
107
+ spender: (0, import_utils.hexEq)(target, creditFacade) ? creditManager : target,
108
+ token,
109
+ amount
110
+ };
111
+ }
112
+ function liquidationCallToRawTx(call, description) {
113
+ return {
114
+ to: call.target,
115
+ value: "0",
116
+ signature: "",
117
+ callData: call.callData,
118
+ contractMethod: {
119
+ name: (0, import_viem.slice)(call.callData, 0, 4),
120
+ inputs: [],
121
+ payable: false
122
+ },
123
+ contractInputsValues: {},
124
+ description
125
+ };
126
+ }
83
127
  // Annotate the CommonJS export names for ESM import in node:
84
128
  0 && (module.exports = {
85
129
  DUST_THRESHOLD,
86
130
  calcEstimatedProfit,
87
131
  calcRepaymentAmount,
132
+ liquidationCallToRawTx,
88
133
  pickMainAsset,
89
- toLiquidatorWithdrawals
134
+ toLiquidationApproval,
135
+ toLiquidatorWithdrawals,
136
+ toReceivedAssets
90
137
  });
@@ -15,13 +15,13 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var liquidations_exports = {};
17
17
  module.exports = __toCommonJS(liquidations_exports);
18
- __reExport(liquidations_exports, require("./helpers.js"), module.exports);
18
+ __reExport(liquidations_exports, require("./constants.js"), module.exports);
19
19
  __reExport(liquidations_exports, require("./LiquidationsService.js"), module.exports);
20
20
  __reExport(liquidations_exports, require("./MultichainLiquidationsService.js"), module.exports);
21
21
  __reExport(liquidations_exports, require("./types.js"), module.exports);
22
22
  // Annotate the CommonJS export names for ESM import in node:
23
23
  0 && (module.exports = {
24
- ...require("./helpers.js"),
24
+ ...require("./constants.js"),
25
25
  ...require("./LiquidationsService.js"),
26
26
  ...require("./MultichainLiquidationsService.js"),
27
27
  ...require("./types.js")
@@ -0,0 +1,79 @@
1
+ const iLiquidationCompressorV313Abi = [
2
+ {
3
+ type: "function",
4
+ name: "contractType",
5
+ inputs: [],
6
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
7
+ stateMutability: "view"
8
+ },
9
+ {
10
+ type: "function",
11
+ name: "getLiquidationData",
12
+ inputs: [
13
+ { name: "liquidator", type: "address", internalType: "address" },
14
+ { name: "creditAccount", type: "address", internalType: "address" },
15
+ {
16
+ name: "priceUpdates",
17
+ type: "tuple[]",
18
+ internalType: "struct PriceUpdate[]",
19
+ components: [
20
+ { name: "priceFeed", type: "address", internalType: "address" },
21
+ { name: "data", type: "bytes", internalType: "bytes" }
22
+ ]
23
+ }
24
+ ],
25
+ outputs: [
26
+ {
27
+ name: "",
28
+ type: "tuple",
29
+ internalType: "struct LiquidationData",
30
+ components: [
31
+ {
32
+ name: "requiredUnderlyingAmount",
33
+ type: "uint256",
34
+ internalType: "uint256"
35
+ },
36
+ {
37
+ name: "expectedOutputs",
38
+ type: "tuple[]",
39
+ internalType: "struct LiquidationOutput[]",
40
+ components: [
41
+ { name: "token", type: "address", internalType: "address" },
42
+ { name: "amount", type: "uint256", internalType: "uint256" },
43
+ { name: "delayed", type: "bool", internalType: "bool" },
44
+ {
45
+ name: "redeemerAddress",
46
+ type: "address",
47
+ internalType: "address"
48
+ },
49
+ { name: "claimableAt", type: "uint256", internalType: "uint256" }
50
+ ]
51
+ },
52
+ {
53
+ name: "liquidationCall",
54
+ type: "tuple",
55
+ internalType: "struct MultiCall",
56
+ components: [
57
+ { name: "target", type: "address", internalType: "address" },
58
+ { name: "callData", type: "bytes", internalType: "bytes" }
59
+ ]
60
+ },
61
+ { name: "isLiquidatorEligible", type: "bool", internalType: "bool" },
62
+ { name: "kycProtocol", type: "string", internalType: "string" },
63
+ { name: "kycToken", type: "address", internalType: "address" }
64
+ ]
65
+ }
66
+ ],
67
+ stateMutability: "nonpayable"
68
+ },
69
+ {
70
+ type: "function",
71
+ name: "version",
72
+ inputs: [],
73
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
74
+ stateMutability: "view"
75
+ }
76
+ ];
77
+ export {
78
+ iLiquidationCompressorV313Abi
79
+ };
@@ -0,0 +1,191 @@
1
+ const liquidationCompressorAbi = [
2
+ {
3
+ type: "constructor",
4
+ inputs: [
5
+ { name: "_owner", type: "address", internalType: "address" },
6
+ { name: "addressProvider_", type: "address", internalType: "address" }
7
+ ],
8
+ stateMutability: "nonpayable"
9
+ },
10
+ {
11
+ type: "function",
12
+ name: "addressProvider",
13
+ inputs: [],
14
+ outputs: [{ name: "", type: "address", internalType: "address" }],
15
+ stateMutability: "view"
16
+ },
17
+ {
18
+ type: "function",
19
+ name: "compressorTypeToCompressor",
20
+ inputs: [
21
+ { name: "", type: "bytes32", internalType: "bytes32" },
22
+ { name: "", type: "uint256", internalType: "uint256" }
23
+ ],
24
+ outputs: [{ name: "", type: "address", internalType: "address" }],
25
+ stateMutability: "view"
26
+ },
27
+ {
28
+ type: "function",
29
+ name: "contractType",
30
+ inputs: [],
31
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
32
+ stateMutability: "view"
33
+ },
34
+ {
35
+ type: "function",
36
+ name: "getLiquidationData",
37
+ inputs: [
38
+ { name: "liquidator", type: "address", internalType: "address" },
39
+ { name: "creditAccount", type: "address", internalType: "address" },
40
+ {
41
+ name: "priceUpdates",
42
+ type: "tuple[]",
43
+ internalType: "struct PriceUpdate[]",
44
+ components: [
45
+ { name: "priceFeed", type: "address", internalType: "address" },
46
+ { name: "data", type: "bytes", internalType: "bytes" }
47
+ ]
48
+ }
49
+ ],
50
+ outputs: [
51
+ {
52
+ name: "",
53
+ type: "tuple",
54
+ internalType: "struct LiquidationData",
55
+ components: [
56
+ {
57
+ name: "requiredUnderlyingAmount",
58
+ type: "uint256",
59
+ internalType: "uint256"
60
+ },
61
+ {
62
+ name: "expectedOutputs",
63
+ type: "tuple[]",
64
+ internalType: "struct LiquidationOutput[]",
65
+ components: [
66
+ { name: "token", type: "address", internalType: "address" },
67
+ { name: "amount", type: "uint256", internalType: "uint256" },
68
+ { name: "delayed", type: "bool", internalType: "bool" },
69
+ {
70
+ name: "redeemerAddress",
71
+ type: "address",
72
+ internalType: "address"
73
+ },
74
+ { name: "claimableAt", type: "uint256", internalType: "uint256" }
75
+ ]
76
+ },
77
+ {
78
+ name: "liquidationCall",
79
+ type: "tuple",
80
+ internalType: "struct MultiCall",
81
+ components: [
82
+ { name: "target", type: "address", internalType: "address" },
83
+ { name: "callData", type: "bytes", internalType: "bytes" }
84
+ ]
85
+ },
86
+ { name: "isLiquidatorEligible", type: "bool", internalType: "bool" },
87
+ { name: "kycProtocol", type: "string", internalType: "string" },
88
+ { name: "kycToken", type: "address", internalType: "address" }
89
+ ]
90
+ }
91
+ ],
92
+ stateMutability: "nonpayable"
93
+ },
94
+ {
95
+ type: "function",
96
+ name: "liquidatableTypeToCompressorType",
97
+ inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
98
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
99
+ stateMutability: "view"
100
+ },
101
+ {
102
+ type: "function",
103
+ name: "liquidatableTypeToSpecificCompressorVersion",
104
+ inputs: [
105
+ { name: "", type: "bytes32", internalType: "bytes32" },
106
+ { name: "", type: "uint256", internalType: "uint256" }
107
+ ],
108
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
109
+ stateMutability: "view"
110
+ },
111
+ {
112
+ type: "function",
113
+ name: "owner",
114
+ inputs: [],
115
+ outputs: [{ name: "", type: "address", internalType: "address" }],
116
+ stateMutability: "view"
117
+ },
118
+ {
119
+ type: "function",
120
+ name: "renounceOwnership",
121
+ inputs: [],
122
+ outputs: [],
123
+ stateMutability: "nonpayable"
124
+ },
125
+ {
126
+ type: "function",
127
+ name: "setLiquidatableTypeToCompressorType",
128
+ inputs: [
129
+ { name: "liquidatableType", type: "bytes32", internalType: "bytes32" },
130
+ { name: "compressorType", type: "bytes32", internalType: "bytes32" }
131
+ ],
132
+ outputs: [],
133
+ stateMutability: "nonpayable"
134
+ },
135
+ {
136
+ type: "function",
137
+ name: "setLiquidatableVersionToSpecificCompressorVersion",
138
+ inputs: [
139
+ { name: "liquidatableType", type: "bytes32", internalType: "bytes32" },
140
+ { name: "liquidatableVersion", type: "uint256", internalType: "uint256" },
141
+ { name: "compressorVersion", type: "uint256", internalType: "uint256" }
142
+ ],
143
+ outputs: [],
144
+ stateMutability: "nonpayable"
145
+ },
146
+ {
147
+ type: "function",
148
+ name: "setSubcompressor",
149
+ inputs: [
150
+ { name: "subcompressor", type: "address", internalType: "address" }
151
+ ],
152
+ outputs: [],
153
+ stateMutability: "nonpayable"
154
+ },
155
+ {
156
+ type: "function",
157
+ name: "transferOwnership",
158
+ inputs: [{ name: "newOwner", type: "address", internalType: "address" }],
159
+ outputs: [],
160
+ stateMutability: "nonpayable"
161
+ },
162
+ {
163
+ type: "function",
164
+ name: "version",
165
+ inputs: [],
166
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
167
+ stateMutability: "view"
168
+ },
169
+ {
170
+ type: "event",
171
+ name: "OwnershipTransferred",
172
+ inputs: [
173
+ {
174
+ name: "previousOwner",
175
+ type: "address",
176
+ indexed: true,
177
+ internalType: "address"
178
+ },
179
+ {
180
+ name: "newOwner",
181
+ type: "address",
182
+ indexed: true,
183
+ internalType: "address"
184
+ }
185
+ ],
186
+ anonymous: false
187
+ }
188
+ ];
189
+ export {
190
+ liquidationCompressorAbi
191
+ };
@@ -0,0 +1,80 @@
1
+ const midasLiquidationSubcompressorAbi = [
2
+ {
3
+ type: "function",
4
+ name: "contractType",
5
+ inputs: [],
6
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
7
+ stateMutability: "view"
8
+ },
9
+ {
10
+ type: "function",
11
+ name: "getLiquidationData",
12
+ inputs: [
13
+ { name: "liquidator", type: "address", internalType: "address" },
14
+ { name: "creditAccount", type: "address", internalType: "address" },
15
+ { name: "phantomToken", type: "address", internalType: "address" },
16
+ {
17
+ name: "priceUpdates",
18
+ type: "tuple[]",
19
+ internalType: "struct PriceUpdate[]",
20
+ components: [
21
+ { name: "priceFeed", type: "address", internalType: "address" },
22
+ { name: "data", type: "bytes", internalType: "bytes" }
23
+ ]
24
+ }
25
+ ],
26
+ outputs: [
27
+ {
28
+ name: "data",
29
+ type: "tuple",
30
+ internalType: "struct LiquidationData",
31
+ components: [
32
+ {
33
+ name: "requiredUnderlyingAmount",
34
+ type: "uint256",
35
+ internalType: "uint256"
36
+ },
37
+ {
38
+ name: "expectedOutputs",
39
+ type: "tuple[]",
40
+ internalType: "struct LiquidationOutput[]",
41
+ components: [
42
+ { name: "token", type: "address", internalType: "address" },
43
+ { name: "amount", type: "uint256", internalType: "uint256" },
44
+ { name: "delayed", type: "bool", internalType: "bool" },
45
+ {
46
+ name: "redeemerAddress",
47
+ type: "address",
48
+ internalType: "address"
49
+ },
50
+ { name: "claimableAt", type: "uint256", internalType: "uint256" }
51
+ ]
52
+ },
53
+ {
54
+ name: "liquidationCall",
55
+ type: "tuple",
56
+ internalType: "struct MultiCall",
57
+ components: [
58
+ { name: "target", type: "address", internalType: "address" },
59
+ { name: "callData", type: "bytes", internalType: "bytes" }
60
+ ]
61
+ },
62
+ { name: "isLiquidatorEligible", type: "bool", internalType: "bool" },
63
+ { name: "kycProtocol", type: "string", internalType: "string" },
64
+ { name: "kycToken", type: "address", internalType: "address" }
65
+ ]
66
+ }
67
+ ],
68
+ stateMutability: "nonpayable"
69
+ },
70
+ {
71
+ type: "function",
72
+ name: "version",
73
+ inputs: [],
74
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
75
+ stateMutability: "view"
76
+ }
77
+ ];
78
+ export {
79
+ midasLiquidationSubcompressorAbi
80
+ };