mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-24 18:52:58 +03:00
[examples] Get this to compile at least.
This commit is contained in:
parent
07154af8ec
commit
54f2410e96
@ -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;
|
||||
|
@ -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 {
|
||||
winning_bidder = bidder;
|
||||
winning_bid = bid;
|
||||
}
|
||||
let new: Auction = Auction {
|
||||
owner: current.owner,
|
||||
gates: current.gates,
|
||||
winning_bidder: bidder,
|
||||
winning_bid: bid
|
||||
winning_bidder: winning_bidder,
|
||||
winning_bid: winning_bid
|
||||
};
|
||||
} else {
|
||||
return current;
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user