v2 · Feature 5 — Changing Collection Authors - #5
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an “author swap” flow to allow reassigning a collection’s author via an on-chain offer/accept/reject mechanism, with timing constraints intended to differ based on whether the swap was created using owner vs active authorization.
Changes:
- Introduces
createauswap,acceptauswap, andrejectauswapactions to manage collection author swap offers. - Adds a new
authorswapsmulti_index table to persist pending swap offers and anAUTHOR_SWAP_TIME_DELTAtiming constant. - Implements time-gated acceptance and an expiry window for swaps.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/atomicassets.cpp |
Implements create/accept/reject action logic for author swap offers, including auth + time checks and collection author update. |
include/atomicassets.hpp |
Declares new actions, adds the authorswaps table, and introduces AUTHOR_SWAP_TIME_DELTA. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| check(authorswaps.find(collection_name.value) == authorswaps.end(), | ||
| "Can't swap author's while an authorswap is underway for this collection"); |
| auto collection_itr = collections.require_find(collection_name.value, | ||
| "No collection with this name exists"); | ||
|
|
||
| if (owner){ | ||
| require_auth(permission_level{collection_itr->author, name("owner")}); | ||
| } else { | ||
| require_auth(collection_itr->author); | ||
| } | ||
|
|
| uint32_t now = eosio::current_time_point().sec_since_epoch(); | ||
|
|
||
| check (now > author_swaps_itr->acceptance_date, | ||
| ("[ " + to_string(author_swaps_itr->acceptance_date - now) + " ] seconds remaining until this author swap can be accepted").c_str()); | ||
|
|
| /** | ||
| * Accepts an author swap, with time constraints based on 'owner' or 'active' permissions used when creating the author swap | ||
| * With default parameters, author swaps created by 'active' permissions can only be accepted after 1 week has passed | ||
| * With default parameters, author swaps remain valid for up to 3 weeks | ||
| */ |
|
|
||
|
|
||
| static constexpr double MAX_MARKET_FEE = 0.15; | ||
| static constexpr uint32_t AUTHOR_SWAP_TIME_DELTA = 60 * 60 * 24 * 7; // 1 week, valid for 1 week |
|
Superseded by #9, which is merged. This feature is on |
Enables collection author reassignment (authorswaps).
Mirrored into the canonical
atomicassetsorg for the AtomicAssets v2 release + audit.Original: wax-office-of-inspector-general/atomicassets-contract#6
masteryet. Kept on a feature branch to avoid prod integration risk; pending the comprehensive v2 audit.