@morpho-org/morpho-sdk 2.0.0 → 3.0.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/lib/cjs/abis.d.ts +2816 -0
- package/lib/cjs/abis.js +1951 -0
- package/lib/cjs/actions/index.d.ts +3 -0
- package/lib/cjs/actions/marketV1/borrow.js +7 -10
- package/lib/cjs/actions/marketV1/buildReallocationActions.d.ts +2 -3
- package/lib/cjs/actions/marketV1/buildReallocationActions.js +1 -2
- package/lib/cjs/actions/marketV1/repay.d.ts +2 -0
- package/lib/cjs/actions/marketV1/repay.js +7 -8
- package/lib/cjs/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
- package/lib/cjs/actions/marketV1/repayWithdrawCollateral.js +9 -10
- package/lib/cjs/actions/marketV1/supplyCollateral.d.ts +2 -0
- package/lib/cjs/actions/marketV1/supplyCollateral.js +11 -12
- package/lib/cjs/actions/marketV1/supplyCollateralBorrow.d.ts +2 -0
- package/lib/cjs/actions/marketV1/supplyCollateralBorrow.js +13 -14
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +2 -2
- package/lib/cjs/actions/requirements/getRequirementsAction.d.ts +28 -4
- package/lib/cjs/actions/requirements/getRequirementsAction.js +28 -4
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -2
- package/lib/cjs/actions/requirements/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/index.js +1 -0
- package/lib/cjs/actions/vaultV1/deposit.d.ts +2 -0
- package/lib/cjs/actions/vaultV1/deposit.js +13 -14
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +2 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.js +11 -9
- package/lib/cjs/actions/vaultV2/deposit.d.ts +2 -0
- package/lib/cjs/actions/vaultV2/deposit.js +13 -14
- package/lib/cjs/addresses.d.ts +2 -0
- package/lib/cjs/addresses.js +18 -0
- package/lib/cjs/augment/AccrualPosition.d.ts +9 -0
- package/lib/cjs/augment/AccrualPosition.js +8 -0
- package/lib/cjs/augment/AccrualVault.d.ts +8 -0
- package/lib/cjs/augment/AccrualVault.js +7 -0
- package/lib/cjs/augment/Holding.d.ts +8 -0
- package/lib/cjs/augment/Holding.js +7 -0
- package/lib/cjs/augment/Market.d.ts +8 -0
- package/lib/cjs/augment/Market.js +7 -0
- package/lib/cjs/augment/MarketParams.d.ts +8 -0
- package/lib/cjs/augment/MarketParams.js +7 -0
- package/lib/cjs/augment/Position.d.ts +8 -0
- package/lib/cjs/augment/Position.js +7 -0
- package/lib/cjs/augment/Token.d.ts +8 -0
- package/lib/cjs/augment/Token.js +7 -0
- package/lib/cjs/augment/User.d.ts +8 -0
- package/lib/cjs/augment/User.js +7 -0
- package/lib/cjs/augment/Vault.d.ts +8 -0
- package/lib/cjs/augment/Vault.js +7 -0
- package/lib/cjs/augment/VaultConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultConfig.js +7 -0
- package/lib/cjs/augment/VaultMarketAllocation.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketAllocation.js +7 -0
- package/lib/cjs/augment/VaultMarketConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketConfig.js +7 -0
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +8 -0
- package/lib/cjs/augment/VaultUser.d.ts +8 -0
- package/lib/cjs/augment/VaultUser.js +7 -0
- package/lib/cjs/augment.d.ts +14 -0
- package/lib/cjs/augment.js +16 -0
- package/lib/cjs/bundler/actions.d.ts +555 -0
- package/lib/cjs/bundler/actions.js +953 -0
- package/lib/cjs/bundler/index.d.ts +2 -0
- package/lib/cjs/bundler/index.js +18 -0
- package/lib/cjs/bundler/types.d.ts +181 -0
- package/lib/cjs/bundler/types.js +2 -0
- package/lib/cjs/constants.d.ts +3 -0
- package/lib/cjs/constants.js +32 -0
- package/lib/cjs/entities/index.d.ts +6 -3
- package/lib/cjs/entities/index.js +41 -17
- package/lib/cjs/entities/marketV1/marketV1.d.ts +45 -11
- package/lib/cjs/entities/marketV1/marketV1.js +45 -23
- package/lib/cjs/entities/reallocationData.d.ts +193 -0
- package/lib/cjs/entities/reallocationData.js +406 -0
- package/lib/cjs/entities/vaultV1/vaultV1.js +6 -2
- package/lib/cjs/entities/vaultV2/vaultV2.js +6 -1
- package/lib/cjs/errors.d.ts +2 -0
- package/lib/cjs/errors.js +18 -0
- package/lib/cjs/fetch.d.ts +1 -0
- package/lib/cjs/fetch.js +30 -0
- package/lib/cjs/format.d.ts +2 -0
- package/lib/cjs/format.js +22 -0
- package/lib/cjs/helpers/computeReallocations.d.ts +48 -8
- package/lib/cjs/helpers/computeReallocations.js +120 -32
- package/lib/cjs/helpers/constant.d.ts +17 -0
- package/lib/cjs/helpers/constant.js +30 -1
- package/lib/cjs/helpers/index.d.ts +1 -0
- package/lib/cjs/helpers/index.js +9 -1
- package/lib/cjs/helpers/metadata.d.ts +10 -0
- package/lib/cjs/helpers/metadata.js +20 -1
- package/lib/cjs/helpers/validate.d.ts +2 -0
- package/lib/cjs/helpers/validate.js +14 -2
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/types/client.d.ts +1 -1
- package/lib/cjs/types/error.d.ts +91 -1
- package/lib/cjs/types/error.js +126 -1
- package/lib/cjs/types/sharedLiquidity.d.ts +43 -3
- package/lib/cjs/types.d.ts +3 -0
- package/lib/cjs/types.js +17 -0
- package/lib/cjs/utils.d.ts +9 -0
- package/lib/cjs/utils.js +65 -0
- package/lib/esm/abis.d.ts +2816 -0
- package/lib/esm/abis.js +1922 -0
- package/lib/esm/actions/index.d.ts +3 -0
- package/lib/esm/actions/marketV1/borrow.js +2 -5
- package/lib/esm/actions/marketV1/buildReallocationActions.d.ts +2 -3
- package/lib/esm/actions/marketV1/buildReallocationActions.js +1 -2
- package/lib/esm/actions/marketV1/repay.d.ts +2 -0
- package/lib/esm/actions/marketV1/repay.js +4 -5
- package/lib/esm/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
- package/lib/esm/actions/marketV1/repayWithdrawCollateral.js +4 -5
- package/lib/esm/actions/marketV1/supplyCollateral.d.ts +2 -0
- package/lib/esm/actions/marketV1/supplyCollateral.js +4 -5
- package/lib/esm/actions/marketV1/supplyCollateralBorrow.d.ts +2 -0
- package/lib/esm/actions/marketV1/supplyCollateralBorrow.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +1 -1
- package/lib/esm/actions/requirements/getRequirementsAction.d.ts +28 -4
- package/lib/esm/actions/requirements/getRequirementsAction.js +29 -5
- package/lib/esm/actions/requirements/getRequirementsApproval.js +1 -1
- package/lib/esm/actions/requirements/index.d.ts +1 -0
- package/lib/esm/actions/requirements/index.js +1 -0
- package/lib/esm/actions/vaultV1/deposit.d.ts +2 -0
- package/lib/esm/actions/vaultV1/deposit.js +3 -4
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +2 -0
- package/lib/esm/actions/vaultV1/migrateToV2.js +3 -1
- package/lib/esm/actions/vaultV2/deposit.d.ts +2 -0
- package/lib/esm/actions/vaultV2/deposit.js +3 -4
- package/lib/esm/addresses.d.ts +2 -0
- package/lib/esm/addresses.js +1 -0
- package/lib/esm/augment/AccrualPosition.d.ts +9 -0
- package/lib/esm/augment/AccrualPosition.js +5 -0
- package/lib/esm/augment/AccrualVault.d.ts +8 -0
- package/lib/esm/augment/AccrualVault.js +4 -0
- package/lib/esm/augment/Holding.d.ts +8 -0
- package/lib/esm/augment/Holding.js +4 -0
- package/lib/esm/augment/Market.d.ts +8 -0
- package/lib/esm/augment/Market.js +4 -0
- package/lib/esm/augment/MarketParams.d.ts +8 -0
- package/lib/esm/augment/MarketParams.js +4 -0
- package/lib/esm/augment/Position.d.ts +8 -0
- package/lib/esm/augment/Position.js +4 -0
- package/lib/esm/augment/Token.d.ts +8 -0
- package/lib/esm/augment/Token.js +4 -0
- package/lib/esm/augment/User.d.ts +8 -0
- package/lib/esm/augment/User.js +4 -0
- package/lib/esm/augment/Vault.d.ts +8 -0
- package/lib/esm/augment/Vault.js +4 -0
- package/lib/esm/augment/VaultConfig.d.ts +8 -0
- package/lib/esm/augment/VaultConfig.js +4 -0
- package/lib/esm/augment/VaultMarketAllocation.d.ts +8 -0
- package/lib/esm/augment/VaultMarketAllocation.js +4 -0
- package/lib/esm/augment/VaultMarketConfig.d.ts +8 -0
- package/lib/esm/augment/VaultMarketConfig.js +4 -0
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +5 -0
- package/lib/esm/augment/VaultUser.d.ts +8 -0
- package/lib/esm/augment/VaultUser.js +4 -0
- package/lib/esm/augment.d.ts +14 -0
- package/lib/esm/augment.js +14 -0
- package/lib/esm/bundler/actions.d.ts +555 -0
- package/lib/esm/bundler/actions.js +950 -0
- package/lib/esm/bundler/index.d.ts +2 -0
- package/lib/esm/bundler/index.js +2 -0
- package/lib/esm/bundler/types.d.ts +181 -0
- package/lib/esm/bundler/types.js +1 -0
- package/lib/esm/constants.d.ts +3 -0
- package/lib/esm/constants.js +3 -0
- package/lib/esm/entities/index.d.ts +6 -3
- package/lib/esm/entities/index.js +5 -3
- package/lib/esm/entities/marketV1/marketV1.d.ts +45 -11
- package/lib/esm/entities/marketV1/marketV1.js +46 -24
- package/lib/esm/entities/reallocationData.d.ts +193 -0
- package/lib/esm/entities/reallocationData.js +402 -0
- package/lib/esm/entities/vaultV1/vaultV1.js +6 -2
- package/lib/esm/entities/vaultV2/vaultV2.js +6 -1
- package/lib/esm/errors.d.ts +2 -0
- package/lib/esm/errors.js +1 -0
- package/lib/esm/fetch.d.ts +1 -0
- package/lib/esm/fetch.js +1 -0
- package/lib/esm/format.d.ts +2 -0
- package/lib/esm/format.js +1 -0
- package/lib/esm/helpers/computeReallocations.d.ts +48 -8
- package/lib/esm/helpers/computeReallocations.js +119 -31
- package/lib/esm/helpers/constant.d.ts +17 -0
- package/lib/esm/helpers/constant.js +30 -1
- package/lib/esm/helpers/index.d.ts +1 -0
- package/lib/esm/helpers/index.js +1 -0
- package/lib/esm/helpers/metadata.d.ts +10 -0
- package/lib/esm/helpers/metadata.js +20 -1
- package/lib/esm/helpers/validate.d.ts +2 -0
- package/lib/esm/helpers/validate.js +12 -1
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/types/client.d.ts +1 -1
- package/lib/esm/types/error.d.ts +91 -1
- package/lib/esm/types/error.js +118 -0
- package/lib/esm/types/sharedLiquidity.d.ts +43 -3
- package/lib/esm/types.d.ts +3 -0
- package/lib/esm/types.js +1 -0
- package/lib/esm/utils.d.ts +9 -0
- package/lib/esm/utils.js +7 -0
- package/package.json +121 -14
- package/src/index.ts +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VaultConfig as BlueVaultConfig } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultConfig } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace VaultConfig {
|
|
5
|
+
let fetch: typeof fetchVaultConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueVaultConfig as VaultConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VaultMarketAllocation as BlueVaultMarketAllocation } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultMarketAllocation } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace VaultMarketAllocation {
|
|
5
|
+
let fetch: typeof fetchVaultMarketAllocation;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueVaultMarketAllocation as VaultMarketAllocation };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VaultMarketAllocation as BlueVaultMarketAllocation } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultMarketAllocation } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
BlueVaultMarketAllocation.fetch = fetchVaultMarketAllocation;
|
|
4
|
+
export { BlueVaultMarketAllocation as VaultMarketAllocation };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VaultMarketConfig as BlueVaultMarketConfig } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultMarketConfig } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace VaultMarketConfig {
|
|
5
|
+
let fetch: typeof fetchVaultMarketConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueVaultMarketConfig as VaultMarketConfig };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VaultMarketPublicAllocatorConfig as BlueVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace VaultMarketPublicAllocatorConfig {
|
|
5
|
+
let fetch: typeof fetchVaultMarketPublicAllocatorConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { VaultMarketPublicAllocatorConfig as BlueVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
BlueVaultMarketPublicAllocatorConfig.fetch =
|
|
4
|
+
fetchVaultMarketPublicAllocatorConfig;
|
|
5
|
+
export { BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VaultUser as BlueVaultUser } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchVaultUser } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace VaultUser {
|
|
5
|
+
let fetch: typeof fetchVaultUser;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueVaultUser as VaultUser };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./augment/AccrualPosition.js";
|
|
2
|
+
import "./augment/AccrualVault.js";
|
|
3
|
+
import "./augment/Holding.js";
|
|
4
|
+
import "./augment/Market.js";
|
|
5
|
+
import "./augment/MarketParams.js";
|
|
6
|
+
import "./augment/Position.js";
|
|
7
|
+
import "./augment/Token.js";
|
|
8
|
+
import "./augment/User.js";
|
|
9
|
+
import "./augment/Vault.js";
|
|
10
|
+
import "./augment/VaultConfig.js";
|
|
11
|
+
import "./augment/VaultMarketAllocation.js";
|
|
12
|
+
import "./augment/VaultMarketConfig.js";
|
|
13
|
+
import "./augment/VaultMarketPublicAllocatorConfig.js";
|
|
14
|
+
import "./augment/VaultUser.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./augment/AccrualPosition.js";
|
|
2
|
+
import "./augment/AccrualVault.js";
|
|
3
|
+
import "./augment/Holding.js";
|
|
4
|
+
import "./augment/Market.js";
|
|
5
|
+
import "./augment/MarketParams.js";
|
|
6
|
+
import "./augment/Position.js";
|
|
7
|
+
import "./augment/Token.js";
|
|
8
|
+
import "./augment/User.js";
|
|
9
|
+
import "./augment/Vault.js";
|
|
10
|
+
import "./augment/VaultConfig.js";
|
|
11
|
+
import "./augment/VaultMarketAllocation.js";
|
|
12
|
+
import "./augment/VaultMarketConfig.js";
|
|
13
|
+
import "./augment/VaultMarketPublicAllocatorConfig.js";
|
|
14
|
+
import "./augment/VaultUser.js";
|
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import { type InputMarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { type Address, type Hex } from "viem";
|
|
3
|
+
import type { Action, InputReallocation, Permit2PermitSingle } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Encoded low-level call consumed by Bundler3's `multicall`.
|
|
6
|
+
*/
|
|
7
|
+
export interface BundlerCall {
|
|
8
|
+
/** Contract or account called by Bundler3. */
|
|
9
|
+
readonly to: Address;
|
|
10
|
+
/** ABI-encoded calldata sent to `to`. */
|
|
11
|
+
readonly data: Hex;
|
|
12
|
+
/** Native-token value sent with the call. */
|
|
13
|
+
readonly value: bigint;
|
|
14
|
+
/** Whether Bundler3 should continue when the call reverts. */
|
|
15
|
+
readonly skipRevert: boolean;
|
|
16
|
+
/** Expected callback hash for calls that reenter Bundler3, or zero hash. */
|
|
17
|
+
readonly callbackHash: Hex;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Encodes the Bundler3 action subset used by `morpho-sdk` transaction builders.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* The namespace covers only the Bundler3 actions required by `morpho-sdk`.
|
|
24
|
+
* It does not expose operation population or simulation helpers from
|
|
25
|
+
* `@morpho-org/bundler-sdk-viem`.
|
|
26
|
+
*/
|
|
27
|
+
export declare namespace BundlerAction {
|
|
28
|
+
/**
|
|
29
|
+
* Encodes a list of Bundler3 actions into a single Bundler3 multicall
|
|
30
|
+
* transaction request.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* This is a low-level encoding helper, not a safe bundle constructor. It
|
|
34
|
+
* does not validate that native-token pre-funding is fully consumed or that
|
|
35
|
+
* pre-funding actions are ordered before the value-carrying calls they fund.
|
|
36
|
+
*
|
|
37
|
+
* When custom actions include `nativeTransfer(externalOwner, bundler3,
|
|
38
|
+
* amount)`, no inner Bundler3 call is emitted for that transfer. Consumers
|
|
39
|
+
* must ensure those pre-funding actions precede their downstream consumers
|
|
40
|
+
* and leave no residual pre-funded native token; otherwise `tx.value` can be
|
|
41
|
+
* over-counted or native token can remain stranded on Bundler3. The
|
|
42
|
+
* high-level `morpho-sdk` action builders construct actions in that order,
|
|
43
|
+
* but this invariant is not checked at runtime by `encodeBundle`.
|
|
44
|
+
*
|
|
45
|
+
* @param chainId - Chain where the bundle will execute.
|
|
46
|
+
* @param actions - Ordered Bundler3 actions to encode.
|
|
47
|
+
* @returns Transaction target, calldata, and native value required by the
|
|
48
|
+
* bundle.
|
|
49
|
+
* @throws {BundlerErrors.MissingSignature} when a signature action is unsigned.
|
|
50
|
+
* @throws {BundlerErrors.UnexpectedAction} when an action is unavailable on the chain.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { getChainAddresses } from "@morpho-org/blue-sdk";
|
|
55
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
56
|
+
*
|
|
57
|
+
* const { generalAdapter1 } = getChainAddresses(1).bundler3;
|
|
58
|
+
* const sender = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
59
|
+
*
|
|
60
|
+
* const tx = BundlerAction.encodeBundle(1, [
|
|
61
|
+
* {
|
|
62
|
+
* type: "nativeTransfer",
|
|
63
|
+
* args: [sender, generalAdapter1, 1_000000000000000000n],
|
|
64
|
+
* },
|
|
65
|
+
* ]);
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function encodeBundle(chainId: number, actions: Action[]): {
|
|
69
|
+
to: `0x${string}`;
|
|
70
|
+
value: bigint;
|
|
71
|
+
data: `0x${string}`;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Encodes a single supported Bundler3 action into one or more low-level
|
|
75
|
+
* Bundler3 calls.
|
|
76
|
+
*
|
|
77
|
+
* @param chainId - Chain where the action will execute.
|
|
78
|
+
* @param action - Bundler3 action to encode.
|
|
79
|
+
* @returns Encoded Bundler3 calls.
|
|
80
|
+
* @throws {BundlerErrors.MissingSignature} when a signature action is unsigned.
|
|
81
|
+
* @throws {BundlerErrors.UnexpectedAction} when the action is unavailable on the chain.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
86
|
+
*
|
|
87
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
88
|
+
*
|
|
89
|
+
* const calls = BundlerAction.encode(1, {
|
|
90
|
+
* type: "wrapNative",
|
|
91
|
+
* args: [1_000000000000000000n, recipient],
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
function encode(chainId: number, action: Action): BundlerCall[];
|
|
96
|
+
/**
|
|
97
|
+
* Encodes a native-token transfer for Bundler3 execution.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* Transfers to Bundler3 are treated as bundle pre-funding and emit no inner
|
|
101
|
+
* call. Transfers whose `owner` is GeneralAdapter1 are encoded as
|
|
102
|
+
* `GeneralAdapter1.nativeTransfer(recipient, amount)` and always use
|
|
103
|
+
* `skipRevert: false`; the caller-supplied `skipRevert` argument applies
|
|
104
|
+
* only to direct native transfers from other owners.
|
|
105
|
+
*
|
|
106
|
+
* @param chainId - Chain where the action will execute.
|
|
107
|
+
* @param owner - Current native-token owner in the bundle.
|
|
108
|
+
* @param recipient - Native-token recipient.
|
|
109
|
+
* @param amount - Native-token amount in wei.
|
|
110
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
111
|
+
* @returns Encoded Bundler3 calls.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
116
|
+
*
|
|
117
|
+
* const sender = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
118
|
+
* const recipient = "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359";
|
|
119
|
+
*
|
|
120
|
+
* const calls = BundlerAction.nativeTransfer(
|
|
121
|
+
* 1,
|
|
122
|
+
* sender,
|
|
123
|
+
* recipient,
|
|
124
|
+
* 1_000000000000000000n,
|
|
125
|
+
* );
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
function nativeTransfer(chainId: number, owner: Address, recipient: Address, amount: bigint, skipRevert?: boolean): BundlerCall[];
|
|
129
|
+
/**
|
|
130
|
+
* Encodes an ERC20 transfer from the given adapter.
|
|
131
|
+
*
|
|
132
|
+
* @param asset - ERC20 token to transfer.
|
|
133
|
+
* @param recipient - Recipient of the transferred tokens.
|
|
134
|
+
* @param amount - Token amount to transfer.
|
|
135
|
+
* @param adapter - Adapter that currently holds the tokens.
|
|
136
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
137
|
+
* @returns Encoded Bundler3 calls.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* import { getChainAddresses } from "@morpho-org/blue-sdk";
|
|
142
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
143
|
+
*
|
|
144
|
+
* const adapter = getChainAddresses(1).bundler3.generalAdapter1;
|
|
145
|
+
* const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
146
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
147
|
+
*
|
|
148
|
+
* const calls = BundlerAction.erc20Transfer(
|
|
149
|
+
* asset,
|
|
150
|
+
* recipient,
|
|
151
|
+
* 100n,
|
|
152
|
+
* adapter,
|
|
153
|
+
* );
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
function erc20Transfer(asset: Address, recipient: Address, amount: bigint, adapter: Address, skipRevert?: boolean): BundlerCall[];
|
|
157
|
+
/**
|
|
158
|
+
* Encodes a GeneralAdapter1 ERC20 `transferFrom`.
|
|
159
|
+
*
|
|
160
|
+
* @param chainId - Chain where the action will execute.
|
|
161
|
+
* @param asset - ERC20 token to transfer.
|
|
162
|
+
* @param amount - Token amount to transfer.
|
|
163
|
+
* @param recipient - Recipient of the transferred tokens.
|
|
164
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
165
|
+
* @returns Encoded Bundler3 calls.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
170
|
+
*
|
|
171
|
+
* const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
172
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
173
|
+
*
|
|
174
|
+
* const calls = BundlerAction.erc20TransferFrom(
|
|
175
|
+
* 1,
|
|
176
|
+
* asset,
|
|
177
|
+
* 100n,
|
|
178
|
+
* recipient,
|
|
179
|
+
* );
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
function erc20TransferFrom(chainId: number, asset: Address, amount: bigint, recipient: Address, skipRevert?: boolean): BundlerCall[];
|
|
183
|
+
/**
|
|
184
|
+
* Encodes an ERC20 permit for GeneralAdapter1 spending.
|
|
185
|
+
*
|
|
186
|
+
* @param chainId - Chain where the action will execute.
|
|
187
|
+
* @param owner - Token owner signing the permit.
|
|
188
|
+
* @param asset - ERC20 token being permitted.
|
|
189
|
+
* @param amount - Allowance amount.
|
|
190
|
+
* @param deadline - Permit deadline timestamp.
|
|
191
|
+
* @param signature - Owner signature.
|
|
192
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
193
|
+
* @returns Encoded Bundler3 calls.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
198
|
+
*
|
|
199
|
+
* const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
200
|
+
* const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
201
|
+
* const signature =
|
|
202
|
+
* "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
|
|
203
|
+
*
|
|
204
|
+
* const calls = BundlerAction.permit(
|
|
205
|
+
* 1,
|
|
206
|
+
* owner,
|
|
207
|
+
* asset,
|
|
208
|
+
* 100n,
|
|
209
|
+
* 1_900_000_000n,
|
|
210
|
+
* signature,
|
|
211
|
+
* );
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
function permit(chainId: number, owner: Address, asset: Address, amount: bigint, deadline: bigint, signature: Hex, skipRevert?: boolean): BundlerCall[];
|
|
215
|
+
/**
|
|
216
|
+
* Encodes a Permit2 approval for GeneralAdapter1 spending.
|
|
217
|
+
*
|
|
218
|
+
* @param chainId - Chain where the action will execute.
|
|
219
|
+
* @param owner - Token owner signing the Permit2 payload.
|
|
220
|
+
* @param permitSingle - Permit2 allowance payload.
|
|
221
|
+
* @param signature - Owner signature.
|
|
222
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
223
|
+
* @returns Encoded Bundler3 calls.
|
|
224
|
+
* @throws {BundlerErrors.UnexpectedAction} when Permit2 is unavailable on the chain.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
229
|
+
*
|
|
230
|
+
* const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
231
|
+
* const token = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
232
|
+
* const signature =
|
|
233
|
+
* "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
|
|
234
|
+
*
|
|
235
|
+
* const calls = BundlerAction.approve2(
|
|
236
|
+
* 1,
|
|
237
|
+
* owner,
|
|
238
|
+
* {
|
|
239
|
+
* details: {
|
|
240
|
+
* token,
|
|
241
|
+
* amount: 100n,
|
|
242
|
+
* expiration: 1_900_000_000,
|
|
243
|
+
* nonce: 0,
|
|
244
|
+
* },
|
|
245
|
+
* sigDeadline: 1_900_000_000n,
|
|
246
|
+
* },
|
|
247
|
+
* signature,
|
|
248
|
+
* );
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
function approve2(chainId: number, owner: Address, permitSingle: Permit2PermitSingle, signature: Hex, skipRevert?: boolean): BundlerCall[];
|
|
252
|
+
/**
|
|
253
|
+
* Encodes a GeneralAdapter1 Permit2 transfer.
|
|
254
|
+
*
|
|
255
|
+
* @param chainId - Chain where the action will execute.
|
|
256
|
+
* @param asset - ERC20 token to transfer through Permit2.
|
|
257
|
+
* @param amount - Token amount to transfer.
|
|
258
|
+
* @param recipient - Recipient of the transferred tokens.
|
|
259
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
260
|
+
* @returns Encoded Bundler3 calls.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
265
|
+
*
|
|
266
|
+
* const asset = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
267
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
268
|
+
*
|
|
269
|
+
* const calls = BundlerAction.transferFrom2(
|
|
270
|
+
* 1,
|
|
271
|
+
* asset,
|
|
272
|
+
* 100n,
|
|
273
|
+
* recipient,
|
|
274
|
+
* );
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
function transferFrom2(chainId: number, asset: Address, amount: bigint, recipient: Address, skipRevert?: boolean): BundlerCall[];
|
|
278
|
+
/**
|
|
279
|
+
* Encodes a GeneralAdapter1 ERC4626 deposit.
|
|
280
|
+
*
|
|
281
|
+
* @param chainId - Chain where the action will execute.
|
|
282
|
+
* @param erc4626 - ERC4626 vault address.
|
|
283
|
+
* @param assets - Asset amount to deposit.
|
|
284
|
+
* @param maxSharePrice - Maximum accepted share price in RAY.
|
|
285
|
+
* @param receiver - Recipient of minted vault shares.
|
|
286
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
287
|
+
* @returns Encoded Bundler3 calls.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
292
|
+
*
|
|
293
|
+
* const vault = "0x186514400e52270cef3D80e1c6F8d10A75d47344";
|
|
294
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
295
|
+
*
|
|
296
|
+
* const calls = BundlerAction.erc4626Deposit(
|
|
297
|
+
* 1,
|
|
298
|
+
* vault,
|
|
299
|
+
* 100n,
|
|
300
|
+
* 1_000000000000000000000000000n,
|
|
301
|
+
* recipient,
|
|
302
|
+
* );
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
function erc4626Deposit(chainId: number, erc4626: Address, assets: bigint, maxSharePrice: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
|
|
306
|
+
/**
|
|
307
|
+
* Encodes a GeneralAdapter1 ERC4626 redeem.
|
|
308
|
+
*
|
|
309
|
+
* @param chainId - Chain where the action will execute.
|
|
310
|
+
* @param erc4626 - ERC4626 vault address.
|
|
311
|
+
* @param shares - Share amount to redeem.
|
|
312
|
+
* @param minSharePrice - Minimum accepted share price in RAY.
|
|
313
|
+
* @param receiver - Recipient of redeemed assets.
|
|
314
|
+
* @param owner - Owner of the shares being redeemed.
|
|
315
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
316
|
+
* @returns Encoded Bundler3 calls.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
321
|
+
*
|
|
322
|
+
* const vault = "0x186514400e52270cef3D80e1c6F8d10A75d47344";
|
|
323
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
324
|
+
* const owner = recipient;
|
|
325
|
+
*
|
|
326
|
+
* const calls = BundlerAction.erc4626Redeem(
|
|
327
|
+
* 1,
|
|
328
|
+
* vault,
|
|
329
|
+
* 100n,
|
|
330
|
+
* 900000000000000000000000000n,
|
|
331
|
+
* recipient,
|
|
332
|
+
* owner,
|
|
333
|
+
* );
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
function erc4626Redeem(chainId: number, erc4626: Address, shares: bigint, minSharePrice: bigint, receiver: Address, owner: Address, skipRevert?: boolean): BundlerCall[];
|
|
337
|
+
/**
|
|
338
|
+
* Encodes a GeneralAdapter1 Morpho Blue supply-collateral call.
|
|
339
|
+
*
|
|
340
|
+
* @param chainId - Chain where the action will execute.
|
|
341
|
+
* @param market - Morpho Blue market parameters.
|
|
342
|
+
* @param assets - Collateral asset amount to supply.
|
|
343
|
+
* @param onBehalf - Account receiving the collateral position.
|
|
344
|
+
* @param callbackCalls - Calls executed in Morpho's callback.
|
|
345
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
346
|
+
* @returns Encoded Bundler3 calls.
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```ts
|
|
350
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
351
|
+
*
|
|
352
|
+
* const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
353
|
+
* const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
354
|
+
* const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
355
|
+
* const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
356
|
+
* const onBehalf = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
357
|
+
* const marketParams = {
|
|
358
|
+
* loanToken,
|
|
359
|
+
* collateralToken,
|
|
360
|
+
* oracle,
|
|
361
|
+
* irm,
|
|
362
|
+
* lltv: 860_000000000000000000n,
|
|
363
|
+
* };
|
|
364
|
+
*
|
|
365
|
+
* const calls = BundlerAction.morphoSupplyCollateral(
|
|
366
|
+
* 1,
|
|
367
|
+
* marketParams,
|
|
368
|
+
* 100n,
|
|
369
|
+
* onBehalf,
|
|
370
|
+
* [],
|
|
371
|
+
* );
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
function morphoSupplyCollateral(chainId: number, market: InputMarketParams, assets: bigint, onBehalf: Address, callbackCalls: BundlerCall[], skipRevert?: boolean): BundlerCall[];
|
|
375
|
+
/**
|
|
376
|
+
* Encodes a GeneralAdapter1 Morpho Blue borrow call.
|
|
377
|
+
*
|
|
378
|
+
* @param chainId - Chain where the action will execute.
|
|
379
|
+
* @param market - Morpho Blue market parameters.
|
|
380
|
+
* @param assets - Borrow asset amount.
|
|
381
|
+
* @param shares - Borrow share amount.
|
|
382
|
+
* @param slippageAmount - Slippage guard amount.
|
|
383
|
+
* @param receiver - Recipient of borrowed assets.
|
|
384
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
385
|
+
* @returns Encoded Bundler3 calls.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```ts
|
|
389
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
390
|
+
*
|
|
391
|
+
* const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
392
|
+
* const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
393
|
+
* const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
394
|
+
* const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
395
|
+
* const receiver = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
396
|
+
* const marketParams = {
|
|
397
|
+
* loanToken,
|
|
398
|
+
* collateralToken,
|
|
399
|
+
* oracle,
|
|
400
|
+
* irm,
|
|
401
|
+
* lltv: 860_000000000000000000n,
|
|
402
|
+
* };
|
|
403
|
+
*
|
|
404
|
+
* const calls = BundlerAction.morphoBorrow(
|
|
405
|
+
* 1,
|
|
406
|
+
* marketParams,
|
|
407
|
+
* 100n,
|
|
408
|
+
* 0n,
|
|
409
|
+
* 1_000000000000000000000000000n,
|
|
410
|
+
* receiver,
|
|
411
|
+
* );
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
function morphoBorrow(chainId: number, market: InputMarketParams, assets: bigint, shares: bigint, slippageAmount: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
|
|
415
|
+
/**
|
|
416
|
+
* Encodes a GeneralAdapter1 Morpho Blue repay call.
|
|
417
|
+
*
|
|
418
|
+
* @param chainId - Chain where the action will execute.
|
|
419
|
+
* @param market - Morpho Blue market parameters.
|
|
420
|
+
* @param assets - Repay asset amount.
|
|
421
|
+
* @param shares - Repay share amount.
|
|
422
|
+
* @param slippageAmount - Slippage guard amount.
|
|
423
|
+
* @param onBehalf - Account whose borrow is repaid.
|
|
424
|
+
* @param callbackCalls - Calls executed in Morpho's callback.
|
|
425
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
426
|
+
* @returns Encoded Bundler3 calls.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```ts
|
|
430
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
431
|
+
*
|
|
432
|
+
* const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
433
|
+
* const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
434
|
+
* const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
435
|
+
* const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
436
|
+
* const onBehalf = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
437
|
+
* const marketParams = {
|
|
438
|
+
* loanToken,
|
|
439
|
+
* collateralToken,
|
|
440
|
+
* oracle,
|
|
441
|
+
* irm,
|
|
442
|
+
* lltv: 860_000000000000000000n,
|
|
443
|
+
* };
|
|
444
|
+
*
|
|
445
|
+
* const calls = BundlerAction.morphoRepay(
|
|
446
|
+
* 1,
|
|
447
|
+
* marketParams,
|
|
448
|
+
* 100n,
|
|
449
|
+
* 0n,
|
|
450
|
+
* 1_000000000000000000000000000n,
|
|
451
|
+
* onBehalf,
|
|
452
|
+
* [],
|
|
453
|
+
* );
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
function morphoRepay(chainId: number, market: InputMarketParams, assets: bigint, shares: bigint, slippageAmount: bigint, onBehalf: Address, callbackCalls: BundlerCall[], skipRevert?: boolean): BundlerCall[];
|
|
457
|
+
/**
|
|
458
|
+
* Encodes a GeneralAdapter1 Morpho Blue withdraw-collateral call.
|
|
459
|
+
*
|
|
460
|
+
* @param chainId - Chain where the action will execute.
|
|
461
|
+
* @param market - Morpho Blue market parameters.
|
|
462
|
+
* @param assets - Collateral asset amount to withdraw.
|
|
463
|
+
* @param receiver - Recipient of withdrawn collateral.
|
|
464
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
465
|
+
* @returns Encoded Bundler3 calls.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```ts
|
|
469
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
470
|
+
*
|
|
471
|
+
* const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
472
|
+
* const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
473
|
+
* const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
474
|
+
* const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
475
|
+
* const receiver = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
476
|
+
* const marketParams = {
|
|
477
|
+
* loanToken,
|
|
478
|
+
* collateralToken,
|
|
479
|
+
* oracle,
|
|
480
|
+
* irm,
|
|
481
|
+
* lltv: 860_000000000000000000n,
|
|
482
|
+
* };
|
|
483
|
+
*
|
|
484
|
+
* const calls = BundlerAction.morphoWithdrawCollateral(
|
|
485
|
+
* 1,
|
|
486
|
+
* marketParams,
|
|
487
|
+
* 100n,
|
|
488
|
+
* receiver,
|
|
489
|
+
* );
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
function morphoWithdrawCollateral(chainId: number, market: InputMarketParams, assets: bigint, receiver: Address, skipRevert?: boolean): BundlerCall[];
|
|
493
|
+
/**
|
|
494
|
+
* Encodes a PublicAllocator reallocation call.
|
|
495
|
+
*
|
|
496
|
+
* @param chainId - Chain where the action will execute.
|
|
497
|
+
* @param vault - Vault to reallocate.
|
|
498
|
+
* @param fee - Public allocator fee.
|
|
499
|
+
* @param withdrawals - Market withdrawals performed before supply.
|
|
500
|
+
* @param supplyMarketParams - Target supply market parameters.
|
|
501
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
502
|
+
* @returns Encoded Bundler3 calls.
|
|
503
|
+
* @throws {BundlerErrors.UnexpectedAction} when the PublicAllocator is unavailable on the chain.
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```ts
|
|
507
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
508
|
+
*
|
|
509
|
+
* const loanToken = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
|
510
|
+
* const collateralToken = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
511
|
+
* const oracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419";
|
|
512
|
+
* const irm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
513
|
+
* const vault = "0x186514400e52270cef3D80e1c6F8d10A75d47344";
|
|
514
|
+
* const marketParams = {
|
|
515
|
+
* loanToken,
|
|
516
|
+
* collateralToken,
|
|
517
|
+
* oracle,
|
|
518
|
+
* irm,
|
|
519
|
+
* lltv: 860_000000000000000000n,
|
|
520
|
+
* };
|
|
521
|
+
*
|
|
522
|
+
* const calls = BundlerAction.publicAllocatorReallocateTo(
|
|
523
|
+
* 1,
|
|
524
|
+
* vault,
|
|
525
|
+
* 0n,
|
|
526
|
+
* [{ marketParams, amount: 100n }],
|
|
527
|
+
* marketParams,
|
|
528
|
+
* );
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
function publicAllocatorReallocateTo(chainId: number, vault: Address, fee: bigint, withdrawals: InputReallocation[], supplyMarketParams: InputMarketParams, skipRevert?: boolean): BundlerCall[];
|
|
532
|
+
/**
|
|
533
|
+
* Encodes a GeneralAdapter1 native-token wrap call.
|
|
534
|
+
*
|
|
535
|
+
* @param chainId - Chain where the action will execute.
|
|
536
|
+
* @param amount - Native-token amount to wrap.
|
|
537
|
+
* @param recipient - Recipient of wrapped native tokens.
|
|
538
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert.
|
|
539
|
+
* @returns Encoded Bundler3 calls.
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```ts
|
|
543
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
544
|
+
*
|
|
545
|
+
* const recipient = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
546
|
+
*
|
|
547
|
+
* const calls = BundlerAction.wrapNative(
|
|
548
|
+
* 1,
|
|
549
|
+
* 1_000000000000000000n,
|
|
550
|
+
* recipient,
|
|
551
|
+
* );
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
function wrapNative(chainId: number, amount: bigint, recipient: Address, skipRevert?: boolean): BundlerCall[];
|
|
555
|
+
}
|