v2 · Feature 300 — Renting Assets (Version B) - #8
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces the first pieces of “dual ownership” support (separating owner vs holder) to enable asset renting-like behavior, by adding a move action and tracking holdership in a new holders table while keeping the existing transfer flow mostly intact.
Changes:
- Added
atomicassets::move(owner, from, to, asset_ids, memo)to move holdership under the true owner’s authorization. - Introduced a
holderstable (asset_id -> {holder, owner}) to persist holder state when owner != holder. - Updated
internal_transferto keepholders.ownerin sync when ownership changes (and to drop the holders row when transferring to the holder).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/atomicassets.cpp |
Adds the move action and updates internal_transfer to reconcile holder rows during ownership transfers. |
include/atomicassets.hpp |
Declares the new move action and adds the holders multi-index table. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * Moves one or more assets to another account | ||
| * @required_auth of the true owner of the asset | ||
| * Cannot have notifications for the from & to, exploitable | ||
| */ |
| auto holders_itr = holders.find(asset_id); | ||
| if (holders_itr != holders.end()){ | ||
|
|
||
| // Deletes row if transfering to holder | ||
| if (to == holders_itr->holder){ | ||
| holders.erase(holders_itr); | ||
| } else { // Modifies row to move ownership to the new "to" wallet | ||
| holders.modify(holders_itr, from, [&](auto &_holders_row){ | ||
| _holders_row.owner = to; | ||
| }); | ||
| } | ||
| } |
| if (holders_itr != holders.end()){ | ||
| check(holders_itr->holder == from, | ||
| ("At least one asset invalidates the 'from:holder' constraint (ID: " + to_string(asset_id) + ")").c_str()); |
|
Closing: custodial rentals were descoped from the v2 release train, so this feature is deliberately not on Nothing is lost. The work is preserved on two branches, both kept indefinitely:
Whether and how rentals return has not been decided. The non-custodial approach is being explored separately in #26. Closing this PR records the descope; it does not reject the work. |
Asset renting via dual ownership (
owner≠holder) +move/logmove.Mirrored into the canonical
atomicassetsorg for the AtomicAssets v2 release + audit.Original: wax-office-of-inspector-general/atomicassets-contract#10
masteryet. Kept on a feature branch to avoid prod integration risk; pending the comprehensive v2 audit.