In the auction code of the Plutus pioneer program during week 1, the code approves a bid by comparing the datum with previous ones in the Plutus on-chain code. How could you repurpose this so that you could store multiple utxos of different datums tokens on the smart contract then verify transactions for only the tokens that match the needed datum?
This is the code i'm refrencing
ownOutput :: TxOut
outputDatum :: Integer
(ownOutput, outputDatum) = case getContinuingOutputs ctx of
[o] -> case txOutDatumHash o of
Nothing -> traceError "wrong output type"
Just h -> case findDatum h info of
Nothing -> traceError "datum not found"
Just (Datum d) -> case PlutusTx.fromBuiltinData d of
Just iDatum' -> (o, iDatum')
Nothing -> traceError "error decoding data"
_ -> traceError "expected exactly one continuing output"