nibiru-ownable
Utility for single-party ownership of CosmWasm smart contracts.
nibiru-ownable provides a comprehensive ownership management system for CosmWasm smart contracts, inspired by OpenZeppelin's Ownable pattern for Ethereum. It implements a two-phase ownership transfer mechanism with optional expiration deadlines, designed for the CosmWasm execution model.
How to use
Initialize the owner during instantiation using the initialize_owner method provided by this crate:
use ;
use OwnershipError;
Use the #[ownable_execute] macro to extend your execute message:
use cw_serde;
use ownable_execute;
The macro inserts a new variant, UpdateOwnership to the enum:
Where nibiru_ownable::Action is an enum with three variants:
Action::TransferOwnership { new_owner: String, expiry: Option<Expiration> }- Propose to transfer ownership with optional deadlineAction::AcceptOwnership- Accept the proposed ownership transferAction::RenounceOwnership- Renounce ownership permanently, setting the contract's owner to None
Handle the messages using the update_ownership function provided by this crate:
use ;
use ;
Use the #[ownable_query] macro to extend your query message:
use ;
use ownable_query;
The macro inserts a new variant, Ownership:
Handle the message using the get_ownership function provided by this crate:
use ;
use get_ownership;
Core Types
nibiru_ownable::Ownership<T>- Struct containing current owner, pending owner, and expirynibiru_ownable::Action- Enum for ownership management actionsnibiru_ownable::OwnershipError- Error types for ownership operations
Documentation
For detailed API documentation, visit docs.rs/nibiru-ownable.
License
Contents of this crate at or prior to version 0.5.0 are published under GNU Affero General Public License v3 or later; contents after the said version are published under Apache-2.0 license.