-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calyptus446.sol
36 lines (27 loc) · 1.11 KB
/
Calyptus446.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//I SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// https://x.com/calyptus_web3/status/1841365018266226767
/*
The TimedDrop contract is designed for token airdrops.
Each time the airdrop function is called, this timer resets to another 30 days
and the signer is cleared and ready for the next drop.
The function is intended to mint 1000 tokens (the AIRDROP_AMOUNT) to the caller
if the signature is verified.
Tell us if you can break the logic and claim airdrops whenever you want.
*/
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TimedDrop is ERC20{
address signer;
uint256 timer = block.timestamp + 30 days;
uint256 AIRDROP_AMOUNT = 1000;
constructor() ERC20("MyToken", "MTK") {}
function airdrop(address who, uint8 v, bytes32 r, bytes32 s) external {
if (block.timestamp > timer) {
signer = msg. sender;
}
require(signer == ecrecover(keccak256(abi.encode(who, AIRDROP_AMOUNT)), v, r, s), "invalid signature");
_mint(msg.sender, AIRDROP_AMOUNT);
timer = block.timestamp + 30 days;
signer = address(0);
}
}