EnumerableMapMock.sol 932 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. pragma solidity ^0.6.0;
  2. import "../utils/EnumerableMap.sol";
  3. contract EnumerableMapMock {
  4. using EnumerableMap for EnumerableMap.UintToAddressMap;
  5. event OperationResult(bool result);
  6. EnumerableMap.UintToAddressMap private _map;
  7. function contains(uint256 key) public view returns (bool) {
  8. return _map.contains(key);
  9. }
  10. function set(uint256 key, address value) public {
  11. bool result = _map.set(key, value);
  12. emit OperationResult(result);
  13. }
  14. function remove(uint256 key) public {
  15. bool result = _map.remove(key);
  16. emit OperationResult(result);
  17. }
  18. function length() public view returns (uint256) {
  19. return _map.length();
  20. }
  21. function at(uint256 index) public view returns (uint256 key, address value) {
  22. return _map.at(index);
  23. }
  24. function get(uint256 key) public view returns (address) {
  25. return _map.get(key);
  26. }
  27. }