@morpho-org/bundler-sdk-viem 3.0.0-next.7 → 3.0.0-next.8
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/BundlerAction.js +10 -6
- package/package.json +3 -3
package/lib/BundlerAction.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { aaveV2MigrationAdapterAbi, aaveV3MigrationAdapterAbi, aaveV3OptimizerMigrationAdapterAbi, bundler3Abi, compoundV2MigrationAdapterAbi, compoundV3MigrationAdapterAbi, coreAdapterAbi, erc20WrapperAdapterAbi, ethereumGeneralAdapter1Abi, generalAdapter1Abi, universalRewardsDistributorAbi, } from "./abis.js";
|
|
2
2
|
import { getChainAddresses, } from "@morpho-org/blue-sdk";
|
|
3
3
|
import { blueAbi, erc2612Abi, permit2Abi, publicAllocatorAbi, } from "@morpho-org/blue-sdk-viem";
|
|
4
|
-
import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature,
|
|
4
|
+
import { encodeAbiParameters, encodeFunctionData, keccak256, maxUint256, parseSignature, zeroHash, } from "viem";
|
|
5
5
|
import { BundlerErrors } from "./errors.js";
|
|
6
|
-
const
|
|
6
|
+
const reenterAbiInputs = bundler3Abi.find((item) => item.name === "reenter").inputs;
|
|
7
7
|
/**
|
|
8
8
|
* Namespace to easily encode calls to the Bundler contract, using viem.
|
|
9
9
|
*/
|
|
@@ -673,7 +673,7 @@ export var BundlerAction;
|
|
|
673
673
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
674
674
|
const reenter = callbackCalls.length > 0;
|
|
675
675
|
const reenterData = reenter
|
|
676
|
-
? encodeAbiParameters(
|
|
676
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
677
677
|
: "0x";
|
|
678
678
|
return [
|
|
679
679
|
{
|
|
@@ -702,7 +702,7 @@ export var BundlerAction;
|
|
|
702
702
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
703
703
|
const reenter = callbackCalls.length > 0;
|
|
704
704
|
const reenterData = reenter
|
|
705
|
-
? encodeAbiParameters(
|
|
705
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
706
706
|
: "0x";
|
|
707
707
|
return [
|
|
708
708
|
{
|
|
@@ -759,7 +759,7 @@ export var BundlerAction;
|
|
|
759
759
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
760
760
|
const reenter = callbackCalls.length > 0;
|
|
761
761
|
const reenterData = reenter
|
|
762
|
-
? encodeAbiParameters(
|
|
762
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
763
763
|
: "0x";
|
|
764
764
|
return [
|
|
765
765
|
{
|
|
@@ -835,6 +835,10 @@ export var BundlerAction;
|
|
|
835
835
|
*/
|
|
836
836
|
function morphoFlashLoan(chainId, asset, amount, callbackCalls) {
|
|
837
837
|
const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
|
|
838
|
+
const reenter = callbackCalls.length > 0;
|
|
839
|
+
const reenterData = reenter
|
|
840
|
+
? encodeAbiParameters(reenterAbiInputs, [callbackCalls])
|
|
841
|
+
: "0x";
|
|
838
842
|
return [
|
|
839
843
|
{
|
|
840
844
|
to: generalAdapter1,
|
|
@@ -853,7 +857,7 @@ export var BundlerAction;
|
|
|
853
857
|
}),
|
|
854
858
|
value: 0n,
|
|
855
859
|
skipRevert: false,
|
|
856
|
-
callbackHash: keccak256(
|
|
860
|
+
callbackHash: reenter ? keccak256(reenterData) : zeroHash,
|
|
857
861
|
},
|
|
858
862
|
];
|
|
859
863
|
}
|
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": "3.0.0-next.
|
|
4
|
+
"version": "3.0.0-next.8",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"typescript": "^5.7.2",
|
|
36
36
|
"viem": "^2.23.0",
|
|
37
37
|
"vitest": "^3.0.5",
|
|
38
|
-
"@morpho-org/blue-sdk-viem": "^2.2.2",
|
|
39
|
-
"@morpho-org/morpho-test": "^2.2.1",
|
|
40
38
|
"@morpho-org/blue-sdk": "^2.3.2",
|
|
39
|
+
"@morpho-org/blue-sdk-viem": "^2.2.2",
|
|
41
40
|
"@morpho-org/morpho-ts": "^2.2.0",
|
|
41
|
+
"@morpho-org/morpho-test": "^2.2.1",
|
|
42
42
|
"@morpho-org/simulation-sdk": "^2.1.4",
|
|
43
43
|
"@morpho-org/simulation-sdk-wagmi": "^2.0.5",
|
|
44
44
|
"@morpho-org/test-wagmi": "^2.0.4",
|