pub fn verify_predicate_address(predicate_id: Address, bytecode: Vec<u8>) 
Expand description

Asserts that a predicates’s address from some bytecode and the given address match.

Arguments

  • predicate_id: [Address] - The predicate address that the bytecode should match.
  • bytecode: [Vec] - The bytecode of the predicate.

Reverts

  • When the bytecode is empty.
  • When the predicate’s address does not match the passed address.

Examples

use sway_libs::bytecode::verify_predicate_address;

fn foo(my_predicate_id: Address, my_bytecode: Vec<u8>) {
    verify_predicate_address(my_predicate_id, my_bytecode);
    // This line will only be reached if the predicates's address and the computed address match.
}