-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Dev Feature 5 - Changing Collection Authors #6
Conversation
on-a-t-break
commented
Sep 16, 2024
- 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)
There was a problem hiding this 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.
include/atomicassets.hpp
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
src/atomicassets.cpp
Outdated
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")}); |
There was a problem hiding this comment.
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
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. |
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. |