package miden:base@1.0.0;
/// Types to be used in tx-kernel interface
interface core-types {
/// Represents an on-chain felt.
///
/// Field modulus M = 2^64 - 2^32 + 1.
record felt {
/// The backing type is `f32` which will be treated as a felt by the compiler.
/// We're basically hijacking the Wasm `f32` type and treat as felt.
inner: f32,
}
/// A group of four field elements in the Miden base field.
record word {
a: felt,
b: felt,
c: felt,
d: felt,
}
/// A cryptographic digest representing a 256-bit hash value.
/// This is a wrapper around `word` which contains 4 field elements.
record digest {
inner: word
}
/// Unique identifier of an account.
///
/// # Layout
///
/// An `AccountId` consists of two field elements, where the first is called the prefix and the
/// second is called the suffix. It is laid out as follows:
///
/// prefix: [hash (56 bits) | storage mode (2 bits) | type (2 bits) | version (4 bits)]
/// suffix: [zero bit | hash (55 bits) | 8 zero bits]
record account-id {
prefix: felt,
suffix: felt
}
/// Creates a new account ID from a field element.
//account-id-from-felt: func(felt: felt) -> account-id;
/// Recipient of the note, i.e., hash(hash(hash(serial_num, [0; 4]), note_script_hash), input_hash)
record recipient {
inner: word
}
record tag {
inner: felt
}
/// A fungible or a non-fungible asset.
///
/// In protocol v0.14 assets are encoded as two words: an asset key and an asset value.
///
/// The methodology for constructing fungible and non-fungible assets is described below.
///
/// # Fungible assets
/// - `key`: `[0, 0, faucet_id_suffix, faucet_id_prefix]`
/// - `value`: `[amount, 0, 0, 0]`
///
/// # Non-fungible assets
/// - `key`: `[hash0, hash1, faucet_id_suffix, faucet_id_prefix]`
/// - `value`: `DATA_HASH`
record asset {
key: word,
value: word,
}
/// Account nonce
record nonce {
inner: felt
}
/// Account hash
record account-hash {
inner: word
}
/// Block hash
record block-hash {
inner: word
}
/// Storage value
record storage-value {
inner: word
}
/// Account storage root
record storage-root {
inner: word
}
/// Account code root
record account-code-root {
inner: word
}
/// Commitment to the account vault
record vault-commitment {
inner: word
}
/// An index of the created note
record note-idx {
inner: felt
}
record note-type {
inner: felt
}
record note-execution-hint {
inner: felt
}
}
/// The transaction script interface that is expected to be implemented by transaction scripts.
interface transaction-script {
use core-types.{word};
run: func(arg: word);
}
world base-world {
export core-types;
export transaction-script;
}