Skip to content

Commit

Permalink
fix all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Jan 20, 2025
2 parents b11064f + f511b4e commit 4f82aff
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 31 deletions.
22 changes: 14 additions & 8 deletions packages/contracts/deploy/20_new_version/23_publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
isLocal,
pluginEnsDomain,
} from '../../utils/helpers';
import {PLUGIN_REPO_PERMISSIONS, uploadToIPFS} from '@aragon/osx-commons-sdk';
import {PLUGIN_REPO_PERMISSIONS, uploadToPinata} from '@aragon/osx-commons-sdk';
import {writeFile} from 'fs/promises';
import {ethers} from 'hardhat';
import {DeployFunction} from 'hardhat-deploy/types';
Expand All @@ -31,14 +31,20 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments} = hre;
const [deployer] = await hre.ethers.getSigners();

// Upload the metadata to IPFS
const releaseMetadataURI = `ipfs://${await uploadToIPFS(
JSON.stringify(METADATA.release, null, 2)
)}`;
const buildMetadataURI = `ipfs://${await uploadToIPFS(
JSON.stringify(METADATA.build, null, 2)
)}`;
let releaseMetadataURI = '0x';
let buildMetadataURI = '0x';

if (!isLocal(hre)) {
// Upload the metadata to IPFS
releaseMetadataURI = await uploadToPinata(
JSON.stringify(METADATA.release, null, 2),
`${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-release-metadata`
);
buildMetadataURI = await uploadToPinata(
JSON.stringify(METADATA.build, null, 2),
`${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}-build-metadata`
);
}
console.log(`Uploaded release metadata: ${releaseMetadataURI}`);
console.log(`Uploaded build metadata: ${buildMetadataURI}`);

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/plugin-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const PLUGIN_CONTRACT_NAME = 'Admin';
export const PLUGIN_SETUP_CONTRACT_NAME = isZkSync(hre.network.name)
? 'AdminSetupZkSync'
: 'AdminSetup';
export const PLUGIN_REPO_ENS_SUBDOMAIN_NAME = 'test-admin-6'; // 'admin.plugin.dao.eth'
export const PLUGIN_REPO_ENS_SUBDOMAIN_NAME = 'admin'; // 'admin.plugin.dao.eth'

// Specify the version of your plugin that you are currently working on. The first version is v1.1.
// For more details, visit https://devs.aragon.org/docs/osx/how-it-works/framework/plugin-management/plugin-repo.
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/10_unit-testing/11_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ async function fixture(): Promise<FixtureResult> {
);

if (!isZksync) {
initializedPlugin.initialize(dao.address, targetConfig);
await initializedPlugin.initialize(dao.address, targetConfig);
}

const dummyActions: DAOStructs.ActionStruct[] = [
Expand Down
33 changes: 19 additions & 14 deletions packages/contracts/test/20_integration-testing/21_deployment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {METADATA, VERSION} from '../../plugin-settings';
import {VERSION, PLUGIN_SETUP_CONTRACT_NAME} from '../../plugin-settings';
import {getProductionNetworkName, findPluginRepo} from '../../utils/helpers';
import {loadFixtureCustom} from '../test-utils/fixture';
import {skipTestSuiteIfNetworkIsZkSync} from '../test-utils/skip-functions';
import {
getLatestNetworkDeployment,
Expand All @@ -11,7 +10,6 @@ import {
PERMISSION_MANAGER_FLAGS,
PLUGIN_REPO_PERMISSIONS,
UnsupportedNetworkError,
uploadToIPFS,
} from '@aragon/osx-commons-sdk';
import {
DAO,
Expand All @@ -20,6 +18,7 @@ import {
PluginRepoRegistry,
PluginRepoRegistry__factory,
} from '@aragon/osx-ethers';
import {loadFixture} from '@nomicfoundation/hardhat-network-helpers';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import env, {deployments, ethers} from 'hardhat';
Expand All @@ -30,13 +29,13 @@ skipTestSuiteIfNetworkIsZkSync(
`Deployment on network '${productionNetworkName}'`,
function () {
it('creates the repo', async () => {
const {pluginRepo, pluginRepoRegistry} = await loadFixtureCustom(fixture);
const {pluginRepo, pluginRepoRegistry} = await loadFixture(fixture);

expect(await pluginRepoRegistry.entries(pluginRepo.address)).to.be.true;
});

it('gives the management DAO permissions over the repo', async () => {
const {pluginRepo, managementDaoProxy} = await loadFixtureCustom(fixture);
const {pluginRepo, managementDaoProxy} = await loadFixture(fixture);

expect(
await pluginRepo.isGranted(
Expand Down Expand Up @@ -68,20 +67,16 @@ skipTestSuiteIfNetworkIsZkSync(

context('PluginSetup Publication', async () => {
it('registers the setup', async () => {
const {pluginRepo} = await loadFixtureCustom(fixture);
const {pluginRepo, pluginSetupAddr} = await loadFixture(fixture);

const results = await pluginRepo['getVersion((uint8,uint16))']({
release: VERSION.release,
build: VERSION.build,
});

const buildMetadataURI = `ipfs://${await uploadToIPFS(
JSON.stringify(METADATA.build, null, 2)
)}`;

expect(results.buildMetadata).to.equal(
ethers.utils.hexlify(ethers.utils.toUtf8Bytes(buildMetadataURI))
);
expect(results.pluginSetup).to.equal(pluginSetupAddr);
expect(results.tag.build).to.equal(VERSION.build);
expect(results.tag.release).to.equal(VERSION.release);
});
});
}
Expand All @@ -92,6 +87,7 @@ type FixtureResult = {
pluginRepo: PluginRepo;
pluginRepoRegistry: PluginRepoRegistry;
managementDaoProxy: DAO;
pluginSetupAddr: string;
};

async function fixture(): Promise<FixtureResult> {
Expand Down Expand Up @@ -128,5 +124,14 @@ async function fixture(): Promise<FixtureResult> {
deployer
);

return {deployer, pluginRepo, pluginRepoRegistry, managementDaoProxy};
const pluginSetupAddr = (await deployments.get(PLUGIN_SETUP_CONTRACT_NAME))
.address;

return {
deployer,
pluginRepo,
pluginRepoRegistry,
managementDaoProxy,
pluginSetupAddr,
};
}
2 changes: 1 addition & 1 deletion packages/contracts/test/test-utils/wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class Wrapper {
const deployRes = await this.network.deploy(artifactName, constructorArgs);

const artifact = deployRes.artifact;
const contract = deployRes.contract;
let contract = deployRes.contract;

if (isProxy) {
const {contract: proxyFactoryContract} = await this.network.deploy(
Expand Down
13 changes: 7 additions & 6 deletions packages/contracts/utils/zkSync.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export const ZK_SYNC_NETWORKS = ['zkMainnet', 'zkLocalTestnet', 'zkTestnet'];
export const ZK_SYNC_NETWORKS = [
'zkMainnet',
'zkLocalTestnet',
'zkTestnet',
'zksyncSepolia',
];
export function isZkSync(networkName: string): boolean {
return (
networkName === 'zksyncSepolia' ||
networkName === 'zkLocalTestnet' ||
networkName === 'zksyncMainnet'
);
return ZK_SYNC_NETWORKS.includes(networkName);
}

0 comments on commit 4f82aff

Please sign in to comment.