EnumerableMapMock.sol 973 B

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