Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
module 0x1::OwnedCounter {
resource struct Counter { owner: address, value: u64 }
public fun create(owner: address): Counter {
Counter { owner, value: 0 }
}
public fun inc(c: &mut Counter, caller: address) {
assert!(caller == c.owner, 1)
c.value = c.value + 1
}
}Coding works best on desktop or with an external keyboard.