-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add update to 1.4.0 * add tests * remove ens * add upgrades for daoregistry+pluginreporegistry * comment * Update packages/contracts/deploy/update/to_v1.4.0/31_DAORegistry.ts Co-authored-by: Rekard0 <[email protected]> * add verification for registry implementations * remove zk from git --------- Co-authored-by: Rekard0 <[email protected]>
- Loading branch information
Showing
18 changed files
with
839 additions
and
87 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
packages/contracts/deploy/update/to_v1.4.0/10_DAOFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import daoFactoryArtifact from '../../../artifacts/src/framework/dao/DAOFactory.sol/DAOFactory.json'; | ||
import {DAO__factory} from '../../../typechain'; | ||
import {getLatestContractAddress} from '../../helpers'; | ||
import {Operation} from '@aragon/osx-commons-sdk'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpdating DAOFactory'); | ||
const {deployments, ethers} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const managementDAOAddress = getLatestContractAddress( | ||
'ManagementDAOProxy', | ||
hre | ||
); | ||
const pluginSetupProcessorAddress = getLatestContractAddress( | ||
'PluginSetupProcessor', | ||
hre | ||
); | ||
|
||
const daoRegistryAddress = getLatestContractAddress('DAORegistryProxy', hre); | ||
const previousDAOFactoryAddress = getLatestContractAddress('DAOFactory', hre); | ||
console.log(`Using managementDAO ${managementDAOAddress}`); | ||
console.log(`Using PluginSetupProcessor ${pluginSetupProcessorAddress}`); | ||
console.log(`Using DAORegistry ${daoRegistryAddress}`); | ||
console.log(`Using PreviousDAOFactory ${previousDAOFactoryAddress}`); | ||
|
||
const deployResult = await deploy('DAOFactory', { | ||
contract: daoFactoryArtifact, | ||
from: deployer.address, | ||
args: [daoRegistryAddress, pluginSetupProcessorAddress], | ||
log: true, | ||
}); | ||
|
||
const daoInterface = DAO__factory.createInterface(); | ||
const calldata = daoInterface.encodeFunctionData( | ||
'applyMultiTargetPermissions', | ||
[ | ||
[ | ||
{ | ||
who: previousDAOFactoryAddress, | ||
where: daoRegistryAddress, | ||
operation: Operation.Revoke, | ||
permissionId: ethers.utils.id('REGISTER_DAO_PERMISSION'), | ||
condition: ethers.constants.AddressZero, | ||
}, | ||
{ | ||
who: deployResult.address, | ||
where: daoRegistryAddress, | ||
operation: Operation.Grant, | ||
permissionId: ethers.utils.id('REGISTER_DAO_PERMISSION'), | ||
condition: ethers.constants.AddressZero, | ||
}, | ||
], | ||
] | ||
); | ||
// update permissions actions | ||
hre.managementDAOActions.push({ | ||
to: managementDAOAddress, | ||
value: 0, | ||
data: calldata, | ||
description: `Moves the <strong>REGISTER_DAO_PERMISSION_ID</strong> permission on the <strong>DAORegistry</strong> (<code>${daoRegistryAddress}</code>) from the old <strong>DAOFactory</strong> (<code>${previousDAOFactoryAddress}</code>) to the new <strong>DAOFactory</strong> (<code>${deployResult.address}</code>).`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['DAOFactory', 'v1.4.0']; | ||
func.dependencies = ['Env']; |
22 changes: 22 additions & 0 deletions
22
packages/contracts/deploy/update/to_v1.4.0/11_DAOFactory_conclude.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {DAOFactory__factory} from '../../../typechain'; | ||
import {getContractAddress} from '../../helpers'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nConcluding DAOFactory update'); | ||
const {deployments, ethers} = hre; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const daoFactoryAddress = await getContractAddress('DAOFactory', hre); | ||
const daoFactory = DAOFactory__factory.connect(daoFactoryAddress, deployer); | ||
const daoBase = await daoFactory.callStatic.daoBase(); | ||
|
||
hre.aragonToVerifyContracts.push(await deployments.get('DAOFactory')); | ||
hre.aragonToVerifyContracts.push({ | ||
address: daoBase, | ||
args: [], | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['DAOFactory', 'Verify', 'v1.4.0']; |
70 changes: 70 additions & 0 deletions
70
packages/contracts/deploy/update/to_v1.4.0/20_PluginRepoFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import pluginRepoFactoryArtifact from '../../../artifacts/src/framework/plugin/repo/PluginRepoFactory.sol/PluginRepoFactory.json'; | ||
import {PluginRepo__factory} from '../../../typechain'; | ||
import {getLatestContractAddress} from '../../helpers'; | ||
import {Operation} from '@aragon/osx-commons-sdk'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpdating PluginRepoFactory'); | ||
const {deployments, ethers} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const managementDAOAddress = getLatestContractAddress( | ||
'ManagementDAOProxy', | ||
hre | ||
); | ||
const pluginRepoRegistryAddress = getLatestContractAddress( | ||
'PluginRepoRegistryProxy', | ||
hre | ||
); | ||
const previousPluginRepoFactoryAddress = getLatestContractAddress( | ||
'PluginRepoFactory', | ||
hre | ||
); | ||
console.log(`Using managementDAO ${managementDAOAddress}`); | ||
console.log(`Using PluginRepoRegistry ${pluginRepoRegistryAddress}`); | ||
console.log( | ||
`Using PreviousPluginRepoFactory ${previousPluginRepoFactoryAddress}` | ||
); | ||
|
||
const deployResult = await deploy('PluginRepoFactory', { | ||
contract: pluginRepoFactoryArtifact, | ||
from: deployer.address, | ||
args: [pluginRepoRegistryAddress], | ||
log: true, | ||
}); | ||
|
||
const pluginRepoInterface = PluginRepo__factory.createInterface(); | ||
const calldata = pluginRepoInterface.encodeFunctionData( | ||
'applyMultiTargetPermissions', | ||
[ | ||
[ | ||
{ | ||
who: previousPluginRepoFactoryAddress, | ||
where: pluginRepoRegistryAddress, | ||
operation: Operation.Revoke, | ||
permissionId: ethers.utils.id('REGISTER_PLUGIN_REPO_PERMISSION'), | ||
condition: ethers.constants.AddressZero, | ||
}, | ||
{ | ||
who: deployResult.address, | ||
where: pluginRepoRegistryAddress, | ||
operation: Operation.Grant, | ||
permissionId: ethers.utils.id('REGISTER_PLUGIN_REPO_PERMISSION'), | ||
condition: ethers.constants.AddressZero, | ||
}, | ||
], | ||
] | ||
); | ||
// update permissions actions | ||
hre.managementDAOActions.push({ | ||
to: managementDAOAddress, | ||
value: 0, | ||
data: calldata, | ||
description: `Moves the <strong>REGISTER_PLUGIN_REPO_PERMISSION</strong> permission on the <strong>PluginRepoRegistry</strong> (<code>${pluginRepoRegistryAddress}</code>) from the old <strong>PluginRepoFactory</strong> (<code>${previousPluginRepoFactoryAddress}</code>) to the new <strong>PluginRepoFactory</strong> (<code>${deployResult.address}</code>).`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['PluginRepoFactory', 'v1.4.0']; |
28 changes: 28 additions & 0 deletions
28
packages/contracts/deploy/update/to_v1.4.0/21_PluginRepoFactory_conclude.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {PluginRepoFactory__factory} from '../../../typechain'; | ||
import {getContractAddress} from '../../helpers'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nConcluding PluginRepoFactory update'); | ||
const {deployments, ethers} = hre; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const pluginRepoFactoryAddress = await getContractAddress( | ||
'PluginRepoFactory', | ||
hre | ||
); | ||
const pluginRepoFactory = PluginRepoFactory__factory.connect( | ||
pluginRepoFactoryAddress, | ||
deployer | ||
); | ||
const pluginRepoBase = await pluginRepoFactory.callStatic.pluginRepoBase(); | ||
|
||
hre.aragonToVerifyContracts.push(await deployments.get('PluginRepoFactory')); | ||
hre.aragonToVerifyContracts.push({ | ||
address: pluginRepoBase, | ||
args: [], | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['PluginRepoFactory', 'Verify', 'v1.4.0']; |
54 changes: 54 additions & 0 deletions
54
packages/contracts/deploy/update/to_v1.4.0/31_DAORegistry.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import daoRegistryArtifact from '../../../artifacts/src/framework/dao/DAORegistry.sol/DAORegistry.json'; | ||
import { | ||
DAOFactory__factory, | ||
DAORegistry__factory, | ||
DAO__factory, | ||
} from '../../../typechain'; | ||
import {DAORegistry} from '../../../typechain/@aragon/osx-v1.0.1/framework/dao/DAORegistry.sol'; | ||
import {getContractAddress} from '../../helpers'; | ||
import {getProtocolVersion} from '@aragon/osx-commons-sdk'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpgrade the DAORegistry to new Implementation'); | ||
|
||
const {deployments, ethers} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const daoRegistryAddress = await getContractAddress('DAORegistryProxy', hre); | ||
const daoRegistry = DAORegistry__factory.connect( | ||
daoRegistryAddress, | ||
hre.ethers.provider | ||
); | ||
|
||
const result = await deploy('DAORegistryImplementation', { | ||
contract: daoRegistryArtifact, | ||
from: deployer.address, | ||
args: [], | ||
log: true, | ||
}); | ||
|
||
const upgradeTX = await daoRegistry.populateTransaction.upgradeTo( | ||
result.address | ||
); | ||
|
||
if (!upgradeTX.to || !upgradeTX.data) { | ||
throw new Error(`Failed to populate upgradeToAndCall transaction`); | ||
} | ||
|
||
hre.aragonToVerifyContracts.push({ | ||
address: result.address, | ||
args: [], | ||
}); | ||
|
||
hre.managementDAOActions.push({ | ||
to: upgradeTX.to, | ||
data: upgradeTX.data, | ||
value: 0, | ||
description: `Upgrade the <strong>DaoRegistry </strong> (<code>${daoRegistryAddress}</code>) to the new <strong>implementation</strong> (<code>${result.address}</code>).`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['DAORegistry', 'v1.4.0']; |
58 changes: 58 additions & 0 deletions
58
packages/contracts/deploy/update/to_v1.4.0/41_PluginRepoRegistry.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import pluginRepoRegistryArtifact from '../../../artifacts/src/framework/plugin/repo/PluginRepoRegistry.sol/PluginRepoRegistry.json'; | ||
import { | ||
DAOFactory__factory, | ||
DAORegistry__factory, | ||
DAO__factory, | ||
PluginRepoRegistry__factory, | ||
} from '../../../typechain'; | ||
import {DAORegistry} from '../../../typechain/@aragon/osx-v1.0.1/framework/dao/DAORegistry.sol'; | ||
import {getContractAddress} from '../../helpers'; | ||
import {getProtocolVersion} from '@aragon/osx-commons-sdk'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpgrade the pluginRepoRegistry to new Implementation'); | ||
|
||
const {deployments, ethers} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const pluginRepoRegistryAddress = await getContractAddress( | ||
'PluginRepoRegistryProxy', | ||
hre | ||
); | ||
const pluginRepoRegistry = PluginRepoRegistry__factory.connect( | ||
pluginRepoRegistryAddress, | ||
hre.ethers.provider | ||
); | ||
|
||
const result = await deploy('PluginRepoRegistryImplementation', { | ||
contract: pluginRepoRegistryArtifact, | ||
from: deployer.address, | ||
args: [], | ||
log: true, | ||
}); | ||
|
||
const upgradeTX = await pluginRepoRegistry.populateTransaction.upgradeTo( | ||
result.address | ||
); | ||
|
||
if (!upgradeTX.to || !upgradeTX.data) { | ||
throw new Error(`Failed to populate upgradeToAndCall transaction`); | ||
} | ||
|
||
hre.aragonToVerifyContracts.push({ | ||
address: result.address, | ||
args: [], | ||
}); | ||
|
||
hre.managementDAOActions.push({ | ||
to: upgradeTX.to, | ||
data: upgradeTX.data, | ||
value: 0, | ||
description: `Upgrade the <strong>PluginRepoRegistry </strong> (<code>${pluginRepoRegistryAddress}</code>) to the new <strong>implementation</strong> (<code>${result.address}</code>).`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['PluginRepoRegistry', 'v1.4.0']; |
44 changes: 44 additions & 0 deletions
44
packages/contracts/deploy/update/to_v1.4.0/90_ManagingDAO.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {DAOFactory__factory, DAO__factory} from '../../../typechain'; | ||
import {getContractAddress} from '../../helpers'; | ||
import {getProtocolVersion} from '@aragon/osx-commons-sdk'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpgrade the management DAO to new Implementation'); | ||
|
||
const daoFactoryAddress = await getContractAddress('DAOFactory', hre); | ||
const newDaoImplementation = await DAOFactory__factory.connect( | ||
daoFactoryAddress, | ||
hre.ethers.provider | ||
).daoBase(); | ||
|
||
const managementDAOAddress = await getContractAddress( | ||
'ManagementDAOProxy', | ||
hre | ||
); | ||
const managementDAO = DAO__factory.connect( | ||
managementDAOAddress, | ||
hre.ethers.provider | ||
); | ||
|
||
const upgradeTX = await managementDAO.populateTransaction.upgradeToAndCall( | ||
newDaoImplementation, | ||
managementDAO.interface.encodeFunctionData('initializeFrom', [ | ||
await getProtocolVersion(managementDAO), | ||
[], | ||
]) | ||
); | ||
|
||
if (!upgradeTX.to || !upgradeTX.data) { | ||
throw new Error(`Failed to populate upgradeToAndCall transaction`); | ||
} | ||
hre.managementDAOActions.push({ | ||
to: upgradeTX.to, | ||
data: upgradeTX.data, | ||
value: 0, | ||
description: `Upgrade the <strong>management DAO</strong> (<code>${managementDAOAddress}</code>) to the new <strong>implementation</strong> (<code>${newDaoImplementation}</code>).`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['ManagementDAO', 'v1.4.0']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.