> For the complete documentation index, see [llms.txt](https://picardy-protocol.gitbook.io/picardy-protocol-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://picardy-protocol.gitbook.io/picardy-protocol-docs/builders-den/nft-royalty-sale-factory.md).

# Nft Royalty Sale Factory

The Nft Royalty Sale Factory smart contract is a factory contract that allows the creation of NftRoyaltySale contracts. An NftRoyaltySale contract represents a sale of non-fungible tokens (NFTs) with a royalty payment mechanism built in.

The factory contract maintains a mapping of NFT royalty sale contracts, indexed by the artist's name and the NFT name, as well as a mapping of NFT royalty details, indexed by the contract's address. 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.

### NftRoyaltySaleFactoryV2

#### Details

```
struct Details {
  uint256 maxSupply;
  uint256 maxMintAmount;
  uint256 cost;
  uint256 percentage;
  string name;
  string symbol;
  string initBaseURI;
  string creatorName;
  address creator;
}
```

#### NftRoyaltyDetails

```
struct NftRoyaltyDetails {
  uint256 royaltyId;
  uint256 royaltyPercentage;
  string royaltyName;
  address royaltyAddress;
}
```

#### RoyaltyDetails

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

####

#### createNftRoyalty

```
function createNftRoyalty(struct NftRoyaltySaleFactoryV2.Details details) external returns (address)
```

Creates a new NftRoyaltySale contract

*The NftRoyaltySale contract is created using the Clones library*

**Parameters**

| Name    | Type                                   | Description |
| ------- | -------------------------------------- | ----------- |
| details | struct NftRoyaltySaleFactoryV2.Details |             |

**Return Values**

| Name | Type    | Description                                          |
| ---- | ------- | ---------------------------------------------------- |
| \[0] | address | Address of the newly created NftRoyaltySale contract |

#### updateRoyaltyDetails

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

Updates the royalty details

*Only the Picardy Hub Admin can call this function. Do not confuse this with the royalty percentage for the NftRoyaltySale contract*

**Parameters**

| Name                | Type    | Description |
| ------------------- | ------- | ----------- |
| \_royaltyPercentage | uint256 |             |

#### getLinkToken

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

#### getRoyaltyDetails

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

#### getHubAddress

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

#### getNftRoyaltySaleAddress

```
function getNftRoyaltySaleAddress(string _creatorName, string _name) external view returns (address)
```
