Skip to content

Commit

Permalink
ref: improvements to Ownable2Step (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
bidzyyys authored Nov 14, 2024
1 parent 17f74d2 commit 3405f76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions contracts/src/access/ownable_two_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ sol! {
address indexed new_owner
);

/// Emitted when ownership gets transferred between accounts.
///
/// * `previous_owner` - Address of the previous owner.
/// * `new_owner` - Address of the new owner.
event OwnershipTransferred(
address indexed previous_owner,
address indexed new_owner
);
}

/// An error that occurred in the implementation of an [`Ownable2Step`]
Expand Down Expand Up @@ -126,7 +118,7 @@ pub trait IOwnable2Step {
///
/// # Events
///
/// Emits a [`OwnershipTransferred`] event.
/// Emits a [`crate::access::ownable::OwnershipTransferred`] event.
fn accept_ownership(&mut self) -> Result<(), Self::Error>;

/// Leaves the contract without owner. It will not be possible to call
Expand All @@ -144,7 +136,7 @@ pub trait IOwnable2Step {
///
/// # Events
///
/// Emits a [`OwnershipTransferred`] event.
/// Emits a [`crate::access::ownable::OwnershipTransferred`] event.
fn renounce_ownership(&mut self) -> Result<(), Self::Error>;
}

Expand Down Expand Up @@ -210,7 +202,7 @@ impl Ownable2Step {
///
/// # Events
///
/// Emits a [`OwnershipTransferred`] event.
/// Emits a [`crate::access::ownable::OwnershipTransferred`] event.
fn _transfer_ownership(&mut self, new_owner: Address) {
self._pending_owner.set(Address::ZERO);
self._ownable._transfer_ownership(new_owner);
Expand Down
4 changes: 2 additions & 2 deletions examples/ownable-two-step/tests/ownable_two_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ async fn overwrite_previous_transfer_ownership(
let contract = Ownable2Step::new(contract_addr, &alice.wallet);

let receipt = receipt!(contract.transferOwnership(bob_addr))?;
assert!(receipt.emits(OwnershipTransferred {
assert!(receipt.emits(OwnershipTransferStarted {
previousOwner: alice_addr,
newOwner: bob_addr,
}));

let receipt = receipt!(contract.transferOwnership(charlie_addr))?;
assert!(receipt.emits(OwnershipTransferred {
assert!(receipt.emits(OwnershipTransferStarted {
previousOwner: alice_addr,
newOwner: charlie_addr,
}));
Expand Down

0 comments on commit 3405f76

Please sign in to comment.