Skip to content

Commit

Permalink
Remove defender.proposeUpgrade and dependencies for Defender legacy (
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau authored Jun 24, 2024
1 parent 0710619 commit 5c5c90f
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 1,241 deletions.
49 changes: 0 additions & 49 deletions docs/modules/ROOT/pages/api-hardhat-upgrades.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -544,55 +544,6 @@ Similar to `prepareUpgrade`. This method validates and deploys the new implement

* `@openzeppelin/[email protected]`

[[defender-propose-upgrade]]
== defender.proposeUpgrade

[source,ts]
----
async function proposeUpgrade(
proxyAddress: string,
ImplFactory: ContractFactory,
opts?: {
unsafeAllow?: ValidationError[],
unsafeAllowRenames?: boolean,
unsafeSkipStorageCheck?: boolean,
constructorArgs?: unknown[],
timeout?: number,
pollingInterval?: number,
redeployImplementation?: 'always' | 'never' | 'onchange',
kind?: 'uups' | 'transparent' | 'beacon',
title?: string,
description?: string,
multisig?: string,
proxyAdmin?: string,
},
): Promise<{
url: string,
txResponse?: ethers.providers.TransactionResponse,
}>
----

NOTE: This method requires configuring a Defender Team API Key.

Proposes an upgrade using https://docs.openzeppelin.com/defender/admin[Defender Admin].

Similar to `prepareUpgrade`. This method validates and deploys the new implementation contract, but also creates an upgrade proposal in Defender Admin, for review and approval by the upgrade administrators. Supported for UUPS or Transparent proxies. Not currently supported for beacon proxies or beacons. For beacons, use `prepareUpgrade` along with a custom action in Defender Admin to upgrade the beacon to the deployed implementation.

*Parameters:*

* `proxyAddress` - the proxy address.
* `ImplFactory` - the new implementation contract.
* `opts` - an object with options:
** `title`: title of the upgrade proposal as seen in Defender Admin, defaults to `Upgrade to 0x12345678` (using the first 8 digits of the new implementation address)
** `description`: description of the upgrade proposal as seen in Defender Admin, defaults to the full implementation address.
** `multisig`: address of the multisignature wallet contract with the rights to execute the upgrade. This is autodetected in https://docs.openzeppelin.com/contracts/api/proxy#TransparentUpgradeableProxy[Transparent proxies], but required for https://docs.openzeppelin.com/contracts/api/proxy#UUPSUpgradeable[UUPS proxies] (read more https://docs.openzeppelin.com/contracts/api/proxy#transparent-vs-uups[here]). Both Gnosis Safe and Gnosis MultisigWallet multisigs are supported.
** `proxyAdmin`: address of the https://docs.openzeppelin.com/contracts/api/proxy#ProxyAdmin[`ProxyAdmin`] contract that manages the proxy, if exists. This is autodetected in https://docs.openzeppelin.com/contracts/api/proxy#TransparentUpgradeableProxy[Transparent proxies], but required for https://docs.openzeppelin.com/contracts/api/proxy#UUPSUpgradeable[UUPS proxies] (read more https://docs.openzeppelin.com/contracts/api/proxy#transparent-vs-uups[here]), though UUPS proxies typically do not require the usage of a ProxyAdmin.
** additional options as described in <<common-options>>.

*Returns:*

* an object with the URL of the Defender proposal, and the ethers transaction response corresponding to the deployment of the new implementation contract. Note that if the new implementation contract was originally imported as a result of `forceImport`, the ethers transaction response will be undefined.

[[admin-change-proxy-admin]]
== admin.changeProxyAdmin

Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-hardhat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.2.0 (2024-06-24)

- **Breaking change**: Remove `defender.proposeUpgrade` from Defender legacy. Defender users should use `defender.proposeUpgradeWithApproval` instead.

## 3.1.1 (2024-06-03)

- Defender: Fix proxy deployments when using `constructorArgs` option, support arbitrary constructor arguments. ([#1029](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/1029))
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-hardhat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openzeppelin/hardhat-upgrades",
"version": "3.1.1",
"version": "3.2.0",
"description": "",
"repository": "https://github.com/OpenZeppelin/openzeppelin-upgrades/tree/master/packages/plugin-hardhat",
"license": "MIT",
Expand Down Expand Up @@ -35,8 +35,6 @@
"sinon": "^18.0.0"
},
"dependencies": {
"@openzeppelin/defender-admin-client": "^1.52.0",
"@openzeppelin/defender-base-client": "^1.52.0",
"@openzeppelin/defender-sdk-base-client": "^1.10.0",
"@openzeppelin/defender-sdk-deploy-client": "^1.10.0",
"@openzeppelin/defender-sdk-network-client": "^1.10.0",
Expand Down
99 changes: 0 additions & 99 deletions packages/plugin-hardhat/src/defender-v1/propose-upgrade.ts

This file was deleted.

24 changes: 0 additions & 24 deletions packages/plugin-hardhat/src/defender-v1/utils.ts

This file was deleted.

101 changes: 0 additions & 101 deletions packages/plugin-hardhat/src/defender-v1/verify-deployment.ts

This file was deleted.

40 changes: 1 addition & 39 deletions packages/plugin-hardhat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ import type {
GetDeployApprovalProcessFunction,
GetUpgradeApprovalProcessFunction,
} from './defender/get-approval-process';
import type { ProposeUpgradeFunction } from './defender-v1/propose-upgrade';
import type {
VerifyDeployFunction,
VerifyDeployWithUploadedArtifactFunction,
GetVerifyDeployArtifactFunction,
GetVerifyDeployBuildInfoFunction,
GetBytecodeDigestFunction,
} from './defender-v1/verify-deployment';

export interface HardhatUpgrades {
deployProxy: DeployFunction;
Expand Down Expand Up @@ -59,16 +51,7 @@ export interface HardhatUpgrades {
};
}

export interface DefenderV1HardhatUpgrades {
proposeUpgrade: ProposeUpgradeFunction;
verifyDeployment: VerifyDeployFunction;
verifyDeploymentWithUploadedArtifact: VerifyDeployWithUploadedArtifactFunction;
getDeploymentArtifact: GetVerifyDeployArtifactFunction;
getDeploymentBuildInfo: GetVerifyDeployBuildInfoFunction;
getBytecodeDigest: GetBytecodeDigestFunction;
}

export interface DefenderHardhatUpgrades extends HardhatUpgrades, DefenderV1HardhatUpgrades {
export interface DefenderHardhatUpgrades extends HardhatUpgrades {
deployContract: DeployContractFunction;
proposeUpgradeWithApproval: ProposeUpgradeWithApprovalFunction;
getDeployApprovalProcess: GetDeployApprovalProcessFunction;
Expand Down Expand Up @@ -256,26 +239,6 @@ function makeUpgradesFunctions(hre: HardhatRuntimeEnvironment): HardhatUpgrades
return makeFunctions(hre, false);
}

function makeDefenderV1Functions(hre: HardhatRuntimeEnvironment): DefenderV1HardhatUpgrades {
const {
makeVerifyDeploy,
makeVerifyDeployWithUploadedArtifact,
makeGetVerifyDeployBuildInfo,
makeGetVerifyDeployArtifact,
makeGetBytecodeDigest,
} = require('./defender-v1/verify-deployment');
const { makeProposeUpgrade } = require('./defender-v1/propose-upgrade');

return {
proposeUpgrade: makeProposeUpgrade(hre),
verifyDeployment: makeVerifyDeploy(hre),
verifyDeploymentWithUploadedArtifact: makeVerifyDeployWithUploadedArtifact(hre),
getDeploymentArtifact: makeGetVerifyDeployArtifact(hre),
getDeploymentBuildInfo: makeGetVerifyDeployBuildInfo(hre),
getBytecodeDigest: makeGetBytecodeDigest(hre),
};
}

function makeDefenderFunctions(hre: HardhatRuntimeEnvironment): DefenderHardhatUpgrades {
const { makeDeployContract } = require('./deploy-contract');
const { makeProposeUpgradeWithApproval } = require('./defender/propose-upgrade-with-approval');
Expand All @@ -285,7 +248,6 @@ function makeDefenderFunctions(hre: HardhatRuntimeEnvironment): DefenderHardhatU

return {
...makeFunctions(hre, true),
...makeDefenderV1Functions(hre),
deployContract: makeDeployContract(hre, true),
proposeUpgradeWithApproval: makeProposeUpgradeWithApproval(hre, true),
getDeployApprovalProcess: makeGetDeployApprovalProcess(hre),
Expand Down
Loading

0 comments on commit 5c5c90f

Please sign in to comment.