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

Add updateRollupAddress to bridge #54

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ contract Bridge is Initializable, DelegateCallAware, IBridge {
rollup = rollup_;
}

/// @notice Allows the proxy owner to set the rollup address
function updateRollupAddress(IOwnable _rollup) external onlyDelegated onlyRollupOrOwner {
rollup = _rollup;
}

modifier onlyRollupOrOwner() {
if (msg.sender != address(rollup)) {
address rollupOwner = rollup.owner();
Expand Down
2 changes: 2 additions & 0 deletions src/bridge/IBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ interface IBridge {
// ---------- initializer ----------

function initialize(IOwnable rollup_) external;

function updateRollupAddress(IOwnable _rollup) external;
}
4 changes: 4 additions & 0 deletions src/mocks/BridgeStub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,8 @@ contract BridgeStub is IBridge {
function initialize(IOwnable) external pure {
revert("NOT_IMPLEMENTED");
}

function updateRollupAddress(IOwnable) external pure {
revert("NOT_IMPLEMENTED");
}
}
4 changes: 4 additions & 0 deletions src/test-helpers/BridgeTester.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ contract BridgeTester is Initializable, DelegateCallAware, IBridge {
rollup = rollup_;
}

function updateRollupAddress(IOwnable _rollup) external onlyDelegated onlyRollupOrOwner {
rollup = _rollup;
}

function activeOutbox() public view returns (address) {
if (_activeOutbox == EMPTY_ACTIVEOUTBOX) return address(uint160(0));
return _activeOutbox;
Expand Down