contract MBDAManager {
    struct FundTokenContract {
        address fundManager;
        address fundContractAddress;
        string fundTokenSymbol;
        bool exists;
    }

    FundTokenContract[] public contracts;
    mapping(address => FundTokenContract) public contractsMap;

    event NewFundCreated(
        address indexed fundManager,
        address indexed tokenAddress,
        string indexed tokenSymbol
    );

    /**
     * @dev Creates a new fund token
     * @param _fundManager - Manager
     * @param _fundChairman - Chairman
     * @param _tokenName - Detailed ERC20 token name
     * @param _decimalUnits - Detailed ERC20 decimal units
     * @param _tokenSymbol - Detailed ERC20 token symbol
     * @param _lockedUntilBlock - Block lock
     * @param _newTotalSupply - Total Supply owned by the contract itself, only Manager can move
     * @param _canChangeAssets - True allows the Manager to change assets in the portfolio
     * @param _mintable - True allows Manager to min new tokens
     * @param _hasWhiteList - Allows transfering only between whitelisted addresses
     * @param _isSyndicate - Allows secondary market
     * @return newFundTokenAddress the address of the newly created token
     */
    function newFund(
        address _fundManager,
        address _fundChairman,
        string memory _tokenName,
        uint8 _decimalUnits,
        string memory _tokenSymbol,
        uint256 _lockedUntilBlock,
        uint256 _newTotalSupply,
        bool _canChangeAssets,    //  ---> Deixar tudo _canChangeAssets
        bool _mintable, //  ---> Usar aqui _canMintNewTokens
        bool _hasWhiteList,
        bool _isSyndicate
    ) public returns (address newFundTokenAddress) {
        MBDAAsset ft = new MBDAAsset(
            _fundManager,
            _fundChairman,
            _tokenName,
            _decimalUnits,
            _tokenSymbol,
            _lockedUntilBlock,
            _newTotalSupply,
            _canChangeAssets,
            _mintable,
            _hasWhiteList,
            _isSyndicate
        );
        newFundTokenAddress = address(ft);
        FundTokenContract memory ftc = FundTokenContract(
            _fundManager,
            newFundTokenAddress,
            _tokenSymbol,
            true
        );
        contracts.push(ftc);
        contractsMap[ftc.fundContractAddress] = ftc;
        emit NewFundCreated(_fundManager, newFundTokenAddress, _tokenSymbol);
        return newFundTokenAddress;
    }

    /**
     * @return Total number of funds created
     */
    function totalContractsGenerated() public view returns (uint256) {
        return contracts.length;
    }
}
/**
 * @title MBDAManager is a contract that generates tokens that represents a investment fund units and manages them
 */
function newFund(
        address _fundManager,
        address _fundChairman,
        string memory _tokenName,
        uint8 _decimalUnits,
        string memory _tokenSymbol,
        uint256 _lockedUntilBlock,
        uint256 _newTotalSupply,
        bool _canChangeAssets,    //  ---> Deixar tudo _canChangeAssets
        bool _mintable, //  ---> Usar aqui _canMintNewTokens
        bool _hasWhiteList,
        bool _isSyndicate
    ) public returns (address newFundTokenAddress) {
        MBDAAsset ft = new MBDAAsset(
            _fundManager,
            _fundChairman,
            _tokenName,
            _decimalUnits,
            _tokenSymbol,
            _lockedUntilBlock,
            _newTotalSupply,
            _canChangeAssets,
            _mintable,
            _hasWhiteList,
            _isSyndicate
        );
        newFundTokenAddress = address(ft);
        FundTokenContract memory ftc = FundTokenContract(
            _fundManager,
            newFundTokenAddress,
            _tokenSymbol,
            true
        );
        contracts.push(ftc);
        contractsMap[ftc.fundContractAddress] = ftc;
        emit NewFundCreated(_fundManager, newFundTokenAddress, _tokenSymbol);
        return newFundTokenAddress;
    }
/**
 * @dev Creates a new fund token
 * @param _fundManager - Manager
 * @param _fundChairman - Chairman
 * @param _tokenName - Detailed ERC20 token name
 * @param _decimalUnits - Detailed ERC20 decimal units
 * @param _tokenSymbol - Detailed ERC20 token symbol
 * @param _lockedUntilBlock - Block lock
 * @param _newTotalSupply - Total Supply owned by the contract itself, only Manager can move
 * @param _canChangeAssets - True allows the Manager to change assets in the portfolio
 * @param _mintable - True allows Manager to min new tokens
 * @param _hasWhiteList - Allows transfering only between whitelisted addresses
 * @param _isSyndicate - Allows secondary market
 * @return newFundTokenAddress the address of the newly created token
 */