Website | Documentation | API Docs | Twitter
Openfort Smart Accounts for zkSync.
zkSync is a zero-knowledge Ethereum rollup featuring its own zkEVM, which operates with bytecode distinct from Ethereum's EVM. While 99% of Ethereum projects can be redeployed on zkSync without requiring refactoring or re-auditing, Account Abstraction contracts fall into the remaining 1%.
Unlike traditional Ethereum setups, zkSync natively supports Account Abstraction, eliminating the need for ERC-4337 and its associated EntryPoint contract. Account features like session keys, guardians, and contracts upgradeability stratregy, MUST conform with Openfort Smart Accounts.
This repository contains only end to end tests because openfort-contracts is already heavily tested and audited.
git clone https://github.com/openfort-xyz/openfort-zksync-contracts.git && cd openfort-zksync-contracts
yarn
yarn hardhat compile
Run e2e tests on a freshly created account deployed from a fresh factory (long setup time)
To test on Sophon testnet:
export WALLET_PRIVATE_KEY=0x...
export export SOPHON_TESTNET_PAYMASTER_ADDRESS=0x...
To test on zkTestnet (zkSync Sepolia):
export WALLET_PRIVATE_KEY=0x... // account must have native sepolia to pay for the deployments
No env required to test on zkSyncLocal (local node)
yarn hardhat test --network <zkSophonTestnet|zkTestnet|zkSyncLocal> --nonce <number> // nonce gives predictive smart account address
Running tests with the zkSyncLocal
network requires a running local zkSync node: download and run era_test_node fork https://sepolia.era.zksync.dev
on another terminal before running the tests.
Run e2e tests directly, skip deployments
export ACCOUNT_ADDRESS=<ACCOUNT_ADDRESS>
yarn hardhat test --network <zkSophonTestnet|zkTestnet|zkSyncLocal> --skip-deployments
WALLET_PRIVATE_KEY= # account must have positive balance to deploy on zkTestnet (Sepolia) OR be whitelisted on Sophon Paymaster to deploy on Sophon testnet
SOPHON_TESTNET_PAYMASTER_ADDRESS= # only required to deploy on Sophon
yarn hardhat deploy-account --network <zkSophonTestnet|zkTestnet|zkSyncLocal>
# account is optional. script will deploy one if not provided.
yarn hardhat deploy-factory --account <DEPLOYED_ACCOUNT> --network <zkSophonTestnet|zkTestnet|zkSyncLocal>
Call createAccountWithNounce
factory function to deploy an account proxy and initialize it with the account implementation
yarn hardhat create-account --factory <FACTORY> --implementation <ACCOUNT_IMPLEMENTATION> --nonce <number> --network <zkSophonTestnet|zkTestnet|zkSyncLocal>
Compute the address of any account
yarn hardhat get-account --factory <FACTORY> --implementation <ACCOUNT_IMPLEMENTATION> --nonce <number>