Update contracts to support Solidity 0.8.x (#2442)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity >=0.6.0 <0.8.0;
|
||||
|
||||
import "../math/SafeMath.sol";
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
/**
|
||||
* @title Counters
|
||||
@ -11,13 +9,8 @@ import "../math/SafeMath.sol";
|
||||
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
|
||||
*
|
||||
* Include with `using Counters for Counters.Counter;`
|
||||
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
|
||||
* overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
|
||||
* directly accessed.
|
||||
*/
|
||||
library Counters {
|
||||
using SafeMath for uint256;
|
||||
|
||||
struct Counter {
|
||||
// This variable should never be directly accessed by users of the library: interactions must be restricted to
|
||||
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
|
||||
@ -30,11 +23,10 @@ library Counters {
|
||||
}
|
||||
|
||||
function increment(Counter storage counter) internal {
|
||||
// The {SafeMath} overflow check can be skipped here, see the comment at the top
|
||||
counter._value += 1;
|
||||
}
|
||||
|
||||
function decrement(Counter storage counter) internal {
|
||||
counter._value = counter._value.sub(1);
|
||||
counter._value = counter._value - 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user