0

I wonder if there is a structure in pallets, which other projects should follow.

We have the following elements:

  1. < Config trait >
  2. < Types >
  3. < Storage >
  4. < Genesis info>
  5. < Events >
  6. < Error >
  7. < Hooks>
  8. < Dispatchables >
  9. < Pallet public and private functions >
  10. < Trait Implementations >

Are there any elements missing? If yes, make a suggestion of your structure with the new elements inside!

1 Answer 1

1

aside from the outer

#[pallet]
mod pallet {}

and the fact that everything needs to be inside of this, internals of a pallet are almost entirely normal Rust and the mentioned items can appear anywhere with any order.

Here are some suggested best-practices:

  • Config trait should come first.
  • Place all storage items next to each other.
  • I would put the types at the top.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.