Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct [[ eosio::table, eosio::contract("voting") ]] identity
- {
- uint64_t key;
- key256 identityHash;
- time_point_sec createdAt;
- uint64_t primary_key() const { return key; }
- key256 by_hash() const { return identityHash; }
- };
- typedef multi_index<"identity"_n, identity,
- indexed_by< "by_hash"_n, const_mem_fun<identity, key256, &identity::by_hash> >
- > identity_index;
- voting::identity_index identities(_code, _code.value);
- auto itr = identities.find(out);
- eosio_assert(itr == identities.end(), "User already registered to vote!");
- std::vector<uint64_t> keysForDeletionFromVotes;
- // find items which are for the named poll
- for(auto& item : _votes) {
- if (item.pollName == pollName) {
- keysForDeletionFromVotes.push_back(item.key);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement