forked from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: change the manifest data json struct * feat: change the script to get the correct params from the manifest data * featL change to ens name * feat: remove the ens domain due to it is not used * feat: update deploy script to get the correct repo address * feat: added IAction to template * feat: bump matchstick version * fix: remove deprecated networks * fix: update the repository in the placeholder * fix: local deploy script problem with `generateRandomName` (aragon#53) * fix: error on local deployment * refactor: move generateName to avoid circular dependency * refactor: metadata encoding * refactor: split upgrade repo script into two (aragon#60) * refactor: renamed file * refactor: extract skip function * refactor: renaming and commenting * style: satisfy linter * chore: maintained guide * refactor: don't alias * fix: wrong import * fix: change the execution order so that reinitialization happens by default * refactor: common steps * doc: subgraph description * fix: remove IAction * refactor: remove IAction (aragon#61) * f: removed IAction from template as is opinonated solution * style: add empty line at EOF --------- Co-authored-by: Michael Heuer <[email protected]> * chore: refactor helpers (aragon#57) * refactor: delete hashHelpers * style: fix linter * fix: import * build: bump OZ dependency * chore: bump osx-commons-sdk dependency * chore: bumped commons-contracts * chore: maintained changelog * chore: bump osx-commons-sdk version (aragon#62) * chore: author change after AA dissolution * chore: sync with `osx-commons` (aragon#63) * chore: bump osx-commons-sdk version * chore: bump osx-commons * fix: yarn lock --------- Co-authored-by: Claudia <[email protected]> Co-authored-by: jordaniza <[email protected]> Co-authored-by: Jordan <[email protected]>
- Loading branch information
1 parent
003ca4e
commit 21c6d76
Showing
19 changed files
with
311 additions
and
554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
213 changes: 0 additions & 213 deletions
213
packages/contracts/deploy/30_upgrade_repo/31_upgrade_repo.ts
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
packages/contracts/deploy/30_upgrade_repo/31a_upgrade_repo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
58 changes: 58 additions & 0 deletions
58
packages/contracts/deploy/30_upgrade_repo/31b_upgrade_and_reinitialize_repo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.