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

Dev Feature 5 - Changing Collection Authors #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

on-a-t-break
Copy link

  • Adds authorswaps table with collection_name key and current_author, new_author, permission and swap_date fields
  • Current authors are able to create "author swap listings" with must then be accepted by the recipient "new_author"
  • Author swaps can be accepted immediately if the permissions used to create the listing are 'owner'
  • Author swaps can be accepted after 1 week (by default) if the permissions used to create the listings are 'active'
  • Author swaps can be rejected / declined / erased by both the current_author & the new_author at any given time
  • Author swaps expire after 3 weeks (by default) & must be destroyed & then recreated (just for safety purposes)

Copy link

@jona-wilmsmann jona-wilmsmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like how the different cases between owner and active are implemented.
Here is what I would suggest:

  • The authorswaps table doesn't store the permission and the swap date (when it was created), but instead stores only an acceptance_date which is the time at which the swap can be accepted.

  • When creating an authorswap, the permission level isn't explicitly provided as owner or active, instead you just have a boolean value for whether you want to use the owner permission. You by default you just use require_auth(current_author) to check general permission, and if the boolean value is true, you require the owner auth. And then you emplace the entry into the authorswaps table where the acceptance_date is now + 1 week by default or simply now if the owner option is used.

@@ -11,6 +11,7 @@ using namespace atomicdata;


static constexpr double MAX_MARKET_FEE = 0.15;
static constexpr uint32_t AUTHOR_SWAP_TIME_DELTA = 604800; // 1 week, valid for 3 weeks

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just personal preference, but I would prefer if this was written out as 60 * 60 * 24 * 7 so that its immediately clear what this means and that it's correct.

uint32_t now = eosio::current_time_point().sec_since_epoch();

if (author_swaps_itr->permission == name("owner")){
require_auth(permission_level{author_swaps_itr->new_author, name("owner")});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense to me that the new author also has to be the owner permission

@on-a-t-break
Copy link
Author

I don't really like how the different cases between owner and active are implemented. Here is what I would suggest:

  • The authorswaps table doesn't store the permission and the swap date (when it was created), but instead stores only an acceptance_date which is the time at which the swap can be accepted.
  • When creating an authorswap, the permission level isn't explicitly provided as owner or active, instead you just have a boolean value for whether you want to use the owner permission. You by default you just use require_auth(current_author) to check general permission, and if the boolean value is true, you require the owner auth. And then you emplace the entry into the authorswaps table where the acceptance_date is now + 1 week by default or simply now if the owner option is used.

Makes sense. Just realized it becomes a bit finicky either way for collections made with WCW, but don't think there's much that can be done there.

@on-a-t-break
Copy link
Author

on-a-t-break commented Oct 14, 2024

Incorporated all comments above, potential edge case when swapping authors in regards to authorized_editors & notification_recipients for a collection, otherwise ready for merging into CPU optimizations.

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 this pull request may close these issues.

2 participants