-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: gas optimization branch #543
Conversation
@@ -9,8 +9,8 @@ import './NFT1155Upgradeable.sol'; | |||
contract NFT1155SubscriptionUpgradeable is NFT1155Upgradeable { | |||
|
|||
struct MintedTokens { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to squeeze the whole struct such that in summary its fields are <= 256 bits (aka uint256
, 32 bytes or one slot). For example, the expirationBlock
/ mintBlock
can be defined as uint64
as (for example, Arbitrum) is a bit faster than 2 blocks per second, and one might calculate for how long this value is safe.
As for the amountMinted
, depending on the projected total supply and decimals, this might be bounded by uint96
?
After these changes, we have uint64 + uint96 + uint64 + uint8 (bool) < uint256
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem of that approach is would break compatibility with existing subscriptions minted. Probably this contract only could be upgraded adding a new mapping but existing subscriptions could not be burned anymore.
@aaitor Couple of more things:
|
Description
The objective of this change would be to reduce the amount of gas used for the NFT1155Subscription contract, specially for the
burn
mechanism.Is this PR related with an open issue?
Related to Issue #
Types of changes
Checklist:
Funny gif