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?
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?
Found the source generator in Truffle Core https://github.com/trufflesuite/truffle-core/blob/b3ad375993ec42bc622c7674258edc7614944482/lib/testing/deployed.js
@VoR0220 see also https://github.com/trufflesuite/truffle/issues/237#issuecomment-307609421
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:
You include
DeployedAddresses.solin your tests by importingtruffle/DeployedAddresses.sol. Here,truffleis a meta package that may include dynamically created contracts likeDeployedAddresses.Let me know if this helps. Thanks!