Upgrades

Reference of interfaces and utilities related to upgradeability.

Core

IUpgradeable

use openzeppelin::upgrades::interface::IUpgradeable;

Interface of an upgradeable contract.

Functions

upgrade(new_class_hash: ClassHash) external

Upgrades the contract code by updating its class hash.

This function is usually protected by an Access Control mechanism.

UpgradeableComponent

use openzeppelin::upgrades::upgradeable::UpgradeableComponent;

Upgradeable component.

Internal Implementations

Internal Functions

upgrade(ref self: ContractState, new_class_hash: ClassHash) internal

Upgrades the contract by updating the contract class hash.

Requirements:

  • new_class_hash must be different from zero.

Emits an Upgraded event.

Events

Upgraded(class_hash: ClassHash) event

Emitted when the class hash is upgraded.