#[smart_beaver::extension] pub mod ownable_extension { use crate::traits::Ownable; use crate::errors::OwnableError; #[smart_beaver::storage] pub struct Token { #[smart_beaver::init(Some(Self::env().caller()))] pub owner: Option, } impl Ownable for Token { #[ink(message)] fn owner(&self) -> Option { self.owner } #[ink(message)] fn renounce_ownership(&mut self) -> Result<(), OwnableError> { assert_eq!(Some(self.env().caller()), self.owner, "Only owner can renounce ownership"); self.owner = None; Ok(()) } #[ink(message)] fn transfer_ownership(&mut self, new_owner: Option) -> Result<(), OwnableError> { assert_eq!(Some(self.env().caller()), self.owner, "Only owner can transfer ownership"); self.owner = new_owner; Ok(()) } } }