Faucet: A Solidity contract implementing a faucet


SUBMITTED BY: proshore28

DATE: Feb. 7, 2024, 9:25 a.m.

FORMAT: ANTLR With Python Target

SIZE: 428 Bytes

HITS: 308

  1. 1 // Our first contract is a faucet!
  2. 2 contract Faucet {
  3. 3
  4. 4 // Give out ether to anyone who asks
  5. 5 function withdraw(uint withdraw_amount) public {
  6. 6
  7. 7 // Limit withdrawal amount
  8. 8 require(withdraw_amount <= 100000000000000000);
  9. 9
  10. 10 // Send the amount to the address that requested it
  11. 11 msg.sender.transfer(withdraw_amount);
  12. 12 }
  13. 13
  14. 14 // Accept any incoming amount
  15. 15 function () public payable {}
  16. 16
  17. 17

comments powered by Disqus