@primitivexyz/portfolio

1.3.0-beta • Public • Published

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

Primitive Portfolio

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

PRs Welcome Twitter Badge

Portfolio Security

Visit Primitive Security to view a comprehensive overview of the security initiatives of Portfolio.

System Invariants

The system is designed around a single invariant:

Actual balance of tokens in contract >= virtually tracked token balance in `__account__.reserves`.

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 Completed
Spearbit Extension 2-weeks Pending

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.

Package Sidebar

Install

npm i @primitivexyz/portfolio

Weekly Downloads

30

Version

1.3.0-beta

License

AGPL-3.0-only

Unpacked Size

954 kB

Total Files

22

Last publish

Collaborators

  • alexangelj