Open djkampus opened 1 year ago
Thanks @djkampus for raising this issue!
The reason Ganache cannot show the deployment / decoded information from the Contract or Event, is because when truffle runs tests it does not persist the artifacts that Ganache needs in order to associate the emitted events and deployed contracts.
This is because Truffle uses evm_snapshot
and evm_revert
to restore the state of the blockchain to the initial state before the tests are run, so any artifacts persisted would be meaningless.
There is an issue in Ganache UI here, as Transactions created and Events emitted during the time that is reverted should either be marked as reverted
or should be removed - I'm keen to hear if you have ideas on how this could be made more obvious and useful.
If you are wanting to see the details of the event, and state of the contract, you could encode the deployment into your migration script, and setup your tests in such a way that they interact with the contracts deployed during the migration step.
You can do this in your test with something like:
const MyContract = artifacts.require("MyContract");
const myContractDeployedAddress = "0x76c9329635AcCD7079F7E7e75193fa46D73cE20b"; // from migration
contract("MyContract", async (accounts) => {
const myContractInstance = new MyContract(myContractDeployedAddress);
...
});
Running truffle migrate
will deploy the contract (after which they should appear as deployed in Ganache UI), and then truffle test
will interact with that deployed instance - meaning you should be able to see the state, and decode the events.
This might not be a viable solution for you in the long term, depending on the workflow you have setup, but hopefully gives you enough context to workaround the issue.
Let me know whether this works or not, and I can check in with the rest of the team to figure out how to solve this.
Cheers
Expected Behavior
event can be decoded instead .
Current Behavior
when i open the event of the transaction, they cannot decode what event emits there. i have already bind my truffle-config to make sure i am not misconfigured.
Steps to Reproduce (for bugs)
1.run ganache and make sure they are set up correctly 2.start truffle test --network ganache(to ganache GUI instead of build-in) 3.transaction done 4.checking transaction block and they're appear. but no more explanation about the event i working with
Context
i need to check my log event related my working development. but they just give me message to linked my truffle-config. but i've already linked them. to make it even worse they not detected my contract already deployed also. but i can retrace which transaction is contract deployment.
Your Environment