Introduction
Silex is the smart contract language used by XELIS. It is statically typed, compact, and designed for deterministic execution: contracts declare typed data, functions, entry points, hooks, structs, and enums, then compile into bytecode executed by the XELIS Virtual Machine.
XVM is the sandboxed runtime behind Silex contracts. It provides a controlled execution environment where every operation is metered, contract state is isolated, and host features are exposed through explicit system calls. This lets contracts interact with blockchain data and built-in primitives without giving them unrestricted access to the node.
The standard library is the bridge between Silex code and the VM environment. It includes core utilities, numeric helpers, collection operations, iterators, persistent and in-memory storage, asset management, transfers, contract calls, scheduled executions, events, and cryptographic types such as hashes, signatures, ciphertexts, scalars, Ristretto points, transcripts, and zero-knowledge proof helpers.
Each entry below shows the available Silex type or function, its signature, a short description when available, and the gas/syscall metadata used by XVM.
Types
Structs: Entry
Enums: BTreeSeekBias, MaxSupplyMode
Structs
Entry
struct Entry {
key: bytes,
value: any
}Enums
BTreeSeekBias
enum BTreeSeekBias {
Exact,
GreaterOrEqual,
Greater,
LessOrEqual,
Less,
First,
Last
}MaxSupplyMode
enum MaxSupplyMode {
None,
Fixed { max_supply: u64 },
Mintable { max_supply: u64 }
}Functions
Function groups:
- Global Utility (30)
- u8 (37)
- u16 (37)
- u32 (37)
- u64 (37)
- u128 (37)
- u256 (37)
- u8[] (1)
- String (20)
- Bytes (15)
- Array (20)
- Map (10)
- Range (5)
- Optional (6)
- Address (6)
- ArbitraryRangeProof (6)
- Asset (18)
- BTreeCursor (2)
- BTreeStore (6)
- BalanceProof (4)
- Block (12)
- Ciphertext (13)
- CiphertextValidityProof (1)
- CommitmentEqualityProof (1)
- Contract (5)
- Hash (12)
- Iterator (22)
- MaxSupplyMode (2)
- MemoryStorage (5)
- OwnershipProof (6)
- Random (8)
- RangeProof (2)
- ReadOnlyStorage (3)
- RistrettoPoint (10)
- Scalar (11)
- ScheduledExecution (7)
- Signature (2)
- Storage (5)
- T (1)
- T0[][] (1)
- Transaction (6)
- Transcript (7)
Global Utility
assert
Fails execution if the condition is false.
assert(condition: bool)Gas: 1
Syscall: 302
burn
Burns an asset amount from the current contract balance.
burn(amount: u64, asset: Hash) ⟶ boolGas: 500
Syscall: 482
debug
Prints a value to standard output using its debug representation.
debug(message: any)Gas: 1
Syscall: 300
emit_event
Emits a contract event with arguments for listeners.
emit_event(id: u64, args: any[])Gas: 1000
Syscall: 504
fire_rpc_event
Records an RPC event for off-chain applications.
fire_rpc_event(id: u64, data: any)Gas: 250
Syscall: 483
get_account_balance_for_asset
Returns an account balance ciphertext and fetched topoheight for the asset, if any.
get_account_balance_for_asset(address: Address, asset: Hash) ⟶ optional<(u64, Ciphertext)>Gas: 1000
Syscall: 484
get_balance_for_asset
Returns the current contract balance for the given asset, if any.
get_balance_for_asset(asset: Hash) ⟶ optional<u64>Gas: 25
Syscall: 478
get_caller
Returns the caller account address, if any.
get_caller() ⟶ optional<Address>Gas: 20
Syscall: 489
get_contract_balance_for_asset
Returns another contract’s balance for the given asset, if any.
get_contract_balance_for_asset(contract: Hash, asset: Hash) ⟶ optional<u64>Gas: 250
Syscall: 479
get_contract_caller
Returns the calling contract hash, if any.
get_contract_caller() ⟶ optional<Hash>Gas: 5
Syscall: 475
get_contract_entry
Returns the initial contract hash used as the entry point.
get_contract_entry() ⟶ HashGas: 5
Syscall: 474
get_contract_hash
Returns the hash of the currently executing contract.
get_contract_hash() ⟶ HashGas: 5
Syscall: 473
get_cost_per_asset
Returns the asset creation cost in atomic units.
get_cost_per_asset() ⟶ u64Gas: 1
Syscall: 490
get_cost_per_scheduled_execution
Returns the scheduled execution cost in atomic units.
get_cost_per_scheduled_execution() ⟶ u64Gas: 1
Syscall: 491
get_current_topoheight
Returns the current execution topoheight.
get_current_topoheight() ⟶ u64Gas: 1
Syscall: 488
get_deposit_for_asset
Returns the public deposit amount for the given asset, if any.
get_deposit_for_asset(asset: Hash) ⟶ optional<u64>Gas: 5
Syscall: 476
get_deposits
Returns all public deposits received by this invocation.
get_deposits() ⟶ map<Hash, u64>Gas: 15
Syscall: 477
get_gas_limit
Returns the current VM gas limit.
get_gas_limit() ⟶ u64Gas: 1
Syscall: 486
get_gas_usage
Returns the current gas used by the execution.
get_gas_usage() ⟶ u64Gas: 1
Syscall: 485
get_xelis_asset
Returns the native XELIS asset hash.
get_xelis_asset() ⟶ HashGas: 1
Syscall: 506
increase_gas_limit
Increases the VM gas limit using current contract funds.
increase_gas_limit(amount: u64) ⟶ boolGas: 250
Syscall: 487
is_contract_callable
Returns whether a contract chunk is callable under current permissions.
is_contract_callable(contract: Hash, chunk_id: u16) ⟶ boolGas: 75
Syscall: 492
is_same_ptr
Returns true when both values point to the same underlying value.
is_same_ptr(left: any, right: any) ⟶ boolGas: 5
Syscall: 303
panic
Stops execution with the provided panic message.
panic(message: any) ⟶ anyGas: 1
Syscall: 301
println
Prints a value to standard output using its display representation.
println(message: any)Gas: 1
Syscall: 299
require
Fails execution with the message if the condition is false.
require(condition: bool, message: string)Gas: 1
Syscall: 304
transfer
Transfers an asset from the current contract to an account.
transfer(destination: Address, amount: u64, asset: Hash) ⟶ boolGas: 500
Syscall: 480
transfer_contract
Transfers an asset from the current contract to another contract.
transfer_contract(contract: Hash, amount: u64, asset: Hash) ⟶ boolGas: 250
Syscall: 481
transfer_payload
Transfers an asset to an account with an attached payload.
transfer_payload(destination: Address, amount: u64, asset: Hash, payload: any) ⟶ boolGas: 550
Syscall: 502
xor_hashes
Returns the bytewise XOR of two hashes.
xor_hashes(hash1: Hash, hash2: Hash) ⟶ HashGas: 50
Syscall: 493
u8
u8::from_be_bytes
Builds a U8 value from be-endian bytes.
u8::from_be_bytes(bytes: bytes) ⟶ u8Gas: 10
Syscall: 178
u8::from_le_bytes
Builds a U8 value from le-endian bytes.
u8::from_le_bytes(bytes: bytes) ⟶ u8Gas: 10
Syscall: 179
checked_add
Returns the checked add result for U8 as an optional value.
checked_add(other: u8) ⟶ optional<u8>Gas: 1
Syscall: 62
checked_div
Returns the checked division result for U8 as an optional value, failing on division by zero.
checked_div(other: u8) ⟶ optional<u8>Gas: 8
Syscall: 65
checked_mul
Returns the checked mul result for U8 as an optional value.
checked_mul(other: u8) ⟶ optional<u8>Gas: 3
Syscall: 64
checked_pow
Returns the checked pow result for U8 as an optional value.
checked_pow(other: u32) ⟶ optional<u8>Gas: 50
Syscall: 67
checked_rem
Returns the checked remainder result for U8 as an optional value, failing on division by zero.
checked_rem(other: u8) ⟶ optional<u8>Gas: 8
Syscall: 66
checked_shl
Returns the checked shl result for U8 as an optional value.
checked_shl(other: u32) ⟶ optional<u8>Gas: 5
Syscall: 69
checked_shr
Returns the checked shr result for U8 as an optional value.
checked_shr(other: u32) ⟶ optional<u8>Gas: 5
Syscall: 68
checked_sub
Returns the checked sub result for U8 as an optional value.
checked_sub(other: u8) ⟶ optional<u8>Gas: 1
Syscall: 63
count_ones
Returns count_ones for this U8 value.
count_ones() ⟶ u32Gas: 3
Syscall: 202
count_zeros
Returns count_zeros for this U8 value.
count_zeros() ⟶ u32Gas: 3
Syscall: 205
leading_ones
Returns leading_ones for this U8 value.
leading_ones() ⟶ u32Gas: 3
Syscall: 200
leading_zeros
Returns leading_zeros for this U8 value.
leading_zeros() ⟶ u32Gas: 3
Syscall: 203
max
Returns the larger of this U8 value and another.
max(other: u8) ⟶ u8Gas: 1
Syscall: 261
min
Returns the smaller of this U8 value and another.
min(other: u8) ⟶ u8Gas: 1
Syscall: 260
pow
Returns the pow result for U8.
pow(other: u32) ⟶ u8Gas: 50
Syscall: 208
reverse_bits
Returns this U8 value with its bits reversed.
reverse_bits() ⟶ u8Gas: 10
Syscall: 254
rotate_left
Returns the rotate_left result for U8.
rotate_left(other: u32) ⟶ u8Gas: 20
Syscall: 206
rotate_right
Returns the rotate_right result for U8.
rotate_right(other: u32) ⟶ u8Gas: 20
Syscall: 207
saturating_add
Returns the saturating_add result for U8.
saturating_add(other: u8) ⟶ u8Gas: 1
Syscall: 110
saturating_div
Returns the saturating division result for U8, failing on division by zero.
saturating_div(other: u8) ⟶ u8Gas: 3
Syscall: 113
saturating_mul
Returns the saturating_mul result for U8.
saturating_mul(other: u8) ⟶ u8Gas: 3
Syscall: 112
saturating_pow
Returns the saturating_pow result for U8.
saturating_pow(other: u32) ⟶ u8Gas: 50
Syscall: 114
saturating_sub
Returns the saturating_sub result for U8.
saturating_sub(other: u8) ⟶ u8Gas: 1
Syscall: 111
sqrt
Returns the integer square root of this U8 value.
sqrt() ⟶ u8Gas: 10
Syscall: 293
to_be_bytes
Converts this U8 value to its be-endian byte representation.
to_be_bytes() ⟶ bytesGas: 10
Syscall: 176
to_le_bytes
Converts this U8 value to its le-endian byte representation.
to_le_bytes() ⟶ bytesGas: 10
Syscall: 177
to_string
Converts this U8 value to a string in the requested base.
to_string(base: u32) ⟶ stringGas: 1
Syscall: 272
trailing_ones
Returns trailing_ones for this U8 value.
trailing_ones() ⟶ u32Gas: 3
Syscall: 201
trailing_zeros
Returns trailing_zeros for this U8 value.
trailing_zeros() ⟶ u32Gas: 3
Syscall: 204
wrapping_add
Returns the wrapping_add result for U8.
wrapping_add(other: u8) ⟶ u8Gas: 1
Syscall: 140
wrapping_div
Returns the wrapping division result for U8, failing on division by zero.
wrapping_div(other: u8) ⟶ u8Gas: 3
Syscall: 143
wrapping_mul
Returns the wrapping_mul result for U8.
wrapping_mul(other: u8) ⟶ u8Gas: 3
Syscall: 142
wrapping_pow
Returns the wrapping_pow result for U8.
wrapping_pow(other: u32) ⟶ u8Gas: 50
Syscall: 145
wrapping_rem
Returns the wrapping remainder result for U8, failing on division by zero.
wrapping_rem(other: u8) ⟶ u8Gas: 3
Syscall: 144
wrapping_sub
Returns the wrapping_sub result for U8.
wrapping_sub(other: u8) ⟶ u8Gas: 1
Syscall: 141
u16
u16::from_be_bytes
Builds a U16 value from be-endian bytes.
u16::from_be_bytes(bytes: bytes) ⟶ u16Gas: 10
Syscall: 182
u16::from_le_bytes
Builds a U16 value from le-endian bytes.
u16::from_le_bytes(bytes: bytes) ⟶ u16Gas: 10
Syscall: 183
checked_add
Returns the checked add result for U16 as an optional value.
checked_add(other: u16) ⟶ optional<u16>Gas: 1
Syscall: 70
checked_div
Returns the checked division result for U16 as an optional value, failing on division by zero.
checked_div(other: u16) ⟶ optional<u16>Gas: 8
Syscall: 73
checked_mul
Returns the checked mul result for U16 as an optional value.
checked_mul(other: u16) ⟶ optional<u16>Gas: 3
Syscall: 72
checked_pow
Returns the checked pow result for U16 as an optional value.
checked_pow(other: u32) ⟶ optional<u16>Gas: 50
Syscall: 75
checked_rem
Returns the checked remainder result for U16 as an optional value, failing on division by zero.
checked_rem(other: u16) ⟶ optional<u16>Gas: 8
Syscall: 74
checked_shl
Returns the checked shl result for U16 as an optional value.
checked_shl(other: u32) ⟶ optional<u16>Gas: 5
Syscall: 77
checked_shr
Returns the checked shr result for U16 as an optional value.
checked_shr(other: u32) ⟶ optional<u16>Gas: 5
Syscall: 76
checked_sub
Returns the checked sub result for U16 as an optional value.
checked_sub(other: u16) ⟶ optional<u16>Gas: 1
Syscall: 71
count_ones
Returns count_ones for this U16 value.
count_ones() ⟶ u32Gas: 3
Syscall: 211
count_zeros
Returns count_zeros for this U16 value.
count_zeros() ⟶ u32Gas: 3
Syscall: 214
leading_ones
Returns leading_ones for this U16 value.
leading_ones() ⟶ u32Gas: 3
Syscall: 209
leading_zeros
Returns leading_zeros for this U16 value.
leading_zeros() ⟶ u32Gas: 3
Syscall: 212
max
Returns the larger of this U16 value and another.
max(other: u16) ⟶ u16Gas: 1
Syscall: 263
min
Returns the smaller of this U16 value and another.
min(other: u16) ⟶ u16Gas: 1
Syscall: 262
pow
Returns the pow result for U16.
pow(other: u32) ⟶ u16Gas: 50
Syscall: 217
reverse_bits
Returns this U16 value with its bits reversed.
reverse_bits() ⟶ u16Gas: 10
Syscall: 255
rotate_left
Returns the rotate_left result for U16.
rotate_left(other: u32) ⟶ u16Gas: 20
Syscall: 215
rotate_right
Returns the rotate_right result for U16.
rotate_right(other: u32) ⟶ u16Gas: 20
Syscall: 216
saturating_add
Returns the saturating_add result for U16.
saturating_add(other: u16) ⟶ u16Gas: 1
Syscall: 115
saturating_div
Returns the saturating division result for U16, failing on division by zero.
saturating_div(other: u16) ⟶ u16Gas: 3
Syscall: 118
saturating_mul
Returns the saturating_mul result for U16.
saturating_mul(other: u16) ⟶ u16Gas: 3
Syscall: 117
saturating_pow
Returns the saturating_pow result for U16.
saturating_pow(other: u32) ⟶ u16Gas: 50
Syscall: 119
saturating_sub
Returns the saturating_sub result for U16.
saturating_sub(other: u16) ⟶ u16Gas: 1
Syscall: 116
sqrt
Returns the integer square root of this U16 value.
sqrt() ⟶ u16Gas: 10
Syscall: 294
to_be_bytes
Converts this U16 value to its be-endian byte representation.
to_be_bytes() ⟶ bytesGas: 10
Syscall: 180
to_le_bytes
Converts this U16 value to its le-endian byte representation.
to_le_bytes() ⟶ bytesGas: 10
Syscall: 181
to_string
Converts this U16 value to a string in the requested base.
to_string(base: u32) ⟶ stringGas: 1
Syscall: 273
trailing_ones
Returns trailing_ones for this U16 value.
trailing_ones() ⟶ u32Gas: 3
Syscall: 210
trailing_zeros
Returns trailing_zeros for this U16 value.
trailing_zeros() ⟶ u32Gas: 3
Syscall: 213
wrapping_add
Returns the wrapping_add result for U16.
wrapping_add(other: u16) ⟶ u16Gas: 1
Syscall: 146
wrapping_div
Returns the wrapping division result for U16, failing on division by zero.
wrapping_div(other: u16) ⟶ u16Gas: 3
Syscall: 149
wrapping_mul
Returns the wrapping_mul result for U16.
wrapping_mul(other: u16) ⟶ u16Gas: 3
Syscall: 148
wrapping_pow
Returns the wrapping_pow result for U16.
wrapping_pow(other: u32) ⟶ u16Gas: 50
Syscall: 151
wrapping_rem
Returns the wrapping remainder result for U16, failing on division by zero.
wrapping_rem(other: u16) ⟶ u16Gas: 3
Syscall: 150
wrapping_sub
Returns the wrapping_sub result for U16.
wrapping_sub(other: u16) ⟶ u16Gas: 1
Syscall: 147
u32
u32::from_be_bytes
Builds a U32 value from be-endian bytes.
u32::from_be_bytes(bytes: bytes) ⟶ u32Gas: 10
Syscall: 186
u32::from_le_bytes
Builds a U32 value from le-endian bytes.
u32::from_le_bytes(bytes: bytes) ⟶ u32Gas: 10
Syscall: 187
checked_add
Returns the checked add result for U32 as an optional value.
checked_add(other: u32) ⟶ optional<u32>Gas: 1
Syscall: 78
checked_div
Returns the checked division result for U32 as an optional value, failing on division by zero.
checked_div(other: u32) ⟶ optional<u32>Gas: 8
Syscall: 81
checked_mul
Returns the checked mul result for U32 as an optional value.
checked_mul(other: u32) ⟶ optional<u32>Gas: 3
Syscall: 80
checked_pow
Returns the checked pow result for U32 as an optional value.
checked_pow(other: u32) ⟶ optional<u32>Gas: 50
Syscall: 83
checked_rem
Returns the checked remainder result for U32 as an optional value, failing on division by zero.
checked_rem(other: u32) ⟶ optional<u32>Gas: 8
Syscall: 82
checked_shl
Returns the checked shl result for U32 as an optional value.
checked_shl(other: u32) ⟶ optional<u32>Gas: 5
Syscall: 85
checked_shr
Returns the checked shr result for U32 as an optional value.
checked_shr(other: u32) ⟶ optional<u32>Gas: 5
Syscall: 84
checked_sub
Returns the checked sub result for U32 as an optional value.
checked_sub(other: u32) ⟶ optional<u32>Gas: 1
Syscall: 79
count_ones
Returns count_ones for this U32 value.
count_ones() ⟶ u32Gas: 3
Syscall: 220
count_zeros
Returns count_zeros for this U32 value.
count_zeros() ⟶ u32Gas: 3
Syscall: 223
leading_ones
Returns leading_ones for this U32 value.
leading_ones() ⟶ u32Gas: 3
Syscall: 218
leading_zeros
Returns leading_zeros for this U32 value.
leading_zeros() ⟶ u32Gas: 3
Syscall: 221
max
Returns the larger of this U32 value and another.
max(other: u32) ⟶ u32Gas: 1
Syscall: 265
min
Returns the smaller of this U32 value and another.
min(other: u32) ⟶ u32Gas: 1
Syscall: 264
pow
Returns the pow result for U32.
pow(other: u32) ⟶ u32Gas: 50
Syscall: 226
reverse_bits
Returns this U32 value with its bits reversed.
reverse_bits() ⟶ u32Gas: 10
Syscall: 256
rotate_left
Returns the rotate_left result for U32.
rotate_left(other: u32) ⟶ u32Gas: 20
Syscall: 224
rotate_right
Returns the rotate_right result for U32.
rotate_right(other: u32) ⟶ u32Gas: 20
Syscall: 225
saturating_add
Returns the saturating_add result for U32.
saturating_add(other: u32) ⟶ u32Gas: 1
Syscall: 120
saturating_div
Returns the saturating division result for U32, failing on division by zero.
saturating_div(other: u32) ⟶ u32Gas: 3
Syscall: 123
saturating_mul
Returns the saturating_mul result for U32.
saturating_mul(other: u32) ⟶ u32Gas: 3
Syscall: 122
saturating_pow
Returns the saturating_pow result for U32.
saturating_pow(other: u32) ⟶ u32Gas: 50
Syscall: 124
saturating_sub
Returns the saturating_sub result for U32.
saturating_sub(other: u32) ⟶ u32Gas: 1
Syscall: 121
sqrt
Returns the integer square root of this U32 value.
sqrt() ⟶ u32Gas: 10
Syscall: 295
to_be_bytes
Converts this U32 value to its be-endian byte representation.
to_be_bytes() ⟶ bytesGas: 10
Syscall: 184
to_le_bytes
Converts this U32 value to its le-endian byte representation.
to_le_bytes() ⟶ bytesGas: 10
Syscall: 185
to_string
Converts this U32 value to a string in the requested base.
to_string(base: u32) ⟶ stringGas: 1
Syscall: 274
trailing_ones
Returns trailing_ones for this U32 value.
trailing_ones() ⟶ u32Gas: 3
Syscall: 219
trailing_zeros
Returns trailing_zeros for this U32 value.
trailing_zeros() ⟶ u32Gas: 3
Syscall: 222
wrapping_add
Returns the wrapping_add result for U32.
wrapping_add(other: u32) ⟶ u32Gas: 1
Syscall: 152
wrapping_div
Returns the wrapping division result for U32, failing on division by zero.
wrapping_div(other: u32) ⟶ u32Gas: 3
Syscall: 155
wrapping_mul
Returns the wrapping_mul result for U32.
wrapping_mul(other: u32) ⟶ u32Gas: 3
Syscall: 154
wrapping_pow
Returns the wrapping_pow result for U32.
wrapping_pow(other: u32) ⟶ u32Gas: 50
Syscall: 157
wrapping_rem
Returns the wrapping remainder result for U32, failing on division by zero.
wrapping_rem(other: u32) ⟶ u32Gas: 3
Syscall: 156
wrapping_sub
Returns the wrapping_sub result for U32.
wrapping_sub(other: u32) ⟶ u32Gas: 1
Syscall: 153
u64
u64::from_be_bytes
Builds a U64 value from be-endian bytes.
u64::from_be_bytes(bytes: bytes) ⟶ u64Gas: 10
Syscall: 190
u64::from_le_bytes
Builds a U64 value from le-endian bytes.
u64::from_le_bytes(bytes: bytes) ⟶ u64Gas: 10
Syscall: 191
checked_add
Returns the checked add result for U64 as an optional value.
checked_add(other: u64) ⟶ optional<u64>Gas: 1
Syscall: 86
checked_div
Returns the checked division result for U64 as an optional value, failing on division by zero.
checked_div(other: u64) ⟶ optional<u64>Gas: 8
Syscall: 89
checked_mul
Returns the checked mul result for U64 as an optional value.
checked_mul(other: u64) ⟶ optional<u64>Gas: 3
Syscall: 88
checked_pow
Returns the checked pow result for U64 as an optional value.
checked_pow(other: u32) ⟶ optional<u64>Gas: 50
Syscall: 91
checked_rem
Returns the checked remainder result for U64 as an optional value, failing on division by zero.
checked_rem(other: u64) ⟶ optional<u64>Gas: 8
Syscall: 90
checked_shl
Returns the checked shl result for U64 as an optional value.
checked_shl(other: u32) ⟶ optional<u64>Gas: 5
Syscall: 93
checked_shr
Returns the checked shr result for U64 as an optional value.
checked_shr(other: u32) ⟶ optional<u64>Gas: 5
Syscall: 92
checked_sub
Returns the checked sub result for U64 as an optional value.
checked_sub(other: u64) ⟶ optional<u64>Gas: 1
Syscall: 87
count_ones
Returns count_ones for this U64 value.
count_ones() ⟶ u32Gas: 3
Syscall: 229
count_zeros
Returns count_zeros for this U64 value.
count_zeros() ⟶ u32Gas: 3
Syscall: 232
leading_ones
Returns leading_ones for this U64 value.
leading_ones() ⟶ u32Gas: 3
Syscall: 227
leading_zeros
Returns leading_zeros for this U64 value.
leading_zeros() ⟶ u32Gas: 3
Syscall: 230
max
Returns the larger of this U64 value and another.
max(other: u64) ⟶ u64Gas: 1
Syscall: 267
min
Returns the smaller of this U64 value and another.
min(other: u64) ⟶ u64Gas: 1
Syscall: 266
pow
Returns the pow result for U64.
pow(other: u32) ⟶ u64Gas: 50
Syscall: 235
reverse_bits
Returns this U64 value with its bits reversed.
reverse_bits() ⟶ u64Gas: 10
Syscall: 257
rotate_left
Returns the rotate_left result for U64.
rotate_left(other: u32) ⟶ u64Gas: 20
Syscall: 233
rotate_right
Returns the rotate_right result for U64.
rotate_right(other: u32) ⟶ u64Gas: 20
Syscall: 234
saturating_add
Returns the saturating_add result for U64.
saturating_add(other: u64) ⟶ u64Gas: 1
Syscall: 125
saturating_div
Returns the saturating division result for U64, failing on division by zero.
saturating_div(other: u64) ⟶ u64Gas: 3
Syscall: 128
saturating_mul
Returns the saturating_mul result for U64.
saturating_mul(other: u64) ⟶ u64Gas: 3
Syscall: 127
saturating_pow
Returns the saturating_pow result for U64.
saturating_pow(other: u32) ⟶ u64Gas: 50
Syscall: 129
saturating_sub
Returns the saturating_sub result for U64.
saturating_sub(other: u64) ⟶ u64Gas: 1
Syscall: 126
sqrt
Returns the integer square root of this U64 value.
sqrt() ⟶ u64Gas: 10
Syscall: 296
to_be_bytes
Converts this U64 value to its be-endian byte representation.
to_be_bytes() ⟶ bytesGas: 10
Syscall: 188
to_le_bytes
Converts this U64 value to its le-endian byte representation.
to_le_bytes() ⟶ bytesGas: 10
Syscall: 189
to_string
Converts this U64 value to a string in the requested base.
to_string(base: u32) ⟶ stringGas: 1
Syscall: 275
trailing_ones
Returns trailing_ones for this U64 value.
trailing_ones() ⟶ u32Gas: 3
Syscall: 228
trailing_zeros
Returns trailing_zeros for this U64 value.
trailing_zeros() ⟶ u32Gas: 3
Syscall: 231
wrapping_add
Returns the wrapping_add result for U64.
wrapping_add(other: u64) ⟶ u64Gas: 1
Syscall: 158
wrapping_div
Returns the wrapping division result for U64, failing on division by zero.
wrapping_div(other: u64) ⟶ u64Gas: 3
Syscall: 161
wrapping_mul
Returns the wrapping_mul result for U64.
wrapping_mul(other: u64) ⟶ u64Gas: 3
Syscall: 160
wrapping_pow
Returns the wrapping_pow result for U64.
wrapping_pow(other: u32) ⟶ u64Gas: 50
Syscall: 163
wrapping_rem
Returns the wrapping remainder result for U64, failing on division by zero.
wrapping_rem(other: u64) ⟶ u64Gas: 3
Syscall: 162
wrapping_sub
Returns the wrapping_sub result for U64.
wrapping_sub(other: u64) ⟶ u64Gas: 1
Syscall: 159
u128
u128::from_be_bytes
Builds a U128 value from be-endian bytes.
u128::from_be_bytes(bytes: bytes) ⟶ u128Gas: 10
Syscall: 194
u128::from_le_bytes
Builds a U128 value from le-endian bytes.
u128::from_le_bytes(bytes: bytes) ⟶ u128Gas: 10
Syscall: 195
checked_add
Returns the checked add result for U128 as an optional value.
checked_add(other: u128) ⟶ optional<u128>Gas: 1
Syscall: 94
checked_div
Returns the checked division result for U128 as an optional value, failing on division by zero.
checked_div(other: u128) ⟶ optional<u128>Gas: 8
Syscall: 97
checked_mul
Returns the checked mul result for U128 as an optional value.
checked_mul(other: u128) ⟶ optional<u128>Gas: 3
Syscall: 96
checked_pow
Returns the checked pow result for U128 as an optional value.
checked_pow(other: u32) ⟶ optional<u128>Gas: 50
Syscall: 99
checked_rem
Returns the checked remainder result for U128 as an optional value, failing on division by zero.
checked_rem(other: u128) ⟶ optional<u128>Gas: 8
Syscall: 98
checked_shl
Returns the checked shl result for U128 as an optional value.
checked_shl(other: u32) ⟶ optional<u128>Gas: 5
Syscall: 101
checked_shr
Returns the checked shr result for U128 as an optional value.
checked_shr(other: u32) ⟶ optional<u128>Gas: 5
Syscall: 100
checked_sub
Returns the checked sub result for U128 as an optional value.
checked_sub(other: u128) ⟶ optional<u128>Gas: 1
Syscall: 95
count_ones
Returns count_ones for this U128 value.
count_ones() ⟶ u32Gas: 3
Syscall: 238
count_zeros
Returns count_zeros for this U128 value.
count_zeros() ⟶ u32Gas: 3
Syscall: 241
leading_ones
Returns leading_ones for this U128 value.
leading_ones() ⟶ u32Gas: 3
Syscall: 236
leading_zeros
Returns leading_zeros for this U128 value.
leading_zeros() ⟶ u32Gas: 3
Syscall: 239
max
Returns the larger of this U128 value and another.
max(other: u128) ⟶ u128Gas: 1
Syscall: 269
min
Returns the smaller of this U128 value and another.
min(other: u128) ⟶ u128Gas: 1
Syscall: 268
pow
Returns the pow result for U128.
pow(other: u32) ⟶ u128Gas: 50
Syscall: 244
reverse_bits
Returns this U128 value with its bits reversed.
reverse_bits() ⟶ u128Gas: 10
Syscall: 258
rotate_left
Returns the rotate_left result for U128.
rotate_left(other: u32) ⟶ u128Gas: 20
Syscall: 242
rotate_right
Returns the rotate_right result for U128.
rotate_right(other: u32) ⟶ u128Gas: 20
Syscall: 243
saturating_add
Returns the saturating_add result for U128.
saturating_add(other: u128) ⟶ u128Gas: 1
Syscall: 130
saturating_div
Returns the saturating division result for U128, failing on division by zero.
saturating_div(other: u128) ⟶ u128Gas: 3
Syscall: 133
saturating_mul
Returns the saturating_mul result for U128.
saturating_mul(other: u128) ⟶ u128Gas: 3
Syscall: 132
saturating_pow
Returns the saturating_pow result for U128.
saturating_pow(other: u32) ⟶ u128Gas: 50
Syscall: 134
saturating_sub
Returns the saturating_sub result for U128.
saturating_sub(other: u128) ⟶ u128Gas: 1
Syscall: 131
sqrt
Returns the integer square root of this U128 value.
sqrt() ⟶ u128Gas: 10
Syscall: 297
to_be_bytes
Converts this U128 value to its be-endian byte representation.
to_be_bytes() ⟶ bytesGas: 10
Syscall: 192
to_le_bytes
Converts this U128 value to its le-endian byte representation.
to_le_bytes() ⟶ bytesGas: 10
Syscall: 193
to_string
Converts this U128 value to a string in the requested base.
to_string(base: u32) ⟶ stringGas: 1
Syscall: 276
trailing_ones
Returns trailing_ones for this U128 value.
trailing_ones() ⟶ u32Gas: 3
Syscall: 237
trailing_zeros
Returns trailing_zeros for this U128 value.
trailing_zeros() ⟶ u32Gas: 3
Syscall: 240
wrapping_add
Returns the wrapping_add result for U128.
wrapping_add(other: u128) ⟶ u128Gas: 1
Syscall: 164
wrapping_div
Returns the wrapping division result for U128, failing on division by zero.
wrapping_div(other: u128) ⟶ u128Gas: 3
Syscall: 167
wrapping_mul
Returns the wrapping_mul result for U128.
wrapping_mul(other: u128) ⟶ u128Gas: 3
Syscall: 166
wrapping_pow
Returns the wrapping_pow result for U128.
wrapping_pow(other: u32) ⟶ u128Gas: 50
Syscall: 169
wrapping_rem
Returns the wrapping remainder result for U128, failing on division by zero.
wrapping_rem(other: u128) ⟶ u128Gas: 3
Syscall: 168
wrapping_sub
Returns the wrapping_sub result for U128.
wrapping_sub(other: u128) ⟶ u128Gas: 1
Syscall: 165
u256
u256::from_be_bytes
Builds a U256 value from be-endian bytes.
u256::from_be_bytes(bytes: bytes) ⟶ u256Gas: 10
Syscall: 198
u256::from_le_bytes
Builds a U256 value from le-endian bytes.
u256::from_le_bytes(bytes: bytes) ⟶ u256Gas: 10
Syscall: 199
checked_add
Returns the checked add result for U256 as an optional value.
checked_add(other: u256) ⟶ optional<u256>Gas: 1
Syscall: 102
checked_div
Returns the checked division result for U256 as an optional value, failing on division by zero.
checked_div(other: u256) ⟶ optional<u256>Gas: 8
Syscall: 105
checked_mul
Returns the checked mul result for U256 as an optional value.
checked_mul(other: u256) ⟶ optional<u256>Gas: 3
Syscall: 104
checked_pow
Returns the checked pow result for U256 as an optional value.
checked_pow(other: u32) ⟶ optional<u256>Gas: 50
Syscall: 107
checked_rem
Returns the checked remainder result for U256 as an optional value, failing on division by zero.
checked_rem(other: u256) ⟶ optional<u256>Gas: 8
Syscall: 106
checked_shl
Returns the checked shl result for U256 as an optional value.
checked_shl(other: u32) ⟶ optional<u256>Gas: 5
Syscall: 109
checked_shr
Returns the checked shr result for U256 as an optional value.
checked_shr(other: u32) ⟶ optional<u256>Gas: 5
Syscall: 108
checked_sub
Returns the checked sub result for U256 as an optional value.
checked_sub(other: u256) ⟶ optional<u256>Gas: 1
Syscall: 103
count_ones
Returns count_ones for this U256 value.
count_ones() ⟶ u32Gas: 3
Syscall: 247
count_zeros
Returns count_zeros for this U256 value.
count_zeros() ⟶ u32Gas: 3
Syscall: 250
leading_ones
Returns leading_ones for this U256 value.
leading_ones() ⟶ u32Gas: 3
Syscall: 245
leading_zeros
Returns leading_zeros for this U256 value.
leading_zeros() ⟶ u32Gas: 3
Syscall: 248
max
Returns the larger of this U256 value and another.
max(other: u256) ⟶ u256Gas: 1
Syscall: 271
min
Returns the smaller of this U256 value and another.
min(other: u256) ⟶ u256Gas: 1
Syscall: 270
pow
Returns the pow result for U256.
pow(other: u32) ⟶ u256Gas: 50
Syscall: 253
reverse_bits
Returns this U256 value with its bits reversed.
reverse_bits() ⟶ u256Gas: 10
Syscall: 259
rotate_left
Returns the rotate_left result for U256.
rotate_left(other: u32) ⟶ u256Gas: 20
Syscall: 251
rotate_right
Returns the rotate_right result for U256.
rotate_right(other: u32) ⟶ u256Gas: 20
Syscall: 252
saturating_add
Returns the saturating_add result for U256.
saturating_add(other: u256) ⟶ u256Gas: 1
Syscall: 135
saturating_div
Returns the saturating division result for U256, failing on division by zero.
saturating_div(other: u256) ⟶ u256Gas: 3
Syscall: 138
saturating_mul
Returns the saturating_mul result for U256.
saturating_mul(other: u256) ⟶ u256Gas: 3
Syscall: 137
saturating_pow
Returns the saturating_pow result for U256.
saturating_pow(other: u32) ⟶ u256Gas: 50
Syscall: 139
saturating_sub
Returns the saturating_sub result for U256.
saturating_sub(other: u256) ⟶ u256Gas: 1
Syscall: 136
sqrt
Returns the integer square root of this U256 value.
sqrt() ⟶ u256Gas: 10
Syscall: 298
to_be_bytes
Converts this U256 value to its be-endian byte representation.
to_be_bytes() ⟶ bytesGas: 10
Syscall: 196
to_le_bytes
Converts this U256 value to its le-endian byte representation.
to_le_bytes() ⟶ bytesGas: 10
Syscall: 197
to_string
Converts this U256 value to a string in the requested base.
to_string(base: u32) ⟶ stringGas: 3
Syscall: 277
trailing_ones
Returns trailing_ones for this U256 value.
trailing_ones() ⟶ u32Gas: 3
Syscall: 246
trailing_zeros
Returns trailing_zeros for this U256 value.
trailing_zeros() ⟶ u32Gas: 3
Syscall: 249
wrapping_add
Returns the wrapping_add result for U256.
wrapping_add(other: u256) ⟶ u256Gas: 1
Syscall: 170
wrapping_div
Returns the wrapping division result for U256, failing on division by zero.
wrapping_div(other: u256) ⟶ u256Gas: 3
Syscall: 173
wrapping_mul
Returns the wrapping_mul result for U256.
wrapping_mul(other: u256) ⟶ u256Gas: 3
Syscall: 172
wrapping_pow
Returns the wrapping_pow result for U256.
wrapping_pow(other: u32) ⟶ u256Gas: 50
Syscall: 175
wrapping_rem
Returns the wrapping remainder result for U256, failing on division by zero.
wrapping_rem(other: u256) ⟶ u256Gas: 3
Syscall: 174
wrapping_sub
Returns the wrapping_sub result for U256.
wrapping_sub(other: u256) ⟶ u256Gas: 1
Syscall: 171
u8[]
to_bytes
Converts an array of u8 values into bytes.
to_bytes() ⟶ bytesGas: 1
Syscall: 16
String
String::from_utf8
Builds a string from UTF-8 bytes, returning null when the bytes are invalid.
String::from_utf8(bytes: bytes) ⟶ optional<string>Gas: 5
Syscall: 60
String::from_utf8_lossy
Builds a string from bytes, replacing invalid UTF-8 sequences.
String::from_utf8_lossy(bytes: bytes) ⟶ stringGas: 5
Syscall: 61
char_at
Returns the character at the character index as a one-character string, or null if out of bounds.
char_at(index: u32) ⟶ optional<string>Gas: 1
Syscall: 55
contains
Returns true when the string contains the substring.
contains(substring: string) ⟶ boolGas: 1
Syscall: 44
contains_ignore_case
Returns true when the string contains the substring, ignoring case.
contains_ignore_case(substring: string) ⟶ boolGas: 1
Syscall: 45
ends_with
Returns true when the string ends with the suffix.
ends_with(suffix: string) ⟶ boolGas: 3
Syscall: 53
index_of
Returns the first byte index of the substring, or null if it is absent.
index_of(substring: string) ⟶ optional<u32>Gas: 3
Syscall: 49
is_empty
Returns true when the string has no bytes.
is_empty() ⟶ boolGas: 1
Syscall: 56
last_index_of
Returns the last byte index of the substring, or null if it is absent.
last_index_of(substring: string) ⟶ optional<u32>Gas: 3
Syscall: 50
len
Returns the byte length of the string.
len() ⟶ u32Gas: 1
Syscall: 42
matches
Returns all non-overlapping matches of the pattern.
matches(pattern: string) ⟶ string[]Gas: 50
Syscall: 57
replace
Returns a copy with every occurrence of one substring replaced by another.
replace(from: string, to: string) ⟶ stringGas: 5
Syscall: 51
split
Splits the string by the separator and returns the parts.
split(separator: string) ⟶ string[]Gas: 5
Syscall: 54
starts_with
Returns true when the string starts with the prefix.
starts_with(prefix: string) ⟶ boolGas: 3
Syscall: 52
substring
Returns the substring from the byte index to the end, or null if the index is invalid.
substring(start: u32) ⟶ optional<string>Gas: 3
Syscall: 58
substring_range
Returns the substring in the byte range, or null if the range is invalid.
substring_range(start: u32, end: u32) ⟶ optional<string>Gas: 3
Syscall: 59
to_bytes
Returns the UTF-8 bytes of the string.
to_bytes() ⟶ bytesGas: 5
Syscall: 48
to_lowercase
Returns a lowercase copy of the string.
to_lowercase() ⟶ stringGas: 1
Syscall: 47
to_uppercase
Returns an uppercase copy of the string.
to_uppercase() ⟶ stringGas: 1
Syscall: 46
trim
Returns a copy of the string without leading or trailing whitespace.
trim() ⟶ stringGas: 1
Syscall: 43
Bytes
Bytes::from_hex
Decodes a hexadecimal string into bytes.
Bytes::from_hex(hex_string: string) ⟶ bytesGas: 1
Syscall: 35
contains
Returns true when the byte sequence contains the byte.
contains(byte: u8) ⟶ boolGas: 10
Syscall: 26
extend
Appends another byte sequence to the end.
extend(other: bytes)Gas: 5
Syscall: 32
first
Returns the first byte, or null when empty.
first() ⟶ optional<u8>Gas: 1
Syscall: 28
get
Returns the byte at the index, or null if out of bounds.
get(index: u32) ⟶ optional<u8>Gas: 1
Syscall: 27
last
Returns the last byte, or null when empty.
last() ⟶ optional<u8>Gas: 1
Syscall: 29
len
Returns the number of bytes.
len() ⟶ u32Gas: 1
Syscall: 21
pop
Removes and returns the last byte, or null when empty.
pop() ⟶ optional<u8>Gas: 1
Syscall: 24
push
Appends one byte to the end.
push(byte: u8)Gas: 2
Syscall: 22
remove
Removes and returns the byte at the index, shifting later bytes left.
remove(index: u32) ⟶ u8Gas: 5
Syscall: 23
slice
Returns a copy of the bytes in the range.
slice(range: range<u32>) ⟶ bytesGas: 5
Syscall: 25
split_off
Splits the bytes at the index, keeping the first part and returning the second.
split_off(index: u32) ⟶ bytesGas: 5
Syscall: 31
to_array
Converts the bytes to an array of u8 values.
to_array() ⟶ u8[]Gas: 1
Syscall: 30
to_hex
Encodes the bytes as a lowercase hexadecimal string.
to_hex() ⟶ stringGas: 1
Syscall: 34
truncate
Shortens the byte sequence to the requested size.
truncate(size: u32)Gas: 5
Syscall: 33
Array
contains
Returns true when the array contains the element.
contains(element: T0) ⟶ boolGas: 10
Syscall: 8
extend
Appends all elements from another array.
extend(other: T0[])Gas: 5
Syscall: 12
first
Returns the first element, or null when empty.
first() ⟶ optional<T0>Gas: 1
Syscall: 10
get
Returns the element at the index, or null if out of bounds.
get(index: u32) ⟶ optional<T0>Gas: 1
Syscall: 9
index_of
Returns the first index of the element, or null when absent.
index_of(element: T0) ⟶ optional<u32>Gas: 5
Syscall: 5
insert
Inserts an element at the index, shifting later elements right.
insert(index: u32, element: T0)Gas: 5
Syscall: 4
iter
Creates an iterator over the array elements.
iter() ⟶ IteratorGas: 5
Syscall: 309
last
Returns the last element, or null when empty.
last() ⟶ optional<T0>Gas: 1
Syscall: 11
len
Returns the number of elements in the array.
len() ⟶ u32Gas: 1
Syscall: 0
map
Calls the mapper for each element and returns the mapped values.
map(mapper: closure(T0) -> any) ⟶ any[]Gas: 10
Syscall: 19
pop
Removes and returns the last element, or null when empty.
pop() ⟶ optional<T0>Gas: 1
Syscall: 6
push
Appends an element to the end of the array.
push(element: T0)Gas: 2
Syscall: 1
remove
Removes and returns the element at the index, shifting later elements left.
remove(index: u32) ⟶ T0Gas: 5
Syscall: 2
reverse
Reverses the array in place.
reverse()Gas: 10
Syscall: 18
slice
Returns a shallow slice of the array for the range.
slice(range: range<u32>) ⟶ T0[]Gas: 5
Syscall: 7
sort
Sorts the array in ascending or descending order.
sort(ascending: bool)Gas: 20
Syscall: 17
sort_by_key
Sorts the array by keys returned from the key function.
sort_by_key(key_fn: closure(T0) -> any, ascending: bool)Gas: 30
Syscall: 20
split_off
Splits the array at the index, keeping the first part and returning the second.
split_off(index: u32) ⟶ T0[]Gas: 5
Syscall: 14
swap_remove
Removes and returns the element at the index by swapping in the last element.
swap_remove(index: u32) ⟶ T0Gas: 8
Syscall: 3
truncate
Shortens the array to the requested size.
truncate(size: u32)Gas: 5
Syscall: 15
Map
clear
Removes all entries from the map.
clear()Gas: 5
Syscall: 289
contains_key
Returns true when the map contains the key.
contains_key(key: T0) ⟶ boolGas: 15
Syscall: 284
entries
Returns all key-value pairs in insertion order.
entries() ⟶ (T0, T1)[]Gas: 40
Syscall: 292
get
Returns the value for the key, or null when absent.
get(key: T0) ⟶ optional<T1>Gas: 15
Syscall: 285
insert
Inserts a key-value pair and returns the previous value, or null.
insert(key: T0, value: T1) ⟶ optional<T1>Gas: 30
Syscall: 286
keys
Returns all keys in insertion order.
keys() ⟶ T0[]Gas: 20
Syscall: 290
len
Returns the number of entries in the map.
len() ⟶ u32Gas: 1
Syscall: 283
shift_remove
Removes a key while preserving map order and returns its value, or null.
shift_remove(key: T0) ⟶ optional<T1>Gas: 15
Syscall: 287
swap_remove
Removes a key by swapping with the last entry and returns its value, or null.
swap_remove(key: T0) ⟶ optional<T1>Gas: 15
Syscall: 288
values
Returns all values in insertion order.
values() ⟶ T1[]Gas: 20
Syscall: 291
Range
collect
Collects all values in the range into an array.
collect() ⟶ T0[]Gas: 20
Syscall: 279
contains
Returns true when the range contains the element.
contains(element: T0) ⟶ boolGas: 5
Syscall: 278
count
Returns the number of values in the range.
count() ⟶ T0Gas: 5
Syscall: 282
max
Returns the range upper bound.
max() ⟶ T0Gas: 1
Syscall: 280
min
Returns the range lower bound.
min() ⟶ T0Gas: 1
Syscall: 281
Optional
expect
Returns the contained value or fails with the provided message when it is null.
expect(message: string) ⟶ T0Gas: 1
Syscall: 40
is_none
Returns true when the optional value is null.
is_none() ⟶ boolGas: 1
Syscall: 36
is_some
Returns true when the optional value contains a value.
is_some() ⟶ boolGas: 1
Syscall: 37
unwrap
Returns the contained value or fails if it is null.
unwrap() ⟶ T0Gas: 1
Syscall: 38
unwrap_or
Returns the contained value or the provided default when it is null.
unwrap_or(default: T0) ⟶ T0Gas: 1
Syscall: 39
unwrap_or_else
Returns the contained value or calls the fallback closure when it is null.
unwrap_or_else(fn: closure() -> T0) ⟶ T0Gas: 2
Syscall: 41
Address
Address::from_bytes
Deserializes an address from bytes.
Address::from_bytes(bytes: bytes) ⟶ AddressGas: 75
Syscall: 365
Address::from_string
Parses an address from its string representation.
Address::from_string(address: string) ⟶ AddressGas: 350
Syscall: 364
is_mainnet
Returns whether the address targets mainnet.
is_mainnet() ⟶ boolGas: 5
Syscall: 360
to_bytes
Serializes the address to bytes.
to_bytes() ⟶ bytesGas: 5
Syscall: 361
to_point
Returns the address public key as a Ristretto point.
to_point() ⟶ RistrettoPointGas: 10
Syscall: 362
to_string
Encodes the address as a string.
to_string() ⟶ stringGas: 100
Syscall: 363
ArbitraryRangeProof
ArbitraryRangeProof::new
Creates an arbitrary range proof wrapper from its components.
ArbitraryRangeProof::new(max_value: u64, delta_commitment: RistrettoPoint, eq_commitment_proof: CommitmentEqualityProof, range_proof: RangeProof) ⟶ ArbitraryRangeProofGas: 500
Syscall: 446
commitment_eq_proof
Returns the commitment equality proof inside the arbitrary range proof.
commitment_eq_proof() ⟶ CommitmentEqualityProofGas: 250
Syscall: 449
delta_commitment
Returns the delta commitment for the arbitrary range proof.
delta_commitment() ⟶ RistrettoPointGas: 50
Syscall: 448
max_value
Returns the maximum value covered by the arbitrary range proof.
max_value() ⟶ u64Gas: 1
Syscall: 447
range_proof
Returns the range proof inside the arbitrary range proof.
range_proof() ⟶ RangeProofGas: 250
Syscall: 450
verify
Verifies the arbitrary range proof for the source ciphertext.
verify(source_pubkey: RistrettoPoint, source_ciphertext: Ciphertext, transcript: Transcript) ⟶ boolGas: 1600000
Syscall: 451
Asset
Asset::create
Creates a new asset owned by the current contract.
Asset::create(id: u64, name: string, ticker: string, decimals: u8, max_supply: MaxSupplyMode) ⟶ optional<Asset>Gas: 2500
Syscall: 387
Asset::get_by_hash
Returns an asset by hash, if it exists.
Asset::get_by_hash(hash: Hash) ⟶ optional<Asset>Gas: 500
Syscall: 388
Asset::get_by_id
Returns an asset by local id, if it exists.
Asset::get_by_id(id: u64) ⟶ optional<Asset>Gas: 1000
Syscall: 386
get_contract_hash
Returns the contract hash that owns the asset, if any.
get_contract_hash() ⟶ optional<Hash>Gas: 5
Syscall: 400
get_creator
Returns the creator contract hash for the asset, if any.
get_creator() ⟶ optional<Hash>Gas: 5
Syscall: 396
get_creator_id
Returns the creator contract id for the asset, if any.
get_creator_id() ⟶ optional<u64>Gas: 5
Syscall: 395
get_decimals
Returns the decimal precision for the asset.
get_decimals() ⟶ u8Gas: 3
Syscall: 503
get_hash
Returns the asset hash.
get_hash() ⟶ HashGas: 5
Syscall: 393
get_id
Returns the contract id that owns the asset, if any.
get_id() ⟶ optional<u64>Gas: 5
Syscall: 401
get_max_supply
Returns the configured maximum supply for the asset, if any.
get_max_supply() ⟶ optional<u64>Gas: 5
Syscall: 389
get_name
Returns the self-declared asset name.
get_name() ⟶ stringGas: 5
Syscall: 391
get_owner
Returns the current owner contract hash for the asset, if any.
get_owner() ⟶ optional<Hash>Gas: 5
Syscall: 394
get_supply
Returns the current circulating supply for the asset.
get_supply() ⟶ u64Gas: 15
Syscall: 390
get_ticker
Returns the asset ticker.
get_ticker() ⟶ stringGas: 5
Syscall: 392
is_mintable
Returns whether the asset supply can still be minted.
is_mintable() ⟶ boolGas: 5
Syscall: 399
is_read_only
Returns whether the current contract can only read this asset.
is_read_only() ⟶ boolGas: 5
Syscall: 398
mint
Mints new supply to the current contract when the asset permits it.
mint(amount: u64) ⟶ boolGas: 500
Syscall: 397
transfer_ownership
Transfers asset ownership to another contract when allowed.
transfer_ownership(contract: Hash) ⟶ boolGas: 250
Syscall: 402
BTreeCursor
delete
Deletes the current cursor entry.
delete() ⟶ boolGas: 20
Syscall: 501
next
Returns the next cursor entry, if any.
next() ⟶ optional<Entry>Gas: 15
Syscall: 500
BTreeStore
BTreeStore::new
Creates a BTree store for the given namespace.
BTreeStore::new(namespace: bytes) ⟶ BTreeStoreGas: 5
Syscall: 494
delete
Deletes a unique key from the BTree store.
delete(key: bytes) ⟶ boolGas: 75
Syscall: 497
get
Returns the value for a unique key in the BTree store, if any.
get(key: bytes) ⟶ optional<any>Gas: 75
Syscall: 496
insert
Inserts a key and value into the BTree store.
insert(key: bytes, value: any)Gas: 100
Syscall: 495
len
Returns the number of entries in the BTree store.
len() ⟶ u64Gas: 25
Syscall: 499
seek
Creates a cursor at the requested key using the seek bias and direction.
seek(key: bytes, bias: BTreeSeekBias, ascending: bool) ⟶ (BTreeCursor, optional<Entry>)Gas: 100
Syscall: 498
BalanceProof
BalanceProof::new
Creates a balance proof wrapper from its components.
BalanceProof::new(amount: u64, commitment_eq_proof: CommitmentEqualityProof) ⟶ BalanceProofGas: 250
Syscall: 458
amount
Returns the amount claimed by the balance proof.
amount() ⟶ u64Gas: 1
Syscall: 459
commitment_eq_proof
Returns the commitment equality proof inside the balance proof.
commitment_eq_proof() ⟶ CommitmentEqualityProofGas: 250
Syscall: 460
verify
Verifies the balance proof for the source ciphertext.
verify(source_pubkey: RistrettoPoint, source_ciphertext: Ciphertext, transcript: Transcript) ⟶ boolGas: 1600000
Syscall: 461
Block
Block::current
Returns the current block context.
Block::current() ⟶ BlockGas: 5
Syscall: 335
extra_nonce
Returns the block extra nonce bytes.
extra_nonce() ⟶ bytesGas: 5
Syscall: 339
hash
Returns the block hash.
hash() ⟶ HashGas: 5
Syscall: 340
height
Returns the block height.
height() ⟶ u64Gas: 5
Syscall: 338
miner
Returns the miner address for the block.
miner() ⟶ AddressGas: 5
Syscall: 341
nonce
Returns the block nonce.
nonce() ⟶ u64Gas: 5
Syscall: 336
timestamp
Returns the block timestamp.
timestamp() ⟶ u64Gas: 5
Syscall: 337
tips
Returns the block tip hashes.
tips() ⟶ Hash[]Gas: 5
Syscall: 343
transactions
Returns the transactions included in the block.
transactions() ⟶ Transaction[]Gas: 250
Syscall: 345
transactions_count
Returns the number of transactions in the block.
transactions_count() ⟶ u32Gas: 1
Syscall: 346
transactions_hashes
Returns the hashes of the transactions included in the block.
transactions_hashes() ⟶ Hash[]Gas: 50
Syscall: 344
version
Returns the block version.
version() ⟶ u8Gas: 5
Syscall: 342
Ciphertext
Ciphertext::generate
Generates a ciphertext for an address and plaintext amount.
Ciphertext::generate(address: Address, amount: u64) ⟶ CiphertextGas: 1000
Syscall: 411
Ciphertext::new
Creates a ciphertext from commitment and handle points.
Ciphertext::new(commitment: RistrettoPoint, handle: RistrettoPoint) ⟶ CiphertextGas: 50
Syscall: 507
Ciphertext::zero
Returns a zero ciphertext.
Ciphertext::zero() ⟶ CiphertextGas: 10
Syscall: 414
add
Adds a plaintext value to the ciphertext in place.
add(value: u64)Gas: 1500
Syscall: 407
add_ct
Adds another ciphertext to this ciphertext in place.
add_ct(other: Ciphertext)Gas: 9000
Syscall: 508
add_scalar
Adds a scalar to this ciphertext in place.
add_scalar(scalar: Scalar)Gas: 14000
Syscall: 510
commitment
Returns the ciphertext commitment point.
commitment() ⟶ RistrettoPointGas: 5
Syscall: 412
div
Divides the ciphertext by a plaintext value in place.
div(value: u64)Gas: 7500
Syscall: 410
handle
Returns the ciphertext handle point.
handle() ⟶ RistrettoPointGas: 5
Syscall: 413
mul
Multiplies the ciphertext by a plaintext value in place.
mul(value: u64)Gas: 2000
Syscall: 409
sub
Subtracts a plaintext value from the ciphertext in place.
sub(value: u64)Gas: 1500
Syscall: 408
sub_ct
Subtracts another ciphertext from this ciphertext in place.
sub_ct(other: Ciphertext)Gas: 9000
Syscall: 509
sub_scalar
Subtracts a scalar from this ciphertext in place.
sub_scalar(scalar: Scalar)Gas: 14000
Syscall: 511
CiphertextValidityProof
verify
Verifies that the ciphertext handles match the commitment and public keys.
verify(commitment: RistrettoPoint, dest_pubkey: RistrettoPoint, source_pubkey: RistrettoPoint, dest_handle: RistrettoPoint, source_handle: RistrettoPoint, transcript: Transcript) ⟶ boolGas: 150000
Syscall: 442
CommitmentEqualityProof
verify
Verifies equality between a ciphertext commitment and a plain commitment.
verify(source_pubkey: RistrettoPoint, ciphertext: Ciphertext, commitment: RistrettoPoint, transcript: Transcript) ⟶ boolGas: 150000
Syscall: 443
Contract
Contract::new
Loads a contract handle by hash, if available.
Contract::new(contract: Hash) ⟶ optional<Contract>Gas: 1500
Syscall: 462
call
Calls a callable chunk on this contract and optionally deposits funds.
call(chunk_id: u16, args: any[], deposits: map<Hash, u64>) ⟶ void<any>Gas: 750
Syscall: 463
delegate
Delegates a call to this contract so it runs as the caller’s contract.
delegate(chunk_id: u16, args: any[]) ⟶ void<any>Gas: 100
Syscall: 464
get_hash
Returns this contract hash.
get_hash() ⟶ HashGas: 5
Syscall: 465
listen_event
Registers the current contract as a listener for this contract’s event.
listen_event(id: u64, callback: fn(any[]) -> u64, max_gas: u64) ⟶ boolGas: 5000
Syscall: 505
Hash
Hash::blake3
Computes the BLAKE3 hash of the input bytes.
Hash::blake3(input: bytes) ⟶ HashGas: 3000
Syscall: 374
Hash::from_array
Creates a hash from a u8 array.
Hash::from_array(bytes: u8[]) ⟶ HashGas: 75
Syscall: 371
Hash::from_bytes
Creates a hash from bytes.
Hash::from_bytes(bytes: bytes) ⟶ HashGas: 75
Syscall: 370
Hash::from_hex
Parses a hash from a hexadecimal string.
Hash::from_hex(hex: string) ⟶ HashGas: 75
Syscall: 373
Hash::from_u256
Creates a hash from a u256 value.
Hash::from_u256(value: u256) ⟶ HashGas: 75
Syscall: 372
Hash::max
Returns the maximum hash value.
Hash::max() ⟶ HashGas: 1
Syscall: 377
Hash::sha3
Computes the SHA3 hash of the input bytes.
Hash::sha3(input: bytes) ⟶ HashGas: 7500
Syscall: 375
Hash::zero
Returns the all-zero hash.
Hash::zero() ⟶ HashGas: 1
Syscall: 376
to_array
Returns the hash bytes as a u8 array.
to_array() ⟶ u8[]Gas: 5
Syscall: 367
to_bytes
Serializes the hash to bytes.
to_bytes() ⟶ bytesGas: 5
Syscall: 366
to_hex
Encodes the hash as a hexadecimal string.
to_hex() ⟶ stringGas: 20
Syscall: 369
to_u256
Interprets the hash as a u256 value.
to_u256() ⟶ u256Gas: 5
Syscall: 368
Iterator
Iterator::empty
Creates an iterator that yields no values.
Iterator::empty() ⟶ IteratorGas: 1
Syscall: 307
Iterator::once
Creates an iterator that yields one value.
Iterator::once(value: T0) ⟶ IteratorGas: 2
Syscall: 306
Iterator::unfold
Creates an iterator by repeatedly calling a closure with evolving state.
Iterator::unfold(seed: T0, f: closure(T0) -> optional<(T1, T0)>) ⟶ IteratorGas: 10
Syscall: 308
all
Returns true when every yielded value matches the predicate.
all(predicate: closure(T0) -> bool) ⟶ boolGas: 10
Syscall: 326
any
Returns true when any yielded value matches the predicate.
any(predicate: closure(T0) -> bool) ⟶ boolGas: 10
Syscall: 325
chain
Returns an iterator that yields this iterator followed by another.
chain(other: Iterator) ⟶ IteratorGas: 5
Syscall: 314
collect
Consumes the iterator and returns all yielded values as an array.
collect() ⟶ T0[]Gas: 5
Syscall: 317
count
Consumes the iterator and returns how many values it yields.
count() ⟶ u32Gas: 1
Syscall: 311
enumerate
Returns an iterator of index-value pairs.
enumerate() ⟶ IteratorGas: 5
Syscall: 315
filter
Returns a lazy iterator that keeps values accepted by the predicate.
filter(predicate: closure(T0) -> bool) ⟶ IteratorGas: 10
Syscall: 322
find
Consumes the iterator until a value matches the predicate, returning it or null.
find(predicate: closure(T0) -> bool) ⟶ optional<T0>Gas: 10
Syscall: 324
flatten
Flattens an iterator of iterators into a single iterator.
flatten() ⟶ IteratorGas: 10
Syscall: 319
fold
Consumes the iterator and combines values with an accumulator closure.
fold(init: T0, f: closure(T0, T0) -> T0) ⟶ T0Gas: 10
Syscall: 327
for_each
Consumes the iterator and calls the closure for each value.
for_each(f: closure(T0))Gas: 10
Syscall: 323
map
Returns a lazy iterator that applies the mapper closure to each value.
map(mapper: closure(T0) -> T1) ⟶ IteratorGas: 10
Syscall: 321
next
Advances the iterator and returns the next value, or null when exhausted.
next() ⟶ optional<T0>Gas: 2
Syscall: 310
position
Returns the index of the first value matching the predicate, or null.
position(predicate: closure(T0) -> bool) ⟶ optional<u32>Gas: 10
Syscall: 328
rev
Returns an iterator that yields values in reverse order when supported.
rev() ⟶ IteratorGas: 5
Syscall: 316
skip
Returns an iterator that skips the first n values.
skip(n: u32) ⟶ IteratorGas: 2
Syscall: 312
sum
Consumes the iterator and returns the sum of its values.
sum() ⟶ T0Gas: 10
Syscall: 320
take
Returns an iterator that yields at most n values.
take(n: u32) ⟶ IteratorGas: 2
Syscall: 313
zip
Returns an iterator that pairs values from two iterators until either is exhausted.
zip(other: Iterator) ⟶ IteratorGas: 5
Syscall: 318
MaxSupplyMode
get_max_supply
Returns the maximum supply encoded in this mode, if any.
get_max_supply() ⟶ optional<u64>Gas: 5
Syscall: 403
is_mintable
Returns whether this max supply mode allows minting.
is_mintable() ⟶ boolGas: 5
Syscall: 404
MemoryStorage
MemoryStorage::new
Creates a temporary memory storage handle, shared or local.
MemoryStorage::new(shared: bool) ⟶ MemoryStorageGas: 5
Syscall: 355
delete
Deletes a value from temporary memory storage and returns the previous value, if any.
delete(key: any) ⟶ optional<any>Gas: 5
Syscall: 359
has
Returns whether temporary memory storage contains the key.
has(key: any) ⟶ boolGas: 5
Syscall: 357
load
Loads a value from temporary memory storage by key.
load(key: any) ⟶ optional<any>Gas: 5
Syscall: 356
store
Stores a value in temporary memory storage and returns the previous value, if any.
store(key: any, value: any) ⟶ optional<any>Gas: 5
Syscall: 358
OwnershipProof
OwnershipProof::new
Creates an ownership proof wrapper from its components.
OwnershipProof::new(amount: u64, commitment: RistrettoPoint, eq_commitment_proof: CommitmentEqualityProof, range_proof: RangeProof) ⟶ OwnershipProofGas: 500
Syscall: 452
amount
Returns the amount claimed by the ownership proof.
amount() ⟶ u64Gas: 1
Syscall: 453
commitment
Returns the commitment claimed by the ownership proof.
commitment() ⟶ RistrettoPointGas: 50
Syscall: 454
commitment_eq_proof
Returns the commitment equality proof inside the ownership proof.
commitment_eq_proof() ⟶ CommitmentEqualityProofGas: 250
Syscall: 455
range_proof
Returns the range proof inside the ownership proof.
range_proof() ⟶ RangeProofGas: 250
Syscall: 456
verify
Verifies the ownership proof for the source ciphertext.
verify(source_pubkey: RistrettoPoint, source_ciphertext: Ciphertext, transcript: Transcript) ⟶ boolGas: 1600000
Syscall: 457
Random
Random::new
Creates a deterministic random generator for this execution.
Random::new() ⟶ RandomGas: 5
Syscall: 378
next_bool
Generates the next deterministic random boolean.
next_bool() ⟶ boolGas: 5
Syscall: 385
next_u128
Generates the next deterministic random u128.
next_u128() ⟶ u128Gas: 5
Syscall: 383
next_u16
Generates the next deterministic random u16.
next_u16() ⟶ u16Gas: 5
Syscall: 380
next_u256
Generates the next deterministic random u256.
next_u256() ⟶ u256Gas: 5
Syscall: 384
next_u32
Generates the next deterministic random u32.
next_u32() ⟶ u32Gas: 5
Syscall: 381
next_u64
Generates the next deterministic random u64.
next_u64() ⟶ u64Gas: 5
Syscall: 382
next_u8
Generates the next deterministic random u8.
next_u8() ⟶ u8Gas: 5
Syscall: 379
RangeProof
verify_multiple
Verifies a range proof for multiple commitments.
verify_multiple(commitments: RistrettoPoint[], transcript: Transcript, n: u8) ⟶ boolGas: 1515000
Syscall: 445
verify_single
Verifies a range proof for a single commitment.
verify_single(commitment: RistrettoPoint, transcript: Transcript, n: u8) ⟶ boolGas: 1500000
Syscall: 444
ReadOnlyStorage
ReadOnlyStorage::new
Opens read-only storage for another contract by hash, if available.
ReadOnlyStorage::new(contract: Hash) ⟶ optional<ReadOnlyStorage>Gas: 15
Syscall: 352
has
Returns whether another contract’s read-only storage contains the key.
has(key: any) ⟶ boolGas: 25
Syscall: 354
load
Loads a value from another contract’s read-only storage by key.
load(key: any) ⟶ optional<any>Gas: 50
Syscall: 353
RistrettoPoint
RistrettoPoint::from_bytes
Deserializes a Ristretto point from bytes.
RistrettoPoint::from_bytes(bytes: bytes) ⟶ RistrettoPointGas: 1500
Syscall: 423
RistrettoPoint::identity
Returns the identity Ristretto point.
RistrettoPoint::identity() ⟶ RistrettoPointGas: 50
Syscall: 416
add
Returns the sum of this point and another point.
add(value: RistrettoPoint) ⟶ RistrettoPointGas: 5000
Syscall: 419
add_scalar
Returns this point plus the scalar multiplied by the base point.
add_scalar(value: Scalar) ⟶ RistrettoPointGas: 14000
Syscall: 417
div_scalar
Returns this point divided by a non-zero scalar.
div_scalar(value: Scalar) ⟶ RistrettoPointGas: 23000
Syscall: 422
is_identity
Returns whether the point is the identity.
is_identity() ⟶ boolGas: 5
Syscall: 415
mul_scalar
Returns this point multiplied by a scalar.
mul_scalar(value: Scalar) ⟶ RistrettoPointGas: 20000
Syscall: 421
sub
Returns this point minus another point.
sub(value: RistrettoPoint) ⟶ RistrettoPointGas: 6000
Syscall: 420
sub_scalar
Returns this point minus the scalar multiplied by the base point.
sub_scalar(value: Scalar) ⟶ RistrettoPointGas: 14000
Syscall: 418
to_bytes
Serializes the Ristretto point to bytes.
to_bytes() ⟶ bytesGas: 1500
Syscall: 424
Scalar
Scalar::from_bytes
Deserializes a scalar from bytes, if valid.
Scalar::from_bytes(bytes: bytes) ⟶ optional<Scalar>Gas: 150
Syscall: 433
Scalar::from_u64
Creates a scalar from a u64 value.
Scalar::from_u64(value: u64) ⟶ ScalarGas: 25
Syscall: 425
Scalar::hash_from_bytes
Hashes bytes into a scalar.
Scalar::hash_from_bytes(bytes: bytes) ⟶ ScalarGas: 10000
Syscall: 512
add
Returns the sum of this scalar and another scalar.
add(value: Scalar) ⟶ ScalarGas: 2000
Syscall: 429
div
Returns this scalar divided by a non-zero scalar.
div(value: Scalar) ⟶ ScalarGas: 6000
Syscall: 432
invert
Returns the multiplicative inverse of the scalar.
invert() ⟶ ScalarGas: 2500
Syscall: 426
is_zero
Returns whether the scalar is zero.
is_zero() ⟶ boolGas: 1
Syscall: 427
mul
Returns this scalar multiplied by another scalar.
mul(value: Scalar) ⟶ ScalarGas: 4000
Syscall: 431
mul_base
Returns the scalar multiplied by the base point.
mul_base() ⟶ RistrettoPointGas: 2500
Syscall: 428
sub
Returns this scalar minus another scalar.
sub(value: Scalar) ⟶ ScalarGas: 2000
Syscall: 430
to_bytes
Serializes the scalar to bytes.
to_bytes() ⟶ bytesGas: 50
Syscall: 434
ScheduledExecution
ScheduledExecution::get_pending
Returns a pending scheduled execution for the topoheight, if any.
ScheduledExecution::get_pending(topoheight: optional<u64>) ⟶ optional<ScheduledExecution>Gas: 1500
Syscall: 471
ScheduledExecution::new_at_block_end
Schedules a callback execution at the end of the current block.
ScheduledExecution::new_at_block_end(callback: fn(any[]) -> u64, args: any[], max_gas: u64, use_contract_balance: bool) ⟶ optional<ScheduledExecution>Gas: 3500
Syscall: 467
ScheduledExecution::new_at_topoheight
Schedules a callback execution at a specific topoheight.
ScheduledExecution::new_at_topoheight(callback: fn(any[]) -> u64, args: any[], max_gas: u64, use_contract_balance: bool, topoheight: u64) ⟶ optional<ScheduledExecution>Gas: 3500
Syscall: 466
get_hash
Returns the hash generated for the scheduled execution.
get_hash() ⟶ HashGas: 5
Syscall: 468
get_max_gas
Returns the maximum gas allowed for the scheduled execution.
get_max_gas() ⟶ u64Gas: 5
Syscall: 470
get_topoheight
Returns the topoheight at which the execution is scheduled, if any.
get_topoheight() ⟶ optional<u64>Gas: 5
Syscall: 469
increase_max_gas
Increases the max gas for a pending scheduled execution.
increase_max_gas(amount: u64, use_contract_balance: bool) ⟶ boolGas: 500
Syscall: 472
Signature
Signature::from_bytes
Deserializes a signature from bytes.
Signature::from_bytes(bytes: bytes) ⟶ SignatureGas: 75
Syscall: 406
verify
Verifies the signature against the data and public key point.
verify(data: bytes, point: RistrettoPoint) ⟶ boolGas: 500
Syscall: 405
Storage
Storage::new
Creates a persistent storage handle for the current contract.
Storage::new() ⟶ StorageGas: 5
Syscall: 347
delete
Deletes a value from contract storage and returns the previous value, if any.
delete(key: any) ⟶ optional<any>Gas: 16384
Syscall: 351
has
Returns whether contract storage contains the key.
has(key: any) ⟶ boolGas: 200
Syscall: 349
load
Loads a value from contract storage by key.
load(key: any) ⟶ optional<any>Gas: 200
Syscall: 348
store
Stores a value in contract storage and returns the previous value, if any.
store(key: any, value: any) ⟶ optional<any>Gas: 16384
Syscall: 350
T
clone
Returns a deep clone of the value.
clone() ⟶ TGas: 5
Syscall: 305
T0[][]
concat
Flattens one level of nested arrays into a single array.
concat() ⟶ T0[]Gas: 5
Syscall: 13
Transaction
Transaction::current
Returns the current transaction when execution was started by a transaction.
Transaction::current() ⟶ optional<Transaction>Gas: 5
Syscall: 329
fee
Returns the transaction fee in atomic units.
fee() ⟶ u64Gas: 5
Syscall: 333
hash
Returns the transaction hash.
hash() ⟶ HashGas: 5
Syscall: 331
nonce
Returns the transaction nonce.
nonce() ⟶ u64Gas: 5
Syscall: 330
signature
Returns the transaction signature.
signature() ⟶ SignatureGas: 5
Syscall: 334
source
Returns the source address of the transaction.
source() ⟶ AddressGas: 5
Syscall: 332
Transcript
Transcript::new
Creates a transcript with the given label.
Transcript::new(label: bytes) ⟶ TranscriptGas: 500
Syscall: 435
append_message
Appends labeled bytes to the transcript.
append_message(label: bytes, message: bytes)Gas: 500
Syscall: 438
append_point
Appends a labeled Ristretto point to the transcript.
append_point(label: bytes, point: RistrettoPoint)Gas: 250
Syscall: 439
append_scalar
Appends a labeled scalar to the transcript.
append_scalar(label: bytes, scalar: Scalar)Gas: 250
Syscall: 441
challenge_bytes
Derives challenge bytes from the transcript with the given label and length.
challenge_bytes(label: bytes, n: u32) ⟶ bytesGas: 700
Syscall: 437
challenge_scalar
Derives a challenge scalar from the transcript with the given label.
challenge_scalar(label: bytes) ⟶ ScalarGas: 750
Syscall: 436
validate_and_append_point
Validates and appends a labeled Ristretto point to the transcript.
validate_and_append_point(label: bytes, point: RistrettoPoint)Gas: 250
Syscall: 440