Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- EthereumFaucet
- Optimization enabled
- true
- Compiler version
- v0.8.21+commit.d9974bed
- Optimization runs
- 200
- EVM Version
- paris
- Verified at
- 2023-10-04T08:34:09.758113Z
Contract source code
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract EthereumFaucet { mapping(address => bool) public hasClaimed; uint256 public claimAmount = 0.1 ether; // Amount to claim in wei address private owner; // Modifier to restrict certain functions only to the contract owner modifier onlyOwner() { require(msg.sender == owner, "Not the contract owner"); _; } constructor() { owner = msg.sender; } // Function to claim ETH function claim() external { require(!hasClaimed[msg.sender], "Already claimed"); require(address(this).balance >= claimAmount, "Insufficient faucet balance"); hasClaimed[msg.sender] = true; payable(msg.sender).transfer(claimAmount); } // Function to top up the faucet, can be called by anyone function topUp() external payable {} // Function to change the claim amount by the owner function setClaimAmount(uint256 newAmount) external onlyOwner { claimAmount = newAmount; } // Function to withdraw funds from the faucet (for owner only) function withdraw(uint256 amount) external onlyOwner { require(address(this).balance >= amount, "Insufficient funds"); payable(owner).transfer(amount); } // Fallback function to receive ETH receive() external payable {} }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasClaimed","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setClaimAmount","inputs":[{"type":"uint256","name":"newAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"topUp","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405267016345785d8a000060015534801561001c57600080fd5b50600280546001600160a01b031916331790556103c38061003e6000396000f3fe6080604052600436106100595760003560e01c80632e1a7d4d146100655780634e71d92d1461008757806373b2e80e1461009c578063830953ab146100e1578063b1c7ef0c14610105578063dc29f1de1461008557600080fd5b3661006057005b600080fd5b34801561007157600080fd5b50610085610080366004610344565b610125565b005b34801561009357600080fd5b50610085610200565b3480156100a857600080fd5b506100cc6100b736600461035d565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156100ed57600080fd5b506100f760015481565b6040519081526020016100d8565b34801561011157600080fd5b50610085610120366004610344565b6102ec565b6002546001600160a01b0316331461017d5760405162461bcd60e51b81526020600482015260166024820152752737ba103a34329031b7b73a3930b1ba1037bbb732b960511b60448201526064015b60405180910390fd5b804710156101c25760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610174565b6002546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156101fc573d6000803e3d6000fd5b5050565b3360009081526020819052604090205460ff16156102525760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610174565b6001544710156102a45760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e74206661756365742062616c616e636500000000006044820152606401610174565b33600081815260208190526040808220805460ff1916600190811790915554905181156108fc0292818181858888f193505050501580156102e9573d6000803e3d6000fd5b50565b6002546001600160a01b0316331461033f5760405162461bcd60e51b81526020600482015260166024820152752737ba103a34329031b7b73a3930b1ba1037bbb732b960511b6044820152606401610174565b600155565b60006020828403121561035657600080fd5b5035919050565b60006020828403121561036f57600080fd5b81356001600160a01b038116811461038657600080fd5b939250505056fea26469706673582212207f8290daf57f8dd2208d4fc76e7fcadf3ea1d36b0b2cd3adb7b5ae67c02b752d64736f6c63430008150033
Deployed ByteCode
0x6080604052600436106100595760003560e01c80632e1a7d4d146100655780634e71d92d1461008757806373b2e80e1461009c578063830953ab146100e1578063b1c7ef0c14610105578063dc29f1de1461008557600080fd5b3661006057005b600080fd5b34801561007157600080fd5b50610085610080366004610344565b610125565b005b34801561009357600080fd5b50610085610200565b3480156100a857600080fd5b506100cc6100b736600461035d565b60006020819052908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156100ed57600080fd5b506100f760015481565b6040519081526020016100d8565b34801561011157600080fd5b50610085610120366004610344565b6102ec565b6002546001600160a01b0316331461017d5760405162461bcd60e51b81526020600482015260166024820152752737ba103a34329031b7b73a3930b1ba1037bbb732b960511b60448201526064015b60405180910390fd5b804710156101c25760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b6044820152606401610174565b6002546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156101fc573d6000803e3d6000fd5b5050565b3360009081526020819052604090205460ff16156102525760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610174565b6001544710156102a45760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e74206661756365742062616c616e636500000000006044820152606401610174565b33600081815260208190526040808220805460ff1916600190811790915554905181156108fc0292818181858888f193505050501580156102e9573d6000803e3d6000fd5b50565b6002546001600160a01b0316331461033f5760405162461bcd60e51b81526020600482015260166024820152752737ba103a34329031b7b73a3930b1ba1037bbb732b960511b6044820152606401610174565b600155565b60006020828403121561035657600080fd5b5035919050565b60006020828403121561036f57600080fd5b81356001600160a01b038116811461038657600080fd5b939250505056fea26469706673582212207f8290daf57f8dd2208d4fc76e7fcadf3ea1d36b0b2cd3adb7b5ae67c02b752d64736f6c63430008150033