Counter per Address
Another contract that implements a counter, this time unique per user address. Showcases how to validate that a transaction was done by user possessing private keys to 'from' address
contract test {
import Runtime;
import Map;
global counters: storage_map<address, number>;
public increment(from:address)
{
Runtime.expect(Runtime.isWitness(from), "witness failed");
local temp: number;
temp := counters.get(from);
temp += 1;
counters.set(from, temp);
}
}
Last updated