@gearbox-protocol/sdk 16.3.0-next.5 → 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/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/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/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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ierc20Abi } from "../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
2
|
+
import { ierc20Abi } from "../abi/iERC20.js";
|
|
3
3
|
import { AddressMap } from "../onchain/utils/AddressMap.js";
|
|
4
4
|
import { AddressSet } from "../onchain/utils/AddressSet.js";
|
|
5
5
|
import { AssetsMap } from "../onchain/utils/AssetsMap.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { getNetworkType } from "../onchain/chain/chains.js";
|
|
3
2
|
import { getWithdrawalCompressorAddress } from "../onchain/accounts/withdrawal-compressor/addresses.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import "../onchain/index.js";
|
|
5
5
|
import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
|
|
6
6
|
import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
2
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
3
3
|
import { AddressMap } from "../../onchain/utils/AddressMap.js";
|
|
4
4
|
import "../../onchain/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
-
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
3
1
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
4
2
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
5
3
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
@@ -10,6 +8,8 @@ import "../base/index.js";
|
|
|
10
8
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
11
9
|
import "./bots/index.js";
|
|
12
10
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
11
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
13
13
|
import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
|
|
14
14
|
import "../market/index.js";
|
|
15
15
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
2
1
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
3
2
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
4
3
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -20,6 +19,7 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
|
|
|
20
19
|
import "../../market/rwa/securitize/index.js";
|
|
21
20
|
import "../../market/index.js";
|
|
22
21
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
22
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
23
23
|
import { skipLiquidatableAccount } from "./skipLiquidatableAccount.js";
|
|
24
24
|
//#region src/onchain/accounts/liquidations/LiquidationsService.ts
|
|
25
25
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
4
3
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
5
4
|
import "../../../model/index.js";
|
|
6
5
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
6
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
7
7
|
//#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
8
8
|
const abi = iRedemptionLoggerV310Abi;
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
3
3
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV311Abi;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
3
2
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import { toWithdrawalStatus } from "./types.js";
|
|
5
5
|
//#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
|
|
6
6
|
const abi = iWithdrawalCompressorV313Abi;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
2
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
3
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
4
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
5
2
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
6
3
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
7
4
|
import { getAssetType } from "../chain/chains.js";
|
|
8
5
|
import { formatBN } from "../utils/formatter.js";
|
|
9
6
|
import "../utils/index.js";
|
|
7
|
+
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
8
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
9
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
10
10
|
import { SdkRWADataNotLoadedError } from "../core/errors.js";
|
|
11
11
|
import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
|
|
12
12
|
//#region src/onchain/base/TokensMeta.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
2
1
|
import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
|
|
3
2
|
import { isV310 } from "../constants/versions.js";
|
|
4
3
|
import "../constants/index.js";
|
|
5
4
|
import { hexEq } from "../utils/hex.js";
|
|
5
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
6
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
7
7
|
//#region src/onchain/core/createAddressProvider.ts
|
|
8
8
|
const OVERRIDE_ADDRESSES = { Mainnet: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
1
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
|
+
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
3
3
|
//#region src/onchain/market/adapters/contracts/AccountMigratorAdapterContract.ts
|
|
4
4
|
const abi = accountMigratorAbi;
|
|
5
5
|
const protocolAbi = accountMigratorAbi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
2
1
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
3
2
|
import "../../../base/index.js";
|
|
3
|
+
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
4
4
|
import { iERC4626Abi } from "../abi/targetContractAbi.js";
|
|
5
5
|
import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
|
|
6
6
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
3
|
import "../../base/index.js";
|
|
4
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
4
3
|
import { RAY } from "../../constants/math.js";
|
|
@@ -8,6 +7,7 @@ import "../../utils/index.js";
|
|
|
8
7
|
import { SdkRWADataNotLoadedError } from "../../core/errors.js";
|
|
9
8
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
10
9
|
import "../../base/index.js";
|
|
10
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
11
11
|
//#region src/onchain/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
13
13
|
var PoolV310Contract = class extends BaseContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iVersionAbi } from "../../../abi/iVersion.js";
|
|
2
1
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
3
2
|
import "../../utils/index.js";
|
|
3
|
+
import { iVersionAbi } from "../../../abi/iVersion.js";
|
|
4
4
|
import { iMidasDegenNFTAbi } from "../../../abi/rwa/iMidasDegenNFT.js";
|
|
5
5
|
import { DEGEN_NFT_MIDAS } from "./midas/constants.js";
|
|
6
6
|
import { MidasDegenNFT } from "./midas/MidasDegenNFT.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
1
|
import { ZapperContract } from "./ZapperContract.js";
|
|
2
|
+
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
3
3
|
//#region src/onchain/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
4
3
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
5
4
|
import "../../../model/index.js";
|
|
5
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
6
6
|
//#region src/onchain/market/zapper/ZapperContract.ts
|
|
7
7
|
/**
|
|
8
8
|
* Base contract for every Gearbox zapper. Specialized zappers (e.g.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../../abi/iERC20.js";
|
|
2
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
3
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
2
|
+
import { ierc20Abi } from "../../../abi/iERC20.js";
|
|
4
3
|
import { sdkErr, sdkOk } from "../../../model/result.js";
|
|
5
4
|
import "../../../model/index.js";
|
|
5
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
6
6
|
//#region src/onchain/preview/preview/previewPoolPositionOperation.ts
|
|
7
7
|
function previewRead(operation) {
|
|
8
8
|
switch (operation.operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
2
|
import { generateCastTraceCall } from "./cast.js";
|
|
3
|
+
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
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;
|