Skip to content

primex-finance/primex-protocol

Repository files navigation

Primex Finance protocol

This repository contains the smart contracts source code and configuration files for the Primex Finance protocol. The repository uses Hardhat as a development environment for compilation, testing and deployment.

What is Primex?

Primex Finance is a non-custodial prime brokerage protocol that connects lenders with traders, enabling traders to utilize lender liquidity for leveraged spot trading on existing DEXs like Uniswap, Balancer, Curve, and more. On Primex, traders can also benefit from CEX-like trader tooling and interfaces.

Documentation and useful links

  1. Litepaper
  2. Whitepaper
  3. Yellowpaper
  4. Tokenomics
  5. Guides
  6. Technical documentation
  7. Twitter
  8. Discord

Audits

Audited by Halborn, Quantstamp, Resonance Security.

You can find all audit reports in the audits repository.

Prerequisites

  • node.js v18
  • yarn

Setup

cd src
yarn install

Some scripts may require additional environment variables. You can install them by adding a .env file to the ./src folder (see env.template).

Setup account

Hardhat default generated accounts are used for testing and deployment to the localhost.

Add a .env file to the ./src folder (see env.template)

By geth keystore:

KEYSTORE_DIR=<PATH_TO_YOUR_KEYSTORE_DIR>
ADDRESS=<KEY_PUB_ADDRESS>
PASSWORD=<PASSWORD>

By private key:

PRIVATE_KEY=<PRIVATE_KEY>

Configuration

Setup for development

Tests

Run tests:

cd src
yarn test

Run coverage:

COVERAGE=true

cd src
yarn hardhat coverage

Deployment

Docs:

Deployment on localhost:

cd src
yarn hardhat node --no-deploy
yarn hardhat deployFull:devnode1 --network localhost

Deployment on live networks:

cd src

# Network list you can find in the instruction (./docs/developmentSetup.md)
yarn hardhat deployCore --network <network_name>

Deployment on custom networks:

Default config:

HOST_ADDR=<rpc_endpoint>

cd src
yarn hardhat deployFull:devnode1 --network host

Custom config: Env contracts setup tasks

HOST_ADDR=<rpc_endpoint>

cd src

# Deploy env contracts
yarn hardhat setup:deployEnv --network host [--flags ...]

# Deploy core and testnet services
yarn hardhat deployCoreAndTestnetServices --network host

Phase switching deployment

The Primex protocol will be deployed in phases. Each phase has a separate task. Tasks can be found here

First phase:

HOST_ADDR=<rpc_endpoint>

cd src
yarn hardhat setup:phase-1 --network <network_name>

Project contributing

When working on a project, you must adhere to the development rules described below. All of these rules are necessary to improve the development experience.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published