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

Swaps out configurable values in a contract or predicate’s bytecode.

Arguments

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

Returns

  • [Vec] - The resulting bytecode containing the new configurable values.

Examples

use sway_libs::bytecode::{sway_configurables, ContractConfigurables};

fn foo(my_bytecode: Vec<u8>, my_configurables: ContractConfigurables) {
    let mut my_bytecode = my_bytecode;
    let resulting_bytecode = swap_configurables(my_bytecode, my_configurables);
    assert(resulting_bytecode != my_bytecode);
}