scilla-parser 2.0.0

Scilla smart contract parser written in Rust
Documentation
scilla_version 0

(* HelloWorld contract *)

import ListUtils

(***************************************************)
(*               Associated library                *)
(***************************************************)
library HelloWorld

let not_owner_code = Int32 1
let set_hello_code = Int32 2

(***************************************************)
(*             The contract definition             *)
(***************************************************)

contract HelloWorld
(owner: ByStr20)

field welcome_msg : String = "Hello world!"

transition setHello (msg : String)
    is_owner = builtin eq owner _sender;
    match is_owner with
    | False =>
    e = {_eventname : "setHello()"; code : not_owner_code};
    event e
    | True =>
    welcome_msg := msg;
    e = {_eventname : "setHello()"; code : set_hello_code};
    event e
    end
end


transition getHello ()
    r <- welcome_msg;
    e = {_eventname: "getHello()"; msg: r};
    event e
end