Skip to main content

owner

Function owner 

Source
pub fn owner() -> Result<AccountId>
Expand description

Returns the account ID of the contract owner.

The owner is set at deployment time and can be transferred via ownership transfer mechanisms. Typically used for access control.

§Returns

The 32-byte account ID of the contract owner.

§Example

let owner = context::owner()?;
let caller = context::caller()?;
 
if caller != owner {
    return Err(Error::new(ERR_NOT_OWNER));
}