Commit 2f33ea9e authored by Maurelian's avatar Maurelian Committed by Kelvin Fichter

chore(contracts): Rename AddressSetter to AddressDictator

Reasoning:
1. It manages the address manager
2. AddressSetter is overly generic
parent f3764e57
...@@ -4,9 +4,9 @@ pragma solidity ^0.8.9; ...@@ -4,9 +4,9 @@ pragma solidity ^0.8.9;
import { Lib_AddressManager } from "../resolver/Lib_AddressManager.sol"; import { Lib_AddressManager } from "../resolver/Lib_AddressManager.sol";
/** /**
* @title AddressSetter * @title AddressDictator
*/ */
contract AddressSetter { contract AddressDictator {
/************* /*************
* Variables * * Variables *
*************/ *************/
...@@ -39,7 +39,7 @@ contract AddressSetter { ...@@ -39,7 +39,7 @@ contract AddressSetter {
finalOwner = _finalOwner; finalOwner = _finalOwner;
require( require(
_names.length == _addresses.length, _names.length == _addresses.length,
"AddressSetter: Must provide an equal number of names and addresses." "AddressDictator: Must provide an equal number of names and addresses."
); );
names = _names; names = _names;
addresses = _addresses; addresses = _addresses;
......
...@@ -37,7 +37,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -37,7 +37,7 @@ const deployFn: DeployFunction = async (hre) => {
}) })
) )
// Add non-deployed addresses to the Address Setter arguments. // Add non-deployed addresses to the Address Dictator arguments.
namesAndAddresses = [ namesAndAddresses = [
...namesAndAddresses, ...namesAndAddresses,
// L2CrossDomainMessenger is the address of the predeploy on L2. We can refactor off-chain // L2CrossDomainMessenger is the address of the predeploy on L2. We can refactor off-chain
...@@ -70,8 +70,8 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -70,8 +70,8 @@ const deployFn: DeployFunction = async (hre) => {
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
name: 'AddressSetter', name: 'AddressDictator',
contract: 'AddressSetter', contract: 'AddressDictator',
args: [ args: [
Lib_AddressManager.address, Lib_AddressManager.address,
(hre as any).deployConfig.ovmAddressManagerOwner, (hre as any).deployConfig.ovmAddressManagerOwner,
...@@ -85,6 +85,6 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -85,6 +85,6 @@ const deployFn: DeployFunction = async (hre) => {
}) })
} }
deployFn.tags = ['fresh', 'upgrade', 'AddressSetter'] deployFn.tags = ['fresh', 'upgrade', 'AddressDictator']
export default deployFn export default deployFn
...@@ -8,18 +8,18 @@ import { getLiveContract, waitUntilTrue } from '../src/hardhat-deploy-ethers' ...@@ -8,18 +8,18 @@ import { getLiveContract, waitUntilTrue } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
const addressSetter = await getLiveContract(hre, 'AddressSetter', { const addressDictator = await getLiveContract(hre, 'AddressDictator', {
signerOrProvider: deployer, signerOrProvider: deployer,
}) })
const libAddressManager = await getLiveContract(hre, 'Lib_AddressManager') const libAddressManager = await getLiveContract(hre, 'Lib_AddressManager')
const names = await addressSetter.getNames() const names = await addressDictator.getNames()
const addresses = await addressSetter.getAddresses() const addresses = await addressDictator.getAddresses()
const finalOwner = await addressSetter.finalOwner() const finalOwner = await addressDictator.finalOwner()
let currentOwner = await libAddressManager.owner() let currentOwner = await libAddressManager.owner()
console.log( console.log(
'\n', '\n',
'An Address Setter contract has been deployed, with the following address <=> name pairs:' 'An Address Dictator contract has been deployed, with the following name/address pairs:'
) )
for (let i = 0; i < names.length; i++) { for (let i = 0; i < names.length; i++) {
console.log(`${addresses[i]} <=> ${names[i]}`) console.log(`${addresses[i]} <=> ${names[i]}`)
...@@ -31,7 +31,9 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -31,7 +31,9 @@ const deployFn: DeployFunction = async (hre) => {
console.log( console.log(
` then transfer ownership of the Address Manager at (${libAddressManager.address})` ` then transfer ownership of the Address Manager at (${libAddressManager.address})`
) )
console.log(` to the Address Setter contract at ${addressSetter.address}.`) console.log(
` to the Address Dictator contract at ${addressDictator.address}.`
)
const hreSigners = await hre.ethers.getSigners() const hreSigners = await hre.ethers.getSigners()
const hreSignerAddresses = hreSigners.map((signer) => { const hreSignerAddresses = hreSigners.map((signer) => {
...@@ -48,15 +50,15 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -48,15 +50,15 @@ const deployFn: DeployFunction = async (hre) => {
const owner = await hre.ethers.getSigner(currentOwner) const owner = await hre.ethers.getSigner(currentOwner)
await libAddressManager await libAddressManager
.connect(owner) .connect(owner)
.transferOwnership(addressSetter.address) .transferOwnership(addressDictator.address)
} }
await waitUntilTrue( await waitUntilTrue(
async () => { async () => {
console.log('Checking ownership of Lib_AddressManager... ') console.log('Checking ownership of Lib_AddressManager... ')
currentOwner = await libAddressManager.owner() currentOwner = await libAddressManager.owner()
console.log('Lib_AddressManager owner is now set to AddressSetter.') console.log('Lib_AddressManager owner is now set to AddressDictator.')
return hexStringEquals(currentOwner, addressSetter.address) return hexStringEquals(currentOwner, addressDictator.address)
}, },
{ {
// Try every 30 seconds for 500 minutes. // Try every 30 seconds for 500 minutes.
...@@ -67,7 +69,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -67,7 +69,7 @@ const deployFn: DeployFunction = async (hre) => {
// Set the addresses! // Set the addresses!
console.log('Ownership successfully transferred. Invoking setAddresses...') console.log('Ownership successfully transferred. Invoking setAddresses...')
await addressSetter.setAddresses() await addressDictator.setAddresses()
currentOwner = await libAddressManager.owner() currentOwner = await libAddressManager.owner()
console.log('Verifying final ownership of Lib_AddressManager') console.log('Verifying final ownership of Lib_AddressManager')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment