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

feat: enable token template upgrades through TokenizerModule #193

Conversation

sebsadface
Copy link
Member

Description

This PR adds the ability to upgrade whitelisted token template implementations in the TokenizerModule. The enhancement enables controlled upgrades of token implementations while maintaining system security through proper access controls.

Changes

  • Added upgradeWhitelistedTokenTemplate function to the TokenizerModule and its interface
  • Updated the Errors library with a new error for zero token implementation validation
  • Transferred ownership of the ownableERC20Beacon to the TokenizerModule
  • Added tests to verify upgrade functionality works correctly

Security Considerations

  • Function is restricted to be called only by the upgrader admin through the restricted modifier
  • Multiple validation checks ensure that:
    • Token template address is not zero
    • New implementation address is not zero
    • Token template is whitelisted

Testing

Added two test cases:

  1. Successfully upgrading a whitelisted token template
  2. Verifying reversion when attempting to upgrade a non-whitelisted template

…okenizerModule`

This commit adds functionality to the TokenizerModule allowing upgrading of whitelisted token templates. Key changes include:

- Added `upgradeWhitelistedTokenTemplate` function to the TokenizerModule and its interface
- Updated the Errors library with a new error type for validation
- Transferred ownership of the ownableERC20Beacon to the TokenizerModule
- Added tests to verify the new upgrade functionality works as expected

This enhancement enables safer and more controlled upgrades of token implementations while maintaining the security of the system through proper access controls.
@kingster-will
Copy link
Collaborator

Why we need this feature?

@sebsadface
Copy link
Member Author

Why we need this feature?

We need this to allow upgrading the token template directly from the Tokenizer module, and to integrate with our Access Manager. This is similar to how we currently handle upgrades for IPRoyaltyVault (via RoyaltyModule), IPAccount (via IIPAssetRegistry), and SPGNFT (via RegistrationWorkflows).

Otherwise, we'd have to upgrade the OwnableERC20 template by directly calling the Upgradeable Beacon, which requires action by the beacon owner (currently the deployer). That’s less flexible and inconsistent with our other upgrade methods.

@kingster-will
Copy link
Collaborator

I see.
I meant, why do we need this PR now? Is there a known use case that requires this feature, or do we consider it just a missing feature gap in the current version?

@sebsadface
Copy link
Member Author

I see. I meant, why do we need this PR now? Is there a known use case that requires this feature, or do we consider it just a missing feature gap in the current version?

Got it! There’s no known use case currently requiring this feature; we consider it as a feature gap in the existing version. I noticed this issue while working on #178 where I’m improving the upgrade scripts

@sebsadface sebsadface merged commit f601063 into storyprotocol:main Mar 11, 2025
10 checks passed
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.

2 participants