Skip to content

Commit

Permalink
feat: moved most of the deploy scripts without tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaniza committed Mar 7, 2024
1 parent e61d1b0 commit 54aa7c0
Show file tree
Hide file tree
Showing 13 changed files with 349 additions and 415 deletions.

This file was deleted.

This file was deleted.

52 changes: 0 additions & 52 deletions packages/contracts/deploy/20_new_version/10_token_voting_setup.ts

This file was deleted.

This file was deleted.

46 changes: 43 additions & 3 deletions packages/contracts/deploy/20_new_version/21_setup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import {PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings';
import governanceERC20Artifact from '../../artifacts/src/ERC20/governance/GovernanceERC20.sol/GovernanceERC20.json';
import governanceWrappedERC20Artifact from '../../artifacts/src/ERC20/governance/GovernanceWrappedERC20.sol/GovernanceWrappedERC20.json';
import {
GOVERNANCE_ERC20_DEPLOY_ARGS,
GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS,
PLUGIN_SETUP_CONTRACT_NAME,
} from '../../plugin-settings';
import {
GOVERNANCE_ERC20_CONTRACT_NAME,
GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME,
} from '../../plugin-settings';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import path from 'path';

/**
* Deploys the plugin setup contract with the plugin implementation inside.
* In the case of the token voting plugin, we also need to deploy the governance ERC20
* and the wrapped variants.
* @param {HardhatRuntimeEnvironment} hre
*/
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
Expand All @@ -14,11 +26,39 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deploy} = deployments;
const {deployer} = await getNamedAccounts();

await deploy(PLUGIN_SETUP_CONTRACT_NAME, {
// Deploy the bases for the TokenVotingSetup
const governanceERC20DeployResult = await deploy(
GOVERNANCE_ERC20_CONTRACT_NAME,
{
contract: governanceERC20Artifact,
from: deployer,
args: GOVERNANCE_ERC20_DEPLOY_ARGS,
log: true,
}
);

const governanceWrappedERC20DeployResult = await deploy(
GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME,
{
contract: governanceWrappedERC20Artifact,
from: deployer,
args: GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS,
log: true,
}
);

const res = await deploy(PLUGIN_SETUP_CONTRACT_NAME, {
from: deployer,
args: [],
args: [
governanceERC20DeployResult.address,
governanceWrappedERC20DeployResult.address,
],
log: true,
});

console.log(
`Deployed contract '${PLUGIN_SETUP_CONTRACT_NAME}' at ${res.address}.`
);
};

export default func;
Expand Down
37 changes: 32 additions & 5 deletions packages/contracts/deploy/20_new_version/22_setup_conclude.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import {PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings';
import {MyPluginSetup__factory, MyPlugin__factory} from '../../typechain';
import {
GOVERNANCE_ERC20_CONTRACT_NAME,
GOVERNANCE_ERC20_DEPLOY_ARGS,
GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME,
GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS,
PLUGIN_SETUP_CONTRACT_NAME,
} from '../../plugin-settings';
import {TokenVotingSetup__factory, TokenVoting__factory} from '../../typechain';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import path from 'path';
Expand All @@ -17,24 +23,45 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Get the plugin setup address
const setupDeployment = await deployments.get(PLUGIN_SETUP_CONTRACT_NAME);
const setup = MyPluginSetup__factory.connect(
const setup = TokenVotingSetup__factory.connect(
setupDeployment.address,
deployer
);
// Get the plugin implementation address
const implementation = MyPlugin__factory.connect(
const implementation = TokenVoting__factory.connect(
await setup.implementation(),
deployer
);

const governanceERC20DeployResult = await deployments.get(
GOVERNANCE_ERC20_CONTRACT_NAME
);
const governanceWrappedERC20DeployResult = await deployments.get(
GOVERNANCE_WRAPPED_ERC20_CONTRACT_NAME
);

// Queue the plugin setup and implementation for verification on the block explorers
hre.aragonToVerifyContracts.push({
address: setup.address,
args: setupDeployment.args,
});

hre.aragonToVerifyContracts.push({
address: implementation.address,
args: [],
args: [
governanceERC20DeployResult.address,
governanceWrappedERC20DeployResult.address,
],
});

hre.aragonToVerifyContracts.push({
address: governanceERC20DeployResult.address,
args: GOVERNANCE_ERC20_DEPLOY_ARGS,
});

hre.aragonToVerifyContracts.push({
address: governanceWrappedERC20DeployResult.address,
args: GOVERNANCE_WRAPPED_ERC20_DEPLOY_ARGS,
});
};

Expand Down
Loading

0 comments on commit 54aa7c0

Please sign in to comment.