0

I have been using Remix for developing my dapp but decided I should use Truffle to make things a little more robust and professional. I have truffle and ganache installed. I run

truffle migrate

and get the following results:

enter image description here

The Ganache output looks like this:

enter image description here

The migration script looks like:

var Collateral = artifacts.require('Collateral');

module.exports = function(deployer) {
  deployer.deploy(Collateral);
};

This contract is one of many contracts in the file DirectLending.SOL which is stored in the contracts directory.

My understanding of truffle migrate is that so long as the contract file is in the contracts directory, it will be compiled and the contract should be findable by truffle.

I also tried to create a single file collateral.sol with just the Collateral contract in it and that also did not work.

Can anyone please help me?

Thanks!

Phil

  • Thanks Alberto. I changed the code as you suggested but nothing changes and I still get the message "Could not find artifacts for Collateral from any sources". Any other suggestions? – Philip Rutovitz Jun 30 at 19:42
  • Sorry, I deleted my previous comment. Have you tried truffle migrate --reset? – alberto Jun 30 at 19:49
  • Thanks, I tried it but it still does not work. What else could be wrong? – Philip Rutovitz Jun 30 at 19:52
  • It appears to think it has compiled the contracts. The stage where it's bombing is where it would take the compiled contracts and deploy them. Question is where are the contracts being output to? Search your project for Collateral.json. I don't know how your project has been set up, but I ran into an issue with it where I had to configure a new output folder for contracts so react-create-app could build an app that has access to the contract abi. In case it helps: ethereum.stackexchange.com/a/60575/44463 – Cliff Hall Jun 30 at 20:46
  • Another thought: If the Collateral contract is extended (with is) by another contract in the system, then there won't be a separate file for it in the output. When you put Collateral into its own file, what was the error? Does it extend another contract? It would be useful to know the contract hierarchy (if there is one). – Cliff Hall Jun 30 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.