You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been wondering about this since you opened the issue. And I have figured out the issue. Solidity expects constructor arguments to be appended to the code itself and not provided as calldata input. So what you need to do is:
❯ ./build/bin/evm run --code "6080604052348015600e575f80fd5b50604051609938038060998339818101604052810190602c91906072565b60405181815260208101604052602081f35b5f80fd5b5f8115159050919050565b6054816042565b8114605d575f80fd5b50565b5f81519050606c81604d565b92915050565b5f602082840312156084576083603e565b5b5f608f848285016060565b9150509291505056fe0000000000000000000000000000000000000000000000000000000000000001"
0x0000000000000000000000000000000000000000000000000000000000000001
Which as you can see does return the input value.
The reason is simple. In Ethereum, when you deploy a contract, the compile code will be set in the calldata of that transaction. Because the nodes have to learn about the code. And because there is only one calldata, Solidity decided for the approach of taking in arguments for constructor from the end of the code.
I want deploy this contract via evm offline using bytecode and get the response:
I get get the abi and byte code via
and run
but I always get the error that error:
how do I get the expected output which would be the same as the input?
The text was updated successfully, but these errors were encountered: