-
Notifications
You must be signed in to change notification settings - Fork 6
/
coverageReport.html
51 lines (51 loc) · 9.45 KB
/
coverageReport.html
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
<body ><h1 >Files</h1><ul ><li ><a href="#src/Contract/Escrow.hs" >src/Contract/Escrow.hs</a></li></ul><hr><h2 id="src/Contract/Escrow.hs" >src/Contract/Escrow.hs</h2><pre >.
.
.
224 <span style=background-color:lightgray;color:gray > the target address is also used as a change address for the spending</span>
225 <span style=background-color:lightgray;color:gray > transaction, and allowing the target to be exceed prevents outsiders from</span>
226 <span style=background-color:lightgray;color:gray > poisoning the contract by adding arbitrary outputs to the script address.</span>
227 <span style=background-color:lightgray;color:gray >-}</span>
228 <span style=background-color:lightgray;color:gray >meetsTarget :: TxInfo -> EscrowTarget Datum -> Bool</span>
229 <span style=background-color:black;color:orangered >meetsTarget ptx = \case</span><span style=background-color:lightgray;color:gray ></span>
230 <span style=background-color:black;color:orangered > PaymentPubKeyTarget pkh vl -></span><span style=background-color:lightgray;color:gray ></span>
231 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >valuePaidTo </span><span style=background-color:black;color:orangered >ptx </span><span style=background-color:black;color:orangered >(unPaymentPubKeyHash pkh) </span><span style=background-color:black;color:orangered >`geq` </span><span style=background-color:black;color:orangered >vl</span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
232 <span style=background-color:black;color:orangered > ScriptTarget validatorHash dataValue vl -></span><span style=background-color:lightgray;color:gray ></span>
233 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >case scriptOutputsAt </span><span style=background-color:black;color:orangered >validatorHash </span><span style=background-color:black;color:orangered >ptx </span><span style=background-color:black;color:orangered >of</span><span style=background-color:lightgray;color:gray ></span>
234 <span style=background-color:black;color:orangered > [(dataValue', vl')] -></span><span style=background-color:lightgray;color:gray ></span>
235 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >PlutusTx.traceIfFalse "dataValue" </span><span style=background-color:black;color:orangered >(dataValue' PlutusTx.== </span><span style=background-color:black;color:orangered >OutputDatum </span><span style=background-color:black;color:orangered >dataValue)</span><span style=background-color:black;color:orangered ></span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
236 <span style=background-color:black;color:orangered > PlutusTx.&& </span><span style=background-color:black;color:orangered >PlutusTx.traceIfFalse "value" </span><span style=background-color:black;color:orangered >(</span><span style=background-color:black;color:orangered >vl' </span><span style=background-color:black;color:orangered >`geq` </span><span style=background-color:black;color:orangered >vl)</span><span style=background-color:black;color:orangered ></span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
237 <span style=background-color:black;color:orangered > _ -> </span><span style=background-color:black;color:orangered >False</span><span style=background-color:lightgray;color:gray ></span>
238 <span style=background-color:lightgray;color:gray ></span>
239 <span style=background-color:lightgray;color:gray >{-# INLINEABLE validate #-}</span>
240 <span style=background-color:lightgray;color:gray >validate :: EscrowParams Datum -> PaymentPubKeyHash -> Action -> ScriptContext -> Bool</span>
241 <span style=background-color:black;color:orangered >validate EscrowParams{escrowDeadline, escrowTargets} contributor action ScriptContext{scriptContextTxInfo} =</span><span style=background-color:lightgray;color:gray ></span>
242 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >case action of</span><span style=background-color:lightgray;color:gray ></span>
243 <span style=background-color:black;color:orangered > Redeem -></span><span style=background-color:lightgray;color:gray ></span>
244 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >PlutusTx.traceIfFalse</span><span style=background-color:lightgray;color:gray ></span>
245 <span style=background-color:black;color:orangered > "escrowDeadline-after"</span><span style=background-color:lightgray;color:gray ></span>
246 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >(</span><span style=background-color:black;color:orangered >escrowDeadline </span><span style=background-color:black;color:orangered >`Interval.after` txInfoValidRange scriptContextTxInfo)</span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
247 <span style=background-color:black;color:orangered > PlutusTx.&& </span><span style=background-color:black;color:orangered >PlutusTx.traceIfFalse</span><span style=background-color:lightgray;color:gray ></span>
248 <span style=background-color:black;color:orangered > "meetsTarget"</span><span style=background-color:lightgray;color:gray ></span>
249 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >(PlutusTx.all (meetsTarget </span><span style=background-color:black;color:orangered >scriptContextTxInfo)</span><span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >escrowTargets)</span><span style=background-color:black;color:orangered ></span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
250 <span style=background-color:black;color:orangered > Refund -></span><span style=background-color:lightgray;color:gray ></span>
251 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >PlutusTx.traceIfFalse</span><span style=background-color:lightgray;color:gray ></span>
252 <span style=background-color:black;color:orangered > "escrowDeadline-before"</span><span style=background-color:lightgray;color:gray ></span>
253 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >(</span><span style=background-color:black;color:orangered >(escrowDeadline PlutusTx.- </span><span style=background-color:black;color:orangered >1000)</span><span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >`Interval.before` txInfoValidRange scriptContextTxInfo)</span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
254 <span style=background-color:black;color:orangered > PlutusTx.&& </span><span style=background-color:black;color:orangered >PlutusTx.traceIfFalse</span><span style=background-color:lightgray;color:gray ></span>
255 <span style=background-color:black;color:orangered > "txSignedBy"</span><span style=background-color:lightgray;color:gray ></span>
256 <span style=background-color:black;color:orangered > </span><span style=background-color:black;color:orangered >(</span><span style=background-color:black;color:orangered >scriptContextTxInfo </span><span style=background-color:black;color:orangered >`txSignedBy` </span><span style=background-color:black;color:orangered >unPaymentPubKeyHash contributor)</span><span style=background-color:black;color:orangered ></span><span style=background-color:lightgray;color:gray ></span>
257 <span style=background-color:lightgray;color:gray ></span>
258 <span style=background-color:lightgray;color:gray >typedValidator :: EscrowParams Datum -> V2.TypedValidator Escrow</span>
259 <span style=background-color:lightgray;color:gray >typedValidator = go</span>
260 <span style=background-color:lightgray;color:gray > where</span>
261 <span style=background-color:lightgray;color:gray > go =</span>
.
.
.
480 <span style=background-color:lightgray;color:gray > -- Pay the value 'vl' into the contract</span>
481 <span style=background-color:lightgray;color:gray > void $ pay wallet privateKey escrow vl</span>
482 <span style=background-color:lightgray;color:gray > go</span>
483 <span style=background-color:lightgray;color:gray ></span>
484 <span style=background-color:lightgray;color:gray >covIdx :: CoverageIndex</span>
485 <span style=background-color:lightgray;color:gray >covIdx = getCovIdx $$</span><span style=background-color:black;color:orangered >(PlutusTx.compile [||validate||])</span><span style=background-color:lightgray;color:gray ></span>
</pre></body>