From dbe428265908e5749696c227875508a55c302eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Wed, 5 Jun 2019 20:06:20 +0200 Subject: [PATCH] missing files in failwith and guess_string tests, oops. --- src/contracts/failwith.mligo | 8 ++++++++ src/contracts/guess_string.mligo | 24 ++++++++++++++++++++++++ src/test/.gitignore | 1 + 3 files changed, 33 insertions(+) create mode 100644 src/contracts/failwith.mligo create mode 100644 src/contracts/guess_string.mligo create mode 100644 src/test/.gitignore diff --git a/src/contracts/failwith.mligo b/src/contracts/failwith.mligo new file mode 100644 index 000000000..91d7c42d6 --- /dev/null +++ b/src/contracts/failwith.mligo @@ -0,0 +1,8 @@ +type storage = unit + +(* let%entry main (p:unit) storage = *) +(* (failwith "This contract always fails" : unit) *) + +let%entry main (p:unit) storage = + if true then failwith "This contract always fails" else () + diff --git a/src/contracts/guess_string.mligo b/src/contracts/guess_string.mligo new file mode 100644 index 000000000..ae5bfd5bc --- /dev/null +++ b/src/contracts/guess_string.mligo @@ -0,0 +1,24 @@ +(** Type of storage for this contract *) +type storage = { + challenge : string ; +} + +(** Initial storage *) +let%init storage = { + challenge = "" ; +} + +type param = { + new_challenge : string ; + attempt : string ; +} + +let%entry attempt (p:param) storage = + (* if p.attempt <> storage.challenge then failwith "Failed challenge" else *) + let contract : unit contract = Operation.get_contract sender in + let transfer : operation = Operation.transaction (unit , contract , 10.00tz) in + (* TODO: no syntax for functional updates yet *) + (* let storage : storage = { storage with challenge = p.new_challenge } in *) + (* for now, rebuild the record by hand. *) + let storage : storage = { challenge = p.new_challenge } in + ((list [] : operation list), storage) diff --git a/src/test/.gitignore b/src/test/.gitignore new file mode 100644 index 000000000..ddabb4d33 --- /dev/null +++ b/src/test/.gitignore @@ -0,0 +1 @@ +/dune-project