I am trying to write a simple contract in which I am using set of records as storage.
type data = {
message : string,
did: address
};
type parameter =
| ["Published"]
| ["Revoked"];
type storage = set<data>;
type return_ = [list <operation>, storage];
let store: storage = Set.empty;
/* Two entrypoints */
const published = ([store] : [storage]) : storage => {
const entry = {message: "Credentials for has been published to the blockchain", did: Tezos.get_source()};
Set.add(entry, store);
return store;
};
const revoked = ([store] : [storage]) : storage => {
const entry = {message: "Credentials for has been revoked", did: Tezos.get_source()};
Set.add(entry, store);
return store;
};
But I am getting the below error in line
Set.add(entry, store)
Does anyone know what is issue here ?
Invalid type(s) Cannot unify set (record[did -> address , message -> string]) with unit.
store
) like in functional programming, not modifying the providedstore
in place?