Skip to content

Commit

Permalink
Add oracle prevout check.
Browse files Browse the repository at this point in the history
  • Loading branch information
msinkec committed Nov 20, 2023
1 parent e4f0277 commit 0f2ed4c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/contracts/bsv20BuyLimitOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 0f2ed4c

Please sign in to comment.