Closed honeywest closed 3 years ago
There is a trait called AccountSet
for any object that can act as a set of accounts in. https://github.com/substrate-developer-hub/recipes/blob/7e79915f5fcb7c0fc05803e51e01fe1fe2890d76/traits/account-set/src/lib.rs#L5-L11
There are two different pallets in the recipes that both act as account sets, and therefore implement this trait. The first is called vec-set
, it's the one you're working on. The second is called map-set
. You can see it implements the same trait here. https://github.com/substrate-developer-hub/recipes/blob/7e79915f5fcb7c0fc05803e51e01fe1fe2890d76/pallets/map-set/src/lib.rs#L100-L108
Implementing this common trait allows other pallets that need a set of accounts to use either of these pallet without changing their code. The recipes has a pallet, check-membership
that demonstrates this technique. It is called "loosely coupling" pallets. https://github.com/substrate-developer-hub/recipes/blob/master/pallets/check-membership/src/loose/mod.rs#L22-L23
Tight and Loose coupling is described in some detail in this recipe https://substrate.dev/recipes/pallet-coupling.html
Based on your last comment I am going to close this Issue @honeywest please reopen it or a create a new one if you have more questions. Thank you for the assist, @JoshOrndorff!
delete code and test ok I don't know what this code does https://github.com/substrate-developer-hub/recipes/blob/7e79915f5fcb7c0fc05803e51e01fe1fe2890d76/pallets/vec-set/src/lib.rs#L108-L114