From eb7e132441a74161d1663d182950fecd8309b685 Mon Sep 17 00:00:00 2001 From: woxjro Date: Sat, 5 Oct 2024 17:17:41 +0900 Subject: [PATCH] feat(examples): added sha256.mlir --- examples/mlir/sha256.mlir | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 examples/mlir/sha256.mlir diff --git a/examples/mlir/sha256.mlir b/examples/mlir/sha256.mlir new file mode 100644 index 0000000..461c134 --- /dev/null +++ b/examples/mlir/sha256.mlir @@ -0,0 +1,16 @@ +module { + func.func @smart_contract(%parameter: !michelson.int, %storage: !michelson.bytes) + -> !michelson.pair, !michelson.bytes> { + + %byt = "michelson.get_bytes"(%parameter) : (!michelson.int) -> !michelson.bytes + %hash = "michelson.sha256"(%byt) : (!michelson.bytes) -> !michelson.bytes + %operations = "michelson.make_list"() : () -> !michelson.list + + %res = "michelson.make_pair"(%operations, %hash) : + (!michelson.list , !michelson.bytes) + -> !michelson.pair, !michelson.bytes> + + return %res : !michelson.pair, !michelson.bytes> + } +} +