Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. struct [[ eosio::table, eosio::contract("voting") ]] identity
  2. {
  3. uint64_t key;
  4. key256 identityHash;
  5. time_point_sec createdAt;
  6.  
  7. uint64_t primary_key() const { return key; }
  8. key256 by_hash() const { return identityHash; }
  9. };
  10. typedef multi_index<"identity"_n, identity,
  11. indexed_by< "by_hash"_n, const_mem_fun<identity, key256, &identity::by_hash> >
  12. > identity_index;
  13.  
  14. voting::identity_index identities(_code, _code.value);
  15. auto itr = identities.find(out);
  16. eosio_assert(itr == identities.end(), "User already registered to vote!");
  17.  
  18. std::vector<uint64_t> keysForDeletionFromVotes;
  19. // find items which are for the named poll
  20. for(auto& item : _votes) {
  21. if (item.pollName == pollName) {
  22. keysForDeletionFromVotes.push_back(item.key);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement