Skip to content

consensusnetworks/casimir

Repository files navigation

Casimir logo

Casimir

GitHub discussions GitHub issues GitHub milestones Discord

Decentralized staking and asset management

About

Casimir is a complete platform that allows users to monitor, move, and stake their assets while holding their own keys. With Casimir staking, users can easily and securely move funds in and out of decentralized staking pools that are operated by high-performing validators.

Development

Get started contributing to Casimir's codebase.

Prerequisites

Configure the following prerequisite global dependency versions:

  1. Git (v2.x).

    🚩 GitHub submodule support: You also need to make sure to have at least one SSH authentication key on your GitHub account (for the git cloning of submodules within submodules). See Adding a new SSH key to your GitHub account.

  2. Docker (v24.x).

  3. Go (v1.20.x).

  4. Node.js (LTS).

    🚩 Using NVM: Install NVM and run nvm install --lts && nvm alias default lts/* to set the default version to the latest LTS. You will need to rerun this command whenever the latest LTS changes.

  5. AWS CLI (v2.x).

    🚩 Consensus Networks team only: Create an AWS profile named consensus-networks-dev.

Setup

Clone the repository and checkout a new branch from develop:

git clone https://github.com/consensusnetworks/casimir.git
cd casimir
git checkout -b <"feature || bug || enhancement">/<"your-branch-name" develop

We are using npm workspaces to simplify monorepo development workflows while keeping project-wide resources accessible. The core commands are below.

Install all repository dependencies and build necessary types:

npm install

Clean all repository dependencies and reinstall:

npm run clean

Install a dev dependency to the root:

npm install -D some-dev-dependency

Install a dependency or dev dependency to a specific workspace:

# dependency
npm install some-dependency --workspace @casimir/<"workspace-name">

# dev dependency
npm install -D some-dev-dependency --workspace @casimir/<"workspace-name">

Configure

Customize and override the development environment configuration by creating a .env file in the root directory.

If you are on the Consensus Networks organization, make sure your AWS CLI and profile are configured correctly. By default, the scripts look for the consensus-networks-dev named profile, but you can override the AWS_PROFILE name to be used in the .env file. Optionally, override the AWS_PROFILE name in your .env file:

# From the root directory
echo "AWS_PROFILE=<"your-aws-profile-name">" > .env

If you are outside of the Consensus Networks organization, set USE_SECRETS to false in your .env file:

# From the root directory
echo "USE_SECRETS=false" > .env

Environment Variables

Name Description Default
USE_SECRETS Whether to use AWS secrets (set false for external access) true
AWS_PROFILE AWS profile name for accessing secrets consensus-networks-dev
PROJECT Project name casimir
STAGE Environment stage name (`prod
ETHEREUM_FORK_BLOCK Starting block number for local fork network (current block)
ETHEREUM_RPC_URL Ethereum RPC network URL http://127.0.0.1:8545
NETWORK Network name (`mainnet
FORK Fork network name (`mainnet
FACTORY_ADDRESS Base factory contract address (predicted factory address)
CRYPTO_COMPARE_API_KEY CryptoCompare API key ``
TUNNEL Whether to tunnel local network RPC URLs (for remote wallets) false
MOCK_SERVICES Whether to mock backend services true
BUILD_PREVIEW Whether to preview web app production build false

Apps

The apps packages provide a UI to end-users.

@casimir/app

Run the main web app with an integrated development environment, including local contracts and services:

# From the root directory
npm run dev

See the @casimir/app README.md for detailed documentation.

@casimir/www

Run the landing page app:

# From the root directory
npm run dev:www

See the @casimir/www README.md for detailed documentation.

Contracts

The contracts packages provide the smart contracts for the project.

@casimir/ethereum

Test the Ethereum contracts:

# From the root directory
npm run test --workspace @casimir/ethereum

See the @casimir/ethereum README.md for detailed documentation.

Common

The common packages provide shared code for the project:

Check for a README.md file in each common package directory for detailed usage instructions.

Infrastructure

The infrastructure packages provide the infrastructure as code for the project.

@casimir/cdk

Test the CDK infrastructure:

# From the root directory
npm run test:cdk

See the @casimir/cdk README.md for detailed documentation.

Services

The services packages provide the backend services for the project:

Layout

Code is organized into work directories (apps, common, contracts, infrastructure, services, scripts, and more listed below).

β”œβ”€β”€ .github/ (workflows and issue templates)
|   └── workflows/ (gh actions workflows)
β”œβ”€β”€ apps/ (frontend apps)
|   |── www/ (landing page app)
|   └── app/ (main web app)
β”œβ”€β”€ common/ (shared code)
|   β”œβ”€β”€ data/ (data schemas and operational workflows)
|   └── helpers/ (general utilities)
β”œβ”€β”€ contracts/ (blockchain contracts)
|   └── ethereum/ (ethereum contracts)
β”œβ”€β”€ infrastructure/ (deployment resources)
|   └── cdk/ (aws stacks)
β”œβ”€β”€ scripts/ (devops and build scripts)
|   β”œβ”€β”€ ethereum/ (ethereum test and dev scripts)
|   └── root/ (root install and dev scripts)
β”œβ”€β”€ services/ (backend services)
|   β”œβ”€β”€ oracle/ (oracle service)
|   └── users/ (users service)
└── package.json (project-wide npm dependencies and scripts)

License

This respository is available as open source under the terms of the Apache License.

License: Apache