Add bytes32 to bytes32 enumerable map (#3192)
* feat(enumerablemap): add bytes32 to bytes32 map * chore(changelog): edit CHANGELOG * feat(enumerable map): edit struct visibility
This commit is contained in:
@ -84,4 +84,50 @@ contract AddressToUintMapMock {
|
||||
function get(address key) public view returns (uint256) {
|
||||
return _map.get(key);
|
||||
}
|
||||
|
||||
function getWithMessage(address key, string calldata errorMessage) public view returns (uint256) {
|
||||
return _map.get(key, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
contract Bytes32ToBytes32MapMock {
|
||||
using EnumerableMap for EnumerableMap.Bytes32ToBytes32Map;
|
||||
|
||||
event OperationResult(bool result);
|
||||
|
||||
EnumerableMap.Bytes32ToBytes32Map private _map;
|
||||
|
||||
function contains(bytes32 key) public view returns (bool) {
|
||||
return _map.contains(key);
|
||||
}
|
||||
|
||||
function set(bytes32 key, bytes32 value) public {
|
||||
bool result = _map.set(key, value);
|
||||
emit OperationResult(result);
|
||||
}
|
||||
|
||||
function remove(bytes32 key) public {
|
||||
bool result = _map.remove(key);
|
||||
emit OperationResult(result);
|
||||
}
|
||||
|
||||
function length() public view returns (uint256) {
|
||||
return _map.length();
|
||||
}
|
||||
|
||||
function at(uint256 index) public view returns (bytes32 key, bytes32 value) {
|
||||
return _map.at(index);
|
||||
}
|
||||
|
||||
function tryGet(bytes32 key) public view returns (bool, bytes32) {
|
||||
return _map.tryGet(key);
|
||||
}
|
||||
|
||||
function get(bytes32 key) public view returns (bytes32) {
|
||||
return _map.get(key);
|
||||
}
|
||||
|
||||
function getWithMessage(bytes32 key, string calldata errorMessage) public view returns (bytes32) {
|
||||
return _map.get(key, errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user