Add a Counter.reset function (#2678)
This commit is contained in:
@ -5,7 +5,7 @@ pragma solidity ^0.8.0;
|
||||
/**
|
||||
* @title Counters
|
||||
* @author Matt Condon (@shrugs)
|
||||
* @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
|
||||
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
|
||||
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
|
||||
*
|
||||
* Include with `using Counters for Counters.Counter;`
|
||||
@ -35,4 +35,8 @@ library Counters {
|
||||
counter._value = value - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function reset(Counter storage counter) internal {
|
||||
counter._value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user