From 7ba49c549d39e88e7a9a0bd0ea021a012e20fbe6 Mon Sep 17 00:00:00 2001 From: radrow Date: Mon, 2 Aug 2021 13:07:10 +0200 Subject: [PATCH] spend test --- test/contracts/hagia/spend.aes | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/contracts/hagia/spend.aes diff --git a/test/contracts/hagia/spend.aes b/test/contracts/hagia/spend.aes new file mode 100644 index 0000000..0056e2c --- /dev/null +++ b/test/contracts/hagia/spend.aes @@ -0,0 +1,14 @@ +include "List.aes" + +contract C = + + payable stateful entrypoint split(targets : list(address)) = + let value_per_person = Call.value / List.length(targets) + spend_to_all(value_per_person, targets) + + stateful function + spend_to_all : (int, list(address)) => unit + spend_to_all(_, []) = () + spend_to_all(value, addr::rest) = + Chain.spend(addr, value) + spend_to_all(value, rest) \ No newline at end of file