Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.5.0;
- import "openzeppelin-eth/contracts/ownership/Ownable.sol";
- /**
- * @title ERC20Storage
- */
- contract ERC20Storage is Ownable {
- string private _name;
- string private _symbol;
- uint256 private _totalSupply;
- mapping(address => uint256) private _balances;
- mapping(address => mapping(address => uint256)) private _allowances;
- /*****************************/
- /* Getters */
- /*****************************/
- function getName() public view returns (string memory) {
- return _name;
- }
- function getSymbol() public view returns (string memory) {
- return _symbol;
- }
- function getTotalSupply() public view returns (uint256) {
- return _totalSupply;
- }
- function getBalance(address account) public view returns (uint256) {
- return _balances[account];
- }
- function getAllowances(address owner, address spender)
- public
- view
- returns (uint256)
- {
- return _allowances[owner][spender];
- }
- /*****************************/
- /* Setters */
- /*****************************/
- function setName(string memory name) public onlyOwner returns (bool) {
- _name = name;
- return true;
- }
- function setSymbol(string memory symbol) public onlyOwner returns (bool) {
- _symbol = symbol;
- return true;
- }
- function setTotalSupply(uint256 totalSupply)
- public
- onlyOwner
- returns (bool)
- {
- _totalSupply = totalSupply;
- return true;
- }
- function setBalance(address account, uint256 value)
- public
- onlyOwner
- returns (bool)
- {
- _balances[account] = value;
- return true;
- }
- function setAllowances(address owner, address spender, uint256 value)
- public
- onlyOwner
- returns (bool)
- {
- _allowances[owner][spender] = value;
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement