Skip to content

Commit

Permalink
Update example and related CI
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Jun 28, 2023
1 parent 186b500 commit 2f53dee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .circleci/test-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,10 @@ if [ $EXITCODE -ne 0 ]; then
echo "The \`vote\` program failed to run successfully."
exit $EXITCODE
fi

# Build the lottery example Leo program.
echo "Building the \`lottery\` program..."
(
cd $EXAMPLES/lottery || exit
$LEO build || exit
)
6 changes: 3 additions & 3 deletions examples/lottery/src/main.leo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ program lottery.aleo {
owner: address,
}

transition play() -> u32 {
transition play() -> Ticket {
let ticket: Ticket = Ticket {
owner: self.caller,
};
Expand All @@ -16,13 +16,13 @@ program lottery.aleo {

finalize play() {
// Check that the lottery has not expired.
assert(block.height <= 1000);
assert(block.height <= 1000u32);

// Randomly select whether or not the ticket is a winner.
assert(ChaCha::rand_bool());

// Check that the maximum number of winners have not been reached.
let winners: u8 = num_winners.get_or_use(0u8);
let winners: u8 = num_winners.get_or_use(0u8, 0u8);
assert(winners < 5u8);
num_winners.set(0u8, winners + 1u8);

Expand Down

0 comments on commit 2f53dee

Please sign in to comment.