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
ea5091e4
Unverified
Commit
ea5091e4
authored
Oct 26, 2021
by
Maurelian
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(contracts): Protect returnOwnership
parent
644c9042
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
AddressDictator.sol
...tracts/contracts/libraries/deployment/AddressDictator.sol
+10
-3
No files found.
packages/contracts/contracts/libraries/deployment/AddressDictator.sol
View file @
ea5091e4
...
@@ -40,9 +40,6 @@ contract AddressDictator {
...
@@ -40,9 +40,6 @@ contract AddressDictator {
string[] memory _names,
string[] memory _names,
address[] memory _addresses
address[] memory _addresses
) {
) {
// todo: this probably needs to be moved into a public function which the deployer key
// is authed to call. Otherwise we need to predict the address of this contract, and have
// the multisig transfer ownership here before it is deployed, which would be scary.
manager = _manager;
manager = _manager;
finalOwner = _finalOwner;
finalOwner = _finalOwner;
require(
require(
...
@@ -58,6 +55,10 @@ contract AddressDictator {
...
@@ -58,6 +55,10 @@ contract AddressDictator {
* Public Functions *
* Public Functions *
********************/
********************/
/**
* Called to finalize the transfer, this function is callable by anyone, but will only result in
* an upgrade if this contract is the owner Address Manager.
*/
function setAddresses() external {
function setAddresses() external {
for (uint256 i = 0; i < namedAddresses.length; i++) {
for (uint256 i = 0; i < namedAddresses.length; i++) {
manager.setAddress(namedAddresses[i].name, namedAddresses[i].addr);
manager.setAddress(namedAddresses[i].name, namedAddresses[i].addr);
...
@@ -67,10 +68,13 @@ contract AddressDictator {
...
@@ -67,10 +68,13 @@ contract AddressDictator {
}
}
/**
/**
* Transfers ownership of this contract to the finalOwner.
* Only callable by the Final Owner, which is intended to be our multisig.
* This function shouldn't be necessary, but it gives a sense of reassurance that we can recover
* This function shouldn't be necessary, but it gives a sense of reassurance that we can recover
* if something really surprising goes wrong.
* if something really surprising goes wrong.
*/
*/
function returnOwnership() external {
function returnOwnership() external {
require(msg.sender == finalOwner, "AddressDictator: only callable by finalOwner");
manager.transferOwnership(finalOwner);
manager.transferOwnership(finalOwner);
}
}
...
@@ -78,6 +82,9 @@ contract AddressDictator {
...
@@ -78,6 +82,9 @@ contract AddressDictator {
* View Functions *
* View Functions *
******************/
******************/
/**
* Returns the full namedAddresses array.
*/
function getNamedAddresses() external view returns (NamedAddress[] memory) {
function getNamedAddresses() external view returns (NamedAddress[] memory) {
return namedAddresses;
return namedAddresses;
}
}
...
...
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