Giter Site home page Giter Site logo

scw-contracts's Introduction

Solidity Hardhat Foundry Test Coverage

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.

Biconomy Account Abstraction Banner

๐Ÿ“œ 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.
  • VerifyingSingletonPaymaster.sol: A paymaster that uses an external service for transaction validation.
  • PaymasterHelpers.sol: A library essential for decoding paymaster data and context.

๐Ÿ› ๏ธ 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 install

Configuration: 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

Run regular tests:

npx hardhat test

For Bundler Integration Tests, first install realpath:

brew install coreutils

Then, run the Bundler Integration Tests:

yarn bundler-test

๐Ÿ“ฆ Compilation & Deployment

Compile contracts:

npx hardhat compile

Clean the environment:

npx hardhat clean

Start a local Ethereum node:

npx hardhat node

Deploy contracts:

npx hardhat run scripts/deploy.ts
TS_NODE_FILES=true npx ts-node scripts/deploy.ts

๐Ÿ“ˆ Analysis & Reporting

Display available accounts:

npx hardhat accounts

Get help on Hardhat commands:

npx hardhat help

Test with gas report:

REPORT_GAS=true npx hardhat test

Generate 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}' --fix

Check formatting for JSON, Solidity, and Markdown files:

npx prettier '**/*.{json,sol,md}' --check

Automatically format files:

npx prettier '**/*.{json,sol,md}' --write

Lint Solidity contracts:

npx solhint 'contracts/**/*.sol'

Automatically fix issues in Solidity contracts:

npx solhint 'contracts/**/*.sol' --fix

This 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.


๐Ÿค 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.

scw-contracts's People

Contributors

aboudjem avatar amanraj1608 avatar ankurdubey521 avatar biconomy avatar chirag018 avatar filmakarov avatar livingrockrises avatar proxima424 avatar sivo4kin avatar talhamalik883 avatar tomarsachin2271 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scw-contracts's Issues

Bug Report 2024-01-28

I'm opening this issue to report a bug, which I'm doing based on this:

If you've identified a bug that hasn't been reported, open a new Issue detailing the bug.

With this specific bug, it'd be better if the details aren't available for everyone to see, so can I send my writeup privately to the team somehow? I can do email or any other medium.

Wrong information in natspec

Module Manager: execTransactionFromModule does not emit module events

I noticed that in the module manager's execTransactionFromModule function, it directly uses the _execute function from the executor contract. However, this setup doesn't emit any of module events when a transaction succeeds or fails.

I'm wondering why we're not using the _executeFromModule function, like we do in the execBatchTransactionFromModule method, for consistency.

Checking initializer.length

Why does the SmartAccountFactory include a check for initializer.length > 0 in the deployAccount and deployCounterFactualAccount functions? Given that the initializer is not passed directly and is not optional. Under what circumstances would initializer.length be zero?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.