@primitivexyz/portfolio
v1.3.0-beta
Published
Onchain protocol for low cost portfolio management using automated market making strategies.
Downloads
4
Maintainers
Readme
Beta: Not production ready. Pending on-going audits.
Primitive Portfolio
On-chain portfolio management. Optimized for managing risk and liquidity.
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
- Portfolio Yellow Paper (Deprecated)
- RMM in desmos
- Original codebase
- solstat
- Replicating Market Makers
- RMM whitepaper
- High precision calculator
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
formatOnSave
config 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.