Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

openzeppelin_utils

Fully qualified path: openzeppelin_utils

Modules


Re-exports:

nonces—
snip12—

Modules

Modules

bytearray

Fully qualified path: openzeppelin_utils::bytearray

Free functions

read_n_bytesReads n bytes from a byte array starting from a given index. Requirements:…
to_byte_arrayConverts a value to a byte array with a given base and padding. Requirements:…
hash_byte_arrayReturns a unique hash given a ByteArray. The hash is computed by serializing the data into a span of felts, and then hashing the span using the Pedersen hash algorithm.

Traits

Impls

ByteArrayExtImplByteArray extension trait.

Free functions

Free functions

read_n_bytesReads n bytes from a byte array starting from a given index. Requirements:…
to_byte_arrayConverts a value to a byte array with a given base and padding. Requirements:…
hash_byte_arrayReturns a unique hash given a ByteArray. The hash is computed by serializing the data into a span of felts, and then hashing the span using the Pedersen hash algorithm.

read_n_bytes

Reads n bytes from a byte array starting from a given index.

Requirements:

  • start + n must be less than or equal to the length of the byte array.

Fully qualified path: openzeppelin_utils::bytearray::read_n_bytes

pub fn read_n_bytes(data: @ByteArray, start: u32, n: u32) -> ByteArray

to_byte_array

Converts a value to a byte array with a given base and padding.

Requirements:

  • base cannot be zero.

Fully qualified path: openzeppelin_utils::bytearray::to_byte_array

pub fn to_byte_array<T, +Into<T, felt252>, +Copy<T>>(value: @T, base: u8, padding: u16) -> ByteArray

hash_byte_array

Returns a unique hash given a ByteArray.

The hash is computed by serializing the data into a span of felts, and then hashing the span using the Pedersen hash algorithm.

Fully qualified path: openzeppelin_utils::bytearray::hash_byte_array

pub fn hash_byte_array(data: @ByteArray) -> felt252

Traits

Traits

ByteArrayExtTrait

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtTrait

pub trait ByteArrayExtTrait

Trait functions

read_n_bytes

Requirements:

  • start + n must be less than or equal to the length of the byte array.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtTrait::read_n_bytes

fn read_n_bytes(self: @ByteArray, start: u32, n: u32) -> ByteArray

to_byte_array

Converts a value to a byte array with a given base and padding.

Requirements:

  • base cannot be zero.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtTrait::to_byte_array

fn to_byte_array<T, +Into<T, felt252>, +Copy<T>>(self: @T, base: u8, padding: u16) -> ByteArray

hash

Hashes a byte array using the Pedersen hash algorithm. Encodes the byte array as a ´Span´ by serializing ´data´.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtTrait::hash

fn hash(self: @ByteArray) -> felt252

Impls

Impls

ByteArrayExtImplByteArray extension trait.

ByteArrayExtImpl

ByteArray extension trait.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtImpl

pub impl ByteArrayExtImpl of ByteArrayExtTrait;

Impl functions

read_n_bytes

Requirements:

  • start + n must be less than or equal to the length of the byte array.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtImpl::read_n_bytes

fn read_n_bytes(self: @ByteArray, start: u32, n: u32) -> ByteArray

to_byte_array

Converts a value to a byte array with a given base and padding.

Requirements:

  • base cannot be zero.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtImpl::to_byte_array

fn to_byte_array(self: @T, base: u8, padding: u16) -> ByteArray

hash

Hashes a byte array using the Pedersen hash algorithm. Encodes the byte array as a ´Span´ by serializing ´data´.

Fully qualified path: openzeppelin_utils::bytearray::ByteArrayExtImpl::hash

fn hash(self: @ByteArray) -> felt252

contract_clock

Fully qualified path: openzeppelin_utils::contract_clock

Modules


Re-exports:



Modules

Modules

block_number

Fully qualified path: openzeppelin_utils::contract_clock::block_number

Impls

Impls

Impls

ERC6372BlockNumberClock

Fully qualified path: openzeppelin_utils::contract_clock::block_number::ERC6372BlockNumberClock

pub impl ERC6372BlockNumberClock of ERC6372Clock;

Impl functions

clock

See ERC6372Clock::clock.

Fully qualified path: openzeppelin_utils::contract_clock::block_number::ERC6372BlockNumberClock::clock

fn clock() -> u64

CLOCK_MODE

See ERC6372Clock::CLOCK_MODE.

Fully qualified path: openzeppelin_utils::contract_clock::block_number::ERC6372BlockNumberClock::CLOCK_MODE

fn CLOCK_MODE() -> ByteArray

erc_6372

Fully qualified path: openzeppelin_utils::contract_clock::erc_6372

Traits

Traits

Traits

ERC6372Clock

Fully qualified path: openzeppelin_utils::contract_clock::erc_6372::ERC6372Clock

pub trait ERC6372Clock

Trait functions

clock

Returns the current timepoint determined by the contract’s operational mode, intended for use in time-sensitive logic. See https://eips.ethereum.org/EIPS/eip-6372#clock.

Requirements:

  • This function MUST always be non-decreasing.

NOTE: While this function returns a u64 value, timepoints must fit into u48 according to the EIP-6372 specification.

Fully qualified path: openzeppelin_utils::contract_clock::erc_6372::ERC6372Clock::clock

fn clock() -> u64

CLOCK_MODE

Returns a description of the clock the contract is operating in. See https://eips.ethereum.org/EIPS/eip-6372#clock_mode.

Requirements:

  • The output MUST be formatted like a URL query string, decodable in standard JavaScript.

Fully qualified path: openzeppelin_utils::contract_clock::erc_6372::ERC6372Clock::CLOCK_MODE

fn CLOCK_MODE() -> ByteArray

timestamp

Fully qualified path: openzeppelin_utils::contract_clock::timestamp

Impls

Impls

Impls

ERC6372TimestampClock

Fully qualified path: openzeppelin_utils::contract_clock::timestamp::ERC6372TimestampClock

pub impl ERC6372TimestampClock of ERC6372Clock;

Impl functions

clock

See ERC6372Clock::clock.

Fully qualified path: openzeppelin_utils::contract_clock::timestamp::ERC6372TimestampClock::clock

fn clock() -> u64

CLOCK_MODE

See ERC6372Clock::CLOCK_MODE.

Fully qualified path: openzeppelin_utils::contract_clock::timestamp::ERC6372TimestampClock::CLOCK_MODE

fn CLOCK_MODE() -> ByteArray

cryptography

Fully qualified path: openzeppelin_utils::cryptography

Modules

nonces—
snip12—

Modules

Modules

nonces—
snip12—

nonces

Fully qualified path: openzeppelin_utils::cryptography::nonces

Modules

Modules

Modules

NoncesComponent

Nonces Component

The Nonces component provides a simple mechanism for handling incremental nonces for a set of addresses. It is commonly used to prevent replay attacks when contracts accept signatures as input.

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent

Modules

Free functions

Structs

Enums

Event—

Traits

Modules

Modules

Errors

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::Errors

Constants

Constants

Constants

INVALID_NONCE

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::Errors::INVALID_NONCE

pub const INVALID_NONCE: felt252 = 114633287427981701509025378867516584301826866570085;

__external_NoncesImpl

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::__external_NoncesImpl

__l1_handler_NoncesImpl

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::__l1_handler_NoncesImpl

__constructor_NoncesImpl

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::__constructor_NoncesImpl

Free functions

Free functions

unsafe_new_component_state

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::unsafe_new_component_state

pub fn unsafe_new_component_state<TContractState>() -> ComponentState<TContractState>

Structs

Structs

Storage

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::Storage

[storage]
pub struct Storage {
    pub Nonces_nonces: Map<ContractAddress, felt252>,
}

Members

Nonces_nonces

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::Storage::Nonces_nonces

pub Nonces_nonces: Map<ContractAddress, felt252>

ComponentState

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::ComponentState

pub struct ComponentState<TContractState> {}

Enums

Enums

Event—

Event

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::Event

pub enum Event {}

Traits

Traits

HasComponent

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::HasComponent

pub trait HasComponent<TContractState>

Trait functions

get_component

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::HasComponent::get_component

fn get_component(self: @TContractState) -> @ComponentState<TContractState>

get_component_mut

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::HasComponent::get_component_mut

fn get_component_mut(ref self: TContractState) -> ComponentState<TContractState>

get_contract

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::HasComponent::get_contract

fn get_contract(self: @ComponentState<TContractState>) -> @TContractState

get_contract_mut

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::HasComponent::get_contract_mut

fn get_contract_mut(ref self: ComponentState<TContractState>) -> TContractState

emit

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::HasComponent::emit

fn emit<S, impl IntoImp: Into<S, openzeppelin_utils::cryptography::nonces::NoncesComponent::Event>>(
    ref self: ComponentState<TContractState>, event: S,
)

InternalTrait

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::InternalTrait

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

Trait functions

use_nonce

Consumes a nonce, returns the current value, and increments nonce.

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::InternalTrait::use_nonce

fn use_nonce(ref self: ComponentState<TContractState>, owner: ContractAddress) -> felt252

use_checked_nonce

Same as use_nonce but checking that nonce is the next valid one for owner.

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::InternalTrait::use_checked_nonce

fn use_checked_nonce(
    ref self: ComponentState<TContractState>, owner: ContractAddress, nonce: felt252,
) -> felt252

UnsafeNewContractStateTraitForNoncesImpl

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::UnsafeNewContractStateTraitForNoncesImpl

pub trait UnsafeNewContractStateTraitForNoncesImpl<TContractState>

Trait functions

unsafe_new_contract_state

Fully qualified path: openzeppelin_utils::cryptography::nonces::NoncesComponent::UnsafeNewContractStateTraitForNoncesImpl::unsafe_new_contract_state

fn unsafe_new_contract_state() -> TContractState

snip12

Fully qualified path: openzeppelin_utils::cryptography::snip12

Constants

Structs

StarknetDomainGeneric Starknet domain separator representation as defined in SNIP-12.

Traits

StructHashTrait for calculating the hash of a struct.
OffchainMessageHashTrait for calculating the hash of a message given the passed signer .
SNIP12Metadata—

Impls

StructHashStarknetDomainImplImplementation of StructHash that calculates the Poseidon hash of type StarknetDomain .
SNIP12HashSpanImplHash trait implementation for a span of elements according to SNIP-12.

Constants

Constants

STARKNET_DOMAIN_TYPE_HASH

Fully qualified path: openzeppelin_utils::cryptography::snip12::STARKNET_DOMAIN_TYPE_HASH

pub const STARKNET_DOMAIN_TYPE_HASH: felt252 =
    903185825206485993942627316682662375025985481915563849197465435174148809232;

Structs

Structs

StarknetDomainGeneric Starknet domain separator representation as defined in SNIP-12.

StarknetDomain

Generic Starknet domain separator representation as defined in SNIP-12.

Fully qualified path: openzeppelin_utils::cryptography::snip12::StarknetDomain

[derive(Drop, Copy, Hash)]
pub struct StarknetDomain {
    pub name: felt252,
    pub version: felt252,
    pub chain_id: felt252,
    pub revision: felt252,
}

Members

name

Fully qualified path: openzeppelin_utils::cryptography::snip12::StarknetDomain::name

pub name: felt252

version

Fully qualified path: openzeppelin_utils::cryptography::snip12::StarknetDomain::version

pub version: felt252

chain_id

Fully qualified path: openzeppelin_utils::cryptography::snip12::StarknetDomain::chain_id

pub chain_id: felt252

revision

Fully qualified path: openzeppelin_utils::cryptography::snip12::StarknetDomain::revision

pub revision: felt252

Traits

Traits

StructHashTrait for calculating the hash of a struct.
OffchainMessageHashTrait for calculating the hash of a message given the passed signer .
SNIP12Metadata—

StructHash

Trait for calculating the hash of a struct.

Fully qualified path: openzeppelin_utils::cryptography::snip12::StructHash

pub trait StructHash<T>

Trait functions

hash_struct

Fully qualified path: openzeppelin_utils::cryptography::snip12::StructHash::hash_struct

fn hash_struct(self: @T) -> felt252

OffchainMessageHash

Trait for calculating the hash of a message given the passed signer.

Fully qualified path: openzeppelin_utils::cryptography::snip12::OffchainMessageHash

pub trait OffchainMessageHash<T>

Trait functions

get_message_hash

Fully qualified path: openzeppelin_utils::cryptography::snip12::OffchainMessageHash::get_message_hash

fn get_message_hash(self: @T, signer: ContractAddress) -> felt252

SNIP12Metadata

Fully qualified path: openzeppelin_utils::cryptography::snip12::SNIP12Metadata

pub trait SNIP12Metadata

Trait functions

name

Returns the name of the dapp.

Fully qualified path: openzeppelin_utils::cryptography::snip12::SNIP12Metadata::name

fn name() -> felt252

version

Returns the version of the dapp.

Fully qualified path: openzeppelin_utils::cryptography::snip12::SNIP12Metadata::version

fn version() -> felt252

Impls

Impls

StructHashStarknetDomainImplImplementation of StructHash that calculates the Poseidon hash of type StarknetDomain .
SNIP12HashSpanImplHash trait implementation for a span of elements according to SNIP-12.

StructHashStarknetDomainImpl

Implementation of StructHash that calculates the Poseidon hash of type StarknetDomain.

Fully qualified path: openzeppelin_utils::cryptography::snip12::StructHashStarknetDomainImpl

pub impl StructHashStarknetDomainImpl of StructHash<StarknetDomain>;

Impl functions

hash_struct

Fully qualified path: openzeppelin_utils::cryptography::snip12::StructHashStarknetDomainImpl::hash_struct

fn hash_struct(self: @StarknetDomain) -> felt252

SNIP12HashSpanImpl

Hash trait implementation for a span of elements according to SNIP-12.

Fully qualified path: openzeppelin_utils::cryptography::snip12::SNIP12HashSpanImpl

pub impl SNIP12HashSpanImpl<
    T, +Copy<T>, +Hash<T, HashState>,
> of Hash<Span<T>, HashState, HashStateImpl>;

Impl functions

update_state

Fully qualified path: openzeppelin_utils::cryptography::snip12::SNIP12HashSpanImpl::update_state

fn update_state(mut state: HashState, value: Span<T>) -> HashState

deployments

Fully qualified path: openzeppelin_utils::deployments

Constants

Free functions

calculate_contract_address_from_deploy_syscallReturns the contract address from a deploy_syscall . deployer_address should be the zero address if the deployment is origin-independent (deployed from zero). For more information, see…
calculate_contract_address_from_udcReturns the calculated contract address for contracts deployed through the UDC. Origin-independent deployments (deployed from zero) should pass Option::None as deployer_info .

Structs

Constants

Constants

L2_ADDRESS_UPPER_BOUND

Fully qualified path: openzeppelin_utils::deployments::L2_ADDRESS_UPPER_BOUND

pub const L2_ADDRESS_UPPER_BOUND: felt252 =
    3618502788666131106986593281521497120414687020801267626233049500247285300992;

CONTRACT_ADDRESS_PREFIX

Fully qualified path: openzeppelin_utils::deployments::CONTRACT_ADDRESS_PREFIX

pub const CONTRACT_ADDRESS_PREFIX: felt252 =
    523065374597054866729014270389667305596563390979550329787219;

Free functions

Free functions

calculate_contract_address_from_deploy_syscallReturns the contract address from a deploy_syscall . deployer_address should be the zero address if the deployment is origin-independent (deployed from zero). For more information, see…
calculate_contract_address_from_udcReturns the calculated contract address for contracts deployed through the UDC. Origin-independent deployments (deployed from zero) should pass Option::None as deployer_info .

calculate_contract_address_from_deploy_syscall

Returns the contract address from a deploy_syscall. deployer_address should be the zero address if the deployment is origin-independent (deployed from zero).

For more information, see https://docs.starknet.io/architecture-and-concepts/smart-contracts/contract-address/

Fully qualified path: openzeppelin_utils::deployments::calculate_contract_address_from_deploy_syscall

pub fn calculate_contract_address_from_deploy_syscall(
    salt: felt252,
    class_hash: ClassHash,
    constructor_calldata: Span<felt252>,
    deployer_address: ContractAddress,
) -> ContractAddress

calculate_contract_address_from_udc

Returns the calculated contract address for contracts deployed through the UDC. Origin-independent deployments (deployed from zero) should pass Option::None as deployer_info.

Fully qualified path: openzeppelin_utils::deployments::calculate_contract_address_from_udc

pub fn calculate_contract_address_from_udc(
    salt: felt252,
    class_hash: ClassHash,
    constructor_calldata: Span<felt252>,
    deployer_info: Option<DeployerInfo>,
) -> ContractAddress

Structs

Structs

DeployerInfo

Fully qualified path: openzeppelin_utils::deployments::DeployerInfo

[derive(Drop)]
pub struct DeployerInfo {
    pub caller_address: ContractAddress,
    pub udc_address: ContractAddress,
}

Members

caller_address

Fully qualified path: openzeppelin_utils::deployments::DeployerInfo::caller_address

pub caller_address: ContractAddress

udc_address

Fully qualified path: openzeppelin_utils::deployments::DeployerInfo::udc_address

pub udc_address: ContractAddress

execution

Fully qualified path: openzeppelin_utils::execution

Free functions

execute_callsExecutes a list of calls and returns the return values.
execute_single_callExecutes a single call and returns the return value.
assert_valid_signatureValidates a signature using SRC6 is_valid_signature and asserts it’s valid. Checks both ‘VALID’ (starknet::VALIDATED) and true (1) for backwards compatibility.

Free functions

Free functions

execute_callsExecutes a list of calls and returns the return values.
execute_single_callExecutes a single call and returns the return value.
assert_valid_signatureValidates a signature using SRC6 is_valid_signature and asserts it’s valid. Checks both ‘VALID’ (starknet::VALIDATED) and true (1) for backwards compatibility.

execute_calls

Executes a list of calls and returns the return values.

Fully qualified path: openzeppelin_utils::execution::execute_calls

pub fn execute_calls(calls: Span<Call>) -> Array<Span<felt252>>

execute_single_call

Executes a single call and returns the return value.

Fully qualified path: openzeppelin_utils::execution::execute_single_call

pub fn execute_single_call(call: @Call) -> Span<felt252>

assert_valid_signature

Validates a signature using SRC6 is_valid_signature and asserts it’s valid. Checks both ‘VALID’ (starknet::VALIDATED) and true (1) for backwards compatibility.

Fully qualified path: openzeppelin_utils::execution::assert_valid_signature

pub fn assert_valid_signature(
    signer: ContractAddress,
    hash: felt252,
    signature: Span<felt252>,
    invalid_signature_error: felt252,
)

math

Fully qualified path: openzeppelin_utils::math

Free functions

averageReturns the average of two unsigned integers. The result is rounded down.
u256_mul_divReturns the quotient of x * y / denominator and rounds up or down depending on rounding . Uses wide_mul and u512_safe_div_rem_by_u256 for precision. Requirements:…

Enums

Traits

UnsignedA trait to represent unsigned integers.

Free functions

Free functions

averageReturns the average of two unsigned integers. The result is rounded down.
u256_mul_divReturns the quotient of x * y / denominator and rounds up or down depending on rounding . Uses wide_mul and u512_safe_div_rem_by_u256 for precision. Requirements:…

average

Returns the average of two unsigned integers. The result is rounded down.

Fully qualified path: openzeppelin_utils::math::average

pub fn average<
    T, +Unsigned<T>, +Add<T>, +Div<T>, +BitAnd<T>, +BitXor<T>, +Into<u8, T>, +Copy<T>, +Drop<T>,
>(
    a: T, b: T,
) -> T

u256_mul_div

Returns the quotient of x * y / denominator and rounds up or down depending on rounding. Uses wide_mul and u512_safe_div_rem_by_u256 for precision.

Requirements:

  • denominator must not be zero.
  • The quotient must not overflow u256.

Fully qualified path: openzeppelin_utils::math::u256_mul_div

pub fn u256_mul_div(x: u256, y: u256, denominator: u256, rounding: Rounding) -> u256

Enums

Enums

Rounding

Fully qualified path: openzeppelin_utils::math::Rounding

pub enum Rounding {
    Floor,
    Ceil,
    Trunc,
    Expand,
}

Variants

Floor

Fully qualified path: openzeppelin_utils::math::Rounding::Floor

Floor

Ceil

Fully qualified path: openzeppelin_utils::math::Rounding::Ceil

Ceil

Trunc

Fully qualified path: openzeppelin_utils::math::Rounding::Trunc

Trunc

Expand

Fully qualified path: openzeppelin_utils::math::Rounding::Expand

Expand

Traits

Traits

UnsignedA trait to represent unsigned integers.

Unsigned

A trait to represent unsigned integers.

Fully qualified path: openzeppelin_utils::math::Unsigned

pub trait Unsigned<T>

serde

Fully qualified path: openzeppelin_utils::serde

Traits

Traits

Traits

SerializedAppend

Fully qualified path: openzeppelin_utils::serde::SerializedAppend

pub trait SerializedAppend<T>

Trait functions

append_serde

Fully qualified path: openzeppelin_utils::serde::SerializedAppend::append_serde

fn append_serde(ref self: Array<felt252>, value: T)

structs

Fully qualified path: openzeppelin_utils::structs

Modules


Re-exports:

CheckpointGeneric checkpoint representation.
TraceTrace struct, for checkpointing values as they change at different points in time, and later looking up past values by block timestamp.

Modules

Modules

checkpoint

Fully qualified path: openzeppelin_utils::structs::checkpoint

Structs

TraceTrace struct, for checkpointing values as they change at different points in time, and later looking up past values by block timestamp.
CheckpointGeneric checkpoint representation.

Traits

Impls

Structs

Structs

TraceTrace struct, for checkpointing values as they change at different points in time, and later looking up past values by block timestamp.
CheckpointGeneric checkpoint representation.

Trace

Trace struct, for checkpointing values as they change at different points in time, and later looking up past values by block timestamp.

Fully qualified path: openzeppelin_utils::structs::checkpoint::Trace

[starknet::storage_node]
pub struct Trace {
    pub checkpoints: Vec<Checkpoint>,
}

Members

checkpoints

Fully qualified path: openzeppelin_utils::structs::checkpoint::Trace::checkpoints

pub checkpoints: Vec<Checkpoint>

Checkpoint

Generic checkpoint representation.

Fully qualified path: openzeppelin_utils::structs::checkpoint::Checkpoint

[derive(Copy, Drop, Serde, PartialEq, Debug)]
pub struct Checkpoint {
    pub key: u64,
    pub value: u256,
}

Members

key

Fully qualified path: openzeppelin_utils::structs::checkpoint::Checkpoint::key

pub key: u64

value

Fully qualified path: openzeppelin_utils::structs::checkpoint::Checkpoint::value

pub value: u256

Traits

Traits

TraceTrait

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait

pub trait TraceTrait

Trait functions

push

Pushes a (key, value) pair into a Trace so that it is stored as the checkpoint and returns both the previous and the new value.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::push

fn push(self: StoragePath<Mutable<Trace>>, key: u64, value: u256) -> (u256, u256)

upper_lookup

Returns the value in the last (most recent) checkpoint with the key lower than or equal to the search key, or zero if there is none.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::upper_lookup

fn upper_lookup(self: StoragePath<Trace>, key: u64) -> u256

upper_lookup_recent

Returns the value in the last (most recent) checkpoint with key lower than or equal to the search key, or zero if there is none.

NOTE: This is a variant of upper_lookup that is optimised to find “recent” checkpoints (checkpoints with high keys).

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::upper_lookup_recent

fn upper_lookup_recent(self: StoragePath<Trace>, key: u64) -> u256

latest

Returns the value in the most recent checkpoint, or zero if there are no checkpoints.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::latest

fn latest(self: StoragePath<Trace>) -> u256

latest_checkpoint

Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value in the most recent checkpoint.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::latest_checkpoint

fn latest_checkpoint(self: StoragePath<Trace>) -> (bool, u64, u256)

length

Returns the total number of checkpoints.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::length

fn length(self: StoragePath<Trace>) -> u64

at

Returns the checkpoint at the given position.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceTrait::at

fn at(self: StoragePath<Trace>, pos: u64) -> Checkpoint

Impls

Impls

TraceImpl

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl

pub impl TraceImpl of TraceTrait;

Impl functions

push

Pushes a (key, value) pair into a Trace so that it is stored as the checkpoint and returns both the previous and the new value.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::push

fn push(self: StoragePath<Mutable<Trace>>, key: u64, value: u256) -> (u256, u256)

upper_lookup

Returns the value in the last (most recent) checkpoint with the key lower than or equal to the search key, or zero if there is none.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::upper_lookup

fn upper_lookup(self: StoragePath<Trace>, key: u64) -> u256

upper_lookup_recent

Returns the value in the last (most recent) checkpoint with key lower than or equal to the search key, or zero if there is none.

NOTE: This is a variant of upper_lookup that is optimised to find “recent” checkpoints (checkpoints with high keys).

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::upper_lookup_recent

fn upper_lookup_recent(self: StoragePath<Trace>, key: u64) -> u256

latest

Returns the value in the most recent checkpoint, or zero if there are no checkpoints.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::latest

fn latest(self: StoragePath<Trace>) -> u256

latest_checkpoint

Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value in the most recent checkpoint.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::latest_checkpoint

fn latest_checkpoint(self: StoragePath<Trace>) -> (bool, u64, u256)

length

Returns the total number of checkpoints.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::length

fn length(self: StoragePath<Trace>) -> u64

at

Returns the checkpoint at the given position.

Fully qualified path: openzeppelin_utils::structs::checkpoint::TraceImpl::at

fn at(self: StoragePath<Trace>, pos: u64) -> Checkpoint