Defender

Smart contract Defender utilities and implementations

import "@openzeppelin/src/Defender.sol";

Library for interacting with OpenZeppelin Defender from Forge scripts or tests.

deployContract(string contractName) → address

internal

#

Deploys a contract to the current network using OpenZeppelin Defender.

Do not use this function directly if you are deploying an upgradeable contract. This function does not validate whether the contract is upgrade safe.

NOTE: If using an EOA or Safe to deploy, go to Defender deploy to submit the pending deployment while the script is running. The script waits for the deployment to complete before it continues.

deployContract(string contractName, struct DefenderOptions defenderOpts) → address

internal

#

Deploys a contract to the current network using OpenZeppelin Defender.

Do not use this function directly if you are deploying an upgradeable contract. This function does not validate whether the contract is upgrade safe.

NOTE: If using an EOA or Safe to deploy, go to Defender deploy to submit the pending deployment while the script is running. The script waits for the deployment to complete before it continues.

deployContract(string contractName, bytes constructorData) → address

internal

#

Deploys a contract with constructor arguments to the current network using OpenZeppelin Defender.

Do not use this function directly if you are deploying an upgradeable contract. This function does not validate whether the contract is upgrade safe.

NOTE: If using an EOA or Safe to deploy, go to Defender deploy to submit the pending deployment while the script is running. The script waits for the deployment to complete before it continues.

deployContract(string contractName, bytes constructorData, struct DefenderOptions defenderOpts) → address

internal

#

Deploys a contract with constructor arguments to the current network using OpenZeppelin Defender.

Do not use this function directly if you are deploying an upgradeable contract. This function does not validate whether the contract is upgrade safe.

NOTE: If using an EOA or Safe to deploy, go to Defender deploy to submit the pending deployment while the script is running. The script waits for the deployment to complete before it continues.

proposeUpgrade(address proxyAddress, string newImplementationContractName, struct Options opts) → struct ProposeUpgradeResponse

internal

#

Proposes an upgrade to an upgradeable proxy using OpenZeppelin Defender.

This function validates a new implementation contract in comparison with a reference contract, deploys the new implementation contract using Defender, and proposes an upgrade to the new implementation contract using an upgrade approval process on Defender.

Supported for UUPS or Transparent proxies. Not currently supported for beacon proxies or beacons. For beacons, use Upgrades.prepareUpgrade along with a transaction proposal on Defender to upgrade the beacon to the deployed implementation.

Requires that either the referenceContract option is set, or the contract has a @custom:oz-upgrades-from <reference> annotation.

Ensure that the reference contract is the same as the current implementation contract that the proxy is pointing to.

This function does not validate that the reference contract is the current implementation.

NOTE: If using an EOA or Safe to deploy, go to Defender deploy to submit the pending deployment of the new implementation contract while the script is running. The script waits for the deployment to complete before it continues.

getDeployApprovalProcess() → struct ApprovalProcessResponse

internal

#

Gets the default deploy approval process configured for your deployment environment on OpenZeppelin Defender.

getUpgradeApprovalProcess() → struct ApprovalProcessResponse

internal

#

Gets the default upgrade approval process configured for your deployment environment on OpenZeppelin Defender. For example, this is useful for determining the default multisig wallet that you can use in your scripts to assign as the owner of your proxy.

import "@openzeppelin/src/Defender.sol";
import "@openzeppelin/src/Defender.sol";