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

2
  • How does your truffle.js look like? Please try truffle console --network development.
    – ivicaa
    Commented Mar 5, 2018 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
    Commented Mar 6, 2018 at 7:11

2 Answers 2

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

0

let tulkerSale = await TulkerSale.deployed()

https://trufflesuite.com/docs/truffle/how-to/contracts/interact-with-your-contracts/

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.