Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: vote example #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions vote/src/main.leo
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,21 @@ program vote.aleo {
// Generate a new proposal id.
let id: field = BHP256::hash_to_field(info.title);

// Produce a proposal record for the proposer.
let new: Proposal = Proposal {
owner: self.caller,
id,
info,
};


// Return a new record for the proposal.
// Finalize the proposal id.
return Proposal {
owner: self.caller,
id,
info,
} then finalize(id);
// Finalize the proposal id and info.
return new then finalize(id, info);
}
// Create a new proposal in the "tickets" mapping.
finalize propose(public id: field) {
// Create a new proposal in the "proposals" and "tickets" mappings.
finalize propose(public id: field, public info: ProposalInfo) {
Mapping::set(proposals, id, info);
Mapping::set(tickets, id, 0u64);
}

Expand Down