aiken_design_patterns/singular_utxo_indexer

Functions

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

Spend endpoint helper function. By including this in your validator, you’ll get an efficient access to your input, and a corresponding output.

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-one) pattern for a convenient way of preventing this attack vector. Otherwise, consider tagging your output with input’s output reference.

Search Document