EnumerableSetMock.sol 791 B

123456789101112131415161718192021222324252627282930313233
  1. pragma solidity ^0.6.0;
  2. import "../utils/EnumerableSet.sol";
  3. contract EnumerableSetMock {
  4. using EnumerableSet for EnumerableSet.AddressSet;
  5. event OperationResult(bool result);
  6. EnumerableSet.AddressSet private _set;
  7. function contains(address value) public view returns (bool) {
  8. return _set.contains(value);
  9. }
  10. function add(address value) public {
  11. bool result = _set.add(value);
  12. emit OperationResult(result);
  13. }
  14. function remove(address value) public {
  15. bool result = _set.remove(value);
  16. emit OperationResult(result);
  17. }
  18. function length() public view returns (uint256) {
  19. return _set.length();
  20. }
  21. function at(uint256 index) public view returns (address) {
  22. return _set.at(index);
  23. }
  24. }