Skip to content

Commit

Permalink
feat(examples): added sha256.mlir
Browse files Browse the repository at this point in the history
  • Loading branch information
woxjro committed Oct 5, 2024
1 parent f5b2da5 commit eb7e132
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/mlir/sha256.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module {
func.func @smart_contract(%parameter: !michelson.int, %storage: !michelson.bytes)
-> !michelson.pair<!michelson.list<!michelson.operation>, !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<!michelson.operation>

%res = "michelson.make_pair"(%operations, %hash) :
(!michelson.list<!michelson.operation> , !michelson.bytes)
-> !michelson.pair<!michelson.list<!michelson.operation>, !michelson.bytes>

return %res : !michelson.pair<!michelson.list<!michelson.operation>, !michelson.bytes>
}
}

0 comments on commit eb7e132

Please sign in to comment.