Skip to content

Commit 3a46267

Browse files
committed
feat: add basic erc20
1 parent abf625a commit 3a46267

File tree

3 files changed

+52
-36
lines changed

3 files changed

+52
-36
lines changed

contracts/Lock.sol

-36
This file was deleted.

contracts/Token.sol

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity >=0.8.9;
3+
4+
import "@openzeppelin/contracts/access/Ownable.sol" as Ownable;
5+
import "@openzeppelin/contracts/utils/Pausable.sol" as Pausable;
6+
import "@openzeppelin/contracts/token/ERC20/ERC20.sol" as ERC20;
7+
8+
/// @title Kolektivo TTD Token
9+
/// @author wasteofintel.eth
10+
/// @notice This its the ERC20 representing a collateralized
11+
/// TTD stable coin of the Trinidad & Tobago Dollar by the
12+
/// Kolektivo Project.
13+
/// @dev This contract is Ownable to allow minting by an
14+
/// authorized signatory. It is also Pausable to control
15+
/// flow of tokens during an initial gathering phase.
16+
contract KolektivoTTD is Ownable, Pausable {
17+
uint256 private perUserFaucetLimit = 1 ether;
18+
19+
constructor() ERC20("Kolektivo TTD", "KTTD") {
20+
init();
21+
}
22+
23+
/// @notice Disburse tokens to an account.
24+
/// @dev Only the owner can disburse tokens.
25+
/// @param address account to be disbursed tokens
26+
/// @param uint256 amount of tokens to be disbursed
27+
function mint(address account, uint256 amount) public onlyOwner {
28+
if (ERC20.balanceOf(account) < perUserFaucetLimit) {
29+
revert FaucetDripLimitReached();
30+
}
31+
_mint(account, amount);
32+
}
33+
34+
/// @notice Transfers tokens from the sender to the recipient.
35+
/// @dev Internal accounting for managing sender / recipient balances
36+
/// this logic is pausable to incentivice the accumulation phase.
37+
/// @param address Sender's address
38+
/// @param address Recipient's address
39+
/// @param uint256 Amount of tokens to transfer
40+
function _transfer(address sender, address recipient, uint256 amount) internal override whenNotPaused {
41+
super._transfer(sender, recipient, amount);
42+
}
43+
44+
/// @notice This account has reached the maximum threshold to be
45+
/// dripped any more tokens.
46+
/// @dev The maximum drip limit is controlled by _faucetLimit
47+
/// and is not configurable.
48+
error FaucetDripLimitReached();
49+
}

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,8 @@
7575
"task:withdraw": "hardhat task:withdraw",
7676
"test": "hardhat test",
7777
"typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain"
78+
},
79+
"dependencies": {
80+
"@openzeppelin/contracts": "^5.0.1"
7881
}
7982
}

0 commit comments

Comments
 (0)