# Ji Protocol Technical Specification

## Overview
Ji Protocol is a non-custodial, permissionless hedge fund managed by JI Ventures. The protocol allows investors to deposit funds that are tokenized. These tokens represent a pro-rata share of the underlying assets held by the fund.
## Core Contracts
### Share Manager
_Functionality:_
- Manages the minting and burning of share tokens for a portfolio contract.
- Inspired by Solmate's ERC4626 but customized for portfolios containing multiple assets.
_Key Responsibilities:_
mintShares: Mints new shares in exchange for a deposit into the portfolio contract.
burnShares: Burns shares and returns the pro-rata share of the underlying assets.
_Dependencies:_
Relies on the Portfolio Oracle for pricing data during minting and burning.
### Portfolio Oracle
_Functionality:_
- Holds reference to an oracle for each asset in the portfolio.
- Tracks the value of each asset in real-time.
- Calculates the current value of the portfolio.
_Key Responsibilities:_
- getAssetPrice: Returns the current price of an individual asset.
- getPortfolioValue: Returns the current value of the entire portfolio.
_Dependencies:_
- Integrated with external oracles for price feeds.
### Swap Contract
_Functionality:_
- Handles the swapping of portfolio assets into a stable coin upon user withdrawal.
- Batches asset swaps for efficiency.
- Routed for trades made by managers on the Portfolio Contract.
_Key Responsibilities:_
executeSwap: Swaps the underlying assets for a stable coin.
_Dependencies:_
Interacts with Portfolio Contract for authorized swaps.
### Portfolio Contract
_Functionality:_
- Smart contract that holds the portfolio's assets.
- Owned by a multisig.
- Has permissions for managers for asset swapping and trading limits.
_Key Responsibilities:_
addAsset: Adds an asset to the portfolio (via Share Manager only)
removeAsset: Removes an asset from the portfolio (via Share Manager only).
swapAssets: managers make trades (via Swap Contract only).
_Dependencies:_
Multisig for contract parametrization.
Swap Contract for asset swaps.
Multisig
### Multisig
_Functionality:_
- Solely controlled by JI Ventures.
- Parametrizes the contracts, manages oracles, and managers.
_Key Responsibilities:_
addOracle: Adds a new oracle for a specific asset.
removeOracle: Removes an existing oracle.
addManager: Adds a new portfolio manager.
removeManager: Removes an existing portfolio manager.
_Dependencies:_
None