Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. pragma solidity ^0.5.0;
  2.  
  3. import "openzeppelin-eth/contracts/ownership/Ownable.sol";
  4.  
  5. /**
  6. * @title ERC20Storage
  7. */
  8. contract ERC20Storage is Ownable {
  9. string private _name;
  10. string private _symbol;
  11.  
  12. uint256 private _totalSupply;
  13. mapping(address => uint256) private _balances;
  14. mapping(address => mapping(address => uint256)) private _allowances;
  15.  
  16. /*****************************/
  17. /* Getters */
  18. /*****************************/
  19.  
  20. function getName() public view returns (string memory) {
  21. return _name;
  22. }
  23. function getSymbol() public view returns (string memory) {
  24. return _symbol;
  25. }
  26. function getTotalSupply() public view returns (uint256) {
  27. return _totalSupply;
  28. }
  29. function getBalance(address account) public view returns (uint256) {
  30. return _balances[account];
  31. }
  32. function getAllowances(address owner, address spender)
  33. public
  34. view
  35. returns (uint256)
  36. {
  37. return _allowances[owner][spender];
  38. }
  39.  
  40. /*****************************/
  41. /* Setters */
  42. /*****************************/
  43.  
  44. function setName(string memory name) public onlyOwner returns (bool) {
  45. _name = name;
  46. return true;
  47.  
  48. }
  49. function setSymbol(string memory symbol) public onlyOwner returns (bool) {
  50. _symbol = symbol;
  51. return true;
  52.  
  53. }
  54. function setTotalSupply(uint256 totalSupply)
  55. public
  56. onlyOwner
  57. returns (bool)
  58. {
  59. _totalSupply = totalSupply;
  60. return true;
  61.  
  62. }
  63. function setBalance(address account, uint256 value)
  64. public
  65. onlyOwner
  66. returns (bool)
  67. {
  68. _balances[account] = value;
  69. return true;
  70.  
  71. }
  72. function setAllowances(address owner, address spender, uint256 value)
  73. public
  74. onlyOwner
  75. returns (bool)
  76. {
  77. _allowances[owner][spender] = value;
  78. return true;
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement