Skip to content

Instantly share code, notes, and snippets.

@petejkim
Created September 17, 2020 14:32
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save petejkim/31085e6df58d304b459d4e81a5178417 to your computer and use it in GitHub Desktop.
Save petejkim/31085e6df58d304b459d4e81a5178417 to your computer and use it in GitHub Desktop.
USDC Faucet in Goerli
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 petejkim
pragma solidity 0.6.12;
import { Ownable } from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/access/Ownable.sol";
import { IERC20 } from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.2.0/contracts/token/ERC20/SafeERC20.sol";
contract USDCFaucet is Ownable {
using SafeERC20 for IERC20;
mapping (address => uint256) public lastClaimedAt;
uint256 public amount = 100000000;
uint256 public waitPeriod = 3600;
address public tokenAddress = 0x2f3A40A3db8a7e3D09B0adfEfbCe4f6F81927557;
function configure(uint256 newAmount, uint256 newWaitPeriod, address newTokenAddress) external onlyOwner {
amount = newAmount;
waitPeriod = newWaitPeriod;
tokenAddress = newTokenAddress;
}
function canClaim(address account) external view returns (bool) {
return lastClaimedAt[account] + waitPeriod < now;
}
function claim() external {
require(lastClaimedAt[msg.sender] + waitPeriod < now, "You cannot claim again so soon!");
lastClaimedAt[msg.sender] = now;
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}
function drain() external onlyOwner {
IERC20 token = IERC20(tokenAddress);
token.safeTransfer(msg.sender, token.balanceOf(address(this)));
}
function destroy() external onlyOwner {
selfdestruct(msg.sender);
}
}
@amrabass3
Copy link

0x7C83a796bc9C35cd5af54E3eC721c8FF0404AdF0

@diikikurniawan
Copy link

0x21F9e488C67454779ce21d25ccB90C681b984664

@Bhuddham
Copy link

0x26EB38bd11d73651373B8fc9eE546892F1Dd937F

@vasiliaku
Copy link

0x00D7398236acb046Ddc5606b7545Da6d3053237d

@zeuss999
Copy link

0x8dbb1544ff71845B114A468740C02fB430815D05

@hunterichigo
Copy link

0x67fA94b65fb7e850240E4687928E423eDCB25235

@serhii3333
Copy link

0x819594F2Fbb656c71B6Dd6CdD315d96043d93047

@hoangvu300885
Copy link

0x6BC099C01467aF656183ab55492801ae073cbDC6

@Askfavour
Copy link

0x891d198698Af8A928b1da9319aa4E32062c85845

@jagger032
Copy link

0xD59606fc9403Cf80FED00FE6a74C5F9901820c75

@ajitular
Copy link

0xA9dcb671cD48C94acD46b091Ea38C49694Fbc12c

@wenblock
Copy link

0x680578Bd8a1a59dc83EE67b10f02ac4F61391417

@Akh111
Copy link

Akh111 commented Feb 27, 2024

0x31148e9423E6Abdcdcf4Cd6B13CBEBdECA29a9fE

@Pual0
Copy link

Pual0 commented Feb 27, 2024

0xd96e2250a15Aab7c43dC2dAd7d53904Ec4B41b30

@Amir12Azizi
Copy link

0x55b33c314560016688D4764f1eAE288aD49576aC

@gabek11
Copy link

gabek11 commented Feb 28, 2024

0xCDe1F7338B80B0894544278e4aCF5Ae590251027

@wiraloka81
Copy link

0xc4c8ac5FB438f592740c94E2Bd663B25e32cC45f

@nikthegreek12
Copy link

0xFEF924C379472B1AE4d5C4485a277E2123Faa780

@Zeram10
Copy link

Zeram10 commented Feb 28, 2024

0xdbafafc363578276c89b02d0d5334ac47e06a3ee

@Mcprogramin
Copy link

0x4fa3329d76608F53f151e77442373DF544952D56

@riki-dav
Copy link

riki-dav commented Mar 1, 2024

0x3289cc185e4483fE123b2e08019dc33768460458

@michael2jordan3
Copy link

0x2D46ee82527205eA59B1d7940987CC6879800D86

@haramiya
Copy link

haramiya commented Mar 7, 2024

0xe8c512a0D0DB43081b372A9436D7b16A01265F6c

@MarteezyDC
Copy link

0x7D9063f8EC74588cea572F5E6298E2b2645Ca887

@OgheneTega
Copy link

0x4d74D2c2a4a7a0135877eB9AEbB71855ffeaEB91

@sunilkumawat45
Copy link

0xd570059e4C63AFb0ddb9Ffa2a9EAb27780BA4614

@Jayvis1993
Copy link

0x43769c085C82A61c7c961Ed5741De278b4A56b24

@gaurav2425
Copy link

0xF250b1d39600B00994F55d48bD7b6a94CA60965e

@marinadem
Copy link

0x51AC19579aB065b2E0228d3EbcA99fd99015ee11

@Eminentpluz
Copy link

0x28c0b3642930c1448594d4b97056efb78ab15643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment