0.0.2 • Published 10 months ago

diamond-ledger-core-contracts v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

DiamondLedger Project

Welcome to the DiamondLedger project! This project implements a highly modular smart contract wallet utilizing the ERC-4337 and ERC-2535 standards. The key components of this project are the DiamondLedger, DiamondLedgerFactory, and SmartContractWalletFacet contracts.

Table of Contents

Introduction

The DiamondLedger project aims to create a customizable and extensible smart contract wallet. By leveraging the ERC-4337 and ERC-2535 standards, this project provides a flexible architecture that allows users to tailor their wallet's functionality according to their needs.

Standards

  • ERC-4337: This standard introduces account abstraction, enabling the creation of smart contract wallets with enhanced capabilities.
  • ERC-2535: Known as the Diamond Standard, it allows for modular smart contracts where functionalities can be added or removed by integrating or removing facets.

Contracts

DiamondLedger

The DiamondLedger contract is the core of the wallet system. It implements the Diamond Standard (ERC-2535) to allow modularity and uses ERC-4337 for account abstraction.

DiamondLedgerFactory

The DiamondLedgerFactory contract is responsible for creating instances of the DiamondLedger. It uses the Create2 opcode for deterministic address generation, ensuring that the same wallet can be recreated with the same parameters.

SmartContractWalletFacet

The SmartContractWalletFacet contract provides the core functionalities of the wallet. It includes functions for executing transactions, batch operations, and more. This facet can be extended or replaced to add new features to the wallet.

Installation

To get started with the DiamondLedger project, you'll need to have Node.js and Hardhat installed.

  1. Clone the repository:

    git clone https://github.com/your-repo/diamondledger.git
    cd diamondledger
  2. Install the dependencies:

    npm install

Usage

You can interact with the DiamondLedger contracts using Hardhat. Below are some basic commands:

  • Compile the contracts:

    npx hardhat compile
  • Deploy the contracts:

    npx hardhat run scripts/deploy.js
  • Run tests:

    npx hardhat test

Deployment

To deploy the DiamondLedger contracts, follow these steps:

  1. Update the deployment script scripts/deploy.js with the necessary parameters.

  2. Run the deployment script:

    npx hardhat run scripts/deploy.js --network <network-name>

Replace <network-name> with the name of the network you want to deploy to (e.g., localhost, rinkeby, mainnet).

Testing

The project includes a suite of tests to ensure the functionality of the contracts. To run the tests, execute:

npx hardhat test

The tests are located in the test directory and cover various scenarios for the DiamondLedger, DiamondLedgerFactory, and SmartContractWalletFacet contracts.

Contributing

We welcome contributions to the DiamondLedger project! If you have suggestions for improvements or find any issues, please feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Thank you for using the DiamondLedger project! If you have any questions or need further assistance, please don't hesitate to reach out.