Skip to content

tribeshq/tribes

Repository files navigation



A Linux-powered EVM rollup as a Debit Capital Market
Tokenized debt issuance through reverse auction mechanism with collateralization

license last-commit

Table of Contents

Getting Started

Prerequisites

  1. Install Docker Desktop for your operating system;

    To install Docker RISC-V support without using Docker Desktop, run the following command:

    docker run --privileged --rm tonistiigi/binfmt --install all
  2. Download and install the latest version of Node.js;

  3. Cartesi CLI is an easy-to-use tool to build and deploy your dApps on devnet. To install it, run:

    npm install -g @cartesi/cli
  4. Install Foundry for smart contract development and testing;

  5. Install Go (version 1.24.4 or later) for backend development;

Environment

  1. Create the environment variables file:

    make env
  2. Edit the .env file with your configuration values.

  3. Import your private key for contract deployment:

    cast wallet import defaultKey --interactive

    This will prompt you to enter your private key securely for contract deployment operations.

Running

Contracts

The contract suite features emergency delegate call operations for secure asset recovery in critical situations. The system also includes asset contracts comprising a Stablecoin and Collateral token for the debt capital market operations, and ERC1155 Badge contracts for managing badges.

Each deployment script saves its configuration to individual JSON files in the ./contracts/deployments/ directory for easy reference and integration.

  1. Deploy all contracts:

    make deploy-contracts
  2. Deploy individual contracts:

    # Deploy BadgeFactory contract (ERC1155 Badge factory)
    make deploy-badge-factory
    
    # Deploy Tokens (Collateral and Stablecoin)
    make deploy-tokens
    
    # Deploy Emergency contracts (EmergencyWithdraw)
    make deploy-emergency
    
    # Deploy SafeERC1155Mint contract (Safe ERC1155 minting)
    make deploy-safe-erc1155-mint
  3. Simulate deployment (without broadcasting):

    make deploy-contracts-simulate

    This is useful for testing deployment scripts and verifying gas costs without actually deploying contracts.

Backend

The backend is built on Cartesi Rollups, a Layer 2 scaling solution that combines the security of blockchain with the computational power of Linux. This architecture enables complex off-chain computations while maintaining cryptographic guarantees of correctness and data availability. The system runs a full Linux environment inside the blockchain, handling business logic off-chain for better performance while keeping all computations verifiable on-chain.

  1. Generate bytecode and Go bindings

    make generate
  2. Devnet

    2.1 Build application:

    make build

    2.2 Run application on devnet:

    cartesi run

Testing

Run all tests (Contracts + Backend):

make test

This command will:

  • Clean and test smart contracts with Foundry;
  • Run mock tests with Go;
  • Run integration tests with Vitest;

Development

Code Quality

  1. Format all code (Contracts + Backend):

    make fmt
  2. View test coverage report:

    make coverage

Utility Commands

  1. Check contract sizes:

    make size

    Shows the size of all compiled contracts to ensure they fit within deployment limits.

  2. Run gas reports:

    make gas

    Generates detailed gas usage reports for all contract functions during testing.

Available Make Commands

For a complete list of available commands:

make help

This will show all available make targets with their descriptions.

About

An EVM Linux-powered rollup as a Debit Capital Market

Resources

License

Stars

Watchers

Forks

Packages

No packages published