Skip to main content
Version: SDK V1

Smart Account Factory Contract

Factory for deploying Smart Accounts as Proxies

(https://github.com/bcnmy/scw-contracts/blob/master/contracts/smart-contract-wallet/SmartAccountFactory.sol)

It is a Factory contract that is responsible for deploying Smart Accounts using CREATE2 and CREATE opcodes.

It deploys Smart Accounts as proxies pointing to basicImplementation that is immutable for this factory.

This allows keeping the same address for the same Smart Account owner on various chains via CREATE2.

The Smart Account is initialized directly after its deployment with owner and callback handler info.

getAddressForCounterFactualAccount()

Returns an address for the Smart Account when it will be deployed by this factory with the same _owner and _index values. _index serves as a salt to be able to deploy several Smart Accounts for the same user from this factory.

function getAddressForCounterFactualAccount(
address _owner,
uint256 _index
) external view returns (address _account)

deployCounterFactualAccount()

Deploys Smart Account with CREATE2 and returns its address.

function deployCounterFactualAccount(
address _owner,
uint256 _index
) public returns (address proxy)

deployAccount()

Deploys account using CREATE (thus it deploys with a random address, rather than a counterfactual).

function deployAccount(address _owner) public returns (address proxy)