概要

ERC7579に準拠するコントラクトアカウントは、以下のアカウント設定用インターフェースを実装する必要があります。 これは、アカウントの識別や対応モード、モジュールの互換性を外部から確認できるようにするインターフェースです。

IERC7579AccountConfig

IERC7579AccountConfig.sol
interface IERC7579AccountConfig {
    /**
     * @dev Returns the account id of the smart account
     * @return accountImplementationId the account id of the smart account
     *
     * MUST return a non-empty string
     * The accountId SHOULD be structured like so:
     *        "vendorname.accountname.semver"
     * The id SHOULD be unique across all smart accounts
     */
    function accountId() external view returns (string memory accountImplementationId);

    /**
     * @dev Function to check if the account supports a certain execution mode (see above)
     * @param encodedMode the encoded mode
     *
     * MUST return true if the account supports the mode and false otherwise
     */
    function supportsExecutionMode(bytes32 encodedMode) external view returns (bool);

    /**
     * @dev Function to check if the account supports a certain module typeId
     * @param moduleTypeId the module type ID according to the ERC-7579 spec
     *
     * MUST return true if the account supports the module type and false otherwise
     */
    function supportsModule(uint256 moduleTypeId) external view returns (bool);
}

accountId

solidity
function accountId() external view returns (string memory accountImplementationId);

コントラクトアカウントの一意な識別子(account ID)を返す関数。 返される文字列は空であってはならず、フォーマットは "ベンダー名.アカウント名.バージョン" のように構成されることが推奨されます(例:mywallet.safemodule.v1.0.0)。 この識別子は、他のコントラクトアカウントと一意であることが望まれます。

このIDは、外部からそのコントラクトアカウントがどのような実装で構成されているかを識別する際に使われます。

supportsExecutionMode

solidity
function supportsExecutionMode(bytes32 encodedMode) external view returns (bool);

渡された実行モード(encodedMode)がこのコントラクトアカウントでサポートされているかを確認する関数。 実行モードの詳細は呼び出しの種類やエラーハンドリング方式をエンコードしたものです。 コントラクトアカウントがそのモードをサポートしていれば true、そうでなければ false を返します。 これにより、モジュールや外部アプリケーションが事前に互換性を確認できます。

supportsModule

solidity
function supportsModule(uint256 moduleTypeId) external view returns (bool);

指定されたモジュールタイプ(moduleTypeId)がコントラクトアカウントで使用可能かを返す関数。 moduleTypeId はERC7579で定義されたモジュール種別(Validator, Executor, Fallback など)を表すIDです。 コントラクトアカウントがそのモジュールタイプを受け入れる設計になっていれば true を返します。 この関数により、モジュールの導入可否を事前に判別することができ、モジュールとアカウント間の安全な組み合わせを確保できます。