pub fn verify_predicate_address_with_configurables(
    predicate_id: Address,
    ref mut bytecode: Vec<u8>,
    configurables: ContractConfigurables,
) 
Expand description

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

Arguments

  • predicate_id: [Address] - The predicate address that the bytecode should match.
  • bytecode: [Vec] - The bytecode of the predicate.
  • configurables: [ContractConfigurables] - The configurable values to swap.

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_with_configurables;

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