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
1e6d318b
Unverified
Commit
1e6d318b
authored
Oct 20, 2021
by
Maurelian
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(contracts): Add new AddressSetter contract
parent
15371851
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
AddressSetter.sol
...ontracts/contracts/libraries/deployment/AddressSetter.sol
+67
-0
No files found.
packages/contracts/contracts/libraries/deployment/AddressSetter.sol
0 → 100644
View file @
1e6d318b
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import { Lib_AddressManager } from "../resolver/Lib_AddressManager.sol";
/**
* @title AddressSetter
*/
contract AddressSetter {
/*************
* Variables *
*************/
Lib_AddressManager manager;
address finalOwner;
string[] names;
address[] addresses;
/***************
* Constructor *
***************/
/**
* @param _manager Address of the AddressManager contract.
* @param _finalOwner Address to transfer AddressManager ownership to afterwards.
* @param _names Array of names to associate an address with.
* @param _addresses Array of addresses to associate with the name.
*/
constructor(
Lib_AddressManager _manager,
address _finalOwner,
string[] memory _names,
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;
finalOwner = _finalOwner;
require(
_names.length == _addresses.length,
"AddressSetter: Must provide an equal number of names and addresses."
);
names = _names;
addresses = _addresses;
}
/********************
* Public Functions *
********************/
function setAddresses() external {
for (uint256 i = 0; i < names.length; i++) {
manager.setAddress(names[i], addresses[i]);
}
// note that this will revert if _finalOwner == currentOwner
manager.transferOwnership(finalOwner);
}
/**
* This function shouldn't be necessary, but it gives a sense of reassurance that we can recover
* if something really surprising goes wrong.
*/
function returnOwnership() external {
manager.transferOwnership(finalOwner);
}
}
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