Skip to content

Commit

Permalink
refactor: add LSP1 hook in renounceOwnership(..)
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Aug 8, 2023
1 parent d183909 commit 767675b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,16 @@ abstract contract LSP0ERC725AccountCore is
// Depending on the magicValue returned, a second call is done after transferring ownership
bool verifyAfter = _verifyCall(_owner);

// set the pending owner
address previousOwner = owner();
LSP14Ownable2Step._renounceOwnership();

if (owner() == address(0)) {
previousOwner.tryNotifyUniversalReceiver(
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
""
);
}

// If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
// The transferOwnership function does not return, second parameter of {_verifyCallResult} will be empty
if (verifyAfter) {
Expand Down
8 changes: 8 additions & 0 deletions contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
override(OwnableUnset, ILSP14Ownable2Step)
onlyOwner
{
address previousOwner = owner();
_renounceOwnership();

if (owner() == address(0)) {
previousOwner.tryNotifyUniversalReceiver(
_TYPEID_LSP14_OwnershipTransferred_SenderNotification,
""
);
}
}

// --- Internal methods
Expand Down
8 changes: 8 additions & 0 deletions contracts/LSP9Vault/LSP9VaultCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,15 @@ contract LSP9VaultCore is
override(LSP14Ownable2Step, OwnableUnset)
onlyOwner
{
address previousOwner = owner();
LSP14Ownable2Step._renounceOwnership();

if (owner() == address(0)) {
previousOwner.tryNotifyUniversalReceiver(
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
""
);
}
}

/**
Expand Down

0 comments on commit 767675b

Please sign in to comment.