Rename AutoIncrementing to Counter (#1307)
parent
225b492109
commit
b4f87bb8fc
@ -1,21 +0,0 @@ |
||||
pragma solidity ^0.4.24; |
||||
|
||||
import "../utils/AutoIncrementing.sol"; |
||||
|
||||
|
||||
contract AutoIncrementingImpl { |
||||
using AutoIncrementing for AutoIncrementing.Counter; |
||||
|
||||
uint256 public theId; |
||||
|
||||
// use whatever key you want to track your counters |
||||
mapping(string => AutoIncrementing.Counter) private _counters; |
||||
|
||||
function doThing(string key) |
||||
public |
||||
returns (uint256) |
||||
{ |
||||
theId = _counters[key].nextId(); |
||||
return theId; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
Loading…
Reference in new issue