Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- CrestFaucetNative
- Optimization enabled
- true
- Compiler version
- v0.8.26+commit.8a97fa7a
- Optimization runs
- 2000
- EVM Version
- paris
- Verified at
- 2025-06-02T15:10:26.242146Z
Contract source code
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } } // File: contracts/faucet.sol pragma solidity ^0.8.20; contract CrestFaucetNative is ReentrancyGuard { uint256 public amountToSend = 0.01 ether; uint256 public cooldownTime = 1 days; mapping(address => uint256) public lastClaimed; address public owner; modifier onlyOwner() { require(msg.sender == owner, "Not owner"); _; } constructor() { owner = msg.sender; } function claim() external nonReentrant { require(block.timestamp - lastClaimed[msg.sender] >= cooldownTime, "Wait 24h"); require(address(this).balance >= amountToSend, "Faucet empty"); lastClaimed[msg.sender] = block.timestamp; (bool sent, ) = msg.sender.call{value: amountToSend}(""); require(sent, "Transfer failed"); } function setAmount(uint256 _amount) external onlyOwner { amountToSend = _amount; } function withdraw(address payable to, uint256 amount) external onlyOwner { require(address(this).balance >= amount, "Insufficient"); (bool sent, ) = to.call{value: amount}(""); require(sent, "Withdraw failed"); } receive() external payable {} }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"amountToSend","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"cooldownTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastClaimed","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAmount","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"address","name":"to","internalType":"address payable"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x6080604052662386f26fc1000060015562015180600255348015602157600080fd5b506001600055600480546001600160a01b0319163317905561064a806100486000396000f3fe6080604052600436106100745760003560e01c80638da5cb5b1161004e5780638da5cb5b146100f7578063ae27758414610149578063b319c6b71461015f578063f3fef3a31461017557600080fd5b8063013eba9214610080578063271f88b4146100c05780634e71d92d146100e257600080fd5b3661007b57005b600080fd5b34801561008c57600080fd5b506100ad61009b36600461056b565b60036020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156100cc57600080fd5b506100e06100db36600461058f565b610195565b005b3480156100ee57600080fd5b506100e0610206565b34801561010357600080fd5b506004546101249073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b34801561015557600080fd5b506100ad60015481565b34801561016b57600080fd5b506100ad60025481565b34801561018157600080fd5b506100e06101903660046105a8565b610381565b60045473ffffffffffffffffffffffffffffffffffffffff1633146102015760405162461bcd60e51b815260206004820152600960248201527f4e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600155565b61020e6104ed565b6002543360009081526003602052604090205461022b90426105d4565b10156102795760405162461bcd60e51b815260206004820152600860248201527f576169742032346800000000000000000000000000000000000000000000000060448201526064016101f8565b6001544710156102cb5760405162461bcd60e51b815260206004820152600c60248201527f46617563657420656d707479000000000000000000000000000000000000000060448201526064016101f8565b3360008181526003602052604080822042905560015490519192918381818185875af1925050503d806000811461031e576040519150601f19603f3d011682016040523d82523d6000602084013e610323565b606091505b50509050806103745760405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c6564000000000000000000000000000000000060448201526064016101f8565b5061037f6001600055565b565b60045473ffffffffffffffffffffffffffffffffffffffff1633146103e85760405162461bcd60e51b815260206004820152600960248201527f4e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016101f8565b804710156104385760405162461bcd60e51b815260206004820152600c60248201527f496e73756666696369656e74000000000000000000000000000000000000000060448201526064016101f8565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610492576040519150601f19603f3d011682016040523d82523d6000602084013e610497565b606091505b50509050806104e85760405162461bcd60e51b815260206004820152600f60248201527f5769746864726177206661696c6564000000000000000000000000000000000060448201526064016101f8565b505050565b60026000540361053f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101f8565b6002600055565b73ffffffffffffffffffffffffffffffffffffffff8116811461056857600080fd5b50565b60006020828403121561057d57600080fd5b813561058881610546565b9392505050565b6000602082840312156105a157600080fd5b5035919050565b600080604083850312156105bb57600080fd5b82356105c681610546565b946020939093013593505050565b8181038181111561060e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212209ce6cbaeb26b2a798cb1fe6a24274d984913c81a32ef271852b290bb0f5bed7164736f6c634300081a0033
Deployed ByteCode
0x6080604052600436106100745760003560e01c80638da5cb5b1161004e5780638da5cb5b146100f7578063ae27758414610149578063b319c6b71461015f578063f3fef3a31461017557600080fd5b8063013eba9214610080578063271f88b4146100c05780634e71d92d146100e257600080fd5b3661007b57005b600080fd5b34801561008c57600080fd5b506100ad61009b36600461056b565b60036020526000908152604090205481565b6040519081526020015b60405180910390f35b3480156100cc57600080fd5b506100e06100db36600461058f565b610195565b005b3480156100ee57600080fd5b506100e0610206565b34801561010357600080fd5b506004546101249073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b34801561015557600080fd5b506100ad60015481565b34801561016b57600080fd5b506100ad60025481565b34801561018157600080fd5b506100e06101903660046105a8565b610381565b60045473ffffffffffffffffffffffffffffffffffffffff1633146102015760405162461bcd60e51b815260206004820152600960248201527f4e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b600155565b61020e6104ed565b6002543360009081526003602052604090205461022b90426105d4565b10156102795760405162461bcd60e51b815260206004820152600860248201527f576169742032346800000000000000000000000000000000000000000000000060448201526064016101f8565b6001544710156102cb5760405162461bcd60e51b815260206004820152600c60248201527f46617563657420656d707479000000000000000000000000000000000000000060448201526064016101f8565b3360008181526003602052604080822042905560015490519192918381818185875af1925050503d806000811461031e576040519150601f19603f3d011682016040523d82523d6000602084013e610323565b606091505b50509050806103745760405162461bcd60e51b815260206004820152600f60248201527f5472616e73666572206661696c6564000000000000000000000000000000000060448201526064016101f8565b5061037f6001600055565b565b60045473ffffffffffffffffffffffffffffffffffffffff1633146103e85760405162461bcd60e51b815260206004820152600960248201527f4e6f74206f776e6572000000000000000000000000000000000000000000000060448201526064016101f8565b804710156104385760405162461bcd60e51b815260206004820152600c60248201527f496e73756666696369656e74000000000000000000000000000000000000000060448201526064016101f8565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610492576040519150601f19603f3d011682016040523d82523d6000602084013e610497565b606091505b50509050806104e85760405162461bcd60e51b815260206004820152600f60248201527f5769746864726177206661696c6564000000000000000000000000000000000060448201526064016101f8565b505050565b60026000540361053f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016101f8565b6002600055565b73ffffffffffffffffffffffffffffffffffffffff8116811461056857600080fd5b50565b60006020828403121561057d57600080fd5b813561058881610546565b9392505050565b6000602082840312156105a157600080fd5b5035919050565b600080604083850312156105bb57600080fd5b82356105c681610546565b946020939093013593505050565b8181038181111561060e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b9291505056fea26469706673582212209ce6cbaeb26b2a798cb1fe6a24274d984913c81a32ef271852b290bb0f5bed7164736f6c634300081a0033