How do I pass my account address to the contract constructor while deploying with truffle migration? I want to pass address into MyAdress like below.

deployer.deploy(MyContract, MyAddress)

My contract looks like this

address payable public admin;
constructor(address payable _admin) {
        admin = _admin;

3 Answers 3


You need to define the address as a constant in the deployment file:

const MyAddress = '0x123...'

deployer.deploy(MyContract, MyAddress)

Refer address to truffle config file is more appropriable.

module.exports = async function(deployer, network, accounts) {
  const deployerAddress = accounts[0];
  await deployer.deploy(Contract, deployerAddress);

You can also decide to just put in the address deployer.deploy(contractName, "addresshere")

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.