5

I opened truffle console and when I type my contract's name, I see a very long message on the console but not sure How do I deploy the contract and find the deployed contract address. Kindly advise.

0

2 Answers 2

13
$truffle console
truffle(development)>compile
truffle(development)>migrate
truffle(development)>contract_name.new().then(function(res) { sc = contract_name.at(res.address) })
truffle(development)>sc.address 
2

For anyone coming here and using Truffle v5+, use .address after a call to await ContractName.new(). For example:

some_erc20_contract_instance = await ERC20.new()
console.log(`address: ${some_erc20_contract_instance.address}`)

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.