Skip to content

Commit

Permalink
Add more events
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Oct 14, 2024
1 parent e99af3c commit 63040e9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/contracts/src/utils/ECDSAOwnedDKIMRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ contract ECDSAOwnedDKIMRegistry is
string public constant SET_PREFIX = "SET:";
string public constant REVOKE_PREFIX = "REVOKE:";

event SignerChanged(address indexed oldSigner, address indexed newOwner);

constructor() {}

/// @notice Initializes the contract with a predefined signer and deploys a new DKIMRegistry.
Expand Down Expand Up @@ -159,7 +161,9 @@ contract ECDSAOwnedDKIMRegistry is
function changeSigner(address _newSigner) public onlyOwner {
require(_newSigner != address(0), "Invalid signer");
require(_newSigner != signer, "Same signer");
address oldSigner = signer;
signer = _newSigner;
emit SignerChanged(oldSigner, _newSigner);
}

/// @notice Upgrade the implementation of the proxy.
Expand Down
9 changes: 9 additions & 0 deletions packages/contracts/src/utils/ForwardDKIMRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ contract ForwardDKIMRegistry is
{
IDKIMRegistry public sourceDKIMRegistry;

event sourceDKIMRegistryChanged(
address indexed oldRegistry,
address indexed newRegistry
);
event StorageReset(address indexed sourceDKIMRegistry);

constructor() {}

/// @notice Initializes the contract with a predefined signer and deploys a new DKIMRegistry.
Expand Down Expand Up @@ -57,7 +63,9 @@ contract ForwardDKIMRegistry is
_newSourceDKIMRegistry != address(this),
"Cannot set self as source DKIMRegistry"
);
address oldRegistryAddr = address(sourceDKIMRegistry);
sourceDKIMRegistry = IDKIMRegistry(_newSourceDKIMRegistry);
emit sourceDKIMRegistryChanged(oldRegistryAddr, _newSourceDKIMRegistry);
}

/// @notice Upgrade the implementation of the proxy from the ECDSAOwnedDKIMRegistry.
Expand All @@ -70,6 +78,7 @@ contract ForwardDKIMRegistry is
sstore(sourceDKIMRegistry.slot, _sourceDKIMRegistry)
sstore(add(sourceDKIMRegistry.slot, 1), 0)
}
emit StorageReset(_sourceDKIMRegistry);
}

/// @notice Upgrade the implementation of the proxy.
Expand Down

0 comments on commit 63040e9

Please sign in to comment.