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

HOLO-1536 save init payload (WIP) #318

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

Yashiru
Copy link
Contributor

@Yashiru Yashiru commented May 24, 2024

Describe Changes

I updated all the ERC721 sources contracts to make them store the payload used in their initialization.

For each source contracts

  • Add INIT_PAYLOAD private storage variable
  • Update init function to store the init payload in the INIT_PAYLOAD
  • Add a getter function that decode the INIT_PAYLOAD

Note

The initPayload could be directly storaged ass a struct type for each contracts, but in the CountdownERC721 and the CustomERC721 contracts, build failed with a stack too deep error in the constructors. So to create a "standard" in all contracts, I opted for a private storage variable of type bytes and a getter function to decode the bytes. This also made it possible to have a getter function named according to each contract.

Checklist before requesting a review

  • I have performed a self-review of my code
  • Code styles have been enforced
  • All Foundry tests are passing

@Yashiru Yashiru self-assigned this May 24, 2024
@@ -0,0 +1,218 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. Thanks for adding this fixture. I think it'll be great if we can make all the tests relatively consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you are right, I'd like to improve/refactor the entire foundry test base to standardize everything and make it consistent.

But we'll have to wait until everything has been migrated from hardhat to foundry I think.

wdyt ?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah probably. we can do what we can on the tests we're writing but we probably shouldn't touch what the Think and Dev team are done until they reach a good stopping point

@alexanderattar alexanderattar marked this pull request as ready for review May 28, 2024 19:11
Copy link
Contributor

@alexanderattar alexanderattar left a comment

Choose a reason for hiding this comment

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

Nice. This looks good!

Copy link
Contributor

@sogoiii sogoiii left a comment

Choose a reason for hiding this comment

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

Can this also be applied to the ERC20 contracts?

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.

4 participants