0

Usually we have one address initialization in constructor function. And that address becomes owner of the contract. While studying erc721 token and going through several examples online i found ceo and coo addresses being initialized in constructor function. I was wondering what is the point of initializing both of them to same address or is there any way to have different addresses for both of them in constructor through msg.sender.

function xyz() public {
   ceoAddress = msg.sender;
   cooAddress = msg.sender;
}
  • I'm a newbie here.. Can somebody help me what to do on my smart contract? I practice to create a smart contract through youtube the I success but when I try to send to another wallet of my token it failed it says '' cannot locate the transfer event log in the sendr.. but I used the creator addresd as the sender pls help me – Kru John Villanueva Feb 16 '18 at 11:58
0

Yes you can do, In general token has one issuer. So that a reason most of the eg. coders will use for msg.sender as a contract owner. If you want to add multiple address args to contractor to init the data.

For more details refer below code.

contract XYZ{
  address ceoAddress, cooAddress, contractCreator;
  function XYZ(address _ceo, address _coo) public { //One Arg contractor 
   contractCreator = msg.sender;
   ceoAddress = _ceo;
   cooAddress = _coo;
 }
}

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.