This commit is contained in:
Eric Mastro 2022-11-28 14:43:03 +11:00
parent 3502632909
commit e80b5b80ef
No known key found for this signature in database
GPG Key ID: 141E3048D95A4E63
2 changed files with 5 additions and 13 deletions

View File

@ -20,17 +20,10 @@ library Mappings {
mapping(ValueId => Value) _values;
}
struct Key {
string name;
bool delux;
uint price;
EnumerableSetExtensions.ClearableBytes32Set _values;
}
struct Value {
string name;
bool delux;
uint price;
struct Value {
KeyId _keyId;
}
@ -118,10 +111,9 @@ library Mappings {
success = insertKey(map, key);
assert (success); // key insertion failure
}
map._valueIds.add(ValueId.unwrap(value));
map._values[value]._keyId = key;
success = map._keys[key]._values.add(ValueId.unwrap(value));
if (!exists(map, key, value)) {
success = insertValue(map, key, value);
}
}
function deleteKey(Mapping storage map, KeyId key)

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./libs/Mappings.sol";
import "./Mappings.sol";
// exposes public functions for testing
contract TestMappings {