Skip to main content

Mod

Trait Mod 

Source
pub trait Mod {
    // Required methods
    fn mod_reveal() -> Cow<'static, [u8]>;
    fn mod_hash() -> TreeHash;

    // Provided method
    fn curry_tree_hash(&self) -> TreeHash
       where Self: Sized + ToKlvm<TreeHasher> { ... }
}
Expand description

This trait makes it possible to get the mod hash or puzzle reveal of a puzzle.

There is also a utility for calculating the curried tree hash, provided the type implements ToTreeHash. This is much more efficient than manually allocating and hashing the puzzle and its arguments.

This trait should be be implemented for types that represent the curried arguments of puzzles. However, if a puzzle can’t be curried (ie it has no arguments), this trait can still be implemented on a marker struct that doesn’t implement ToTreeHash. This will disable the curry_tree_hash method.

§Usage Example

We can specify the arguments of a puzzle to get its curried puzzle hash.

let args = StandardArgs::new(PublicKey::default());
let puzzle_hash = args.curry_tree_hash();

Required Methods§

Source

fn mod_reveal() -> Cow<'static, [u8]>

Source

fn mod_hash() -> TreeHash

Provided Methods§

Source

fn curry_tree_hash(&self) -> TreeHash
where Self: Sized + ToKlvm<TreeHasher>,

Curry the arguments into the MOD_HASH.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Mod for EverythingWithSignatureTailArgs

Source§

impl Mod for GenesisByCoinIdTailArgs

Source§

impl Mod for NftIntermediateLauncherArgs

Source§

impl Mod for NftRoyaltyTransferPuzzleArgs

Source§

impl Mod for StandardArgs

Source§

impl<I, M> Mod for DidArgs<I, M>

Source§

impl<I, M> Mod for NftStateLayerArgs<I, M>

Source§

impl<I, P> Mod for NftOwnershipLayerArgs<I, P>

Source§

impl<I> Mod for CatArgs<I>

Source§

impl<I> Mod for SingletonArgs<I>

Source§

impl<T> Mod for &T
where T: Mod,

Implementors§