Skip to content

Commit

Permalink
Merge pull request #2 from alchemyplatform/fangting/MSCA
Browse files Browse the repository at this point in the history
update/add interfaces (updatePlugin, modularAccount), update hooks requirements
  • Loading branch information
fangting-alchemy authored Apr 25, 2023
2 parents b5faddf + 958d8df commit 074d89a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions EIPS/eip-modular-smart-contract-accounts-and-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,21 @@ Account interface. Modular Smart Contract Accounts MUST implement this interface
> */
> function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds)
> external returns (uint256 validationData);
>
> /**
> * @notice Add/replace/remove any number of global plugins and optionally execute
> * a function with delegatecall
> * @param globalPluginUpdates Contains the plugin addresses and function selectors.
> * @param init The address of the contract or facet to execute calldata
> * @param callData A function call, including function selector and arguments
> * calldata is executed with delegatecall on init
> */
> function updateGlobalPlugins(AssociatedFunction[] memory globalPluginUpdates, address init, bytes calldata callData)
> external;
> }
> ```
Account interface. Modular Smart Contract Accounts MAY implement `viewCall` to support view functions without the need to add view functions selectors into storage through updatePlugins.

`IModularAccount.sol`

> ```solidity
> interface IModularAccount {
> /**
> * view function calls to the account
> * @param implAddress the address of the implmentation contract
> * @param data params to pass to the view function
> */
> function viewCall(address implAddress, bytes calldata data) external returns (bytes memory);
> }
> ```
Expand Down Expand Up @@ -152,6 +156,7 @@ Plugin modification interface. Modular Smart Contract Accounts MAY implement thi
> }
>
> event PluginsUpdated(PluginUpdate[] pluginUpdates, address init, bytes callData);
> event GlobalPluginsUpdated(AssociatedFunction[] globalPluginUpdates, address init, bytes callData);
>
> /**
> * @notice Add/replace/remove any number of plugins and optionally execute
Expand All @@ -165,6 +170,17 @@ Plugin modification interface. Modular Smart Contract Accounts MAY implement thi
> * calldata is executed with delegatecall on init
> */
> function updatePlugins(PluginUpdate[] memory pluginUpdates, address init, bytes calldata callData) external;
>
> /**
> * @notice Add/replace/remove any number of global plugins and optionally execute
> * a function with delegatecall
> * @param globalPluginUpdates Contains the plugin addresses and function selectors.
> * @param init The address of the contract or facet to execute calldata
> * @param callData A function call, including function selector and arguments
> * calldata is executed with delegatecall on init
> */
> function updateGlobalPlugins(AssociatedFunction[] memory globalPluginUpdates, address init, bytes calldata callData)
> external;
> }
> ```
Expand Down Expand Up @@ -303,9 +319,11 @@ Runtime Validation Functions may have any function name, and MUST take in the pa
> ```
Hooks may have any function name.

Global hooks are used for every tx.
The global preHook function MUST take in the parameters `(bytes calldata data)`.
The global postHook function MUST take in the parameters `(bytes calldata data)`.
For sets of hooks that are used specifically with execution funtions, they can be paired and share information through returned value.
The preHook function MUST take in the parameters `(bytes calldata data)` and return `(bytes calldata preHookReturnedData)`.

The postHook function MUST take in the parameters `(bytes calldata data, bytes calldata preHookReturnedData)`.

## Rationale
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 074d89a

Please sign in to comment.