Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.5.11;
- contract Bitmonds_one_main_Owner {
- //parameter--------------------------------------------------------------------------------------------
- mapping(address => bool) private authorized;
- mapping(string => string) public registry_bitmonds;
- mapping(string => string) public registry_bitmonds_vip;
- mapping(string => string) public registry_bitmonds_LimitedEdition;
- mapping(string => string) public registry_bitmonds_Special;
- address private owner;
- //event-------------------------------------------------------------------------------------------
- event AddedOwner(address newOwner);
- event RemovedOwner(address removedOwner);
- event transferMain_owner(address new_main_owner);
- //function for admin-------------------------------------------------------------------------------------------
- function addAuthorized(address _toAdd) onlyAuthorized() public
- {
- require(!authorized[_toAdd],"This owner already exists");
- authorized[_toAdd] = true;
- emit AddedOwner(_toAdd);
- }
- function removeAuthorized(address _toRemove) onlyAuthorized() public
- {
- require(_toRemove != msg.sender && _toRemove != owner,"You cannot remove yourself or main owner");
- authorized[_toRemove] = false;
- emit RemovedOwner(_toRemove);
- }
- function transferOwnership_Creator(address newOwner) public onlyCreator()
- {
- owner = newOwner;
- emit transferMain_owner(newOwner);
- }
- function check_creator(address _admin) public view returns(bool Creator)
- {
- return(owner == _admin);
- }
- function check_autorized(address _admin) public view returns(bool authorize)
- {
- return(authorized[_admin]);
- }
- //modifier-------------------------------------------------------------------------------------------
- modifier onlyAuthorized()
- {
- require(authorized[msg.sender] || msg.sender == owner, "You are not Authorized!");
- _;
- }
- modifier onlyCreator()
- {
- require(msg.sender == owner);
- _;
- }
- //constructor-------------------------------------------------------------------------------------------
- constructor() public
- {
- owner = msg.sender;
- }
- //write--------------------------------------------------------------------------------------------------
- //in questa funzione รจ stato inserito "onlyAuthorized" per permettere la scrittura solo dal wallet autorizzato
- function push_Bitmonds(string memory Bitmond,string memory Owners) public onlyAuthorized
- {
- registry_bitmonds[Bitmond]= Owners;
- }
- function push_Bitmonds_Vip(string memory Bitmond,string memory Owners) public onlyAuthorized
- {
- registry_bitmonds_vip[Bitmond]= Owners;
- }
- function push_Bitmonds_LimitedEdition(string memory Bitmond,string memory Owners) public onlyAuthorized
- {
- registry_bitmonds_LimitedEdition[Bitmond]= Owners;
- }
- function push_Bitmonds_Special(string memory Bitmond,string memory Owners) public onlyAuthorized
- {
- registry_bitmonds_Special[Bitmond]= Owners;
- }
- //read------------------------------------------------------------------------------------------------------------
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement