-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSToken.sol
32 lines (25 loc) · 937 Bytes
/
SToken.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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { ERC20 } from "@oz/token/ERC20/ERC20.sol";
import { Ownable } from "@oz/access/Ownable.sol";
import { ISToken } from "../interfaces/ISToken.sol";
/**
* @notice Spear or Shield
* @dev only battle contract(aka.owner) can mint or burn SToken
*/
contract SToken is ERC20, Ownable, ISToken {
uint8 private immutable _decimals;
constructor(string memory name_, string memory symbol_, uint8 decimals_, address battle) ERC20(name_, symbol_) {
_decimals = decimals_;
_transferOwnership(battle);
}
function mint(address account, uint256 amount) external override onlyOwner {
_mint(account, amount);
}
function burn(address account, uint256 amount) external override onlyOwner {
_burn(account, amount);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}