Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOT MERGE] Featture/linea testing #624

Draft
wants to merge 5 commits into
base: feature/mode-testing
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ yarn-error.log*
deployments
deployments-zk
deployed_contracts.json
deployed_contracts_detailed.json
managingDAOTX.json

# generated
Expand Down
47 changes: 26 additions & 21 deletions packages/contracts/deploy/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ENS_PUBLIC_RESOLVERS: {[key: string]: string} = {
goerli: '0x19c2d5d0f035563344dbb7be5fd09c8dad62b001',
mainnet: '0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41',
sepolia: '0x8FADE66B79cC9f707aB26799354482EB93a5B7dD',
holesky: '0x9010A27463717360cAD99CEA8bD39b8705CCA238'
holesky: '0x9010A27463717360cAD99CEA8bD39b8705CCA238',
};

export const DAO_PERMISSIONS = [
Expand Down Expand Up @@ -224,7 +224,11 @@ export async function createPluginRepo(
);
const found = events.filter(event => event?.args?.subdomain == pluginName);
if (found && found.length == 1) {
hre.aragonPluginRepos[pluginName] = found[0].args.pluginRepo;
hre.aragonPluginRepos[pluginName] = {
address: found[0].args.pluginRepo,
blockNumber: found[0].blockNumber,
transactionHash: found[0].transactionHash || null,
};
return;
}
throw new Error(
Expand All @@ -247,7 +251,8 @@ export async function createPluginRepo(
console.log(
`Creating & registering repo for ${pluginName} with tx ${tx.hash}`
);
await tx.wait();

const receipt = await tx.wait();

const event = await findEventTopicLog<PluginRepoRegisteredEvent>(
tx,
Expand All @@ -256,7 +261,11 @@ export async function createPluginRepo(
);
const repoAddress = event.args.pluginRepo;

hre.aragonPluginRepos[pluginName] = repoAddress;
hre.aragonPluginRepos[pluginName] = {
address: repoAddress,
blockNumber: receipt.blockNumber,
transactionHash: tx.hash,
};

console.log(
`Created & registered repo for ${pluginName} at address: ${repoAddress}` //, with contentURI ${ethers.utils.toUtf8String(releaseMetadata)}`
Expand Down Expand Up @@ -363,7 +372,7 @@ export async function populatePluginRepo(

for (let i = 1; i < latestBuildNumber; i++) {
await createVersion(
hre.aragonPluginRepos[pluginRepoName],
hre.aragonPluginRepos[pluginRepoName].address,
placeholderSetup,
releaseNumber,
i,
Expand All @@ -376,7 +385,7 @@ export async function populatePluginRepo(

// create latest builds
await createVersion(
hre.aragonPluginRepos[pluginRepoName],
hre.aragonPluginRepos[pluginRepoName].address,
latestVersion.pluginSetupContract,
releaseNumber,
latestBuildNumber,
Expand Down Expand Up @@ -653,29 +662,25 @@ export function getManagingDAOMultisigAddress(
}

export async function getPSPAddress(hre: HardhatRuntimeEnvironment) {
let name = 'PluginSetupProcessor'
if(ZK_SYNC_NETWORKS.includes(hre.network.name)) {
name = 'PluginSetupProcessorUpgradeable'
let name = 'PluginSetupProcessor';
if (ZK_SYNC_NETWORKS.includes(hre.network.name)) {
name = 'PluginSetupProcessorUpgradeable';
}

const address = await getContractAddress(
name,
hre
);
const address = await getContractAddress(name, hre);

return address;
}

export async function getTokenVotingSetupAddress(hre: HardhatRuntimeEnvironment) {
let name = 'TokenVotingSetup'
if(ZK_SYNC_NETWORKS.includes(hre.network.name)) {
name = 'TokenVotingSetupZkSync'
export async function getTokenVotingSetupAddress(
hre: HardhatRuntimeEnvironment
) {
let name = 'TokenVotingSetup';
if (ZK_SYNC_NETWORKS.includes(hre.network.name)) {
name = 'TokenVotingSetupZkSync';
}

const address = await getContractAddress(
name,
hre
);
const address = await getContractAddress(name, hre);

return address;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/contracts/deploy/new/10_framework/00_ens_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const {network} = hre;

console.log(`\nOn Network: `, network.name);

// Prepare ENS.
const daoDomain =
process.env[`${network.name.toUpperCase()}_DAO_ENS_DOMAIN`] || '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const pluginRepoBase = await pluginRepoFactory.pluginRepoBase();

hre.aragonToVerifyContracts.push({
address: hre.aragonPluginRepos['address-list-voting'],
address: hre.aragonPluginRepos['address-list-voting'].address,
args: [pluginRepoBase, initializeData],
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const pluginRepoBase = await pluginRepoFactory.pluginRepoBase();

hre.aragonToVerifyContracts.push({
address: hre.aragonPluginRepos['token-voting'],
address: hre.aragonPluginRepos['token-voting'].address,
args: [pluginRepoBase, initializeData],
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const pluginRepoBase = await pluginRepoFactory.pluginRepoBase();

hre.aragonToVerifyContracts.push({
address: hre.aragonPluginRepos['admin'],
address: hre.aragonPluginRepos['admin'].address,
args: [pluginRepoBase, initializeData],
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const pluginRepoBase = await pluginRepoFactory.pluginRepoBase();

hre.aragonToVerifyContracts.push({
address: hre.aragonPluginRepos['multisig'],
address: hre.aragonPluginRepos['multisig'].address,
args: [pluginRepoBase, initializeData],
});
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import {DAO__factory, PluginRepo__factory} from '../../../typechain';
import {Operation} from '../../../utils/types';
import {getContractAddress, getPSPAddress, managePermissions, Permission} from '../../helpers';
import {
getContractAddress,
getPSPAddress,
managePermissions,
Permission,
} from '../../helpers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

Expand Down Expand Up @@ -60,7 +65,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Grant `ROOT_PERMISSION`, `MAINTAINER_PERMISSION` and `UPGRADE_REPO_PERMISSION` to `managingDao` on the permission manager of each PluginRepo.
for (const repoName in hre.aragonPluginRepos) {
const repoAddress = hre.aragonPluginRepos[repoName];
const repoAddress = hre.aragonPluginRepos[repoName].address;

// if repoAddress empty, the deployment must have been marked as skipped.
if (repoAddress === '') continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
'0x'
);

console.log(`\nShould set metadata of ManagementDAO:`, hasMetadataPermission);

if (hasMetadataPermission) {
const setMetadataTX = await managingDaoContract.setMetadata(
ethers.utils.hexlify(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ import {findEvent} from '../../../utils/event';
import {getNamedTypesFromMetadata} from '../../../utils/metadata';
import {hashHelpers} from '../../../utils/psp';
import {Operation} from '../../../utils/types';
import {checkPermission, getContractAddress, getPSPAddress} from '../../helpers';
import {
checkPermission,
getContractAddress,
getPSPAddress,
} from '../../helpers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(`\nInstall Multisig plugin on the ManagementDAO.`);

const {ethers, network} = hre;
const [deployer] = await ethers.getSigners();

Expand Down Expand Up @@ -55,7 +61,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

// Get `PluginSetupProcessor` address.
const pspAddress = await getPSPAddress(hre)
const pspAddress = await getPSPAddress(hre);

// Get `PluginSetupProcessor` contract.
const pspContract = PluginSetupProcessor__factory.connect(
Expand All @@ -64,7 +70,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

// Install multisig build 2
const multisigRepoAddress = hre.aragonPluginRepos['multisig'];
const multisigRepoAddress = hre.aragonPluginRepos['multisig'].address;
const versionTag = {
release: 1,
build: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Revoke `ROOT_PERMISSION`, `MAINTAINER_PERMISSION` and `UPGRADE_REPO_PERMISSION` from `Deployer` on the permission manager of each PluginRepo.
for (const repoName in hre.aragonPluginRepos) {
const repoAddress = hre.aragonPluginRepos[repoName];
const repoAddress = hre.aragonPluginRepos[repoName].address;

// if repoAddress empty, the deployment must have been marked as skipped.
if (repoAddress === '') continue;
Expand Down
7 changes: 3 additions & 4 deletions packages/contracts/deploy/new/50_save-contract-addresses.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {promises as fs} from 'fs';
import { DAORegistry } from '../../typechain';
import {DAORegistry} from '../../typechain';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log('\nPrinting deployed contracts.');
Expand Down Expand Up @@ -38,15 +38,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

for (const pluginRepo in aragonPluginRepos) {
deployedContractAddresses[`${pluginRepo}-repo`] =
aragonPluginRepos[pluginRepo];
console.log(`${pluginRepo}-repo: ${aragonPluginRepos[pluginRepo]}`);
aragonPluginRepos[pluginRepo].address;
console.log(`${pluginRepo}-repo: ${aragonPluginRepos[pluginRepo].address}`);
}

await fs.writeFile(
'deployed_contracts.json',
JSON.stringify(deployedContractAddresses, null, 2)
);

};
export default func;
func.tags = ['New', 'Conclude'];
Expand Down
Loading
Loading