Skip to content

fix(docs): add common data best practice #2879

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

skywardboundd
Copy link
Contributor

Closes #2878

@skywardboundd skywardboundd requested a review from a team as a code owner April 21, 2025 08:25
@skywardboundd skywardboundd linked an issue Apr 21, 2025 that may be closed by this pull request
@novusnota novusnota self-requested a review April 21, 2025 12:57
@novusnota novusnota added this to the Doc: 2025-04 milestone Apr 21, 2025
Copy link
Member

@novusnota novusnota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've left a couple of suggestions

skywardboundd and others added 8 commits April 22, 2025 00:26
Co-authored-by: Novus Nota <68142933+novusnota@users.noreply.github.com>
Co-authored-by: Novus Nota <68142933+novusnota@users.noreply.github.com>
Co-authored-by: Novus Nota <68142933+novusnota@users.noreply.github.com>
Co-authored-by: Novus Nota <68142933+novusnota@users.noreply.github.com>
Co-authored-by: Novus Nota <68142933+novusnota@users.noreply.github.com>
Co-authored-by: Novus Nota <68142933+novusnota@users.noreply.github.com>

When deploying multiple instances of the same contract type, it's common for some data fields to be initially set to the same values. For example, in [NFT Item contracts](/cookbook/nfts), fields like `ownerAddress`, `content`, and `collectionAddress` might start as `null` or have the same collection address for all items.

In such cases, it's more gas-efficient to group these common fields at the beginning of the contract parameters.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear from the description this is going to be cheaper.

Please add an explanation and a test that supports this recommendation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move commonData to the start — best practice
4 participants