@morpho-org/bundler-sdk-viem 2.0.0 → 2.1.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/lib/operations.d.ts +12 -0
- package/lib/operations.js +6 -1
- package/package.json +15 -15
package/lib/operations.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { type Address, type MarketId } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type MaybeDraft, type Operation, type Operations, type PublicAllocatorOptions, type SimulationResult, type SimulationState } from "@morpho-org/simulation-sdk";
|
|
3
3
|
import type { BundlerOperation, CallbackBundlerOperation, InputBundlerOperation } from "./types/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* The default target utilization above which the shared liquidity algorithm is triggered (scaled by WAD).
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_SUPPLY_TARGET_UTILIZATION = 905000000000000000n;
|
|
4
8
|
export interface BundlingOptions {
|
|
5
9
|
withSimplePermit?: Set<Address>;
|
|
6
10
|
publicAllocatorOptions?: PublicAllocatorOptions & {
|
|
11
|
+
/**
|
|
12
|
+
* The target utilization of each market above which the shared liquidity algorithm is triggered (scaled by WAD).
|
|
13
|
+
*/
|
|
7
14
|
supplyTargetUtilization?: Record<MarketId, bigint | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* The default target utilization above which the shared liquidity algorithm is triggered (scaled by WAD).
|
|
17
|
+
* @default 90.5%
|
|
18
|
+
*/
|
|
19
|
+
defaultSupplyTargetUtilization?: bigint;
|
|
8
20
|
};
|
|
9
21
|
getRequirementOperations?: (requiredTokenAmounts: {
|
|
10
22
|
token: Address;
|
package/lib/operations.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { DEFAULT_SLIPPAGE_TOLERANCE,
|
|
1
|
+
import { DEFAULT_SLIPPAGE_TOLERANCE, MarketUtils, MathLib, NATIVE_ADDRESS, erc20WrapperTokens, getChainAddresses, getUnwrappedToken, permissionedBackedTokens, permissionedWrapperTokens, } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { bigIntComparator, entries, getLast, getValue, keys, } from "@morpho-org/morpho-ts";
|
|
3
3
|
import { handleOperation, handleOperations, produceImmutable, simulateOperation, simulateOperations, } from "@morpho-org/simulation-sdk";
|
|
4
4
|
import { maxUint256 } from "viem";
|
|
5
5
|
import { BundlerErrors } from "./errors.js";
|
|
6
|
+
/**
|
|
7
|
+
* The default target utilization above which the shared liquidity algorithm is triggered (scaled by WAD).
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_SUPPLY_TARGET_UTILIZATION = 905000000000000000n;
|
|
6
10
|
export const populateInputTransfer = ({ address, args: { amount, from } }, data, { hasSimplePermit = false } = {}) => {
|
|
7
11
|
const { bundler, permit2 } = getChainAddresses(data.chainId);
|
|
8
12
|
// If native token, it is expected to be sent along as call value.
|
|
@@ -197,6 +201,7 @@ export const populateSubBundle = (inputOperation, data, options = {}) => {
|
|
|
197
201
|
const newTotalBorrowAssets = market.totalBorrowAssets + borrowedAssets;
|
|
198
202
|
const reallocations = {};
|
|
199
203
|
const supplyTargetUtilization = publicAllocatorOptions.supplyTargetUtilization?.[market.params.id] ??
|
|
204
|
+
publicAllocatorOptions.defaultSupplyTargetUtilization ??
|
|
200
205
|
DEFAULT_SUPPLY_TARGET_UTILIZATION;
|
|
201
206
|
if (MarketUtils.getUtilization({
|
|
202
207
|
totalSupplyAssets: newTotalSupplyAssets,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/bundler-sdk-viem",
|
|
3
3
|
"description": "Viem-based extension of `@morpho-org/simulation-sdk` that exports utilities to transform simple interactions on Morpho (such as `Blue_Borrow`) and Morpho Vaults (such as `MetaMorpho_Deposit`) into the required bundles (with ERC20 approvals, transfers, etc) to submit to the bundler onchain.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|
|
@@ -20,29 +20,29 @@
|
|
|
20
20
|
],
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"viem": "^2.0.0",
|
|
23
|
+
"@morpho-org/blue-sdk": "^2.1.2",
|
|
23
24
|
"@morpho-org/morpho-ts": "^2.0.0",
|
|
24
|
-
"@morpho-org/
|
|
25
|
-
"@morpho-org/
|
|
26
|
-
"@morpho-org/blue-sdk-viem": "^2.0.0"
|
|
25
|
+
"@morpho-org/simulation-sdk": "^2.1.1",
|
|
26
|
+
"@morpho-org/blue-sdk-viem": "^2.0.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@tanstack/query-core": "^5.
|
|
30
|
-
"@tanstack/react-query": "^5.
|
|
29
|
+
"@tanstack/query-core": "^5.62.9",
|
|
30
|
+
"@tanstack/react-query": "^5.62.11",
|
|
31
31
|
"@testing-library/dom": "^10.4.0",
|
|
32
|
-
"@testing-library/react": "^16.0
|
|
32
|
+
"@testing-library/react": "^16.1.0",
|
|
33
33
|
"@types/lodash": "^4.17.12",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
35
|
"typescript": "^5.7.2",
|
|
36
|
-
"viem": "^2.
|
|
36
|
+
"viem": "^2.22.2",
|
|
37
37
|
"vitest": "^2.1.8",
|
|
38
|
-
"@morpho-org/blue-sdk": "^2.
|
|
39
|
-
"@morpho-org/blue-sdk-viem": "^2.0.
|
|
38
|
+
"@morpho-org/blue-sdk": "^2.1.2",
|
|
39
|
+
"@morpho-org/blue-sdk-viem": "^2.0.3",
|
|
40
40
|
"@morpho-org/morpho-ts": "^2.0.0",
|
|
41
|
-
"@morpho-org/
|
|
42
|
-
"@morpho-org/
|
|
43
|
-
"@morpho-org/test": "^2.0.
|
|
44
|
-
"@morpho-org/test
|
|
45
|
-
"@morpho-org/simulation-sdk-wagmi": "^2.0.
|
|
41
|
+
"@morpho-org/morpho-test": "^2.0.1",
|
|
42
|
+
"@morpho-org/simulation-sdk": "^2.1.1",
|
|
43
|
+
"@morpho-org/test-wagmi": "^2.0.2",
|
|
44
|
+
"@morpho-org/test": "^2.0.2",
|
|
45
|
+
"@morpho-org/simulation-sdk-wagmi": "^2.0.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"prepublish": "$npm_execpath build",
|