// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC20Permit} from "@openzeppelin-contracts/token/ERC20/extensions/ERC20Permit.sol";
import {ERC20} from "@openzeppelin-contracts/token/ERC20/ERC20.sol";

import {IFTSO} from "./interfaces/IFTSO.sol";
import {IGhostAuthority} from "./interfaces/IGhostAuthority.sol";
import {GhostAccessControlled} from "./types/GhostAccessControlled.sol";

contract Fatso is ERC20Permit, IFTSO, GhostAccessControlled {
    constructor(address _authority, string memory name, string memory symbol)
        ERC20(name, symbol)
        ERC20Permit(name)
        GhostAccessControlled(IGhostAuthority(_authority))
    {}

    function decimals() public pure override returns (uint8) {
        return 9;
    }

    function mint(address account, uint256 amount) external override onlyVault {
        _mint(account, amount);
    }

    function burn(uint256 amount) external override {
        _burn(msg.sender, amount);
    }

    function burnFrom(address account, uint256 amount) external override {
        _burnFrom(account, amount);
    }

    function _burnFrom(address account, uint256 amount) internal {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}
