contract PLX is ERC20, AccessControl {
    
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");


    /**
     * @dev Grants `DEFAULT_ADMIN_ROLE` to the
     * account that deploys the contract.
     *
     * See {ERC20-constructor}.
     */
     
    constructor(uint256 initialSupply)
     
        ERC20("Polyx Token", "PLX")
        AccessControl()
    {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _mint(
            0x56695E296fFD313424402fD947412CFF6400b4BC,
            initialSupply * 10**18
        );
    }


    /**
     * @dev Set the DEFAULT_ADMIN_ROLE to `_newAdmin`.
     * Requirements:
     * - the caller must have the `DEFAULT_ADMIN_ROLE`.
     */

    function changeAdmin(address _newAdmin) public {
        require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()),"Caller is not an admin");
        _setupRole(DEFAULT_ADMIN_ROLE, _newAdmin);
        renounceRole(DEFAULT_ADMIN_ROLE, _msgSender());
    }

    /**
     * @dev Creates `_amount` new tokens for `_to`.
     * See {ERC20-_mint}.
     * Requirements:
     * - the caller must have the `MINTER_ROLE`.
    */
     
    function mint(address _to, uint256 _amount) public {
        require(hasRole(MINTER_ROLE, _msgSender()), "Caller is not a minter");
        _mint(_to, _amount);
    }
    
    function burn(uint256 amount) public {
        require(hasRole(BURNER_ROLE, _msgSender()), "Caller is not a burner");
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     * Requirements:
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */

    function burnFrom(address account, uint256 amount) public {
        require(hasRole(BURNER_ROLE, _msgSender()), "Caller is not a burner");
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
                    }
        _burn(account, amount);
    }

}
function mint(address _to, uint256 _amount) public {
    require(hasRole(MINTER_ROLE, _msgSender()), "Caller is not a minter");
    _mint(_to, _amount);
}

/**
 * @dev Creates `_amount` new tokens for `_to`.
 * See {ERC20-_mint}.
 * Requirements:
 * - the caller must have the `MINTER_ROLE`.
 */