-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8b3e9f
commit 6ba9e23
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.13; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract airDrop is ERC20("AIRDROP","AIR"){ | ||
|
||
address public creator; | ||
|
||
constructor() payable{ | ||
creator = msg.sender; | ||
} | ||
|
||
modifier onlyOwner(){ | ||
require(msg.sender == creator, "Only owner is allowed"); | ||
_; | ||
} | ||
|
||
function mintNewTokens(address[] memory addresses, uint amount) public onlyOwner{ | ||
|
||
for(uint i=0;i<addresses.length;i++){ | ||
_mint(addresses[i], amount*(10**18)); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//SPDX-License-Identifier:MIT | ||
|
||
pragma solidity ^0.8.13; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract timedToken is ERC20("TIME TOKEN","TT") { | ||
|
||
mapping(address => uint) public lastSpent; | ||
mapping(address => uint) public alreadySpent; | ||
mapping(address => bool) public exclusions; | ||
|
||
uint public limitPerDay = 5; | ||
|
||
function timedTransfer(address to, uint amount) public { | ||
if(exclusions[msg.sender] == false){ | ||
if(block.timestamp - lastSpent[msg.sender] > 1 minutes){ | ||
lastSpent[msg.sender] = block.timestamp; | ||
alreadySpent[msg.sender] = amount; | ||
_transfer(msg.sender, to, amount); | ||
}else{ | ||
if((alreadySpent[msg.sender] + amount) > limitPerDay){ | ||
revert("limit exceeded"); | ||
}else{ | ||
lastSpent[msg.sender] = block.timestamp; | ||
alreadySpent[msg.sender] += amount; | ||
_transfer(msg.sender, to, amount); | ||
} | ||
} | ||
}else{ | ||
_transfer(msg.sender, to, amount); | ||
} | ||
|
||
} | ||
|
||
function mint() public{ | ||
_mint(msg.sender,5); | ||
} | ||
|
||
function addToExclusion(address exclude) public{ | ||
exclusions[exclude] = !exclusions[exclude]; | ||
} | ||
|
||
} |