Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity 0.4.24;
  2. contract SecretClub {
  3.     address owner;
  4.     mapping (address => bool) authorized;
  5.     modifier onlyAuthorized()
  6.     {
  7.         require(authorized[msg.sender]);
  8.         _;
  9.     }
  10.     modifier onlyOwner()
  11.     {
  12.         require(owner == msg.sender);
  13.         _;
  14.     }
  15.    
  16.     constructor() public {
  17.         owner = msg.sender;
  18.     }
  19.    
  20.     function authorize(address[] _addressesToAuthorize) public onlyOwner {
  21.         // Add to the list of authorized addresses
  22.         for (uint i=0; i<_addressesToAuthorize.length; i++) {
  23.             authorized[_addressesToAuthorize[i]] = true;
  24.         }
  25.     }
  26.    
  27.     function deauthorize(address[] _addressesToDeauthorize) public onlyOwner {
  28.         // Remove from the list of authorized addresses
  29.         for (uint i=0; i<_addressesToDeauthorize.length; i++) {
  30.             authorized[_addressesToDeauthorize[i]] = false;
  31.         }
  32.     }
  33.    
  34.     function doAwesomeThings() public onlyAuthorized
  35.     {
  36.         // Only super awesome authorized people can do this
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement