CounterImpl.sol 399 B

1234567891011121314151617
  1. pragma solidity ^0.5.0;
  2. import "../drafts/Counter.sol";
  3. contract CounterImpl {
  4. using Counter for Counter.Counter;
  5. uint256 public theId;
  6. // use whatever key you want to track your counters
  7. mapping(string => Counter.Counter) private _counters;
  8. function doThing(string memory key) public returns (uint256) {
  9. theId = _counters[key].next();
  10. return theId;
  11. }
  12. }