Skip to content

Commit

Permalink
feat: add calldata to json file (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
clauBv23 authored Feb 18, 2025
1 parent 8d13144 commit 2177e56
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions packages/contracts/deploy/20_new_version/23_publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
isValidAddress,
} from '../../utils/helpers';
import {PLUGIN_REPO_PERMISSIONS, uploadToPinata} from '@aragon/osx-commons-sdk';
import {PluginRepo__factory} from '@aragon/osx-ethers';
import {writeFile} from 'fs/promises';
import {ethers} from 'hardhat';
import {DeployFunction} from 'hardhat-deploy/types';
Expand Down Expand Up @@ -172,6 +173,25 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
} else {
// The deployer does not have `MAINTAINER_PERMISSION_ID` permission and we are not deploying to a production network,
// so we write the data into a file for a management DAO member to create a proposal from it.
const pluginRepoInterface = PluginRepo__factory.createInterface();
const versionData = {
_release: VERSION.release,
_pluginSetup: setup.address,
_buildMetadata: ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(buildMetadataURI)
),
_releaseMetadata: ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(releaseMetadataURI)
),
};

const calldata = pluginRepoInterface.encodeFunctionData('createVersion', [
versionData._release,
versionData._pluginSetup,
versionData._buildMetadata,
versionData._releaseMetadata,
]);

const data = {
proposalTitle: `Publish '${PLUGIN_CONTRACT_NAME}' plugin v${VERSION.release}.${VERSION.build}`,
proposalSummary: `Publishes v${VERSION.release}.${VERSION.build} of the '${PLUGIN_CONTRACT_NAME}' plugin in the '${ensDomain}' plugin repo.`,
Expand All @@ -181,16 +201,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
actions: [
{
to: pluginRepo.address,
createVersion: {
_release: VERSION.release,
_pluginSetup: setup.address,
_buildMetadata: ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(buildMetadataURI)
),
_releaseMetadata: ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(releaseMetadataURI)
),
},
value: 0,
data: calldata,
createVersion: versionData,
},
],
};
Expand Down

0 comments on commit 2177e56

Please sign in to comment.