pub fn compute_bytecode_root_with_configurables(
    ref mut bytecode: Vec<u8>,
    configurables: ContractConfigurables,
) -> BytecodeRoot 
Expand description

Takes the bytecode of a contract or predicate and configurables and computes the bytecode root.

Arguments

  • bytecode: [Vec] - The bytecode of a contract or predicate.
  • configurables: [ContractConfigurables] - The configurable values to swap.

Returns

  • [b256] - The bytecode root of the contract or predicate.

Reverts

  • When the bytecode is empty.

Examples

use sway_libs::bytecode::{compute_bytecode_root_with_configurables, BytecodeRoot, ContractConfigurables};

fn foo(my_bytecode: Vec<u8>, my_configurables: ContractConfigurables) {
    let mut my_bytecode = my_bytecode;
    let bytecode_root: BytecodeRoot = compute_bytecode_root_with_configurables(my_bytecode, my_configurables);
    assert(bytecode_root != b256::zero());
}