1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- // SPDX-License-Identifier: MIT
- pragma solidity >=0.6.0 <0.8.0;
- import "../utils/EnumerableSet.sol";
- // Bytes32Set
- contract EnumerableBytes32SetMock {
- using EnumerableSet for EnumerableSet.Bytes32Set;
- event OperationResult(bool result);
- EnumerableSet.Bytes32Set private _set;
- function contains(bytes32 value) public view returns (bool) {
- return _set.contains(value);
- }
- function add(bytes32 value) public {
- bool result = _set.add(value);
- emit OperationResult(result);
- }
- function remove(bytes32 value) public {
- bool result = _set.remove(value);
- emit OperationResult(result);
- }
- function length() public view returns (uint256) {
- return _set.length();
- }
- function at(uint256 index) public view returns (bytes32) {
- return _set.at(index);
- }
- }
- // AddressSet
- contract EnumerableAddressSetMock {
- using EnumerableSet for EnumerableSet.AddressSet;
- event OperationResult(bool result);
- EnumerableSet.AddressSet private _set;
- function contains(address value) public view returns (bool) {
- return _set.contains(value);
- }
- function add(address value) public {
- bool result = _set.add(value);
- emit OperationResult(result);
- }
- function remove(address value) public {
- bool result = _set.remove(value);
- emit OperationResult(result);
- }
- function length() public view returns (uint256) {
- return _set.length();
- }
- function at(uint256 index) public view returns (address) {
- return _set.at(index);
- }
- }
- // UintSet
- contract EnumerableUintSetMock {
- using EnumerableSet for EnumerableSet.UintSet;
- event OperationResult(bool result);
- EnumerableSet.UintSet private _set;
- function contains(uint256 value) public view returns (bool) {
- return _set.contains(value);
- }
- function add(uint256 value) public {
- bool result = _set.add(value);
- emit OperationResult(result);
- }
- function remove(uint256 value) public {
- bool result = _set.remove(value);
- emit OperationResult(result);
- }
- function length() public view returns (uint256) {
- return _set.length();
- }
- function at(uint256 index) public view returns (uint256) {
- return _set.at(index);
- }
- }
|