Libraries
@stdlib/ownable

@stdlib/ownable

This library provides a contract traits for ownable contracts. This is most commonly used trait that is required by most other traits.

Ownable

This trait declares an owner (non-editable) of a contract, provides a helper function requireOwner() that checks that a message was sent by an owner.

Ownable trait requires a field owner: Address to be declared and exposes get-method owner to read it from the contract.

Usage

import "@stdlib/ownable";
 
contract ExampleContract with Ownable {
    
    owner: Address;
    
    init(owner: Address) {
        self.owner = owner;
    }
}

OwnableTransferable

OwnableTransferable is an extension of an Ownable that allows to transfer ownership of a contract to another address. It provides a secure handle ChangeOwner that could be called by an owner to transfer ownership.

Usage

import "@stdlib/ownable";
 
contract ExampleContract with OwnableTransferable {
    
    owner: Address;
    
    init(owner: Address) {
        self.owner = owner;
    }
}