# IFrictionlessTokensFactory

[Git Source](https://gitlab.com/dfyclabs/protocol/dfyclabs-tokens/blob/85f6dfa54ce0787eb1b1345bd6726f84fe766c54/contracts/interface/IFrictionlessTokensFactory.sol)

**Author:** DEFYCA Labs S.à.r.l

Copyright © 2023 DEFYCA Labs S.à.r.l Permission is hereby granted, free of charge, to any person obtaining a copy of the Frictionless protocol smart contracts (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DEFYCA LABS S.à.r.l BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Interface defining the token factory for all tokens in the Frictionless protocol.

## Functions

### setTreasuryManager

*Sets the Treasury Manager to be the specified address.*

```solidity
function setTreasuryManager(address newTreasuryManager_) external;
```

**Parameters**

| Name                  | Type      | Description                                                                                                                              |
| --------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `newTreasuryManager_` | `address` | the addresses of the treasury manager to set throws `FrictionlessTokensFactoryZeroAddress` if the newTreasuryManager\_ is a zero address |

### deployFundDepositToken

*Deploys the `FrictionlessFundDepositToken` contract as a proxy*

```solidity
function deployFundDepositToken(
    address tokenOwner_,
    BaseTokenInitParams calldata baseTokenInitParams_,
    IFrictionlessFundDepositToken.FFDImmutableData calldata initData_
) external returns (address tokenProxyAddr_);
```

**Parameters**

| Name                   | Type                                             | Description                                                    |
| ---------------------- | ------------------------------------------------ | -------------------------------------------------------------- |
| `tokenOwner_`          | `address`                                        | The owner of the deployed contract                             |
| `baseTokenInitParams_` | `BaseTokenInitParams`                            | the base contract data to deploy a Frictionless token contract |
| `initData_`            | `IFrictionlessFundDepositToken.FFDImmutableData` | the immutable data for the `FrictionlessFundDepositToken`      |

**Returns**

| Name              | Type      | Description                                                                                                                                                                                                                                                             |
| ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tokenProxyAddr_` | `address` | the address of the deployed token contract `FrictionlessFundDepositToken` throws `FrictionlessTokensFactoryNotATreasuryManager` if the msg.sender is not the treasury manager emits `FrictionlessTokenDeployed` event upon successful deployment of the token contract. |

### deployDigitalSecurityToken

*Deploys the `FrictionlessDigitalSecurityToken` contract as a proxy*

```solidity
function deployDigitalSecurityToken(
    address tokenOwner_,
    BaseTokenInitParams calldata baseTokenInitParams_,
    IFrictionlessDigitalSecurityToken.FDSImmutableData calldata initData_,
    IFrictionlessDigitalSecurityToken.FDSMutableData calldata updateData_
) external returns (address tokenProxyAddr_);
```

**Parameters**

| Name                   | Type                                                 | Description                                                    |
| ---------------------- | ---------------------------------------------------- | -------------------------------------------------------------- |
| `tokenOwner_`          | `address`                                            | The owner of the deployed contract                             |
| `baseTokenInitParams_` | `BaseTokenInitParams`                                | the base contract data to deploy a Frictionless token contract |
| `initData_`            | `IFrictionlessDigitalSecurityToken.FDSImmutableData` | the immutable data for the `FrictionlessDigitalSecurityToken`  |
| `updateData_`          | `IFrictionlessDigitalSecurityToken.FDSMutableData`   | the mutable data for the `FrictionlessDigitalSecurityToken`    |

**Returns**

| Name              | Type      | Description                                                                                                                                                                                                                                                                 |
| ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tokenProxyAddr_` | `address` | the address of the deployed token contract `FrictionlessDigitalSecurityToken` throws `FrictionlessTokensFactoryNotATreasuryManager` if the msg.sender is not the treasury manager emits `FrictionlessTokenDeployed` event upon successful deployment of the token contract. |

### deployOnChainAssetToken

*Deploys the `FrictionlessOnChainAssetToken` contract as a proxy*

```solidity
function deployOnChainAssetToken(
    address tokenOwner_,
    BaseTokenInitParams calldata baseTokenInitParams_,
    IFrictionlessOnChainAssetToken.FOCASpecData calldata specData_,
    IFrictionlessOnChainAssetToken.FOCAIssuanceData calldata issuanceData_,
    IFrictionlessOnChainAssetToken.FOCAUpdateData calldata updateData_
) external returns (address tokenProxyAddr_);
```

**Parameters**

| Name                   | Type                                              | Description                                                              |
| ---------------------- | ------------------------------------------------- | ------------------------------------------------------------------------ |
| `tokenOwner_`          | `address`                                         | The owner of the deployed contract                                       |
| `baseTokenInitParams_` | `BaseTokenInitParams`                             | the base contract data to deploy a Frictionless token contract           |
| `specData_`            | `IFrictionlessOnChainAssetToken.FOCASpecData`     | the immutable specification data for the `FrictionlessOnChainAssetToken` |
| `issuanceData_`        | `IFrictionlessOnChainAssetToken.FOCAIssuanceData` | the immutable issuance data for the `FrictionlessOnChainAssetToken`      |
| `updateData_`          | `IFrictionlessOnChainAssetToken.FOCAUpdateData`   | the mutable update data for the `FrictionlessOnChainAssetToken`          |

**Returns**

| Name              | Type      | Description                                                                                                                                                                                                                                                              |
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `tokenProxyAddr_` | `address` | the address of the deployed token contract `FrictionlessOnChainAssetToken` throws `FrictionlessTokensFactoryNotATreasuryManager` if the msg.sender is not the treasury manager emits `FrictionlessTokenDeployed` event upon successful deployment of the token contract. |

### treasuryManager

*returns the address of the treasuryManager*

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

**Returns**

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

### existingFrictionlessTokens

*Checks whether a given token address is an existing frictionless token*

```solidity
function existingFrictionlessTokens(address tokenAddr_) external view returns (bool);
```

**Parameters**

| Name         | Type      | Description                       |
| ------------ | --------- | --------------------------------- |
| `tokenAddr_` | `address` | the address of the token to check |

**Returns**

| Name     | Type   | Description                                                              |
| -------- | ------ | ------------------------------------------------------------------------ |
| `<none>` | `bool` | A boolean indicating whether the token is an existing frictionless token |

## Events

### FrictionlessTokenDeployed

*Event emitted upon successful deployment of a compliance contract.*

```solidity
event FrictionlessTokenDeployed(
    IBasicFrictionlessToken.FrictionlessTokenTypes indexed tokenType, address newTokenContract
);
```

## Errors

### FrictionlessTokensFactoryZeroAddress

*error thrown if an attempt to set a zero address contract during function `setTreasuryManager`*

```solidity
error FrictionlessTokensFactoryZeroAddress();
```

### FrictionlessTokensFactoryNotATreasuryManager

*error thrown if the `msg.sender` is not the treasury manager during the functions `deployFundDepositToken`, `deployDigitalSecurityToken`, or `deployOnChainAssetToken`*

```solidity
error FrictionlessTokensFactoryNotATreasuryManager(address);
```

## Structs

### BaseTokenInitParams

*Struct to represent the base contract data to deploy a Frictionless token contract.*

```solidity
struct BaseTokenInitParams {
    address implementationAuthority;
    address identityRegistry;
    address compliance;
    address onChainId;
    string tokenName;
    string tokenSymbol;
}
```
