Timeline for Function not working on Truffle, but works on Remix
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 10, 2022 at 7:19 | comment | added | Kirienzo Eth | You can also tell Remix to connect to your Ganache and try to deploy the contract from there. It could tell you if the problem is with the truffle console, or with the truffle deployment. Although generating a different ABI from the same code is kinda weird, so it's probably the latter. | |
Jan 10, 2022 at 5:52 | comment | added | cruise_lab | Okay, an interesting find. I noticed that the ABI generated using truffle is quite different from the ABI generated using Remix. Not sure if that matters. But I am now trying to use the web3.eth.Contract API to deploy the contract in the client code rather than using Truffle, and see what happens | |
Jan 10, 2022 at 5:40 | comment | added | cruise_lab | Yeah, I am using truffle console. This is the command that I used TradeCoin.deployed().then(function(instance) { instance.purchaseItem(1); }); | |
Jan 10, 2022 at 5:24 | comment | added | Kirienzo Eth | Are you using the Truffle console to communicate with your contract? If yes, can you paste what command do you write? | |
Jan 10, 2022 at 5:06 | comment | added | cruise_lab | Yeah, I checked. They are the same, version 0.8.10. I added the truffle config in the question | |
Jan 10, 2022 at 5:00 | comment | added | Kirienzo Eth | Did you check the solidity version of your Truffle config? Is it the same (at least the major version) as the one you used in Remix? Providing your truffle config could help as well in this case | |
Jan 10, 2022 at 4:27 | comment | added | cruise_lab | Alright, updated the question to include the migration code, its p simple. I don't have any tests. Maybe I should write some. | |
Jan 10, 2022 at 4:16 | comment | added | Kirienzo Eth | True. Can you add a bit more details about your Truffle migration/test? If it works with both of us on Remix but it does not on Truffle, the issue is probably in there. | |
Jan 10, 2022 at 3:14 | comment | added | cruise_lab | Good catch. But even if I did purchaseItem(1), it still does not work. Also, doesn't seem to explain why buyItem, which is an empty function would cause erroring out. | |
S Jan 10, 2022 at 2:38 | review | First answers | |||
Jan 13, 2022 at 15:25 | |||||
S Jan 10, 2022 at 2:38 | history | answered | Kirienzo Eth | CC BY-SA 4.0 |