Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache _conduits[conduit] to save gas #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/conduit/ConduitController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ contract ConduitController is ConduitControllerInterface {
function acceptOwnership(address conduit) external override {
// Ensure that the conduit in question exists.
_assertConduitExists(conduit);
ConduitProperties storage conduitProperties = _conduits[conduit];

// If caller does not match current potential owner of the conduit...
if (msg.sender != _conduits[conduit].potentialOwner) {
if (msg.sender != conduitProperties.potentialOwner) {
// Revert, indicating that caller is not current potential owner.
revert CallerIsNotNewPotentialOwner(conduit);
}
Expand All @@ -239,13 +240,13 @@ contract ConduitController is ConduitControllerInterface {
emit PotentialOwnerUpdated(address(0));

// Clear the current new potential owner from the conduit.
_conduits[conduit].potentialOwner = address(0);
conduitProperties.potentialOwner = address(0);

// Emit an event indicating conduit ownership has been transferred.
emit OwnershipTransferred(conduit, _conduits[conduit].owner, msg.sender);
emit OwnershipTransferred(conduit, conduitProperties.owner, msg.sender);

// Set the caller as the owner of the conduit.
_conduits[conduit].owner = msg.sender;
conduitProperties.owner = msg.sender;
}

/**
Expand Down