> For the complete documentation index, see [llms.txt](https://docs.libertum.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.libertum.io/developers/contracts/security-token/isecuritytokenfactory.sol.md).

# ISecurityTokenFactory.sol

## ISecurityTokenFactory

[Git Source](https://github.com/Libertum-Project/security-token-contracts/blob/3464d5ab8850f3f8fc835299f95703c8793378ae/src\token\factory\ISecurityTokenFactory.sol)

Interface for the SecurityTokenFactory contract

*Defines the structure for deploying and managing SecurityToken instances*

### Functions

#### initialize

Initializes the SecurityTokenFactory

*Sets up initial roles and deploys the UpgradeableBeacon*

```solidity
function initialize(address initialAuthority, address initialImplementation) external;
```

**Parameters**

| Name                    | Type      | Description                                                  |
| ----------------------- | --------- | ------------------------------------------------------------ |
| `initialAuthority`      | `address` | Address of the initial admin                                 |
| `initialImplementation` | `address` | Address of the initial SecurityToken implementation contract |

#### getDeploymentAddress

Returns the deterministic deployment address for a given id

```solidity
function getDeploymentAddress(bytes32 id) external view returns (address);
```

**Parameters**

| Name | Type      | Description                          |
| ---- | --------- | ------------------------------------ |
| `id` | `bytes32` | Unique identifier for the deployment |

**Returns**

| Name     | Type      | Description                                                    |
| -------- | --------- | -------------------------------------------------------------- |
| `<none>` | `address` | The computed address where the SecurityToken would be deployed |

#### deploy

Deploys a new SecurityToken instance

*Uses Create2 for deterministic address generation*

```solidity
function deploy(bytes32 id, bytes calldata initData) external returns (address deployment);
```

**Parameters**

| Name       | Type      | Description                                            |
| ---------- | --------- | ------------------------------------------------------ |
| `id`       | `bytes32` | Unique identifier for the deployment                   |
| `initData` | `bytes`   | Initialization data for the new SecurityToken instance |

**Returns**

| Name         | Type      | Description                                          |
| ------------ | --------- | ---------------------------------------------------- |
| `deployment` | `address` | Address of the newly deployed SecurityToken instance |

#### upgradeImplementation

Upgrades the implementation of all deployed SecurityToken instances

*Can only be called by addresses with the UPGRADE\_ROLE*

```solidity
function upgradeImplementation(address newImplementation) external;
```

**Parameters**

| Name                | Type      | Description                                |
| ------------------- | --------- | ------------------------------------------ |
| `newImplementation` | `address` | Address of the new implementation contract |

#### beacon

Returns the address of the SecurityTokenBeacon

```solidity
function beacon() external view returns (address);
```

**Returns**

| Name     | Type      | Description                        |
| -------- | --------- | ---------------------------------- |
| `<none>` | `address` | Address of the SecurityTokenBeacon |

#### implementation

Returns the address of the current SecurityToken implementation

```solidity
function implementation() external view returns (address);
```

**Returns**

| Name     | Type      | Description                           |
| -------- | --------- | ------------------------------------- |
| `<none>` | `address` | Address of the current implementation |

### Events

#### SecurityTokenDeployed

Emitted when a new SecurityToken is deployed

```solidity
event SecurityTokenDeployed(address indexed token);
```

**Parameters**

| Name    | Type      | Description                                 |
| ------- | --------- | ------------------------------------------- |
| `token` | `address` | Address of the newly deployed SecurityToken |

#### ImplementationUpgraded

Emitted when the implementation is upgraded

```solidity
event ImplementationUpgraded(address indexed oldImplementation, address indexed newImplementation);
```

**Parameters**

| Name                | Type      | Description                            |
| ------------------- | --------- | -------------------------------------- |
| `oldImplementation` | `address` | Address of the previous implementation |
| `newImplementation` | `address` | Address of the new implementation      |
