I'm trying to test a contract that wrote and compiled, and I need to use another deployed contract to test it. I am writing a test for a specific contract and trying to invoke another deployed contract:

contract('Vault', accounts => {
  it('should be able to see the other contract.', async () => {
    const instance = await Vault.deployed()
    const owner = await instance.admin.call()
    assert.equal(owner, accounts[0], `contract owner was not ${accounts[0]}`)
    console.log(await HumanStandardTokenFactory.deployed())

which should work, but it I get the error:

Error: HumanStandardTokenFactory has not been deployed to detected network (network/artifact mismatch).

I am using the new truffle develop command instead of TestRPC. When I run migrate, I can see the addresses of all the contracts being populated properly. I installed the contract through EthPM. In the truffle console I can even type:

truffle(develop)> HumanStandardTokenFactory.deployed().then(instance => console.log(instance.address))

I'm thinking this has something to do with the "clean-room" environment, but everyone else seems to have gotten past this issue. My migration file is as follows:

const Vault = artifacts.require('./Vault.sol')
const HumanStandardTokenFactory = artifacts.require(

module.exports = function (deployer) {

Is there any way I can get the deployed version of this contract into my tests?

  • With truffle I'd first try removing the build/ folder. And make a deploy again. It just happened too many times that a broken artifact caused tests failures.
    – Ismael
    Commented Nov 16, 2017 at 0:41
  • 1. Do you see HumanStandardTokenFactory.json in your build folder? 2. Do you see "Compiling HumanStandardTokenFactory.." in your console output when you run test?
    – ulu
    Commented Jan 23, 2018 at 12:47
  • @ulu yes to both. I got around it by manually deploying the contracts as part of the test setup.
    – rhlsthrm
    Commented Jan 24, 2018 at 17:30


Your Answer

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