Closed temuera closed 5 months ago
tried to use w3.Message with InputData to deploy the contract.
Simple functions can run normally, such as:
w3.MustNewFunc(`test(uint256 _in)`, "uint256")
call a Complex functions failed.
However, forked a exists deployed contract can call complex functions with same args.
Understood. The default chain ID for the VM is 1.
@temuera did you manage to deploy a contract? There is an open issue explaining how this can be done using a workaround: #112
Note, that you can also set the w3.Message
Func
and Args
attribute instead of constructing the input data manually using Func.EncodeArgs
.
Understood. The default chain ID for the VM is 1.
You can set a custom chain config using w3vm.WithChainConfig
.
@lmittmann
Yeah, It works.
Just construct an account with bytecode using state, or go with tx message.
w3 is a helperfull project with great structure, But it's also brought along some inconveniences for me.
1,It's missing onSuccess and onFaild callbacks for call functions. Even though I can work around these problems by writing more code, it's just not convenient.
2,It's not compatible with the BSC version of go-eth library.
This one's particularly annoying. If you don't merge the PR, I'll have to keep using my locally modified version with replace.
Also, I haven't found a way yet to modify the blockNumber
within the same VM context.
As I continue to use it, I might come across more issues and post in this thread.
I might have some weird use cases. but communication isn't easy 4 me (I don't speak English).
Currently, I'm working on a scam token detection tool. Some scam tokens set a time bomb, where you can buy and sell tokens at BN1, but you can't sell after BN+n. That's why I'm looking for a way to switch blockNumber within the same context.
I might add a SetBlockNumber
function to w3vm.VM and submit a PR.
/LOL
I might add a SetBlockNumber function to w3vm.VM and submit a PR.
you can set the block number when building the VM using w3vm.WithHeader
or w3vm.WithBlockContext`
1,It's missing onSuccess and onFaild callbacks for call functions. Even though I can work around these problems by writing more code, it's just not convenient.
see https://github.com/lmittmann/w3?tab=readme-ov-file#error-handling
VM
What I mean is, after executing one transaction (TX), then modifying the block number, and finally executing the next transaction. All these operations are carried out within the same context.
hi all~
can anyone give a example code for deploy contract with bytecode in w3vm?
I attempted to set the account state with bytecode, but it didn't run.