Skip to content

[style] ERC173: emit OwnershipTransferred after updating owner state #51

@CodeCryptX

Description

@CodeCryptX

**### Summary
Both facet and library emit the OwnershipTransferred event before updating the stored owner variable. Emitting events after the state change is the conventional pattern and reduces cognitive load for auditors.

Suggested change

Change ordering from:

emit OwnershipTransferred(s.owner, _newOwner);
s.owner = _newOwner;

to:

address previousOwner = s.owner;
s.owner = _newOwner;
emit OwnershipTransferred(previousOwner, _newOwner);**

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions