I believe that the openzeppelin project have updated their StandardToken smart contract which is now called ERC20.sol.
One issue that I have is that the new smart contract has some missing functionalities that we previously had. In the past, when you imported StandardToken into your smart contract, you would be able to initialize your Token like that:
pragma solidity ^0.4.19;
import "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol";
/**
* @title ExampleToken is a basic ERC20
*/
contract ExampleToken is ERC20, Ownable {
uint256 public totalSupply;
string public name;
string public symbol;
uint32 public decimals;
/**
* @dev assign totalSupply to owner of contract
*/
constructor() public {
symbol = "EXM";
name = "ExampleCoin";
decimals = 4;
totalSupply = 10000000000;
owner = msg.sender;
balances[msg.sender] = totalSupply;
emit Transfer(0x0, msg.sender, totalSupply);
}
}
Because I am using the new smart contract, I can't do this anymore:
balances[msg.sender] = totalSupply;
because I am getting the error since openzeppelin has not implemented it:
DeclarationError: Undeclared identifier. Did you mean "balanceOf"?
balanceOf is obviously not suitable since this is a function returning the balance at a given address.
What's the most suitable way to initialize the balance?
Is it better to send it to owner's address or just leave it in the smart contract? Is there a risk for leaving the balance inside the smart contract and is this procedure widely used?
If I shouldn't leave it in the smart contract, then what's the best way to give the total supply to the contract creator?
Alternatively, is it possible to import previous openzeppelin smart contracts when StandardToken existed?