-
Notifications
You must be signed in to change notification settings - Fork 2
/
prime-safe-claim.tapscript
55 lines (51 loc) · 1.31 KB
/
prime-safe-claim.tapscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Claim: Treasury can Unlock all collateral After expiration when Burning Fuji
// constructorInputs:
// borrowAsset: asset
// borrowAmount: value
// treasuryPk: xonlypubkey
// expirationTimeout: number
// functionInputs:
// treasurySig: sig
// Check that $expirationTimeout has passed since the the start of the contract
// Note that OP_CHECKSEQUENCEVERIFY will check $expirationTimeout against
// medianTimePast, not the current timestamp
<$expirationTimeout>
OP_CHECKSEQUENCEVERIFY
OP_DROP
// take out 0 asset
<0>
OP_INSPECTOUTPUTASSET
// make sure that asset is not confidential
<1>
OP_EQUALVERIFY
// check that the asset is equal to $borrowAsset
<$borrowAsset>
OP_EQUALVERIFY
// take out 0 value
<0>
OP_INSPECTOUTPUTVALUE
// make sure that value is not confidential
<1>
OP_EQUALVERIFY
// check that the value is equal to $borrowAmount
<$borrowAmount>
OP_EQUALVERIFY
// take out 0 scriptpubkey
<0>
OP_INSPECTOUTPUTSCRIPTPUBKEY
// OP_RETURN is not a witness scriptPubKey, so its version will be -1
// check that the version is -1
<-1>
OP_EQUALVERIFY
// check that the out 0 scriptpubkey is really just OP_RETURN
<0x6a> // DATA(OP_RETURN)
OP_SHA256
OP_EQUALVERIFY
// Check that the nonce on out 0 is empty
<0>
OP_INSPECTOUTPUTNONCE
<0>
OP_EQUALVERIFY
// Require authorization by Treasury
<$treasuryPk>
OP_CHECKSIG