-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParti_Token.sol
39 lines (30 loc) · 1.17 KB
/
Parti_Token.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
37
38
39
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
contract PartiCoin is ERC20,ERC20Permit {
address owner;
address [] public transferers;
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name)
{
_mint(address(this), 1000000 * 10 ** decimals());
owner = msg.sender;
}
function addTransferer(address transferer) external{
require(msg.sender == owner, "You do not own this contract");
transferers.push (transferer);
}
function isAllowedToTransfer(address addr) public view returns (bool) {
for (uint i = 0; i < transferers.length; i++) {
if (transferers[i] == addr) {
return true;
}
}
return false;
}
function transfer_reward(address depositor, uint amount) external{
require (isAllowedToTransfer (msg.sender),"You are not permitted");
_transfer(address(this), depositor, amount);
}
}