CounterImpl.sol 383 B

1234567891011121314151617181920
  1. pragma solidity ^0.4.24;
  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 key)
  9. public
  10. returns (uint256)
  11. {
  12. theId = _counters[key].next();
  13. return theId;
  14. }
  15. }