pub fn compute_predicate_address(bytecode: Vec<u8>) -> Address 
Expand description

Takes the bytecode of a predicate and computes the address of a predicate.

Arguments

  • bytecode: [Vec] - The bytecode of a predicate.

Returns

  • [Address] - The address of the predicate.

Reverts

  • When the bytecode is empty.

Examples

use sway_libs::bytecode::compute_predicate_address;

fn foo(my_bytecode: Vec<u8>) {
    let predicate_address: Address = compute_predicate_address(my_bytecode);
    assert(predicate_address != Address::zero());
}