From 0f2ed4ca3e6d2f6ba3f3b0c3b7ed48726cb0c236 Mon Sep 17 00:00:00 2001 From: msinkec Date: Mon, 20 Nov 2023 09:16:51 +0100 Subject: [PATCH] Add oracle prevout check. --- src/contracts/bsv20BuyLimitOrder.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/contracts/bsv20BuyLimitOrder.ts b/src/contracts/bsv20BuyLimitOrder.ts index 6a6ece2b..bd045409 100644 --- a/src/contracts/bsv20BuyLimitOrder.ts +++ b/src/contracts/bsv20BuyLimitOrder.ts @@ -69,6 +69,12 @@ export class BSV20BuyLimitOrder extends BSV20V2 { 'oracle sig verify failed' ) + // Check that we're unlocking the UTXO specified in the oracles message. + assert( + slice(this.prevouts, 0n, 36n) == slice(oracleMsg, 0n, 36n), + 'first input is not spending specified ordinal UTXO' + ) + // Get token amount held by the UTXO from oracle message. const utxoTokenAmt = byteString2Int(slice(oracleMsg, 36n, 44n))