Skip to content

Commit

Permalink
Bump revm-interpreter-js
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmDreamy committed Aug 24, 2024
1 parent 40be8b0 commit eb6a24e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"lottie-web": "^5.12.2",
"marked": "^11.2.0",
"moment": "^2.29.4",
"revm-interpreter-js": "^0.1.2",
"revm-interpreter-js": "^1.0.1",
"veaury": "^2.3.12",
"viem": "^2.9.13",
"vue": "^3.2.47",
Expand Down
31 changes: 18 additions & 13 deletions src/helpers/pools/swap/libs/interpretContract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { interpret } from "revm-interpreter-js";
import { type InterpretParams, interpret } from "revm-interpreter-js";
import {
encodeFunctionData,
type Abi,
Expand All @@ -23,14 +23,14 @@ export function interpretContract<
abi,
AbiStateMutability,
functionName extends ContractFunctionName<abi>
? functionName
: ContractFunctionName<abi>
? functionName
: ContractFunctionName<abi>
> = ContractFunctionArgs<
abi,
AbiStateMutability,
functionName extends ContractFunctionName<abi>
? functionName
: ContractFunctionName<abi>
? functionName
: ContractFunctionName<abi>
>
>(
parameters: EncodeFunctionDataParameters<abi, functionName> & {
Expand All @@ -40,6 +40,8 @@ export function interpretContract<
bytecodeAddress?: Address | ByteArray;
code: Hex | ByteArray;
gasLimit?: bigint;
staticCall?: boolean;
specificationName?: InterpretParams["specificationName"];
}
): DecodeFunctionResultReturnType<abi, functionName, args> {
const tryToBytes = (
Expand All @@ -56,14 +58,17 @@ export function interpretContract<
args: parameters.args,
} as EncodeFunctionDataParameters);
const interpretResult = interpret(
isBytes(parameters.code) ? parameters.code : hexToBytes(parameters.code),
hexToBytes(encodedData),
parameters.value,
tryToBytes(parameters.from),
tryToBytes(parameters.targetAddress),
tryToBytes(parameters.bytecodeAddress),
parameters.gasLimit
);
{
bytecode: isBytes(parameters.code) ? parameters.code : hexToBytes(parameters.code),
data: hexToBytes(encodedData),
value: parameters.value,
from: tryToBytes(parameters.from),
targetAddress: tryToBytes(parameters.targetAddress),
bytecodeAddress: tryToBytes(parameters.bytecodeAddress),
gasLimit: parameters.gasLimit,
staticCall: parameters.staticCall,
specificationName: parameters.specificationName,
});
return decodeFunctionResult({
abi: parameters.abi,
functionName: parameters.functionName,
Expand Down

0 comments on commit eb6a24e

Please sign in to comment.