Skip to content

Commit

Permalink
LSP18 Royalties
Browse files Browse the repository at this point in the history
  • Loading branch information
lykhonis committed Dec 8, 2022
1 parent 78e67aa commit 6a91b64
Showing 1 changed file with 122 additions and 0 deletions.
122 changes: 122 additions & 0 deletions LSPs/LSP-18-Royalties.md
@@ -0,0 +1,122 @@
---
lip: 18
title: Royalties
author: Volodymyr Lykhonis <vlad@universal.page>, Jake Prins <jake@universal.page>
discussions-to: https://discord.gg/E2rJPP4
status: Draft
type: LSP
created: 2022-11-23
requires: LSP2, LSP4
---

## Simple Summary
This standard describes a set of [ERC725Y](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md) data key values to store royalties recipient addresses and corresponding percentages in a [ERC725Y](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md) smart contract.

## Abstract
This data key value standard describes a set of data keys that can be added to an [ERC725Y](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md) smart contract to describe royalties:

- `LSP18Royalties[]` is an [LSP2 array](./LSP-2-ERC725YJSONSchema.md) of royalties recipient addresses.
- `LSP18RoyaltiesMap` is a dynamic address mapping, which contains:
- royaties percentage allocation per recipient address.
- and the index in the `LSP18Royalties[]` array.
- `LSP18RoyaltiesEnforceAtLoss` is a boolean to enforce royalties whenever the NFT is sold at loss.

The data key `LSP18RoyaltiesMap` exists so that smart contracts can detect if an address is present in the array (e.g. as done in the [LSP1-UniversalReceiverDelegate](./LSP-1-UniversalReceiver.md)).

## Motivation
This standard allows to create a decentralised asset royalties allocations by a smart contract.

## Specification
Every contract that supports the LSP18DigitalAssetMetadata SHOULD have the following data keys:

### ERC725Y Data Keys


#### LSP18Royalties[]

An array of royalties recipients addresses (see [LSP-0-ERC725Account](./LSP-0-ERC725Account.md)).


```json
{
"name": "LSP18Royalties[]",
"key": "0xe010b84f60176d2f466b495da33173c1a008950ed855b4b92282e356d009bd76",
"keyType": "Array",
"valueType": "address",
"valueContent": "Address"
}
```

For more info about how to access each index of the `LSP18Royalties[]` array, see [ERC725Y JSON Schema > `keyType`: `Array`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#array)

#### LSP18RoyaltiesMap

References royalties amounts of each recipient addresses.

The data value MUST be constructed as follows: `bytes8(indexNumber) + bytes2(type) + bytesN`. Where:
- `indexNumber` = the index in the [`LSP18Royalties[]` Array](#lsp18royalties).
- `type` = the type of a payload:
- `0` = percentage
- `bytes4(amountNumber)` = the percentage of royalties allocation in points with `100_000` basis. e.g. `15%` is `15_000` points, and `1.5%` is `1_500` points.
- `1` = fixed amount in `LYX`
- `bytes32(amount)` = wei amount


```json
{
"name": "LSP18RoyaltiesMap:<address>",
"key": "0xe5ea91873c26eca6dec90000<address>",
"keyType": "Mapping",
"valueType": "(bytes8,bytes2,bytes4)",
"valueContent": "(Number,Number,Number)"
}
```

#### LSP18RoyaltiesEnforcePayment

A boolean when `true` to indicate enforcement of royalties even if a NFT is sold at a loss. By default this is `false` and a marktetplace may not enforce royalties.


```json
{
"name": "LSP18RoyaltiesEnforcePayment",
"key": "0x580d62ad353782eca17b89e5900e7df3b13b6f4ca9bbc2f8af8bceb0c3d1ecc6",
"keyType": "Singleton",
"valueType": "boolean",
"valueContent": "Boolean"
}
```

## Rationale

## Implementation

ERC725Y JSON Schema `LSP18Royalties`:
```json
[
{
"name": "LSP18Royalties[]",
"key": "0xe010b84f60176d2f466b495da33173c1a008950ed855b4b92282e356d009bd76",
"keyType": "Array",
"valueType": "address",
"valueContent": "Address"
},
{
"name": "LSP18RoyaltiesMap:<address>",
"key": "0xe5ea91873c26eca6dec90000<address>",
"keyType": "Mapping",
"valueType": "(bytes8,bytes2,bytes4)",
"valueContent": "(Number,Number,Number)"
},
{
"name": "LSP18RoyaltiesEnforcePayment",
"key": "0x580d62ad353782eca17b89e5900e7df3b13b6f4ca9bbc2f8af8bceb0c3d1ecc6",
"keyType": "Singleton",
"valueType": "boolean",
"valueContent": "Boolean"
}
]
```

## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 comments on commit 6a91b64

Please sign in to comment.