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

Royalties #579

Merged
merged 39 commits into from
Nov 29, 2023
Merged

Royalties #579

merged 39 commits into from
Nov 29, 2023

Conversation

zajck
Copy link
Member

@zajck zajck commented Mar 8, 2023

Added flexible royalty specification to the protocol.

When seller is created, a default royalty recipient (trasury) is created. Admin can then add more royalty recipients to the allow list.
Admin at the same time also set minimal royalty that recipient should receive.
When assistant creates an offer they choose a subset of royalty recipients (can be empty) and sets individual royalty percentages, which should be at least as the minimum, set by the admin.

Changes:

  • Added royalties related revert reasons
  • Added new structs RoyaltyRecipient and RoyaltyInfo. RoyaltyInfo format is directly compatibile with royalty registry. RoyaltyInfo was added to existing Offer struct.
  • added RoyaltyRecipientsChanged event
  • added new methods addRoyaltyRecipients, updateRoyaltyRecipients, removeRoyaltyRecipients and getRoyaltyRecipients
  • updated updateSeller to update default royalty recipient if treasury is changed
  • refactored part of the code that was duplicated across updateSeller and new methods. I added two internal functions isCallerAuthorizedCheck and validateAdminStatus
  • changed createOfferInternal to handle RoyaltyInfo
  • changed createSellerInternal to create a default recipient
  • added royaltyRecipientsBySeller and royaltyRecipientIndexBySellerAndRecipient mappings to protocol lookups
  • added domain scripts and tests for RoyaltyRecipient and RoyaltyInfo.
  • updated domain scripts and tests for Offer
  • added/updated unit tests

Other changes:

TODO:

  • update domain model diagram
  • integration tests with royaltyRegistry

@zajck zajck self-assigned this Mar 8, 2023
@zajck zajck added the enhancement New feature or request label Mar 8, 2023
@zajck zajck mentioned this pull request Mar 17, 2023
@zajck zajck mentioned this pull request Mar 30, 2023
@zajck zajck added the v2.3.0 label Mar 30, 2023
@mischat mischat added v2.4.0 and removed v2.3.0 labels May 9, 2023
@zajck zajck marked this pull request as ready for review October 27, 2023 13:30
@zajck zajck marked this pull request as draft November 28, 2023 07:03
@zajck zajck marked this pull request as ready for review November 28, 2023 07:03
contracts/protocol/libs/FundsLib.sol Dismissed Show dismissed Hide dismissed
@coveralls
Copy link

coveralls commented Nov 28, 2023

Coverage Status

coverage: 98.609% (-0.02%) from 98.627%
when pulling 5c4cb54 on royalties-2
into f685df3 on main.

@zajck zajck merged commit 32eb99e into main Nov 29, 2023
12 checks passed
@zajck zajck deleted the royalties-2 branch November 29, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v2.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RoyaltyPecentage typo
5 participants