Every time I run truffle test
in the terminal, I encounter the following error message:
Error: Attempting to run a transaction which calls a contract function, but the recipient address 0x3ad2c00512808bd7fafa6dce844a583621f3df87 is not a contract address
. I find this puzzling because my build
folder appears to be normal. When I execute truffle migrate --reset
, the address in the terminal matches the address in the build file. The migration process works fine. However, each time I run the truffle test, the recipient address seems to change. I'm unsure of what steps to take next and would appreciate any assistance.
It is worth mentioning that this error occurs only when I implement the following code: selfdestruct(admin);
. In this scenario, the admin is equal to msg.sender, which refers to the initial account in the ganache setup. I'm at a loss as to what might be causing this issue.
I have been following this tutorial video. While I successfully completed all the previous tutorials by this individual, I am now stuck at minute 15:11, where he carries out the final test without any issues. Unfortunately, for me, it results in the error mentioned above.
If anyone has a solution, I would greatly appreciate the assistance.
Here is my test (javascript):
var CinoCoin = artifacts.require("./CinoCoin.sol");
var CinoCoinSale = artifacts.require("./CinoCoinSale.sol");
// Contract testing code continues below...
And here is the contract code (solidity):
pragma solidity ^0.4.23;
import "./CinoCoin.sol";
contract CinoCoinSale {
// Contract implementation goes here...
}
When I comment out the selfdestruct(admin);
line, the tests pass without any issues. This indicates that the problem might be related to that particular line. Your help is much appreciated. Thank you.