-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathTestToken.sol
More file actions
35 lines (30 loc) · 981 Bytes
/
TestToken.sol
File metadata and controls
35 lines (30 loc) · 981 Bytes
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
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.11;
import { ERC20, ERC20Permit } from "@openzeppelin-v5/contracts/token/ERC20/extensions/ERC20Permit.sol";
/**
* @title Test token contract
* @author Superfluid
* @dev Test ERC20 token that allows any one mint new tokens.
*/
contract TestToken is ERC20Permit {
uint256 private immutable _mintLimit;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 initDecimals, uint256 mintLimit)
ERC20Permit(name)
ERC20(name, symbol)
{
_decimals = initDecimals;
_mintLimit = mintLimit;
}
/**
* @dev See {ERC20-_mint}.
*/
function mint(address account, uint256 amount) public returns (bool) {
assert(amount <= _mintLimit); // no revert msg for you, bad boy
ERC20._mint(account, amount);
return true;
}
function decimals() public view override returns (uint8) {
return _decimals;
}
}