Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RoyaltyFee to custom HTS fee types #1935

Closed
tinker-michaelj opened this issue Aug 5, 2021 · 4 comments · Fixed by #1973
Closed

Add RoyaltyFee to custom HTS fee types #1935

tinker-michaelj opened this issue Aug 5, 2021 · 4 comments · Fixed by #1973
Assignees
Milestone

Comments

@tinker-michaelj
Copy link
Collaborator

tinker-michaelj commented Aug 5, 2021

Problem

NFT creators cannot define a royalty fee to be automatically assessed when their NFTs are exchanged for fungible value (whether ℏ or units of a fungible HTS token like USDC).

Neither the FixedFee nor FractionalFee types support this use case.

Solution

Introduce a new RoyaltyFee type:

/* A fee to assess during a CryptoTransfer that changes ownership of an NFT. 
*
* Defines the fraction of the fungible value exchanged for an NFT that the ledger 
* should collect as a royalty. 
*   - "Fungible value" includes both ℏ and units of fungible HTS tokens.
*   - If the NFT sender does not receive any fungible value, the ledger will assess the (optional) fallback fee to the new NFT owner. 
*/  

message RoyaltyFee {
  Fraction exchange_value_fraction = 1; // The fraction of fungible value exchanged for an NFT to collect as royalty
  FixedFee fallback_fee = 2; // If present, the fixed fee to assess to the NFT receiver when no fungible value is exchanged with the sender
}

Implement the charging behavior outlined in the two examples here where first,

Zephyr sends Amelie an NFT of type westWindArt (with no other transfers), where the westWindsArt token has a royalty fee of 1/100th exchange value and a fallback fee of 1USDC.

And then,

Amelie sends Alice the westWindArt NFT, but this time in exchange for 1000ℏ and 200USDC.

@bugbytesinc
Copy link

bugbytesinc commented Aug 5, 2021

Thinking out loud: if there there is more than one type of fungible token exchanged for said NFT transfer, then the exchange_value_fraction will be applied for each of those fungible payments, correct?

@bugbytesinc
Copy link

Another edge case: if there are two NFTs exchanged for a Fungible transfer, exchange_value_fraction is applied once fore each of the NFTs?

@tinker-michaelj
Copy link
Collaborator Author

tinker-michaelj commented Aug 5, 2021

Thinking out loud: if there there is more than one type of fungible token exchanged for said NFT transfer, then the exchange_value_fraction will be applied for each of those fungible payments, correct?

Definitely...so if there is an nftTransfer with 0.0.1001 as sender like,

tokenTransferLists {
  token { tokenNum: 8888 } 
  nftTransfers {
    senderAccountID { accountNum: 1001 }
    receiverAccountID { accountNum: 2002 }
    serialNumber: 1
  }
}

Then the "fungible value exchanged" for 0.0.8888.1 will be interpreted as:
  ➡️  The union of all AccountAmount entries with account=0.0.1001 and amount>0.

Whether these AccountAmounts appear in the transfersList or the tokenTransfersList doesn't matter; all of them are assessed the royalty fee.

@tinker-michaelj
Copy link
Collaborator Author

Another edge case: if there are two NFTs exchanged for a Fungible transfer, exchange_value_fraction is applied once fore each of the NFTs?

My instinct would be to charge the royalty fee once for each unique (nftType, senderAccount) pair.

Does that make sense to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants