# Artiste / Creators Token Factory

This factory or module allows for the tokenization of a creator or an artiste, their brand or their creation/music as an ERC20 token that can be traded and as an asset or attached to real world value. This factory exposes a couple of functions.

The factory contract maintains a mapping of ArtisteToken contracts, indexed by the token name and symbol, as well as a mapping of ArtisteToken details, indexed by the token ID. It also maintains a struct called RoyaltyDetails, which holds the percentage of royalties to be paid and the address of the party receiving the royalties.

### ArtisteTokenFactory

#### NewArtisteTokenCreated

```
event NewArtisteTokenCreated(uint256 tokenId, uint256 totalAmount, address tokenAddress)
```

#### RoyaltyDetailsUpdated

```
event RoyaltyDetailsUpdated(uint256 percentage, address royaltyAddress)
```

#### picardyHub

```
address picardyHub
```

#### ArtisteToken

```
struct ArtisteToken {
  uint256 artisteTokenId;
  uint256 totalAmount;
  string name;
  string symbol;
  address creator;
  address artisteTokenAddress;
  uint256 cost;
}
```

#### RoyaltyDetails

```
struct RoyaltyDetails {
  uint256 royaltyPercentage;
  address royaltyAddress;
}
```

#### royaltyDetails

```
struct ArtisteTokenFactory.RoyaltyDetails royaltyDetails
```

#### tokenAddressMap

```
mapping(string => mapping(string => address)) tokenAddressMap
```

#### artisteTokenMap

```
mapping(uint256 => struct ArtisteTokenFactory.ArtisteToken) artisteTokenMap
```

#### artisteTokenId

```
uint256 artisteTokenId
```

#### constructor

```
constructor(address _picardyHub) public
```

#### createArtisteToken

```
function createArtisteToken(uint256 _totalAmount, string _name, string _symbol, uint256 _cost) external
```

\_Creats an ERC20 contract to the caller @param \_totalAmount The maximum suppyly of the token @param \_name Token name @param _symbol Token symbol_

#### getHubAddress

```
function getHubAddress() external view returns (address)
```

#### updateRoyaltyDetails

```
function updateRoyaltyDetails(uint256 _royaltyPercentage) external
```

#### getRoyaltyDetails

```
function getRoyaltyDetails() external view returns (address, uint256)
```

#### getTokenAddress

```
function getTokenAddress(string _name, string _symbol) external view returns (address)
```
