Rename AutoIncrementing to Counter (#1307)
This commit is contained in:
committed by
Nicolás Venturo
parent
225b492109
commit
b4f87bb8fc
21
contracts/mocks/CounterImpl.sol
Normal file
21
contracts/mocks/CounterImpl.sol
Normal file
@ -0,0 +1,21 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../utils/Counter.sol";
|
||||
|
||||
|
||||
contract CounterImpl {
|
||||
using Counter for Counter.Index;
|
||||
|
||||
uint256 public theId;
|
||||
|
||||
// use whatever key you want to track your counters
|
||||
mapping(string => Counter.Index) private _counters;
|
||||
|
||||
function doThing(string key)
|
||||
public
|
||||
returns (uint256)
|
||||
{
|
||||
theId = _counters[key].next();
|
||||
return theId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user