From f9bec4fb673b13d7030969625f3be677971ac6b6 Mon Sep 17 00:00:00 2001 From: Luke Newman <5315645+lukenewman@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:44:12 -0500 Subject: [PATCH] update var --- arcade/raffle/build/README.md | 2 +- arcade/raffle/build/main.aleo | 300 ++++++++++++++++--------------- arcade/raffle/build/program.json | 2 +- arcade/raffle/program.json | 2 +- arcade/raffle/src/main.leo | 4 +- 5 files changed, 160 insertions(+), 150 deletions(-) diff --git a/arcade/raffle/build/README.md b/arcade/raffle/build/README.md index 5f705dc..5f144d8 100644 --- a/arcade/raffle/build/README.md +++ b/arcade/raffle/build/README.md @@ -1,4 +1,4 @@ -# giveaway_731_3.aleo +# giveaway.aleo ## Build Guide diff --git a/arcade/raffle/build/main.aleo b/arcade/raffle/build/main.aleo index 5753376..f97f2f8 100644 --- a/arcade/raffle/build/main.aleo +++ b/arcade/raffle/build/main.aleo @@ -1,5 +1,5 @@ import puzzle_arcade_ticket_v001.aleo; -program giveaway_731_3.aleo; +program giveaway.aleo; struct PrivateKey: pk_pt1 as u128; @@ -55,295 +55,305 @@ function buy_one_entry: call puzzle_arcade_ticket_v001.aleo/spend r0 1000000u64 into r1; async buy_one_entry r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_one_entry.future; + output r2 as giveaway.aleo/buy_one_entry.future; finalize buy_one_entry: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; + add r1 1u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; set r0 into entries[r1]; - add r1 1u64 into r3; - set r3 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r4; - add r4 1u16 into r5; - set r5 into user_entries[r0]; + add r1 1u64 into r4; + set r4 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r5; + add r5 1u16 into r6; + set r6 into user_entries[r0]; function buy_two_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 2000000u64 into r1; async buy_two_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_two_entries.future; + output r2 as giveaway.aleo/buy_two_entries.future; finalize buy_two_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 2u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; - set r5 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r6; - add r6 2u16 into r7; - set r7 into user_entries[r0]; + add r1 1u64 into r5; + set r0 into entries[r5]; + add r1 2u64 into r6; + set r6 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r7; + add r7 2u16 into r8; + set r8 into user_entries[r0]; function buy_three_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 3000000u64 into r1; async buy_three_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_three_entries.future; + output r2 as giveaway.aleo/buy_three_entries.future; finalize buy_three_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 3u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; - set r6 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r7; - add r7 3u16 into r8; - set r8 into user_entries[r0]; + add r1 2u64 into r6; + set r0 into entries[r6]; + add r1 3u64 into r7; + set r7 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r8; + add r8 3u16 into r9; + set r9 into user_entries[r0]; function buy_four_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 4000000u64 into r1; async buy_four_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_four_entries.future; + output r2 as giveaway.aleo/buy_four_entries.future; finalize buy_four_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 4u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; - set r7 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r8; - add r8 4u16 into r9; - set r9 into user_entries[r0]; + add r1 3u64 into r7; + set r0 into entries[r7]; + add r1 4u64 into r8; + set r8 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r9; + add r9 4u16 into r10; + set r10 into user_entries[r0]; function buy_five_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 5000000u64 into r1; async buy_five_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_five_entries.future; + output r2 as giveaway.aleo/buy_five_entries.future; finalize buy_five_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 5u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; + add r1 3u64 into r7; set r0 into entries[r7]; - add r1 5u64 into r8; - set r8 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r9; - add r9 5u16 into r10; - set r10 into user_entries[r0]; + add r1 4u64 into r8; + set r0 into entries[r8]; + add r1 5u64 into r9; + set r9 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r10; + add r10 5u16 into r11; + set r11 into user_entries[r0]; function buy_six_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 6000000u64 into r1; async buy_six_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_six_entries.future; + output r2 as giveaway.aleo/buy_six_entries.future; finalize buy_six_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 6u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; + add r1 3u64 into r7; set r0 into entries[r7]; - add r1 5u64 into r8; + add r1 4u64 into r8; set r0 into entries[r8]; - add r1 6u64 into r9; - set r9 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r10; - add r10 6u16 into r11; - set r11 into user_entries[r0]; + add r1 5u64 into r9; + set r0 into entries[r9]; + add r1 6u64 into r10; + set r10 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r11; + add r11 6u16 into r12; + set r12 into user_entries[r0]; function buy_seven_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 7000000u64 into r1; async buy_seven_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_seven_entries.future; + output r2 as giveaway.aleo/buy_seven_entries.future; finalize buy_seven_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 7u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; + add r1 3u64 into r7; set r0 into entries[r7]; - add r1 5u64 into r8; + add r1 4u64 into r8; set r0 into entries[r8]; - add r1 6u64 into r9; + add r1 5u64 into r9; set r0 into entries[r9]; - add r1 7u64 into r10; - set r10 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r11; - add r11 7u16 into r12; - set r12 into user_entries[r0]; + add r1 6u64 into r10; + set r0 into entries[r10]; + add r1 7u64 into r11; + set r11 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r12; + add r12 7u16 into r13; + set r13 into user_entries[r0]; function buy_eight_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 8000000u64 into r1; async buy_eight_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_eight_entries.future; + output r2 as giveaway.aleo/buy_eight_entries.future; finalize buy_eight_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 8u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; + add r1 3u64 into r7; set r0 into entries[r7]; - add r1 5u64 into r8; + add r1 4u64 into r8; set r0 into entries[r8]; - add r1 6u64 into r9; + add r1 5u64 into r9; set r0 into entries[r9]; - add r1 7u64 into r10; + add r1 6u64 into r10; set r0 into entries[r10]; - add r1 8u64 into r11; - set r11 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r12; - add r12 8u16 into r13; - set r13 into user_entries[r0]; + add r1 7u64 into r11; + set r0 into entries[r11]; + add r1 8u64 into r12; + set r12 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r13; + add r13 8u16 into r14; + set r14 into user_entries[r0]; function buy_nine_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 9000000u64 into r1; async buy_nine_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_nine_entries.future; + output r2 as giveaway.aleo/buy_nine_entries.future; finalize buy_nine_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 9u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; + add r1 3u64 into r7; set r0 into entries[r7]; - add r1 5u64 into r8; + add r1 4u64 into r8; set r0 into entries[r8]; - add r1 6u64 into r9; + add r1 5u64 into r9; set r0 into entries[r9]; - add r1 7u64 into r10; + add r1 6u64 into r10; set r0 into entries[r10]; - add r1 8u64 into r11; + add r1 7u64 into r11; set r0 into entries[r11]; - add r1 9u64 into r12; - set r12 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r13; - add r13 9u16 into r14; - set r14 into user_entries[r0]; + add r1 8u64 into r12; + set r0 into entries[r12]; + add r1 9u64 into r13; + set r13 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r14; + add r14 9u16 into r15; + set r15 into user_entries[r0]; function buy_ten_entries: input r0 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; call puzzle_arcade_ticket_v001.aleo/spend r0 10000000u64 into r1; async buy_ten_entries r0.owner into r2; output r1 as puzzle_arcade_ticket_v001.aleo/PuzzleArcadeTicket.record; - output r2 as giveaway_731_3.aleo/buy_ten_entries.future; + output r2 as giveaway.aleo/buy_ten_entries.future; finalize buy_ten_entries: input r0 as address.public; get.or_use total_entries[0u64] 0u64 into r1; - lt r1 50u64 into r2; - assert.eq r2 true; - add r1 0u64 into r3; - set r0 into entries[r3]; - add r1 1u64 into r4; + add r1 10u64 into r2; + lt r2 50u64 into r3; + assert.eq r3 true; + add r1 0u64 into r4; set r0 into entries[r4]; - add r1 2u64 into r5; + add r1 1u64 into r5; set r0 into entries[r5]; - add r1 3u64 into r6; + add r1 2u64 into r6; set r0 into entries[r6]; - add r1 4u64 into r7; + add r1 3u64 into r7; set r0 into entries[r7]; - add r1 5u64 into r8; + add r1 4u64 into r8; set r0 into entries[r8]; - add r1 6u64 into r9; + add r1 5u64 into r9; set r0 into entries[r9]; - add r1 7u64 into r10; + add r1 6u64 into r10; set r0 into entries[r10]; - add r1 8u64 into r11; + add r1 7u64 into r11; set r0 into entries[r11]; - add r1 9u64 into r12; + add r1 8u64 into r12; set r0 into entries[r12]; - add r1 10u64 into r13; - set r13 into total_entries[0u64]; - get.or_use user_entries[r0] 0u16 into r14; - add r14 10u16 into r15; - set r15 into user_entries[r0]; + add r1 9u64 into r13; + set r0 into entries[r13]; + add r1 10u64 into r14; + set r14 into total_entries[0u64]; + get.or_use user_entries[r0] 0u16 into r15; + add r15 10u16 into r16; + set r16 into user_entries[r0]; function draw_winner: assert.eq self.caller self.signer; assert.eq self.caller aleo196a39wq9q8ea779cmlmff0c9pj2gl4f5e8fhjpvmufe5utuq7y8snz4h2l; async draw_winner into r0; - output r0 as giveaway_731_3.aleo/draw_winner.future; + output r0 as giveaway.aleo/draw_winner.future; finalize draw_winner: get total_entries[0u64] into r0; diff --git a/arcade/raffle/build/program.json b/arcade/raffle/build/program.json index 3575e3f..75c7bee 100644 --- a/arcade/raffle/build/program.json +++ b/arcade/raffle/build/program.json @@ -1,5 +1,5 @@ { - "program": "giveaway_731_3.aleo", + "program": "giveaway.aleo", "version": "0.0.0", "description": "", "license": "MIT" diff --git a/arcade/raffle/program.json b/arcade/raffle/program.json index d5cf822..26b0a12 100644 --- a/arcade/raffle/program.json +++ b/arcade/raffle/program.json @@ -1,5 +1,5 @@ { - "program": "giveaway_731_3.aleo", + "program": "giveaway.aleo", "version": "0.0.0", "description": "", "license": "MIT", diff --git a/arcade/raffle/src/main.leo b/arcade/raffle/src/main.leo index a57a4c3..116c8bd 100644 --- a/arcade/raffle/src/main.leo +++ b/arcade/raffle/src/main.leo @@ -1,6 +1,6 @@ import puzzle_arcade_ticket_v001.aleo; -program giveaway_731_3.aleo { +program giveaway.aleo { const OPERATOR: address = aleo196a39wq9q8ea779cmlmff0c9pj2gl4f5e8fhjpvmufe5utuq7y8snz4h2l; const MAX_ENTRIES: u64 = 50u64; @@ -70,7 +70,7 @@ program giveaway_731_3.aleo { async function add_one_entry (public participant: address) { // get current raffle count, if first entry, choose default of 0u64 let current_raffle_count: u64 = Mapping::get_or_use(total_entries, 0u64, 0u64); - assert(current_raffle_coun + 1u64 < MAX_ENTRIES); + assert(current_raffle_count + 1u64 < MAX_ENTRIES); // add address to entry mapping Mapping::set(entries, current_raffle_count, participant);