I would like to know if this is possible to check in a simple way if a bytes32 value exists in an array of bytes32 value please?
contract Test {
struct TestStruct {
string name;
bytes32 value;
}
struct ConfigStruct {
bytes32[] valuesPossible;
}
TestStruct[] public structs;
ConfigStruct[] configs;
function constructor(bytes32[] _valuesToStore) public {
configs.push(ConfigStruct(_valuesToStore));
}
function add(string _name, uint _idConfig, bytes32 _valueToStore) valueIsPossible(_idConfig, _valueToStore) public {
structs.push(TestStruct("test", _valueToStore));
}
modifier valueIsPossible(uint _idConfig, bytes32 _valueToStore) {
//require(configs[_idConfig].valuesPossible[_valueToStore]); // How to check that
_;
}
}
Thanks by advance
EDIT: Sorry my code was not very accurate, I updated it