-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Dependency Injection Trait Locker for Uniques Pallet #11025
Dependency Injection Trait Locker for Uniques Pallet #11025
Conversation
…ted downstream to enable locking of an asset. Use case defined in RMRK substrate pallet PR76
User @HashWarlock, please sign the CLA here. |
LGTM |
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.
Looks broadly good to me, have some minor notes to address before merge.
Any other updates I need to make to ensure this gets merged? |
Looking at the checks, you need a polkadot companion. Otherwise good to go 👍 |
Would this be the companion you mean? paritytech/cumulus#1085 or I need to add additional one to the polkadot repo as well? |
Yes but you have to put it in the PR description (which I did for you now :) ) |
bot merge |
Error: pr-custom-review is not passing for paritytech/cumulus#1085 |
Thank you for the help. Do I need labels and approvals on the cumulus PR as well? |
We have to wait for the new review rules to approve the cumulus companion, sorry for the delay! |
bot merge |
Error: "Check reviews" status is not passing for paritytech/cumulus#1085 |
bot merge |
Waiting for commit status. |
Merge cancelled due to error. Error: Checks failed for cb4eeb2 |
bot rebase |
Rebasing |
bot merge |
* Create a dependency injection trait named Locker that can be implemented downstream to enable locking of an asset. Use case defined in RMRK substrate pallet PR76 * Formatting * Change impl Locker function name to is_locked * Remove unused import * Add docstring header * Remove impl_locker file and add Locker trait to frame_support::traits * Expose Locker from frame_support::traits::misc * Formatting * Move to tokens folder * Move to tokens folder * Format and remove Locker from misc traits * Punctuation * Update frame/support/src/traits/tokens/misc.rs Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Giles Cope <[email protected]>
* Create a dependency injection trait named Locker that can be implemented downstream to enable locking of an asset. Use case defined in RMRK substrate pallet PR76 * Formatting * Change impl Locker function name to is_locked * Remove unused import * Add docstring header * Remove impl_locker file and add Locker trait to frame_support::traits * Expose Locker from frame_support::traits::misc * Formatting * Move to tokens folder * Move to tokens folder * Format and remove Locker from misc traits * Punctuation * Update frame/support/src/traits/tokens/misc.rs Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Giles Cope <[email protected]>
* Create a dependency injection trait named Locker that can be implemented downstream to enable locking of an asset. Use case defined in RMRK substrate pallet PR76 * Formatting * Change impl Locker function name to is_locked * Remove unused import * Add docstring header * Remove impl_locker file and add Locker trait to frame_support::traits * Expose Locker from frame_support::traits::misc * Formatting * Move to tokens folder * Move to tokens folder * Format and remove Locker from misc traits * Punctuation * Update frame/support/src/traits/tokens/misc.rs Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Giles Cope <[email protected]>
Description
Within the RMRK Standard there requires a locking mechanism for the NFT to ensure that when a NFT is
list
ed in thermrk-market
pallet, the NFT must be locked and can no longer allow any interactions with the NFT. Since the RMRK pallet extends theuniques
pallet, implementing theLocker
trait in the config ofrmrk-core
creates a situation where a user can bypass thelock
and execute ado_transfer
directly to theuniques
pallet. We looked using thefreeze
mechanism for anasset
instance, but the implementation was not feasible and led to some centralized problems if the RMRK Admin were to be defined as thefreezer
for all NFT collections.The proposal here is to create a dependency injection trait named
Locker
in theuniques
pallet config that has aimpl
ofLocker
for()
that has function namedshould_check_lock
that defaults a return offalse
, but can be implemented downstream for a pallet like RMRK to enable a simple locking mechanism to ensure the lock cannot be bypassed by directly calling theuniques
palletdo_transfer
. A working example of this in the RMRK pallet is defined here.Note
Use case defined in RMRK substrate pallet in this PR: rmrk-team/rmrk-substrate#76 where the code currently is pointing to a branch off of the stable branch version of
v0.19.17
with the same changes as this PR. This is my first PR to Substrate so let me know if I may have missed any details and I'll gladly add them. Thank you.cumulus-companion: paritytech/cumulus#1085