Add EnumerableMap, refactor ERC721 (#2160)
* Implement AddressSet in terms of a generic Set * Add Uint256Set * Add EnumerableMap * Fix wording on EnumerableSet docs and tests * Refactor ERC721 using EnumerableSet and EnumerableMap * Fix tests * Fix linter error * Gas optimization for EnumerableMap * Gas optimization for EnumerableSet * Remove often not-taken if from Enumerable data structures * Fix failing test * Gas optimization for EnumerableMap * Fix linter errors * Add comment for clarification * Improve test naming * Rename EnumerableMap.add to set * Add overload for EnumerableMap.get with custom error message * Improve Enumerable docs * Rename Uint256Set to UintSet * Add changelog entry
This commit is contained in:
@ -5,7 +5,7 @@ import "../utils/EnumerableSet.sol";
|
||||
contract EnumerableSetMock {
|
||||
using EnumerableSet for EnumerableSet.AddressSet;
|
||||
|
||||
event TransactionResult(bool result);
|
||||
event OperationResult(bool result);
|
||||
|
||||
EnumerableSet.AddressSet private _set;
|
||||
|
||||
@ -15,16 +15,12 @@ contract EnumerableSetMock {
|
||||
|
||||
function add(address value) public {
|
||||
bool result = _set.add(value);
|
||||
emit TransactionResult(result);
|
||||
emit OperationResult(result);
|
||||
}
|
||||
|
||||
function remove(address value) public {
|
||||
bool result = _set.remove(value);
|
||||
emit TransactionResult(result);
|
||||
}
|
||||
|
||||
function enumerate() public view returns (address[] memory) {
|
||||
return _set.enumerate();
|
||||
emit OperationResult(result);
|
||||
}
|
||||
|
||||
function length() public view returns (uint256) {
|
||||
|
||||
Reference in New Issue
Block a user