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

Feat/update scrips #394

Merged
merged 8 commits into from
Jun 2, 2023
4 changes: 2 additions & 2 deletions .github/helpers/contracts/dummy-dao/createDao.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ async function createDao() {
],
};
const client = IPFS.create({
url: 'https://ipfs-0.aragon.network/api/v0',
url: 'https://prod.ipfs.aragon.network/api/v0',
headers: {
'X-API-KEY': 'yRERPRwFAb5ZiV94XvJdgvDKoGEeFerfFsAQ65',
'X-API-KEY': 'b477RhECf8s8sdM7XrkLBs2wHc4kCMwpbcFC55Kt',
},
});
const cid = await client.add(JSON.stringify(metadataObj));
Expand Down
4 changes: 2 additions & 2 deletions .github/helpers/contracts/dummy-dao/proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ async function proposal() {
],
};
const client = IPFS.create({
url: 'https://ipfs-0.aragon.network/api/v0',
url: 'https://prod.ipfs.aragon.network/api/v0',
headers: {
'X-API-KEY': 'yRERPRwFAb5ZiV94XvJdgvDKoGEeFerfFsAQ65',
'X-API-KEY': 'b477RhECf8s8sdM7XrkLBs2wHc4kCMwpbcFC55Kt',
},
});
const cid = await client.add(JSON.stringify(metadataObj));
Expand Down
1 change: 1 addition & 0 deletions DEPLOYMENT_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This checklist is seen as a guide to deploy the stack to a new chain.

## Pre-Deployment

- [ ] Make sure you are using Node v16
- [ ] Bump the OSx protocol version in the `ProtocolVersion.sol` file.
- [ ] Choose an ENS domain for DAOs
- [ ] Choose an ENS domain for plugins
Expand Down
1 change: 1 addition & 0 deletions UPDATE_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This checklist is seen as a guide to update the existing deployment.

## Pre-Update

- [ ] Make sure you are using Node v16
- [ ] Make sure that the `deploy` property in `packages/contracts/networks.json` points to the correct update
- [ ] Run `yarn` in the repository root to install the dependencies
- [ ] Run `yarn build` in `packages/contracts` to make sure the contracts compile
Expand Down
4 changes: 2 additions & 2 deletions active_contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
"PluginRepoRegistry": "0xc796bB1AfEBc56daDF6CAcD2aDa78055e5381971",
"PluginRepoFactory": "0xDcC5933bc3567E7798Ff00Ab3413cF5f5801BD41",
"PluginSetupProcessor": "0x9227b311C5cecB416707F1C8B7Ca1b52649AabEc",
"DAOFactory": "0x3ff1681f31f68Ff2723d25Cf839bA7500FE5d218",
"DAOFactory": "0x5bDBaAfd90B908058567080513635f560F896918",
"AddresslistVotingSetup": "0xD1CE76c26bc20255157C8ef478276eb115eC02a7",
"TokenVotingSetup": "0x76D3795Df5acF2e2141557BA1Cf094fd54d4e10C",
"AdminSetup": "0x40a3EF0f0780e044EbDDEdAa9AB225158f315afd",
"MultisigSetup": "0x2C233F09CaB08BC66b750CB80da401Bd700B74a0",
"MultisigSetup": "0x8b2361C65E898F40372a0DD5E1BfEE9895A676B3",
mathewmeconry marked this conversation as resolved.
Show resolved Hide resolved
"address-list-voting-repo": "0x71570268A86A80B5cCa3F5e430c2BAa3F4b26278",
"token-voting-repo": "0xaCa70D8c462940B839DE386BcDD4CACf745632cA",
"admin-repo": "0x0DF9b15550fF39149e491dDD154b28f587e0cD16",
Expand Down
27 changes: 24 additions & 3 deletions packages/contracts/deploy/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export async function uploadToIPFS(
networkName: string
): Promise<string> {
const client = IPFS.create({
url: 'https://ipfs-0.aragon.network/api/v0',
url: 'https://prod.ipfs.aragon.network/api/v0',
headers: {
'X-API-KEY': 'yRERPRwFAb5ZiV94XvJdgvDKoGEeFerfFsAQ65',
'X-API-KEY': 'b477RhECf8s8sdM7XrkLBs2wHc4kCMwpbcFC55Kt',
},
});

Expand All @@ -70,6 +70,7 @@ export async function uploadToIPFS(

const cid = await client.add(metadata);
await client.pin.add(cid.cid);
console.log(`Uploaded to IPFS with cid ${cid.cid}`);
return cid.path;
}

Expand All @@ -81,7 +82,7 @@ export async function getContractAddress(

let networkName = network.name;

if (hre.testingFork) {
if (hre.testingFork.network) {
networkName = hre.testingFork.network;
}

Expand All @@ -104,6 +105,26 @@ export async function getContractAddress(
}
} catch (e) {}

return getActiveContractAddressInNetwork(contractName, networkName);
}

export async function getActiveContractAddress(
contractName: string,
hre: HardhatRuntimeEnvironment
): Promise<string> {
let networkName = hre.network.name;

if (hre.testingFork.network) {
networkName = hre.testingFork.network;
}

return getActiveContractAddressInNetwork(contractName, networkName);
}

export async function getActiveContractAddressInNetwork(
contractName: string,
networkName: string
): Promise<string> {
const activeContracts = await getActiveContractsJSON();
try {
return activeContracts[networkName][contractName];
Expand Down
13 changes: 8 additions & 5 deletions packages/contracts/deploy/update/to_v1.3.0/01_DAOFactory.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 {Operation} from '../../../utils/types';
import {getContractAddress} from '../../helpers';
import {getActiveContractAddress} from '../../helpers';
import {DAO__factory} from '../../../typechain';
import {UPDATE_INFOS} from '../../../utils/updates';

Expand All @@ -13,13 +13,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deploy} = deployments;
const [deployer] = await ethers.getSigners();

const managingDAOAddress = await getContractAddress('managingDAO', hre);
const pluginSetupProcessorAddress = await getContractAddress(
const managingDAOAddress = await getActiveContractAddress('managingDAO', hre);
const pluginSetupProcessorAddress = await getActiveContractAddress(
'PluginSetupProcessor',
hre
);
const daoRegistryAddress = await getContractAddress('DAORegistry', hre);
const previousDAOFactoryAddress = await getContractAddress('DAOFactory', hre);
const daoRegistryAddress = await getActiveContractAddress('DAORegistry', hre);
const previousDAOFactoryAddress = await getActiveContractAddress(
'DAOFactory',
hre
);
console.log(`Using managingDAO ${managingDAOAddress}`);
console.log(`Using PluginSetupProcessor ${pluginSetupProcessorAddress}`);
console.log(`Using DAORegistry ${daoRegistryAddress}`);
Expand Down
10 changes: 5 additions & 5 deletions packages/contracts/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"url": "https://goerli.infura.io/v3/481a4cdc7c774286b8627f21c6827f48",
"isTestnet": true,
"chainId": 5,
"deploy": ["./deploy/update/to_v1.2.0", "./deploy/verification"]
"deploy": ["./deploy/update/to_v1.3.0", "./deploy/verification"]
},
"mainnet": {
"url": "https://mainnet.infura.io/v3/481a4cdc7c774286b8627f21c6827f48",
"isTestnet": false,
"chainId": 1,
"deploy": ["./deploy/update/to_v1.2.0", "./deploy/verification"]
"deploy": ["./deploy/update/to_v1.3.0", "./deploy/verification"]
},
"arbitrum": {
"url": "https://arbitrum-mainnet.infura.io/v3/481a4cdc7c774286b8627f21c6827f48",
Expand All @@ -21,13 +21,13 @@
"isTestnet": false,
"chainId": 137,
"feesUrl": "https://gasstation-mainnet.matic.network/v2",
"deploy": ["./deploy/update/to_v1.2.0", "./deploy/verification"]
"deploy": ["./deploy/update/to_v1.3.0", "./deploy/verification"]
},
"mumbai": {
"url": "https://rpc.ankr.com/polygon_mumbai",
"url": "https://polygon-mumbai.infura.io/v3/481a4cdc7c774286b8627f21c6827f48",
"isTestnet": true,
"chainId": 80001,
"feesUrl": "https://gasstation-mumbai.matic.today/v2",
"deploy": ["./deploy/update/to_v1.2.0", "./deploy/verification"]
"deploy": ["./deploy/update/to_v1.3.0", "./deploy/verification"]
}
}