github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/assets/how-to-guides/porting-solidity-to-gno/porting-5.gno (about) 1 func Bid() { 2 if std.GetHeight() > auctionEndBlock { 3 panic("Exceeded auction end block") 4 } 5 6 sentCoins := std.GetOrigSend() 7 if len(sentCoins) != 1 { 8 panic("Send only one type of coin") 9 } 10 11 sentAmount := uint(sentCoins[0].Amount) 12 if sentAmount <= highestBid { 13 panic("Too few coins sent") 14 } 15 16 // A new bid is higher than the current highest bid 17 if sentAmount > highestBid { 18 // If the highest bid is greater than 0, 19 if highestBid > 0 { 20 // Need to return the bid amount to the existing highest bidder 21 // Create an AVL tree and save 22 pendingReturns.Set(highestBidder.String(), highestBid) 23 } 24 25 // Update the top bidder address 26 highestBidder = std.GetOrigCaller() 27 // Update the top bid amount 28 highestBid = sentAmount 29 } 30 }