Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pallets: move business logic to seperate files #735

Closed
10 tasks done
DylanVerstraete opened this issue Jun 12, 2023 · 3 comments
Closed
10 tasks done

Pallets: move business logic to seperate files #735

DylanVerstraete opened this issue Jun 12, 2023 · 3 comments
Assignees
Labels
type_feature New feature or request
Milestone

Comments

@DylanVerstraete
Copy link
Contributor

DylanVerstraete commented Jun 12, 2023

In lib.rs only keep:

the pallet module declaration containing:

  • storage
  • events
  • calls
  • ..

Move logic that is executed within extrinsics to seperate files. This will improve readability.

  • pallet-smart-contract
  • pallet-tfgrid
  • pallet-dao
  • pallet-burning
  • pallet-kvstore
  • pallet-tft-price
  • pallet-validator
  • substrate-validator-set
  • pallet-runtime-upgrade (already good)
  • pallet-tft-bridge
@DylanVerstraete DylanVerstraete added the type_feature New feature or request label Jun 12, 2023
@renauter
Copy link
Collaborator

Do you think about something like this?

  • lib.rs => pallet module declaration
  • extr.rs => extrinsics body functions
  • help.rs => helpers functions
  • traits.rs => impl of some traits

@DylanVerstraete
Copy link
Contributor Author

@renauter that is too generic, I would group functionality in files and give the file a meaningful name. For example, anything related to distribution of rewards in pallet-smart-contract -> distribution.rs

Another example, twins create/update in pallet-tfgrid -> twins.rs

@DylanVerstraete DylanVerstraete added this to the 2.5.0 milestone Jun 19, 2023
sameh-farouk added a commit to sameh-farouk/tfchain that referenced this issue Jun 20, 2023
sameh-farouk added a commit to sameh-farouk/tfchain that referenced this issue Jun 20, 2023
sameh-farouk added a commit to sameh-farouk/tfchain that referenced this issue Jun 26, 2023
sameh-farouk added a commit to sameh-farouk/tfchain that referenced this issue Jul 3, 2023
sameh-farouk added a commit to sameh-farouk/tfchain that referenced this issue Jul 5, 2023
sameh-farouk added a commit to sameh-farouk/tfchain that referenced this issue Jul 5, 2023
@mohamedamer453
Copy link

Verified.

  • pallet-smart-contract
  • pallet-tfgrid
  • pallet-dao
  • pallet-burning
  • pallet-kvstore
  • pallet-tft-price
  • pallet-validator
  • substrate-validator-set
  • pallet-runtime-upgrade (already good)
  • pallet-tft-bridge

The structure of the pallets was done as mentioned.

image

Each pallet has its own readme.

image

and within each pallet in the src directory there's a file containing the implementation of each functionality.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type_feature New feature or request
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants