Modules

core

Fully qualified path: core

Modules

Free functions

Enums

Type aliases

Impls

Extern types

Extern functions

traits

Fully qualified path: core::traits

Traits

boolean

Boolean operations. The bool type is a primitive type in Cairo representing a boolean value that can be either true or false. This module provides trait implementations for boolean operations. # Examples Basic boolean operations:


let value = true;
assert!(value == true);
assert!(!value == false);

Converting to optional values with BoolTrait::then_some:

use core::boolean::BoolTrait;

let bool_value = true;
let result = bool_value.then_some(42_u8);
assert!(result == Option::Some(42));

let bool_value = false;
let result = bool_value.then_some(42_u8);
assert!(result == Option::None);

Fully qualified path: core::boolean

Traits

circuit

Fully qualified path: core::circuit

Free functions

Structs

Enums

Type aliases

Traits

Impls

Extern types

felt_252

felt252. Utilities for the felt252 type. The implementations defined in this module can be accessed by using the traits directly.

Fully qualified path: core::felt_252

Impls

box

Boxes. Box<T> is a smart pointer that allows for: * Storing values of arbitrary size while maintaining a fixed-size pointer * Enabling recursive types that would otherwise have infinite size * Moving large data structures efficiently by passing pointers instead of copying values # Examples Creating a new box with BoxTrait::new:

let boxed = BoxTrait::new(42);
let unboxed = boxed.unbox();

Working with larger structures:

let large_array = array![1, 2, 3, 4, 5];
let boxed_array = BoxTrait::new(large_array);

Creating a recursive data structure:

[derive(Copy, Drop, Debug)]
enum BinaryTree {
    Leaf: u32,
    Node: (u32, Box<BinaryTree>, Box<BinaryTree>)
}

let leaf = BinaryTree::Leaf(1);
let node = BinaryTree::Node((2, BoxTrait::new(leaf), BoxTrait::new(leaf)));
println!("{:?}", node);

NOTE: A Box<T> is a smart pointer type that provides a way to store a value of type T in Cairo VM's boxed segment, leaving only a pointer in the execution segment.

Fully qualified path: core::box

Traits

Extern types

nullable

Nullable A wrapper type for handling optional values. Nullable<T> is a wrapper type that can either contain a value stored in a Box<T> or be null. It provides a safe way to handle optional values without the risk of dereferencing null pointers. This makes it particularly useful in dictionaries that store complex data structures that don't implement the Felt252DictValue trait; instead, they can be wrapped inside a Nullable. # Examples Basic usage:

let value: Nullable<u32> = NullableTrait::new(10);
let unwrapped_value = value.deref();

Handling null values:

let null_value: Nullable<u32> = Default::default();
let unwrapped_value = null_value.deref_or(1);

Checking if the value is null:

let value: Nullable<u32> = NullableTrait::new(10);
let is_null = if value.is_null() {
    // Handle null case
} else {
    // Handle non-null case
};

Fully qualified path: core::nullable

Enums

Traits

Extern types

Extern functions

array

Module for Array and other continuous same type collections. A contiguous collection of elements of the same type in memory, written Array<T>. Arrays have O(1) indexing, O(1) push and O(1) pop (from the front). Arrays can only be mutated by appending to the end or popping from the front. # Examples You can explicitly create an Array with ArrayTrait::new:

let arr: Array<usize> = ArrayTrait::new();

...or by using the array! macro:

let arr: Array<usize> = array![];

let arr: Array<usize> = array![1, 2, 3, 4, 5];

You can append values onto the end of an array:

let mut arr = array![1, 2];
arr.append(3);

Popping values from the front works like this:

let mut arr = array![1, 2];
let one = arr.pop_front(); // Returns Option::Some(1)

Arrays support indexing (through the IndexView trait):

let arr = array![1, 2, 3];
let three = arr[2]; // Returns a snapshot (@T)

Arrays can be converted to Spans for read-only access:

let arr = array![1, 2, 3];
let span = arr.span();

A span can be manipulated without affecting the original array:

let mut arr = array![1, 2, 3];
let mut span = arr.span();
span.pop_back();
assert!(arr == array![1, 2, 3]);

Fully qualified path: core::array

Structs

Traits

Impls

Extern types

Extern functions

dict

Dictionary. A dictionary-like data structure that maps felt252 keys to values of any type. The Felt252Dict provides efficient key-value storage with operations for inserting, retrieving, and updating values. Each operation creates a new entry that can be validated through a process called squashing. # Examples One can create a new dictionary using the Default::default method:

use core::dict::Felt252Dict;

let mut dict: Felt252Dict<u8> = Default::default();

... then insert new values corresponding to a given key with the Felt252DictTrait::insert method, and retrieve any value given a key with the Felt252DictTrait::get method.

dict.insert(0, 10);
dict.insert(1, 20);
assert!(dict.get(0) == 10);
assert!(dict.get(1) == 20);

dict.insert(0, 20);
assert!(dict.get(0) == 20

It is also possible to use the Felt252DictTrait::entry method to retrieve the last entry given a certain key. In this case, the method takes ownership of the dictionary and returns the entry to update. After that, using the Felt252DictEntryTrait::finalize allows to create a new entry in the dictionary. Using entry and finalize methods can be very useful given that it does not require the type in the dictionary to be copyable, meaning that we can use non-copyable types like arrays as dictionary values.

use core::dict::Felt252Dict;

let mut dict: Felt252Dict<u8> = Default::default();
dict.insert(0, 10);

let (entry, prev_value) = dict.entry(0);
let new_value: u8 = 20;
dict = entry.finalize(new_value);

Fully qualified path: core::dict

Traits

Extern types

Extern functions

result

Result.

Fully qualified path: core::result

Enums

Traits

option

Option.

Fully qualified path: core::option

Enums

Traits

Impls

clone

Clone. The Clone trait provides the ability to duplicate instances of types that cannot be 'implicitly copied'. In Cairo, some simple types are "implicitly copyable": when you assign them or pass them as arguments, the receiver will get a copy, leaving the original value in place. These types do not require allocation to copy, and are not at risk of accessing un-allocated memory, so the compiler considers them cheap and safe to copy. For other types, copies must be made explicitly, by convention implementing the Clone trait and calling the Clone::clone method. # Examples

let arr = array![1, 2, 3];
let cloned_arr = arr.clone();
assert!(arr == cloned_arr);

You can use the #[derive(Clone)] attribute to automatically generate the implementation for your type:

[derive(Clone, Drop)]
struct Sheep {
   name: ByteArray,
   age: u8,
}

fn main() {
   let dolly = Sheep {
       name: "Dolly",
       age: 6,
   };

   let cloned_sheep = dolly.clone();  // Famous cloned sheep!
}

Fully qualified path: core::clone

Traits

ec

EC. This module contains functions and constructs related to elliptic curve operations on the Stark curve.

Fully qualified path: core::ec

Modules

Type aliases

Traits

Impls

Extern types

Extern functions

ecdsa

Fully qualified path: core::ecdsa

Free functions

integer

Integer.

Fully qualified path: core::integer

Free functions

Structs

Impl aliases

Traits

Impls

Extern types

Extern functions

math

Math.

Fully qualified path: core::math

Modules

Free functions

num

Module containing the traits for relevant for numeric types.

Fully qualified path: core::num

Modules

ops

Module containing the operations that can be performed on the different types.

Fully qualified path: core::ops

Modules

Structs

Traits

cmp

Module for comparison operations. Utilities for comparing and ordering values. This module contains functions that rely on the PartialOrd trait for comparing values. # Examples

use core::cmp::{min, max, minmax};

assert!(min(10, 20) == 10);
assert!(max(10, 20) == 20);

assert!(minmax(20, 10) == (10, 20));
assert!(minmax(10, 20) == (10, 20));

Fully qualified path: core::cmp

Free functions

gas

Module for handling gas operations.

Fully qualified path: core::gas

Extern types

Extern functions

panics

Panics.

Fully qualified path: core::panics

Free functions

Structs

Enums

Extern functions

serde

Serialization and Deserialization. Serialization and deserialization of data structures. This module provides traits and implementations for converting Cairo types into a sequence of felt252 values (serialization) and back (deserialization). When passing values between Cairo and an external environment, serialization and deserialization are necessary to convert Cairo's data types into a sequence of felt252 values, as felt252 is the fundamental type of the language. # The Serde Trait All types that need to be serialized must implement the Serde trait. This includes both simple types that serialize to a single felt252 and compound types (like u256) that require multiple felt252 values.

Fully qualified path: core::serde

Modules

Traits

hash

Hash functions.

Fully qualified path: core::hash

Modules

Traits

keccak

Fully qualified path: core::keccak

Free functions

sha256

Fully qualified path: core::sha256

Free functions

Extern types

pedersen

Pedersen Pedersen hash related traits implementations. This module provides an implementation of the Pedersen hash function, which is a collision-resistant cryptographic hash function. The HashState struct represents the state of a Pedersen hash computation. It contains a single felt252 field state that holds the current hash value. The PedersenTrait provides a new method to create a new HashState from a base value. The HashStateTrait defined in the Hash module provides the update and finalize methods to update the hash state and obtain the final hash value, respectively. # Examples

use core::hash::HashStateTrait;
use core::pedersen::PedersenTrait;

let mut state = PedersenTrait::new(0);
state = state.update(1);
state = state.update(2);
let hash = state.finalize();
assert!(hash == 0x07546be9ecb576c12cd00962356afd90b615d8ef50605bc13badfd1fd218c0d5);

Fully qualified path: core::pedersen

Structs

Traits

Impls

Extern types

Extern functions

poseidon

Poseidon Poseidon hash related traits implementations and functions. This module provides cryptographic hash functions based on the Poseidon permutation. The Poseidon hash function is an arithmetic-friendly hash function optimized for use in zero-knowledge proof systems. This module implements the Poseidon hash using a sponge construction for arbitrary-length inputs. # Examples

use core::hash::HashStateTrait;
use core::poseidon::PoseidonTrait;

// Create a new hash state
let mut state = PoseidonTrait::new();

// Update with values
state = state.update(1);
state = state.update(2);

// Finalize to get the hash
let hash = state.finalize();

Fully qualified path: core::poseidon

Free functions

Structs

Traits

Impls

Extern types

Extern functions

debug

Debug. Utilities related to printing of values at runtime. The recommended way of printing values is by using the Display and Debug traits available in the fmt module. The items in this module are not public, and are not recommended to use.

Fully qualified path: core::debug

Free functions

Traits

Impls

Extern functions

fmt

Functionality for formatting values. The main components of this module are: - Error: A type representing formatting errors. - Formatter: A struct that holds the configuration and buffer for formatting. - Display: A trait for standard formatting using the empty format ("{}"). - Debug: A trait for debug formatting using the empty format ("{:?}"). - LowerHex: A trait for hex formatting in lower case. The module includes implementations of the Display, Debug and LowerHex traits for various types.

Fully qualified path: core::fmt

Modules

Structs

Traits

starknet

Starknet

Fully qualified path: core::starknet

Modules

Constants

Free functions

Structs

Type aliases

Traits

Extern types

Extern functions

internal

Internals.

Fully qualified path: core::internal

Modules

Enums

Extern functions

zeroable

Zeroable.

Fully qualified path: core::zeroable

Modules

Enums

Impl aliases

Traits

Impls

Extern types

bytes_31

bytes31.

Fully qualified path: core::bytes_31

Constants

Free functions

Traits

Impls

Extern types

Extern functions

byte_array

BytesArray. ByteArray is designed to handle large sequences of bytes with operations like appending, concatenation, and accessing individual bytes. It uses a structure that combines an Array of bytes31 for full words and a felt252 for handling partial words, optimizing for both space and performance. # Examples There are multiple ways to create a new ByteArray: - From a string literal:

let s = "Hello";

Using the format! macro:

let max_tps:u16 = 850;
let s = format!("Starknet's max TPS is: {}", max_tps);

You can append bytes to an existing ByteArray with ByteArrayTrait::append_byte:

let mut ba: ByteArray = "";
ba.append_byte(0x41); // Appending a single byte 'A'

You can create a new ByteArray from an existing one by concatenating with +:

let s = "Hello";
let message = s + " world!";

Indexing operations are available on the ByteArray type as well:

let mut ba: ByteArray = "ABC";
let first_bytes = ba[0]
assert!(first_byte == 0x41);

Fully qualified path: core::byte_array

Constants

Structs

Traits

Impls

string

String.

Fully qualified path: core::string

Traits

to_byte_array

to_byte_array. ASCII representation of numeric types for ByteArray manipulation. This module enables conversion of numeric values into their ASCII string representation, with support for different numeric bases and efficient appending to existing ByteArray. # Examples Basic decimal formatting:

use core::to_byte_array::{FormatAsByteArray, AppendFormattedToByteArray};

let value: u32 = 42;
let base: NonZero<u32> = 10;

// Create a new formatted `ByteArray`
let formatted = value.format_as_byte_array(base);
assert!(formatted == "42");

// Append to an existing `ByteArray`
let mut buffer = "Value: ";
value.append_formatted_to_byte_array(ref buffer, base);
assert!(buffer == "Value: 42");

Custom base formatting:

use core::to_byte_array::FormatAsByteArray;
let value: u32 = 255;

// Hexadecimal representation
let hex = value.format_as_byte_array(16);
assert!(hex == "ff");

// Binary representation
let bin = value.format_as_byte_array(2);
assert!(bin == "11111111");

Fully qualified path: core::to_byte_array

Traits

testing

Module for testing only. Measurement of gas consumption for testing purpose. This module provides the get_available_gas function, useful for asserting the amount of gas consumed by a particular operation or function call. By calling get_available_gas before and after the operation, you can calculate the exact amount of gas used.

Fully qualified path: core::testing

Extern functions

metaprogramming

Metaprogramming.

Fully qualified path: core::metaprogramming

Traits

prelude

Preludes.

Fully qualified path: core::prelude

iter

Iterators.

Fully qualified path: core::iter

Traits

stark_curve

Fully qualified path: core::ec::stark_curve

Constants

one_based

Fully qualified path: core::math::one_based

traits

Fully qualified path: core::num::traits

Modules

Traits

zero

Fully qualified path: core::num::traits::zero

Traits

one

Fully qualified path: core::num::traits::one

Traits

bit_size

Fully qualified path: core::num::traits::bit_size

Traits

ops

Fully qualified path: core::num::traits::ops

Modules

overflowing

Fully qualified path: core::num::traits::ops::overflowing

Traits

wrapping

Fully qualified path: core::num::traits::ops::wrapping

Modules

Traits

checked

Fully qualified path: core::num::traits::ops::checked

Modules

Traits

saturating

Fully qualified path: core::num::traits::ops::saturating

Modules

Traits

pow

Fully qualified path: core::num::traits::ops::pow

Traits

sqrt

Fully qualified path: core::num::traits::ops::sqrt

Traits

widemul

Fully qualified path: core::num::traits::ops::widemul

Traits

widesquare

Fully qualified path: core::num::traits::ops::widesquare

Traits

overflow_based

Fully qualified path: core::num::traits::ops::wrapping::overflow_based

overflow_based

Fully qualified path: core::num::traits::ops::checked::overflow_based

overflow_based

Fully qualified path: core::num::traits::ops::saturating::overflow_based

index

Fully qualified path: core::ops::index

Traits

into_felt252_based

Fully qualified path: core::serde::into_felt252_based

into_felt252_based

Impl for Hash for types that can be converted into felt252 using the Into trait. Usage example:

impl MyTypeHash<S, +HashStateTrait<S>, +Drop<S>> =
    core::hash::into_felt252_based::HashImpl<MyType, S>;`

Fully qualified path: core::hash::into_felt252_based

into_felt252_based

Implementations for Debug and LowerHex for types that can be converted into felt252 using the Into trait. # Examples

impl MyTypeDebug = crate::fmt::into_felt252_based::DebugImpl<MyType>;`
impl MyTypeLowerHex = crate::fmt::into_felt252_based::LowerHexImpl<MyType>;

Fully qualified path: core::fmt::into_felt252_based

storage_access

Store trait and implementations for various types.

Fully qualified path: core::starknet::storage_access

Traits

Extern types

Extern functions

syscalls

Module containing all the extern declaration of the syscalls.

Fully qualified path: core::starknet::syscalls

Extern functions

secp256_trait

secp256

Fully qualified path: core::starknet::secp256_trait

Free functions

Structs

Traits

secp256k1

This module contains functions and constructs related to elliptic curve operations on the secp256k1 curve.

Fully qualified path: core::starknet::secp256k1

Impls

Extern types

secp256r1

This module contains functions and constructs related to elliptic curve operations on the secp256r1 curve.

Fully qualified path: core::starknet::secp256r1

Impls

Extern types

contract_address

ContractAddress

Fully qualified path: core::starknet::contract_address

Impl aliases

Impls

Extern types

Extern functions

eth_address

EthAddress

Fully qualified path: core::starknet::eth_address

Structs

Impl aliases

Impls

eth_signature

EthSignature

Fully qualified path: core::starknet::eth_signature

Free functions

class_hash

ClassHash

Fully qualified path: core::starknet::class_hash

Impl aliases

Impls

Extern types

Extern functions

event

Fully qualified path: core::starknet::event

Traits

account

Account module defining the Call struct and the AccountContract trait. The Call struct represents a call to a contract, with the following fields: - to: The address of the contract to call. - selector: The entry point selector in the called contract. - calldata: The calldata to pass to the entry point. The AccountContract trait defines the standard interface for account contracts. It assumes that the calldata for invoke transactions is an Array<Call>, following the SNIP6 standard. Implementing this trait allows contracts to function as account contracts in the Starknet network, supporting class declarations and batched call execution.

Fully qualified path: core::starknet::account

Structs

Traits

storage

This module contains the storage-related types and traits for Cairo contracts. It provides abstractions for reading and writing to Starknet storage. The front facing interface for the user is simple and intuitive, for example consider the following storage struct:

[storage]
struct Storage {
    a: felt252,
    b: Map<felt252, felt52>,
    c: Map<felt52, Map<felt52, felt52>>,
}

The user can access the storage members a and b using the following code:

fn use_storage(self: @ContractState) {
    let a_value = self.a.read();
    // For a Map, the user can use the `entry` method to access the value at a specific key:
    let b_value = self.b.entry(42).read();
    // Or simply pass the key to the `read` method:
    let b_value = self.b.read(42);
    // Accessing a nested Map must be done using the `entry` method, either:
    let c_value = self.c.entry(42).entry(43).read()
    // Or:
    let c_value = self.c.entry(42).read(43);
}

Under the hood, the storage access is more complex. The life cycle of a storage object is as follows: 1. The storage struct of a contract is represented by a FlattenedStorage struct, which can be derefed into a struct containing a member for each storage member of the contract. This member can be either a StorageBase or a FlattenedStorage instance. Members are represented as a FlattenedStorage if the storage member is attributed with either #[substorage(v0)] (for backward compatibility) or #[flat]. FlattenedStorage is used to structure the storage access; however, it does not affect the address of the storage object. 2. StorageBase members of a FlattenedStorage struct hold a single felt252 value, which is the Keccak hash of the name of the member. For simple types, this value will be the address of the member in the storage. 3. StorageBase members are then converted to StoragePath instances, which are essentially a wrapper around a HashState instance, used to account for more values when computing the address of the storage object. StoragePath instances can be updated with values coming from two sources:- Storage nodes, which are structs that represent another struct with all its members in the storage, similar to FlattenedStorage. However, unlike FlattenedStorage, the path to the storage node does affect the address of the storage object. See StorageNode for more details.

  • Storage collections, specifically Map and Vec, simulate the behavior of collections by updating the hash state with the key or index of the collection member. After finishing the updates, the StoragePath instance is finalized, resulting in aStoragePointer0Offset instance, which is a pointer to the address of the storage object. Ifthe pointer is to an object of size greater than 1, the object is stored in a sequentialmanner starting from the address of the pointer. The whole object can be read or writtenusing read and write methods, and specific members can also be accessed in the case of astruct. See SubPointers for more details.The transitioning between the different types of storage objects is also called from theDeref trait, and thus, allowing an access to the members of the storage object in a simpleway.The types mentioned above are generic in the stored object type. This is done to providespecific behavior for each type of stored object, e.g., a StoragePath of Map type will havean entry method, but it won't have a read or write method, as Map is not storable byitself, only its values are.The generic type of the storage object can also be wrapped with a Mutable type, whichindicates that the storage object is mutable, i.e., it was created from a ref contract state,and thus the object can be written to.

Fully qualified path: core::starknet::storage

Structs

Traits

Impls

testing

Module for starknet testing only. Provides functions useful for testing event emission, starknet state information, and the cheatcode concept in general.

Fully qualified path: core::starknet::testing

Free functions

Extern functions

bounded_int

Fully qualified path: core::internal::bounded_int

Traits

Extern types

zero_based

Provides an implementation of the Zeroable trait for types that implement Zero.

Fully qualified path: core::zeroable::zero_based

Constants

ALPHA

The STARK Curve is defined by the equation y^2 = x^3 + ALPHA*x + BETA.

Fully qualified path: core::ec::stark_curve::ALPHA

pub const ALPHA: felt252 = 1;

BETA

The STARK Curve is defined by the equation y^2 = x^3 + ALPHA*x + BETA.

Fully qualified path: core::ec::stark_curve::BETA

pub const BETA: felt252 = 0x6f21413efbe40de150e596d72f7a8c5609ad26c15c915c1f4cdfcb99cee9e89;

ORDER

The order (number of points) of the STARK Curve.

Fully qualified path: core::ec::stark_curve::ORDER

pub const ORDER: felt252 = 0x800000000000010ffffffffffffffffb781126dcae7b2321e66a241adc64d2f;

GEN_X

The x coordinate of the generator point used in the ECDSA signature.

Fully qualified path: core::ec::stark_curve::GEN_X

pub const GEN_X: felt252 = 0x1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca;

GEN_Y

The y coordinate of the generator point used in the ECDSA signature.

Fully qualified path: core::ec::stark_curve::GEN_Y

pub const GEN_Y: felt252 = 0x5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f;

VALIDATED

The expected return value of the __validate*__ functions of an accounted contract.

Fully qualified path: core::starknet::VALIDATED

pub const VALIDATED: felt252 = 'VALID';

BYTES_IN_BYTES31

Fully qualified path: core::bytes_31::BYTES_IN_BYTES31

pub(crate) const BYTES_IN_BYTES31: usize = 31;

POW_2_128

Fully qualified path: core::bytes_31::POW_2_128

pub(crate) const POW_2_128: felt252 = 0x100000000000000000000000000000000;

POW_2_8

Fully qualified path: core::bytes_31::POW_2_8

pub(crate) const POW_2_8: u128 = 0x100;

BYTE_ARRAY_MAGIC

A magic constant for identifying serialization of ByteArray variables. An array of felt252 with this magic value as one of the felt252 indicates that you should expect right after it a serialized ByteArray. This is currently used mainly for prints and panics.

Fully qualified path: core::byte_array::BYTE_ARRAY_MAGIC

pub const BYTE_ARRAY_MAGIC: felt252 =
    0x46a6158a16a947e5916b2a2ca68501a45e93d7110e81aa2d6438b1c57c879a3;

Free functions

panic_with_felt252

Fully qualified path: core::panic_with_felt252

pub fn panic_with_felt252(err_code: felt252) -> never

assert

Fully qualified path: core::assert

pub fn assert(cond: bool, err_code: felt252)

circuit_add

Given two circuit elements, returns a new circuit element representing the circuit that applies the addmod operation to the two input circuits.

Fully qualified path: core::circuit::circuit_add

pub fn circuit_add<Lhs, Rhs, +CircuitElementTrait<Lhs>, +CircuitElementTrait<Rhs>>(
    lhs: CircuitElement<Lhs>, rhs: CircuitElement<Rhs>,
) -> CircuitElement::<AddModGate<Lhs, Rhs>>

circuit_sub

Given two circuit elements, returns a new circuit element representing the circuit that applies the submod operation to the two input circuits.

Fully qualified path: core::circuit::circuit_sub

pub fn circuit_sub<Lhs, Rhs, +CircuitElementTrait<Lhs>, +CircuitElementTrait<Rhs>>(
    lhs: CircuitElement<Lhs>, rhs: CircuitElement<Rhs>,
) -> CircuitElement::<SubModGate<Lhs, Rhs>>

circuit_inverse

Given a circuit element, returns a new circuit element representing the circuit that applies the inverse operation on the input circuit.

Fully qualified path: core::circuit::circuit_inverse

pub fn circuit_inverse<Input, +CircuitElementTrait<Input>>(
    input: CircuitElement<Input>,
) -> CircuitElement::<InverseGate<Input>>

circuit_mul

Given two circuit elements, returns a new circuit element representing the circuit that applies the mul operation to the two input circuits.

Fully qualified path: core::circuit::circuit_mul

pub fn circuit_mul<Lhs, Rhs, +CircuitElementTrait<Lhs>, +CircuitElementTrait<Rhs>>(
    lhs: CircuitElement<Lhs>, rhs: CircuitElement<Rhs>,
) -> CircuitElement::<MulModGate<Lhs, Rhs>>

check_ecdsa_signature

Checks if (signature_r, signature_s) is a valid ECDSA signature for the given public_key on the given message. Note: the verification algorithm implemented by this function slightly deviates from the standard ECDSA. While this does not allow to create valid signatures if one does not possess the private key, it means that the signature algorithm used should be modified accordingly. Namely, it should check that r, s < stark_curve::ORDER. Arguments: * message_hash - the signed message. * public_key - the public key corresponding to the key with which the message was signed. * signature_r - the r component of the ECDSA signature. * signature_s - the s component of the ECDSA signature. Returns: true if the signature is valid and false otherwise.

Fully qualified path: core::ecdsa::check_ecdsa_signature

pub fn check_ecdsa_signature(
    message_hash: felt252, public_key: felt252, signature_r: felt252, signature_s: felt252,
) -> bool

recover_public_key

Receives a signature and the signed message hash. Returns the public key associated with the signer.

Fully qualified path: core::ecdsa::recover_public_key

pub fn recover_public_key(
    message_hash: felt252, signature_r: felt252, signature_s: felt252, y_parity: bool,
) -> Option<felt252>

u128_wrapping_add

Fully qualified path: core::integer::u128_wrapping_add

pub fn u128_wrapping_add(lhs: u128, rhs: u128) -> u128 implicits(RangeCheck) nopanic

u128_wrapping_sub

Fully qualified path: core::integer::u128_wrapping_sub

pub fn u128_wrapping_sub(a: u128, b: u128) -> u128 implicits(RangeCheck) nopanic

u128_wide_mul

Multiplies two u128s and returns (high, low) - the 128-bit parts of the result.

Fully qualified path: core::integer::u128_wide_mul

pub fn u128_wide_mul(a: u128, b: u128) -> (u128, u128) nopanic

u128_overflowing_mul

Fully qualified path: core::integer::u128_overflowing_mul

pub fn u128_overflowing_mul(lhs: u128, rhs: u128) -> (u128, bool) implicits(RangeCheck) nopanic

u8_wrapping_add

Fully qualified path: core::integer::u8_wrapping_add

pub fn u8_wrapping_add(lhs: u8, rhs: u8) -> u8 implicits(RangeCheck) nopanic

u8_wrapping_sub

Fully qualified path: core::integer::u8_wrapping_sub

pub fn u8_wrapping_sub(lhs: u8, rhs: u8) -> u8 implicits(RangeCheck) nopanic

u16_wrapping_add

Fully qualified path: core::integer::u16_wrapping_add

pub fn u16_wrapping_add(lhs: u16, rhs: u16) -> u16 implicits(RangeCheck) nopanic

u16_wrapping_sub

Fully qualified path: core::integer::u16_wrapping_sub

pub fn u16_wrapping_sub(lhs: u16, rhs: u16) -> u16 implicits(RangeCheck) nopanic

u32_wrapping_add

Fully qualified path: core::integer::u32_wrapping_add

pub fn u32_wrapping_add(lhs: u32, rhs: u32) -> u32 implicits(RangeCheck) nopanic

u32_wrapping_sub

Fully qualified path: core::integer::u32_wrapping_sub

pub fn u32_wrapping_sub(lhs: u32, rhs: u32) -> u32 implicits(RangeCheck) nopanic

u64_wrapping_add

Fully qualified path: core::integer::u64_wrapping_add

pub fn u64_wrapping_add(lhs: u64, rhs: u64) -> u64 implicits(RangeCheck) nopanic

u64_wrapping_sub

Fully qualified path: core::integer::u64_wrapping_sub

pub fn u64_wrapping_sub(lhs: u64, rhs: u64) -> u64 implicits(RangeCheck) nopanic

u256_overflowing_add

Fully qualified path: core::integer::u256_overflowing_add

pub fn u256_overflowing_add(lhs: u256, rhs: u256) -> (u256, bool) implicits(RangeCheck) nopanic

u256_overflowing_sub

Fully qualified path: core::integer::u256_overflowing_sub

pub fn u256_overflowing_sub(lhs: u256, rhs: u256) -> (u256, bool) implicits(RangeCheck) nopanic

u256_overflow_sub

Fully qualified path: core::integer::u256_overflow_sub

pub fn u256_overflow_sub(lhs: u256, rhs: u256) -> (u256, bool) implicits(RangeCheck) nopanic

u256_overflowing_mul

Fully qualified path: core::integer::u256_overflowing_mul

pub fn u256_overflowing_mul(lhs: u256, rhs: u256) -> (u256, bool)

u256_overflow_mul

Fully qualified path: core::integer::u256_overflow_mul

pub fn u256_overflow_mul(lhs: u256, rhs: u256) -> (u256, bool)

u256_wide_mul

Fully qualified path: core::integer::u256_wide_mul

pub fn u256_wide_mul(a: u256, b: u256) -> u512 nopanic

u128_add_with_bounded_int_carry

Helper function for implementation of u256_wide_mul. Used for adding two u128s and receiving a BoundedInt for the carry result.

Fully qualified path: core::integer::u128_add_with_bounded_int_carry

pub(crate) fn u128_add_with_bounded_int_carry(
    a: u128, b: u128,
) -> (u128, crate::internal::bounded_int::BoundedInt<0, 1>) nopanic

u512_safe_div_rem_by_u256

Calculates division with remainder of a u512 by a non-zero u256.

Fully qualified path: core::integer::u512_safe_div_rem_by_u256

pub fn u512_safe_div_rem_by_u256(
    lhs: u512, rhs: NonZero<u256>,
) -> (u512, u256) implicits(RangeCheck) nopanic

egcd

Extended GCD: finds (g, s, t, sub_direction) such that g = gcd(a, b) = s * a - t * b if sub_direction is true, or g = gcd(a, b) = t * b - s * a if sub_direction is false. (s, -t) or (-s, t) are the Bezout coefficients (according to sub_direction). Uses the Extended Euclidean algorithm.

Fully qualified path: core::math::egcd

pub fn egcd<
    T,
    +Copy<T>,
    +Drop<T>,
    +Add<T>,
    +Mul<T>,
    +DivRem<T>,
    +core::num::traits::Zero<T>,
    +core::num::traits::One<T>,
    +TryInto<T, NonZero<T>>,
>(
    a: NonZero<T>, b: NonZero<T>,
) -> (T, T, T, bool)

inv_mod

Returns s the inverse of a modulo n such that as≡ 1 modulo n, or None if gcd(a, n) > 1. s is guaranteed to be between 1 and n - 1 (inclusive).

Fully qualified path: core::math::inv_mod

pub fn inv_mod<
    T,
    +Copy<T>,
    +Drop<T>,
    +Add<T>,
    +Sub<T>,
    +Mul<T>,
    +DivRem<T>,
    +core::num::traits::Zero<T>,
    +core::num::traits::One<T>,
    +TryInto<T, NonZero<T>>,
>(
    a: NonZero<T>, n: NonZero<T>,
) -> Option<T>

u256_inv_mod

Returns the inverse of a modulo n, or None if a is not invertible modulo n. All as will be considered not invertible for n == 1.

Fully qualified path: core::math::u256_inv_mod

pub fn u256_inv_mod(a: u256, n: NonZero<u256>) -> Option<NonZero<u256>>

u256_div_mod_n

Returns a / b (mod n), or None if b is not invertible modulo n.

Fully qualified path: core::math::u256_div_mod_n

pub fn u256_div_mod_n(a: u256, b: u256, n: NonZero<u256>) -> Option<u256>

u256_mul_mod_n

Returns a * b (mod n).

Fully qualified path: core::math::u256_mul_mod_n

pub fn u256_mul_mod_n(a: u256, b: u256, n: NonZero<u256>) -> u256

min

Takes two comparable values a and b and returns the smallest of the two values. # Examples

use core::cmp::min;

assert!(min(0, 1) == 0);

Fully qualified path: core::cmp::min

pub fn min<T, +PartialOrd<T>, +Drop<T>, +Copy<T>>(a: T, b: T) -> T

max

Takes two comparable values a and b and returns the greatest of the two values. # Examples

use core::cmp::max;

assert!(max(0, 1) == 1);

Fully qualified path: core::cmp::max

pub fn max<T, +PartialOrd<T>, +Drop<T>, +Copy<T>>(a: T, b: T) -> T

minmax

Takes two comparable values a and b and returns a tuple with the smallest value and the greatest value. # Examples

use core::cmp::minmax;

assert!(minmax(0, 1) == (0, 1));
assert!(minmax(1, 0) == (0, 1));

Fully qualified path: core::cmp::minmax

pub fn minmax<T, +PartialOrd<T>, +Drop<T>, +Copy<T>>(a: T, b: T) -> (T, T)

panic_with_byte_array

Panics with the given ByteArray. That is, panics with an Array<felt252> with BYTE_ARRAY_MAGIC, and then the serialized given ByteArray.

Fully qualified path: core::panics::panic_with_byte_array

pub fn panic_with_byte_array(err: @ByteArray) -> crate::never

keccak_u256s_le_inputs

Computes the keccak256 of multiple u256 values. The input values are interpreted as little-endian. The 32-byte result is represented as a little-endian u256.

Fully qualified path: core::keccak::keccak_u256s_le_inputs

pub fn keccak_u256s_le_inputs(mut input: Span<u256>) -> u256

keccak_u256s_be_inputs

Computes the keccak256 of multiple u256 values. The input values are interpreted as big-endian. The 32-byte result is represented as a little-endian u256.

Fully qualified path: core::keccak::keccak_u256s_be_inputs

pub fn keccak_u256s_be_inputs(mut input: Span<u256>) -> u256

cairo_keccak

Computes the keccak of input + last_input_num_bytes LSB bytes of last_input_word. To use this function, split the input into words of 64 bits (little endian). For example, to compute keccak('Hello world!'), use: inputs = [8031924123371070792, 560229490]([8031924123371070792, 560229490]) where: 8031924123371070792 == int.from_bytes(b'Hello wo', 'little') 560229490 == int.from_bytes(b'rld!', 'little') Returns the hash as a little endian u256.

Fully qualified path: core::keccak::cairo_keccak

pub fn cairo_keccak(
    ref input: Array<u64>, last_input_word: u64, last_input_num_bytes: usize,
) -> u256

compute_keccak_byte_array

Computes the Keccak hash of the input ByteArray. Returns the hash as a little endian u256.

Fully qualified path: core::keccak::compute_keccak_byte_array

pub fn compute_keccak_byte_array(arr: @ByteArray) -> u256

compute_sha256_u32_array

Computes the SHA-256 hash of the input array. input is an array of 32-bit words. use last_input_word when the number of bytes in the last input word is less than 4. last_input_num_bytes is the number of bytes in the last input word (must be less than 4). return the SHA-256 hash of the input array + last_input_word as big endian.

Fully qualified path: core::sha256::compute_sha256_u32_array

pub fn compute_sha256_u32_array(
    mut input: Array<u32>, last_input_word: u32, last_input_num_bytes: u32,
) -> [u32; 8]

compute_sha256_byte_array

Computes the SHA-256 hash of the input ByteArray.

Fully qualified path: core::sha256::compute_sha256_byte_array

pub fn compute_sha256_byte_array(arr: @ByteArray) -> [u32; 8]

poseidon_hash_span

Computes the Poseidon hash on the given span input. Applies the sponge construction to digest many elements. To distinguish between use cases, the capacity element is initialized to 0. To distinguish between different input sizes always pads with 1, and possibly with another 0 to complete to an even-sized input. # Examples

let span = [1, 2].span();
let hash = poseidon_hash_span(span);

assert!(hash == 0x0371cb6995ea5e7effcd2e174de264b5b407027a75a231a70c2c8d196107f0e7);

Fully qualified path: core::poseidon::poseidon_hash_span

pub fn poseidon_hash_span(mut span: Span<felt252>) -> felt252

print_byte_array_as_string

Prints a ByteArray as a string. # Examples

let ba: ByteArray = "123";
print_byte_array_as_string(@ba);

Fully qualified path: core::debug::print_byte_array_as_string

pub fn print_byte_array_as_string(self: @ByteArray)

get_execution_info

Returns the execution info for the current execution.

Fully qualified path: core::starknet::info::get_execution_info

pub fn get_execution_info() -> Box<v2::ExecutionInfo>

get_caller_address

Returns the address of the caller contract. See ExecutionInfo.caller_address for more information.

Fully qualified path: core::starknet::info::get_caller_address

pub fn get_caller_address() -> ContractAddress

get_contract_address

Returns the address of the contract being executed. See ExecutionInfo.contract_address for more information.

Fully qualified path: core::starknet::info::get_contract_address

pub fn get_contract_address() -> ContractAddress

get_block_info

Returns the block info for the current block.

Fully qualified path: core::starknet::info::get_block_info

pub fn get_block_info() -> Box<BlockInfo>

get_tx_info

Returns the transaction info for the current transaction.

Fully qualified path: core::starknet::info::get_tx_info

pub fn get_tx_info() -> Box<v2::TxInfo>

get_block_timestamp

Returns the timestamp of the current block.

Fully qualified path: core::starknet::info::get_block_timestamp

pub fn get_block_timestamp() -> u64

get_block_number

Returns the number of the current block.

Fully qualified path: core::starknet::info::get_block_number

pub fn get_block_number() -> u64

signature_from_vrs

Creates an ECDSA signature from the v, r and s values. v is the sum of an odd number and the parity of the y coordinate of the ec point whose x coordinate is r. See https://eips.ethereum.org/EIPS/eip-155 for more details.

Fully qualified path: core::starknet::secp256_trait::signature_from_vrs

pub fn signature_from_vrs(v: u32, r: u256, s: u256) -> Signature

is_signature_entry_valid

Checks whether value is in the range [1, N), where N is the size of the curve.

Fully qualified path: core::starknet::secp256_trait::is_signature_entry_valid

pub fn is_signature_entry_valid<
    Secp256Point, +Drop<Secp256Point>, impl Secp256Impl: Secp256Trait<Secp256Point>,
>(
    value: u256,
) -> bool

is_valid_signature

Fully qualified path: core::starknet::secp256_trait::is_valid_signature

pub fn is_valid_signature<
    Secp256Point,
    +Drop<Secp256Point>,
    impl Secp256Impl: Secp256Trait<Secp256Point>,
    +Secp256PointTrait<Secp256Point>,
>(
    msg_hash: u256, r: u256, s: u256, public_key: Secp256Point,
) -> bool

recover_public_key

Receives a signature and the signed message hash. Returns the public key associated with the signer, represented as a point on the curve.

Fully qualified path: core::starknet::secp256_trait::recover_public_key

pub fn recover_public_key<
    Secp256Point,
    +Drop<Secp256Point>,
    impl Secp256Impl: Secp256Trait<Secp256Point>,
    +Secp256PointTrait<Secp256Point>,
>(
    msg_hash: u256, signature: Signature,
) -> Option<Secp256Point>

verify_eth_signature

Asserts that an Ethereum signature is valid w.r.t. a given Eth address Also verifies that r and s components of the signature are in the range (0, N), where N is the size of the curve.

Fully qualified path: core::starknet::eth_signature::verify_eth_signature

pub fn verify_eth_signature(msg_hash: u256, signature: Signature, eth_address: EthAddress)

is_eth_signature_valid

Asserts that an Ethereum signature is valid w.r.t. a given Eth address Also verifies that r and s components of the signature are in the range (0, N), where N is the size of the curve. Returns a Result with an error string if the signature is invalid.

Fully qualified path: core::starknet::eth_signature::is_eth_signature_valid

pub fn is_eth_signature_valid(
    msg_hash: u256, signature: Signature, eth_address: EthAddress,
) -> Result<(), felt252>

public_key_point_to_eth_address

Converts a public key point to the corresponding Ethereum address.

Fully qualified path: core::starknet::eth_signature::public_key_point_to_eth_address

pub fn public_key_point_to_eth_address<
    Secp256Point,
    +Drop<Secp256Point>,
    +Secp256Trait<Secp256Point>,
    +Secp256PointTrait<Secp256Point>,
>(
    public_key_point: Secp256Point,
) -> EthAddress

set_block_number

Set the block number to the provided value. After a call to set_block_number, starknet::get_execution_info().block_info.block_number will return the set value.

Fully qualified path: core::starknet::testing::set_block_number

pub fn set_block_number(block_number: u64)

set_caller_address

Set the caller address to the provided value. After a call to set_caller_address, starknet::get_execution_info().caller_address will return the set value.

Fully qualified path: core::starknet::testing::set_caller_address

pub fn set_caller_address(address: ContractAddress)

set_contract_address

Set the contract address to the provided value. After a call to set_contract_address, starknet::get_execution_info().contract_address will return the set value.

Fully qualified path: core::starknet::testing::set_contract_address

pub fn set_contract_address(address: ContractAddress)

set_sequencer_address

Set the sequencer address to the provided value. After a call to set_sequencer_address, starknet::get_execution_info().block_info.sequencer_address will return the set value.

Fully qualified path: core::starknet::testing::set_sequencer_address

pub fn set_sequencer_address(address: ContractAddress)

set_block_timestamp

Set the block timestamp to the provided value. After a call to set_block_timestamp, starknet::get_execution_info().block_info.block_timestamp will return the set value.

Fully qualified path: core::starknet::testing::set_block_timestamp

pub fn set_block_timestamp(block_timestamp: u64)

set_version

Set the version to the provided value. After a call to set_version, starknet::get_execution_info().tx_info.version will return the set value.

Fully qualified path: core::starknet::testing::set_version

pub fn set_version(version: felt252)

set_account_contract_address

Set the account contract address. After a call to set_account_contract_address, starknet::get_execution_info().tx_info.account_contract_address will return the set value.

Fully qualified path: core::starknet::testing::set_account_contract_address

pub fn set_account_contract_address(address: ContractAddress)

set_max_fee

Set the max fee. After a call to set_max_fee, starknet::get_execution_info().tx_info.max_fee will return the set value.

Fully qualified path: core::starknet::testing::set_max_fee

pub fn set_max_fee(fee: u128)

set_transaction_hash

Set the transaction hash. After a call to set_transaction_hash, starknet::get_execution_info().tx_info.transaction_hash will return the set value.

Fully qualified path: core::starknet::testing::set_transaction_hash

pub fn set_transaction_hash(hash: felt252)

set_chain_id

Set the chain id. After a call to set_chain_id, starknet::get_execution_info().tx_info.chain_id will return the set value.

Fully qualified path: core::starknet::testing::set_chain_id

pub fn set_chain_id(chain_id: felt252)

set_nonce

Set the nonce. After a call to set_nonce, starknet::get_execution_info().tx_info.nonce will return the set value.

Fully qualified path: core::starknet::testing::set_nonce

pub fn set_nonce(nonce: felt252)

set_signature

Set the signature. After a call to set_signature, starknet::get_execution_info().tx_info.signature will return the set value.

Fully qualified path: core::starknet::testing::set_signature

pub fn set_signature(signature: Span<felt252>)

set_block_hash

Set the hash for a block. After a call to set_block_hash, starknet::syscalls::get_block_hash_syscall for the block_number will return the set value. Unset blocks values call would fail.

Fully qualified path: core::starknet::testing::set_block_hash

pub fn set_block_hash(block_number: u64, value: felt252)

pop_log_raw

Pop the earliest unpopped logged event for the contract. The value is returned as a tuple of two spans, the first for the keys and the second for the data. May be called multiple times to pop multiple events. If called until None is returned, all events have been popped.

Fully qualified path: core::starknet::testing::pop_log_raw

pub fn pop_log_raw(address: ContractAddress) -> Option<(Span<felt252>, Span<felt252>)>

pop_log

Pop the earliest unpopped logged event for the contract as the requested type. Should be used when the type of the event is known. Type of the event should be the event defined within the contract. Useful for testing the contract's event emission. May be called multiple times to pop multiple events. If called until None is returned, all events have been popped. Example:

[starknet::contract]
mod contract {
   [event]
   [derive(Copy, Drop, Debug, PartialEq, starknet::Event)]
   pub enum Event {
      Event1: felt252,
      Event2: u128,
   }
   ...
}

[test]
fn test_event() {
    let contract_address = somehow_get_contract_address();
    call_code_causing_events(contract_address);
    assert_eq!(
        starknet::testing::pop_log(contract_address), Option::Some(contract::Event::Event1(42))
    );
    assert_eq!(
        starknet::testing::pop_log(contract_address), Option::Some(contract::Event::Event2(41))
    );
    assert_eq!(
        starknet::testing::pop_log(contract_address), Option::Some(contract::Event::Event1(40))
    );
    assert_eq!(starknet::testing::pop_log_raw(contract_address), Option::None);
}

Fully qualified path: core::starknet::testing::pop_log

pub fn pop_log<T, +starknet::Event<T>>(address: ContractAddress) -> Option<T>

pop_l2_to_l1_message

Pop the earliest unpopped l2 to l1 message for the contract. The returned value is a tuple of a the l1 address the message was sent to as a felt252, and the message data as a span. May be called multiple times to pop multiple messages. Useful for testing the contract's l2 to l1 message emission.

Fully qualified path: core::starknet::testing::pop_l2_to_l1_message

pub fn pop_l2_to_l1_message(address: ContractAddress) -> Option<(felt252, Span<felt252>)>

split_bytes31

Splits a bytes31 into two bytes31s at the given index (LSB's index is 0). The bytes31s are represented using felt252s to improve performance. Note: this function assumes that: 1. word is validly convertible to a bytes31 which has no more than len bytes of data. 2. index <= len. 3. len <= BYTES_IN_BYTES31. If these assumptions are not met, it can corrupt the ByteArray. Thus, this should be a private function. We could add masking/assertions but it would be more expansive.

Fully qualified path: core::bytes_31::split_bytes31

pub(crate) fn split_bytes31(word: felt252, len: usize, index: usize) -> (felt252, felt252)

one_shift_left_bytes_felt252

Returns 1 << (8 * n_bytes) as felt252, assuming that n_bytes < BYTES_IN_BYTES31. Note: if n_bytes >= BYTES_IN_BYTES31, the behavior is undefined. If one wants to assert that in the callsite, it's sufficient to assert that n_bytes != BYTES_IN_BYTES31 because if n_bytes > 31 then n_bytes - 16 > 15 and one_shift_left_bytes_u128 would panic.

Fully qualified path: core::bytes_31::one_shift_left_bytes_felt252

pub(crate) fn one_shift_left_bytes_felt252(n_bytes: usize) -> felt252

one_shift_left_bytes_u128

Returns 1 << (8 * n_bytes) as u128, where n_bytes must be < BYTES_IN_U128. Panics if n_bytes >= BYTES_IN_U128.

Fully qualified path: core::bytes_31::one_shift_left_bytes_u128

pub(crate) fn one_shift_left_bytes_u128(n_bytes: usize) -> u128

Structs

u384

A 384-bit unsigned integer, used for circuit values.

Fully qualified path: core::circuit::u384

#[derive(Copy, Drop, Debug, PartialEq)]
pub struct u384 {
    pub limb0: u96,
    pub limb1: u96,
    pub limb2: u96,
    pub limb3: u96,
}

CircuitElement

A wrapper for circuit elements, used to construct circuits..

Fully qualified path: core::circuit::CircuitElement

pub struct CircuitElement<T> {}

Span

A span is a view into a continuous collection of the same type - such as Array. It is a structure with a single field that holds a snapshot of an array. Span implements the Copy and the Drop traits.

Fully qualified path: core::array::Span

pub struct Span<T> {
    pub(crate) snapshot: @Array<T>,
}

SpanIter

An iterator struct over a span collection.

Fully qualified path: core::array::SpanIter

pub struct SpanIter<T> {
    span: Span<T>,
}

ArrayIter

An iterator struct over an array collection.

Fully qualified path: core::array::ArrayIter

#[derive(Drop)]
pub struct ArrayIter<T> {
    array: Array<T>,
}

u256

Fully qualified path: core::integer::u256

#[derive(Copy, Drop, Hash, PartialEq, Serde)]
pub struct u256 {
    pub low: u128,
    pub high: u128,
}

u512

Fully qualified path: core::integer::u512

#[derive(Copy, Drop, Hash, PartialEq, Serde)]
pub struct u512 {
    pub limb0: u128,
    pub limb1: u128,
    pub limb2: u128,
    pub limb3: u128,
}

Range

Represents the range [start, end).

Fully qualified path: core::ops::range::Range

#[derive(Clone, Drop)]
pub struct Range<T> {
    pub start: T,
    pub end: T,
}

Panic

Fully qualified path: core::panics::Panic

pub struct Panic {}

HashState

Represents the current state of a Pedersen hash computation. The state is maintained as a single felt252 value, which is updated through the HashStateTrait::finalize method.

Fully qualified path: core::pedersen::HashState

#[derive(Copy, Drop, Debug)]
pub struct HashState {
    pub state: felt252,
}

HashState

State for Poseidon hash.

Fully qualified path: core::poseidon::HashState

#[derive(Copy, Drop, Debug)]
pub struct HashState {
    pub s0: felt252,
    pub s1: felt252,
    pub s2: felt252,
    pub odd: bool,
}

Error

Dedicated type for representing formatting errors.

Fully qualified path: core::fmt::Error

#[derive(Drop)]
pub struct Error {}

Formatter

Configuration for formatting.

Fully qualified path: core::fmt::Formatter

#[derive(Default, Drop)]
pub struct Formatter {
    pub buffer: ByteArray,
}

EthAddress

Fully qualified path: core::starknet::eth_address::EthAddress

#[derive(Copy, Drop, Hash, PartialEq)]
pub struct EthAddress {
    address: felt252,
}

ExecutionInfo

The same as ExecutionInfo, but with the TxInfo field replaced with v2::TxInfo.

Fully qualified path: core::starknet::info::v2::ExecutionInfo

#[derive(Copy, Drop, Debug)]
pub struct ExecutionInfo {
    pub block_info: Box<BlockInfo>,
    pub tx_info: Box<TxInfo>,
    pub caller_address: ContractAddress,
    pub contract_address: ContractAddress,
    pub entry_point_selector: felt252,
}

BlockInfo

Information about the current block.

Fully qualified path: core::starknet::info::BlockInfo

#[derive(Copy, Drop, Debug, Serde)]
pub struct BlockInfo {
    pub block_number: u64,
    pub block_timestamp: u64,
    pub sequencer_address: ContractAddress,
}

TxInfo

Fully qualified path: core::starknet::info::v2::TxInfo

#[derive(Copy, Drop, Debug, Serde)]
pub struct TxInfo {
    pub version: felt252,
    pub account_contract_address: ContractAddress,
    pub max_fee: u128,
    pub signature: Span<felt252>,
    pub transaction_hash: felt252,
    pub chain_id: felt252,
    pub nonce: felt252,
    pub resource_bounds: Span<ResourceBounds>,
    pub tip: u128,
    pub paymaster_data: Span<felt252>,
    pub nonce_data_availability_mode: u32,
    pub fee_data_availability_mode: u32,
    pub account_deployment_data: Span<felt252>,
}

ResourceBounds

Fully qualified path: core::starknet::info::v2::ResourceBounds

#[derive(Copy, Drop, Debug, Serde)]
pub struct ResourceBounds {
    pub resource: felt252,
    pub max_amount: u64,
    pub max_price_per_unit: u128,
}

Signature

Secp256{k/r}1 ECDSA signature.

Fully qualified path: core::starknet::secp256_trait::Signature

#[derive(Copy, Drop, Debug, PartialEq, Serde, Hash)]
pub struct Signature {
    pub r: u256,
    pub s: u256,
    pub y_parity: bool,
}

EthAddress

Fully qualified path: core::starknet::eth_address::EthAddress

#[derive(Copy, Drop, Hash, PartialEq)]
pub struct EthAddress {
    address: felt252,
}

Call

A struct representing a call to a contract.

Fully qualified path: core::starknet::account::Call

#[derive(Drop, Copy, Serde, Debug)]
pub struct Call {
    pub to: ContractAddress,
    pub selector: felt252,
    pub calldata: Span<felt252>,
}

AccountContractDispatcher

Fully qualified path: core::starknet::account::AccountContractDispatcher

#[derive(Copy, Drop, starknet::Store, Serde)]
pub struct AccountContractDispatcher {
    pub contract_address: starknet::ContractAddress,
}

AccountContractLibraryDispatcher

Fully qualified path: core::starknet::account::AccountContractLibraryDispatcher

#[derive(Copy, Drop, starknet::Store, Serde)]
pub struct AccountContractLibraryDispatcher {
    pub class_hash: starknet::ClassHash,
}

AccountContractSafeLibraryDispatcher

Fully qualified path: core::starknet::account::AccountContractSafeLibraryDispatcher

#[derive(Copy, Drop, starknet::Store, Serde)]
pub struct AccountContractSafeLibraryDispatcher {
    pub class_hash: starknet::ClassHash,
}

AccountContractSafeDispatcher

Fully qualified path: core::starknet::account::AccountContractSafeDispatcher

#[derive(Copy, Drop, starknet::Store, Serde)]
pub struct AccountContractSafeDispatcher {
    pub contract_address: starknet::ContractAddress,
}

StoragePointer

A pointer to an address in storage, can be used to read and write values, if the generic type supports it (e.g. basic types like felt252).

Fully qualified path: core::starknet::storage::StoragePointer

pub struct StoragePointer<T> {
    pub __storage_pointer_address__: StorageBaseAddress,
    pub __storage_pointer_offset__: u8,
}

StoragePointer0Offset

Same as StoragePointer, but with offset 0, which allows for some optimizations.

Fully qualified path: core::starknet::storage::StoragePointer0Offset

pub struct StoragePointer0Offset<T> {
    pub __storage_pointer_address__: StorageBaseAddress,
}

StoragePath

An intermediate struct to store a hash state, in order to be able to hash multiple values and get the final address. Storage path should have two interfaces, if T is storable then it should implement StorageAsPointer in order to be able to get the address of the storage path. Otherwise, if T is not storable then it should implement some kind of updating trait, e.g. StoragePathEntry.

Fully qualified path: core::starknet::storage::StoragePath

pub struct StoragePath<T> {
    __hash_state__: StoragePathHashState,
}

PendingStoragePath

A struct for delaying the creation of a storage path, used for lazy evaluation in storage nodes.

Fully qualified path: core::starknet::storage::PendingStoragePath

pub struct PendingStoragePath<T> {
    __hash_state__: StoragePathHashState,
    __pending_key__: felt252,
}

Mutable

A wrapper around different storage related types, indicating that the instance is mutable, i.e. originally created from a ref contract state.

Fully qualified path: core::starknet::storage::Mutable

#[phantom]
pub struct Mutable<T> {}

Vec

A type to represent a vec in storage. The length of the storage is stored in the storage base, while the elements are stored in hash(storage_base, index).

Fully qualified path: core::starknet::storage::vec::Vec

#[phantom]
pub struct Vec<T> {}

StorageBase

A struct for holding an address to initialize a storage path with. The members (not direct members, but accessible using deref) of a contract state are either StorageBase or FlattenedStorage instances, with the generic type representing the type of the stored member.

Fully qualified path: core::starknet::storage::storage_base::StorageBase

pub struct StorageBase<T> {
    pub __base_address__: felt252,
}

FlattenedStorage

A type that represents a flattened storage, i.e. a storage object which does not have any effect on the path taken into consideration when computing the address of the storage object.

Fully qualified path: core::starknet::storage::storage_base::FlattenedStorage

pub struct FlattenedStorage<T> {}

Map

A struct that represents a map in a contract storage.

Fully qualified path: core::starknet::storage::map::Map

#[phantom]
pub struct Map<K, V> {}

ByteArray

Byte array type.

Fully qualified path: core::byte_array::ByteArray

#[derive(Drop, Clone, PartialEq, Serde, Default)]
pub struct ByteArray {
    pub(crate) data: Array<bytes31>,
    pub(crate) pending_word: felt252,
    pub(crate) pending_word_len: usize,
}

Enums

bool

Fully qualified path: core::bool

#[derive(Copy, Drop, Default)]
pub enum bool {
    #[default]
    False,
    True,
}

Variants

False

Fully qualified path: core::bool::False

#[default]
False

True

Fully qualified path: core::bool::True

True

never

Fully qualified path: core::never

pub enum never {}

AddInputResult

The result of filling an input in the circuit instance's data.

Fully qualified path: core::circuit::AddInputResult

pub enum AddInputResult<C> {
    Done: CircuitData<C>,
    More: CircuitInputAccumulator<C>,
}

Variants

Done

All inputs have been filled.

Fully qualified path: core::circuit::AddInputResult::Done

Done : CircuitData < C >

More

More inputs are needed to fill the circuit instance's data.

Fully qualified path: core::circuit::AddInputResult::More

More : CircuitInputAccumulator < C >

FromNullableResult

Represents the result of matching a Nullable value. Used to safely handle both null and non-null cases when using match_nullable on a Nullable.

Fully qualified path: core::nullable::FromNullableResult

pub enum FromNullableResult<T> {
    Null,
    NotNull: Box<T>,
}

Variants

Null

Represents a null value

Fully qualified path: core::nullable::FromNullableResult::Null

Null

NotNull

The boxed value when not null

Fully qualified path: core::nullable::FromNullableResult::NotNull

NotNull : Box < T >

Result

Fully qualified path: core::result::Result

#[must_use]
#[derive(Copy, Drop, Debug, Serde, PartialEq)]
pub enum Result<T, E> {
    Ok: T,
    Err: E,
}

Variants

Ok

Fully qualified path: core::result::Result::Ok

Ok : T

Err

Fully qualified path: core::result::Result::Err

Err : E

Option

Fully qualified path: core::option::Option

#[must_use]
#[derive(Copy, Drop, Debug, Serde, PartialEq)]
pub enum Option<T> {
    Some: T,
    None,
}

Variants

Some

Fully qualified path: core::option::Option::Some

Some : T

None

Fully qualified path: core::option::Option::None

None

PanicResult

Fully qualified path: core::panics::PanicResult

pub enum PanicResult<T> {
    Ok: T,
    Err: (Panic, Array<felt252>),
}

Variants

Ok

Fully qualified path: core::panics::PanicResult::Ok

Ok : T

Err

Fully qualified path: core::panics::PanicResult::Err

Err : ( Panic , Array < felt252 > )

OptionRev

Same as Option, except that the order of the variants is reversed. This is used as the return type of some libfuncs for efficiency reasons.

Fully qualified path: core::internal::OptionRev

#[must_use]
#[derive(Copy, Drop, Debug, PartialEq)]
pub enum OptionRev<T> {
    None,
    Some: T,
}

Variants

None

Fully qualified path: core::internal::OptionRev::None

None

Some

Fully qualified path: core::internal::OptionRev::Some

Some : T

IsZeroResult

Represents the result of checking whether a value is zero.

Fully qualified path: core::zeroable::IsZeroResult

pub(crate) enum IsZeroResult<T> {
    Zero,
    NonZero: NonZero<T>,
}

Variants

Zero

Indicates that the value is zero.

Fully qualified path: core::zeroable::IsZeroResult::Zero

Zero

NonZero

Indicates that the value is non-zero, wrapping it in a NonZero.

Fully qualified path: core::zeroable::IsZeroResult::NonZero

NonZero : NonZero < T >

Type aliases

usize

Fully qualified path: core::usize

pub type usize = u32;

u96

Fully qualified path: core::circuit::u96

pub type u96 = crate::internal::bounded_int::BoundedInt<0, 79228162514264337593543950335>;

ConstZero

Expose the const required by the libfunc to allow the compiler const reusage.

Fully qualified path: core::circuit::ConstZero

pub type ConstZero = crate::internal::bounded_int::BoundedInt<0, 0>;

ConstOne

Fully qualified path: core::circuit::ConstOne

pub type ConstOne = crate::internal::bounded_int::BoundedInt<1, 1>;

NonZeroEcPoint

Fully qualified path: core::ec::NonZeroEcPoint

pub type NonZeroEcPoint = NonZero<EcPoint>;

SyscallResult

The result type for a syscall.

Fully qualified path: core::starknet::SyscallResult

pub type SyscallResult<T> = Result<T, Array<felt252>>;

Impl aliases

U8Zeroable

Fully qualified path: core::integer::U8Zeroable

pub(crate) impl U8Zeroable = crate::zeroable::zero_based::ZeroableImpl<u8, U8Zero>;

U16Zeroable

Fully qualified path: core::integer::U16Zeroable

pub(crate) impl U16Zeroable = crate::zeroable::zero_based::ZeroableImpl<u16, U16Zero>;

U32Zeroable

Fully qualified path: core::integer::U32Zeroable

pub(crate) impl U32Zeroable = crate::zeroable::zero_based::ZeroableImpl<u32, U32Zero>;

U64Zeroable

Fully qualified path: core::integer::U64Zeroable

pub(crate) impl U64Zeroable = crate::zeroable::zero_based::ZeroableImpl<u64, U64Zero>;

U128Zeroable

Fully qualified path: core::integer::U128Zeroable

pub(crate) impl U128Zeroable = crate::zeroable::zero_based::ZeroableImpl<u128, U128Zero>;

U256Zeroable

Fully qualified path: core::integer::U256Zeroable

pub(crate) impl U256Zeroable = crate::zeroable::zero_based::ZeroableImpl<u256, U256Zero>;

ContractAddressZeroable

Fully qualified path: core::starknet::contract_address::ContractAddressZeroable

pub(crate) impl ContractAddressZeroable =
    core::zeroable::zero_based::ZeroableImpl<ContractAddress, ContractAddressZero>;

EthAddressZeroable

Fully qualified path: core::starknet::eth_address::EthAddressZeroable

pub(crate) impl EthAddressZeroable =
    core::zeroable::zero_based::ZeroableImpl<EthAddress, EthAddressZero>;

ClassHashZeroable

Fully qualified path: core::starknet::class_hash::ClassHashZeroable

pub(crate) impl ClassHashZeroable =
    core::zeroable::zero_based::ZeroableImpl<ClassHash, ClassHashZero>;

Felt252Zeroable

Fully qualified path: core::zeroable::Felt252Zeroable

pub(crate) impl Felt252Zeroable = zero_based::ZeroableImpl<felt252>;

Traits

Copy

Fully qualified path: core::traits::Copy

pub trait Copy<T>;

Drop

Fully qualified path: core::traits::Drop

pub trait Drop<T>;

Add

Fully qualified path: core::traits::Add

pub trait Add<T>

Trait functions

add

Fully qualified path: core::traits::Add::add

fn add(lhs: T, rhs: T) -> T

AddEq

Fully qualified path: core::traits::AddEq

pub trait AddEq<T>

Trait functions

add_eq

Fully qualified path: core::traits::AddEq::add_eq

fn add_eq(ref self: T, other: T)

Sub

Fully qualified path: core::traits::Sub

pub trait Sub<T>

Trait functions

sub

Fully qualified path: core::traits::Sub::sub

fn sub(lhs: T, rhs: T) -> T

SubEq

Fully qualified path: core::traits::SubEq

pub trait SubEq<T>

Trait functions

sub_eq

Fully qualified path: core::traits::SubEq::sub_eq

fn sub_eq(ref self: T, other: T)

Mul

Fully qualified path: core::traits::Mul

pub trait Mul<T>

Trait functions

mul

Fully qualified path: core::traits::Mul::mul

fn mul(lhs: T, rhs: T) -> T

MulEq

Fully qualified path: core::traits::MulEq

pub trait MulEq<T>

Trait functions

mul_eq

Fully qualified path: core::traits::MulEq::mul_eq

fn mul_eq(ref self: T, other: T)

Div

Fully qualified path: core::traits::Div

pub trait Div<T>

Trait functions

div

Fully qualified path: core::traits::Div::div

fn div(lhs: T, rhs: T) -> T

DivEq

Fully qualified path: core::traits::DivEq

pub trait DivEq<T>

Trait functions

div_eq

Fully qualified path: core::traits::DivEq::div_eq

fn div_eq(ref self: T, other: T)

Rem

Fully qualified path: core::traits::Rem

pub trait Rem<T>

Trait functions

rem

Fully qualified path: core::traits::Rem::rem

fn rem(lhs: T, rhs: T) -> T

RemEq

Fully qualified path: core::traits::RemEq

pub trait RemEq<T>

Trait functions

rem_eq

Fully qualified path: core::traits::RemEq::rem_eq

fn rem_eq(ref self: T, other: T)

DivRem

Division with remainder.

Fully qualified path: core::traits::DivRem

pub trait DivRem<T>

Trait functions

div_rem

Fully qualified path: core::traits::DivRem::div_rem

fn div_rem(lhs: T, rhs: NonZero<T>) -> (T, T)

PartialEq

Fully qualified path: core::traits::PartialEq

pub trait PartialEq<T>

Trait functions

eq

Fully qualified path: core::traits::PartialEq::eq

fn eq(lhs: @T, rhs: @T) -> bool

ne

Fully qualified path: core::traits::PartialEq::ne

fn ne(lhs: @T, rhs: @T) -> bool

BitAnd

Fully qualified path: core::traits::BitAnd

pub trait BitAnd<T>

Trait functions

bitand

Fully qualified path: core::traits::BitAnd::bitand

fn bitand(lhs: T, rhs: T) -> T

BitOr

Fully qualified path: core::traits::BitOr

pub trait BitOr<T>

Trait functions

bitor

Fully qualified path: core::traits::BitOr::bitor

fn bitor(lhs: T, rhs: T) -> T

BitXor

Fully qualified path: core::traits::BitXor

pub trait BitXor<T>

Trait functions

bitxor

Fully qualified path: core::traits::BitXor::bitxor

fn bitxor(lhs: T, rhs: T) -> T

BitNot

Fully qualified path: core::traits::BitNot

pub trait BitNot<T>

Trait functions

bitnot

Fully qualified path: core::traits::BitNot::bitnot

fn bitnot(a: T) -> T

PartialOrd

Fully qualified path: core::traits::PartialOrd

pub trait PartialOrd<T>

Trait functions

lt

Fully qualified path: core::traits::PartialOrd::lt

fn lt(lhs: T, rhs: T) -> bool

ge

Fully qualified path: core::traits::PartialOrd::ge

fn ge(lhs: T, rhs: T) -> bool

gt

Fully qualified path: core::traits::PartialOrd::gt

fn gt(lhs: T, rhs: T) -> bool

le

Fully qualified path: core::traits::PartialOrd::le

fn le(lhs: T, rhs: T) -> bool

Into

Trait for conversion between types.

Fully qualified path: core::traits::Into

pub trait Into<T, S>

Trait functions

into

Fully qualified path: core::traits::Into::into

fn into(self: T) -> S

TryInto

Trait for fallible conversion between types.

Fully qualified path: core::traits::TryInto

pub trait TryInto<T, S>

Trait functions

try_into

Fully qualified path: core::traits::TryInto::try_into

fn try_into(self: T) -> Option<S>

Neg

Fully qualified path: core::traits::Neg

pub trait Neg<T>

Trait functions

neg

Fully qualified path: core::traits::Neg::neg

fn neg(a: T) -> T

Not

Fully qualified path: core::traits::Not

pub trait Not<T>

Trait functions

not

Fully qualified path: core::traits::Not::not

fn not(a: T) -> T

IndexView

The following two traits are for implementing the [] operator. Only one should be implemented for each type. Both are not consuming of self, the first gets a snapshot of the object and the second gets ref.

Fully qualified path: core::traits::IndexView

pub trait IndexView<C, I, V>

Trait functions

index

Fully qualified path: core::traits::IndexView::index

fn index(self: @C, index: I) -> V

Index

Fully qualified path: core::traits::Index

pub trait Index<C, I, V>

Trait functions

index

Fully qualified path: core::traits::Index::index

fn index(ref self: C, index: I) -> V

Destruct

Fully qualified path: core::traits::Destruct

pub trait Destruct<T>

Trait functions

destruct

Fully qualified path: core::traits::Destruct::destruct

fn destruct(self: T) nopanic

PanicDestruct

Fully qualified path: core::traits::PanicDestruct

pub trait PanicDestruct<T>

Trait functions

panic_destruct

Fully qualified path: core::traits::PanicDestruct::panic_destruct

fn panic_destruct(self: T, ref panic: Panic) nopanic

Default

Fully qualified path: core::traits::Default

pub trait Default<T>

Trait functions

default

Fully qualified path: core::traits::Default::default

fn default() -> T

Felt252DictValue

Trait for types allowed as values in a Felt252Dict.

Fully qualified path: core::traits::Felt252DictValue

pub trait Felt252DictValue<T>

Trait functions

zero_default

Returns the default value for this type as a value in a Felt252Dict. Should be logically equivalent to 0.

Fully qualified path: core::traits::Felt252DictValue::zero_default

fn zero_default() -> T nopanic

BoolTrait

Fully qualified path: core::boolean::BoolTrait

pub trait BoolTrait<T, +Drop<T>>

Trait functions

then_some

Returns Option::Some(t) if the bool is true, Option::None otherwise. # Examples

assert!(false.then_some(0) == Option::None);
assert!(true.then_some(0) == Option::Some(0));

Fully qualified path: core::boolean::BoolTrait::then_some

fn then_some(self: bool, t: T) -> Option<T> nopanic

CircuitElementTrait

A marker trait for keeping track of which types are circuit elements.

Fully qualified path: core::circuit::CircuitElementTrait

pub trait CircuitElementTrait<T>

CircuitOutputsTrait

A trait for evaluating a circuit.

Fully qualified path: core::circuit::CircuitOutputsTrait

pub trait CircuitOutputsTrait<Outputs, OutputElement>

Trait functions

get_output

Evaluates the circuit with the given data and modulus.

Fully qualified path: core::circuit::CircuitOutputsTrait::get_output

fn get_output(self: Outputs, output: OutputElement) -> u384

CircuitInputs

Fully qualified path: core::circuit::CircuitInputs

pub trait CircuitInputs<CES>

Trait functions

new_inputs

calls init_circuit_data for the given circuit.

Fully qualified path: core::circuit::CircuitInputs::new_inputs

fn new_inputs<impl CD: CircuitDefinition<CES>, +Drop<CES>>(
    self: CES,
) -> AddInputResult<CD::CircuitType>

AddInputResultTrait

Fully qualified path: core::circuit::AddInputResultTrait

pub trait AddInputResultTrait<C>

Trait functions

next

Adds an input to the accumulator.

Fully qualified path: core::circuit::AddInputResultTrait::next

fn next<Value, +IntoCircuitInputValue<Value>, +Drop<Value>>(
    self: AddInputResult<C>, value: Value,
) -> AddInputResult<C>

done

Fully qualified path: core::circuit::AddInputResultTrait::done

fn done(self: AddInputResult<C>) -> CircuitData<C>

EvalCircuitTrait

Fully qualified path: core::circuit::EvalCircuitTrait

pub trait EvalCircuitTrait<C>

Trait functions

eval

Fully qualified path: core::circuit::EvalCircuitTrait::eval

fn eval(self: CircuitData<C>, modulus: CircuitModulus) -> crate::circuit::EvalCircuitResult<C>

eval_ex

Fully qualified path: core::circuit::EvalCircuitTrait::eval_ex

fn eval_ex(
    self: CircuitData<C>, descriptor: CircuitDescriptor<C>, modulus: CircuitModulus,
) -> crate::circuit::EvalCircuitResult<C>

BoxTrait

Fully qualified path: core::box::BoxTrait

pub trait BoxTrait<T>

Trait functions

new

Creates a new Box with the given value. Allocates space in the boxed segment for the provided value and returns a Box<T> that points to it. # Examples

let x = 42;
let boxed_x = BoxTrait::new(x);

Fully qualified path: core::box::BoxTrait::new

fn new(value: T) -> Box<T> nopanic

unbox

Unboxes the given Box and returns the wrapped value. # Examples

let boxed = BoxTrait::new(42);
assert!(boxed.unbox() == 42);

Fully qualified path: core::box::BoxTrait::unbox

fn unbox(self: Box<T>) -> T nopanic

as_snapshot

Converts the given snapshot of a Box into a Box of a snapshot. Useful for structures that aren't copyable. # Examples

let snap_boxed_arr = @BoxTraits::new(array![1, 2, 3]);
let boxed_snap_arr = snap_boxed_arr.as_snapshot();
let snap_arr = boxed_snap_arr.unbox();

Fully qualified path: core::box::BoxTrait::as_snapshot

fn as_snapshot(self: @Box<T>) -> Box<@T> nopanic

NullableTrait

Fully qualified path: core::nullable::NullableTrait

pub trait NullableTrait<T>

Trait functions

deref

Wrapper for Deref::deref. Prefer using Deref::deref directly. This function exists for backwards compatibility. # Examples Preferred way:

let value: Nullable<u32> = NullableTrait::new(42);
let unwrapped = value.deref();

This function method does the same thing:

use core::nullable::NullableTrait;
let also_unwrapped = NullableTrait::deref(value);

Fully qualified path: core::nullable::NullableTrait::deref

fn deref(nullable: Nullable<T>) -> T

deref_or

Returns the contained value if not null, or returns the provided default value. # Examples

let value: Nullable<u32> = NullableTrait::new(42);
assert!(value.deref_or(0) == 42);

let null_value: Nullable<u32> = Default::default();
assert!(null_value.deref_or(0) == 0);

Fully qualified path: core::nullable::NullableTrait::deref_or

fn deref_or<+Drop<T>>(self: Nullable<T>, default: T) -> T

new

Creates a new non-null Nullable with the given value. # Examples

let value: Nullable<u32> = NullableTrait::new(42);
assert!(!value.is_null());

Fully qualified path: core::nullable::NullableTrait::new

fn new(value: T) -> Nullable<T>

is_null

Returns true if the value is null. # Examples

let value: Nullable<u32> = NullableTrait::new(42);
assert!(!value.is_null());

let null_value: Nullable<u32> = Default::default();
assert!(null_value.is_null());

Fully qualified path: core::nullable::NullableTrait::is_null

fn is_null(self: @Nullable<T>) -> bool

as_snapshot

Creates a new Nullable containing a snapshot of the value. This is useful when working with non-copyable types inside a Nullable. This allows you to keep using the original value while also having access to a snapshot of it, preventing the original value from being moved. # Examples

let value: Nullable<Array<u32>> = NullableTrait::new(array![1, 2, 3]);
let res = (@value).as_snapshot();
assert!(res.deref() == @array![1, 2, 3]);
assert!(value.deref() == array![1, 2, 3]);

Fully qualified path: core::nullable::NullableTrait::as_snapshot

fn as_snapshot(self: @Nullable<T>) -> Nullable<@T> nopanic

ToSpanTrait

ToSpanTrait converts a data structure into a span of its data.

Fully qualified path: core::array::ToSpanTrait

pub trait ToSpanTrait<C, T>

Trait functions

span

Returns a span pointing to the data in the input.

Fully qualified path: core::array::ToSpanTrait::span

fn span(self: @C) -> Span<T>

ArrayTrait

Fully qualified path: core::array::ArrayTrait

pub trait ArrayTrait<T>

Trait functions

new

Constructs a new, empty Array<T>. # Examples

let arr: Array<u32> = ArrayTrait::new();

let arr = ArrayTrait::<u128>::new();

It is also possible to use the array! macro to create a new array.

let arr: Array<bool> = array![];

Fully qualified path: core::array::ArrayTrait::new

fn new() -> Array<T> nopanic

append

Adds a value of type T to the end of the array. # Examples

let mut arr: Array<u8> = array![1, 2];
arr.append(3);
assert!(arr == array![1, 2, 3]);

Fully qualified path: core::array::ArrayTrait::append

fn append(ref self: Array<T>, value: T) nopanic

append_span

Adds a span to the end of the array. # Examples

let mut arr: Array<u8> = array![];
arr.append_span(array![1, 2, 3].span());
assert!(arr == array![1, 2, 3]);

Fully qualified path: core::array::ArrayTrait::append_span

fn append_span<+Clone<T>, +Drop<T>>(ref self: Array<T>, span: Span<T>)

pop_front

Pops a value from the front of the array. Returns Option::Some(value) if the array is not empty, Option::None otherwise. # Examples

let mut arr = array![2, 3, 4];
assert!(arr.pop_front() == Option::Some(2));
assert!(arr.pop_front() == Option::Some(3));
assert!(arr.pop_front() == Option::Some(4));
assert!(arr.pop_front().is_none());

Fully qualified path: core::array::ArrayTrait::pop_front

fn pop_front(ref self: Array<T>) -> Option<T> nopanic

pop_front_consume

Pops a value from the front of the array. Returns an option containing the remaining array and the value removed if the array is not empty, otherwise Option::None and drops the array. # Examples

let arr = array![2, 3, 4];
assert!(arr.pop_front_consume() == Option::Some((array![3, 4], 2)));

let arr: Array<u8> = array![];
assert!(arr.pop_front_consume().is_none());

Fully qualified path: core::array::ArrayTrait::pop_front_consume

fn pop_front_consume(self: Array<T>) -> Option<(Array<T>, T)> nopanic

get

Returns an option containing a box of a snapshot of the element at the given 'index' if the array contains this index, 'Option::None' otherwise. Element at index 0 is the front of the array. # Examples

let arr = array![2, 3, 4];
assert!(arr.get(1).unwrap().unbox() == @3);

Fully qualified path: core::array::ArrayTrait::get

fn get(self: @Array<T>, index: usize) -> Option<Box<@T>>

at

Returns a snapshot of the element at the given index. Element at index 0 is the front of the array. # Panics Panics if the index is out of bounds. # Examples

let mut arr: Array<usize> = array![3,4,5,6];
assert!(arr.at(1) == @4);

Fully qualified path: core::array::ArrayTrait::at

fn at(self: @Array<T>, index: usize) -> @T

len

Returns the length of the array as a usize value. # Examples

let arr = array![2, 3, 4];
assert!(arr.len() == 3);

Fully qualified path: core::array::ArrayTrait::len

fn len(self: @Array<T>) -> usize

is_empty

Returns whether the array is empty or not. # Examples

let mut arr = array![];
assert!(arr.is_empty());
arr.append(1);
assert!(!arr.is_empty());

Fully qualified path: core::array::ArrayTrait::is_empty

fn is_empty(self: @Array<T>) -> bool

span

Returns a span of the array. # Examples

let arr: Array<u8> = array![1, 2, 3];
let span: Span<u8> = arr.span();

Fully qualified path: core::array::ArrayTrait::span

fn span(snapshot: @Array<T>) -> Span<T>

SpanTrait

Fully qualified path: core::array::SpanTrait

pub trait SpanTrait<T>

Trait functions

pop_front

Pops a value from the front of the span. Returns Option::Some(@value) if the array is not empty, Option::None otherwise. # Examples

let mut span = array![1, 2, 3].span();
assert!(span.pop_front() == Option::Some(@1));

Fully qualified path: core::array::SpanTrait::pop_front

fn pop_front(ref self: Span<T>) -> Option<@T>

pop_back

Pops a value from the back of the span. Returns Option::Some(@value) if the array is not empty, Option::None otherwise. # Examples

let mut span = array![1, 2, 3].span();
assert!(span.pop_back() == Option::Some(@3));

Fully qualified path: core::array::SpanTrait::pop_back

fn pop_back(ref self: Span<T>) -> Option<@T>

multi_pop_front

Pops multiple values from the front of the span. Returns an option containing a snapshot of a box that contains the values as a fixed-size array if the action completed successfully, 'Option::None' otherwise. # Examples

let mut span = array![1, 2, 3].span();
let result = *(span.multi_pop_front::<2>().unwrap());
let unboxed_result = result.unbox();
assert!(unboxed_result == [1, 2]);

Fully qualified path: core::array::SpanTrait::multi_pop_front

fn multi_pop_front<const SIZE: usize>(ref self: Span<T>) -> Option<@Box<[T; SIZE]>>

multi_pop_back

Pops multiple values from the back of the span. Returns an option containing a snapshot of a box that contains the values as a fixed-size array if the action completed successfully, 'Option::None' otherwise. # Examples

let mut span = array![1, 2, 3].span();
let result = *(span.multi_pop_back::<2>().unwrap());
let unboxed_result = result.unbox();
assert!(unboxed_result == [2, 3]);;

Fully qualified path: core::array::SpanTrait::multi_pop_back

fn multi_pop_back<const SIZE: usize>(ref self: Span<T>) -> Option<@Box<[T; SIZE]>>

get

Returns an option containing a box of a snapshot of the element at the given 'index' if the span contains this index, 'Option::None' otherwise. Element at index 0 is the front of the array. # Examples

let span = array![2, 3, 4];
assert!(span.get(1).unwrap().unbox() == @3);

Fully qualified path: core::array::SpanTrait::get

fn get(self: Span<T>, index: usize) -> Option<Box<@T>>

at

Returns a snapshot of the element at the given index. Element at index 0 is the front of the array. # Panics Panics if the index is out of bounds. # Examples

let span = array![2, 3, 4].span();
assert!(span.at(1) == @3);

Fully qualified path: core::array::SpanTrait::at

fn at(self: Span<T>, index: usize) -> @T

slice

Returns a span containing values from the 'start' index, with amount equal to 'length'. # Examples

let span = array![1, 2, 3].span();
assert!(span.slice(1, 2) == array![2, 3].span());

Fully qualified path: core::array::SpanTrait::slice

fn slice(self: Span<T>, start: usize, length: usize) -> Span<T>

len

Returns the length of the span as a usize value. # Examples

let span = array![2, 3, 4].span();
assert!(span.len() == 3);

Fully qualified path: core::array::SpanTrait::len

fn len(self: Span<T>) -> usize

is_empty

Returns whether the span is empty or not. # Examples

let span: Span<felt252> = array![].span();
assert!(span.is_empty());
let span = array![1, 2, 3].span();
assert!(!span.is_empty());

Fully qualified path: core::array::SpanTrait::is_empty

fn is_empty(self: Span<T>) -> bool

Felt252DictTrait

Basic trait for the Felt252Dict type.

Fully qualified path: core::dict::Felt252DictTrait

pub trait Felt252DictTrait<T>

Trait functions

insert

Inserts the given value for the given key. # Examples

use core::dict::Felt252Dict;

let mut dict: Felt252Dict<u8> = Default::default();
dict.insert(0, 10);

Fully qualified path: core::dict::Felt252DictTrait::insert

fn insert<+Destruct<T>>(ref self: Felt252Dict<T>, key: felt252, value: T)

get

Returns the value stored at the given key. If no value was previously inserted at this key, returns the default value for type T. # Examples

use core::dict::Felt252Dict;

let mut dict: Felt252Dict<u8> = Default::default();
dict.insert(0, 10);
let value = dict.get(0);
assert!(value == 10);

Fully qualified path: core::dict::Felt252DictTrait::get

fn get<+Copy<T>>(ref self: Felt252Dict<T>, key: felt252) -> T

squash

Squashes a dictionary and returns the associated SquashedFelt252Dict. # Examples

use core::dict::Felt252Dict;

let mut dict: Felt252Dict<u8> = Default::default();
dict.insert(0, 10);
let squashed_dict = dict.squash();

Fully qualified path: core::dict::Felt252DictTrait::squash

fn squash(self: Felt252Dict<T>) -> SquashedFelt252Dict<T> nopanic

entry

Retrieves the last entry for a certain key. This method takes ownership of the dictionary and returns the entry to update, as well as the previous value at the given key. # Examples

use core::dict::Felt252Dict;

let mut dict: Felt252Dict<u8> = Default::default();
dict.insert(0, 10);
let (entry, prev_value) = dict.entry(0);
assert!(prev_value == 10);

Fully qualified path: core::dict::Felt252DictTrait::entry

fn entry(self: Felt252Dict<T>, key: felt252) -> (Felt252DictEntry<T>, T) nopanic

Felt252DictEntryTrait

Basic trait for the Felt252DictEntryTrait type.

Fully qualified path: core::dict::Felt252DictEntryTrait

pub trait Felt252DictEntryTrait<T>

Trait functions

finalize

Finalizes the changes made to a dictionary entry and gives back the ownership of the dictionary. # Examples

use core::dict::Felt252DictEntryTrait;

// Create a dictionary that stores arrays
let mut dict: Felt252Dict<Nullable<Array<felt252>>> = Default::default();

let a = array![1, 2, 3];
dict.insert(0, NullableTrait::new(a));

let (entry, prev_value) = dict.entry(0);
let new_value = NullableTrait::new(array![4, 5, 6]);
dict = entry.finalize(new_value);
assert!(prev_value == a);
assert!(dict.get(0) == new_value);

Fully qualified path: core::dict::Felt252DictEntryTrait::finalize

fn finalize(self: Felt252DictEntry<T>, new_value: T) -> Felt252Dict<T>

ResultTrait

Fully qualified path: core::result::ResultTrait

pub trait ResultTrait<T, E>

Trait functions

expect

If val is Result::Ok(x), returns x. Otherwise, panics with err.

Fully qualified path: core::result::ResultTrait::expect

fn expect<+PanicDestruct<E>>(self: Result<T, E>, err: felt252) -> T

unwrap

If val is Result::Ok(x), returns x. Otherwise, panics.

Fully qualified path: core::result::ResultTrait::unwrap

fn unwrap<+Destruct<E>>(self: Result<T, E>) -> T

unwrap_or

If val is Result::Ok(x), returns x. Otherwise, returns default.

Fully qualified path: core::result::ResultTrait::unwrap_or

fn unwrap_or<+Destruct<T>, +Destruct<E>>(self: Result<T, E>, default: T) -> T

unwrap_or_default

If val is Result::Ok(x), returns x. Otherwise returns Default::<T>::default().

Fully qualified path: core::result::ResultTrait::unwrap_or_default

fn unwrap_or_default<+Destruct<E>, +Default<T>>(self: Result<T, E>) -> T

expect_err

If val is Result::Err(x), returns x. Otherwise, panics with err.

Fully qualified path: core::result::ResultTrait::expect_err

fn expect_err<+PanicDestruct<T>>(self: Result<T, E>, err: felt252) -> E

unwrap_err

If val is Result::Err(x), returns x. Otherwise, panics.

Fully qualified path: core::result::ResultTrait::unwrap_err

fn unwrap_err<+PanicDestruct<T>>(self: Result<T, E>) -> E

is_ok

Returns true if the Result is Result::Ok.

Fully qualified path: core::result::ResultTrait::is_ok

fn is_ok(self: @Result<T, E>) -> bool

is_err

Returns true if the Result is Result::Err.

Fully qualified path: core::result::ResultTrait::is_err

fn is_err(self: @Result<T, E>) -> bool

into_is_err

Returns true if the Result is Result::Ok, and consumes the value.

Fully qualified path: core::result::ResultTrait::into_is_err

fn into_is_err<+Destruct<T>, +Destruct<E>>(self: Result<T, E>) -> bool

into_is_ok

Returns true if the Result is Result::Err, and consumes the value.

Fully qualified path: core::result::ResultTrait::into_is_ok

fn into_is_ok<+Destruct<T>, +Destruct<E>>(self: Result<T, E>) -> bool

ok

Converts from Result<T, E> to Option<T>. Converts self into an Option<T>, consuming self, and discarding the error, if any. # Examples

let x: Result<u32, ByteArray> = Result::Ok(2);
assert_eq!(x.ok(), Option::Some(2));

let x: Result<u32, ByteArray> = Result::Err("Nothing here");
assert!(x.ok().is_none());

Fully qualified path: core::result::ResultTrait::ok

fn ok<+Destruct<T>, +Destruct<E>>(self: Result<T, E>) -> Option<T>

err

Converts from Result<T, E> to Option<E>. Converts self into an Option<E>, consuming self, and discarding the success value, if any. # Examples

let x: Result<u32, ByteArray> = Result::Err("Nothing here");
assert_eq!(x.err(), Option::Some("Nothing here"));

let x: Result<u32, ByteArray> = Result::Ok(2);
assert!(x.err().is_none());

Fully qualified path: core::result::ResultTrait::err

fn err<+Destruct<T>, +Destruct<E>>(self: Result<T, E>) -> Option<E>

OptionTrait

Fully qualified path: core::option::OptionTrait

pub trait OptionTrait<T>

Trait functions

expect

If val is Option::Some(x), returns x. Otherwise, panics with err.

Fully qualified path: core::option::OptionTrait::expect

fn expect(self: Option<T>, err: felt252) -> T

unwrap

If val is Option::Some(x), returns x. Otherwise, panics.

Fully qualified path: core::option::OptionTrait::unwrap

fn unwrap(self: Option<T>) -> T

ok_or

Transforms the Option<T> into a Result<T, E>, mapping Option::Some(v) to Result::Ok(v) and Option::None to Result::Err(err).

Fully qualified path: core::option::OptionTrait::ok_or

fn ok_or<E, +Destruct<E>>(self: Option<T>, err: E) -> Result<T, E>

is_some

Returns true if the Option is Option::Some.

Fully qualified path: core::option::OptionTrait::is_some

fn is_some(self: @Option<T>) -> bool

is_none

Returns true if the Option is Option::None.

Fully qualified path: core::option::OptionTrait::is_none

fn is_none(self: @Option<T>) -> bool

unwrap_or

If self is Option::Some(x), returns x. Otherwise, returns the provided default.

Fully qualified path: core::option::OptionTrait::unwrap_or

fn unwrap_or<+Destruct<T>>(self: Option<T>, default: T) -> T

unwrap_or_default

If self is Option::Some(x), returns x. Otherwise, returns Default::<T>::default().

Fully qualified path: core::option::OptionTrait::unwrap_or_default

fn unwrap_or_default<+Default<T>>(self: Option<T>) -> T

Clone

A common trait for the ability to explicitly duplicate an object. Differs from Copy in that Copy is implicit and inexpensive, while Clone is always explicit and may or may not be expensive. Since Clone is more general than Copy, you can automatically make anything Copy be Clone as well. ## Derivable This trait can be used with #[derive] if all fields are Clone. The derived implementation of Clone calls clone on each field.

Fully qualified path: core::clone::Clone

pub trait Clone<T>

Trait functions

clone

Returns a copy of the value. # Examples

let arr = array![1, 2, 3];
assert!(arr == arr.clone());

Fully qualified path: core::clone::Clone::clone

fn clone(self: @T) -> T

EcStateTrait

Fully qualified path: core::ec::EcStateTrait

pub trait EcStateTrait

Trait functions

init

Initializes an EC computation with the zero point.

Fully qualified path: core::ec::EcStateTrait::init

fn init() -> EcState nopanic

add

Adds a point to the computation.

Fully qualified path: core::ec::EcStateTrait::add

fn add(ref self: EcState, p: NonZeroEcPoint) nopanic

sub

Subs a point to the computation.

Fully qualified path: core::ec::EcStateTrait::sub

fn sub(ref self: EcState, p: NonZeroEcPoint)

add_mul

Adds the product p * scalar to the state.

Fully qualified path: core::ec::EcStateTrait::add_mul

fn add_mul(ref self: EcState, scalar: felt252, p: NonZeroEcPoint) nopanic

finalize_nz

Finalizes the EC computation and returns the result (returns None if the result is the zero point).

Fully qualified path: core::ec::EcStateTrait::finalize_nz

fn finalize_nz(self: EcState) -> Option<NonZeroEcPoint> nopanic

finalize

Finalizes the EC computation and returns the result.

Fully qualified path: core::ec::EcStateTrait::finalize

fn finalize(self: EcState) -> EcPoint

EcPointTrait

Fully qualified path: core::ec::EcPointTrait

pub trait EcPointTrait

Trait functions

new

Creates a new EC point from its (x, y) coordinates.

Fully qualified path: core::ec::EcPointTrait::new

fn new(x: felt252, y: felt252) -> Option<EcPoint>

new_nz

Creates a new NonZero EC point from its (x, y) coordinates.

Fully qualified path: core::ec::EcPointTrait::new_nz

fn new_nz(x: felt252, y: felt252) -> Option<NonZeroEcPoint>

new_from_x

Creates a new EC point from its x coordinate.

Fully qualified path: core::ec::EcPointTrait::new_from_x

fn new_from_x(x: felt252) -> Option<EcPoint>

new_nz_from_x

Creates a new NonZero EC point from its x coordinate.

Fully qualified path: core::ec::EcPointTrait::new_nz_from_x

fn new_nz_from_x(x: felt252) -> Option<NonZeroEcPoint>

coordinates

Returns the coordinates of the EC point.

Fully qualified path: core::ec::EcPointTrait::coordinates

fn coordinates(self: NonZeroEcPoint) -> (felt252, felt252)

x

Returns the x coordinate of the EC point.

Fully qualified path: core::ec::EcPointTrait::x

fn x(self: NonZeroEcPoint) -> felt252

y

Returns the y coordinate of the EC point.

Fully qualified path: core::ec::EcPointTrait::y

fn y(self: NonZeroEcPoint) -> felt252

mul

Computes the product of an EC point p by the given scalar scalar.

Fully qualified path: core::ec::EcPointTrait::mul

fn mul(self: EcPoint, scalar: felt252) -> EcPoint

NumericLiteral

Fully qualified path: core::integer::NumericLiteral

pub trait NumericLiteral<T>;

BoundedInt

Trait for getting the maximal and minimal values of an integer type.

Fully qualified path: core::integer::BoundedInt

pub trait BoundedInt<T>

Trait functions

min

Returns the minimal value of the type.

Fully qualified path: core::integer::BoundedInt::min

fn min() -> T nopanic

max

Returns the maximal value of the type.

Fully qualified path: core::integer::BoundedInt::max

fn max() -> T nopanic

AbsAndSign

Internal trait for easier finding of absolute values.

Fully qualified path: core::integer::AbsAndSign

pub(crate) trait AbsAndSign<Signed, Unsigned>

Trait functions

abs_and_sign

Returns the absolute value of the Signed value as Unsigned and the original sign. Returns true for sign if the number was negative and false otherwise.

Fully qualified path: core::integer::AbsAndSign::abs_and_sign

fn abs_and_sign(self: Signed) -> (Unsigned, bool)

Zero

Defines an additive identity element for T.

Fully qualified path: core::num::traits::zero::Zero

pub trait Zero<T>

Trait functions

zero

Returns the additive identity element of T, 0.

Fully qualified path: core::num::traits::zero::Zero::zero

fn zero() -> T

is_zero

Returns true if self is equal to the additive identity.

Fully qualified path: core::num::traits::zero::Zero::is_zero

fn is_zero(self: @T) -> bool

is_non_zero

Returns false if self is equal to the additive identity.

Fully qualified path: core::num::traits::zero::Zero::is_non_zero

fn is_non_zero(self: @T) -> bool

One

Defines a multiplicative identity element for T.

Fully qualified path: core::num::traits::one::One

pub trait One<T>

Trait functions

one

Returns the multiplicative identity element of T, 1.

Fully qualified path: core::num::traits::one::One::one

fn one() -> T

is_one

Returns true if self is equal to the multiplicative identity.

Fully qualified path: core::num::traits::one::One::is_one

fn is_one(self: @T) -> bool

is_non_one

Returns false if self is equal to the multiplicative identity.

Fully qualified path: core::num::traits::one::One::is_non_one

fn is_non_one(self: @T) -> bool

BitSize

Trait used to retrieve the size in bits of a type.

Fully qualified path: core::num::traits::bit_size::BitSize

pub trait BitSize<T>

Trait functions

bits

Returns the size in bits of T as usize.

Fully qualified path: core::num::traits::bit_size::BitSize::bits

fn bits() -> usize

Bounded

A trait defining minimum and maximum bounds for numeric types. Only supports types that can have a constant value. Example:

Bounded::<MyType>::MAX;

Fully qualified path: core::num::traits::bounded::Bounded

pub trait Bounded<T>

Trait constants

MIN

The minimum allowable value.

Fully qualified path: core::num::traits::bounded::Bounded::MIN

const MIN: T;

MAX

The maximum allowable value.

Fully qualified path: core::num::traits::bounded::Bounded::MAX

const MAX: T;

OverflowingAdd

Performs addition with a flag for overflow.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingAdd

pub trait OverflowingAdd<T>

Trait functions

overflowing_add

Returns a tuple of the sum along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingAdd::overflowing_add

fn overflowing_add(self: T, v: T) -> (T, bool)

OverflowingSub

Performs subtraction with a flag for overflow.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingSub

pub trait OverflowingSub<T>

Trait functions

overflowing_sub

Returns a tuple of the difference along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingSub::overflowing_sub

fn overflowing_sub(self: T, v: T) -> (T, bool)

OverflowingMul

Performs multiplication with a flag for overflow.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingMul

pub trait OverflowingMul<T>

Trait functions

overflowing_mul

Returns a tuple of the product along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingMul::overflowing_mul

fn overflowing_mul(self: T, v: T) -> (T, bool)

WrappingAdd

Performs addition that wraps around on overflow.

Fully qualified path: core::num::traits::ops::wrapping::WrappingAdd

pub trait WrappingAdd<T>

Trait functions

wrapping_add

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type.

Fully qualified path: core::num::traits::ops::wrapping::WrappingAdd::wrapping_add

fn wrapping_add(self: T, v: T) -> T

WrappingSub

Performs subtraction that wraps around on overflow.

Fully qualified path: core::num::traits::ops::wrapping::WrappingSub

pub trait WrappingSub<T>

Trait functions

wrapping_sub

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type.

Fully qualified path: core::num::traits::ops::wrapping::WrappingSub::wrapping_sub

fn wrapping_sub(self: T, v: T) -> T

WrappingMul

Performs multiplication that wraps around on overflow.

Fully qualified path: core::num::traits::ops::wrapping::WrappingMul

pub trait WrappingMul<T>

Trait functions

wrapping_mul

Wrapping (modular) multiplication. Computes self * other, wrapping around at the boundary of the type.

Fully qualified path: core::num::traits::ops::wrapping::WrappingMul::wrapping_mul

fn wrapping_mul(self: T, v: T) -> T

CheckedAdd

Performs addition that returns None instead of wrapping around on overflow.

Fully qualified path: core::num::traits::ops::checked::CheckedAdd

pub trait CheckedAdd<T>

Trait functions

checked_add

Adds two numbers, checking for overflow. If overflow happens, None is returned.

Fully qualified path: core::num::traits::ops::checked::CheckedAdd::checked_add

fn checked_add(self: T, v: T) -> Option<T>

CheckedSub

Performs subtraction that returns None instead of wrapping around on underflow.

Fully qualified path: core::num::traits::ops::checked::CheckedSub

pub trait CheckedSub<T>

Trait functions

checked_sub

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.

Fully qualified path: core::num::traits::ops::checked::CheckedSub::checked_sub

fn checked_sub(self: T, v: T) -> Option<T>

CheckedMul

Performs multiplication that returns None instead of wrapping around on underflow or overflow.

Fully qualified path: core::num::traits::ops::checked::CheckedMul

pub trait CheckedMul<T>

Trait functions

checked_mul

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.

Fully qualified path: core::num::traits::ops::checked::CheckedMul::checked_mul

fn checked_mul(self: T, v: T) -> Option<T>

Pow

A trait for calculating a base to the power of an exponent.

Fully qualified path: core::num::traits::ops::pow::Pow

pub trait Pow<Base, Exp>

Trait functions

pow

Returns self to the power exp.

Fully qualified path: core::num::traits::ops::pow::Pow::pow

fn pow(self: Base, exp: Exp) -> Self::Output

Trait types

Output

Fully qualified path: core::num::traits::ops::pow::Pow::Output

type Output;

SaturatingAdd

Performs addition that saturates at the numeric bounds instead of overflowing.

Fully qualified path: core::num::traits::ops::saturating::SaturatingAdd

pub trait SaturatingAdd<T>

Trait functions

saturating_add

Saturating addition. Computes self + other, saturating at the relevant high or low boundary of the type.

Fully qualified path: core::num::traits::ops::saturating::SaturatingAdd::saturating_add

fn saturating_add(self: T, other: T) -> T

SaturatingSub

Performs subtraction that saturates at the numeric bounds instead of overflowing.

Fully qualified path: core::num::traits::ops::saturating::SaturatingSub

pub trait SaturatingSub<T>

Trait functions

saturating_sub

Saturating subtraction. Computes self - other, saturating at the relevant high or low boundary of the type.

Fully qualified path: core::num::traits::ops::saturating::SaturatingSub::saturating_sub

fn saturating_sub(self: T, other: T) -> T

SaturatingMul

Performs multiplication that saturates at the numeric bounds instead of overflowing.

Fully qualified path: core::num::traits::ops::saturating::SaturatingMul

pub trait SaturatingMul<T>

Trait functions

saturating_mul

Saturating multiplication. Computes self * other, saturating at the relevant high or low boundary of the type.

Fully qualified path: core::num::traits::ops::saturating::SaturatingMul::saturating_mul

fn saturating_mul(self: T, other: T) -> T

WideMul

A trait for types that can be multiplied together to produce a wider type.

Fully qualified path: core::num::traits::ops::widemul::WideMul

pub trait WideMul<Lhs, Rhs>

Trait functions

wide_mul

Multiply two values together, producing a wider type.

Fully qualified path: core::num::traits::ops::widemul::WideMul::wide_mul

fn wide_mul(self: Lhs, other: Rhs) -> Self::Target

Trait types

Target

The type of the result of the multiplication.

Fully qualified path: core::num::traits::ops::widemul::WideMul::Target

type Target;

WideSquare

A trait for a type that can be squared to produce a wider type.

Fully qualified path: core::num::traits::ops::widesquare::WideSquare

pub trait WideSquare<T>

Trait functions

wide_square

Calculates the square, producing a wider type.

Fully qualified path: core::num::traits::ops::widesquare::WideSquare::wide_square

fn wide_square(self: T) -> Self::Target

Trait types

Target

The type of the result of the square.

Fully qualified path: core::num::traits::ops::widesquare::WideSquare::Target

type Target;

Sqrt

A trait for computing the square root of a number.

Fully qualified path: core::num::traits::ops::sqrt::Sqrt

pub trait Sqrt<T>

Trait functions

sqrt

Compute the square root of a number.

Fully qualified path: core::num::traits::ops::sqrt::Sqrt::sqrt

fn sqrt(self: T) -> Self::Target

Trait types

Target

The type of the result of the square root operation.

Fully qualified path: core::num::traits::ops::sqrt::Sqrt::Target

type Target;

Zero

Defines an additive identity element for T.

Fully qualified path: core::num::traits::zero::Zero

pub trait Zero<T>

Trait functions

zero

Returns the additive identity element of T, 0.

Fully qualified path: core::num::traits::zero::Zero::zero

fn zero() -> T

is_zero

Returns true if self is equal to the additive identity.

Fully qualified path: core::num::traits::zero::Zero::is_zero

fn is_zero(self: @T) -> bool

is_non_zero

Returns false if self is equal to the additive identity.

Fully qualified path: core::num::traits::zero::Zero::is_non_zero

fn is_non_zero(self: @T) -> bool

One

Defines a multiplicative identity element for T.

Fully qualified path: core::num::traits::one::One

pub trait One<T>

Trait functions

one

Returns the multiplicative identity element of T, 1.

Fully qualified path: core::num::traits::one::One::one

fn one() -> T

is_one

Returns true if self is equal to the multiplicative identity.

Fully qualified path: core::num::traits::one::One::is_one

fn is_one(self: @T) -> bool

is_non_one

Returns false if self is equal to the multiplicative identity.

Fully qualified path: core::num::traits::one::One::is_non_one

fn is_non_one(self: @T) -> bool

BitSize

Trait used to retrieve the size in bits of a type.

Fully qualified path: core::num::traits::bit_size::BitSize

pub trait BitSize<T>

Trait functions

bits

Returns the size in bits of T as usize.

Fully qualified path: core::num::traits::bit_size::BitSize::bits

fn bits() -> usize

OverflowingAdd

Performs addition with a flag for overflow.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingAdd

pub trait OverflowingAdd<T>

Trait functions

overflowing_add

Returns a tuple of the sum along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingAdd::overflowing_add

fn overflowing_add(self: T, v: T) -> (T, bool)

OverflowingSub

Performs subtraction with a flag for overflow.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingSub

pub trait OverflowingSub<T>

Trait functions

overflowing_sub

Returns a tuple of the difference along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingSub::overflowing_sub

fn overflowing_sub(self: T, v: T) -> (T, bool)

OverflowingMul

Performs multiplication with a flag for overflow.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingMul

pub trait OverflowingMul<T>

Trait functions

overflowing_mul

Returns a tuple of the product along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Fully qualified path: core::num::traits::ops::overflowing::OverflowingMul::overflowing_mul

fn overflowing_mul(self: T, v: T) -> (T, bool)

WrappingAdd

Performs addition that wraps around on overflow.

Fully qualified path: core::num::traits::ops::wrapping::WrappingAdd

pub trait WrappingAdd<T>

Trait functions

wrapping_add

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type.

Fully qualified path: core::num::traits::ops::wrapping::WrappingAdd::wrapping_add

fn wrapping_add(self: T, v: T) -> T

WrappingSub

Performs subtraction that wraps around on overflow.

Fully qualified path: core::num::traits::ops::wrapping::WrappingSub

pub trait WrappingSub<T>

Trait functions

wrapping_sub

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type.

Fully qualified path: core::num::traits::ops::wrapping::WrappingSub::wrapping_sub

fn wrapping_sub(self: T, v: T) -> T

WrappingMul

Performs multiplication that wraps around on overflow.

Fully qualified path: core::num::traits::ops::wrapping::WrappingMul

pub trait WrappingMul<T>

Trait functions

wrapping_mul

Wrapping (modular) multiplication. Computes self * other, wrapping around at the boundary of the type.

Fully qualified path: core::num::traits::ops::wrapping::WrappingMul::wrapping_mul

fn wrapping_mul(self: T, v: T) -> T

CheckedAdd

Performs addition that returns None instead of wrapping around on overflow.

Fully qualified path: core::num::traits::ops::checked::CheckedAdd

pub trait CheckedAdd<T>

Trait functions

checked_add

Adds two numbers, checking for overflow. If overflow happens, None is returned.

Fully qualified path: core::num::traits::ops::checked::CheckedAdd::checked_add

fn checked_add(self: T, v: T) -> Option<T>

CheckedSub

Performs subtraction that returns None instead of wrapping around on underflow.

Fully qualified path: core::num::traits::ops::checked::CheckedSub

pub trait CheckedSub<T>

Trait functions

checked_sub

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.

Fully qualified path: core::num::traits::ops::checked::CheckedSub::checked_sub

fn checked_sub(self: T, v: T) -> Option<T>

CheckedMul

Performs multiplication that returns None instead of wrapping around on underflow or overflow.

Fully qualified path: core::num::traits::ops::checked::CheckedMul

pub trait CheckedMul<T>

Trait functions

checked_mul

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.

Fully qualified path: core::num::traits::ops::checked::CheckedMul::checked_mul

fn checked_mul(self: T, v: T) -> Option<T>

SaturatingAdd

Performs addition that saturates at the numeric bounds instead of overflowing.

Fully qualified path: core::num::traits::ops::saturating::SaturatingAdd

pub trait SaturatingAdd<T>

Trait functions

saturating_add

Saturating addition. Computes self + other, saturating at the relevant high or low boundary of the type.

Fully qualified path: core::num::traits::ops::saturating::SaturatingAdd::saturating_add

fn saturating_add(self: T, other: T) -> T

SaturatingSub

Performs subtraction that saturates at the numeric bounds instead of overflowing.

Fully qualified path: core::num::traits::ops::saturating::SaturatingSub

pub trait SaturatingSub<T>

Trait functions

saturating_sub

Saturating subtraction. Computes self - other, saturating at the relevant high or low boundary of the type.

Fully qualified path: core::num::traits::ops::saturating::SaturatingSub::saturating_sub

fn saturating_sub(self: T, other: T) -> T

SaturatingMul

Performs multiplication that saturates at the numeric bounds instead of overflowing.

Fully qualified path: core::num::traits::ops::saturating::SaturatingMul

pub trait SaturatingMul<T>

Trait functions

saturating_mul

Saturating multiplication. Computes self * other, saturating at the relevant high or low boundary of the type.

Fully qualified path: core::num::traits::ops::saturating::SaturatingMul::saturating_mul

fn saturating_mul(self: T, other: T) -> T

Pow

A trait for calculating a base to the power of an exponent.

Fully qualified path: core::num::traits::ops::pow::Pow

pub trait Pow<Base, Exp>

Trait functions

pow

Returns self to the power exp.

Fully qualified path: core::num::traits::ops::pow::Pow::pow

fn pow(self: Base, exp: Exp) -> Self::Output

Trait types

Output

Fully qualified path: core::num::traits::ops::pow::Pow::Output

type Output;

Sqrt

A trait for computing the square root of a number.

Fully qualified path: core::num::traits::ops::sqrt::Sqrt

pub trait Sqrt<T>

Trait functions

sqrt

Compute the square root of a number.

Fully qualified path: core::num::traits::ops::sqrt::Sqrt::sqrt

fn sqrt(self: T) -> Self::Target

Trait types

Target

The type of the result of the square root operation.

Fully qualified path: core::num::traits::ops::sqrt::Sqrt::Target

type Target;

WideMul

A trait for types that can be multiplied together to produce a wider type.

Fully qualified path: core::num::traits::ops::widemul::WideMul

pub trait WideMul<Lhs, Rhs>

Trait functions

wide_mul

Multiply two values together, producing a wider type.

Fully qualified path: core::num::traits::ops::widemul::WideMul::wide_mul

fn wide_mul(self: Lhs, other: Rhs) -> Self::Target

Trait types

Target

The type of the result of the multiplication.

Fully qualified path: core::num::traits::ops::widemul::WideMul::Target

type Target;

WideSquare

A trait for a type that can be squared to produce a wider type.

Fully qualified path: core::num::traits::ops::widesquare::WideSquare

pub trait WideSquare<T>

Trait functions

wide_square

Calculates the square, producing a wider type.

Fully qualified path: core::num::traits::ops::widesquare::WideSquare::wide_square

fn wide_square(self: T) -> Self::Target

Trait types

Target

The type of the result of the square.

Fully qualified path: core::num::traits::ops::widesquare::WideSquare::Target

type Target;

Index

Trait for accessing an item contained in type C with an index of type I.

Fully qualified path: core::ops::index::Index

pub trait Index<C, I>

Trait functions

index

Returns the item at the given index.

Fully qualified path: core::ops::index::Index::index

fn index(ref self: C, index: I) -> Self::Target

Trait types

Target

The type of the item.

Fully qualified path: core::ops::index::Index::Target

type Target;

IndexView

The following two traits are for implementing the [] operator. Only one should be implemented for each type. Both are not consuming of self, the first gets a snapshot of the object and the second gets ref. Trait for a view of an item contained in type C with an index of type I.

Fully qualified path: core::ops::index::IndexView

pub trait IndexView<C, I>

Trait functions

index

Returns the item at the given index.

Fully qualified path: core::ops::index::IndexView::index

fn index(self: @C, index: I) -> Self::Target

Trait types

Target

The type of the item.

Fully qualified path: core::ops::index::IndexView::Target

type Target;

AddAssign

The addition assignment operator +=.

Fully qualified path: core::ops::arith::AddAssign

pub trait AddAssign<Lhs, Rhs>

Trait functions

add_assign

Performs the += operation.

Fully qualified path: core::ops::arith::AddAssign::add_assign

fn add_assign(ref self: Lhs, rhs: Rhs)

SubAssign

The subtraction assignment operator -=.

Fully qualified path: core::ops::arith::SubAssign

pub trait SubAssign<Lhs, Rhs>

Trait functions

sub_assign

Performs the -= operation.

Fully qualified path: core::ops::arith::SubAssign::sub_assign

fn sub_assign(ref self: Lhs, rhs: Rhs)

MulAssign

The multiplication assignment operator *=.

Fully qualified path: core::ops::arith::MulAssign

pub trait MulAssign<Lhs, Rhs>

Trait functions

mul_assign

Performs the *= operation.

Fully qualified path: core::ops::arith::MulAssign::mul_assign

fn mul_assign(ref self: Lhs, rhs: Rhs)

DivAssign

The division assignment operator /=.

Fully qualified path: core::ops::arith::DivAssign

pub trait DivAssign<Lhs, Rhs>

Trait functions

div_assign

Performs the /= operation.

Fully qualified path: core::ops::arith::DivAssign::div_assign

fn div_assign(ref self: Lhs, rhs: Rhs)

RemAssign

The remainder assignment operator %=.

Fully qualified path: core::ops::arith::RemAssign

pub trait RemAssign<Lhs, Rhs>

Trait functions

rem_assign

Performs the %= operation.

Fully qualified path: core::ops::arith::RemAssign::rem_assign

fn rem_assign(ref self: Lhs, rhs: Rhs)

Deref

A trait for dereferencing a value. This is used in order to directly access members of the dereferenced value.

Fully qualified path: core::ops::deref::Deref

pub trait Deref<T>

Trait functions

deref

Returns the dereferenced value.

Fully qualified path: core::ops::deref::Deref::deref

fn deref(self: T) -> Self::Target

Trait types

Target

The type of the dereferenced value.

Fully qualified path: core::ops::deref::Deref::Target

type Target;

SnapshotDeref

A helper trait for dereferencing a snapshot of a type. Should not be implemented for copyable types.

Fully qualified path: core::ops::deref::SnapshotDeref

pub trait SnapshotDeref<T>

Trait functions

snapshot_deref

Returns the dereferenced value.

Fully qualified path: core::ops::deref::SnapshotDeref::snapshot_deref

fn snapshot_deref(self: @T) -> Self::Target

Trait types

Target

The type of the dereferenced value.

Fully qualified path: core::ops::deref::SnapshotDeref::Target

type Target;

DerefMut

A trait for dereferencing a value. This is used in order to handle the case where the value is a reference.

Fully qualified path: core::ops::deref::DerefMut

pub trait DerefMut<T>

Trait functions

deref_mut

Returns the dereferenced value.

Fully qualified path: core::ops::deref::DerefMut::deref_mut

fn deref_mut(ref self: T) -> Self::Target

Trait types

Target

The type of the dereferenced value.

Fully qualified path: core::ops::deref::DerefMut::Target

type Target;

FnOnce

The version of the call operator that takes a by-value receiver. Instances of FnOnce can be called, but might not be callable multiple times. Because of this, if the only thing known about a type is that it implements FnOnce, it can only be called once. FnOnce is implemented automatically by closures that might consume captured variables.

Fully qualified path: core::ops::function::FnOnce

pub trait FnOnce<T, Args>

Trait functions

call

Performs the call operation.

Fully qualified path: core::ops::function::FnOnce::call

fn call(self: T, args: Args) -> Self::Output

Trait types

Output

The returned type after the call operator is used.

Fully qualified path: core::ops::function::FnOnce::Output

type Output;

Fn

The version of the call operator that takes a by-snapshot receiver. Instances of Fn can be called multiple times. Fn is implemented automatically by closures that capture only copyable variables.

Fully qualified path: core::ops::function::Fn

pub trait Fn<T, Args>

Trait functions

call

Performs the call operation.

Fully qualified path: core::ops::function::Fn::call

fn call(self: @T, args: Args) -> Self::Output

Trait types

Output

The returned type after the call operator is used.

Fully qualified path: core::ops::function::Fn::Output

type Output;

IndexView

The following two traits are for implementing the [] operator. Only one should be implemented for each type. Both are not consuming of self, the first gets a snapshot of the object and the second gets ref. Trait for a view of an item contained in type C with an index of type I.

Fully qualified path: core::ops::index::IndexView

pub trait IndexView<C, I>

Trait functions

index

Returns the item at the given index.

Fully qualified path: core::ops::index::IndexView::index

fn index(self: @C, index: I) -> Self::Target

Trait types

Target

The type of the item.

Fully qualified path: core::ops::index::IndexView::Target

type Target;

Index

Trait for accessing an item contained in type C with an index of type I.

Fully qualified path: core::ops::index::Index

pub trait Index<C, I>

Trait functions

index

Returns the item at the given index.

Fully qualified path: core::ops::index::Index::index

fn index(ref self: C, index: I) -> Self::Target

Trait types

Target

The type of the item.

Fully qualified path: core::ops::index::Index::Target

type Target;

Serde

Fully qualified path: core::serde::Serde

pub trait Serde<T>

Trait functions

serialize

Serializes a value into a sequence of felt252s. # Examples

let value: u256 = 1;
let mut serialized: Array<felt252> = array![];
value.serialize(ref serialized);
assert!(serialized == array![1, 0]) // `serialized` contains the [low, high] parts of the
`u256` value ```

Fully qualified path: core::serde::Serde::serialize

fn serialize(self: @T, ref output: Array<felt252>)

deserialize

Deserializes a value from a sequence of felt252s. If the value cannot be deserialized, returns Option::None. # Examples

let mut serialized: Span<felt252> = array![1, 0].span();
let value: u256 = Serde::deserialize(ref serialized).unwrap();
assert!(value == 1);

Fully qualified path: core::serde::Serde::deserialize

fn deserialize(ref serialized: Span<felt252>) -> Option<T>

HashStateTrait

A trait for hash state accumulators.

Fully qualified path: core::hash::HashStateTrait

pub trait HashStateTrait<S>

Trait functions

update

Fully qualified path: core::hash::HashStateTrait::update

fn update(self: S, value: felt252) -> S

finalize

Fully qualified path: core::hash::HashStateTrait::finalize

fn finalize(self: S) -> felt252

Hash

A trait for values that can be hashed.

Fully qualified path: core::hash::Hash

pub trait Hash<T, S, +HashStateTrait<S>>

Trait functions

update_state

Updates the hash state with the given value.

Fully qualified path: core::hash::Hash::update_state

fn update_state(state: S, value: T) -> S

LegacyHash

Trait for hashing values. Used for backwards compatibility. NOTE: Implement Hash instead of this trait if possible.

Fully qualified path: core::hash::LegacyHash

pub trait LegacyHash<T>

Trait functions

hash

Fully qualified path: core::hash::LegacyHash::hash

fn hash(state: felt252, value: T) -> felt252

HashStateExTrait

Extension trait for hash state accumulators.

Fully qualified path: core::hash::HashStateExTrait

pub trait HashStateExTrait<S, T>

Trait functions

update_with

Updates the hash state with the given value.

Fully qualified path: core::hash::HashStateExTrait::update_with

fn update_with(self: S, value: T) -> S

PedersenTrait

Fully qualified path: core::pedersen::PedersenTrait

pub trait PedersenTrait

Trait functions

new

Creates a new Pedersen hash state with the given base value. # Examples

let mut state = PedersenTrait::new(0);
assert!(state.state == 0);

Fully qualified path: core::pedersen::PedersenTrait::new

fn new(base: felt252) -> HashState

PoseidonTrait

Fully qualified path: core::poseidon::PoseidonTrait

pub trait PoseidonTrait

Trait functions

new

Creates an initial state with all fields set to 0. # Examples

use core::poseidon::PoseidonTrait;

let mut state = PoseidonTrait::new();

Fully qualified path: core::poseidon::PoseidonTrait::new

fn new() -> HashState

PrintTrait

A trait for printing values for debugging purposes. Accessible with prelude editions prior to 2024_07. # Examples

use core::debug::PrintTrait;

1.print();
(1 == 2).print();

let mut arr = array![];
arr.append('1234567890123456789012345678901');
arr.append('Sca');
arr.append('SomeVeryLongMessage');
arr.print();

Fully qualified path: core::debug::PrintTrait

pub(crate) trait PrintTrait<T>

Trait functions

print

Fully qualified path: core::debug::PrintTrait::print

fn print(self: T)

Display

A trait for standard formatting, using the empty format ("{}"). # Examples

let word: ByteArray = "123";
println!("{}", word);

Fully qualified path: core::fmt::Display

pub trait Display<T>

Trait functions

fmt

Fully qualified path: core::fmt::Display::fmt

fn fmt(self: @T, ref f: Formatter) -> Result<(), Error>

Debug

A trait for debug formatting, using the empty format ("{:?}"). # Examples

let word: ByteArray = "123";
println!("{:?}", word);

Fully qualified path: core::fmt::Debug

pub trait Debug<T>

Trait functions

fmt

Fully qualified path: core::fmt::Debug::fmt

fn fmt(self: @T, ref f: Formatter) -> Result<(), Error>

LowerHex

A trait for hex formatting in lower case, using the empty format ("{:x}").

Fully qualified path: core::fmt::LowerHex

pub trait LowerHex<T>

Trait functions

fmt

Fully qualified path: core::fmt::LowerHex::fmt

fn fmt(self: @T, ref f: Formatter) -> Result<(), Error>

SyscallResultTrait

Fully qualified path: core::starknet::SyscallResultTrait

pub trait SyscallResultTrait<T>

Trait functions

unwrap_syscall

If val is Result::Ok(x), returns x. Otherwise, panics with the revert reason.

Fully qualified path: core::starknet::SyscallResultTrait::unwrap_syscall

fn unwrap_syscall(self: SyscallResult<T>) -> T

Store

Trait for types that can be used as a value in Starknet storage variables.

Fully qualified path: core::starknet::storage_access::Store

pub trait Store<T>

Trait functions

read

Reads a value from storage from domain address_domain and base address base.

Fully qualified path: core::starknet::storage_access::Store::read

fn read(address_domain: u32, base: StorageBaseAddress) -> SyscallResult<T>

write

Writes a value to storage to domain address_domain and base address base.

Fully qualified path: core::starknet::storage_access::Store::write

fn write(address_domain: u32, base: StorageBaseAddress, value: T) -> SyscallResult<()>

read_at_offset

Reads a value from storage from domain address_domain and base address base at offset offset.

Fully qualified path: core::starknet::storage_access::Store::read_at_offset

fn read_at_offset(address_domain: u32, base: StorageBaseAddress, offset: u8) -> SyscallResult<T>

write_at_offset

Writes a value to storage to domain address_domain and base address base at offset offset.

Fully qualified path: core::starknet::storage_access::Store::write_at_offset

fn write_at_offset(
    address_domain: u32, base: StorageBaseAddress, offset: u8, value: T,
) -> SyscallResult<()>

size

Fully qualified path: core::starknet::storage_access::Store::size

fn size() -> u8

Event

Fully qualified path: core::starknet::event::Event

pub trait Event<T>

Trait functions

append_keys_and_data

Fully qualified path: core::starknet::event::Event::append_keys_and_data

fn append_keys_and_data(self: @T, ref keys: Array<felt252>, ref data: Array<felt252>)

deserialize

Fully qualified path: core::starknet::event::Event::deserialize

fn deserialize(ref keys: Span<felt252>, ref data: Span<felt252>) -> Option<T>

AccountContract

A trait for account contracts that support class declarations (only __validate__ and __execute__ are mandatory for an account). This trait assumes that the calldata for invoke transactions is Array<Call>. This is the network standard following SNIP6. It is not enforced by StarkNet, but deviating from the standard interface may lead to incompatibility with standard tooling.

Fully qualified path: core::starknet::account::AccountContract

pub trait AccountContract<TContractState>

Trait functions

validate_declare

An entry point that is called to check if the account is willing to pay for the declaration of the class with the given hash. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the declaration.

Fully qualified path: core::starknet::account::AccountContract::__validate_declare__

fn __validate_declare__(self: @TContractState, class_hash: felt252) -> felt252

validate

An entry point that is called to check if the account is willing to pay for executing a given set of calls. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the execution, in which case __execute__ will be called on the same set of calls.

Fully qualified path: core::starknet::account::AccountContract::__validate__

fn __validate__(ref self: TContractState, calls: Array<Call>) -> felt252

execute

An entry point that is called to execute a given set of calls. This entry point should block the deprecated v0 invoke transactions as they do not go through the __validate__ entry point.

Fully qualified path: core::starknet::account::AccountContract::__execute__

fn __execute__(ref self: TContractState, calls: Array<Call>) -> Array<Span<felt252>>

Store

Trait for types that can be used as a value in Starknet storage variables.

Fully qualified path: core::starknet::storage_access::Store

pub trait Store<T>

Trait functions

read

Reads a value from storage from domain address_domain and base address base.

Fully qualified path: core::starknet::storage_access::Store::read

fn read(address_domain: u32, base: StorageBaseAddress) -> SyscallResult<T>

write

Writes a value to storage to domain address_domain and base address base.

Fully qualified path: core::starknet::storage_access::Store::write

fn write(address_domain: u32, base: StorageBaseAddress, value: T) -> SyscallResult<()>

read_at_offset

Reads a value from storage from domain address_domain and base address base at offset offset.

Fully qualified path: core::starknet::storage_access::Store::read_at_offset

fn read_at_offset(address_domain: u32, base: StorageBaseAddress, offset: u8) -> SyscallResult<T>

write_at_offset

Writes a value to storage to domain address_domain and base address base at offset offset.

Fully qualified path: core::starknet::storage_access::Store::write_at_offset

fn write_at_offset(
    address_domain: u32, base: StorageBaseAddress, offset: u8, value: T,
) -> SyscallResult<()>

size

Fully qualified path: core::starknet::storage_access::Store::size

fn size() -> u8

StorePacking

Trait for easier implementation of Store used for packing and unpacking values into values that already implement Store, and having Store implemented using this conversion.

Fully qualified path: core::starknet::storage_access::StorePacking

pub trait StorePacking<T, PackedT>

Trait functions

pack

Packs a value of type T into a value of type PackedT.

Fully qualified path: core::starknet::storage_access::StorePacking::pack

fn pack(value: T) -> PackedT

unpack

Unpacks a value of type PackedT into a value of type T.

Fully qualified path: core::starknet::storage_access::StorePacking::unpack

fn unpack(value: PackedT) -> T

Secp256Trait

Fully qualified path: core::starknet::secp256_trait::Secp256Trait

pub trait Secp256Trait<Secp256Point>

Trait functions

get_curve_size

Fully qualified path: core::starknet::secp256_trait::Secp256Trait::get_curve_size

fn get_curve_size() -> u256

get_generator_point

Fully qualified path: core::starknet::secp256_trait::Secp256Trait::get_generator_point

fn get_generator_point() -> Secp256Point

secp256_ec_new_syscall

Fully qualified path: core::starknet::secp256_trait::Secp256Trait::secp256_ec_new_syscall

fn secp256_ec_new_syscall(x: u256, y: u256) -> SyscallResult<Option<Secp256Point>>

secp256_ec_get_point_from_x_syscall

Fully qualified path: core::starknet::secp256_trait::Secp256Trait::secp256_ec_get_point_from_x_syscall

fn secp256_ec_get_point_from_x_syscall(
    x: u256, y_parity: bool,
) -> SyscallResult<Option<Secp256Point>>

Secp256PointTrait

Fully qualified path: core::starknet::secp256_trait::Secp256PointTrait

pub trait Secp256PointTrait<Secp256Point>

Trait functions

get_coordinates

Fully qualified path: core::starknet::secp256_trait::Secp256PointTrait::get_coordinates

fn get_coordinates(self: Secp256Point) -> SyscallResult<(u256, u256)>

add

Fully qualified path: core::starknet::secp256_trait::Secp256PointTrait::add

fn add(self: Secp256Point, other: Secp256Point) -> SyscallResult<Secp256Point>

mul

Fully qualified path: core::starknet::secp256_trait::Secp256PointTrait::mul

fn mul(self: Secp256Point, scalar: u256) -> SyscallResult<Secp256Point>

Event

Fully qualified path: core::starknet::event::Event

pub trait Event<T>

Trait functions

append_keys_and_data

Fully qualified path: core::starknet::event::Event::append_keys_and_data

fn append_keys_and_data(self: @T, ref keys: Array<felt252>, ref data: Array<felt252>)

deserialize

Fully qualified path: core::starknet::event::Event::deserialize

fn deserialize(ref keys: Span<felt252>, ref data: Span<felt252>) -> Option<T>

EventEmitter

Fully qualified path: core::starknet::event::EventEmitter

pub trait EventEmitter<T, TEvent>

Trait functions

emit

Fully qualified path: core::starknet::event::EventEmitter::emit

fn emit<S, +Into<S, TEvent>>(ref self: T, event: S)

AccountContract

A trait for account contracts that support class declarations (only __validate__ and __execute__ are mandatory for an account). This trait assumes that the calldata for invoke transactions is Array<Call>. This is the network standard following SNIP6. It is not enforced by StarkNet, but deviating from the standard interface may lead to incompatibility with standard tooling.

Fully qualified path: core::starknet::account::AccountContract

pub trait AccountContract<TContractState>

Trait functions

validate_declare

An entry point that is called to check if the account is willing to pay for the declaration of the class with the given hash. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the declaration.

Fully qualified path: core::starknet::account::AccountContract::__validate_declare__

fn __validate_declare__(self: @TContractState, class_hash: felt252) -> felt252

validate

An entry point that is called to check if the account is willing to pay for executing a given set of calls. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the execution, in which case __execute__ will be called on the same set of calls.

Fully qualified path: core::starknet::account::AccountContract::__validate__

fn __validate__(ref self: TContractState, calls: Array<Call>) -> felt252

execute

An entry point that is called to execute a given set of calls. This entry point should block the deprecated v0 invoke transactions as they do not go through the __validate__ entry point.

Fully qualified path: core::starknet::account::AccountContract::__execute__

fn __execute__(ref self: TContractState, calls: Array<Call>) -> Array<Span<felt252>>

AccountContractDispatcherTrait

Fully qualified path: core::starknet::account::AccountContractDispatcherTrait

pub trait AccountContractDispatcherTrait<T>

Trait functions

validate_declare

An entry point that is called to check if the account is willing to pay for the declaration of the class with the given hash. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the declaration.

Fully qualified path: core::starknet::account::AccountContractDispatcherTrait::__validate_declare__

fn __validate_declare__(self: T, class_hash: felt252) -> felt252

validate

An entry point that is called to check if the account is willing to pay for executing a given set of calls. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the execution, in which case __execute__ will be called on the same set of calls.

Fully qualified path: core::starknet::account::AccountContractDispatcherTrait::__validate__

fn __validate__(self: T, calls: Array<Call>) -> felt252

execute

An entry point that is called to execute a given set of calls. This entry point should block the deprecated v0 invoke transactions as they do not go through the __validate__ entry point.

Fully qualified path: core::starknet::account::AccountContractDispatcherTrait::__execute__

fn __execute__(self: T, calls: Array<Call>) -> Array<Span<felt252>>

AccountContractSafeDispatcherTrait

Fully qualified path: core::starknet::account::AccountContractSafeDispatcherTrait

pub trait AccountContractSafeDispatcherTrait<T>

Trait functions

validate_declare

An entry point that is called to check if the account is willing to pay for the declaration of the class with the given hash. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the declaration.

Fully qualified path: core::starknet::account::AccountContractSafeDispatcherTrait::__validate_declare__

fn __validate_declare__(self: T, class_hash: felt252) -> starknet::SyscallResult<felt252>

validate

An entry point that is called to check if the account is willing to pay for executing a given set of calls. The entry point should return core::starknet::VALIDATED if the account is willing to pay for the execution, in which case __execute__ will be called on the same set of calls.

Fully qualified path: core::starknet::account::AccountContractSafeDispatcherTrait::__validate__

fn __validate__(self: T, calls: Array<Call>) -> starknet::SyscallResult<felt252>

execute

An entry point that is called to execute a given set of calls. This entry point should block the deprecated v0 invoke transactions as they do not go through the __validate__ entry point.

Fully qualified path: core::starknet::account::AccountContractSafeDispatcherTrait::__execute__

fn __execute__(self: T, calls: Array<Call>) -> starknet::SyscallResult<Array<Span<felt252>>>

StorageAsPointer

Trait for converting a storage member to a StoragePointer0Offset.

Fully qualified path: core::starknet::storage::StorageAsPointer

pub trait StorageAsPointer<TMemberState>

Trait functions

as_ptr

Fully qualified path: core::starknet::storage::StorageAsPointer::as_ptr

fn as_ptr(self: @TMemberState) -> StoragePointer0Offset<Self::Value>

Trait types

Value

Fully qualified path: core::starknet::storage::StorageAsPointer::Value

type Value;

StoragePointerReadAccess

Trait for accessing the values in storage using a StoragePointer.

Fully qualified path: core::starknet::storage::StoragePointerReadAccess

pub trait StoragePointerReadAccess<T>

Trait functions

read

Fully qualified path: core::starknet::storage::StoragePointerReadAccess::read

fn read(self: @T) -> Self::Value

Trait types

Value

Fully qualified path: core::starknet::storage::StoragePointerReadAccess::Value

type Value;

StoragePointerWriteAccess

Trait for writing values to storage using a StoragePointer.

Fully qualified path: core::starknet::storage::StoragePointerWriteAccess

pub trait StoragePointerWriteAccess<T>

Trait functions

write

Fully qualified path: core::starknet::storage::StoragePointerWriteAccess::write

fn write(self: T, value: Self::Value)

Trait types

Value

Fully qualified path: core::starknet::storage::StoragePointerWriteAccess::Value

type Value;

StorageAsPath

Trait for creating a new StoragePath from a storage member.

Fully qualified path: core::starknet::storage::StorageAsPath

pub trait StorageAsPath<TMemberState>

Trait functions

as_path

Fully qualified path: core::starknet::storage::StorageAsPath::as_path

fn as_path(self: @TMemberState) -> StoragePath<Self::Value>

Trait types

Value

Fully qualified path: core::starknet::storage::StorageAsPath::Value

type Value;

PendingStoragePathTrait

A trait for creating a PendingStoragePath from a hash state and a key.

Fully qualified path: core::starknet::storage::PendingStoragePathTrait

pub trait PendingStoragePathTrait<T, S>

Trait functions

new

Fully qualified path: core::starknet::storage::PendingStoragePathTrait::new

fn new(storage_path: @StoragePath<S>, pending_key: felt252) -> PendingStoragePath<T>

VecTrait

Trait for the interface of a storage vec.

Fully qualified path: core::starknet::storage::vec::VecTrait

pub trait VecTrait<T>

Trait functions

get

Fully qualified path: core::starknet::storage::vec::VecTrait::get

fn get(self: T, index: u64) -> Option<StoragePath<Self::ElementType>>

at

Fully qualified path: core::starknet::storage::vec::VecTrait::at

fn at(self: T, index: u64) -> StoragePath<Self::ElementType>

len

Fully qualified path: core::starknet::storage::vec::VecTrait::len

fn len(self: T) -> u64

Trait types

ElementType

Fully qualified path: core::starknet::storage::vec::VecTrait::ElementType

type ElementType;

MutableVecTrait

Trait for the interface of a mutable storage vec.

Fully qualified path: core::starknet::storage::vec::MutableVecTrait

pub trait MutableVecTrait<T>

Trait functions

get

Fully qualified path: core::starknet::storage::vec::MutableVecTrait::get

fn get(self: T, index: u64) -> Option<StoragePath<Mutable<Self::ElementType>>>

at

Fully qualified path: core::starknet::storage::vec::MutableVecTrait::at

fn at(self: T, index: u64) -> StoragePath<Mutable<Self::ElementType>>

len

Fully qualified path: core::starknet::storage::vec::MutableVecTrait::len

fn len(self: T) -> u64

append

Fully qualified path: core::starknet::storage::vec::MutableVecTrait::append

fn append(self: T) -> StoragePath<Mutable<Self::ElementType>>

Trait types

ElementType

Fully qualified path: core::starknet::storage::vec::MutableVecTrait::ElementType

type ElementType;

StorageNode

A trait that given a storage path of a struct, generates the storage node of this struct. The storage node is a struct that is used to structure the storage of a struct, while taking into account this structure when computing the address of the struct members in the storage. The trigger for creating a storage node is the #[starknet::storage_node] attribute. Storage nodes are used in order to structure the storage of a struct, while not enforcing the struct to be sequential in the storage. This is useful for structs that contains phantom types such as Map and Vec. As a result, structs attributed with #[starknet::storage_node] are also considered to be phantom types, although not explicitly annotated as such. Structs which do not contain phantom types, can still be declared a storage node, and it will make them a phantom type. However, it may be preferable to simply make this struct storable (i.e. #[derive(Store)]') instead. This will still allow accessing individual members of the struct (see SubPointers`), but will not make the struct a phantom type. For example, given the following struct:

[starknet::storage_node]
struct MyStruct {
   a: felt252,
   b: Map<felt252, felt52>,
}

The following storage node struct and impl will be generated:

struct MyStructStorageNode {
    a: PendingStoragePath<felt252>,
    b: PendingStoragePath<Map<felt252, felt52>>,
}

impl MyStructStorageNodeImpl of StorageNode<MyStruct> {
   fn storage_node(self: StoragePath<MyStruct>) -> MyStructStorageNode {
        MyStructStorageNode {
           a: PendingStoragePathTrait::new(@self, selector!("a")),
           b: PendingStoragePathTrait::new(@self, selector!("b")),
        }
   }
}

For a type T that implement StorageNode (e.g. MyStruct in the example above), Deref<StoragePath<T>> is implemented as simply calling storage_node, and thus exposing the members of the storage node (a and b in the example above). For example, given the following storage:

[storage]
struct Storage {
    my_struct: MyStruct,
    a: felt52,
}

We can access the members of the storage node as follows:

fn use_storage(self: @ContractState) { let a_value = self.a.read(); let inner_a_value = self.my_struct.a.read(); let b_value = self.my_struct.b.entry(42).read(); }


If a member is annotated with `#[flat]`, the storage node will be flattened, and the
member name (i.e. `my_struct`) will not affect the address of the storage object.
In the storage example above, it will look like:

#storage struct Storage { #flat my_struct: MyStruct, a: felt52, } In this case, the storage node will be flattened, and both self.a and self.my_struct.a will point to the same address. This behavior is rarely intended, and thus #[flat] should be used with caution. Notice that the members of the storage node are PendingStoragePath instances, which are used to lazily get the updated storage path of the struct members, in this way only members that are accessed are actually evaluated.

Fully qualified path: core::starknet::storage::storage_node::StorageNode

pub trait StorageNode<T>

Trait functions

storage_node

Fully qualified path: core::starknet::storage::storage_node::StorageNode::storage_node

fn storage_node(self: StoragePath<T>) -> Self::NodeType

Trait types

NodeType

Fully qualified path: core::starknet::storage::storage_node::StorageNode::NodeType

type NodeType;

StorageNodeMut

A mutable version of StorageNode, works the same way, but on Mutable<T>.

Fully qualified path: core::starknet::storage::storage_node::StorageNodeMut

pub trait StorageNodeMut<T>

Trait functions

storage_node_mut

Fully qualified path: core::starknet::storage::storage_node::StorageNodeMut::storage_node_mut

fn storage_node_mut(self: StoragePath<Mutable<T>>) -> Self::NodeType

Trait types

NodeType

Fully qualified path: core::starknet::storage::storage_node::StorageNodeMut::NodeType

type NodeType;

SubPointers

Similar to storage node, but for structs which are stored sequentially in the storage. In contrast to storage node, the fields of the struct are just offsetted from the base address of the struct.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointers

pub trait SubPointers<T>

Trait functions

sub_pointers

Creates a sub pointers struct for the given storage pointer to a struct T.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointers::sub_pointers

fn sub_pointers(self: StoragePointer<T>) -> Self::SubPointersType

Trait types

SubPointersType

The type of the storage pointers, generated for the struct T.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointers::SubPointersType

type SubPointersType;

SubPointersMut

A mutable version of SubPointers, works the same way, but on Mutable<T>.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersMut

pub trait SubPointersMut<T>

Trait functions

sub_pointers_mut

Creates a sub pointers struct for the given storage pointer to a struct T.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersMut::sub_pointers_mut

fn sub_pointers_mut(self: StoragePointer<Mutable<T>>) -> Self::SubPointersType

Trait types

SubPointersType

The type of the storage pointers, generated for the struct T.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersMut::SubPointersType

type SubPointersType;

SubPointersForward

A trait for implementing SubPointers for types which are not a StoragePointer, such as StorageBase and StoragePath.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersForward

pub trait SubPointersForward<T>

Trait functions

sub_pointers

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersForward::sub_pointers

fn sub_pointers(self: T) -> Self::SubPointersType

Trait types

SubPointersType

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersForward::SubPointersType

type SubPointersType;

SubPointersMutForward

A trait for implementing SubPointersMut for types which are not a StoragePointer, such as StorageBase and StoragePath.

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersMutForward

pub trait SubPointersMutForward<T>

Trait functions

sub_pointers_mut

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersMutForward::sub_pointers_mut

fn sub_pointers_mut(self: T) -> Self::SubPointersType

Trait types

SubPointersType

Fully qualified path: core::starknet::storage::sub_pointers::SubPointersMutForward::SubPointersType

type SubPointersType;

StorageTrait

A trait for creating the struct containing the StorageBase or FlattenedStorage of all the members of a contract state.

Fully qualified path: core::starknet::storage::storage_base::StorageTrait

pub trait StorageTrait<T>

Trait functions

storage

Creates a struct containing the StorageBase or FlattenedStorage of all the members of a contract state. Should be called from the deref method of the contract state.

Fully qualified path: core::starknet::storage::storage_base::StorageTrait::storage

fn storage(self: FlattenedStorage<T>) -> Self::BaseType

Trait types

BaseType

The type of the struct containing the StorageBase or FlattenedStorage of all the members of a the type T.

Fully qualified path: core::starknet::storage::storage_base::StorageTrait::BaseType

type BaseType;

StorageTraitMut

A trait for creating the struct containing the mutable StorageBase or FlattenedStorage of all the members of a contract state.

Fully qualified path: core::starknet::storage::storage_base::StorageTraitMut

pub trait StorageTraitMut<T>

Trait functions

storage_mut

Creates a struct containing a mutable version of the the StorageBase or FlattenedStorage of all the members of a contract state. Should be called from the deref method of the contract state.

Fully qualified path: core::starknet::storage::storage_base::StorageTraitMut::storage_mut

fn storage_mut(self: FlattenedStorage<Mutable<T>>) -> Self::BaseType

Trait types

BaseType

The type of the struct containing the mutable StorageBase or FlattenedStorage of all the members of a the type T.

Fully qualified path: core::starknet::storage::storage_base::StorageTraitMut::BaseType

type BaseType;

StorageMapReadAccess

Trait for reading a contract/component storage member in a specific key place.

Fully qualified path: core::starknet::storage::map::StorageMapReadAccess

pub trait StorageMapReadAccess<TMemberState>

Trait functions

read

Fully qualified path: core::starknet::storage::map::StorageMapReadAccess::read

fn read(self: TMemberState, key: Self::Key) -> Self::Value

Trait types

Key

Fully qualified path: core::starknet::storage::map::StorageMapReadAccess::Key

type Key;

Value

Fully qualified path: core::starknet::storage::map::StorageMapReadAccess::Value

type Value;

StorageMapWriteAccess

Trait for writing contract/component storage member in a specific key place.

Fully qualified path: core::starknet::storage::map::StorageMapWriteAccess

pub trait StorageMapWriteAccess<TMemberState>

Trait functions

write

Fully qualified path: core::starknet::storage::map::StorageMapWriteAccess::write

fn write(self: TMemberState, key: Self::Key, value: Self::Value)

Trait types

Key

Fully qualified path: core::starknet::storage::map::StorageMapWriteAccess::Key

type Key;

Value

Fully qualified path: core::starknet::storage::map::StorageMapWriteAccess::Value

type Value;

StoragePathEntry

Trait for updating the hash state with a value, using an entry method.

Fully qualified path: core::starknet::storage::map::StoragePathEntry

pub trait StoragePathEntry<C>

Trait functions

entry

Fully qualified path: core::starknet::storage::map::StoragePathEntry::entry

fn entry(self: C, key: Self::Key) -> StoragePath<Self::Value>

Trait types

Key

Fully qualified path: core::starknet::storage::map::StoragePathEntry::Key

type Key;

Value

Fully qualified path: core::starknet::storage::map::StoragePathEntry::Value

type Value;

AddHelper

A helper trait for adding two BoundedInt instances.

Fully qualified path: core::internal::bounded_int::AddHelper

pub trait AddHelper<Lhs, Rhs>

Trait types

Result

Fully qualified path: core::internal::bounded_int::AddHelper::Result

type Result;

SubHelper

A helper trait for subtracting two BoundedInt instances.

Fully qualified path: core::internal::bounded_int::SubHelper

pub trait SubHelper<Lhs, Rhs>

Trait types

Result

Fully qualified path: core::internal::bounded_int::SubHelper::Result

type Result;

MulHelper

A helper trait for multiplying two BoundedInt instances.

Fully qualified path: core::internal::bounded_int::MulHelper

pub trait MulHelper<Lhs, Rhs>

Trait types

Result

Fully qualified path: core::internal::bounded_int::MulHelper::Result

type Result;

DivRemHelper

A helper trait for dividing two BoundedInt instances.

Fully qualified path: core::internal::bounded_int::DivRemHelper

pub trait DivRemHelper<Lhs, Rhs>

Trait types

DivT

Fully qualified path: core::internal::bounded_int::DivRemHelper::DivT

type DivT;

RemT

Fully qualified path: core::internal::bounded_int::DivRemHelper::RemT

type RemT;

ConstrainHelper

A helper trait for constraining a BoundedInt instance.

Fully qualified path: core::internal::bounded_int::ConstrainHelper

pub trait ConstrainHelper<T, const BOUNDARY: felt252>

Trait types

LowT

Fully qualified path: core::internal::bounded_int::ConstrainHelper::LowT

type LowT;

HighT

Fully qualified path: core::internal::bounded_int::ConstrainHelper::HighT

type HighT;

NegateHelper

A helper trait for negating a BoundedInt instance.

Fully qualified path: core::internal::bounded_int::NegateHelper

pub trait NegateHelper<T>

Trait functions

negate

Negates the given value.

Fully qualified path: core::internal::bounded_int::NegateHelper::negate

fn negate(self: T) -> Self::Result

negate_nz

Negates the given non-zero value.

Fully qualified path: core::internal::bounded_int::NegateHelper::negate_nz

fn negate_nz(self: NonZero<T>) -> NonZero<Self::Result>

Trait types

Result

The result of negating the given value.

Fully qualified path: core::internal::bounded_int::NegateHelper::Result

type Result;

Zeroable

A trait for types that have a concept of zero and can be compared to zero. This trait is useful for numeric types or any type that has an additive identity element.

Fully qualified path: core::zeroable::Zeroable

pub(crate) trait Zeroable<T>

Trait functions

zero

Returns the additive identity element of Self, 0. This method should return a value that, when added to any other value of type T, does not change that value. # Examples

assert_eq!(Zeroable::<i32>::zero(), 0);

Fully qualified path: core::zeroable::Zeroable::zero

fn zero() -> T

is_zero

Returns whether self is equal to 0, the additive identity element. # Examples

assert!(0.is_zero());
assert!(!5.is_zero());

Fully qualified path: core::zeroable::Zeroable::is_zero

fn is_zero(self: T) -> bool

is_non_zero

Returns whether self is not equal to 0, the additive identity element. This method is the logical inverse of is_zero(). # Examples

assert!(5.is_non_zero());
assert!(!0.is_non_zero());

Fully qualified path: core::zeroable::Zeroable::is_non_zero

fn is_non_zero(self: T) -> bool

Bytes31Trait

Fully qualified path: core::bytes_31::Bytes31Trait

pub trait Bytes31Trait

Trait functions

at

Gets the byte at the given index (LSB's index is 0), assuming that index < BYTES_IN_BYTES31. If the assumption is not met, the behavior is undefined.

Fully qualified path: core::bytes_31::Bytes31Trait::at

fn at(self: @bytes31, index: usize) -> u8

ByteArrayTrait

Fully qualified path: core::byte_array::ByteArrayTrait

pub trait ByteArrayTrait

Trait functions

append_word

Appends a single word of len bytes to the end of the ByteArray. This function assumes that: 1. word could be validly converted to a bytes31 which has no more than len bytes of data. 2. len <= BYTES_IN_BYTES31. If these assumptions are not met, it can corrupt the ByteArray. Thus, this should be a private function. We could add masking/assertions but it would be more expensive. # Examples

let mut ba = "";
ba.append_word('word', 4);
assert!(ba == "word");

Fully qualified path: core::byte_array::ByteArrayTrait::append_word

fn append_word(ref self: ByteArray, word: felt252, len: usize)

append

Appends a ByteArray to the end of another ByteArray. # Examples

let mut ba: ByteArray = "1";
ba.append(@"2");
assert!(ba == "12");

Fully qualified path: core::byte_array::ByteArrayTrait::append

fn append(ref self: ByteArray, other: @ByteArray)

concat

Concatenates two ByteArray and returns the result. The content of left is cloned in a new memory segment. # Examples

let ba = "1";
let other_ba = "2";
let result = ByteArrayTrait::concat(@ba, @other_ba);
assert!(result == "12");

Fully qualified path: core::byte_array::ByteArrayTrait::concat

fn concat(left: @ByteArray, right: @ByteArray) -> ByteArray

append_byte

Appends a single byte to the end of the ByteArray. # Examples

let mut ba = "";
ba.append_byte(0);
assert!(ba == "0");

Fully qualified path: core::byte_array::ByteArrayTrait::append_byte

fn append_byte(ref self: ByteArray, byte: u8)

len

Returns the length of the ByteArray. # Examples

let ba: ByteArray = "byte array";
let len = ba.len();
assert!(len == 10);

Fully qualified path: core::byte_array::ByteArrayTrait::len

fn len(self: @ByteArray) -> usize

at

Returns an option of the byte at the given index of self or Option::None if the index is out of bounds. # Examples

let ba: ByteArray = "byte array";
let byte = ba.at(0).unwrap();
assert!(byte == 98);

Fully qualified path: core::byte_array::ByteArrayTrait::at

fn at(self: @ByteArray, index: usize) -> Option<u8>

rev

Returns a ByteArray with the reverse order of self. # Examples

let ba: ByteArray = "123";
let rev_ba = ba.rev();
assert!(rev_ba == "321");

Fully qualified path: core::byte_array::ByteArrayTrait::rev

fn rev(self: @ByteArray) -> ByteArray

append_word_rev

Appends the reverse of the given word to the end of self. This function assumes that: 1. len < 31 2. word is validly convertible to bytes31 of length len. # Examples

let mut ba: ByteArray = "";
ba.append_word_rev('123', 3);
assert!(ba == "321");

Fully qualified path: core::byte_array::ByteArrayTrait::append_word_rev

fn append_word_rev(ref self: ByteArray, word: felt252, len: usize)

append_word_fits_into_pending

Appends a single word of len bytes to the end of the ByteArray, assuming there is enough space in the pending word (self.pending_word_len + len < BYTES_IN_BYTES31). word is of type felt252 but actually represents a bytes31. It is represented as a felt252 to improve performance of building the ByteArray.

Fully qualified path: core::byte_array::ByteArrayTrait::append_word_fits_into_pending

fn append_word_fits_into_pending(ref self: ByteArray, word: felt252, len: usize)

append_split_index_lt_16

Appends a single word to the end of self, given that 0 < split_index < 16. split_index is the number of bytes left in self.pending_word after this function. This is the index of the split (LSB's index is 0). Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayTrait::append_split_index_lt_16

fn append_split_index_lt_16(ref self: ByteArray, word: felt252, split_index: usize)

append_split_index_16

Appends a single word to the end of self, given that the index of splitting word is exactly 16. split_index is the number of bytes left in self.pending_word after this function. This is the index of the split (LSB's index is 0). Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayTrait::append_split_index_16

fn append_split_index_16(ref self: ByteArray, word: felt252)

append_split_index_gt_16

Appends a single word to the end of self, given that the index of splitting word is > 16. split_index is the number of bytes left in self.pending_word after this function. This is the index of the split (LSB's index is 0). Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayTrait::append_split_index_gt_16

fn append_split_index_gt_16(ref self: ByteArray, word: felt252, split_index: usize)

append_split

A helper function to append a remainder to self, by: 1. completing self.pending_word to a full word using complete_full_word, assuming it's validly convertible to a bytes31 of length exactly BYTES_IN_BYTES31 - self.pending_word_len. 2. Setting self.pending_word to new_pending. Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayTrait::append_split

fn append_split(ref self: ByteArray, complete_full_word: felt252, new_pending: felt252)

StringLiteral

Fully qualified path: core::string::StringLiteral

pub trait StringLiteral<T>;

AppendFormattedToByteArray

A trait for appending the ASCII representation of a number to an existing ByteArray.

Fully qualified path: core::to_byte_array::AppendFormattedToByteArray

pub trait AppendFormattedToByteArray<T>

Trait functions

append_formatted_to_byte_array

Appends the ASCII representation of the value to the provided ByteArray. # Examples

use core::to_byte_array::AppendFormattedToByteArray;

let mut buffer = "Count: ";
let num: u32 = 42;
num.append_formatted_to_byte_array(ref buffer, 10);
assert!(buffer == "Count: 42");

Fully qualified path: core::to_byte_array::AppendFormattedToByteArray::append_formatted_to_byte_array

fn append_formatted_to_byte_array(self: @T, ref byte_array: ByteArray, base: NonZero<T>)

FormatAsByteArray

A trait for formatting values into their ASCII string representation in a ByteArray.

Fully qualified path: core::to_byte_array::FormatAsByteArray

pub trait FormatAsByteArray<T>

Trait functions

format_as_byte_array

Returns a new ByteArray containing the ASCII representation of the value. # Examples

use core::to_byte_array::FormatAsByteArray;

let num: u32 = 42;
let formatted = num.format_as_byte_array(16);
assert!(formatted, "2a");

Fully qualified path: core::to_byte_array::FormatAsByteArray::format_as_byte_array

fn format_as_byte_array(self: @T, base: NonZero<T>) -> ByteArray

TypeEqual

A trait that can be used to disable implementations based on the types of the generic args. Assumes that TypeEqualImpl is the only implementation of this trait.

Fully qualified path: core::metaprogramming::TypeEqual

pub trait TypeEqual<S, T>

IsTuple

Marker trait for types that are tuples. Currently supports tuples of size 0 to 10.

Fully qualified path: core::metaprogramming::IsTuple

pub(crate) trait IsTuple<T>;

TupleSplit

A trait for splitting a tuple into head element and a tail tuple, as well as reconstructing from them.

Fully qualified path: core::metaprogramming::TupleSplit

pub(crate) trait TupleSplit<T>

Trait functions

split_head

Splits the tuple into the head and the rest.

Fully qualified path: core::metaprogramming::TupleSplit::split_head

fn split_head(self: T) -> (Self::Head, Self::Rest) nopanic

reconstruct

Reconstructs the tuple from the head and the rest.

Fully qualified path: core::metaprogramming::TupleSplit::reconstruct

fn reconstruct(head: Self::Head, rest: Self::Rest) -> T nopanic

Trait types

The type of the first element of the tuple.

Fully qualified path: core::metaprogramming::TupleSplit::Head

type Head;

Rest

The type of the rest of the tuple.

Fully qualified path: core::metaprogramming::TupleSplit::Rest

type Rest;

TupleExtendFront

A trait for extending a tuple from the front.

Fully qualified path: core::metaprogramming::TupleExtendFront

pub(crate) trait TupleExtendFront<T, E>

Trait functions

extend_front

Creates a new tuple from the value tuple with element in front of it.

Fully qualified path: core::metaprogramming::TupleExtendFront::extend_front

fn extend_front(value: T, element: E) -> Self::Result nopanic

Trait types

Result

The type of the resulting tuple.

Fully qualified path: core::metaprogramming::TupleExtendFront::Result

type Result;

TupleSnapForward

A trait for forwarding a wrapping snapshot from a tuple style struct into a tuple style struct of the snapshots.

Fully qualified path: core::metaprogramming::TupleSnapForward

pub(crate) trait TupleSnapForward<T>

Trait functions

snap_forward

Fully qualified path: core::metaprogramming::TupleSnapForward::snap_forward

fn snap_forward(self: @T) -> Self::SnapForward nopanic

Trait types

SnapForward

Fully qualified path: core::metaprogramming::TupleSnapForward::SnapForward

type SnapForward;

SnapRemove

A trait for removing a wrapping snapshot from the types in tuple style struct.

Fully qualified path: core::metaprogramming::SnapRemove

pub(crate) trait SnapRemove<T>

Trait types

Result

Fully qualified path: core::metaprogramming::SnapRemove::Result

type Result;

Iterator

An iterator over a collection of values.

Fully qualified path: core::iter::traits::iterator::Iterator

pub trait Iterator<T>

Trait functions

next

Advance the iterator and return the next value.

Fully qualified path: core::iter::traits::iterator::Iterator::next

fn next(ref self: T) -> Option<Self::Item>

Trait types

Item

The type of the elements being iterated over.

Fully qualified path: core::iter::traits::iterator::Iterator::Item

type Item;

IntoIterator

Turn a collection of values into an iterator.

Fully qualified path: core::iter::traits::iterator::IntoIterator

pub trait IntoIterator<T>

Trait functions

into_iter

Creates an iterator from a collection.

Fully qualified path: core::iter::traits::iterator::IntoIterator::into_iter

fn into_iter(self: T) -> Self::IntoIter

Trait types

IntoIter

The iterator type that will be created.

Fully qualified path: core::iter::traits::iterator::IntoIterator::IntoIter

type IntoIter;

Impls

BoolSerde

Fully qualified path: core::BoolSerde

impl BoolSerde of Serde<bool>

Impl functions

serialize

Fully qualified path: core::BoolSerde::serialize

fn serialize(self: @bool, ref output: Array<felt252>)

deserialize

Fully qualified path: core::BoolSerde::deserialize

fn deserialize(ref serialized: Span<felt252>) -> Option<bool>

BoolBitAnd

Fully qualified path: core::BoolBitAnd

impl BoolBitAnd of BitAnd<bool>

Impl functions

bitand

Fully qualified path: core::BoolBitAnd::bitand

fn bitand(lhs: bool, rhs: bool) -> bool

BoolBitOr

Fully qualified path: core::BoolBitOr

impl BoolBitOr of BitOr<bool>

Impl functions

bitor

Fully qualified path: core::BoolBitOr::bitor

fn bitor(lhs: bool, rhs: bool) -> bool

BoolNot

Fully qualified path: core::BoolNot

impl BoolNot of Not<bool>

Impl functions

not

Fully qualified path: core::BoolNot::not

fn not(a: bool) -> bool implicits() nopanic

BoolBitXor

Fully qualified path: core::BoolBitXor

impl BoolBitXor of BitXor<bool>

Impl functions

bitxor

Fully qualified path: core::BoolBitXor::bitxor

fn bitxor(lhs: bool, rhs: bool) -> bool

BoolPartialEq

Fully qualified path: core::BoolPartialEq

impl BoolPartialEq of PartialEq<bool>

Impl functions

eq

Fully qualified path: core::BoolPartialEq::eq

fn eq(lhs: @bool, rhs: @bool) -> bool

ne

Fully qualified path: core::BoolPartialEq::ne

fn ne(lhs: @bool, rhs: @bool) -> bool

BoolFelt252DictValue

Default values for felt252_dict values.

Fully qualified path: core::BoolFelt252DictValue

impl BoolFelt252DictValue of Felt252DictValue<bool>

Impl functions

zero_default

Fully qualified path: core::BoolFelt252DictValue::zero_default

fn zero_default() -> bool nopanic

BoolIntoFelt252

Fully qualified path: core::BoolIntoFelt252

impl BoolIntoFelt252 of Into<bool, felt252>

Impl functions

into

Fully qualified path: core::BoolIntoFelt252::into

fn into(self: bool) -> felt252 implicits() nopanic

Felt252Serde

Fully qualified path: core::Felt252Serde

impl Felt252Serde of Serde<felt252>

Impl functions

serialize

Fully qualified path: core::Felt252Serde::serialize

fn serialize(self: @felt252, ref output: Array<felt252>)

deserialize

Fully qualified path: core::Felt252Serde::deserialize

fn deserialize(ref serialized: Span<felt252>) -> Option<felt252>

Felt252Add

Fully qualified path: core::Felt252Add

impl Felt252Add of Add<felt252>

Impl functions

add

Fully qualified path: core::Felt252Add::add

fn add(lhs: felt252, rhs: felt252) -> felt252

Felt252AddEq

Fully qualified path: core::Felt252AddEq

impl Felt252AddEq of AddEq<felt252>

Impl functions

add_eq

Fully qualified path: core::Felt252AddEq::add_eq

fn add_eq(ref self: felt252, other: felt252)

Felt252Sub

Fully qualified path: core::Felt252Sub

impl Felt252Sub of Sub<felt252>

Impl functions

sub

Fully qualified path: core::Felt252Sub::sub

fn sub(lhs: felt252, rhs: felt252) -> felt252

Felt252SubEq

Fully qualified path: core::Felt252SubEq

impl Felt252SubEq of SubEq<felt252>

Impl functions

sub_eq

Fully qualified path: core::Felt252SubEq::sub_eq

fn sub_eq(ref self: felt252, other: felt252)

Felt252Mul

Fully qualified path: core::Felt252Mul

impl Felt252Mul of Mul<felt252>

Impl functions

mul

Fully qualified path: core::Felt252Mul::mul

fn mul(lhs: felt252, rhs: felt252) -> felt252

Felt252MulEq

Fully qualified path: core::Felt252MulEq

impl Felt252MulEq of MulEq<felt252>

Impl functions

mul_eq

Fully qualified path: core::Felt252MulEq::mul_eq

fn mul_eq(ref self: felt252, other: felt252)

Felt252Neg

Fully qualified path: core::Felt252Neg

impl Felt252Neg of Neg<felt252>

Impl functions

neg

Fully qualified path: core::Felt252Neg::neg

fn neg(a: felt252) -> felt252

Felt252PartialEq

Fully qualified path: core::Felt252PartialEq

impl Felt252PartialEq of PartialEq<felt252>

Impl functions

eq

Fully qualified path: core::Felt252PartialEq::eq

fn eq(lhs: @felt252, rhs: @felt252) -> bool

Felt252TryIntoNonZero

Fully qualified path: core::Felt252TryIntoNonZero

impl Felt252TryIntoNonZero of TryInto<felt252, NonZero<felt252>>

Impl functions

try_into

Fully qualified path: core::Felt252TryIntoNonZero::try_into

fn try_into(self: felt252) -> Option<NonZero<felt252>>

Felt252Default

Fully qualified path: core::Felt252Default

impl Felt252Default of Default<felt252>

Impl functions

default

Fully qualified path: core::Felt252Default::default

fn default() -> felt252 nopanic

Felt252Felt252DictValue

Fully qualified path: core::Felt252Felt252DictValue

impl Felt252Felt252DictValue of Felt252DictValue<felt252>

Impl functions

zero_default

Fully qualified path: core::Felt252Felt252DictValue::zero_default

fn zero_default() -> felt252 nopanic

boolCopy

Fully qualified path: core::boolCopy

impl boolCopy of core::traits::Copy<bool>;

boolDrop

Fully qualified path: core::boolDrop

impl boolDrop of core::traits::Drop<bool>;

boolDefault

Fully qualified path: core::boolDefault

impl boolDefault of core::traits::Default<bool>

Impl functions

default

Fully qualified path: core::boolDefault::default

fn default() -> bool

felt252Copy

Fully qualified path: core::felt252Copy

impl felt252Copy of core::traits::Copy<felt252>;

felt252Drop

Fully qualified path: core::felt252Drop

impl felt252Drop of core::traits::Drop<felt252>;

CircuitElementDrop

Fully qualified path: core::circuit::CircuitElementDrop

pub impl CircuitElementDrop<T> of Drop<CircuitElement<T>>;

CircuitElementCopy

Fully qualified path: core::circuit::CircuitElementCopy

pub impl CircuitElementCopy<T> of Copy<CircuitElement<T>>;

DestructFailureGuarantee

Fully qualified path: core::circuit::DestructFailureGuarantee

pub impl DestructFailureGuarantee of Destruct<CircuitFailureGuarantee>

Impl functions

destruct

Fully qualified path: core::circuit::DestructFailureGuarantee::destruct

fn destruct(self: CircuitFailureGuarantee) nopanic

Felt252Zero

Fully qualified path: core::felt_252::Felt252Zero

pub(crate) impl Felt252Zero of crate::num::traits::Zero<felt252>

Impl functions

zero

Fully qualified path: core::felt_252::Felt252Zero::zero

fn zero() -> felt252

is_zero

Fully qualified path: core::felt_252::Felt252Zero::is_zero

fn is_zero(self: @felt252) -> bool

is_non_zero

Fully qualified path: core::felt_252::Felt252Zero::is_non_zero

fn is_non_zero(self: @felt252) -> bool

Felt252One

Fully qualified path: core::felt_252::Felt252One

pub(crate) impl Felt252One of crate::num::traits::One<felt252>

Impl functions

one

Fully qualified path: core::felt_252::Felt252One::one

fn one() -> felt252

is_one

Fully qualified path: core::felt_252::Felt252One::is_one

fn is_one(self: @felt252) -> bool

is_non_one

Fully qualified path: core::felt_252::Felt252One::is_non_one

fn is_non_one(self: @felt252) -> bool

SpanIndex

Fully qualified path: core::array::SpanIndex

pub impl SpanIndex<T> of IndexView<Span<T>, usize, @T>

Impl functions

index

Returns a snapshot of the element at the given index. # Examples

let span: @Span<u8> = @array![1, 2, 3].span();
let element: @u8 = span[0];
assert!(element == @1);

Fully qualified path: core::array::SpanIndex::index

fn index(self: @Span<T>, index: usize) -> @T

DestructOption

Fully qualified path: core::option::DestructOption

pub impl DestructOption<T, +Destruct<T>, -Drop<Option<T>>> of Destruct<Option<T>>

Impl functions

destruct

Fully qualified path: core::option::DestructOption::destruct

fn destruct(self: Option<T>) nopanic

EcStateImpl

Fully qualified path: core::ec::EcStateImpl

pub impl EcStateImpl of EcStateTrait

Impl functions

init

Initializes an EC computation with the zero point.

Fully qualified path: core::ec::EcStateImpl::init

fn init() -> EcState nopanic

add

Adds a point to the computation.

Fully qualified path: core::ec::EcStateImpl::add

fn add(ref self: EcState, p: NonZeroEcPoint) nopanic

sub

Subs a point to the computation.

Fully qualified path: core::ec::EcStateImpl::sub

fn sub(ref self: EcState, p: NonZeroEcPoint)

add_mul

Adds the product p * scalar to the state.

Fully qualified path: core::ec::EcStateImpl::add_mul

fn add_mul(ref self: EcState, scalar: felt252, p: NonZeroEcPoint) nopanic

finalize_nz

Finalizes the EC computation and returns the result (returns None if the result is the zero point).

Fully qualified path: core::ec::EcStateImpl::finalize_nz

fn finalize_nz(self: EcState) -> Option<NonZeroEcPoint> nopanic

finalize

Finalizes the EC computation and returns the result.

Fully qualified path: core::ec::EcStateImpl::finalize

fn finalize(self: EcState) -> EcPoint

EcPointImpl

Fully qualified path: core::ec::EcPointImpl

pub impl EcPointImpl of EcPointTrait

Impl functions

new

Creates a new EC point from its (x, y) coordinates.

Fully qualified path: core::ec::EcPointImpl::new

fn new(x: felt252, y: felt252) -> Option<EcPoint>

new_nz

Creates a new NonZero EC point from its (x, y) coordinates.

Fully qualified path: core::ec::EcPointImpl::new_nz

fn new_nz(x: felt252, y: felt252) -> Option<NonZeroEcPoint>

new_from_x

Creates a new EC point from its x coordinate.

Fully qualified path: core::ec::EcPointImpl::new_from_x

fn new_from_x(x: felt252) -> Option<EcPoint>

new_nz_from_x

Creates a new NonZero EC point from its x coordinate.

Fully qualified path: core::ec::EcPointImpl::new_nz_from_x

fn new_nz_from_x(x: felt252) -> Option<NonZeroEcPoint>

coordinates

Returns the coordinates of the EC point.

Fully qualified path: core::ec::EcPointImpl::coordinates

fn coordinates(self: NonZeroEcPoint) -> (felt252, felt252)

x

Returns the x coordinate of the EC point.

Fully qualified path: core::ec::EcPointImpl::x

fn x(self: NonZeroEcPoint) -> felt252

y

Returns the y coordinate of the EC point.

Fully qualified path: core::ec::EcPointImpl::y

fn y(self: NonZeroEcPoint) -> felt252

mul

Computes the product of an EC point p by the given scalar scalar.

Fully qualified path: core::ec::EcPointImpl::mul

fn mul(self: EcPoint, scalar: felt252) -> EcPoint

U128TryIntoNonZero

Fully qualified path: core::integer::U128TryIntoNonZero

pub(crate) impl U128TryIntoNonZero of TryInto<u128, NonZero<u128>>

Impl functions

try_into

Fully qualified path: core::integer::U128TryIntoNonZero::try_into

fn try_into(self: u128) -> Option<NonZero<u128>>

U32TryIntoNonZero

Fully qualified path: core::integer::U32TryIntoNonZero

pub(crate) impl U32TryIntoNonZero of TryInto<u32, NonZero<u32>>

Impl functions

try_into

Fully qualified path: core::integer::U32TryIntoNonZero::try_into

fn try_into(self: u32) -> Option<NonZero<u32>>

U256TryIntoNonZero

Fully qualified path: core::integer::U256TryIntoNonZero

pub(crate) impl U256TryIntoNonZero of TryInto<u256, NonZero<u256>>

Impl functions

try_into

Fully qualified path: core::integer::U256TryIntoNonZero::try_into

fn try_into(self: u256) -> Option<NonZero<u256>>

Felt252TryIntoU8

Conversions.

Fully qualified path: core::integer::Felt252TryIntoU8

pub(crate) impl Felt252TryIntoU8 of TryInto<felt252, u8>

Impl functions

try_into

Fully qualified path: core::integer::Felt252TryIntoU8::try_into

fn try_into(self: felt252) -> Option<u8>

U8IntoFelt252

Fully qualified path: core::integer::U8IntoFelt252

pub(crate) impl U8IntoFelt252 of Into<u8, felt252>

Impl functions

into

Fully qualified path: core::integer::U8IntoFelt252::into

fn into(self: u8) -> felt252

Felt252TryIntoU16

Fully qualified path: core::integer::Felt252TryIntoU16

pub(crate) impl Felt252TryIntoU16 of TryInto<felt252, u16>

Impl functions

try_into

Fully qualified path: core::integer::Felt252TryIntoU16::try_into

fn try_into(self: felt252) -> Option<u16>

U16IntoFelt252

Fully qualified path: core::integer::U16IntoFelt252

pub(crate) impl U16IntoFelt252 of Into<u16, felt252>

Impl functions

into

Fully qualified path: core::integer::U16IntoFelt252::into

fn into(self: u16) -> felt252

Felt252TryIntoU32

Fully qualified path: core::integer::Felt252TryIntoU32

pub(crate) impl Felt252TryIntoU32 of TryInto<felt252, u32>

Impl functions

try_into

Fully qualified path: core::integer::Felt252TryIntoU32::try_into

fn try_into(self: felt252) -> Option<u32>

U32IntoFelt252

Fully qualified path: core::integer::U32IntoFelt252

pub(crate) impl U32IntoFelt252 of Into<u32, felt252>

Impl functions

into

Fully qualified path: core::integer::U32IntoFelt252::into

fn into(self: u32) -> felt252

Felt252TryIntoU64

Fully qualified path: core::integer::Felt252TryIntoU64

pub(crate) impl Felt252TryIntoU64 of TryInto<felt252, u64>

Impl functions

try_into

Fully qualified path: core::integer::Felt252TryIntoU64::try_into

fn try_into(self: felt252) -> Option<u64>

U64IntoFelt252

Fully qualified path: core::integer::U64IntoFelt252

pub(crate) impl U64IntoFelt252 of Into<u64, felt252>

Impl functions

into

Fully qualified path: core::integer::U64IntoFelt252::into

fn into(self: u64) -> felt252

Felt252TryIntoU128

Fully qualified path: core::integer::Felt252TryIntoU128

pub(crate) impl Felt252TryIntoU128 of TryInto<felt252, u128>

Impl functions

try_into

Fully qualified path: core::integer::Felt252TryIntoU128::try_into

fn try_into(self: felt252) -> Option<u128>

U128IntoFelt252

Fully qualified path: core::integer::U128IntoFelt252

pub(crate) impl U128IntoFelt252 of Into<u128, felt252>

Impl functions

into

Fully qualified path: core::integer::U128IntoFelt252::into

fn into(self: u128) -> felt252

Felt252IntoU256

Fully qualified path: core::integer::Felt252IntoU256

pub(crate) impl Felt252IntoU256 of Into<felt252, u256>

Impl functions

into

Fully qualified path: core::integer::Felt252IntoU256::into

fn into(self: felt252) -> u256

U256TryIntoFelt252

Fully qualified path: core::integer::U256TryIntoFelt252

pub(crate) impl U256TryIntoFelt252 of TryInto<u256, felt252>

Impl functions

try_into

Fully qualified path: core::integer::U256TryIntoFelt252::try_into

fn try_into(self: u256) -> Option<felt252>

I8IntoFelt252

Fully qualified path: core::integer::I8IntoFelt252

pub(crate) impl I8IntoFelt252 of Into<i8, felt252>

Impl functions

into

Fully qualified path: core::integer::I8IntoFelt252::into

fn into(self: i8) -> felt252

I16IntoFelt252

Fully qualified path: core::integer::I16IntoFelt252

pub(crate) impl I16IntoFelt252 of Into<i16, felt252>

Impl functions

into

Fully qualified path: core::integer::I16IntoFelt252::into

fn into(self: i16) -> felt252

I32IntoFelt252

Fully qualified path: core::integer::I32IntoFelt252

pub(crate) impl I32IntoFelt252 of Into<i32, felt252>

Impl functions

into

Fully qualified path: core::integer::I32IntoFelt252::into

fn into(self: i32) -> felt252

I64IntoFelt252

Fully qualified path: core::integer::I64IntoFelt252

pub(crate) impl I64IntoFelt252 of Into<i64, felt252>

Impl functions

into

Fully qualified path: core::integer::I64IntoFelt252::into

fn into(self: i64) -> felt252

I128IntoFelt252

Fully qualified path: core::integer::I128IntoFelt252

pub(crate) impl I128IntoFelt252 of Into<i128, felt252>

Impl functions

into

Fully qualified path: core::integer::I128IntoFelt252::into

fn into(self: i128) -> felt252

PedersenImpl

A trait for creating a new Pedersen hash state.

Fully qualified path: core::pedersen::PedersenImpl

pub impl PedersenImpl of PedersenTrait

Impl functions

new

Creates a new Pedersen hash state with the given base value. # Examples

let mut state = PedersenTrait::new(0);
assert!(state.state == 0);

Fully qualified path: core::pedersen::PedersenImpl::new

fn new(base: felt252) -> HashState

PoseidonImpl

A trait for creating a new Poseidon hash state.

Fully qualified path: core::poseidon::PoseidonImpl

pub impl PoseidonImpl of PoseidonTrait

Impl functions

new

Creates an initial state with all fields set to 0. # Examples

use core::poseidon::PoseidonTrait;

let mut state = PoseidonTrait::new();

Fully qualified path: core::poseidon::PoseidonImpl::new

fn new() -> HashState

Felt252PrintImpl

Fully qualified path: core::debug::Felt252PrintImpl

pub(crate) impl Felt252PrintImpl of PrintTrait<felt252>

Impl functions

Fully qualified path: core::debug::Felt252PrintImpl::print

fn print(self: felt252)

BoolPrintImpl

Fully qualified path: core::debug::BoolPrintImpl

pub(crate) impl BoolPrintImpl of PrintTrait<bool>

Impl functions

Fully qualified path: core::debug::BoolPrintImpl::print

fn print(self: bool)

ContractAddressPrintImpl

Fully qualified path: core::debug::ContractAddressPrintImpl

pub(crate) impl ContractAddressPrintImpl of PrintTrait<starknet::ContractAddress>

Impl functions

Fully qualified path: core::debug::ContractAddressPrintImpl::print

fn print(self: starknet::ContractAddress)

U8PrintImpl

Fully qualified path: core::debug::U8PrintImpl

pub(crate) impl U8PrintImpl of PrintTrait<u8>

Impl functions

Fully qualified path: core::debug::U8PrintImpl::print

fn print(self: u8)

U16PrintImpl

Fully qualified path: core::debug::U16PrintImpl

pub(crate) impl U16PrintImpl of PrintTrait<u16>

Impl functions

Fully qualified path: core::debug::U16PrintImpl::print

fn print(self: u16)

U32PrintImpl

Fully qualified path: core::debug::U32PrintImpl

pub(crate) impl U32PrintImpl of PrintTrait<u32>

Impl functions

Fully qualified path: core::debug::U32PrintImpl::print

fn print(self: u32)

U64PrintImpl

Fully qualified path: core::debug::U64PrintImpl

pub(crate) impl U64PrintImpl of PrintTrait<u64>

Impl functions

Fully qualified path: core::debug::U64PrintImpl::print

fn print(self: u64)

U128PrintImpl

Fully qualified path: core::debug::U128PrintImpl

pub(crate) impl U128PrintImpl of PrintTrait<u128>

Impl functions

Fully qualified path: core::debug::U128PrintImpl::print

fn print(self: u128)

U256PrintImpl

Fully qualified path: core::debug::U256PrintImpl

pub(crate) impl U256PrintImpl of PrintTrait<u256>

Impl functions

Fully qualified path: core::debug::U256PrintImpl::print

fn print(self: u256)

I8PrintImpl

Fully qualified path: core::debug::I8PrintImpl

pub(crate) impl I8PrintImpl of PrintTrait<i8>

Impl functions

Fully qualified path: core::debug::I8PrintImpl::print

fn print(self: i8)

I16PrintImpl

Fully qualified path: core::debug::I16PrintImpl

pub(crate) impl I16PrintImpl of PrintTrait<i16>

Impl functions

Fully qualified path: core::debug::I16PrintImpl::print

fn print(self: i16)

I32PrintImpl

Fully qualified path: core::debug::I32PrintImpl

pub(crate) impl I32PrintImpl of PrintTrait<i32>

Impl functions

Fully qualified path: core::debug::I32PrintImpl::print

fn print(self: i32)

I64PrintImpl

Fully qualified path: core::debug::I64PrintImpl

pub(crate) impl I64PrintImpl of PrintTrait<i64>

Impl functions

Fully qualified path: core::debug::I64PrintImpl::print

fn print(self: i64)

I128PrintImpl

Fully qualified path: core::debug::I128PrintImpl

pub(crate) impl I128PrintImpl of PrintTrait<i128>

Impl functions

Fully qualified path: core::debug::I128PrintImpl::print

fn print(self: i128)

ArrayGenericPrintImpl

Fully qualified path: core::debug::ArrayGenericPrintImpl

pub(crate) impl ArrayGenericPrintImpl of PrintTrait<Array<felt252>>

Impl functions

Fully qualified path: core::debug::ArrayGenericPrintImpl::print

fn print(mut self: Array<felt252>)

Secp256k1Impl

Fully qualified path: core::starknet::secp256k1::Secp256k1Impl

pub(crate) impl Secp256k1Impl of Secp256Trait<Secp256k1Point>

Impl functions

get_curve_size

Fully qualified path: core::starknet::secp256k1::Secp256k1Impl::get_curve_size

fn get_curve_size() -> u256

get_generator_point

Creates the generator point of the secp256k1 curve.

Fully qualified path: core::starknet::secp256k1::Secp256k1Impl::get_generator_point

fn get_generator_point() -> Secp256k1Point

secp256_ec_new_syscall

Fully qualified path: core::starknet::secp256k1::Secp256k1Impl::secp256_ec_new_syscall

fn secp256_ec_new_syscall(x: u256, y: u256) -> SyscallResult<Option<Secp256k1Point>>

secp256_ec_get_point_from_x_syscall

Fully qualified path: core::starknet::secp256k1::Secp256k1Impl::secp256_ec_get_point_from_x_syscall

fn secp256_ec_get_point_from_x_syscall(
    x: u256, y_parity: bool,
) -> SyscallResult<Option<Secp256k1Point>>

Secp256k1PointImpl

Fully qualified path: core::starknet::secp256k1::Secp256k1PointImpl

pub(crate) impl Secp256k1PointImpl of Secp256PointTrait<Secp256k1Point>

Impl functions

get_coordinates

Fully qualified path: core::starknet::secp256k1::Secp256k1PointImpl::get_coordinates

fn get_coordinates(self: Secp256k1Point) -> SyscallResult<(u256, u256)>

add

Fully qualified path: core::starknet::secp256k1::Secp256k1PointImpl::add

fn add(self: Secp256k1Point, other: Secp256k1Point) -> SyscallResult<Secp256k1Point>

mul

Fully qualified path: core::starknet::secp256k1::Secp256k1PointImpl::mul

fn mul(self: Secp256k1Point, scalar: u256) -> SyscallResult<Secp256k1Point>

Secp256r1Impl

Fully qualified path: core::starknet::secp256r1::Secp256r1Impl

pub(crate) impl Secp256r1Impl of Secp256Trait<Secp256r1Point>

Impl functions

get_curve_size

Fully qualified path: core::starknet::secp256r1::Secp256r1Impl::get_curve_size

fn get_curve_size() -> u256

get_generator_point

Creates the generator point of the secp256r1 curve.

Fully qualified path: core::starknet::secp256r1::Secp256r1Impl::get_generator_point

fn get_generator_point() -> Secp256r1Point

secp256_ec_new_syscall

Fully qualified path: core::starknet::secp256r1::Secp256r1Impl::secp256_ec_new_syscall

fn secp256_ec_new_syscall(x: u256, y: u256) -> SyscallResult<Option<Secp256r1Point>>

secp256_ec_get_point_from_x_syscall

Fully qualified path: core::starknet::secp256r1::Secp256r1Impl::secp256_ec_get_point_from_x_syscall

fn secp256_ec_get_point_from_x_syscall(
    x: u256, y_parity: bool,
) -> SyscallResult<Option<Secp256r1Point>>

Secp256r1PointImpl

Fully qualified path: core::starknet::secp256r1::Secp256r1PointImpl

pub(crate) impl Secp256r1PointImpl of Secp256PointTrait<Secp256r1Point>

Impl functions

get_coordinates

Fully qualified path: core::starknet::secp256r1::Secp256r1PointImpl::get_coordinates

fn get_coordinates(self: Secp256r1Point) -> SyscallResult<(u256, u256)>

add

Fully qualified path: core::starknet::secp256r1::Secp256r1PointImpl::add

fn add(self: Secp256r1Point, other: Secp256r1Point) -> SyscallResult<Secp256r1Point>

mul

Fully qualified path: core::starknet::secp256r1::Secp256r1PointImpl::mul

fn mul(self: Secp256r1Point, scalar: u256) -> SyscallResult<Secp256r1Point>

Felt252TryIntoContractAddress

Fully qualified path: core::starknet::contract_address::Felt252TryIntoContractAddress

pub(crate) impl Felt252TryIntoContractAddress of TryInto<felt252, ContractAddress>

Impl functions

try_into

Fully qualified path: core::starknet::contract_address::Felt252TryIntoContractAddress::try_into

fn try_into(self: felt252) -> Option<ContractAddress>

ContractAddressIntoFelt252

Fully qualified path: core::starknet::contract_address::ContractAddressIntoFelt252

pub(crate) impl ContractAddressIntoFelt252 of Into<ContractAddress, felt252>

Impl functions

into

Fully qualified path: core::starknet::contract_address::ContractAddressIntoFelt252::into

fn into(self: ContractAddress) -> felt252

Felt252TryIntoEthAddress

Fully qualified path: core::starknet::eth_address::Felt252TryIntoEthAddress

pub(crate) impl Felt252TryIntoEthAddress of TryInto<felt252, EthAddress>

Impl functions

try_into

Fully qualified path: core::starknet::eth_address::Felt252TryIntoEthAddress::try_into

fn try_into(self: felt252) -> Option<EthAddress>

EthAddressIntoFelt252

Fully qualified path: core::starknet::eth_address::EthAddressIntoFelt252

pub(crate) impl EthAddressIntoFelt252 of Into<EthAddress, felt252>

Impl functions

into

Fully qualified path: core::starknet::eth_address::EthAddressIntoFelt252::into

fn into(self: EthAddress) -> felt252

U256IntoEthAddress

Fully qualified path: core::starknet::eth_address::U256IntoEthAddress

pub(crate) impl U256IntoEthAddress of Into<u256, EthAddress>

Impl functions

into

Fully qualified path: core::starknet::eth_address::U256IntoEthAddress::into

fn into(self: u256) -> EthAddress

EthAddressSerde

Fully qualified path: core::starknet::eth_address::EthAddressSerde

pub(crate) impl EthAddressSerde of Serde<EthAddress>

Impl functions

serialize

Fully qualified path: core::starknet::eth_address::EthAddressSerde::serialize

fn serialize(self: @EthAddress, ref output: Array<felt252>)

deserialize

Fully qualified path: core::starknet::eth_address::EthAddressSerde::deserialize

fn deserialize(ref serialized: Span<felt252>) -> Option<EthAddress>

EthAddressPrintImpl

Fully qualified path: core::starknet::eth_address::EthAddressPrintImpl

pub(crate) impl EthAddressPrintImpl of PrintTrait<EthAddress>

Impl functions

Fully qualified path: core::starknet::eth_address::EthAddressPrintImpl::print

fn print(self: EthAddress)

Felt252TryIntoClassHash

Fully qualified path: core::starknet::class_hash::Felt252TryIntoClassHash

pub(crate) impl Felt252TryIntoClassHash of TryInto<felt252, ClassHash>

Impl functions

try_into

Fully qualified path: core::starknet::class_hash::Felt252TryIntoClassHash::try_into

fn try_into(self: felt252) -> Option<ClassHash>

ClassHashIntoFelt252

Fully qualified path: core::starknet::class_hash::ClassHashIntoFelt252

pub(crate) impl ClassHashIntoFelt252 of Into<ClassHash, felt252>

Impl functions

into

Fully qualified path: core::starknet::class_hash::ClassHashIntoFelt252::into

fn into(self: ClassHash) -> felt252

StorableStoragePointerReadAccess

Simple implementation of StoragePointerReadAccess for any type that implements Store for any offset.

Fully qualified path: core::starknet::storage::StorableStoragePointerReadAccess

pub impl StorableStoragePointerReadAccess<
    T, +starknet::Store<T>,
> of StoragePointerReadAccess<StoragePointer<T>>

Impl functions

read

Fully qualified path: core::starknet::storage::StorableStoragePointerReadAccess::read

fn read(self: @StoragePointer<T>) -> T

Impl types

Value

Fully qualified path: core::starknet::storage::StorableStoragePointerReadAccess::Value

type Value = T;

NonZeroIntoImpl

Implements the Into trait for converting NonZero to T.

Fully qualified path: core::zeroable::NonZeroIntoImpl

pub(crate) impl NonZeroIntoImpl<T> of Into<NonZero<T>, T>

Impl functions

into

Converts a NonZero to T.

Fully qualified path: core::zeroable::NonZeroIntoImpl::into

fn into(self: NonZero<T>) -> T nopanic

Bytes31Impl

Fully qualified path: core::bytes_31::Bytes31Impl

pub impl Bytes31Impl of Bytes31Trait

Impl functions

at

Gets the byte at the given index (LSB's index is 0), assuming that index < BYTES_IN_BYTES31. If the assumption is not met, the behavior is undefined.

Fully qualified path: core::bytes_31::Bytes31Impl::at

fn at(self: @bytes31, index: usize) -> u8

Bytes31IndexView

Fully qualified path: core::bytes_31::Bytes31IndexView

pub(crate) impl Bytes31IndexView of crate::traits::IndexView<bytes31, usize, u8>

Impl functions

index

Fully qualified path: core::bytes_31::Bytes31IndexView::index

fn index(self: @bytes31, index: usize) -> u8

Bytes31IntoFelt252

Fully qualified path: core::bytes_31::Bytes31IntoFelt252

pub(crate) impl Bytes31IntoFelt252 of Into<bytes31, felt252>

Impl functions

into

Fully qualified path: core::bytes_31::Bytes31IntoFelt252::into

fn into(self: bytes31) -> felt252

Bytes31IntoU256

Fully qualified path: core::bytes_31::Bytes31IntoU256

pub(crate) impl Bytes31IntoU256 of Into<bytes31, u256>

Impl functions

into

Fully qualified path: core::bytes_31::Bytes31IntoU256::into

fn into(self: bytes31) -> u256

Felt252TryIntoBytes31

Fully qualified path: core::bytes_31::Felt252TryIntoBytes31

pub(crate) impl Felt252TryIntoBytes31 of TryInto<felt252, bytes31>

Impl functions

try_into

Fully qualified path: core::bytes_31::Felt252TryIntoBytes31::try_into

fn try_into(self: felt252) -> Option<bytes31>

U8IntoBytes31

Fully qualified path: core::bytes_31::U8IntoBytes31

pub(crate) impl U8IntoBytes31 of Into<u8, bytes31>

Impl functions

into

Fully qualified path: core::bytes_31::U8IntoBytes31::into

fn into(self: u8) -> bytes31

U128IntoBytes31

Fully qualified path: core::bytes_31::U128IntoBytes31

pub(crate) impl U128IntoBytes31 of Into<u128, bytes31>

Impl functions

into

Fully qualified path: core::bytes_31::U128IntoBytes31::into

fn into(self: u128) -> bytes31

ByteArrayStringLiteral

Fully qualified path: core::byte_array::ByteArrayStringLiteral

pub(crate) impl ByteArrayStringLiteral of crate::string::StringLiteral<ByteArray>;

ByteArrayImpl

Functions associated with the ByteArray type.

Fully qualified path: core::byte_array::ByteArrayImpl

pub impl ByteArrayImpl of ByteArrayTrait

Impl functions

append_word

Appends a single word of len bytes to the end of the ByteArray. This function assumes that: 1. word could be validly converted to a bytes31 which has no more than len bytes of data. 2. len <= BYTES_IN_BYTES31. If these assumptions are not met, it can corrupt the ByteArray. Thus, this should be a private function. We could add masking/assertions but it would be more expensive. # Examples

let mut ba = "";
ba.append_word('word', 4);
assert!(ba == "word");

Fully qualified path: core::byte_array::ByteArrayImpl::append_word

fn append_word(ref self: ByteArray, word: felt252, len: usize)

append

Appends a ByteArray to the end of another ByteArray. # Examples

let mut ba: ByteArray = "1";
ba.append(@"2");
assert!(ba == "12");

Fully qualified path: core::byte_array::ByteArrayImpl::append

fn append(ref self: ByteArray, mut other: @ByteArray)

concat

Concatenates two ByteArray and returns the result. The content of left is cloned in a new memory segment. # Examples

let ba = "1";
let other_ba = "2";
let result = ByteArrayTrait::concat(@ba, @other_ba);
assert!(result == "12");

Fully qualified path: core::byte_array::ByteArrayImpl::concat

fn concat(left: @ByteArray, right: @ByteArray) -> ByteArray

append_byte

Appends a single byte to the end of the ByteArray. # Examples

let mut ba = "";
ba.append_byte(0);
assert!(ba == "0");

Fully qualified path: core::byte_array::ByteArrayImpl::append_byte

fn append_byte(ref self: ByteArray, byte: u8)

len

Returns the length of the ByteArray. # Examples

let ba: ByteArray = "byte array";
let len = ba.len();
assert!(len == 10);

Fully qualified path: core::byte_array::ByteArrayImpl::len

fn len(self: @ByteArray) -> usize

at

Returns an option of the byte at the given index of self or Option::None if the index is out of bounds. # Examples

let ba: ByteArray = "byte array";
let byte = ba.at(0).unwrap();
assert!(byte == 98);

Fully qualified path: core::byte_array::ByteArrayImpl::at

fn at(self: @ByteArray, index: usize) -> Option<u8>

rev

Returns a ByteArray with the reverse order of self. # Examples

let ba: ByteArray = "123";
let rev_ba = ba.rev();
assert!(rev_ba == "321");

Fully qualified path: core::byte_array::ByteArrayImpl::rev

fn rev(self: @ByteArray) -> ByteArray

append_word_rev

Appends the reverse of the given word to the end of self. This function assumes that: 1. len < 31 2. word is validly convertible to bytes31 of length len. # Examples

let mut ba: ByteArray = "";
ba.append_word_rev('123', 3);
assert!(ba == "321");

Fully qualified path: core::byte_array::ByteArrayImpl::append_word_rev

fn append_word_rev(ref self: ByteArray, word: felt252, len: usize)

append_word_fits_into_pending

Appends a single word of len bytes to the end of the ByteArray, assuming there is enough space in the pending word (self.pending_word_len + len < BYTES_IN_BYTES31). word is of type felt252 but actually represents a bytes31. It is represented as a felt252 to improve performance of building the ByteArray.

Fully qualified path: core::byte_array::ByteArrayImpl::append_word_fits_into_pending

fn append_word_fits_into_pending(ref self: ByteArray, word: felt252, len: usize)

append_split_index_lt_16

Appends a single word to the end of self, given that 0 < split_index < 16. split_index is the number of bytes left in self.pending_word after this function. This is the index of the split (LSB's index is 0). Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayImpl::append_split_index_lt_16

fn append_split_index_lt_16(ref self: ByteArray, word: felt252, split_index: usize)

append_split_index_16

Appends a single word to the end of self, given that the index of splitting word is exactly 16. split_index is the number of bytes left in self.pending_word after this function. This is the index of the split (LSB's index is 0). Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayImpl::append_split_index_16

fn append_split_index_16(ref self: ByteArray, word: felt252)

append_split_index_gt_16

Appends a single word to the end of self, given that the index of splitting word is > 16. split_index is the number of bytes left in self.pending_word after this function. This is the index of the split (LSB's index is 0). Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayImpl::append_split_index_gt_16

fn append_split_index_gt_16(ref self: ByteArray, word: felt252, split_index: usize)

append_split

A helper function to append a remainder to self, by: 1. completing self.pending_word to a full word using complete_full_word, assuming it's validly convertible to a bytes31 of length exactly BYTES_IN_BYTES31 - self.pending_word_len. 2. Setting self.pending_word to new_pending. Note: this function doesn't update the new pending length of self. It's the caller's responsibility.

Fully qualified path: core::byte_array::ByteArrayImpl::append_split

fn append_split(ref self: ByteArray, complete_full_word: felt252, new_pending: felt252)

ByteArrayIndexView

Fully qualified path: core::byte_array::ByteArrayIndexView

pub(crate) impl ByteArrayIndexView of crate::traits::IndexView<ByteArray, usize, u8>

Impl functions

index

Fully qualified path: core::byte_array::ByteArrayIndexView::index

fn index(self: @ByteArray, index: usize) -> u8

Extern types

RangeCheck

General purpose implicits.

Fully qualified path: core::RangeCheck

pub extern type RangeCheck

SegmentArena

Fully qualified path: core::SegmentArena

pub extern type SegmentArena

felt252

Fully qualified path: core::felt252

#[derive(Copy, Drop)]
pub extern type felt252

RangeCheck96

Fully qualified path: core::circuit::RangeCheck96

pub extern type RangeCheck96

AddMod

Fully qualified path: core::circuit::AddMod

pub extern type AddMod

MulMod

Fully qualified path: core::circuit::MulMod

pub extern type MulMod

CircuitModulus

A type that can be used as a circuit modulus (a u384 that is not zero or one).

Fully qualified path: core::circuit::CircuitModulus

pub extern type CircuitModulus

Circuit

A type that creates a circuit from a tuple of outputs.

Fully qualified path: core::circuit::Circuit

pub extern type Circuit<Outputs>

CircuitInput

Defines an input for a circuit.

Fully qualified path: core::circuit::CircuitInput

#[phantom]
pub extern type CircuitInput<const N: usize>

Box

A Box is a type that points to a wrapped value. It allows for cheap moving around of the value, as its size is small, and may wrap a large size.

Fully qualified path: core::box::Box

#[derive(Copy, Drop)]
pub extern type Box<T>

Nullable

A type that can either be null or contain a boxed value.

Fully qualified path: core::nullable::Nullable

#[derive(Copy, Drop)]
pub extern type Nullable<T>

Array

A collection of elements of the same type continuous in memory.

Fully qualified path: core::array::Array

#[derive(Drop)]
pub extern type Array<T>

Felt252Dict

A dictionary that maps felt252 keys to a value of any type.

Fully qualified path: core::dict::Felt252Dict

pub extern type Felt252Dict<T>

SquashedFelt252Dict

A dictionary in a squashed state. It cannot be mutated anymore.

Fully qualified path: core::dict::SquashedFelt252Dict

pub extern type SquashedFelt252Dict<T>

Felt252DictEntry

An intermediate type that is returned after calling the entry method that consumes ownership of the dictionary. This ensures that the dictionary cannot be mutated until the entry is finalized, which restores ownership of the dictionary.

Fully qualified path: core::dict::Felt252DictEntry

pub extern type Felt252DictEntry<T>

EcOp

Fully qualified path: core::ec::EcOp

pub extern type EcOp

EcPoint

Fully qualified path: core::ec::EcPoint

#[derive(Copy, Drop)]
pub extern type EcPoint

EcState

Fully qualified path: core::ec::EcState

#[derive(Drop)]
pub extern type EcState

u128

Fully qualified path: core::integer::u128

#[derive(Copy, Drop)]
pub extern type u128

U128MulGuarantee

A type that contains 4 u128s (a, b, c, d) and guarantees that a * b = 2**128 * c + d. The guarantee is verified by u128_mul_guarantee_verify, which is the only way to destruct this type. This way, one can trust that the guarantee holds although it has not yet been verified.

Fully qualified path: core::integer::U128MulGuarantee

pub extern type U128MulGuarantee

Bitwise

Fully qualified path: core::integer::Bitwise

pub extern type Bitwise

u8

Fully qualified path: core::integer::u8

#[derive(Copy, Drop)]
pub extern type u8

u16

Fully qualified path: core::integer::u16

#[derive(Copy, Drop)]
pub extern type u16

u32

Fully qualified path: core::integer::u32

#[derive(Copy, Drop)]
pub extern type u32

u64

Fully qualified path: core::integer::u64

#[derive(Copy, Drop)]
pub extern type u64

i8

Fully qualified path: core::integer::i8

#[derive(Copy, Drop)]
pub extern type i8

i16

Fully qualified path: core::integer::i16

#[derive(Copy, Drop)]
pub extern type i16

i32

Fully qualified path: core::integer::i32

#[derive(Copy, Drop)]
pub extern type i32

i64

Fully qualified path: core::integer::i64

#[derive(Copy, Drop)]
pub extern type i64

i128

Fully qualified path: core::integer::i128

#[derive(Copy, Drop)]
pub extern type i128

BuiltinCosts

Type representing the table of the costs of the different builtin usages.

Fully qualified path: core::gas::BuiltinCosts

#[derive(Copy, Drop)]
pub extern type BuiltinCosts

GasBuiltin

The gas builtin. This type is used to handle gas in the Cairo code. Contains the amount of gas available for the current run.

Fully qualified path: core::gas::GasBuiltin

pub extern type GasBuiltin

Sha256StateHandle

A handle to the state of a SHA-256 hash.

Fully qualified path: core::sha256::Sha256StateHandle

#[derive(Copy, Drop)]
pub(crate) extern type Sha256StateHandle

Pedersen

Fully qualified path: core::pedersen::Pedersen

pub extern type Pedersen

Poseidon

Fully qualified path: core::poseidon::Poseidon

pub extern type Poseidon

System

Fully qualified path: core::starknet::System

pub extern type System

StorageAddress

Represents the address of a storage value in a Starknet contract. The value range of this type is [0, 2**251).

Fully qualified path: core::starknet::storage_access::StorageAddress

#[derive(Copy, Drop)]
pub extern type StorageAddress

ContractAddress

Represents a Starknet contract address. The value range of this type is [0, 2**251).

Fully qualified path: core::starknet::contract_address::ContractAddress

#[derive(Copy, Drop)]
pub extern type ContractAddress

ClassHash

Represents a Starknet contract class hash. The value range of this type is [0, 2**251).

Fully qualified path: core::starknet::class_hash::ClassHash

#[derive(Copy, Drop)]
pub extern type ClassHash

StorageAddress

Represents the address of a storage value in a Starknet contract. The value range of this type is [0, 2**251).

Fully qualified path: core::starknet::storage_access::StorageAddress

#[derive(Copy, Drop)]
pub extern type StorageAddress

StorageBaseAddress

Fully qualified path: core::starknet::storage_access::StorageBaseAddress

#[derive(Copy, Drop)]
pub extern type StorageBaseAddress

Secp256k1Point

A point on the Secp256k1 curve.

Fully qualified path: core::starknet::secp256k1::Secp256k1Point

#[derive(Copy, Drop)]
pub extern type Secp256k1Point

Secp256r1Point

A point on the Secp256r1 curve.

Fully qualified path: core::starknet::secp256r1::Secp256r1Point

#[derive(Copy, Drop)]
pub extern type Secp256r1Point

ContractAddress

Represents a Starknet contract address. The value range of this type is [0, 2**251).

Fully qualified path: core::starknet::contract_address::ContractAddress

#[derive(Copy, Drop)]
pub extern type ContractAddress

ClassHash

Represents a Starknet contract class hash. The value range of this type is [0, 2**251).

Fully qualified path: core::starknet::class_hash::ClassHash

#[derive(Copy, Drop)]
pub extern type ClassHash

BoundedInt

Fully qualified path: core::internal::bounded_int::BoundedInt

#[derive(Copy, Drop)]
pub(crate) extern type BoundedInt<const MIN: felt252, const MAX: felt252>

NonZero

A wrapper type for non-zero values of type T. This type guarantees that the wrapped value is never zero.

Fully qualified path: core::zeroable::NonZero

#[derive(Copy, Drop)]
pub extern type NonZero<T>

bytes31

Fully qualified path: core::bytes_31::bytes31

#[derive(Copy, Drop)]
pub extern type bytes31

Extern functions

bool_and_impl

Fully qualified path: core::bool_and_impl

extern fn bool_and_impl(lhs: bool, rhs: bool) -> (bool,) implicits() nopanic;

bool_or_impl

Fully qualified path: core::bool_or_impl

extern fn bool_or_impl(lhs: bool, rhs: bool) -> (bool,) implicits() nopanic;

bool_not_impl

Fully qualified path: core::bool_not_impl

extern fn bool_not_impl(a: bool) -> (bool,) implicits() nopanic;

bool_xor_impl

Fully qualified path: core::bool_xor_impl

extern fn bool_xor_impl(lhs: bool, rhs: bool) -> (bool,) implicits() nopanic;

bool_to_felt252

Fully qualified path: core::bool_to_felt252

extern fn bool_to_felt252(a: bool) -> felt252 implicits() nopanic;

felt252_const

Fully qualified path: core::felt252_const

extern fn felt252_const<const value: felt252>() -> felt252 nopanic;

felt252_add

Fully qualified path: core::felt252_add

extern fn felt252_add(lhs: felt252, rhs: felt252) -> felt252 nopanic;

felt252_sub

Fully qualified path: core::felt252_sub

extern fn felt252_sub(lhs: felt252, rhs: felt252) -> felt252 nopanic;

felt252_mul

Fully qualified path: core::felt252_mul

extern fn felt252_mul(lhs: felt252, rhs: felt252) -> felt252 nopanic;

felt252_div

Fully qualified path: core::felt252_div

pub extern fn felt252_div(lhs: felt252, rhs: NonZero<felt252>) -> felt252 nopanic;

felt252_is_zero

Fully qualified path: core::felt252_is_zero

extern fn felt252_is_zero(lhs: felt252) -> zeroable::IsZeroResult<felt252> nopanic;

dup

Fully qualified path: core::dup

extern fn dup<T>(obj: T) -> (T, T) nopanic;

drop

Fully qualified path: core::drop

extern fn drop<T>(obj: T) nopanic;

null

Fully qualified path: core::nullable::null

pub extern fn null<T>() -> Nullable<T> nopanic;

nullable_from_box

Fully qualified path: core::nullable::nullable_from_box

pub(crate) extern fn nullable_from_box<T>(value: Box<T>) -> Nullable<T> nopanic;

match_nullable

Fully qualified path: core::nullable::match_nullable

pub extern fn match_nullable<T>(value: Nullable<T>) -> FromNullableResult<T> nopanic;

array_snapshot_pop_front

Fully qualified path: core::array::array_snapshot_pop_front

pub(crate) extern fn array_snapshot_pop_front<T>(ref arr: @Array<T>) -> Option<Box<@T>> nopanic;

felt252_dict_new

Fully qualified path: core::dict::felt252_dict_new

pub(crate) extern fn felt252_dict_new<T>() -> Felt252Dict<T> implicits(SegmentArena) nopanic;

felt252_dict_squash

Fully qualified path: core::dict::felt252_dict_squash

pub(crate) extern fn felt252_dict_squash<T>(
    dict: Felt252Dict<T>,
) -> SquashedFelt252Dict<T> implicits(RangeCheck, GasBuiltin, SegmentArena) nopanic;

ec_point_unwrap

Unwraps a non-zero point into its (x, y) coordinates.

Fully qualified path: core::ec::ec_point_unwrap

pub extern fn ec_point_unwrap(p: NonZeroEcPoint) -> (felt252, felt252) nopanic;

u128_to_felt252

Fully qualified path: core::integer::u128_to_felt252

pub(crate) extern fn u128_to_felt252(a: u128) -> felt252 nopanic;

u128_overflowing_add

Fully qualified path: core::integer::u128_overflowing_add

pub extern fn u128_overflowing_add(
    lhs: u128, rhs: u128,
) -> Result<u128, u128> implicits(RangeCheck) nopanic;

u128_overflowing_sub

Fully qualified path: core::integer::u128_overflowing_sub

pub extern fn u128_overflowing_sub(
    lhs: u128, rhs: u128,
) -> Result<u128, u128> implicits(RangeCheck) nopanic;

u128_sqrt

Fully qualified path: core::integer::u128_sqrt

pub extern fn u128_sqrt(value: u128) -> u64 implicits(RangeCheck) nopanic;

u128_safe_divmod

Fully qualified path: core::integer::u128_safe_divmod

pub extern fn u128_safe_divmod(
    lhs: u128, rhs: NonZero<u128>,
) -> (u128, u128) implicits(RangeCheck) nopanic;

u128_is_zero

Fully qualified path: core::integer::u128_is_zero

pub(crate) extern fn u128_is_zero(a: u128) -> IsZeroResult<u128> implicits() nopanic;

u128_byte_reverse

Fully qualified path: core::integer::u128_byte_reverse

pub extern fn u128_byte_reverse(input: u128) -> u128 implicits(Bitwise) nopanic;

u8_overflowing_add

Fully qualified path: core::integer::u8_overflowing_add

pub extern fn u8_overflowing_add(lhs: u8, rhs: u8) -> Result<u8, u8> implicits(RangeCheck) nopanic;

u8_overflowing_sub

Fully qualified path: core::integer::u8_overflowing_sub

pub extern fn u8_overflowing_sub(lhs: u8, rhs: u8) -> Result<u8, u8> implicits(RangeCheck) nopanic;

u8_wide_mul

Fully qualified path: core::integer::u8_wide_mul

pub extern fn u8_wide_mul(lhs: u8, rhs: u8) -> u16 implicits() nopanic;

u8_sqrt

Fully qualified path: core::integer::u8_sqrt

pub extern fn u8_sqrt(value: u8) -> u8 implicits(RangeCheck) nopanic;

u8_safe_divmod

Fully qualified path: core::integer::u8_safe_divmod

pub extern fn u8_safe_divmod(lhs: u8, rhs: NonZero<u8>) -> (u8, u8) implicits(RangeCheck) nopanic;

u16_overflowing_add

Fully qualified path: core::integer::u16_overflowing_add

pub extern fn u16_overflowing_add(
    lhs: u16, rhs: u16,
) -> Result<u16, u16> implicits(RangeCheck) nopanic;

u16_overflowing_sub

Fully qualified path: core::integer::u16_overflowing_sub

pub extern fn u16_overflowing_sub(
    lhs: u16, rhs: u16,
) -> Result<u16, u16> implicits(RangeCheck) nopanic;

u16_wide_mul

Fully qualified path: core::integer::u16_wide_mul

pub extern fn u16_wide_mul(lhs: u16, rhs: u16) -> u32 implicits() nopanic;

u16_sqrt

Fully qualified path: core::integer::u16_sqrt

pub extern fn u16_sqrt(value: u16) -> u8 implicits(RangeCheck) nopanic;

u16_safe_divmod

Fully qualified path: core::integer::u16_safe_divmod

pub extern fn u16_safe_divmod(
    lhs: u16, rhs: NonZero<u16>,
) -> (u16, u16) implicits(RangeCheck) nopanic;

u32_overflowing_add

Fully qualified path: core::integer::u32_overflowing_add

pub extern fn u32_overflowing_add(
    lhs: u32, rhs: u32,
) -> Result<u32, u32> implicits(RangeCheck) nopanic;

u32_overflowing_sub

Fully qualified path: core::integer::u32_overflowing_sub

pub extern fn u32_overflowing_sub(
    lhs: u32, rhs: u32,
) -> Result<u32, u32> implicits(RangeCheck) nopanic;

u32_wide_mul

Fully qualified path: core::integer::u32_wide_mul

pub extern fn u32_wide_mul(lhs: u32, rhs: u32) -> u64 implicits() nopanic;

u32_sqrt

Fully qualified path: core::integer::u32_sqrt

pub extern fn u32_sqrt(value: u32) -> u16 implicits(RangeCheck) nopanic;

u32_safe_divmod

Fully qualified path: core::integer::u32_safe_divmod

pub extern fn u32_safe_divmod(
    lhs: u32, rhs: NonZero<u32>,
) -> (u32, u32) implicits(RangeCheck) nopanic;

u64_overflowing_add

Fully qualified path: core::integer::u64_overflowing_add

pub extern fn u64_overflowing_add(
    lhs: u64, rhs: u64,
) -> Result<u64, u64> implicits(RangeCheck) nopanic;

u64_overflowing_sub

Fully qualified path: core::integer::u64_overflowing_sub

pub extern fn u64_overflowing_sub(
    lhs: u64, rhs: u64,
) -> Result<u64, u64> implicits(RangeCheck) nopanic;

u64_wide_mul

Fully qualified path: core::integer::u64_wide_mul

pub extern fn u64_wide_mul(lhs: u64, rhs: u64) -> u128 implicits() nopanic;

u64_sqrt

Fully qualified path: core::integer::u64_sqrt

pub extern fn u64_sqrt(value: u64) -> u32 implicits(RangeCheck) nopanic;

u64_safe_divmod

Fully qualified path: core::integer::u64_safe_divmod

pub extern fn u64_safe_divmod(
    lhs: u64, rhs: NonZero<u64>,
) -> (u64, u64) implicits(RangeCheck) nopanic;

u256_sqrt

Fully qualified path: core::integer::u256_sqrt

pub extern fn u256_sqrt(a: u256) -> u128 implicits(RangeCheck) nopanic;

upcast

Fully qualified path: core::integer::upcast

pub(crate) extern fn upcast<FromType, ToType>(x: FromType) -> ToType nopanic;

downcast

Fully qualified path: core::integer::downcast

pub(crate) extern fn downcast<FromType, ToType>(
    x: FromType,
) -> Option<ToType> implicits(RangeCheck) nopanic;

i8_wide_mul

Fully qualified path: core::integer::i8_wide_mul

pub extern fn i8_wide_mul(lhs: i8, rhs: i8) -> i16 implicits() nopanic;

i8_diff

If lhs >= rhs returns Ok(lhs - rhs) else returns Err(2**8 + lhs - rhs).

Fully qualified path: core::integer::i8_diff

pub extern fn i8_diff(lhs: i8, rhs: i8) -> Result<u8, u8> implicits(RangeCheck) nopanic;

i16_wide_mul

Fully qualified path: core::integer::i16_wide_mul

pub extern fn i16_wide_mul(lhs: i16, rhs: i16) -> i32 implicits() nopanic;

i16_diff

If lhs >= rhs returns Ok(lhs - rhs) else returns Err(2**16 + lhs - rhs).

Fully qualified path: core::integer::i16_diff

pub extern fn i16_diff(lhs: i16, rhs: i16) -> Result<u16, u16> implicits(RangeCheck) nopanic;

i32_wide_mul

Fully qualified path: core::integer::i32_wide_mul

pub extern fn i32_wide_mul(lhs: i32, rhs: i32) -> i64 implicits() nopanic;

i32_diff

If lhs >= rhs returns Ok(lhs - rhs) else returns Err(2**32 + lhs - rhs).

Fully qualified path: core::integer::i32_diff

pub extern fn i32_diff(lhs: i32, rhs: i32) -> Result<u32, u32> implicits(RangeCheck) nopanic;

i64_wide_mul

Fully qualified path: core::integer::i64_wide_mul

pub extern fn i64_wide_mul(lhs: i64, rhs: i64) -> i128 implicits() nopanic;

i64_diff

If lhs >= rhs returns Ok(lhs - rhs) else returns Err(2**64 + lhs - rhs).

Fully qualified path: core::integer::i64_diff

pub extern fn i64_diff(lhs: i64, rhs: i64) -> Result<u64, u64> implicits(RangeCheck) nopanic;

i128_diff

If lhs >= rhs returns Ok(lhs - rhs) else returns Err(2**128 + lhs - rhs).

Fully qualified path: core::integer::i128_diff

pub extern fn i128_diff(lhs: i128, rhs: i128) -> Result<u128, u128> implicits(RangeCheck) nopanic;

withdraw_gas

Withdraws gas from the GasBuiltin to handle the success case flow. Returns Option::Some(()) if there is sufficient gas to handle the success case, otherwise returns Option::None. Example:

// The success branch is the following lines, the failure branch is the `panic` caused by the
// `unwrap` call.
withdraw_gas().unwrap();

// Direct handling of `withdraw_gas`.
match withdraw_gas() {
    Option::Some(()) => success_case(),
    Option::None => cheap_not_enough_gas_case(),
}

Fully qualified path: core::gas::withdraw_gas

pub extern fn withdraw_gas() -> Option<()> implicits(RangeCheck, GasBuiltin) nopanic;

withdraw_gas_all

Same as withdraw_gas, but directly receives BuiltinCosts, which enables optimizations by removing the need for repeated internal calls for fetching the table of consts that may internally happen in calls to withdraw_gas. Should be used with caution.

Fully qualified path: core::gas::withdraw_gas_all

pub extern fn withdraw_gas_all(
    costs: BuiltinCosts,
) -> Option<()> implicits(RangeCheck, GasBuiltin) nopanic;

redeposit_gas

Returns unused gas into the gas builtin. Useful for cases where different branches take different amounts of gas, but gas withdrawal is the same for both.

Fully qualified path: core::gas::redeposit_gas

pub extern fn redeposit_gas() implicits(GasBuiltin) nopanic;

get_builtin_costs

Returns the BuiltinCosts table to be used in withdraw_gas_all.

Fully qualified path: core::gas::get_builtin_costs

pub extern fn get_builtin_costs() -> BuiltinCosts nopanic;

panic

Fully qualified path: core::panics::panic

pub extern fn panic(data: Array<felt252>) -> crate::never;

pedersen

Fully qualified path: core::pedersen::pedersen

pub extern fn pedersen(a: felt252, b: felt252) -> felt252 implicits(Pedersen) nopanic;

hades_permutation

Fully qualified path: core::poseidon::hades_permutation

pub extern fn hades_permutation(
    s0: felt252, s1: felt252, s2: felt252,
) -> (felt252, felt252, felt252) implicits(Poseidon) nopanic;

print

Fully qualified path: core::debug::print

pub(crate) extern fn print(message: Array<felt252>) nopanic;

contract_address_const

Fully qualified path: core::starknet::contract_address::contract_address_const

pub extern fn contract_address_const<const address: felt252>() -> ContractAddress nopanic;

storage_base_address_const

Fully qualified path: core::starknet::storage_access::storage_base_address_const

pub extern fn storage_base_address_const<const address: felt252>() -> StorageBaseAddress nopanic;

storage_base_address_from_felt252

Fully qualified path: core::starknet::storage_access::storage_base_address_from_felt252

pub extern fn storage_base_address_from_felt252(
    addr: felt252,
) -> StorageBaseAddress implicits(RangeCheck) nopanic;

storage_address_to_felt252

Fully qualified path: core::starknet::storage_access::storage_address_to_felt252

pub(crate) extern fn storage_address_to_felt252(address: StorageAddress) -> felt252 nopanic;

storage_address_from_base_and_offset

Fully qualified path: core::starknet::storage_access::storage_address_from_base_and_offset

pub extern fn storage_address_from_base_and_offset(
    base: StorageBaseAddress, offset: u8,
) -> StorageAddress nopanic;

storage_address_from_base

Fully qualified path: core::starknet::storage_access::storage_address_from_base

pub extern fn storage_address_from_base(base: StorageBaseAddress) -> StorageAddress nopanic;

storage_address_try_from_felt252

Fully qualified path: core::starknet::storage_access::storage_address_try_from_felt252

pub(crate) extern fn storage_address_try_from_felt252(
    address: felt252,
) -> Option<StorageAddress> implicits(RangeCheck) nopanic;

call_contract_syscall

Calls a given contract. address - The address of the called contract. entry_point_selector - A selector for a function within that contract. calldata - Call arguments.

Fully qualified path: core::starknet::syscalls::call_contract_syscall

pub extern fn call_contract_syscall(
    address: ContractAddress, entry_point_selector: felt252, calldata: Span<felt252>,
) -> SyscallResult<Span<felt252>> implicits(GasBuiltin, System) nopanic;

deploy_syscall

Deploys a new instance of a previously declared class. class_hash - The class hash of the contract to be deployed. contract_address_salt - The salt, an arbitrary value provided by the sender, used in thecomputation of the contract's address. calldata - Call arguments for the constructor.deploy_from_zero - Deploy the contract from the zero address.Returns the address of the deployed contract and the serialized return value of the constructor.

Fully qualified path: core::starknet::syscalls::deploy_syscall

pub extern fn deploy_syscall(
    class_hash: ClassHash,
    contract_address_salt: felt252,
    calldata: Span<felt252>,
    deploy_from_zero: bool,
) -> SyscallResult<(ContractAddress, Span<felt252>)> implicits(GasBuiltin, System) nopanic;

emit_event_syscall

Emits an event. keys - The keys of the event. data - The data of the event.

Fully qualified path: core::starknet::syscalls::emit_event_syscall

pub extern fn emit_event_syscall(
    keys: Span<felt252>, data: Span<felt252>,
) -> SyscallResult<()> implicits(GasBuiltin, System) nopanic;

get_block_hash_syscall

Gets the block hash of the block with the given number.

Fully qualified path: core::starknet::syscalls::get_block_hash_syscall

pub extern fn get_block_hash_syscall(
    block_number: u64,
) -> SyscallResult<felt252> implicits(GasBuiltin, System) nopanic;

get_execution_info_syscall

Gets information about the current execution.

Fully qualified path: core::starknet::syscalls::get_execution_info_syscall

pub extern fn get_execution_info_syscall() -> SyscallResult<
    Box<starknet::info::ExecutionInfo>,
> implicits(GasBuiltin, System) nopanic;

get_execution_info_v2_syscall

Gets information about the current execution, version 2.

Fully qualified path: core::starknet::syscalls::get_execution_info_v2_syscall

pub extern fn get_execution_info_v2_syscall() -> SyscallResult<
    Box<starknet::info::v2::ExecutionInfo>,
> implicits(GasBuiltin, System) nopanic;

library_call_syscall

Calls the requested function in any previously declared class. class_hash - The hash of the class you want to use. function_selector - A selector for a function within that class. calldata - Call arguments.

Fully qualified path: core::starknet::syscalls::library_call_syscall

pub extern fn library_call_syscall(
    class_hash: ClassHash, function_selector: felt252, calldata: Span<felt252>,
) -> SyscallResult<Span<felt252>> implicits(GasBuiltin, System) nopanic;

send_message_to_l1_syscall

Sends a message to L1. to_address - The recipient's L1 address. payload - The content of the message.

Fully qualified path: core::starknet::syscalls::send_message_to_l1_syscall

pub extern fn send_message_to_l1_syscall(
    to_address: felt252, payload: Span<felt252>,
) -> SyscallResult<()> implicits(GasBuiltin, System) nopanic;

storage_read_syscall

Gets the value of a key in the storage of the calling contract. address_domain - The domain of the address. Only address_domain 0 is currently supported,in the future it will enable access to address spaces with different data availability guarantees. address - The address of the storage key to read.

Fully qualified path: core::starknet::syscalls::storage_read_syscall

pub extern fn storage_read_syscall(
    address_domain: u32, address: StorageAddress,
) -> SyscallResult<felt252> implicits(GasBuiltin, System) nopanic;

storage_write_syscall

Sets the value of a key in the storage of the calling contract. address_domain - The domain of the address. Only address_domain 0 is currently supported,in the future it will enable access to address spaces with different data availability guarantees. address - The address of the storage key to write.value - The value to write to the key.

Fully qualified path: core::starknet::syscalls::storage_write_syscall

pub extern fn storage_write_syscall(
    address_domain: u32, address: StorageAddress, value: felt252,
) -> SyscallResult<()> implicits(GasBuiltin, System) nopanic;

replace_class_syscall

Replaces the class hash of the current contract. class_hash - The class hash that should replace the current one.

Fully qualified path: core::starknet::syscalls::replace_class_syscall

pub extern fn replace_class_syscall(
    class_hash: ClassHash,
) -> SyscallResult<()> implicits(GasBuiltin, System) nopanic;

get_class_hash_at_syscall

Gets the class hash of the contract at the given address. contract_address - The address of the deployed contract. Returns the class hash of the contract's originating code.

Fully qualified path: core::starknet::syscalls::get_class_hash_at_syscall

pub extern fn get_class_hash_at_syscall(
    contract_address: ContractAddress,
) -> SyscallResult<ClassHash> implicits(GasBuiltin, System) nopanic;

keccak_syscall

Computes the keccak of the input. The system call does not add any padding and the input needs to be a multiple of 1088 bits (== 17 u64 word).

Fully qualified path: core::starknet::syscalls::keccak_syscall

pub extern fn keccak_syscall(
    input: Span<u64>,
) -> SyscallResult<u256> implicits(GasBuiltin, System) nopanic;

sha256_process_block_syscall

Computes the next sha256 state of the input with the given state. The system call does not add any padding and the input needs to be a multiple of 512 bits (== 16 u32 word).

Fully qualified path: core::starknet::syscalls::sha256_process_block_syscall

pub extern fn sha256_process_block_syscall(
    state: core::sha256::Sha256StateHandle, input: Box<[u32; 16]>,
) -> SyscallResult<core::sha256::Sha256StateHandle> implicits(GasBuiltin, System) nopanic;

contract_address_const

Fully qualified path: core::starknet::contract_address::contract_address_const

pub extern fn contract_address_const<const address: felt252>() -> ContractAddress nopanic;

contract_address_to_felt252

Fully qualified path: core::starknet::contract_address::contract_address_to_felt252

pub(crate) extern fn contract_address_to_felt252(address: ContractAddress) -> felt252 nopanic;

contract_address_try_from_felt252

Fully qualified path: core::starknet::contract_address::contract_address_try_from_felt252

pub(crate) extern fn contract_address_try_from_felt252(
    address: felt252,
) -> Option<ContractAddress> implicits(RangeCheck) nopanic;

class_hash_const

Fully qualified path: core::starknet::class_hash::class_hash_const

pub extern fn class_hash_const<const address: felt252>() -> ClassHash nopanic;

class_hash_to_felt252

Fully qualified path: core::starknet::class_hash::class_hash_to_felt252

pub(crate) extern fn class_hash_to_felt252(address: ClassHash) -> felt252 nopanic;

class_hash_try_from_felt252

Fully qualified path: core::starknet::class_hash::class_hash_try_from_felt252

pub(crate) extern fn class_hash_try_from_felt252(
    address: felt252,
) -> Option<ClassHash> implicits(RangeCheck) nopanic;

cheatcode

A general cheatcode function used to simplify implementation of Starknet testing functions. External users of the cairo crates can also implement their own cheatcodes by injecting custom CairoHintProcessor.

Fully qualified path: core::starknet::testing::cheatcode

pub extern fn cheatcode<const selector: felt252>(
    input: Span<felt252>,
) -> Span<felt252> implicits() nopanic;

revoke_ap_tracking

Fully qualified path: core::internal::revoke_ap_tracking

pub extern fn revoke_ap_tracking() implicits() nopanic;

require_implicit

Function to enforce that Implicit is used by a function calling it. Note: This extern function is not mapped to a Sierra function, and all usages of it are removed during compilation.

Fully qualified path: core::internal::require_implicit

pub extern fn require_implicit<Implicit>() implicits(Implicit) nopanic;

bytes31_const

Fully qualified path: core::bytes_31::bytes31_const

pub(crate) extern fn bytes31_const<const value: felt252>() -> bytes31 nopanic;

get_available_gas

Returns the amount of gas available in the GasBuiltin. Useful for asserting that a certain amount of gas was consumed. Note: The actual gas consumption observed by calls to get_available_gas is only exact immediately before calls to withdraw_gas. # Examples

use core::testing::get_available_gas;

fn gas_heavy_function() {
    // ... some gas-intensive code
}

fn test_gas_consumption() {
    let gas_before = get_available_gas();
    // Making sure `gas_before` is exact.
    core::gas::withdraw_gas().unwrap();

    gas_heavy_function();

    let gas_after = get_available_gas();
    // Making sure `gas_after` is exact
    core::gas::withdraw_gas().unwrap();

    assert!(gas_after - gas_before < 100_000);
}

Fully qualified path: core::testing::get_available_gas

pub extern fn get_available_gas() -> u128 implicits(GasBuiltin) nopanic;