pub fn verify_contract_bytecode_with_configurables(
contract_id: ContractId,
ref mut bytecode: Vec<u8>,
configurables: ContractConfigurables,
)
Expand description
Asserts that a contract’s bytecode and the given bytecode and configurable values match.
Arguments
contract_id
: [ContractId] - The contract that the bytecode should match.bytecode
: [Vec] - The bytecode of the contract.configurables
: [ContractConfigurables] - The configurable values to swap.
Reverts
- When the bytecode is empty.
- When the contract’s bytecode root does not match the passed bytecode.
Examples
use sway_libs::bytecode::{verify_contract_bytecode_with_configurables, ContractConfigurables};
fn foo(my_contract_id: ContractId, my_bytecode: Vec<u8>, my_configurables: ContractConfigurables) {
let mut my_bytecode = my_bytecode;
verify_contract_bytecode_with_configurables(my_contract_id, my_bytecode, my_configurables);
// This line will only be reached if the contract's bytecode root and the computed bytecode root match.
}