[examples] Get this to compile at least.

This commit is contained in:
Alessandro Coglio 2022-08-03 23:21:54 -07:00
parent 07154af8ec
commit 54f2410e96
2 changed files with 19 additions and 10 deletions

View File

@ -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;

View File

@ -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;
}