diff --git a/auction/build/main.aleo b/auction/build/main.aleo index 480fe0c..0ebd409 100644 --- a/auction/build/main.aleo +++ b/auction/build/main.aleo @@ -8,11 +8,9 @@ record Bid: function place_bid: - input r0 as address.private; - input r1 as u64.private; - assert.eq self.caller r0; - cast aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh r0 r1 false into r2 as Bid.record; - output r2 as Bid.record; + input r0 as u64.private; + cast aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh self.caller r0 false into r1 as Bid.record; + output r1 as Bid.record; function resolve: diff --git a/auction/inputs/auction.in b/auction/inputs/auction.in index c3471d4..84e79a8 100644 --- a/auction/inputs/auction.in +++ b/auction/inputs/auction.in @@ -1,9 +1,5 @@ // The program input for auction/src/main.leo [place_bid] -// Note that `bidder` must have the same address as the caller (refer to `program.json`). -// Swapping the below lines, will result in an error. -// bidder: address = aleo1y7065c2jxkra5yzu9jfxq55klweqev0zas89lt9nxmfrqrafmq9qw2ktdg; -bidder: address = aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh; amount: u64 = 90u64; [resolve] diff --git a/auction/run.sh b/auction/run.sh index 560c345..a07fcfd 100755 --- a/auction/run.sh +++ b/auction/run.sh @@ -55,7 +55,7 @@ echo " ######## ######## ############################################################################### " -leo run place_bid aleo1yzlta2q5h8t0fqe0v6dyh9mtv4aggd53fgzr068jvplqhvqsnvzq7pj2ke 10u64 || exit +leo run place_bid 10u64 || exit # Swap in the private key and address of the second bidder to .env. echo " @@ -77,7 +77,7 @@ echo " ######## ######## ############################################################################### " -leo run place_bid aleo1esqchvevwn7n5p84e735w4dtwt2hdtu4dpguwgwy94tsxm2p7qpqmlrta4 90u64 || exit +leo run place_bid 90u64 || exit # Swap in the private key and address of the auctioneer to .env. echo " diff --git a/auction/src/main.leo b/auction/src/main.leo index ae94841..0442274 100644 --- a/auction/src/main.leo +++ b/auction/src/main.leo @@ -15,18 +15,14 @@ program auction.aleo { } // Returns a new bid. - // - `bidder` : The address of the account that placed the bid. // - `amount` : The amount of the bid. - // Requires that `bidder` matches the function caller. // The owner of the record is set to the entity responsible for running the auction (auction runner). // The address of the auction runner is aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh. - transition place_bid(bidder: address, amount: u64) -> Bid { - // Ensure the caller is the auction bidder. - assert_eq(self.caller, bidder); + transition place_bid(amount: u64) -> Bid { // Return a new 'Bid' record for the auction bidder. return Bid { owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - bidder: bidder, + bidder: self.caller, amount: amount, is_winner: false, };