# EquityFinancingModule

[Git Source](https://github.com/EntreDevelopers-Lab-Inc/Mezz-Companies/blob/f7a3e84e3dd5bb33c4bd7f77283983f9e8ba20b2/src/core/modules/equity-financing/EquityFinancingModule.sol)

**Inherits:** MezzUpgradeableModule, IEquityFinancingModule

**Author:** Daniel Yamagata

A module that manages the equity financing of a company. Priced rounds are indexed at one

*The initial version of Mezzanine only enables a Treasury to have the equity financing module as a child. Future versions may support departments having their own equity financing modules. Additionally, other forms of equity financing will be added via upgrades*

## State Variables

### EquityFinancingModuleStorageLocation

```solidity
bytes32 private constant EquityFinancingModuleStorageLocation =
    0xd961ff105dce6f539fbf0ae0958698eac72f58f46f1375706a8de3e60e2e2f00;
```

## Functions

### \_getEquityFinancingModuleStorage

```solidity
function _getEquityFinancingModuleStorage() internal pure returns (EquityFinancingModuleStorage storage $);
```

### constructor

```solidity
constructor(address _mezzHub, address _mezzMigrator) MezzUpgradeableModule(_mezzHub, _mezzMigrator);
```

### init

Initializes the state of the module. This initialization is bespoke to each module

```solidity
function init(address initTeam, bytes memory) external virtual override(Module, IModule) initializer;
```

**Parameters**

| Name       | Type      | Description                       |
| ---------- | --------- | --------------------------------- |
| `initTeam` | `address` | The team that controls the module |
| `<none>`   | `bytes`   |                                   |

### \_\_EquityFinancingModule\_init

```solidity
function __EquityFinancingModule_init(address initTeam) internal virtual onlyInitializing;
```

### currentRoundIndex

If there are no priced rounds, returns 0. Otherwise, returns the current round's index

*'initTeam' must be a department or treasury*

```solidity
function currentRoundIndex() public view returns (uint256);
```

### openPricedRound

Opens a Priced Round for the treasury of 'team' and returns the address of the new priced round

*Only callable by the 'team' or its ancestor(s)*

```solidity
function openPricedRound(DataTypes.PricedRoundInitArgs memory initArgs, address shares)
    external
    virtual
    onlyTeamOrAncestor
    pausable
    returns (address);
```

**Parameters**

| Name       | Type                            | Description                                                                                  |
| ---------- | ------------------------------- | -------------------------------------------------------------------------------------------- |
| `initArgs` | `DataTypes.PricedRoundInitArgs` | The arguments to initialize the priced round with. Validated within the priced round, itself |
| `shares`   | `address`                       | The shares to be distributed in the priced round                                             |

### getPricedRounds

Cache

```solidity
function getPricedRounds() public view virtual returns (address[] memory);
```

### getPricedRoundByIndex

If the priced round with 'roundIndex' does not exist, returns address(0). Otherwise, returns the address of the priced round with 'roundIndex'

```solidity
function getPricedRoundByIndex(uint256 roundIndex) public view virtual returns (address);
```

### coreId

Returns the coreId of the implementation as a bytes32

*The core ID is the keccak256 hash of the contract name followed by a version under the following syntax: "mezzanine.coreId.ContractName.vX" For example, the core ID of the 2nd version of the Treasury would be the following: keccak256(abi.encodePacked("mezzanine.coreId.Treasury.v2"))*

```solidity
function coreId() public pure virtual override(Credentialed, ICredentialed) returns (bytes32);
```

### version

Returns the version of the implementation as a uint256

```solidity
function version() public pure virtual override(Credentialed, ICredentialed) returns (uint256);
```

### \_updateStateForCanceledRound

*Deletes a canceled priced round from the '\_pricedRoundByIndex' mapping and decrements the '\_nextPricedRoundIndex'*

```solidity
function _updateStateForCanceledRound(uint256 currentRoundIndexCache) internal;
```

### \_incrementCurrentRoundIndex

*Increments the '\_currentRoundIndex' and returns the new value*

```solidity
function _incrementCurrentRoundIndex() internal returns (uint256);
```

### \_decrementCurrentRoundIndex

*Decrements the '\_currentRoundIndex' and returns the new value*

```solidity
function _decrementCurrentRoundIndex() internal returns (uint256);
```

### \_isTeamDepartment

*Returns true if 'teamCache' supports the Department Interface, false otherwise*

```solidity
function _isTeamDepartment(address teamCache) internal view returns (bool);
```

### \_isTeamTreasury

*Returns true if 'teamCache' supports the Treasury Interface, false otherwise*

```solidity
function _isTeamTreasury(address teamCache) internal view returns (bool);
```

### supportsInterface

*ERC165 support*

```solidity
function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(MezzUpgradeableModule, IERC165)
    returns (bool);
```

## Structs

### EquityFinancingModuleStorage

```solidity
struct EquityFinancingModuleStorage {
    uint256 _currentRoundIndex;
    mapping(uint256 => address) _pricedRoundByIndex;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mezzanine.xyz/smart-contracts/source-code/core/module/equityfinancingmodule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
