Skip to content

Latest commit

 

History

History
 
 

Ownable

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

The ownable smart contract

The Ownable contract is common smart contract access restriction pattern. In its essence the ownable smart contract allows for a single user to have "super-user" privileges in the context of this smart contract.

How it works?

Upon deployment, the user that deploys the contract is marked as "owner" in the owner variable. The "onlyOwner" function, when executed, throws if the caller of the function is not the "owner". Put onlyOwner into your contract methods to restrict them to the contract owner.

Methods description

  • owner() - returns the address of the contract owner
  • isOwner() - return true if the Call.caller is the contract owner
  • onlyOwner() - throws if the Call.caller is not the contract owner
  • transferOwnership(newOwner: address) - transfers the ownership over a contract, to a new owner specified by the newOwner address. Callable only by the owner
  • renounceOwnership() - Using this method, the owner of the contract can resign from his duties. Callable only by the owner.