From 54f2410e962a842d63be124cd84042502cd8fb1b Mon Sep 17 00:00:00 2001 From: Alessandro Coglio Date: Wed, 3 Aug 2022 23:21:54 -0700 Subject: [PATCH] [examples] Get this to compile at least. --- examples/auction/inputs/auction.in | 10 ++++++++-- examples/auction/src/main.leo | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/examples/auction/inputs/auction.in b/examples/auction/inputs/auction.in index 018a121e54..0293beebcb 100644 --- a/examples/auction/inputs/auction.in +++ b/examples/auction/inputs/auction.in @@ -1,4 +1,10 @@ // The program input for auction/src/main.leo [main] -public a: u32 = 1u32; -b: u32 = 2u32; +current: Auction = Auction { + owner: aleo1ht2a9q0gsd38j0se4t9lsfulxgqrens2vgzgry3pkvs93xrrzu8s892zn7, + gates: 0u64, + winning_bidder: aleo1ht2a9q0gsd38j0se4t9lsfulxgqrens2vgzgry3pkvs93xrrzu8s892zn7, + winning_bid: 50u64 +}; +bidder: address = aleo1ht2a9q0gsd38j0se4t9lsfulxgqrens2vgzgry3pkvs93xrrzu8s892zn7; +bid: u64 = 100u64; diff --git a/examples/auction/src/main.leo b/examples/auction/src/main.leo index 55638447b5..629d0667d2 100644 --- a/examples/auction/src/main.leo +++ b/examples/auction/src/main.leo @@ -6,14 +6,17 @@ record Auction { } function main(current: Auction, bidder: address, bid: u64) -> Auction { + let winning_bidder: address = current.winning_bidder; + let winning_bid: u64 = current.winning_bid; if bid > current.winning_bid { - return Auction { - owner: current.owner, - gates: current.gates, - winning_bidder: bidder, - winning_bid: bid - }; - } else { - return current; + winning_bidder = bidder; + winning_bid = bid; } + let new: Auction = Auction { + owner: current.owner, + gates: current.gates, + winning_bidder: winning_bidder, + winning_bid: winning_bid + }; + return new; }