Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

InternalTrait

Fully qualified path: openzeppelin_upgrades::upgradeable::UpgradeableComponent::InternalTrait

pub trait InternalTrait<TContractState, +HasComponent<TContractState>>

Trait functions

upgrade

Replaces the contract’s class hash with new_class_hash.

Requirements:

  • new_class_hash is not zero.

Emits an Upgraded event.

Fully qualified path: openzeppelin_upgrades::upgradeable::UpgradeableComponent::InternalTrait::upgrade

fn upgrade(ref self: ComponentState<TContractState>, new_class_hash: ClassHash)

upgrade_and_call

Replaces the contract’s class hash with new_class_hash and then calls selector from the upgraded context. This function returns the unwrapped response data from a call made to the contract itself, using the specified selector as the entrypoint.

Requirements:

  • new_class_hash is not zero.

Emits an Upgraded event.

Fully qualified path: openzeppelin_upgrades::upgradeable::UpgradeableComponent::InternalTrait::upgrade_and_call

fn upgrade_and_call(
    ref self: ComponentState<TContractState>,
    new_class_hash: ClassHash,
    selector: felt252,
    calldata: Span<felt252>,
) -> Span<felt252>