We have 2 migrations files (2,3) and in 2 we are deploying singletons contracts which later be used in the contracts we deploy on migrations file number 3.

How Truffle pass the address of the contract deployed on file 2 so the contracts that deploy on file 3 will use them as part of the deployment.

where I can the addresses of the deployed contracts?

1 Answer 1


The truffle migrate (aka truffle deploy) command executes the scripts inside the migration folder by alphabetic order (only those whose names start with a number).

Each one of these scripts should consist of:

module.exports = function(deployer, network, accounts) {

Truffle passes the deployer object to each one of these scripts, and this object "accumulates" the addresses of every contract deployed "along the way".

Thus, the deployer allows you to deploy contracts, as well as to retrieve the addresses of already-deployed contracts.

The documentation for it can be found here, and with more details here.

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.