Skip to content

Commit

Permalink
Applying the formatting suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Nov 8, 2023
1 parent 8a5f56d commit 12b5da4
Show file tree
Hide file tree
Showing 36 changed files with 2,261 additions and 2,625 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.documentSelectors": ["**/*.sol"],
"solidity.formatter": "prettier"
"solidity.formatter": "prettier",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
38 changes: 18 additions & 20 deletions packages/contracts/deploy/01_repo/10_create_repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import {
GovernancePluginsSetupParams,
PersonalSpaceAdminPluginSetupParams,
SpacePluginSetupParams,
} from "../../plugin-setup-params";
} from '../../plugin-setup-params';
import {
findEventTopicLog,
getPluginRepoFactoryAddress,
} from "../../utils/helpers";
import { addDeployedRepo } from "../../utils/plugin-repo-info";
} from '../../utils/helpers';
import {addDeployedRepo} from '../../utils/plugin-repo-info';
import {
PluginRepo__factory,
PluginRepoFactory__factory,
PluginRepoRegistry__factory,
} from "@aragon/osx-ethers";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
} from '@aragon/osx-ethers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = function (hre: HardhatRuntimeEnvironment) {
return deployRepo(hre, SpacePluginSetupParams.PLUGIN_REPO_ENS_NAME)
Expand All @@ -28,59 +28,57 @@ const func: DeployFunction = function (hre: HardhatRuntimeEnvironment) {

async function deployRepo(
hre: HardhatRuntimeEnvironment,
ensSubdomain: string,
ensSubdomain: string
) {
console.log(
`\nDeploying the "${ensSubdomain}" plugin repo`,
);
console.log(`\nDeploying the "${ensSubdomain}" plugin repo`);

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

// Get the PluginRepoFactory address
const pluginRepoFactoryAddr: string = getPluginRepoFactoryAddress(
network.name,
network.name
);

const pluginRepoFactory = PluginRepoFactory__factory.connect(
pluginRepoFactoryAddr,
deployer,
deployer
);

// Create the PluginRepo
const tx = await pluginRepoFactory.createPluginRepo(
ensSubdomain,
deployer.address,
deployer.address
);

const eventLog = await findEventTopicLog(
tx,
PluginRepoRegistry__factory.createInterface(),
"PluginRepoRegistered",
'PluginRepoRegistered'
);
if (!eventLog) {
throw new Error("Failed to get PluginRepoRegistered event log");
throw new Error('Failed to get PluginRepoRegistered event log');
}

const pluginRepo = PluginRepo__factory.connect(
eventLog.args.pluginRepo,
deployer,
deployer
);

const blockNumberOfDeployment = (await tx.wait()).blockNumber;

console.log(
`"${ensSubdomain}" PluginRepo deployed at: ${pluginRepo.address} at block ${blockNumberOfDeployment}.`,
`"${ensSubdomain}" PluginRepo deployed at: ${pluginRepo.address} at block ${blockNumberOfDeployment}.`
);

// Store the information
addDeployedRepo(
ensSubdomain,
network.name,
pluginRepo.address,
blockNumberOfDeployment,
blockNumberOfDeployment
);
}

export default func;
func.tags = ["PluginRepo", "Deployment"];
func.tags = ['PluginRepo', 'Deployment'];
33 changes: 15 additions & 18 deletions packages/contracts/deploy/02_setup/10_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import {
GovernancePluginsSetupParams,
PersonalSpaceAdminPluginSetupParams,
SpacePluginSetupParams,
} from "../../plugin-setup-params";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
} from '../../plugin-setup-params';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;
const {deployer} = await getNamedAccounts();

// Space
console.log(
`\nDeploying ${SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME}`,
`\nDeploying ${SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME}`
);

await deploy(SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME, {
Expand All @@ -24,21 +24,18 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Personal Space
console.log(
`\nDeploying ${PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME}`,
`\nDeploying ${PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME}`
);

await deploy(
PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
{
from: deployer,
args: [],
log: true,
},
);
await deploy(PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME, {
from: deployer,
args: [],
log: true,
});

// Governance
console.log(
`\nDeploying ${GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME}`,
`\nDeploying ${GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME}`
);

await deploy(GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME, {
Expand All @@ -53,5 +50,5 @@ func.tags = [
SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
"Deployment",
'Deployment',
];
56 changes: 27 additions & 29 deletions packages/contracts/deploy/02_setup/11_setup_conclude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
GovernancePluginsSetupParams,
PersonalSpaceAdminPluginSetupParams,
SpacePluginSetupParams,
} from "../../plugin-setup-params";
} from '../../plugin-setup-params';
import {
GovernancePluginsSetup__factory,
MainVotingPlugin__factory,
Expand All @@ -11,10 +11,10 @@ import {
PersonalSpaceAdminPluginSetup__factory,
SpacePlugin__factory,
SpacePluginSetup__factory,
} from "../../typechain";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { setTimeout } from "timers/promises";
} from '../../typechain';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {setTimeout} from 'timers/promises';

const func: DeployFunction = function (hre: HardhatRuntimeEnvironment) {
return concludeSpaceSetup(hre)
Expand All @@ -23,27 +23,27 @@ const func: DeployFunction = function (hre: HardhatRuntimeEnvironment) {
};

async function concludeSpaceSetup(hre: HardhatRuntimeEnvironment) {
const { deployments, network } = hre;
const {deployments, network} = hre;
const [deployer] = await hre.ethers.getSigners();

console.log(
`Concluding ${SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME} deployment.\n`,
`Concluding ${SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME} deployment.\n`
);

const setupDeployment = await deployments.get(
SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME
);
const setup = SpacePluginSetup__factory.connect(
setupDeployment.address,
deployer,
deployer
);
const implementation = SpacePlugin__factory.connect(
await setup.implementation(),
deployer,
deployer
);

// Add a timeout for polygon because the call to `implementation()` can fail for newly deployed contracts in the first few seconds
if (network.name === "polygon") {
if (network.name === 'polygon') {
console.log(`Waiting 30 secs for ${network.name} to finish up...`);
await setTimeout(30000);
}
Expand All @@ -59,29 +59,29 @@ async function concludeSpaceSetup(hre: HardhatRuntimeEnvironment) {
}

async function concludePersonalSpaceVotingSetup(
hre: HardhatRuntimeEnvironment,
hre: HardhatRuntimeEnvironment
) {
const { deployments, network } = hre;
const {deployments, network} = hre;
const [deployer] = await hre.ethers.getSigners();

console.log(
`Concluding ${PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME} deployment.\n`,
`Concluding ${PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME} deployment.\n`
);

const setupDeployment = await deployments.get(
PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME
);
const setup = PersonalSpaceAdminPluginSetup__factory.connect(
setupDeployment.address,
deployer,
deployer
);
const implementation = PersonalSpaceAdminPlugin__factory.connect(
await setup.implementation(),
deployer,
deployer
);

// Add a timeout for polygon because the call to `implementation()` can fail for newly deployed contracts in the first few seconds
if (network.name === "polygon") {
if (network.name === 'polygon') {
console.log(`Waiting 30secs for ${network.name} to finish up...`);
await setTimeout(30000);
}
Expand All @@ -96,34 +96,32 @@ async function concludePersonalSpaceVotingSetup(
});
}

async function concludeGovernanceSetup(
hre: HardhatRuntimeEnvironment,
) {
const { deployments, network } = hre;
async function concludeGovernanceSetup(hre: HardhatRuntimeEnvironment) {
const {deployments, network} = hre;
const [deployer] = await hre.ethers.getSigners();

console.log(
`Concluding ${GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME} deployment.\n`,
`Concluding ${GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME} deployment.\n`
);

const setupDeployment = await deployments.get(
GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME
);
const setup = GovernancePluginsSetup__factory.connect(
setupDeployment.address,
deployer,
deployer
);
const mainVotingPluginImplementation = MainVotingPlugin__factory.connect(
await setup.implementation(),
deployer,
deployer
);
const memberAccessPluginImplementation = MemberAccessPlugin__factory.connect(
await setup.memberAccessPluginImplementation(),
deployer,
deployer
);

// Add a timeout for polygon because the call to `implementation()` can fail for newly deployed contracts in the first few seconds
if (network.name === "polygon") {
if (network.name === 'polygon') {
console.log(`Waiting 30secs for ${network.name} to finish up...`);
await setTimeout(30000);
}
Expand All @@ -147,5 +145,5 @@ func.tags = [
SpacePluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
PersonalSpaceAdminPluginSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
GovernancePluginsSetupParams.PLUGIN_SETUP_CONTRACT_NAME,
"Verification",
'Verification',
];
Loading

0 comments on commit 12b5da4

Please sign in to comment.