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

chore: sync with osx-plugin-template-hardhat and osx-commons #13

Merged
merged 30 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
242baa8
feat: change the manifest data json struct
clauBv23 Mar 25, 2024
9def9c7
feat: change the script to get the correct params from the manifest data
clauBv23 Mar 25, 2024
f2c31ad
featL change to ens name
clauBv23 Mar 25, 2024
4b4aeca
feat: remove the ens domain due to it is not used
clauBv23 Mar 25, 2024
1adc665
feat: update deploy script to get the correct repo address
clauBv23 Mar 25, 2024
92f7304
Merge pull request #51 from aragon/OS-1148/improve-plugin-template-ma…
clauBv23 Mar 25, 2024
a7b45c3
feat: added IAction to template
jordaniza Mar 27, 2024
648a3e5
feat: bump matchstick version
clauBv23 Mar 28, 2024
5848694
Merge pull request #52 from aragon/f/iaction
jordaniza Apr 2, 2024
090db96
Merge branch 'develop' into feat/bump-matchstick-as-version
jordaniza Apr 2, 2024
8aab444
Merge pull request #54 from aragon/feat/bump-matchstick-as-version
clauBv23 Apr 2, 2024
99ea1da
fix: remove deprecated networks
clauBv23 Apr 2, 2024
f367715
fix: update the repository in the placeholder
clauBv23 Apr 2, 2024
0343bcb
Merge branch 'feat/bump-matchstick-as-version' into feat/improve-temp…
clauBv23 Apr 2, 2024
39a3b87
Merge pull request #55 from aragon/feat/improve-template-repo
clauBv23 Apr 3, 2024
5d892e4
fix: local deploy script problem with `generateRandomName` (#53)
heueristik Apr 11, 2024
5ccb32c
refactor: metadata encoding
heueristik Apr 15, 2024
d35e7e1
refactor: split upgrade repo script into two (#60)
heueristik Apr 15, 2024
663678b
Merge remote-tracking branch 'template/develop' into feature/refactor…
heueristik Apr 16, 2024
f7d541c
doc: subgraph description
heueristik Apr 16, 2024
9772b86
fix: remove IAction
heueristik Apr 16, 2024
5b1aada
refactor: remove IAction (#61)
jordaniza Apr 16, 2024
9ae31a3
Merge remote-tracking branch 'template/develop' into feature/refactor…
heueristik Apr 16, 2024
a779deb
chore: refactor helpers (#57)
heueristik Apr 18, 2024
4310e9d
Merge remote-tracking branch 'template/develop' into feature/refactor…
heueristik Apr 18, 2024
b7e4515
chore: maintained changelog
heueristik Apr 18, 2024
be13d01
chore: bump osx-commons-sdk version (#62)
heueristik Apr 22, 2024
57da5c3
chore: author change after AA dissolution
heueristik Apr 23, 2024
3e9e3b4
chore: sync with `osx-commons` (#63)
heueristik Apr 23, 2024
e4fafc0
Merge remote-tracking branch 'template/develop' into feature/refactor…
heueristik Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -13,5 +13,6 @@ and this project adheres to the [Aragon OSx Plugin Versioning Convention](https:

### Changed

- Bumped OpenZepplin to `4.9.6`.
- Used `ProxyLib` from `osx-commons-contracts` for the minimal proxy deployment in `AdminSetup`.
- Hard-coded the `bytes32 internal constant EXECUTE_PERMISSION_ID` constant in `AdminSetup` until it is available in `PermissionLib`.
5 changes: 5 additions & 0 deletions packages/contracts/deploy/00_info/01_info.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {PLUGIN_REPO_ENS_SUBDOMAIN_NAME} from '../../plugin-settings';
import {
AragonOSxAsciiArt,
getProductionNetworkName,
@@ -52,6 +53,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
await deployer.getBalance()
)} native tokens.`
);

console.log(
`Chosen PluginRepo ENS subdomain name: '${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}'`
);
};

export default func;
4 changes: 2 additions & 2 deletions packages/contracts/deploy/10_create_repo/11_create_repo.ts
Original file line number Diff line number Diff line change
@@ -58,8 +58,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// Get the PluginRepo address and deployment block number from the txn and event therein
const eventLog =
await findEventTopicLog<PluginRepoRegistryEvents.PluginRepoRegisteredEvent>(
tx,
findEventTopicLog<PluginRepoRegistryEvents.PluginRepoRegisteredEvent>(
await tx.wait(),
PluginRepoRegistry__factory.createInterface(),
'PluginRepoRegistered'
);
19 changes: 10 additions & 9 deletions packages/contracts/deploy/20_new_version/23_publish.ts
Original file line number Diff line number Diff line change
@@ -12,12 +12,9 @@ import {
isLocal,
pluginEnsDomain,
} from '../../utils/helpers';
import {
PLUGIN_REPO_PERMISSIONS,
toHex,
uploadToIPFS,
} from '@aragon/osx-commons-sdk';
import {PLUGIN_REPO_PERMISSIONS, uploadToIPFS} from '@aragon/osx-commons-sdk';
import {writeFile} from 'fs/promises';
import {ethers} from 'hardhat';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import path from 'path';
@@ -114,8 +111,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
.createVersion(
VERSION.release,
setup.address,
toHex(buildMetadataURI),
toHex(releaseMetadataURI)
ethers.utils.hexlify(ethers.utils.toUtf8Bytes(buildMetadataURI)),
ethers.utils.hexlify(ethers.utils.toUtf8Bytes(releaseMetadataURI))
);

await tx.wait();
@@ -145,8 +142,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
createVersion: {
_release: VERSION.release,
_pluginSetup: setup.address,
_buildMetadata: toHex(buildMetadataURI),
_releaseMetadata: toHex(releaseMetadataURI),
_buildMetadata: ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(buildMetadataURI)
),
_releaseMetadata: ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(releaseMetadataURI)
),
},
},
],
213 changes: 0 additions & 213 deletions packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts

This file was deleted.

36 changes: 36 additions & 0 deletions packages/contracts/deploy/30_upgrade_repo/31a_upgrade_repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {fetchData, skipUpgrade} from './_common';
import {PLUGIN_REPO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

/**
* Upgrades the plugin repo to the latest implementation.
* This script CAN be called if the contract does not require reinitialization.
* It MUST NOY be called if the contract requires reinitialization, because this
* would leave the proxy unreinitialized.
* @param {HardhatRuntimeEnvironment} hre
*/
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployer, pluginRepo, latestPluginRepoImplementation} =
await fetchData(hre);

// Check if deployer has the permission to upgrade the plugin repo
if (
await pluginRepo.isGranted(
pluginRepo.address,
deployer.address,
PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID,
[]
)
) {
await pluginRepo.upgradeTo(latestPluginRepoImplementation.address);
} else {
throw Error(
`The new version cannot be published because the deployer ('${deployer.address}')
is lacking the ${PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID} permission.`
);
}
};
export default func;
func.tags = ['UpgradeRepo'];
func.skip = skipUpgrade;
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {fetchData, skipUpgrade} from './_common';
import {PLUGIN_REPO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {BytesLike} from 'ethers';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

/**
* Upgrades the plugin repo to the latest implementation and reinitializes the proxy.
* This script MUST be called if the contract requires reinitialization -- otherwise
* the proxy is left unreinitialized.
* @param {HardhatRuntimeEnvironment} hre
*/
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployer, pluginRepo, latestPluginRepoImplementation, current} =
await fetchData(hre);

// Define the `_initData` arguments
const initData: BytesLike[] = [];

// Encode the call to `function initializeFrom(uint8[3] calldata _previousProtocolVersion, bytes calldata _initData)` with `initData`.
const initializeFromCalldata =
latestPluginRepoImplementation.interface.encodeFunctionData(
// Re-initialization will happen through a call to `function initializeFrom(uint8[3] calldata _previousProtocolVersion, bytes calldata _initData)`
// that Aragon will add to the `PluginRepo` contract once it's required.
'initializeFrom',
[current, initData]
);

// Check if deployer has the permission to upgrade the plugin repo
if (
await pluginRepo.isGranted(
pluginRepo.address,
deployer.address,
PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID,
[]
)
) {
// Use `upgradeToAndCall` to reinitialize the new `PluginRepo` implementation after the update.
if (initializeFromCalldata.length > 0) {
await pluginRepo.upgradeToAndCall(
latestPluginRepoImplementation.address,
initializeFromCalldata
);
} else {
throw Error(
`Initialization data is missing for 'upgradeToAndCall'. Stopping repo upgrade and reinitialization...`
);
}
} else {
throw Error(
`The new version cannot be published because the deployer ('${deployer.address}')
is lacking the ${PLUGIN_REPO_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID} permission.`
);
}
};
export default func;
func.tags = ['UpgradeAndReinitializeRepo'];
func.skip = skipUpgrade;
Loading