Skip to content

Commit

Permalink
Update ownership libs for SRC-5 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bitzoic committed Nov 10, 2023
1 parent 1758a6f commit d09a579
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion libs/ownership/src/ownable.sw
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 8 additions & 8 deletions tests/src/ownership/src/main.sw
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
contract;

use ownership::*;
use src_5::{Ownership, State};
use src_5::{SRC5, State};

storage {
owner: Ownership = Ownership::uninitialized(),
Expand All @@ -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)]
Expand All @@ -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)]
Expand Down

0 comments on commit d09a579

Please sign in to comment.