contract KBeanFactory {
    
    /// keep a mapping of deployed token address against the unique artwork uri.
    address public _owner = msg.sender;
    mapping(string => address) _deployedContracts;
    event tokenDeployed(string tokenUri, address tokenAddress, address tokenOwner);

    modifier ownerOnly
    {
        require(msg.sender == _owner, "You are not authorized to create new KBean tokens.");
        _;
    }

    function create(string memory name, string memory symbol, string memory artUri, string memory artHash, string memory licenseUri, uint256 cap) public ownerOnly returns(address tokenAddress){
        KBeanERC20 token = new KBeanERC20(name, symbol, artUri, artHash, licenseUri, cap, msg.sender);
        tokenAddress = address(token);
        register(artUri, tokenAddress);

        emit tokenDeployed(artUri, tokenAddress, _owner);
    }
    
    function register(string memory artUri, address tokenAddress) private
    {
        _deployedContracts[artUri] = tokenAddress;
    }

    /// @param artUri String unique uri identifier of the token
    /// @return Returns the address of the deployed contract 
    function getContract(string memory artUri) public view returns (address tokenAddress)
    {
        return _deployedContracts[artUri];
    }    
}
function getContract(string memory artUri) public view returns (address tokenAddress)
{
    return _deployedContracts[artUri];
}    

/// @param artUri String unique uri identifier of the token
/// @return Returns the address of the deployed contract 