@gearbox-protocol/sdk 16.3.1-next.1 → 16.3.2-next.1
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/model/errors/index.js +1 -0
- package/dist/cjs/model/errors/operation-errors.js +9 -0
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/onchain/accounts/intents/collateral-money.js +41 -0
- package/dist/cjs/onchain/accounts/intents/guards.js +15 -3
- package/dist/cjs/onchain/accounts/intents/index.js +21 -18
- package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +12 -38
- package/dist/cjs/onchain/accounts/intents/realize.js +10 -2
- package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
- package/dist/cjs/onchain/accounts/intents/withdraw-limits.js +97 -0
- package/dist/cjs/onchain/index.js +2 -0
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +1 -1
- package/dist/cjs/onchain/validation/checks/checkReservePriceLimited.js +30 -0
- package/dist/cjs/onchain/validation/checks/index.js +2 -0
- package/dist/cjs/onchain/validation/index.js +2 -0
- package/dist/cjs/plugins/bots/BotsPlugin.js +107 -0
- package/dist/cjs/plugins/bots/PartialLiquidationBotV310Contract.js +47 -0
- package/dist/cjs/plugins/bots/abi/iPartialLiquidationBotV310.js +225 -0
- package/dist/cjs/plugins/bots/abi/index.js +3 -0
- package/dist/cjs/plugins/bots/config.js +39 -0
- package/dist/cjs/plugins/bots/deserializePartialLiquidationBotParams.js +39 -0
- package/dist/cjs/plugins/bots/index.js +17 -0
- package/dist/cjs/plugins/bots/package.json +1 -0
- package/dist/cjs/plugins/bots/types.js +28 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +3 -2
- 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/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +9 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/intents/collateral-money.js +40 -0
- package/dist/esm/onchain/accounts/intents/guards.js +15 -3
- package/dist/esm/onchain/accounts/intents/index.js +21 -18
- package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +12 -38
- package/dist/esm/onchain/accounts/intents/realize.js +10 -2
- package/dist/esm/onchain/accounts/intents/tail.js +1 -1
- package/dist/esm/onchain/accounts/intents/withdraw-limits.js +95 -0
- 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 +2 -1
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +1 -1
- 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/checks/checkReservePriceLimited.js +29 -0
- package/dist/esm/onchain/validation/checks/index.js +2 -1
- package/dist/esm/onchain/validation/index.js +2 -1
- package/dist/esm/plugins/bots/BotsPlugin.js +106 -0
- package/dist/esm/plugins/bots/PartialLiquidationBotV310Contract.js +46 -0
- package/dist/esm/plugins/bots/abi/iPartialLiquidationBotV310.js +224 -0
- package/dist/esm/plugins/bots/abi/index.js +2 -0
- package/dist/esm/plugins/bots/config.js +34 -0
- package/dist/esm/plugins/bots/deserializePartialLiquidationBotParams.js +35 -0
- package/dist/esm/plugins/bots/index.js +7 -0
- package/dist/esm/plugins/bots/package.json +1 -0
- package/dist/esm/plugins/bots/types.js +26 -0
- package/dist/esm/sdk/prepare/PrepareApi.js +3 -2
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +41 -1
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/collateral-money.d.ts +42 -0
- package/dist/types/onchain/accounts/intents/guards.d.ts +18 -2
- package/dist/types/onchain/accounts/intents/index.d.ts +23 -14
- package/dist/types/onchain/accounts/intents/maxWithdrawCollateral.d.ts +3 -8
- package/dist/types/onchain/accounts/intents/types.d.ts +26 -4
- package/dist/types/onchain/accounts/intents/withdraw-limits.d.ts +80 -0
- package/dist/types/onchain/index.d.ts +2 -1
- package/dist/types/onchain/validation/checks/checkReservePriceLimited.d.ts +31 -0
- package/dist/types/onchain/validation/checks/index.d.ts +2 -1
- package/dist/types/onchain/validation/index.d.ts +2 -1
- package/dist/types/onchain/validation/raise.d.ts +2 -2
- package/dist/types/plugins/bots/BotsPlugin.d.ts +18 -0
- package/dist/types/plugins/bots/PartialLiquidationBotV310Contract.d.ts +216 -0
- package/dist/types/plugins/bots/abi/iPartialLiquidationBotV310.d.ts +193 -0
- package/dist/types/plugins/bots/abi/index.d.ts +2 -0
- package/dist/types/plugins/bots/config.d.ts +12 -0
- package/dist/types/plugins/bots/deserializePartialLiquidationBotParams.d.ts +7 -0
- package/dist/types/plugins/bots/index.d.ts +7 -0
- package/dist/types/plugins/bots/types.d.ts +53 -0
- package/dist/types/sdk/prepare/PrepareApi.d.ts +1 -1
- package/dist/types/sdk/prepare/types.d.ts +23 -16
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
2
|
+
import { chains } from "../../onchain/chain/chains.js";
|
|
3
|
+
import { AP_BYTECODE_REPOSITORY, AP_TREASURY } from "../../onchain/constants/address-provider.js";
|
|
4
|
+
import { hexEq } from "../../onchain/utils/hex.js";
|
|
5
|
+
import { BasePlugin } from "../../onchain/plugins/BasePlugin.js";
|
|
6
|
+
import "../../onchain/index.js";
|
|
7
|
+
import { iBytecodeRepositoryAbi } from "../../abi/310/iBytecodeRepository.js";
|
|
8
|
+
import { iPartialLiquidationBotV310Abi } from "./abi/iPartialLiquidationBotV310.js";
|
|
9
|
+
import { LEGACY_MIGRATION_BOT, PARTIAL_LIQUIDATION_BOT_CONFIGS, PARTIAL_LIQUIDATION_BOT_DEPLOYER, PARTIAL_LIQUIDATION_BOT_SALT } from "./config.js";
|
|
10
|
+
import { BOT_PARAMS_ABI, BOT_PARTIAL_LIQUIDATION } from "./types.js";
|
|
11
|
+
import { PartialLiquidationBotV310Contract } from "./PartialLiquidationBotV310Contract.js";
|
|
12
|
+
import { encodeAbiParameters, stringToHex } from "viem";
|
|
13
|
+
//#region src/plugins/bots/BotsPlugin.ts
|
|
14
|
+
var BotsPlugin = class extends BasePlugin {
|
|
15
|
+
#bots;
|
|
16
|
+
get loaded() {
|
|
17
|
+
return !!this.#bots;
|
|
18
|
+
}
|
|
19
|
+
get bots() {
|
|
20
|
+
return this.#bots?.values() ?? [];
|
|
21
|
+
}
|
|
22
|
+
async load(force) {
|
|
23
|
+
if (!force && this.loaded) return this.state;
|
|
24
|
+
const treasury = this.sdk.addressProvider.getAddress(AP_TREASURY);
|
|
25
|
+
const bcr = this.sdk.addressProvider.getAddress(AP_BYTECODE_REPOSITORY);
|
|
26
|
+
const configs = PARTIAL_LIQUIDATION_BOT_CONFIGS[this.sdk.networkType] ?? [];
|
|
27
|
+
this.#bots = new AddressMap();
|
|
28
|
+
if (!configs.length) return this.state;
|
|
29
|
+
const deployedBots = await this.client.multicall({
|
|
30
|
+
contracts: configs.map((config) => ({
|
|
31
|
+
address: bcr,
|
|
32
|
+
abi: iBytecodeRepositoryAbi,
|
|
33
|
+
functionName: "computeAddress",
|
|
34
|
+
args: [
|
|
35
|
+
stringToHex(BOT_PARTIAL_LIQUIDATION, { size: 32 }),
|
|
36
|
+
310,
|
|
37
|
+
encodeAbiParameters(BOT_PARAMS_ABI, [
|
|
38
|
+
treasury,
|
|
39
|
+
config.minHealthFactor,
|
|
40
|
+
config.maxHealthFactor,
|
|
41
|
+
config.premiumScaleFactor,
|
|
42
|
+
config.feeScaleFactor
|
|
43
|
+
]),
|
|
44
|
+
stringToHex(PARTIAL_LIQUIDATION_BOT_SALT, { size: 32 }),
|
|
45
|
+
PARTIAL_LIQUIDATION_BOT_DEPLOYER
|
|
46
|
+
]
|
|
47
|
+
})),
|
|
48
|
+
allowFailure: true,
|
|
49
|
+
blockNumber: this.sdk.currentBlock,
|
|
50
|
+
batchSize: 0
|
|
51
|
+
});
|
|
52
|
+
const expectedBots = new AddressMap();
|
|
53
|
+
for (let i = 0; i < configs.length; i++) {
|
|
54
|
+
const b = deployedBots[i];
|
|
55
|
+
const { minHealthFactor, maxHealthFactor } = configs[i];
|
|
56
|
+
if (b.status === "success") {
|
|
57
|
+
expectedBots.upsert(b.result, {
|
|
58
|
+
...configs[i],
|
|
59
|
+
treasury
|
|
60
|
+
});
|
|
61
|
+
this.logger?.debug(`expected bot [${minHealthFactor}, ${maxHealthFactor}] at ${b.result}`);
|
|
62
|
+
} else this.logger?.error(`failed compute address for bot [${minHealthFactor}, ${maxHealthFactor}]`, b.error);
|
|
63
|
+
}
|
|
64
|
+
const botAddrs = expectedBots.keys();
|
|
65
|
+
const serializedBots = await this.client.multicall({
|
|
66
|
+
contracts: botAddrs.map((address) => ({
|
|
67
|
+
address,
|
|
68
|
+
abi: iPartialLiquidationBotV310Abi,
|
|
69
|
+
functionName: "serialize"
|
|
70
|
+
})),
|
|
71
|
+
allowFailure: true,
|
|
72
|
+
blockNumber: this.sdk.currentBlock,
|
|
73
|
+
batchSize: 0
|
|
74
|
+
});
|
|
75
|
+
for (let i = 0; i < botAddrs.length; i++) {
|
|
76
|
+
const serialized = serializedBots[i];
|
|
77
|
+
const expected = expectedBots.mustGet(botAddrs[i]);
|
|
78
|
+
if (serialized.status === "success") {
|
|
79
|
+
const bot = new PartialLiquidationBotV310Contract(this.sdk, {
|
|
80
|
+
addr: botAddrs[i],
|
|
81
|
+
version: BigInt(310),
|
|
82
|
+
contractType: BOT_PARTIAL_LIQUIDATION,
|
|
83
|
+
serializedParams: serialized.result
|
|
84
|
+
});
|
|
85
|
+
if (!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);
|
|
86
|
+
else this.#bots.upsert(botAddrs[i], bot);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return this.state;
|
|
90
|
+
}
|
|
91
|
+
stateHuman(raw) {
|
|
92
|
+
return { bots: this.#bots?.values().map((bot) => bot.stateHuman(raw)) ?? [] };
|
|
93
|
+
}
|
|
94
|
+
get state() {
|
|
95
|
+
return { bots: this.#bots?.values().map((bot) => bot.state) ?? [] };
|
|
96
|
+
}
|
|
97
|
+
hydrate(state) {
|
|
98
|
+
this.#bots = new AddressMap();
|
|
99
|
+
for (const botState of state.bots) this.#bots.upsert(botState.addr, new PartialLiquidationBotV310Contract(this.sdk, botState));
|
|
100
|
+
}
|
|
101
|
+
static getMigrationBotData(chainId) {
|
|
102
|
+
return chainId === chains.Mainnet.id ? LEGACY_MIGRATION_BOT : void 0;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
export { BotsPlugin };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { percentFmt } from "../../onchain/utils/formatter.js";
|
|
2
|
+
import { BaseContract } from "../../onchain/base/BaseContract.js";
|
|
3
|
+
import "../../onchain/index.js";
|
|
4
|
+
import { iPartialLiquidationBotV310Abi } from "./abi/iPartialLiquidationBotV310.js";
|
|
5
|
+
import "./abi/index.js";
|
|
6
|
+
import { BOT_PARAMS_ABI } from "./types.js";
|
|
7
|
+
import { decodeAbiParameters, stringToHex } from "viem";
|
|
8
|
+
//#region src/plugins/bots/PartialLiquidationBotV310Contract.ts
|
|
9
|
+
const abi = iPartialLiquidationBotV310Abi;
|
|
10
|
+
var PartialLiquidationBotV310Contract = class extends BaseContract {
|
|
11
|
+
treasury;
|
|
12
|
+
minHealthFactor;
|
|
13
|
+
maxHealthFactor;
|
|
14
|
+
premiumScaleFactor;
|
|
15
|
+
feeScaleFactor;
|
|
16
|
+
#serializedParams;
|
|
17
|
+
constructor(sdk, args) {
|
|
18
|
+
super(sdk, {
|
|
19
|
+
...args,
|
|
20
|
+
abi,
|
|
21
|
+
name: "PartialLiquidationBotV310"
|
|
22
|
+
});
|
|
23
|
+
[this.treasury, this.minHealthFactor, this.maxHealthFactor, this.premiumScaleFactor, this.feeScaleFactor] = decodeAbiParameters(BOT_PARAMS_ABI, args.serializedParams);
|
|
24
|
+
this.#serializedParams = args.serializedParams;
|
|
25
|
+
}
|
|
26
|
+
stateHuman(raw) {
|
|
27
|
+
return {
|
|
28
|
+
...super.stateHuman(raw),
|
|
29
|
+
treasury: this.treasury,
|
|
30
|
+
minHealthFactor: percentFmt(this.minHealthFactor, raw),
|
|
31
|
+
maxHealthFactor: percentFmt(this.maxHealthFactor, raw),
|
|
32
|
+
premiumScaleFactor: percentFmt(this.premiumScaleFactor, raw),
|
|
33
|
+
feeScaleFactor: percentFmt(this.feeScaleFactor, raw)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
get state() {
|
|
37
|
+
return {
|
|
38
|
+
addr: this.address,
|
|
39
|
+
version: BigInt(this.version),
|
|
40
|
+
contractType: stringToHex(this.contractType, { size: 32 }),
|
|
41
|
+
serializedParams: this.#serializedParams
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { PartialLiquidationBotV310Contract };
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
//#region src/plugins/bots/abi/iPartialLiquidationBotV310.ts
|
|
2
|
+
const iPartialLiquidationBotV310Abi = [
|
|
3
|
+
{
|
|
4
|
+
type: "function",
|
|
5
|
+
name: "contractType",
|
|
6
|
+
inputs: [],
|
|
7
|
+
outputs: [{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "bytes32",
|
|
10
|
+
internalType: "bytes32"
|
|
11
|
+
}],
|
|
12
|
+
stateMutability: "view"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "function",
|
|
16
|
+
name: "feeScaleFactor",
|
|
17
|
+
inputs: [],
|
|
18
|
+
outputs: [{
|
|
19
|
+
name: "",
|
|
20
|
+
type: "uint16",
|
|
21
|
+
internalType: "uint16"
|
|
22
|
+
}],
|
|
23
|
+
stateMutability: "view"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "maxHealthFactor",
|
|
28
|
+
inputs: [],
|
|
29
|
+
outputs: [{
|
|
30
|
+
name: "",
|
|
31
|
+
type: "uint16",
|
|
32
|
+
internalType: "uint16"
|
|
33
|
+
}],
|
|
34
|
+
stateMutability: "view"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "function",
|
|
38
|
+
name: "minHealthFactor",
|
|
39
|
+
inputs: [],
|
|
40
|
+
outputs: [{
|
|
41
|
+
name: "",
|
|
42
|
+
type: "uint16",
|
|
43
|
+
internalType: "uint16"
|
|
44
|
+
}],
|
|
45
|
+
stateMutability: "view"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "function",
|
|
49
|
+
name: "partiallyLiquidate",
|
|
50
|
+
inputs: [
|
|
51
|
+
{
|
|
52
|
+
name: "creditAccount",
|
|
53
|
+
type: "address",
|
|
54
|
+
internalType: "address"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "token",
|
|
58
|
+
type: "address",
|
|
59
|
+
internalType: "address"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "repaidAmount",
|
|
63
|
+
type: "uint256",
|
|
64
|
+
internalType: "uint256"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "minSeizedAmount",
|
|
68
|
+
type: "uint256",
|
|
69
|
+
internalType: "uint256"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "to",
|
|
73
|
+
type: "address",
|
|
74
|
+
internalType: "address"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "priceUpdates",
|
|
78
|
+
type: "tuple[]",
|
|
79
|
+
internalType: "struct PriceUpdate[]",
|
|
80
|
+
components: [{
|
|
81
|
+
name: "priceFeed",
|
|
82
|
+
type: "address",
|
|
83
|
+
internalType: "address"
|
|
84
|
+
}, {
|
|
85
|
+
name: "data",
|
|
86
|
+
type: "bytes",
|
|
87
|
+
internalType: "bytes"
|
|
88
|
+
}]
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
outputs: [{
|
|
92
|
+
name: "seizedAmount",
|
|
93
|
+
type: "uint256",
|
|
94
|
+
internalType: "uint256"
|
|
95
|
+
}],
|
|
96
|
+
stateMutability: "nonpayable"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: "function",
|
|
100
|
+
name: "premiumScaleFactor",
|
|
101
|
+
inputs: [],
|
|
102
|
+
outputs: [{
|
|
103
|
+
name: "",
|
|
104
|
+
type: "uint16",
|
|
105
|
+
internalType: "uint16"
|
|
106
|
+
}],
|
|
107
|
+
stateMutability: "view"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: "function",
|
|
111
|
+
name: "requiredPermissions",
|
|
112
|
+
inputs: [],
|
|
113
|
+
outputs: [{
|
|
114
|
+
name: "",
|
|
115
|
+
type: "uint192",
|
|
116
|
+
internalType: "uint192"
|
|
117
|
+
}],
|
|
118
|
+
stateMutability: "view"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: "function",
|
|
122
|
+
name: "serialize",
|
|
123
|
+
inputs: [],
|
|
124
|
+
outputs: [{
|
|
125
|
+
name: "serializedData",
|
|
126
|
+
type: "bytes",
|
|
127
|
+
internalType: "bytes"
|
|
128
|
+
}],
|
|
129
|
+
stateMutability: "view"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: "function",
|
|
133
|
+
name: "treasury",
|
|
134
|
+
inputs: [],
|
|
135
|
+
outputs: [{
|
|
136
|
+
name: "",
|
|
137
|
+
type: "address",
|
|
138
|
+
internalType: "address"
|
|
139
|
+
}],
|
|
140
|
+
stateMutability: "view"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "function",
|
|
144
|
+
name: "version",
|
|
145
|
+
inputs: [],
|
|
146
|
+
outputs: [{
|
|
147
|
+
name: "",
|
|
148
|
+
type: "uint256",
|
|
149
|
+
internalType: "uint256"
|
|
150
|
+
}],
|
|
151
|
+
stateMutability: "view"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: "event",
|
|
155
|
+
name: "PartiallyLiquidate",
|
|
156
|
+
inputs: [
|
|
157
|
+
{
|
|
158
|
+
name: "creditManager",
|
|
159
|
+
type: "address",
|
|
160
|
+
indexed: true,
|
|
161
|
+
internalType: "address"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "creditAccount",
|
|
165
|
+
type: "address",
|
|
166
|
+
indexed: true,
|
|
167
|
+
internalType: "address"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "token",
|
|
171
|
+
type: "address",
|
|
172
|
+
indexed: true,
|
|
173
|
+
internalType: "address"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "liquidator",
|
|
177
|
+
type: "address",
|
|
178
|
+
indexed: false,
|
|
179
|
+
internalType: "address"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "repaidDebt",
|
|
183
|
+
type: "uint256",
|
|
184
|
+
indexed: false,
|
|
185
|
+
internalType: "uint256"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "seizedCollateral",
|
|
189
|
+
type: "uint256",
|
|
190
|
+
indexed: false,
|
|
191
|
+
internalType: "uint256"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: "fee",
|
|
195
|
+
type: "uint256",
|
|
196
|
+
indexed: false,
|
|
197
|
+
internalType: "uint256"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
anonymous: false
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
type: "error",
|
|
204
|
+
name: "LiquidatedLessThanNeededException",
|
|
205
|
+
inputs: []
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
type: "error",
|
|
209
|
+
name: "LiquidatedMoreThanNeededException",
|
|
210
|
+
inputs: []
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: "error",
|
|
214
|
+
name: "SeizedLessThanRequiredException",
|
|
215
|
+
inputs: []
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
type: "error",
|
|
219
|
+
name: "UnderlyingNotLiquidatableException",
|
|
220
|
+
inputs: []
|
|
221
|
+
}
|
|
222
|
+
];
|
|
223
|
+
//#endregion
|
|
224
|
+
export { iPartialLiquidationBotV310Abi };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../../onchain/constants/bot-permissions.js";
|
|
2
|
+
import "../../onchain/index.js";
|
|
3
|
+
//#region src/plugins/bots/config.ts
|
|
4
|
+
const PARTIAL_LIQUIDATION_BOT_CONFIGS = {
|
|
5
|
+
Mainnet: [{
|
|
6
|
+
minHealthFactor: 10300,
|
|
7
|
+
maxHealthFactor: 10700,
|
|
8
|
+
premiumScaleFactor: 1e4,
|
|
9
|
+
feeScaleFactor: 1e4
|
|
10
|
+
}],
|
|
11
|
+
Monad: [{
|
|
12
|
+
minHealthFactor: 10300,
|
|
13
|
+
maxHealthFactor: 10700,
|
|
14
|
+
premiumScaleFactor: 1e4,
|
|
15
|
+
feeScaleFactor: 1e4
|
|
16
|
+
}],
|
|
17
|
+
Plasma: [{
|
|
18
|
+
minHealthFactor: 10300,
|
|
19
|
+
maxHealthFactor: 10700,
|
|
20
|
+
premiumScaleFactor: 1e4,
|
|
21
|
+
feeScaleFactor: 1e4
|
|
22
|
+
}]
|
|
23
|
+
};
|
|
24
|
+
const PARTIAL_LIQUIDATION_BOT_SALT = "GEARBOX";
|
|
25
|
+
const PARTIAL_LIQUIDATION_BOT_DEPLOYER = "0xc93155E0a835Cf4E17a19463Fa67ed43c164d06a";
|
|
26
|
+
const LEGACY_MIGRATION_BOT = {
|
|
27
|
+
address: "0x286Fe53994f5668D56538Aa10eaa3Ac36f878e9C".toLowerCase(),
|
|
28
|
+
previewer: "0x6523B8c9daB92eea7944a79b4Dbb598c7934DCca".toLowerCase(),
|
|
29
|
+
version: 310,
|
|
30
|
+
baseType: "LEGACY_MIGRATION"
|
|
31
|
+
};
|
|
32
|
+
const PERMISSION_BY_TYPE = { LEGACY_MIGRATION: BigInt(65604) };
|
|
33
|
+
//#endregion
|
|
34
|
+
export { LEGACY_MIGRATION_BOT, PARTIAL_LIQUIDATION_BOT_CONFIGS, PARTIAL_LIQUIDATION_BOT_DEPLOYER, PARTIAL_LIQUIDATION_BOT_SALT, PERMISSION_BY_TYPE };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { decodeAbiParameters } from "viem";
|
|
2
|
+
//#region src/plugins/bots/deserializePartialLiquidationBotParams.ts
|
|
3
|
+
function deserializePartialLiquidationBotParams(params) {
|
|
4
|
+
const [treasury, minHealthFactor, maxHealthFactor, premiumScaleFactor, feeScaleFactor] = decodeAbiParameters([
|
|
5
|
+
{
|
|
6
|
+
name: "treasury",
|
|
7
|
+
type: "address"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: "minHealthFactor",
|
|
11
|
+
type: "uint16"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "maxHealthFactor",
|
|
15
|
+
type: "uint16"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "premiumScaleFactor",
|
|
19
|
+
type: "uint16"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "feeScaleFactor",
|
|
23
|
+
type: "uint16"
|
|
24
|
+
}
|
|
25
|
+
], params.serializedParams);
|
|
26
|
+
return {
|
|
27
|
+
treasury,
|
|
28
|
+
minHealthFactor,
|
|
29
|
+
maxHealthFactor,
|
|
30
|
+
premiumScaleFactor,
|
|
31
|
+
feeScaleFactor
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { deserializePartialLiquidationBotParams as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { iPartialLiquidationBotV310Abi } from "./abi/iPartialLiquidationBotV310.js";
|
|
2
|
+
import { LEGACY_MIGRATION_BOT, PARTIAL_LIQUIDATION_BOT_CONFIGS, PARTIAL_LIQUIDATION_BOT_DEPLOYER, PARTIAL_LIQUIDATION_BOT_SALT, PERMISSION_BY_TYPE } from "./config.js";
|
|
3
|
+
import "./abi/index.js";
|
|
4
|
+
import { BOT_PARAMS_ABI, BOT_PARTIAL_LIQUIDATION } from "./types.js";
|
|
5
|
+
import { PartialLiquidationBotV310Contract } from "./PartialLiquidationBotV310Contract.js";
|
|
6
|
+
import { BotsPlugin } from "./BotsPlugin.js";
|
|
7
|
+
export { BOT_PARAMS_ABI, BOT_PARTIAL_LIQUIDATION, BotsPlugin, LEGACY_MIGRATION_BOT, PARTIAL_LIQUIDATION_BOT_CONFIGS, PARTIAL_LIQUIDATION_BOT_DEPLOYER, PARTIAL_LIQUIDATION_BOT_SALT, PERMISSION_BY_TYPE, PartialLiquidationBotV310Contract, iPartialLiquidationBotV310Abi };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "module","sideEffects":false}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/plugins/bots/types.ts
|
|
2
|
+
const BOT_PARTIAL_LIQUIDATION = "BOT::PARTIAL_LIQUIDATION";
|
|
3
|
+
const BOT_PARAMS_ABI = [
|
|
4
|
+
{
|
|
5
|
+
type: "address",
|
|
6
|
+
name: "treasury"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
type: "uint16",
|
|
10
|
+
name: "minHealthFactor"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: "uint16",
|
|
14
|
+
name: "maxHealthFactor"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "uint16",
|
|
18
|
+
name: "premiumScaleFactor"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: "uint16",
|
|
22
|
+
name: "feeScaleFactor"
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { BOT_PARAMS_ABI, BOT_PARTIAL_LIQUIDATION };
|
|
@@ -258,12 +258,13 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
258
258
|
/**
|
|
259
259
|
* {@inheritDoc IOpportunitiesPrepare.maxWithdraw}
|
|
260
260
|
**/
|
|
261
|
-
async maxWithdraw(position) {
|
|
261
|
+
async maxWithdraw(position, sourceToken) {
|
|
262
262
|
const sdk = await this.#chain(position.chainId);
|
|
263
263
|
const creditAccount = await this.#account(sdk, position);
|
|
264
264
|
return service(sdk).maxWithdraw({
|
|
265
265
|
creditAccount,
|
|
266
|
-
sdk
|
|
266
|
+
sdk,
|
|
267
|
+
sourceToken
|
|
267
268
|
});
|
|
268
269
|
}
|
|
269
270
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IGearboxError } from "./base.js";
|
|
2
2
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./liquidation-errors.js";
|
|
3
|
-
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
3
|
+
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./operation-errors.js";
|
|
4
4
|
import { UnpriceableTokenError, unpriceableTokenError } from "./oracle-errors.js";
|
|
5
5
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
|
|
6
6
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./preview-errors.js";
|
|
7
|
-
export { BorrowLimitCause, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
7
|
+
export { BorrowLimitCause, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
|
|
@@ -126,6 +126,46 @@ interface InsufficientCollateralError extends IGearboxError {
|
|
|
126
126
|
}
|
|
127
127
|
/** {@inheritDoc InsufficientCollateralError} */
|
|
128
128
|
declare function insufficientCollateral(args: Omit<InsufficientCollateralError, "code" | "message">): InsufficientCollateralError;
|
|
129
|
+
/**
|
|
130
|
+
* The same failure as {@link InsufficientCollateralError}, traced to the
|
|
131
|
+
* reserve price feed rather than to the size of the position.
|
|
132
|
+
*
|
|
133
|
+
* A call that hands funds over is weighed at safe prices — `min` of a token's
|
|
134
|
+
* two feeds, and nothing at all for collateral governance registered no
|
|
135
|
+
* reserve feed for — so an account that covers its debt at the main feed can
|
|
136
|
+
* still be refused. Worth its own code because the two call for opposite
|
|
137
|
+
* words: an under-collateralised position is fixed by adding collateral or
|
|
138
|
+
* requesting less, while this is a valuation the account does not control, and
|
|
139
|
+
* requesting less only helps as far as {@link withdrawable} says it does.
|
|
140
|
+
**/
|
|
141
|
+
interface ReservePriceLimitedError extends IGearboxError {
|
|
142
|
+
code: "reservePriceLimited";
|
|
143
|
+
/** The safe-price factor the operation would have ended at. */
|
|
144
|
+
healthFactor: Bps;
|
|
145
|
+
/**
|
|
146
|
+
* The same account at the main feed. Above {@link healthFactorThreshold} by
|
|
147
|
+
* definition — that is what makes the reserve feed the thing in the way, and
|
|
148
|
+
* the gap between the two is how far it marks the collateral down.
|
|
149
|
+
**/
|
|
150
|
+
atMainPrices: Bps;
|
|
151
|
+
/** The threshold both were weighed against, the facade's own `1.0`. */
|
|
152
|
+
healthFactorThreshold: Bps;
|
|
153
|
+
/**
|
|
154
|
+
* What the account can still take out under the same check, in the market's
|
|
155
|
+
* underlying — the request to offer instead of the refused one. It is the
|
|
156
|
+
* `safePartial` of `WithdrawCeilings`, from the same code that answers
|
|
157
|
+
* `maxWithdraw`, so the two never disagree.
|
|
158
|
+
*
|
|
159
|
+
* `0n` says no partial withdrawal clears the threshold at all, and a smaller
|
|
160
|
+
* request will not help: holding leverage flat scales collateral and debt
|
|
161
|
+
* together, which leaves the safe-price factor exactly where it found it.
|
|
162
|
+
* Such a position can still leave entirely — an exit settles the debt rather
|
|
163
|
+
* than shrinking it, and a check with no debt to divide by refuses nothing.
|
|
164
|
+
**/
|
|
165
|
+
withdrawable: TokenAmount;
|
|
166
|
+
}
|
|
167
|
+
/** {@inheritDoc ReservePriceLimitedError} */
|
|
168
|
+
declare function reservePriceLimited(args: Omit<ReservePriceLimitedError, "code" | "message">): ReservePriceLimitedError;
|
|
129
169
|
/**
|
|
130
170
|
* The operation would increase the balance of a token the market forbids.
|
|
131
171
|
**/
|
|
@@ -219,4 +259,4 @@ interface RWAOpenRequirementsError extends IGearboxError {
|
|
|
219
259
|
/** {@inheritDoc RWAOpenRequirementsError} */
|
|
220
260
|
declare function rwaOpenRequirementsNotMet(args: Omit<RWAOpenRequirementsError, "code" | "message">): RWAOpenRequirementsError;
|
|
221
261
|
//#endregion
|
|
222
|
-
export { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet };
|
|
262
|
+
export { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet };
|
|
@@ -6,7 +6,7 @@ import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseL
|
|
|
6
6
|
import { IGearboxError } from "./errors/base.js";
|
|
7
7
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator } from "./errors/liquidation-errors.js";
|
|
8
8
|
import { KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, MidasOpenAccountRequirements, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./rwa.js";
|
|
9
|
-
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
9
|
+
import { BorrowLimitCause, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, PoolPausedError, PoolSunsetError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError, ReservePriceLimitedError, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaCountExceeded, quotaLimitReached, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
|
|
10
10
|
import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-errors.js";
|
|
11
11
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
12
12
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./errors/preview-errors.js";
|
|
@@ -33,4 +33,4 @@ import { SDKError, SDKResult, SDKReturn, SafeValue, safeValue, sdkErr, sdkOk } f
|
|
|
33
33
|
import { kycRequirementSchema, rwaProtocolSchema } from "./rwa.schema.js";
|
|
34
34
|
import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
|
|
35
35
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
36
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, Notice, NoticeKind, NoticeSubject, OpenNonRWAStrategyPositionPreview, OpenRWAStrategyPositionPreview, OpenStrategyPositionPreview, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAsset, QuotaCountExceededError, QuotaLimitReachedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ResponseMetadata, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
36
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, Notice, NoticeKind, NoticeSubject, OpenNonRWAStrategyPositionPreview, OpenRWAStrategyPositionPreview, OpenStrategyPositionPreview, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAsset, QuotaCountExceededError, QuotaLimitReachedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ReservePriceLimitedError, ResponseMetadata, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAssetSchema, quotaCountExceeded, quotaLimitReached, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|