ts0yu / portfolio

On-chain portfolio protocol for risk and liquidity management.

Home Page:https://www.primitive.xyz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Beta: Not production ready. Pending on-going audits.

Primitive Portfolio

On-chain portfolio management. Optimized for managing risk and liquidity.

PRs Welcome Twitter Badge

Yellow Paper

A technical summary of Portfolio is detailed in the Yellow Paper.

System Invariants

The system is designed around a single invariant:

Balance >= Reserve

Exposed via: Portfolio.getNetBalance(token)

For more invariants, read this.

Portfolio Manual

Clone

git clone https://github.com/primitivefinance/portfolio.git

Installation

Required:

  • Foundry
  • Python (if running echidna)

1. Install foundry. source

curl -L https://foundry.paradigm.xyz | bash

2. Restart terminal or reload PATH, then run:

foundryup

3. Install deps

forge install

4. Test

forge test --match-contract TestRMM01

Resources

Audits

Security Firm Review Time Status
ChainSecurity 8-weeks Completed
Trail of Bits 8-weeks Completed
Spearbit 5-weeks Scheduled

Contributing

Important:

  • This codebase uses the FORGE formatter. This is not prettier. If you have not already, make sure if you use vs code that the formatOnSaveconfig variable uses forge fmt instead of prettier.
  • Setup the proper settings using this guide: forge fmt for formatOnSave vscode.

When making a pull request:

  • All tests pass.
  • Code coverage does not change.
  • Code follows the style guide:
    • Follows Primitive styling rules.
    • Run forge fmt.
    • Code is thoroughly commented with natspec where relevant.
  • If making a change to the contracts:
    • Gas snapshots are provided and demonstrate an improvement (or an acceptable deficit given other improvements).
    • New tests for all new features or code paths.
  • If making a modification to third-party dependencies, yarn audit passes.
  • A descriptive summary of the PR has been provided.

About

On-chain portfolio protocol for risk and liquidity management.

https://www.primitive.xyz/

License:GNU Affero General Public License v3.0


Languages

Language:Solidity 99.7%Language:JavaScript 0.3%Language:Shell 0.0%