@gearbox-protocol/sdk 16.3.0-next.5 → 16.3.0
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/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/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
package/package.json
CHANGED
|
@@ -1,107 +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_chain_chains = require("../../onchain/chain/chains.js");
|
|
4
|
-
const require_onchain_constants_address_provider = require("../../onchain/constants/address-provider.js");
|
|
5
|
-
const require_onchain_utils_hex = require("../../onchain/utils/hex.js");
|
|
6
|
-
const require_onchain_plugins_BasePlugin = require("../../onchain/plugins/BasePlugin.js");
|
|
7
|
-
require("../../onchain/index.js");
|
|
8
|
-
const require_abi_310_iBytecodeRepository = require("../../abi/310/iBytecodeRepository.js");
|
|
9
|
-
const require_plugins_bots_abi_iPartialLiquidationBotV310 = require("./abi/iPartialLiquidationBotV310.js");
|
|
10
|
-
const require_plugins_bots_config = require("./config.js");
|
|
11
|
-
const require_plugins_bots_types = require("./types.js");
|
|
12
|
-
const require_plugins_bots_PartialLiquidationBotV310Contract = require("./PartialLiquidationBotV310Contract.js");
|
|
13
|
-
let viem = require("viem");
|
|
14
|
-
//#region src/plugins/bots/BotsPlugin.ts
|
|
15
|
-
var BotsPlugin = class extends require_onchain_plugins_BasePlugin.BasePlugin {
|
|
16
|
-
#bots;
|
|
17
|
-
get loaded() {
|
|
18
|
-
return !!this.#bots;
|
|
19
|
-
}
|
|
20
|
-
get bots() {
|
|
21
|
-
return this.#bots?.values() ?? [];
|
|
22
|
-
}
|
|
23
|
-
async load(force) {
|
|
24
|
-
if (!force && this.loaded) return this.state;
|
|
25
|
-
const treasury = this.sdk.addressProvider.getAddress(require_onchain_constants_address_provider.AP_TREASURY);
|
|
26
|
-
const bcr = this.sdk.addressProvider.getAddress(require_onchain_constants_address_provider.AP_BYTECODE_REPOSITORY);
|
|
27
|
-
const configs = require_plugins_bots_config.PARTIAL_LIQUIDATION_BOT_CONFIGS[this.sdk.networkType] ?? [];
|
|
28
|
-
this.#bots = new require_onchain_utils_AddressMap.AddressMap();
|
|
29
|
-
if (!configs.length) return this.state;
|
|
30
|
-
const deployedBots = await this.client.multicall({
|
|
31
|
-
contracts: configs.map((config) => ({
|
|
32
|
-
address: bcr,
|
|
33
|
-
abi: require_abi_310_iBytecodeRepository.iBytecodeRepositoryAbi,
|
|
34
|
-
functionName: "computeAddress",
|
|
35
|
-
args: [
|
|
36
|
-
(0, viem.stringToHex)(require_plugins_bots_types.BOT_PARTIAL_LIQUIDATION, { size: 32 }),
|
|
37
|
-
310,
|
|
38
|
-
(0, viem.encodeAbiParameters)(require_plugins_bots_types.BOT_PARAMS_ABI, [
|
|
39
|
-
treasury,
|
|
40
|
-
config.minHealthFactor,
|
|
41
|
-
config.maxHealthFactor,
|
|
42
|
-
config.premiumScaleFactor,
|
|
43
|
-
config.feeScaleFactor
|
|
44
|
-
]),
|
|
45
|
-
(0, viem.stringToHex)(require_plugins_bots_config.PARTIAL_LIQUIDATION_BOT_SALT, { size: 32 }),
|
|
46
|
-
require_plugins_bots_config.PARTIAL_LIQUIDATION_BOT_DEPLOYER
|
|
47
|
-
]
|
|
48
|
-
})),
|
|
49
|
-
allowFailure: true,
|
|
50
|
-
blockNumber: this.sdk.currentBlock,
|
|
51
|
-
batchSize: 0
|
|
52
|
-
});
|
|
53
|
-
const expectedBots = new require_onchain_utils_AddressMap.AddressMap();
|
|
54
|
-
for (let i = 0; i < configs.length; i++) {
|
|
55
|
-
const b = deployedBots[i];
|
|
56
|
-
const { minHealthFactor, maxHealthFactor } = configs[i];
|
|
57
|
-
if (b.status === "success") {
|
|
58
|
-
expectedBots.upsert(b.result, {
|
|
59
|
-
...configs[i],
|
|
60
|
-
treasury
|
|
61
|
-
});
|
|
62
|
-
this.logger?.debug(`expected bot [${minHealthFactor}, ${maxHealthFactor}] at ${b.result}`);
|
|
63
|
-
} else this.logger?.error(`failed compute address for bot [${minHealthFactor}, ${maxHealthFactor}]`, b.error);
|
|
64
|
-
}
|
|
65
|
-
const botAddrs = expectedBots.keys();
|
|
66
|
-
const serializedBots = await this.client.multicall({
|
|
67
|
-
contracts: botAddrs.map((address) => ({
|
|
68
|
-
address,
|
|
69
|
-
abi: require_plugins_bots_abi_iPartialLiquidationBotV310.iPartialLiquidationBotV310Abi,
|
|
70
|
-
functionName: "serialize"
|
|
71
|
-
})),
|
|
72
|
-
allowFailure: true,
|
|
73
|
-
blockNumber: this.sdk.currentBlock,
|
|
74
|
-
batchSize: 0
|
|
75
|
-
});
|
|
76
|
-
for (let i = 0; i < botAddrs.length; i++) {
|
|
77
|
-
const serialized = serializedBots[i];
|
|
78
|
-
const expected = expectedBots.mustGet(botAddrs[i]);
|
|
79
|
-
if (serialized.status === "success") {
|
|
80
|
-
const bot = new require_plugins_bots_PartialLiquidationBotV310Contract.PartialLiquidationBotV310Contract(this.sdk, {
|
|
81
|
-
addr: botAddrs[i],
|
|
82
|
-
version: BigInt(310),
|
|
83
|
-
contractType: require_plugins_bots_types.BOT_PARTIAL_LIQUIDATION,
|
|
84
|
-
serializedParams: serialized.result
|
|
85
|
-
});
|
|
86
|
-
if (!require_onchain_utils_hex.hexEq(treasury, expected.treasury) || bot.minHealthFactor !== expected.minHealthFactor || bot.maxHealthFactor !== expected.maxHealthFactor || bot.premiumScaleFactor !== expected.premiumScaleFactor || bot.feeScaleFactor !== expected.feeScaleFactor) this.logger?.error(`serialized bot ${botAddrs[i]} does not match expected bot`, serialized.error);
|
|
87
|
-
else this.#bots.upsert(botAddrs[i], bot);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return this.state;
|
|
91
|
-
}
|
|
92
|
-
stateHuman(raw) {
|
|
93
|
-
return { bots: this.#bots?.values().map((bot) => bot.stateHuman(raw)) ?? [] };
|
|
94
|
-
}
|
|
95
|
-
get state() {
|
|
96
|
-
return { bots: this.#bots?.values().map((bot) => bot.state) ?? [] };
|
|
97
|
-
}
|
|
98
|
-
hydrate(state) {
|
|
99
|
-
this.#bots = new require_onchain_utils_AddressMap.AddressMap();
|
|
100
|
-
for (const botState of state.bots) this.#bots.upsert(botState.addr, new require_plugins_bots_PartialLiquidationBotV310Contract.PartialLiquidationBotV310Contract(this.sdk, botState));
|
|
101
|
-
}
|
|
102
|
-
static getMigrationBotData(chainId) {
|
|
103
|
-
return chainId === require_onchain_chain_chains.chains.Mainnet.id ? require_plugins_bots_config.LEGACY_MIGRATION_BOT : void 0;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
//#endregion
|
|
107
|
-
exports.BotsPlugin = BotsPlugin;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_onchain_utils_formatter = require("../../onchain/utils/formatter.js");
|
|
3
|
-
const require_onchain_base_BaseContract = require("../../onchain/base/BaseContract.js");
|
|
4
|
-
require("../../onchain/index.js");
|
|
5
|
-
const require_plugins_bots_abi_iPartialLiquidationBotV310 = require("./abi/iPartialLiquidationBotV310.js");
|
|
6
|
-
require("./abi/index.js");
|
|
7
|
-
const require_plugins_bots_types = require("./types.js");
|
|
8
|
-
let viem = require("viem");
|
|
9
|
-
//#region src/plugins/bots/PartialLiquidationBotV310Contract.ts
|
|
10
|
-
const abi = require_plugins_bots_abi_iPartialLiquidationBotV310.iPartialLiquidationBotV310Abi;
|
|
11
|
-
var PartialLiquidationBotV310Contract = class extends require_onchain_base_BaseContract.BaseContract {
|
|
12
|
-
treasury;
|
|
13
|
-
minHealthFactor;
|
|
14
|
-
maxHealthFactor;
|
|
15
|
-
premiumScaleFactor;
|
|
16
|
-
feeScaleFactor;
|
|
17
|
-
#serializedParams;
|
|
18
|
-
constructor(sdk, args) {
|
|
19
|
-
super(sdk, {
|
|
20
|
-
...args,
|
|
21
|
-
abi,
|
|
22
|
-
name: "PartialLiquidationBotV310"
|
|
23
|
-
});
|
|
24
|
-
[this.treasury, this.minHealthFactor, this.maxHealthFactor, this.premiumScaleFactor, this.feeScaleFactor] = (0, viem.decodeAbiParameters)(require_plugins_bots_types.BOT_PARAMS_ABI, args.serializedParams);
|
|
25
|
-
this.#serializedParams = args.serializedParams;
|
|
26
|
-
}
|
|
27
|
-
stateHuman(raw) {
|
|
28
|
-
return {
|
|
29
|
-
...super.stateHuman(raw),
|
|
30
|
-
treasury: this.treasury,
|
|
31
|
-
minHealthFactor: require_onchain_utils_formatter.percentFmt(this.minHealthFactor, raw),
|
|
32
|
-
maxHealthFactor: require_onchain_utils_formatter.percentFmt(this.maxHealthFactor, raw),
|
|
33
|
-
premiumScaleFactor: require_onchain_utils_formatter.percentFmt(this.premiumScaleFactor, raw),
|
|
34
|
-
feeScaleFactor: require_onchain_utils_formatter.percentFmt(this.feeScaleFactor, raw)
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
get state() {
|
|
38
|
-
return {
|
|
39
|
-
addr: this.address,
|
|
40
|
-
version: BigInt(this.version),
|
|
41
|
-
contractType: (0, viem.stringToHex)(this.contractType, { size: 32 }),
|
|
42
|
-
serializedParams: this.#serializedParams
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
//#endregion
|
|
47
|
-
exports.PartialLiquidationBotV310Contract = PartialLiquidationBotV310Contract;
|
|
@@ -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" });
|