contract LexTokenFactory {
    // presented by OpenESQ || lexDAO LLC ~ Use at own risk!
    uint8 public version = 2;
    
    // factory settings
    string public stamp;
    uint256 public factoryFee;
    address payable public _lexDAO; 
    
    LexToken private LT;
    address[] public tokens; 
    
    event LexTokenDeployed(address indexed LT, address indexed owner);
    event LexDAOPaid(uint256 indexed payment, string indexed details);
    
    constructor (uint256 _factoryFee, address payable lexDAO) public 
	{
        stamp = "⚡⚖️⚔️";
        factoryFee = _factoryFee;
        _lexDAO = lexDAO;
	}
    
    function newLexToken( // public can issue stamped lex token for factory ether (Ξ) fee
        string memory name, 
		string memory symbol,
		string memory _stamp,
		uint8 decimals,
		uint256 cap,
		uint256 initialSupply,
		address owner) payable public {
		require(_lexDAO != address(0));
        
        LT = new LexToken(
            name, 
            symbol, 
            _stamp,
            decimals,
            cap,
            initialSupply,
            owner,
            _lexDAO);
        
        tokens.push(address(LT));
        address(_lexDAO).transfer(msg.value);
        emit LexTokenDeployed(address(LT), owner);
    }
    
    function getLexTokenCount() public view returns (uint256 LexTokenCount) {
        return tokens.length;
    }
    
    /***************
    LEXDAO FUNCTIONS
    ***************/
    function newFactoryFee(uint256 weiAmount) public returns (bool) {
        require(msg.sender == _lexDAO);
        factoryFee = weiAmount;
        return true;
    }

    function payLexDAO(string memory details) payable public returns (bool) { 
        _lexDAO.transfer(msg.value);
        emit LexDAOPaid(msg.value, details);
        return true;
    }
}
/**
 * @dev Factory pattern to clone new token contracts with lexDAO governance.
 */
function newFactoryFee(uint256 weiAmount) public returns (bool) {
    require(msg.sender == _lexDAO);
    factoryFee = weiAmount;
    return true;
}

/***************
 LEXDAO FUNCTIONS
 ***************/