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;

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

const MyAddress = '0x123...'

deployer.deploy(MyContract, MyAddress)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.