From d09a5798f39b5edafdcb3629e8916066eb0ccc89 Mon Sep 17 00:00:00 2001 From: bitzoic Date: Fri, 10 Nov 2023 13:08:37 +0300 Subject: [PATCH] Update ownership libs for SRC-5 updates --- libs/ownership/src/ownable.sw | 6 +++++- tests/src/ownership/src/main.sw | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libs/ownership/src/ownable.sw b/libs/ownership/src/ownable.sw index 3ce2d030..1d17323d 100644 --- a/libs/ownership/src/ownable.sw +++ b/libs/ownership/src/ownable.sw @@ -6,7 +6,11 @@ pub mod events; use errors::AccessError; use events::{OwnershipRenounced, OwnershipSet, OwnershipTransferred}; use std::{auth::msg_sender, hash::sha256, storage::storage_api::{read, write}}; -use src_5::{Ownership, State}; +use src_5::State; + +pub struct Ownership { + state: State, +} impl Ownership { /// Returns the `Ownership` struct in the `Uninitalized` state. diff --git a/tests/src/ownership/src/main.sw b/tests/src/ownership/src/main.sw index 946c5e89..faa3b03f 100644 --- a/tests/src/ownership/src/main.sw +++ b/tests/src/ownership/src/main.sw @@ -1,7 +1,7 @@ contract; use ownership::*; -use src_5::{Ownership, State}; +use src_5::{SRC5, State}; storage { owner: Ownership = Ownership::uninitialized(), @@ -10,8 +10,6 @@ storage { abi OwnableTest { #[storage(read)] fn only_owner(); - #[storage(read)] - fn owner() -> State; #[storage(read, write)] fn renounce_ownership(); #[storage(read, write)] @@ -20,15 +18,17 @@ abi OwnableTest { fn transfer_ownership(new_owner: Identity); } -impl OwnableTest for Contract { +impl SRC5 for Contract { #[storage(read)] - fn only_owner() { - storage.owner.only_owner(); + fn owner() -> State { + storage.owner.owner() } +} +impl OwnableTest for Contract { #[storage(read)] - fn owner() -> State { - storage.owner.owner() + fn only_owner() { + storage.owner.only_owner(); } #[storage(read, write)]