npm package: @majora-finance/core
Description: This repository contains a collection of contracts for managing Majoraies and related operations within a decentralized finance (DeFi) ecosystem. These contracts facilitate various functionalities such as Strategy vault creation, asset buffering, operator
Latest version: 1.0.3

# Majora Core Contracts

This repository contains a collection of contracts for managing Majoraies and related operations within a decentralized finance (DeFi) ecosystem. These contracts facilitate various functionalities such as Strategy vault creation, asset buffering, operator proxy, block registry, and more. Below is an overview of each contract:

## Contracts

### MajoraVaultFactory

The `MajoraVaultFactory` contract is responsible for creating new Strategy vaults. It allows users to deploy vault contracts with specified parameters such as name, symbol, underlying asset, Strategy, fees, and more. The factory also provides functions for upgrading the vault and ERC3525 implementations, executing emergency operations, setting protocol fees, and retrieving information about owned vaults.

### MajoraVaultManagement

The `MajoraVaultManagement` contract serves as a middleware between users and the actual Strategy vaults. It handles access control and deposit limits based on the defined middleware Strategy. The contract implements various Majoraies, including public access, whitelisted addresses, and holder requirements. It also supports timelock restrictions and deposit limits for both users and the vault.

### MajoraOperatorProxy

The `MajoraOperatorProxy` contract acts as a proxy for executing operations on behalf of the operator. It enables the operator to perform actions such as vault harvesting, rebalancing, withdrawal rebalancing, and fee withdrawals. Only users with the `OPERATOR_ROLE` can access these functionalities.

### MajoraBlockRegistry

The `MajoraBlockRegistry` contract allows the registration and removal of Strategy blocks. Blocks represent different Majoraies used within the ecosystem. The contract maintains a mapping of block addresses to their corresponding metadata, including the deployer, name, and IPFS hash. The registry enforces access control based on ownership or deployer role.

### MajoraAssetBuffer

The `MajoraAssetBuffer` contract provides a minimalistic mutualized buffer for Strategy vaults. Users can deposit assets into the buffer, which temporarily holds the assets outside the vault Majoraies accounting. This allows for easier asset management and flexibility within the ecosystem.

## Usage

To use these contracts, you can deploy them individually or as part of a larger DeFi system. Each contract has specific functions and access control roles to manage various operations and configurations. You can interact with the contracts using the appropriate Ethereum wallet or smart contract interaction tool.

Please refer to the individual contract source code and associated documentation for detailed information on the functions, events, and usage instructions.

## Development

To contribute or make changes to these contracts, follow these steps:

1. Clone the repository:

   ```
   git clone https://gitlab.com/murphy-labs/Majora-protocol/contracts/core.git
   ```

2. Install the necessary dependencies:

   ```
   npm install --force
   ```

   The --force is mandatory because there is a package version conflict with hardhat-deploy but everything is working fine.
   There is no solution until we migrate on ethers v6

3. Make the desired changes to the contract files.

4. Compile the contracts:

   ```
   npx hardhat compile
   ```

5. Run the tests to ensure everything is working as expected:

   ```
   npx hardhat test
   ```

6. Submit a pull request with your changes for review.

## License

This project is licensed under the [BUSL-1.1](https://spdx.org/licenses/BUSL-1.1.html) license. Please refer to the individual contract files for their specific license information.

## Disclaimer

These contracts are provided as-is without any warranty or guarantee of any kind. Use them at your own risk. Always review and audit the code before deploying it in a production environment.