Skip to main content

Safe Account

The SafeAccount uses the original Safe Singleton and adds ERC-4337 functionality using a module/fallback handler.

  • The V2 contracts, or SafeAccountV0_2_0 in AbstractionKit, supports EntryPoint v0.6.
  • The V3 contracts, or SafeAccountV0_3_0 in AbstractionKit, supports EntryPoint v0.7.

The contracts have been developed by the Safe Team, and have been audited by Open Zeppelin & Ackee Blockchain.

Audits

To learn more about the contracts, visit the repository of Safe ERC-4337 Module.

Import

V3 for EntryPoint v0.7

import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit"; 

V2 for EntryPoint v0.6

import { SafeAccountV0_2_0 as SafeAccount } from "abstractionkit"; 

How to use

AbstractionKit classes are designed to support the same methods across both versions, ensuring compatibility within the essential classes. This allows developers to upgrade from Safe V2 to Safe V3 seamlessly, without breaking functionality or requiring significant code changes.

To initialize a new Safe Account and calculate its address:

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31"; // Safe owner pub address
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

const accountAddress = smartAccount.accountAddress;