1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
class foo { pubkey; } class bar { foo; mutable counter: integer; } operation hello_world(){ print("HELLO"); } operation create_bar(pubkey) { create foo(pubkey); create bar(foo@{pubkey}, counter = 0); } //// OPTION 1 operation update_bar(foo: pubkey) { update bar@{ foo@{pubkey = foo} } ( counter = 1 ); } //// OPTION 2 operation update_bar(foo_p: pubkey) { update bar@{ foo@{pubkey = foo_p} } ( counter = 1 ); }
You can clone a snippet to your computer for local editing. Learn more.