damm-sdk 1.4.35 → 1.4.36

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.
@@ -68,4 +68,15 @@ export declare const withdrawMorphoVaultTrx: ({ args, morphoVaultAddress, }: {
68
68
  args: RedeemMorphoVaultArgs;
69
69
  morphoVaultAddress: Address;
70
70
  }) => Unwrapable<Call>;
71
+ export type ForceDeallocateMorphoVaultArgs = Readonly<{
72
+ adapter: Address;
73
+ data: HexString;
74
+ assets: bigint;
75
+ onBehalf: Address;
76
+ }>;
77
+ export declare const ForceDeallocateMorphoVaultCalldata: ({ adapter, data, assets, onBehalf, }: ForceDeallocateMorphoVaultArgs) => HexString;
78
+ export declare const forceDeallocateMorphoVaultTrx: ({ args, morphoVaultAddress, }: {
79
+ args: ForceDeallocateMorphoVaultArgs;
80
+ morphoVaultAddress: Address;
81
+ }) => Unwrapable<Call>;
71
82
  //# sourceMappingURL=morpho.vault.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"morpho.vault.d.ts","sourceRoot":"","sources":["../../../src/integrations/morphoVault/morpho.vault.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAS/D,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH,eAAO,MAAM,0BAA0B,yBAA0B,sBAAsB,KAAG,SAEzF,CAAC;AAEF,eAAO,MAAM,qBAAqB;UAIxB,sBAAsB;wBACR,OAAO;MAC3B,WAAW,IAAI,CAOlB,CAAC;AAMF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IACzC,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OA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kCAAkC,yCAK5C,8BAA8B,KAAG,SAEnC,CAAC;AAEF,eAAO,MAAM,6BAA6B;UAIhC,8BAA8B;wBAChB,OAAO;MAC3B,WAAW,IAAI,CAOlB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Morpho Vault V2-only ABI fragments. These are not present on V1 vaults.
3
+ *
4
+ * `forceDeallocate(adapter, data, assets, onBehalf)` is the LP escape hatch
5
+ * — it pays the curator-set `forceDeallocatePenalty(adapter)` and pulls
6
+ * `assets` worth of underlying out of the named adapter back to vault idle.
7
+ * V2 vaults expose this so a depositor can force liquidity from a single
8
+ * adapter without waiting for the curator's reallocation.
9
+ */
10
+ export declare const MorphoVaultV2Abi: readonly [{
11
+ readonly inputs: readonly [{
12
+ readonly internalType: "address";
13
+ readonly name: "adapter";
14
+ readonly type: "address";
15
+ }, {
16
+ readonly internalType: "bytes";
17
+ readonly name: "data";
18
+ readonly type: "bytes";
19
+ }, {
20
+ readonly internalType: "uint256";
21
+ readonly name: "assets";
22
+ readonly type: "uint256";
23
+ }, {
24
+ readonly internalType: "address";
25
+ readonly name: "onBehalf";
26
+ readonly type: "address";
27
+ }];
28
+ readonly name: "forceDeallocate";
29
+ readonly outputs: readonly [{
30
+ readonly internalType: "uint256";
31
+ readonly name: "";
32
+ readonly type: "uint256";
33
+ }];
34
+ readonly stateMutability: "nonpayable";
35
+ readonly type: "function";
36
+ }];
37
+ //# sourceMappingURL=morpho.vault.v2.abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morpho.vault.v2.abi.d.ts","sourceRoot":"","sources":["../../../src/integrations/morphoVault/morpho.vault.v2.abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;EAanB,CAAC"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "./dist/index.cjs",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
7
- "version": "1.4.35",
7
+ "version": "1.4.36",
8
8
  "files": [
9
9
  "dist",
10
10
  "src",
@@ -1,10 +1,12 @@
1
1
  import { ethers } from "ethers";
2
2
  import MorphoVaultAbi from "./morpho.vault.abi";
3
+ import { MorphoVaultV2Abi } from "./morpho.vault.v2.abi";
3
4
  import type { Address } from "viem";
4
5
  import type { HexString, Unwrapable, Call } from "../../types";
5
6
  import { createCall } from "../../types";
6
7
 
7
8
  const morphoVaultInterface = new ethers.utils.Interface(MorphoVaultAbi);
9
+ const morphoVaultV2Interface = new ethers.utils.Interface(MorphoVaultV2Abi);
8
10
 
9
11
  // ============================================================================
10
12
  // Deposit (ERC4626)
@@ -138,3 +140,46 @@ export const WithdrawMorphoVaultCalldata = RedeemMorphoVaultCalldata;
138
140
  * is the correct ERC4626 method for shares-based withdrawals.
139
141
  */
140
142
  export const withdrawMorphoVaultTrx = redeemMorphoVaultTrx;
143
+
144
+ // ============================================================================
145
+ // Force Deallocate (Morpho Vault V2 only)
146
+ //
147
+ // `forceDeallocate(adapter, data, assets, onBehalf)` pays the curator-set
148
+ // `forceDeallocatePenalty(adapter)` and pulls `assets` worth of underlying
149
+ // from the named adapter back to vault idle. Caller-supplied `data` is
150
+ // adapter-specific (often empty bytes `0x`); `onBehalf` is typically the
151
+ // avatar safe (the LP whose position absorbs the penalty).
152
+ //
153
+ // V2-only — calling this against a V1 vault reverts (function not present).
154
+ // ============================================================================
155
+
156
+ export type ForceDeallocateMorphoVaultArgs = Readonly<{
157
+ adapter: Address;
158
+ data: HexString;
159
+ assets: bigint;
160
+ onBehalf: Address;
161
+ }>;
162
+
163
+ export const ForceDeallocateMorphoVaultCalldata = ({
164
+ adapter,
165
+ data,
166
+ assets,
167
+ onBehalf,
168
+ }: ForceDeallocateMorphoVaultArgs): HexString => {
169
+ return morphoVaultV2Interface.encodeFunctionData("forceDeallocate", [adapter, data, assets, onBehalf]) as HexString;
170
+ };
171
+
172
+ export const forceDeallocateMorphoVaultTrx = ({
173
+ args,
174
+ morphoVaultAddress,
175
+ }: {
176
+ args: ForceDeallocateMorphoVaultArgs;
177
+ morphoVaultAddress: Address;
178
+ }): Unwrapable<Call> => {
179
+ return createCall({
180
+ operation: 0,
181
+ to: morphoVaultAddress,
182
+ value: 0n,
183
+ data: ForceDeallocateMorphoVaultCalldata(args),
184
+ });
185
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Morpho Vault V2-only ABI fragments. These are not present on V1 vaults.
3
+ *
4
+ * `forceDeallocate(adapter, data, assets, onBehalf)` is the LP escape hatch
5
+ * — it pays the curator-set `forceDeallocatePenalty(adapter)` and pulls
6
+ * `assets` worth of underlying out of the named adapter back to vault idle.
7
+ * V2 vaults expose this so a depositor can force liquidity from a single
8
+ * adapter without waiting for the curator's reallocation.
9
+ */
10
+ export const MorphoVaultV2Abi = [
11
+ {
12
+ inputs: [
13
+ { internalType: "address", name: "adapter", type: "address" },
14
+ { internalType: "bytes", name: "data", type: "bytes" },
15
+ { internalType: "uint256", name: "assets", type: "uint256" },
16
+ { internalType: "address", name: "onBehalf", type: "address" },
17
+ ],
18
+ name: "forceDeallocate",
19
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
20
+ stateMutability: "nonpayable",
21
+ type: "function",
22
+ },
23
+ ] as const;