# Ji Protocol Technical Specification ![label](http://cdn-0.plantuml.com/plantuml/png/RP51Ry8m38Nl-HKHf-r03pjE4sBYi1CQ4e9xQDqIaJeeJiQcQVzzhWKqZRZLpv-VNzmbHHDYwfso626qfWQzFPe0QuEcWw1_bTOzzqIafsSk3odWhTHQ_QbiTkD3RBsp_ZEOse6CTn3VYI1kWgs17KIvWtlZ4gk5p_PYpYkFaLsYcC0tr2d2eBF5uvq2cgQHRR8eGE-_OAo9nwLw47sTNBHakvkBl00ocqpWzlL0MNzKs7T747HLBIRNVDMpG_hHqPy0QQRobfxF5vDNCqlWt0XdFO673ILKd5y2h8x6ehDuOlWy_0BT0ZI5ev0xjCJQ_eN9uICt5E03FLdQcXQOy1U4G4TxBXxoLbMwo77TRB4h8y8Kpy4otaYDyUx_hEpNmw1tCxK4R5Bl_W40) ## 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