github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/assets/how-to-guides/porting-solidity-to-gno/porting-4.sol (about) 1 function bid() external payable { 2 // No arguments are necessary, all 3 // information is already part of 4 // the transaction. The keyword payable 5 // is required for the function to 6 // be able to receive Ether. 7 8 // Revert the call if the bidding 9 // period is over. 10 if (block.timestamp > auctionEndTime) 11 revert AuctionAlreadyEnded(); 12 13 // If the bid is not higher, send the 14 // money back (the revert statement 15 // will revert all changes in this 16 // function execution including 17 // it having received the money). 18 if (msg.value <= highestBid) 19 revert BidNotHighEnough(highestBid); 20 21 if (highestBid != 0) { 22 // Sending back the money by simply using 23 // highestBidder.send(highestBid) is a security risk 24 // because it could execute an untrusted contract. 25 // It is always safer to let the recipients 26 // withdraw their money themselves. 27 pendingReturns[highestBidder] += highestBid; 28 } 29 highestBidder = msg.sender; 30 highestBid = msg.value; 31 emit HighestBidIncreased(msg.sender, msg.value); 32 }