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

Integration with Solday's ERC6551 Implementation #133

Merged
merged 5 commits into from
Apr 25, 2024

Conversation

kingster-will
Copy link

@kingster-will kingster-will commented Apr 25, 2024

Description

Overview

This PR introduces integration with Solday's ERC6551 smart contract. Key modifications include the update of the state variable, renaming it from nonce and changing its type from uint256 to hash (bytes32). This adjustment ensures that state is now deterministic, computed from the input parameters of the execute() function.

Modifications

  • Inheritance: IPAccount now extends Solday's ERC6551 contract to utilize its implementation of ERC6551 interfaces including token(), owner(), receiver functions and 1271 signature validation.
  • State/nonce Update: Changed the type of state from uint256 to bytes32 according to Solady 6551, which is hash computed based on execute() inputs. All execute functions execute()', executeBatch()andexecuteWithSig()share the function to update 'state' which calculate hash based on common inputs of execute functions:to, valueanddata`.
  • Method Overrides: Overrode execute() and executeBatch() methods from Solady ERC6551 to include check permissions via AccessController. This ensures that every execution undergoes a permission verification process.

Test Plan

All new added code covered by automation tests.

Related Issue

Closes #83

Copy link
Member

@LeoHChen LeoHChen left a comment

Choose a reason for hiding this comment

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

LGTM, needs @Vectorized's review

@jdubpark
Copy link

For tests, it'd be better to use parameterized internal functions for repetitive code, e.g. newState and signatures, to improve readability. Pretty hard to scroll through the test cases without getting confused.

Copy link

@Vectorized Vectorized left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@Ramarti Ramarti left a comment

Choose a reason for hiding this comment

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

Looks good

@LeoHChen LeoHChen merged commit 330b8b8 into storyprotocol:main Apr 25, 2024
3 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.

Use Solady's ERC6551 implementation
5 participants