@biconomy-devx/account-contracts-v2 v2.0.3
Biconomy Smart Account: Leading Implementation of Account Abstraction ๐
Biconomy Smart Account is a smart contract wallet focused on implementing Account Abstraction. It builds on the core concepts of Gnosis and Argent safes and is compliant with ERC-4337 and ERC-6900.
๐ Smart Contracts
- BaseSmartAccount.sol: An abstract contract implementing the EIP4337 IWallet interface.
- Proxy.sol: A lightweight proxy upgradeable through the UUPS pattern.
- SmartAccountFactory.sol: This factory contract manages the deployment of Smart Account (Account Abstraction).
- SmartAccount.sol: The primary implementation contract for a Smart Account (Account Abstraction).
- EntryPoint.sol: Implements the EIP4337 Entry Point contract.
- StakeManager.sol: A stake manager for wallet and paymaster deposits/stakes.
- Executor.sol: A helper contract facilitating calls and delegate calls to dapp contracts.
- FallbackManager.sol: Manages a fallback handler for delegate calls.
- ModuleManager.sol: Adopts the Gnosis Safe module manager pattern.
- DefaultCallbackHandler.sol: Handles hooks to respond to token receipts.
- MultiSend.sol & MultiSendCallOnly.sol: Facilitates batching multiple transactions into one.
๐ ๏ธ Prerequisites
- Node.js
- Yarn or npm
- Hardhat
๐ How to Run the Project
Before diving in, place a mnemonic in a .secret file at the root.
Remember: Never commit this file or share it publicly.
Setup
Setup: Clone the repository and install dependencies.
git clone https://github.com/bcnmy/scw-contracts.git
cd scw-contracts
npm installConfiguration: Create a .secret file at the root to store your mnemonic.
Note: Never commit this file.
shell
echo "your mnemonic here" > .secret
๐ ๏ธ Development Commands
Below are the commands you can use for various tasks:
๐งช Testing
Note if there are issues with submodules
to init or update submodules
git submodule update --remote
git submodule update --init
you can alternatively also run forge install.
Run regular tests:
npx hardhat testFor Bundler Integration Tests, first install realpath:
brew install coreutilsThen, run the Bundler Integration Tests:
yarn bundler-test๐ฆ Compilation & Deployment
Compile contracts:
npx hardhat compileClean the environment:
npx hardhat cleanStart a local Ethereum node:
npx hardhat nodeDeploy contracts:
npx hardhat run scripts/deploy.ts
TS_NODE_FILES=true npx ts-node scripts/deploy.ts๐ Analysis & Reporting
Display available accounts:
npx hardhat accountsGet help on Hardhat commands:
npx hardhat helpTest with gas report:
REPORT_GAS=true npx hardhat testGenerate code coverage report:
npx hardhat coverage๐งน Code Quality & Formatting
Lint JavaScript and TypeScript files:
npx eslint '**/*.{js,ts}'Automatically fix linting issues:
npx eslint '**/*.{js,ts}' --fixCheck formatting for JSON, Solidity, and Markdown files:
npx prettier '**/*.{json,sol,md}' --checkAutomatically format files:
npx prettier '**/*.{json,sol,md}' --writeLint Solidity contracts:
npx solhint 'contracts/**/*.sol'Automatically fix issues in Solidity contracts:
npx solhint 'contracts/**/*.sol' --fixThis format separates the description from the command, making it clearer and more readable.
๐ Etherscan Verification
To verify on Etherscan, deploy a contract to an Ethereum network supported by Etherscan, like Ropsten. Set up your .env file, deploy your contract, and then verify:
hardhat run --network goerli scripts/deploy.ts
npx hardhat verify --network goerli DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"โก Performance Optimizations
Boost your tests and scripts' speed by setting the TS_NODE_TRANSPILE_ONLY environment variable to 1 in Hardhat's environment. More details are available in the documentation.
๐ Audit Reports
We have had our contracts audited by reputable firms to ensure their security. You can find the reports in the audits folder.
๐ค Contributing
Biconomy Smart Account is an open-source project. Contributions are welcome. If you're interested in contributing, please check our contribution guidelines and feel free to submit pull requests or raise issues.
๐ License
This project is licensed under the MIT License. See the LICENSE.md file for details.