Skip to content

k3rn3lpanicc/The-Matrix

Repository files navigation

The-Matrix

Welcome to The-Matrix project! This repository contains a full-featured smart contract ecosystem built on the Hardhat framework.

Overview

The-Matrix project is designed to facilitate complex on-chain interactions with a suite of smart contracts and utilities. The ecosystem includes core contracts for token operations, various financial pools, vesting mechanisms, and comprehensive interface definitions. This repository exemplifies robust digital asset management using modern Solidity development practices, advanced testing setups, and integration with OpenZeppelin libraries.

Project Structure

The repository is structured into several key directories:

  • contracts/: Contains the Solidity source files. These include:

    • Core Contracts:
      • Matrix.sol: The central contract driving the ecosystem.
      • Pills.sol: Responsible for managing pill tokens or functionalities related to this metaphor.
      • Source.sol, StSource.sol: Additional contracts managing asset flow within the ecosystem.
      • Tracker.sol: Implements tracking functionality for various operations.
      • Vault.sol: Manages secure storage and access control of tokens.
      • vesting.sol: Implements vesting schedules and token lock mechanisms.
  • contracts/interfaces/: Contains interface definitions that ensure standardization and interoperability between contracts:

    • IBlast.sol, IPills.sol, ISource.sol, ITracker.sol
  • contracts/pools/: Contains pool contracts tailored for different financial strategies and reward distributions:

    • PillPool.sol, PrizePool.sol, SecondaryPrizePool.sol, SourcePool.sol, YieldPool.sol
  • scripts/: Contains deployment scripts (deploy.ts) and other automation scripts for deploying the contracts on Ethereum-compatible networks.

  • test/: Contains test suites written in TypeScript that interact with the smart contracts using Hardhat to validate functionality and resilience.

  • cache/: Used to store compiled Solidity cache files for faster recompilations.

  • typechain-types/: Contains TypeScript type definitions generated by TypeChain that facilitate Ethereum smart contract integration.

  • Other configuration files:

    • hardhat.config.ts: Hardhat configuration file.
    • tsconfig.json: TypeScript configuration file.
    • package.json: Project dependencies and scripts.

Detailed Explanations

Smart Contracts

The project incorporates several smart contracts written in Solidity that work together to form a cohesive ecosystem:

  • Matrix.sol: Acts as the central hub, orchestrating contract interactions and serving as the interface for external communications.

  • Pills.sol: Manages specialized tokens/metaphors associated with the project, potentially used for rewards or governance.

  • Source.sol & StSource.sol: Handle asset flow, ensuring secure and compliant management of resources.

  • Tracker.sol: Logs transactions and contract interactions to provide transparency and auditability.

  • Vault.sol: Implements secure storage and access controls for sensitive tokens and data.

  • vesting.sol: Distributes tokens gradually over time with vesting schedules to align long-term incentives.

Interfaces

Located in the contracts/interfaces/ directory, these Solidity interfaces ensure that contracts adhere to a standardized set of functions. They enhance interoperability and make it easier to manage contract dependencies.

Pools

The pool contracts in contracts/pools/ manage different financial strategies, including staking, prize distribution, and yield generation. Each pool contract caters to specific aspects of the ecosystem's financial operations:

  • PillPool.sol: Typically used for staking or incentivization mechanisms.

  • PrizePool.sol & SecondaryPrizePool.sol: Manage prize distributions and reward mechanisms.

  • SourcePool.sol & YieldPool.sol: Handle funding flows and yield generation for participants.

Scripts & Deployment

Deployment scripts, found in the scripts/ directory, are written in TypeScript and harness the capabilities of Hardhat. These scripts automate contract deployment, including initialization and post-deployment verifications.

Testing

The entire contract suite is rigorously tested using Hardhat and TypeScript. The tests, located in the test/ directory, cover unit tests, integration tests, and scenarios mimicking real-world blockchain interactions.

Development & Build Process

  1. Installation: Run npm install to install the dependencies.
  2. Compilation: Compile the contracts using npx hardhat compile.
  3. Testing: Execute tests via npx hardhat test.
  4. Deployment: Deploy the project using deployment scripts like npx hardhat run scripts/deploy.ts --network <your-network>.

Tools & Libraries

  • Hardhat: A comprehensive Ethereum development environment that simplifies the process of compiling, deploying, and testing smart contracts.
  • TypeChain: Generates TypeScript type definitions for Solidity contracts to ensure safer interactions between your contracts and TypeScript code.
  • OpenZeppelin: Provides reliable and community-reviewed smart contract modules, particularly for security-critical components.
  • TypeScript: Used extensively to enforce type safety in scripts and tests, enhancing productivity and maintainability.

Getting Started

To begin working with The-Matrix:

  1. Clone the repository:

    git clone https://github.com/k3rn3lpanicc/The-Matrix.git
    cd The-Matrix
  2. Install all dependencies:

    npm install
  3. Compile the contracts:

    npx hardhat compile
  4. Run tests to verify contract functionalities:

    npx hardhat test
  5. Deploy the contracts to your selected network:

    npx hardhat run scripts/deploy.ts --network <your-network>

Contribution Guidelines

We welcome contributions! To get started:

  1. Fork the repository.
  2. Create a new feature branch.
  3. Commit your improvements with clear messages.
  4. Open a Pull Request detailing your changes.

Acknowledgements

  • Hardhat for its extensive developer tooling.
  • TypeChain for bridging Solidity and TypeScript.
  • OpenZeppelin for secure, well-audited smart contracts.

For any further questions or issues, please refer to the detailed internal documentation or open an issue on GitHub.

About

The Matrix: A blockchain game with complex Tokenomics.

Resources

Stars

Watchers

Forks