0

As seen in the screenshot, I deploy a contract named TulkerSale using Ganache. Then in truffle console, TulkerSale.deployed() returns an error...

How can I access the deployed contract in the console?

enter image description here

  • How does your truffle.js look like? Please try truffle console --network development. – ivicaa Mar 5 '18 at 22:35
  • 1
    I managed to access it by using TulkerSale.at('here i copy the contract address which is displayed in the deploy output') – shaharsol Mar 6 '18 at 7:11
1

"TulkerSale" is the name of the contract but it does not represent an instance.

<contractName>.at("<address>")

That will get you the deployed contract account.

at(): Create an instance of MyContract that represents your contract at a specific address. deployed(): Create an instance of MyContract that represents the default address managed by MyContract. new(): Deploy a new version of this contract to the network, getting an instance of MyContract that represents the newly deployed instance.

https://github.com/trufflesuite/truffle-contract

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.