@gearbox-protocol/sdk 16.3.0-next.4 → 16.3.0-next.6
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/onchain/index.js +4 -4
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +7 -6
- package/dist/cjs/onchain/validation/bundles/{checkDraw.js → checkIncreaseDebt.js} +10 -10
- package/dist/cjs/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
- package/dist/cjs/onchain/validation/bundles/index.js +4 -4
- package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +1 -1
- package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +1 -1
- package/dist/cjs/onchain/validation/index.js +4 -4
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/history/trace/extractTransfers.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/index.js +3 -3
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/rwa/createDegenNFT.js +1 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/preview/preview/previewPoolPositionOperation.js +2 -2
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +7 -6
- package/dist/esm/onchain/validation/bundles/checkIncreaseDebt.js +27 -0
- package/dist/esm/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
- package/dist/esm/onchain/validation/bundles/index.js +3 -3
- package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +1 -1
- package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +1 -1
- package/dist/esm/onchain/validation/index.js +3 -3
- package/dist/types/model/errors/operation-errors.d.ts +2 -2
- package/dist/types/model/opportunities.d.ts +2 -2
- package/dist/types/onchain/index.d.ts +3 -3
- package/dist/types/onchain/market/pool/types.d.ts +1 -1
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +3 -2
- package/dist/types/onchain/validation/bundles/{checkDraw.d.ts → checkIncreaseDebt.d.ts} +7 -7
- package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts} +3 -3
- package/dist/types/onchain/validation/bundles/index.d.ts +3 -3
- package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +1 -1
- package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +1 -1
- package/dist/types/onchain/validation/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/cjs/plugins/bots/BotsPlugin.js +0 -107
- package/dist/cjs/plugins/bots/PartialLiquidationBotV310Contract.js +0 -47
- package/dist/cjs/plugins/bots/abi/iPartialLiquidationBotV310.js +0 -225
- package/dist/cjs/plugins/bots/abi/index.js +0 -3
- package/dist/cjs/plugins/bots/config.js +0 -39
- package/dist/cjs/plugins/bots/deserializePartialLiquidationBotParams.js +0 -39
- package/dist/cjs/plugins/bots/index.js +0 -17
- package/dist/cjs/plugins/bots/package.json +0 -1
- package/dist/cjs/plugins/bots/types.js +0 -28
- package/dist/cjs/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -61
- package/dist/cjs/plugins/degen-distributors/index.js +0 -4
- package/dist/cjs/plugins/degen-distributors/package.json +0 -1
- package/dist/cjs/plugins/degen-distributors/types.js +0 -1
- package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -114
- package/dist/cjs/plugins/delayed-withdrawal/index.js +0 -4
- package/dist/cjs/plugins/delayed-withdrawal/package.json +0 -1
- package/dist/cjs/plugins/delayed-withdrawal/types.js +0 -1
- package/dist/esm/onchain/validation/bundles/checkDraw.js +0 -27
- package/dist/esm/plugins/bots/BotsPlugin.js +0 -106
- package/dist/esm/plugins/bots/PartialLiquidationBotV310Contract.js +0 -46
- package/dist/esm/plugins/bots/abi/iPartialLiquidationBotV310.js +0 -224
- package/dist/esm/plugins/bots/abi/index.js +0 -2
- package/dist/esm/plugins/bots/config.js +0 -34
- package/dist/esm/plugins/bots/deserializePartialLiquidationBotParams.js +0 -35
- package/dist/esm/plugins/bots/index.js +0 -7
- package/dist/esm/plugins/bots/package.json +0 -1
- package/dist/esm/plugins/bots/types.js +0 -26
- package/dist/esm/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -60
- package/dist/esm/plugins/degen-distributors/index.js +0 -3
- package/dist/esm/plugins/degen-distributors/package.json +0 -1
- package/dist/esm/plugins/degen-distributors/types.js +0 -1
- package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -113
- package/dist/esm/plugins/delayed-withdrawal/index.js +0 -3
- package/dist/esm/plugins/delayed-withdrawal/package.json +0 -1
- package/dist/esm/plugins/delayed-withdrawal/types.js +0 -1
- package/dist/types/plugins/bots/BotsPlugin.d.ts +0 -18
- package/dist/types/plugins/bots/PartialLiquidationBotV310Contract.d.ts +0 -216
- package/dist/types/plugins/bots/abi/iPartialLiquidationBotV310.d.ts +0 -193
- package/dist/types/plugins/bots/abi/index.d.ts +0 -2
- package/dist/types/plugins/bots/config.d.ts +0 -12
- package/dist/types/plugins/bots/deserializePartialLiquidationBotParams.d.ts +0 -7
- package/dist/types/plugins/bots/index.d.ts +0 -7
- package/dist/types/plugins/bots/types.d.ts +0 -53
- package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +0 -25
- package/dist/types/plugins/degen-distributors/index.d.ts +0 -3
- package/dist/types/plugins/degen-distributors/types.d.ts +0 -8
- package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +0 -25
- package/dist/types/plugins/delayed-withdrawal/index.d.ts +0 -3
- package/dist/types/plugins/delayed-withdrawal/types.d.ts +0 -10
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region src/plugins/bots/abi/iPartialLiquidationBotV310.ts
|
|
3
|
-
const iPartialLiquidationBotV310Abi = [
|
|
4
|
-
{
|
|
5
|
-
type: "function",
|
|
6
|
-
name: "contractType",
|
|
7
|
-
inputs: [],
|
|
8
|
-
outputs: [{
|
|
9
|
-
name: "",
|
|
10
|
-
type: "bytes32",
|
|
11
|
-
internalType: "bytes32"
|
|
12
|
-
}],
|
|
13
|
-
stateMutability: "view"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: "function",
|
|
17
|
-
name: "feeScaleFactor",
|
|
18
|
-
inputs: [],
|
|
19
|
-
outputs: [{
|
|
20
|
-
name: "",
|
|
21
|
-
type: "uint16",
|
|
22
|
-
internalType: "uint16"
|
|
23
|
-
}],
|
|
24
|
-
stateMutability: "view"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: "function",
|
|
28
|
-
name: "maxHealthFactor",
|
|
29
|
-
inputs: [],
|
|
30
|
-
outputs: [{
|
|
31
|
-
name: "",
|
|
32
|
-
type: "uint16",
|
|
33
|
-
internalType: "uint16"
|
|
34
|
-
}],
|
|
35
|
-
stateMutability: "view"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: "function",
|
|
39
|
-
name: "minHealthFactor",
|
|
40
|
-
inputs: [],
|
|
41
|
-
outputs: [{
|
|
42
|
-
name: "",
|
|
43
|
-
type: "uint16",
|
|
44
|
-
internalType: "uint16"
|
|
45
|
-
}],
|
|
46
|
-
stateMutability: "view"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: "function",
|
|
50
|
-
name: "partiallyLiquidate",
|
|
51
|
-
inputs: [
|
|
52
|
-
{
|
|
53
|
-
name: "creditAccount",
|
|
54
|
-
type: "address",
|
|
55
|
-
internalType: "address"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "token",
|
|
59
|
-
type: "address",
|
|
60
|
-
internalType: "address"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "repaidAmount",
|
|
64
|
-
type: "uint256",
|
|
65
|
-
internalType: "uint256"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "minSeizedAmount",
|
|
69
|
-
type: "uint256",
|
|
70
|
-
internalType: "uint256"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "to",
|
|
74
|
-
type: "address",
|
|
75
|
-
internalType: "address"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "priceUpdates",
|
|
79
|
-
type: "tuple[]",
|
|
80
|
-
internalType: "struct PriceUpdate[]",
|
|
81
|
-
components: [{
|
|
82
|
-
name: "priceFeed",
|
|
83
|
-
type: "address",
|
|
84
|
-
internalType: "address"
|
|
85
|
-
}, {
|
|
86
|
-
name: "data",
|
|
87
|
-
type: "bytes",
|
|
88
|
-
internalType: "bytes"
|
|
89
|
-
}]
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
outputs: [{
|
|
93
|
-
name: "seizedAmount",
|
|
94
|
-
type: "uint256",
|
|
95
|
-
internalType: "uint256"
|
|
96
|
-
}],
|
|
97
|
-
stateMutability: "nonpayable"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: "function",
|
|
101
|
-
name: "premiumScaleFactor",
|
|
102
|
-
inputs: [],
|
|
103
|
-
outputs: [{
|
|
104
|
-
name: "",
|
|
105
|
-
type: "uint16",
|
|
106
|
-
internalType: "uint16"
|
|
107
|
-
}],
|
|
108
|
-
stateMutability: "view"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
type: "function",
|
|
112
|
-
name: "requiredPermissions",
|
|
113
|
-
inputs: [],
|
|
114
|
-
outputs: [{
|
|
115
|
-
name: "",
|
|
116
|
-
type: "uint192",
|
|
117
|
-
internalType: "uint192"
|
|
118
|
-
}],
|
|
119
|
-
stateMutability: "view"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
type: "function",
|
|
123
|
-
name: "serialize",
|
|
124
|
-
inputs: [],
|
|
125
|
-
outputs: [{
|
|
126
|
-
name: "serializedData",
|
|
127
|
-
type: "bytes",
|
|
128
|
-
internalType: "bytes"
|
|
129
|
-
}],
|
|
130
|
-
stateMutability: "view"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
type: "function",
|
|
134
|
-
name: "treasury",
|
|
135
|
-
inputs: [],
|
|
136
|
-
outputs: [{
|
|
137
|
-
name: "",
|
|
138
|
-
type: "address",
|
|
139
|
-
internalType: "address"
|
|
140
|
-
}],
|
|
141
|
-
stateMutability: "view"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
type: "function",
|
|
145
|
-
name: "version",
|
|
146
|
-
inputs: [],
|
|
147
|
-
outputs: [{
|
|
148
|
-
name: "",
|
|
149
|
-
type: "uint256",
|
|
150
|
-
internalType: "uint256"
|
|
151
|
-
}],
|
|
152
|
-
stateMutability: "view"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
type: "event",
|
|
156
|
-
name: "PartiallyLiquidate",
|
|
157
|
-
inputs: [
|
|
158
|
-
{
|
|
159
|
-
name: "creditManager",
|
|
160
|
-
type: "address",
|
|
161
|
-
indexed: true,
|
|
162
|
-
internalType: "address"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
name: "creditAccount",
|
|
166
|
-
type: "address",
|
|
167
|
-
indexed: true,
|
|
168
|
-
internalType: "address"
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
name: "token",
|
|
172
|
-
type: "address",
|
|
173
|
-
indexed: true,
|
|
174
|
-
internalType: "address"
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: "liquidator",
|
|
178
|
-
type: "address",
|
|
179
|
-
indexed: false,
|
|
180
|
-
internalType: "address"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
name: "repaidDebt",
|
|
184
|
-
type: "uint256",
|
|
185
|
-
indexed: false,
|
|
186
|
-
internalType: "uint256"
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
name: "seizedCollateral",
|
|
190
|
-
type: "uint256",
|
|
191
|
-
indexed: false,
|
|
192
|
-
internalType: "uint256"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: "fee",
|
|
196
|
-
type: "uint256",
|
|
197
|
-
indexed: false,
|
|
198
|
-
internalType: "uint256"
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
anonymous: false
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
type: "error",
|
|
205
|
-
name: "LiquidatedLessThanNeededException",
|
|
206
|
-
inputs: []
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
type: "error",
|
|
210
|
-
name: "LiquidatedMoreThanNeededException",
|
|
211
|
-
inputs: []
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
type: "error",
|
|
215
|
-
name: "SeizedLessThanRequiredException",
|
|
216
|
-
inputs: []
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
type: "error",
|
|
220
|
-
name: "UnderlyingNotLiquidatableException",
|
|
221
|
-
inputs: []
|
|
222
|
-
}
|
|
223
|
-
];
|
|
224
|
-
//#endregion
|
|
225
|
-
exports.iPartialLiquidationBotV310Abi = iPartialLiquidationBotV310Abi;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_plugins_bots_abi_iPartialLiquidationBotV310 = require("./iPartialLiquidationBotV310.js");
|
|
3
|
-
exports.iPartialLiquidationBotV310Abi = require_plugins_bots_abi_iPartialLiquidationBotV310.iPartialLiquidationBotV310Abi;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../onchain/constants/bot-permissions.js");
|
|
3
|
-
require("../../onchain/index.js");
|
|
4
|
-
//#region src/plugins/bots/config.ts
|
|
5
|
-
const PARTIAL_LIQUIDATION_BOT_CONFIGS = {
|
|
6
|
-
Mainnet: [{
|
|
7
|
-
minHealthFactor: 10300,
|
|
8
|
-
maxHealthFactor: 10700,
|
|
9
|
-
premiumScaleFactor: 1e4,
|
|
10
|
-
feeScaleFactor: 1e4
|
|
11
|
-
}],
|
|
12
|
-
Monad: [{
|
|
13
|
-
minHealthFactor: 10300,
|
|
14
|
-
maxHealthFactor: 10700,
|
|
15
|
-
premiumScaleFactor: 1e4,
|
|
16
|
-
feeScaleFactor: 1e4
|
|
17
|
-
}],
|
|
18
|
-
Plasma: [{
|
|
19
|
-
minHealthFactor: 10300,
|
|
20
|
-
maxHealthFactor: 10700,
|
|
21
|
-
premiumScaleFactor: 1e4,
|
|
22
|
-
feeScaleFactor: 1e4
|
|
23
|
-
}]
|
|
24
|
-
};
|
|
25
|
-
const PARTIAL_LIQUIDATION_BOT_SALT = "GEARBOX";
|
|
26
|
-
const PARTIAL_LIQUIDATION_BOT_DEPLOYER = "0xc93155E0a835Cf4E17a19463Fa67ed43c164d06a";
|
|
27
|
-
const LEGACY_MIGRATION_BOT = {
|
|
28
|
-
address: "0x286Fe53994f5668D56538Aa10eaa3Ac36f878e9C".toLowerCase(),
|
|
29
|
-
previewer: "0x6523B8c9daB92eea7944a79b4Dbb598c7934DCca".toLowerCase(),
|
|
30
|
-
version: 310,
|
|
31
|
-
baseType: "LEGACY_MIGRATION"
|
|
32
|
-
};
|
|
33
|
-
const PERMISSION_BY_TYPE = { LEGACY_MIGRATION: BigInt(65604) };
|
|
34
|
-
//#endregion
|
|
35
|
-
exports.LEGACY_MIGRATION_BOT = LEGACY_MIGRATION_BOT;
|
|
36
|
-
exports.PARTIAL_LIQUIDATION_BOT_CONFIGS = PARTIAL_LIQUIDATION_BOT_CONFIGS;
|
|
37
|
-
exports.PARTIAL_LIQUIDATION_BOT_DEPLOYER = PARTIAL_LIQUIDATION_BOT_DEPLOYER;
|
|
38
|
-
exports.PARTIAL_LIQUIDATION_BOT_SALT = PARTIAL_LIQUIDATION_BOT_SALT;
|
|
39
|
-
exports.PERMISSION_BY_TYPE = PERMISSION_BY_TYPE;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
let viem = require("viem");
|
|
6
|
-
//#region src/plugins/bots/deserializePartialLiquidationBotParams.ts
|
|
7
|
-
function deserializePartialLiquidationBotParams(params) {
|
|
8
|
-
const [treasury, minHealthFactor, maxHealthFactor, premiumScaleFactor, feeScaleFactor] = (0, viem.decodeAbiParameters)([
|
|
9
|
-
{
|
|
10
|
-
name: "treasury",
|
|
11
|
-
type: "address"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: "minHealthFactor",
|
|
15
|
-
type: "uint16"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "maxHealthFactor",
|
|
19
|
-
type: "uint16"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "premiumScaleFactor",
|
|
23
|
-
type: "uint16"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "feeScaleFactor",
|
|
27
|
-
type: "uint16"
|
|
28
|
-
}
|
|
29
|
-
], params.serializedParams);
|
|
30
|
-
return {
|
|
31
|
-
treasury,
|
|
32
|
-
minHealthFactor,
|
|
33
|
-
maxHealthFactor,
|
|
34
|
-
premiumScaleFactor,
|
|
35
|
-
feeScaleFactor
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
exports.default = deserializePartialLiquidationBotParams;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_plugins_bots_abi_iPartialLiquidationBotV310 = require("./abi/iPartialLiquidationBotV310.js");
|
|
3
|
-
const require_plugins_bots_config = require("./config.js");
|
|
4
|
-
require("./abi/index.js");
|
|
5
|
-
const require_plugins_bots_types = require("./types.js");
|
|
6
|
-
const require_plugins_bots_PartialLiquidationBotV310Contract = require("./PartialLiquidationBotV310Contract.js");
|
|
7
|
-
const require_plugins_bots_BotsPlugin = require("./BotsPlugin.js");
|
|
8
|
-
exports.BOT_PARAMS_ABI = require_plugins_bots_types.BOT_PARAMS_ABI;
|
|
9
|
-
exports.BOT_PARTIAL_LIQUIDATION = require_plugins_bots_types.BOT_PARTIAL_LIQUIDATION;
|
|
10
|
-
exports.BotsPlugin = require_plugins_bots_BotsPlugin.BotsPlugin;
|
|
11
|
-
exports.LEGACY_MIGRATION_BOT = require_plugins_bots_config.LEGACY_MIGRATION_BOT;
|
|
12
|
-
exports.PARTIAL_LIQUIDATION_BOT_CONFIGS = require_plugins_bots_config.PARTIAL_LIQUIDATION_BOT_CONFIGS;
|
|
13
|
-
exports.PARTIAL_LIQUIDATION_BOT_DEPLOYER = require_plugins_bots_config.PARTIAL_LIQUIDATION_BOT_DEPLOYER;
|
|
14
|
-
exports.PARTIAL_LIQUIDATION_BOT_SALT = require_plugins_bots_config.PARTIAL_LIQUIDATION_BOT_SALT;
|
|
15
|
-
exports.PERMISSION_BY_TYPE = require_plugins_bots_config.PERMISSION_BY_TYPE;
|
|
16
|
-
exports.PartialLiquidationBotV310Contract = require_plugins_bots_PartialLiquidationBotV310Contract.PartialLiquidationBotV310Contract;
|
|
17
|
-
exports.iPartialLiquidationBotV310Abi = require_plugins_bots_abi_iPartialLiquidationBotV310.iPartialLiquidationBotV310Abi;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "commonjs"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region src/plugins/bots/types.ts
|
|
3
|
-
const BOT_PARTIAL_LIQUIDATION = "BOT::PARTIAL_LIQUIDATION";
|
|
4
|
-
const BOT_PARAMS_ABI = [
|
|
5
|
-
{
|
|
6
|
-
type: "address",
|
|
7
|
-
name: "treasury"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
type: "uint16",
|
|
11
|
-
name: "minHealthFactor"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
type: "uint16",
|
|
15
|
-
name: "maxHealthFactor"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: "uint16",
|
|
19
|
-
name: "premiumScaleFactor"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: "uint16",
|
|
23
|
-
name: "feeScaleFactor"
|
|
24
|
-
}
|
|
25
|
-
];
|
|
26
|
-
//#endregion
|
|
27
|
-
exports.BOT_PARAMS_ABI = BOT_PARAMS_ABI;
|
|
28
|
-
exports.BOT_PARTIAL_LIQUIDATION = BOT_PARTIAL_LIQUIDATION;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_onchain_utils_AddressMap = require("../../onchain/utils/AddressMap.js");
|
|
3
|
-
const require_onchain_market_MarketConfiguratorContract = require("../../onchain/market/MarketConfiguratorContract.js");
|
|
4
|
-
const require_onchain_plugins_BasePlugin = require("../../onchain/plugins/BasePlugin.js");
|
|
5
|
-
require("../../onchain/index.js");
|
|
6
|
-
//#region src/plugins/degen-distributors/DegenDistributorsPlugin.ts
|
|
7
|
-
const MAP_LABEL = "degenDistributors";
|
|
8
|
-
var DegenDistributorsPlugin = class extends require_onchain_plugins_BasePlugin.BasePlugin {
|
|
9
|
-
#distributors;
|
|
10
|
-
async load(force) {
|
|
11
|
-
if (!force && this.loaded) return this.state;
|
|
12
|
-
const configurators = Object.values(this.sdk.marketRegister.markets.reduce((acc, market) => {
|
|
13
|
-
const cfgLC = market.configurator.address.toLowerCase();
|
|
14
|
-
acc[cfgLC] = market.configurator;
|
|
15
|
-
return acc;
|
|
16
|
-
}, {}));
|
|
17
|
-
this.sdk.logger?.debug(`loading degen distributors for ${this.sdk.networkType}`);
|
|
18
|
-
const distributors = await require_onchain_market_MarketConfiguratorContract.MarketConfiguratorContract.getPeripheryContractBatch(Object.values(configurators), this.sdk.client, "DEGEN_DISTRIBUTOR", this.sdk.currentBlock);
|
|
19
|
-
const distributorByConfigurator = configurators.reduce((acc, cfg, index) => {
|
|
20
|
-
const cfgLC = cfg.address.toLowerCase();
|
|
21
|
-
acc[cfgLC] = distributors[index];
|
|
22
|
-
return acc;
|
|
23
|
-
}, {});
|
|
24
|
-
this.#distributors = new require_onchain_utils_AddressMap.AddressMap(void 0, MAP_LABEL);
|
|
25
|
-
this.sdk.marketRegister.markets.forEach((m) => {
|
|
26
|
-
const pool = m.pool.pool.address;
|
|
27
|
-
const cfg = m.configurator.address;
|
|
28
|
-
const cfgLC = cfg.toLowerCase();
|
|
29
|
-
const r = distributorByConfigurator?.[cfgLC];
|
|
30
|
-
if (r.status === "success" && r.result.length > 0) this.#distributors?.upsert(pool, r.result[0]);
|
|
31
|
-
else this.sdk.logger?.warn(`failed to load degen distributor for market configurator ${this.labelAddress(cfg)} and pool ${this.labelAddress(pool)}: ${r.error}`);
|
|
32
|
-
});
|
|
33
|
-
return this.state;
|
|
34
|
-
}
|
|
35
|
-
get loaded() {
|
|
36
|
-
return !!this.#distributors;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Returns a map of pool addresses to degen distributor addresses
|
|
40
|
-
* @throws if degen distributor plugin is not attached
|
|
41
|
-
*/
|
|
42
|
-
get distributors() {
|
|
43
|
-
if (!this.#distributors) throw new Error("degen distributor plugin not attached");
|
|
44
|
-
return this.#distributors;
|
|
45
|
-
}
|
|
46
|
-
stateHuman(_) {
|
|
47
|
-
return this.distributors.entries().flatMap(([pool, distributor]) => ({
|
|
48
|
-
address: distributor,
|
|
49
|
-
version: this.version,
|
|
50
|
-
pool
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
get state() {
|
|
54
|
-
return { distributors: this.distributors.asRecord() };
|
|
55
|
-
}
|
|
56
|
-
hydrate(state) {
|
|
57
|
-
this.#distributors = new require_onchain_utils_AddressMap.AddressMap(Object.entries(state.distributors), MAP_LABEL);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
//#endregion
|
|
61
|
-
exports.DegenDistributorsPlugin = DegenDistributorsPlugin;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_plugins_degen_distributors_DegenDistributorsPlugin = require("./DegenDistributorsPlugin.js");
|
|
3
|
-
require("./types.js");
|
|
4
|
-
exports.DegenDistributorsPlugin = require_plugins_degen_distributors_DegenDistributorsPlugin.DegenDistributorsPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "commonjs"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_onchain_utils_AddressMap = require("../../onchain/utils/AddressMap.js");
|
|
3
|
-
const require_onchain_plugins_BasePlugin = require("../../onchain/plugins/BasePlugin.js");
|
|
4
|
-
require("../../onchain/index.js");
|
|
5
|
-
//#region src/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.ts
|
|
6
|
-
const MAP_LABEL = "delayedWithdrawal";
|
|
7
|
-
var DelayedWithdrawalPlugin = class extends require_onchain_plugins_BasePlugin.BasePlugin {
|
|
8
|
-
async load(force) {
|
|
9
|
-
if (!force && this.loaded) return this.state;
|
|
10
|
-
await this.sdk.withdrawalCompressor?.loadWithdrawableAssets(force);
|
|
11
|
-
return this.state;
|
|
12
|
-
}
|
|
13
|
-
get loaded() {
|
|
14
|
-
return !!this.sdk.withdrawalCompressor?.state;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns a map of cmAddress -> array of delayed assets
|
|
18
|
-
* @throws if withdrawable assets have not been loaded
|
|
19
|
-
*/
|
|
20
|
-
get withdrawableAssets() {
|
|
21
|
-
const compressor = this.sdk.withdrawalCompressor;
|
|
22
|
-
if (!compressor?.state) throw new Error("withdrawable assets are not loaded");
|
|
23
|
-
const result = new require_onchain_utils_AddressMap.AddressMap(void 0, MAP_LABEL);
|
|
24
|
-
for (const cfg of compressor.getWithdrawableAssets()) {
|
|
25
|
-
const assets = result.get(cfg.creditManager) ?? [];
|
|
26
|
-
assets.push({
|
|
27
|
-
...cfg,
|
|
28
|
-
disabled: isConfigToOmit({
|
|
29
|
-
creditManager: cfg.creditManager,
|
|
30
|
-
token: cfg.token,
|
|
31
|
-
withdrawalPhantomToken: cfg.withdrawalPhantomToken,
|
|
32
|
-
underlying: cfg.underlying
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
result.upsert(cfg.creditManager, assets);
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
stateHuman(_) {
|
|
40
|
-
return this.withdrawableAssets.values().flatMap((cm) => {
|
|
41
|
-
return cm.map((a) => {
|
|
42
|
-
return {
|
|
43
|
-
address: a.creditManager,
|
|
44
|
-
version: this.version,
|
|
45
|
-
...a
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
get state() {
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
function getConfigKey(config) {
|
|
55
|
-
return `${config.creditManager}-${config.token}-${config.withdrawalPhantomToken}-${config.underlying}`.toLowerCase();
|
|
56
|
-
}
|
|
57
|
-
function isConfigToOmit(config) {
|
|
58
|
-
return !!CONFIGS_TO_OMIT_RECORD[getConfigKey(config)];
|
|
59
|
-
}
|
|
60
|
-
const CONFIGS_TO_OMIT_RECORD = [
|
|
61
|
-
{
|
|
62
|
-
creditManager: "0xf5edc34204e67e592bdcb84114571c9e4bd0bdf7",
|
|
63
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
64
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
65
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
creditManager: "0xb79d6544839d169869476589d2e54014a074317b",
|
|
69
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
70
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
71
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
creditManager: "0x79c6c1ce5b12abcc3e407ce8c160ee1160250921",
|
|
75
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
76
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
77
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
creditManager: "0xc307a074bd5aec2d6ad1d9b74465c24a59b490fd",
|
|
81
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
82
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
83
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
creditManager: "0x9a0fdf7cdab4604fc27ebeab4b3d57bd825e8ebe",
|
|
87
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
88
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
89
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
creditManager: "0x06c0df5ac1f24bc2097b59ed8ee1db86bf0b09df",
|
|
93
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
94
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
95
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
creditManager: "0x1128860755c6d452d9326e35d1672ca7c920b7c1",
|
|
99
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
100
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
101
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
creditManager: "0x35e154be3c856c37d539aae90178fe5ac6d37644",
|
|
105
|
-
token: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
|
|
106
|
-
withdrawalPhantomToken: "0x6252467C2FefB61cB55180282943139BAeEA36c5",
|
|
107
|
-
underlying: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
108
|
-
}
|
|
109
|
-
].reduce((acc, config) => {
|
|
110
|
-
acc[getConfigKey(config)] = config;
|
|
111
|
-
return acc;
|
|
112
|
-
}, {});
|
|
113
|
-
//#endregion
|
|
114
|
-
exports.DelayedWithdrawalPlugin = DelayedWithdrawalPlugin;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_plugins_delayed_withdrawal_DelayedWithdrawalPlugin = require("./DelayedWithdrawalPlugin.js");
|
|
3
|
-
require("./types.js");
|
|
4
|
-
exports.DelayedWithdrawalPlugin = require_plugins_delayed_withdrawal_DelayedWithdrawalPlugin.DelayedWithdrawalPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type": "commonjs"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { checkBorrowLimit } from "../checks/checkBorrowLimit.js";
|
|
2
|
-
import "../checks/index.js";
|
|
3
|
-
//#region src/onchain/validation/bundles/checkDraw.ts
|
|
4
|
-
/**
|
|
5
|
-
* What the transaction draws, against what the market can lend right now.
|
|
6
|
-
*
|
|
7
|
-
* Only a draw is weighed: repaying, or leaving the debt alone, can never exceed
|
|
8
|
-
* a ceiling. Opening borrows the whole debt; adjusting borrows
|
|
9
|
-
* `totalDebtChange`.
|
|
10
|
-
*
|
|
11
|
-
* The engine holds every simulation to this already (`assertCanBorrow`), so
|
|
12
|
-
* this is here for the transactions it never saw — a pasted calldata reaches
|
|
13
|
-
* the confirm screen with nothing else standing between it and a revert.
|
|
14
|
-
*/
|
|
15
|
-
function checkDraw(suite, preview, underlying) {
|
|
16
|
-
const drawn = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
|
|
17
|
-
if (drawn <= 0n) return [];
|
|
18
|
-
const maxBorrowAmount = suite.maxBorrowAmount();
|
|
19
|
-
return checkBorrowLimit({
|
|
20
|
-
requested: drawn,
|
|
21
|
-
available: maxBorrowAmount.amount.value,
|
|
22
|
-
limit: maxBorrowAmount.limit,
|
|
23
|
-
underlying
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { checkDraw };
|