Ankita.eth
GithubContact
  • About Ankita
  • experience
    • TECHNOLOGIES
    • Frontend
      • Javascript
      • React
      • NextJS
      • HTML & CSS
      • UI Libraries & Frameworks
        • Tailwind CSS
        • Comprehensive Guide to UI Libraries and Frameworks
    • Backend
      • Node.js
      • Express.js
    • Database
      • Mongodb, Mongoose
      • PostgresSQl
      • MySQL
    • Packege Mangers
      • NPM-Node Packege Manager
      • Yarn
      • Yarn 2 (Berry)
      • PNPM
      • BUN
      • Commands cheatsheet
    • API Providers
      • Alchemy
      • Telegram Bot
      • CoinMarket
      • Thirdweb
      • Infura
      • Moralis
    • DevOps/Infrastructure
      • Docker
      • Kubernetes
      • CI/CD
      • Docker Swam
    • Protocols
      • ERCs & EIPs
        • ERC-20
        • ERC-721
        • ERC-1155
        • ERC-4337
        • ERC-6551
        • ERC-777
        • ERC-3643
        • EIP-7702
        • ERC-7715
        • ERC-7739
        • EIP-6780
        • EIP-5792
        • ERC-4626
        • EIP-1559
        • ERC-404
        • ERC-3643
        • ERC-223
    • Web3 Toolkits
      • Foundry
      • Hardhat
      • RemixIDE
    • Messaging/Caching
      • Kafka
      • Redis
      • Sendgrid
    • Blockchain
      • Solana
      • Ethereum
      • Polygon & Zero knowldge Proof
      • Bitcoin
      • Solidity
    • Deployment Platforms
      • AWS
      • Vercel
      • Heroku, Render
      • Domain setup
  • SDKs
    • Google Cloud SDK
    • AWS SDK
    • Firebase SDK
  • EOF EVM Object Format
  • Articles
    • Medium Articles
    • 🌐 My Work
  • 📞 Get in Touch
Powered by GitBook
On this page
  • 📜 ERC-7715: Modular Smart Contract Accounts
  • đŸ—ī¸ Architecture
  • 🧠 Core Concepts
  • đŸšļ User Flow
  • đŸ’ģ Implementation Details
  • 🚀 Example Implementation
  • 🔑 Key Features

Was this helpful?

  1. experience
  2. Protocols
  3. ERCs & EIPs

ERC-7715

PreviousEIP-7702NextERC-7739

Last updated 8 months ago

Was this helpful?

📜 ERC-7715: Modular Smart Contract Accounts

ERC-7715 introduces a standard for modular smart contract accounts, providing a flexible and extensible framework for account abstraction on the Ethereum blockchain.

đŸ—ī¸ Architecture

The ERC-7715 standard defines a modular architecture for smart contract accounts, consisting of several key components:

🧠 Core Concepts

1. Account 👤

The main smart contract that represents the user's account. It manages modules and delegates calls to them.

2. AccountRegistry 📚

A central registry that keeps track of all accounts and their associated modules.

3. Modules 🧩

Interchangeable components that provide specific functionalities to the account:

  • ExecutionModule: Handles the execution of transactions

  • ValidationModule: Validates transactions before execution

  • HookModule: Provides pre and post-execution hooks

4. Fallback â†Šī¸

A mechanism to handle calls to undefined functions, providing flexibility for future extensions.

đŸšļ User Flow

Here's a typical user flow for interacting with an ERC-7715 account:

đŸ’ģ Implementation Details

Account Interface

interface IERC7715Account {
    function execute(bytes calldata _data) external payable returns (bytes memory);
    function isValidSignature(bytes32 _hash, bytes memory _signature) external view returns (bytes4);
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
    // ... additional functions
}

Module Interface

interface IERC7715Module {
    function isInitialized(address _account) external view returns (bool);
    function initialize(bytes calldata _data) external returns (bytes memory);
    // ... additional functions
}

AccountRegistry Interface

interface IERC7715AccountRegistry {
    function registerAccount(address _account, address _owner) external;
    function isRegistered(address _account) external view returns (bool);
    function getAccountOwner(address _account) external view returns (address);
    // ... additional functions
}

🚀 Example Implementation

Here's a basic implementation of an ERC-7715 Account:

pragma solidity ^0.8.0;

import "./IERC7715Account.sol";
import "./IERC7715Module.sol";

contract ERC7715Account is IERC7715Account {
    mapping(bytes4 => address) private modules;

    function execute(bytes calldata _data) external payable override returns (bytes memory) {
        address module = modules[bytes4(keccak256("execute(bytes)"))];
        require(module != address(0), "Execution module not set");
        return IERC7715Module(module).execute(_data);
    }

    function isValidSignature(bytes32 _hash, bytes memory _signature) external view override returns (bytes4) {
        address module = modules[bytes4(keccak256("isValidSignature(bytes32,bytes)"))];
        require(module != address(0), "Validation module not set");
        return IERC7715Module(module).isValidSignature(_hash, _signature);
    }

    function setModule(bytes4 _selector, address _module) external {
        // Add access control here
        modules[_selector] = _module;
    }

    function supportsInterface(bytes4 interfaceId) external view override returns (bool) {
        return interfaceId == type(IERC7715Account).interfaceId;
    }

    // Fallback function to handle undefined calls
    fallback() external payable {
        address fallbackModule = modules[bytes4(0)];
        if (fallbackModule != address(0)) {
            (bool success, ) = fallbackModule.delegatecall(msg.data);
            require(success, "Fallback call failed");
        }
    }
}

🔑 Key Features

  • 🧩 Modular design for flexible functionality

  • 🔄 Easy upgradeability of account features

  • 🔒 Enhanced security through separate validation modules

  • đŸŽŖ Extensible with pre and post-execution hooks

  • 🔌 Interoperability with existing Ethereum infrastructure

ERC-7715 provides a powerful framework for creating modular smart contract accounts, enabling developers to build sophisticated and adaptable account systems. This standard paves the way for more user-friendly and feature-rich blockchain applications while maintaining high levels of security and flexibility.