Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
13382dc5
Commit
13382dc5
authored
Feb 14, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint: fix
lint: fix
parent
5e4a33b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
CrossDomainOwnable3.sol
...es/contracts-bedrock/contracts/L2/CrossDomainOwnable3.sol
+18
-17
CrossDomainOwnable3.t.sol
...ontracts-bedrock/contracts/test/CrossDomainOwnable3.t.sol
+1
-1
No files found.
packages/contracts-bedrock/contracts/L2/CrossDomainOwnable3.sol
View file @
13382dc5
...
@@ -8,8 +8,9 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
...
@@ -8,8 +8,9 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
/**
/**
* @title CrossDomainOwnable3
* @title CrossDomainOwnable3
* @notice This contract extends the OpenZeppelin `Ownable` contract for L2 contracts to be owned
* @notice This contract extends the OpenZeppelin `Ownable` contract for L2 contracts to be owned
* by contracts on either L1 or L2. Note that this contract is meant to be used with systems that use
* by contracts on either L1 or L2. Note that this contract is meant to be used with systems
* the CrossDomainMessenger system. It will not work if the OptimismPortal is used directly.
* that use the CrossDomainMessenger system. It will not work if the OptimismPortal is
* used directly.
*/
*/
abstract contract CrossDomainOwnable3 is Ownable {
abstract contract CrossDomainOwnable3 is Ownable {
/**
/**
...
@@ -28,6 +29,21 @@ abstract contract CrossDomainOwnable3 is Ownable {
...
@@ -28,6 +29,21 @@ abstract contract CrossDomainOwnable3 is Ownable {
bool isLocal
bool isLocal
);
);
/**
* @notice Allows for ownership to be transferred with specifying the locality.
* @param _owner The new owner of the contract.
* @param _isLocal Configures the locality of the ownership.
*/
function transferOwnership(address _owner, bool _isLocal) external onlyOwner {
require(_owner != address(0), "CrossDomainOwnable3: new owner is the zero address");
address oldOwner = owner();
_transferOwnership(_owner);
isLocal = _isLocal;
emit OwnershipTransferred(oldOwner, _owner, _isLocal);
}
/**
/**
* @notice Overrides the implementation of the `onlyOwner` modifier to check that the unaliased
* @notice Overrides the implementation of the `onlyOwner` modifier to check that the unaliased
* `xDomainMessageSender` is the owner of the contract. This value is set to the caller
* `xDomainMessageSender` is the owner of the contract. This value is set to the caller
...
@@ -52,19 +68,4 @@ abstract contract CrossDomainOwnable3 is Ownable {
...
@@ -52,19 +68,4 @@ abstract contract CrossDomainOwnable3 is Ownable {
);
);
}
}
}
}
/**
* @notice Allows for ownership to be transferred with specifying the locality.
* @param _owner The new owner of the contract.
* @param _isLocal Configures the locality of the ownership.
*/
function transferOwnership(address _owner, bool _isLocal) external onlyOwner {
require(_owner != address(0), "CrossDomainOwnable3: new owner is the zero address");
address oldOwner = owner();
_transferOwnership(_owner);
isLocal = _isLocal;
emit OwnershipTransferred(oldOwner, _owner, _isLocal);
}
}
}
packages/contracts-bedrock/contracts/test/CrossDomainOwnable3.t.sol
View file @
13382dc5
...
@@ -181,7 +181,7 @@ contract CrossDomainOwnable3_Test is Messenger_Initializer {
...
@@ -181,7 +181,7 @@ contract CrossDomainOwnable3_Test is Messenger_Initializer {
* @notice The existing transferOwnership(address) method
* @notice The existing transferOwnership(address) method
* still exists on the contract
* still exists on the contract
*/
*/
function test_transferOwnership
_n
oLocal_succeeds() public {
function test_transferOwnership
N
oLocal_succeeds() public {
bool isLocal = setter.isLocal();
bool isLocal = setter.isLocal();
vm.expectEmit(true, true, true, true, address(setter));
vm.expectEmit(true, true, true, true, address(setter));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment