EIP-6900
Overview
The EIP-6900 is a standard of a Modular Account used in the Account Abstract. In the contract, user can install the Plugins which is used before the operation of the validation on the validation phase, before and after the execution in the entrypoint's operation. The Modular Account is conbstructed for the users to install the operation that user want to use. There are many types of plugins from the varioius Web3 protocols including Safe, Alchemy, and etc. In this page, we would introduce of the plugins which validates or integrates with the paymaster contract.
Types of Plugins
PaymasterGuardModule-Alchemy
Plugin Type: preValidation Hook
The module checks each UserOperation's paymaster against the stored approved paymaster address. Once installed, the module will validate all UserOperations by checking if they use the approved paymaster. If a different paymaster is used, the transaction will revert with BadPaymasterSpecified
error. You can use only one paymaster which is stored to the SCW by the plugin.
You can see the paymaster address being installed and uninstalled in the contract.
function onInstall(bytes calldata data) external override {
(uint32 entityId, address paymaster) = abi.decode(data, (uint32, address));
paymasters[entityId][msg.sender] = paymaster;
}
function onUninstall(bytes calldata data) external override {
(uint32 entityId) = abi.decode(data, (uint32));
delete paymasters[entityId][msg.sender];
}
CF) The onInstall and the onUnInstall function is the callback function to the entrypoint in the Modular Account(SCW). It is called when installing or uninstalling the plugin contract to the wallet.
The validate function is here:
function preUserOpValidationHook(uint32 entityId, PackedUserOperation calldata userOp, bytes32)
external
view
override
assertNoData(userOp.signature)
returns (uint256)
{
address payingPaymaster = address(bytes20(userOp.paymasterAndData[:20]));
if (payingPaymaster == paymasters[entityId][msg.sender]) {
// checks if the userOp uses the correct paymaster address.
return 0;
} else {
revert BadPaymasterSpecified();
}
}
Last updated