Comments (6)
Correct. My point is to control who can be the collection_issuer
.
For this we take a type type Creators: EnsureOrigin<Self::Origin, Success = Self::AccountId>
.
And current behaviour would be achieved by:
impl pallet_rmrk_core::Config for Runtime {
type Creators = EnsureSigned
}
Then all signed origin can create collection ( & in turn nft inside it )
And if we want it to be controlled we do something like:
impl pallet_rmrk_core::Config for Runtime {
type Creators = OneOfOrigin<[Account1, Account2, Account3]>
}
Then only Account1
, Account2
and Account3
can create collection ( & in turn nft under it )
from rmrk-substrate.
With the Uniques pallet, we can set the team with function set_team
. This function allows us to set
issuer
: Issuer of NFTs for a given Collectionadmin
: Admin can thaw, force transfer and burn NFTs of a given Collectionfreezer
: Freezer to freeze NFTs for a given Collection
We could leverage this existing functionality to set the issuer
account for a Collection then ensure the mint functions check if sender
is the Collection's issuer
Example:
set_team
in pallet_uniques
& must be called by the Collection's owner
:
#[pallet::weight(T::WeightInfo::set_team())]
pub fn set_team(
origin: OriginFor<T>,
collection: T::CollectionId,
issuer: AccountIdLookupOf<T>,
admin: AccountIdLookupOf<T>,
freezer: AccountIdLookupOf<T>,
) -> DispatchResult {
let origin = ensure_signed(origin)?;
let issuer = T::Lookup::lookup(issuer)?;
let admin = T::Lookup::lookup(admin)?;
let freezer = T::Lookup::lookup(freezer)?;
Collection::<T, I>::try_mutate(collection, |maybe_details| {
let details = maybe_details.as_mut().ok_or(Error::<T, I>::UnknownCollection)?;
ensure!(origin == details.owner, Error::<T, I>::NoPermission);
details.issuer = issuer.clone();
details.admin = admin.clone();
details.freezer = freezer.clone();
Self::deposit_event(Event::TeamChanged { collection, issuer, admin, freezer });
Ok(())
})
}
By default, these accounts are assigned to the Collection owner
when a Collection is created. Having upstream uniques manage this account permissions logic can allow us to have the function change_collection_issuer
in pallet_rmrk_core
to remove the call to pallet_uniques::transfer_ownership
and instead call pallet_uniques::set_team
to change the issuer
account. We can update permission checks to check our internal function for Collections called issuer
to return the CollectionInfo
field issuer
from the Collections
storage.
This can remove the need for adding a trait & won't require storage migrations downstream.
from rmrk-substrate.
I think it makes sense. @HashWarlock wdyt?
from rmrk-substrate.
If so. I am willinng to raise a PR. I mean work has already been done.
from rmrk-substrate.
Currently, anyone can do so. It might be more convinent to allow the runtime to configure this.
I am not entirely sure what you mean by this. Currently, only the collection_issuer
is able to mint nfts.
// Collection must exist and sender must be issuer of collection
if let Some(collection_issuer) =
pallet_uniques::Pallet::<T>::collection_owner(collection_id)
{
ensure!(collection_issuer == sender, Error::<T>::NoPermission);
// -- snip
What would we exactly gain by using a custom origin? Sorry if I didn't understand you correctly.
from rmrk-substrate.
Ok, it makes sense to me now, thanks for the explanation.
from rmrk-substrate.
Related Issues (20)
- Add a restriction handler in function transfer HOT 1
- docker_run.sh not working: missing .local HOT 2
- Benchmarking: update all benchmark tests for functions using budget HOT 2
- Benchmarking: rmrk-equip pallet HOT 2
- Benchmarking: rmrk-market HOT 2
- Rmrk-Market pallet doesn't compile with `runtime-benchmark` feature HOT 8
- Build error: in Phantom_type FieldsBuilder after scale-info 2.3 update
- A need to retrieve all NFTs under a certain address through one query HOT 3
- Burn NFTs causes panic HOT 3
- Have a way to bulk remove properties
- Set and Clear Collection Metadata HOT 3
- Rename Base to Catalog
- Remove Locks when selling or unlisting an NFT HOT 2
- Add a Constant Marketplace Fee Trait For Downstream
- Adding Metadata to Base HOT 5
- Add migrations code for storage changes
- Yarn Test Errors HOT 3
- Error compiling HOT 2
- Prevent Market Offer Storage Bloat
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rmrk-substrate.