aiken_design_patterns/singular_utxo_indexer_one_to_many

Functions

spend(
  input_output_validator: fn(Int, Input, a, Int, Output) -> Bool,
  input_collective_outputs_validator: fn(Int, Input, a, List<Output>) -> Bool,
  redeemer: a,
  indices: Pair<Int, List<Int>>,
  own_ref: OutputReference,
  tx: Transaction,
) -> Bool

Spend endpoint helper function. By including this in your validator, you’ll an efficient access to your input, its corresponding outputs, total output value and count.

This function has no protection against double satisfaction vulnerability, as this can be done in multiple ways depending on the contract. If you can tolerate some extra overhead, consider using the multi-utxo-indexer (one-to-many) pattern for a convenient way of preventing this attack vector.

Required validation functions are provided with:

  1. Input index, Input itself, redeemer, output index, and Output itself (this validation is executed for each output)
  2. Input index, Input itself, redeemer, and the list of all Outputs (this validation is executed only once)
Search Document