From e5514b38c0b9b4e7e202ea87f5937071ea698c78 Mon Sep 17 00:00:00 2001 From: Braun-Alex <72709229+Braun-Alex@users.noreply.github.com> Date: Sat, 9 Dec 2023 17:46:12 +0200 Subject: [PATCH] Fix: vote example Signed-off-by: Braun-Alex <72709229+Braun-Alex@users.noreply.github.com> --- vote/src/main.leo | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vote/src/main.leo b/vote/src/main.leo index 435902d..6db9432 100644 --- a/vote/src/main.leo +++ b/vote/src/main.leo @@ -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); }