Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct [[eosio::table]] poll
- {
- uint64_t key; // primary key
- uint64_t pollId; // second key, can be non-unique
- std::string pollName; // name of poll
- uint8_t pollStatus =0; // staus where 0 = closed, 1 = open, 2 = finished
- std::string option; // the item you can vote for
- uint32_t count =0; // the number of votes for each time
- uint64_t primary_key() const { return key; }
- uint64_t by_pollId() const {return pollId; }
- };
- _polls.emplace(get_self(), [&](auto& p) {
- p.key = _polls.available_primary_key(); // method
- p.pollId = _polls.available_primary_key();
- p.pollName = pollName;
- p.pollStatus = 0;
- p.option = "";
- p.count = 0;
- });
Add Comment
Please, Sign In to add comment