💰Smart Account (Account Factory)

The Account Factory contract deploys non-upgradeable, ERC-4337 compatible smart wallet accounts for your dApp users. The smart wallet comes with all the basic benefits of account abstraction like no private key handling, gasless transactions, etc, along with the social account locking and recovery features provided by Guardian Smart Wallet Contracts.

The Account smart contract is non-upgradeable. Developers should use this wallet only if they do not anticipate making any future upgrades to their users' smart wallets.

Usage

On the client side:

Use the AccountFactory address directly on the client side to interact with the deployed factory contract.

In smart-contract projects:

import {AccountFactory} from "@guardian-wallet/contracts/non-upgradeable/AccountFactory.sol;

Functions

function createAccount(address _admin, bytes calldata _email) -> address

Deploys a new smart wallet for your dApp user.

Params:

  1. address _admin: The public address of the user's EOA/Embedded wallet, powering the smart-wallet account.

  2. bytes calldata _email: The user's email in encoded form. This email ID should have been verified by the client and will be used in the account locking and recovery operations.

Returns:

address : The address of the smart wallet account created for the user.


function execute(
        address _target,
        uint256 _value,
        bytes calldata _calldata
    ) external virtual onlyAdminOrEntrypoint whenNotPaused {}

Executes a single transaction. Can only be called directly by the owner or the entry point contract.

whenNotPaused is a modifier, which only allows transactions to go through if the smart wallet account is not locked.

Params

address _target: The address of the contract against which the transaction should execute.

uint256 _value: The value of native tokens, if any, that should be transferred to the _target contract.

bytes calldata _calldata: Any call data to be sent.


function executeBatch(
        address[] calldata _target,
        uint256[] calldata _value,
        bytes[] calldata _calldata
    ) external virtual onlyAdminOrEntrypoint whenNotPaused {}

Executes a batch of transactions. Can only be called directly by the owner or the entry point contract.

whenNotPaused is a modifier, which only allows transactions to go through if the smart wallet account is not locked.

Params

address[] calldata _target: The addresses of the contracts against which the transactions should execute.

uint256[] calldata _value: The values of native tokens, if any, that should be transferred to the _target contracts. The indexes of _target and _value arrays should correspond.

bytes[] calldata _calldata: Bytes of call data, if any, that need to be sent to the respective _target contracts. The indexes of _target and _calldata arrays should correspond.

Last updated