Add rough draft of hashlock contract
This commit is contained in:
parent
c8ea510f18
commit
7756bfda93
16
src/test/contracts/hashlock.mligo
Normal file
16
src/test/contracts/hashlock.mligo
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
type storage = {
|
||||||
|
hashed: bytes;
|
||||||
|
unused: bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
type parameter = {
|
||||||
|
hashable: bytes;
|
||||||
|
message: unit -> operation list;
|
||||||
|
}
|
||||||
|
|
||||||
|
let main ((p,s): parameter * storage) : operation list * storage =
|
||||||
|
if ((Crypto.sha256 p.hashable) = s.hashed) && s.unused
|
||||||
|
then
|
||||||
|
let s: storage = {hashed = s.hashed; unused = false} in
|
||||||
|
((p.message ()), s)
|
||||||
|
else (([]: operation list), s)
|
Loading…
Reference in New Issue
Block a user