Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. pragma solidity ^0.5.11;
  2.  
  3.  
  4. contract Bitmonds_one_main_Owner {
  5.  
  6.  
  7.  
  8. //parameter--------------------------------------------------------------------------------------------
  9.  
  10.  
  11.  
  12.  
  13. mapping(address => bool) private authorized;
  14. mapping(string => string) public registry_bitmonds;
  15. mapping(string => string) public registry_bitmonds_vip;
  16. mapping(string => string) public registry_bitmonds_LimitedEdition;
  17. mapping(string => string) public registry_bitmonds_Special;
  18.  
  19.  
  20. address private owner;
  21.  
  22.  
  23.  
  24. //event-------------------------------------------------------------------------------------------
  25.  
  26.  
  27.  
  28.  
  29.  
  30. event AddedOwner(address newOwner);
  31. event RemovedOwner(address removedOwner);
  32. event transferMain_owner(address new_main_owner);
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. //function for admin-------------------------------------------------------------------------------------------
  40.  
  41.  
  42. function addAuthorized(address _toAdd) onlyAuthorized() public
  43. {
  44. require(!authorized[_toAdd],"This owner already exists");
  45. authorized[_toAdd] = true;
  46. emit AddedOwner(_toAdd);
  47. }
  48.  
  49. function removeAuthorized(address _toRemove) onlyAuthorized() public
  50. {
  51. require(_toRemove != msg.sender && _toRemove != owner,"You cannot remove yourself or main owner");
  52. authorized[_toRemove] = false;
  53. emit RemovedOwner(_toRemove);
  54. }
  55.  
  56. function transferOwnership_Creator(address newOwner) public onlyCreator()
  57. {
  58.  
  59. owner = newOwner;
  60. emit transferMain_owner(newOwner);
  61.  
  62. }
  63.  
  64. function check_creator(address _admin) public view returns(bool Creator)
  65. {
  66. return(owner == _admin);
  67. }
  68.  
  69. function check_autorized(address _admin) public view returns(bool authorize)
  70. {
  71. return(authorized[_admin]);
  72. }
  73.  
  74.  
  75. //modifier-------------------------------------------------------------------------------------------
  76.  
  77.  
  78.  
  79. modifier onlyAuthorized()
  80. {
  81. require(authorized[msg.sender] || msg.sender == owner, "You are not Authorized!");
  82. _;
  83. }
  84.  
  85. modifier onlyCreator()
  86. {
  87. require(msg.sender == owner);
  88. _;
  89. }
  90.  
  91.  
  92.  
  93.  
  94. //constructor-------------------------------------------------------------------------------------------
  95.  
  96.  
  97.  
  98. constructor() public
  99. {
  100. owner = msg.sender;
  101.  
  102. }
  103.  
  104.  
  105.  
  106.  
  107. //write--------------------------------------------------------------------------------------------------
  108.  
  109.  
  110.  
  111. //in questa funzione รจ stato inserito "onlyAuthorized" per permettere la scrittura solo dal wallet autorizzato
  112. function push_Bitmonds(string memory Bitmond,string memory Owners) public onlyAuthorized
  113. {
  114.  
  115. registry_bitmonds[Bitmond]= Owners;
  116.  
  117. }
  118.  
  119. function push_Bitmonds_Vip(string memory Bitmond,string memory Owners) public onlyAuthorized
  120. {
  121.  
  122. registry_bitmonds_vip[Bitmond]= Owners;
  123.  
  124. }
  125.  
  126. function push_Bitmonds_LimitedEdition(string memory Bitmond,string memory Owners) public onlyAuthorized
  127. {
  128.  
  129. registry_bitmonds_LimitedEdition[Bitmond]= Owners;
  130.  
  131. }
  132.  
  133. function push_Bitmonds_Special(string memory Bitmond,string memory Owners) public onlyAuthorized
  134. {
  135.  
  136. registry_bitmonds_Special[Bitmond]= Owners;
  137.  
  138. }
  139.  
  140.  
  141.  
  142. //read------------------------------------------------------------------------------------------------------------
  143.  
  144.  
  145.  
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement