1

Please excuse this basic question, as I am quite new to this. I created a sample token using OpenZeppelin framework. The token class inherits MintableToken which in turn inherits Ownable. This class has a variable:

address public owner;

which is by default set to msg.sender, but how do i check the address of this owner using web3js/truffle. I've tried this:

coinInstance = testCoin.at("address")
coinInstance.owner

but i only get the following

{ [Function]
  call: [Function],
  sendTransaction: [Function],
  request: [Function: bound ],
  estimateGas: [Function] }
0

I had the same problem, but figured it out! Since owner is a public address, Solidity automatically creates a getter function, which you have to call like so:

coinInstance = testCoin.at("address")
coinInstance.owner()

That will return a Promise that should resolve to the owner address.

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.