Truffle Deployer Account – How to Pass Account Address to Truffle Deployer

contract-developmentdapp-developmenttruffletruffle-deploymenttruffle-migration

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;
}

Best Answer

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

const MyAddress = '0x123...'

deployer.deploy(MyContract, MyAddress)
Related Topic