Truffle: Where can I find the DeployedAddresses.sol file?

Created on 29 Jun 2017  路  4Comments  路  Source: trufflesuite/truffle

I cannot find the DeployedAddresses.sol file. It's not in the global truffle repo /usr/local/lib/node_modules/truffle. It's not in the folder created by truffle init. It's not in the Git repo https://github.com/trufflesuite/truffle.

Where can I find the DeployedAddresses.sol file?

question

Most helpful comment

Hi there,

This file is dynamically created at test time. When you run your tests. Truffle creates this file depending on which contracts are deployed. Its contents looks something like this:

contract DeployedAddresses {
  function MetaCoin() returns (address) {
    return 0x...; // address is hardcoded
  }
  // If there are more contracts deployed, they'll be included as well.
}

You include DeployedAddresses.sol in your tests by importing truffle/DeployedAddresses.sol. Here, truffle is a meta package that may include dynamically created contracts like DeployedAddresses.

Let me know if this helps. Thanks!

All 4 comments

Hi there,

This file is dynamically created at test time. When you run your tests. Truffle creates this file depending on which contracts are deployed. Its contents looks something like this:

contract DeployedAddresses {
  function MetaCoin() returns (address) {
    return 0x...; // address is hardcoded
  }
  // If there are more contracts deployed, they'll be included as well.
}

You include DeployedAddresses.sol in your tests by importing truffle/DeployedAddresses.sol. Here, truffle is a meta package that may include dynamically created contracts like DeployedAddresses.

Let me know if this helps. Thanks!

@tcoulter what if I wanted to test a factory of contracts and pick and choose from which ones to run tests on? How would I best organize this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TOMOAKI12345 picture TOMOAKI12345  路  3Comments

maximilianh picture maximilianh  路  3Comments

rjl493456442 picture rjl493456442  路  4Comments

ripper234 picture ripper234  路  4Comments

abcoathup picture abcoathup  路  3Comments