MENU

Where is DeployedAddresses.sol?

January 11, 2019
0
3434
1

If you are creating test scripts in solidity, you may have come across these import statement:

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/HelloWorld.sol";

The last one is easy to understand because it is your smart contract in the “contracts” folder but what about Assert.sol and DeployedAddresses.sol?

First of all, “truffle” refers to the global truffle repo which can be found at usr/local/lib/node_modules/truffle.

Assert.sol lives at: usr/local/lib/node_modules/truffle/build/Assert.sol

The trick is, what about DeployedAddresses.sol? You won’t find this file in the global truffle repo and a terminal search will be chocolateless fruitless.

The reason is because this file is dynamically created at test time. (Kindalike the geth.ipc file that gets generated when geth is running but disappears when geth is stopped).

“truffle” is a meta package, ie “these packages do not contain actual software, they simply depend on other packages to be installed“. In fact, if you look at the deploy.js source code, you’ll see the DeployedAddresses file get created via the code.

Source:

  • https://github.com/trufflesuite/truffle/issues/471
  • https://github.com/trufflesuite/truffle-core/blob/b3ad375993ec42bc622c7674258edc7614944482/lib/testing/deployed.js
  • https://askubuntu.com/questions/66257/what-is-the-difference-between-a-meta-package-and-a-package

Leave a Comment!

Your email address will not be published. Required fields are marked *