3

The folder structure is as follows:

Examples
  |
  +- Multiply
  |        +- Solidity
  |                 +- contracts
  |                           +- MultiplyContract.sol
  |
  +- UUIDProvider
               +- Solidity
                        +- contracts
                                  +- UUIDProviderContract.sol

And I want to test the (main) contract : MultiplyContract.sol

The migrations\2_deploy_contracts.js file looks like this:

var UUIDProviderContract = artifacts.require("../../UUIDProvider/Solidity/contracts/UUIDProviderContract.sol");
var MultiplyContract = artifacts.require("MultiplyContract");

module.exports = function (deployer) {
    deployer.deploy(UUIDProviderContract);

    var multiplier = 4;
    deployer.deploy(MultiplyContract, multiplier);
};

However when running truffle test, I get this error:

Compiling .\contracts\Migrations.sol...
Compiling .\contracts\MultiplyContract.sol...
Compiling .\test\TestMultiplyContract.sol...
Compiling truffle/Assert.sol...
Compiling truffle/DeployedAddresses.sol...
C:\SmartContracts\Examples\Multiply\Solidity\node_modules\truffle\build\cli.bundled.js:63556
  throw new Error("Could not find artifacts for " + import_path + " from any sources");



So how to include the UUIDProviderContract.sol ?

Or is this not possible and should I copy this to the same location as MultiplyContract.sol?

1 Answer 1

2

Truffle looks for contract folder and compile all the contracts under it and sub folders.

artifacts.require();

should refer to compiled Contract not the sol file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.