Source Code
Overview
S Balance
Token Holdings
More Info
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
RUSDCFaucet
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.28; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract RUSDCFaucet is Ownable { IERC20 public usdc; uint256 public constant FAUCET_AMOUNT = 1000 * 10**6; // 1000 USDC mapping(address => uint256) public lastFaucetTime; uint256 public constant FAUCET_COOLDOWN = 24 hours; error CooldownNotExpired(); error InsufficientFaucetBalance(); error TransferFailed(); event TokensRequested(address indexed user, uint256 amount); event TokensWithdrawn(address indexed owner, uint256 amount); constructor(address _usdc) Ownable(msg.sender) { usdc = IERC20(_usdc); } function requestTokens() external { // Checks if (block.timestamp < lastFaucetTime[msg.sender] + FAUCET_COOLDOWN) revert CooldownNotExpired(); if (usdc.balanceOf(address(this)) < FAUCET_AMOUNT) revert InsufficientFaucetBalance(); // Effects lastFaucetTime[msg.sender] = block.timestamp; emit TokensRequested(msg.sender, FAUCET_AMOUNT); // Interactions bool success = usdc.transfer(msg.sender, FAUCET_AMOUNT); if (!success) revert TransferFailed(); } function withdrawTokens() external onlyOwner { // Checks uint256 balance = usdc.balanceOf(address(this)); // Effects emit TokensWithdrawn(owner(), balance); // Interactions bool success = usdc.transfer(owner(), balance); if (!success) revert TransferFailed(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
{ "viaIR": true, "optimizer": { "enabled": true, "runs": 200, "details": { "yulDetails": { "optimizerSteps": "u" } } }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_usdc","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CooldownNotExpired","type":"error"},{"inputs":[],"name":"InsufficientFaucetBalance","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensWithdrawn","type":"event"},{"inputs":[],"name":"FAUCET_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FAUCET_COOLDOWN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastFaucetTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523461002a576100196100146100c2565b610136565b60405161087a61022d823961087a90f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b0382111761006657604052565b61002f565b9061007f61007860405190565b9283610045565b565b6001600160a01b031690565b90565b6001600160a01b0381160361002a57565b9050519061007f82610090565b9060208282031261002a5761008d916100a1565b61008d610aa7803803806100d58161006b565b9283398101906100ae565b61008d90610081906001600160a01b031682565b61008d906100e0565b61008d906100f4565b9061011661008d610132926100fd565b82546001600160a01b0319166001600160a01b03919091161790565b9055565b61014b61007f916101463361017b565b6100fd565b6001610106565b61008161008d61008d9290565b61008d90610152565b6001600160a01b03909116815260200190565b60006101868161015f565b6001600160a01b0381166001600160a01b038416146101aa57505061007f906101da565b631e4fbdf760e01b825281906101c39060048301610168565b0390fd5b61008d90610081565b61008d90546101c7565b6101fb6101f56101ea60006101d0565b610146846000610106565b916100fd565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061022660405190565b600090a356fe6080604052600436101561001257600080fd5b60003560e01c8063359cf2b7146100a25780633e413bee1461009d578063715018a61461009857806376697640146100935780637bc1f6cc1461008e5780637d1d5d19146100895780638d8f2adb146100845780638da5cb5b1461007f5763f2fde38b036100b2576102ef565b6102c8565b610297565b61027c565b61024d565b6101ae565b610174565b61014d565b6100b7565b60009103126100b257565b600080fd5b346100b2576100c73660046100a7565b6100cf610436565b60405180805b0390f35b6100ee916008021c5b6001600160a01b031690565b90565b906100ee91546100d9565b6100ee600060016100f1565b6100ee906100e2906001600160a01b031682565b6100ee90610108565b6100ee9061011c565b61013790610125565b9052565b60208101929161014b919061012e565b565b346100b25761015d3660046100a7565b6100d56101686100fc565b6040519182918261013b565b346100b2576101843660046100a7565b6100cf610646565b6100ee6100ee6100ee9290565b6100ee633b9aca0061018c565b6100ee610199565b346100b2576101be3660046100a7565b6100d56101c96101a6565b6040519182918290815260200190565b6101e2816100e2565b036100b257565b9050359061014b826101d9565b906020828203126100b2576100ee916101e9565b9061021490610125565b600052602052604060002090565b6100ee916008021c81565b906100ee9154610222565b60006102486100ee92600261020a565b61022d565b346100b2576100d56101c96102633660046101f6565b610238565b6100ee6201518061018c565b6100ee610268565b346100b25761028c3660046100a7565b6100d56101c9610274565b346100b2576102a73660046100a7565b6100cf61071e565b610137906100e2565b60208101929161014b91906102af565b346100b2576102d83660046100a7565b6100d56102e3610726565b604051918291826102b8565b346100b2576100cf6103023660046101f6565b610786565b6100ee9081565b6100ee9054610307565b634e487b7160e01b600052601160045260246000fd5b9190820180921161033b57565b610318565b6100ee906100e2565b6100ee9054610340565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761038b57604052565b610353565b806101e2565b9050519061014b82610390565b906020828203126100b2576100ee91610396565b6040513d6000823e3d90fd5b90600019905b9181191691161790565b906103e36100ee6103ea9261018c565b82546103c3565b9055565b8015156101e2565b9050519061014b826103ee565b906020828203126100b2576100ee916103f6565b91602061014b929493610432604082019660008301906102af565b0152565b61045d6100ee61044f61044a33600261020a565b61030e565b610457610268565b9061032e565b42106105fc576104a7602061047a6104756001610349565b610125565b61048330610125565b9061048d60405190565b938492839182916370a0823160e01b8352600483016102b8565b03915afa9081156105b6576000916105cd575b506104c3610199565b9081116105bb5760206105546000926104e76104e033600261020a565b42906103d3565b6104f033610125565b7fc3fb6c98272d7a0d5dc26727b61c00ece2e5bf3dbdc0284659e28d441c1ce06c61051a60405190565b838152602090a261052e6104756001610349565b9061053860405190565b948593849283919063a9059cbb60e01b83523360048401610417565b03925af180156105b65761056e9160009161058957501590565b61057457565b6312171d8360e31b600090815260045b036000fd5b6105ab915060203d6020116105af575b6105a38183610369565b810190610403565b1590565b503d610599565b6103b7565b6325bab55360e01b6000908152600490fd5b6105ef915060203d6020116105f5575b6105e78183610369565b8101906103a3565b386104ba565b503d6105dd565b633ce33ddb60e01b6000908152600490fd5b61061661078f565b61014b610634565b6100e26100ee6100ee9290565b6100ee9061061e565b61014b610641600061062b565b6107f2565b61014b61060e565b61065661078f565b61014b61066b602061047a6104756001610349565b03915afa9081156105b65761055491602091600091610701575b50610691610475610726565b7f6352c5382c4a4578e712449ca65e83cdb392d045dfcf1cad9615189db2da244b6106bb60405190565b838152602090a26106cf6104756001610349565b6106d7610726565b60006106e260405190565b8096819582946106f663a9059cbb60e01b90565b845260048401610417565b6107189150823d84116105f5576105e78183610369565b38610685565b61014b61064e565b6100ee6000610349565b61014b9061073c61078f565b60006107478161062b565b610750816100e2565b610759846100e2565b1461076957505061014b906107f2565b631e4fbdf760e01b8252819061078290600483016102b8565b0390fd5b61014b90610730565b610797610726565b33906107ab6107a5836100e2565b916100e2565b036107b35750565b63118cdaa760e01b6000908152906105849060046102b8565b906001600160a01b03906103c9565b906107eb6100ee6103ea92610125565b82546107cc565b61081361080d6108026000610349565b6104758460006107db565b91610125565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061083e60405190565b600090a356fea2646970667358221220330d3142577a827602589fccb527247097efe52f0461b26fad8ccacd0266161964736f6c634300081c00330000000000000000000000004df78483bde44410de3592f61327ac8b84a53a02
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c8063359cf2b7146100a25780633e413bee1461009d578063715018a61461009857806376697640146100935780637bc1f6cc1461008e5780637d1d5d19146100895780638d8f2adb146100845780638da5cb5b1461007f5763f2fde38b036100b2576102ef565b6102c8565b610297565b61027c565b61024d565b6101ae565b610174565b61014d565b6100b7565b60009103126100b257565b600080fd5b346100b2576100c73660046100a7565b6100cf610436565b60405180805b0390f35b6100ee916008021c5b6001600160a01b031690565b90565b906100ee91546100d9565b6100ee600060016100f1565b6100ee906100e2906001600160a01b031682565b6100ee90610108565b6100ee9061011c565b61013790610125565b9052565b60208101929161014b919061012e565b565b346100b25761015d3660046100a7565b6100d56101686100fc565b6040519182918261013b565b346100b2576101843660046100a7565b6100cf610646565b6100ee6100ee6100ee9290565b6100ee633b9aca0061018c565b6100ee610199565b346100b2576101be3660046100a7565b6100d56101c96101a6565b6040519182918290815260200190565b6101e2816100e2565b036100b257565b9050359061014b826101d9565b906020828203126100b2576100ee916101e9565b9061021490610125565b600052602052604060002090565b6100ee916008021c81565b906100ee9154610222565b60006102486100ee92600261020a565b61022d565b346100b2576100d56101c96102633660046101f6565b610238565b6100ee6201518061018c565b6100ee610268565b346100b25761028c3660046100a7565b6100d56101c9610274565b346100b2576102a73660046100a7565b6100cf61071e565b610137906100e2565b60208101929161014b91906102af565b346100b2576102d83660046100a7565b6100d56102e3610726565b604051918291826102b8565b346100b2576100cf6103023660046101f6565b610786565b6100ee9081565b6100ee9054610307565b634e487b7160e01b600052601160045260246000fd5b9190820180921161033b57565b610318565b6100ee906100e2565b6100ee9054610340565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff82111761038b57604052565b610353565b806101e2565b9050519061014b82610390565b906020828203126100b2576100ee91610396565b6040513d6000823e3d90fd5b90600019905b9181191691161790565b906103e36100ee6103ea9261018c565b82546103c3565b9055565b8015156101e2565b9050519061014b826103ee565b906020828203126100b2576100ee916103f6565b91602061014b929493610432604082019660008301906102af565b0152565b61045d6100ee61044f61044a33600261020a565b61030e565b610457610268565b9061032e565b42106105fc576104a7602061047a6104756001610349565b610125565b61048330610125565b9061048d60405190565b938492839182916370a0823160e01b8352600483016102b8565b03915afa9081156105b6576000916105cd575b506104c3610199565b9081116105bb5760206105546000926104e76104e033600261020a565b42906103d3565b6104f033610125565b7fc3fb6c98272d7a0d5dc26727b61c00ece2e5bf3dbdc0284659e28d441c1ce06c61051a60405190565b838152602090a261052e6104756001610349565b9061053860405190565b948593849283919063a9059cbb60e01b83523360048401610417565b03925af180156105b65761056e9160009161058957501590565b61057457565b6312171d8360e31b600090815260045b036000fd5b6105ab915060203d6020116105af575b6105a38183610369565b810190610403565b1590565b503d610599565b6103b7565b6325bab55360e01b6000908152600490fd5b6105ef915060203d6020116105f5575b6105e78183610369565b8101906103a3565b386104ba565b503d6105dd565b633ce33ddb60e01b6000908152600490fd5b61061661078f565b61014b610634565b6100e26100ee6100ee9290565b6100ee9061061e565b61014b610641600061062b565b6107f2565b61014b61060e565b61065661078f565b61014b61066b602061047a6104756001610349565b03915afa9081156105b65761055491602091600091610701575b50610691610475610726565b7f6352c5382c4a4578e712449ca65e83cdb392d045dfcf1cad9615189db2da244b6106bb60405190565b838152602090a26106cf6104756001610349565b6106d7610726565b60006106e260405190565b8096819582946106f663a9059cbb60e01b90565b845260048401610417565b6107189150823d84116105f5576105e78183610369565b38610685565b61014b61064e565b6100ee6000610349565b61014b9061073c61078f565b60006107478161062b565b610750816100e2565b610759846100e2565b1461076957505061014b906107f2565b631e4fbdf760e01b8252819061078290600483016102b8565b0390fd5b61014b90610730565b610797610726565b33906107ab6107a5836100e2565b916100e2565b036107b35750565b63118cdaa760e01b6000908152906105849060046102b8565b906001600160a01b03906103c9565b906107eb6100ee6103ea92610125565b82546107cc565b61081361080d6108026000610349565b6104758460006107db565b91610125565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e061083e60405190565b600090a356fea2646970667358221220330d3142577a827602589fccb527247097efe52f0461b26fad8ccacd0266161964736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004df78483bde44410de3592f61327ac8b84a53a02
-----Decoded View---------------
Arg [0] : _usdc (address): 0x4df78483bDe44410dE3592F61327aC8B84A53A02
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004df78483bde44410de3592f61327ac8b84a53a02
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.