# IFrictionlessComplianceFactory

[Git Source](https://gitlab.com/dfyclabs/protocol/dfyclabs-tokens/blob/85f6dfa54ce0787eb1b1345bd6726f84fe766c54/contracts/interface/IFrictionlessComplianceFactory.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 upgradeable compliance 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 address of the treasury manager to set throws `FrictionlessComplianceFactoryZeroAddress` if the newTreasuryManager\_ is a zero address |

### updateModularComplianceImpl

*Updates and upgrades the modular compliance implementation*

```solidity
function updateModularComplianceImpl(address newModularComplianceImpl_) external;
```

**Parameters**

| Name                        | Type      | Description                                          |
| --------------------------- | --------- | ---------------------------------------------------- |
| `newModularComplianceImpl_` | `address` | the address of the modular compliance implementation |

### updateSupportedComplianceData

*Updates the set of supported modular compliance modules.*

```solidity
function updateSupportedComplianceData(UpdateSupportedComplianceData[] calldata updateSupportedComplianceDataArr_)
    external;
```

**Parameters**

| Name                                | Type                              | Description                                      |
| ----------------------------------- | --------------------------------- | ------------------------------------------------ |
| `updateSupportedComplianceDataArr_` | `UpdateSupportedComplianceData[]` | the set of supported modular compliance modules. |

### updateModularComplianceData

*Updates the modular compliance data.*

```solidity
function updateModularComplianceData(UpdateModularComplianceData[] calldata updateModularComplianceDataArr_) external;
```

**Parameters**

| Name                              | Type                            | Description                  |
| --------------------------------- | ------------------------------- | ---------------------------- |
| `updateModularComplianceDataArr_` | `UpdateModularComplianceData[]` | the modular compliance data. |

### deployCompliance

*Deploys the compliance contract using the ProxyBeacon with the associated FrictionlessPermissionsManager contract*

```solidity
function deployCompliance(IBasicFrictionlessToken.FrictionlessTokenTypes tokenType_) external returns (address);
```

**Parameters**

| Name         | Type                                             | Description                                                                                |
| ------------ | ------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| `tokenType_` | `IBasicFrictionlessToken.FrictionlessTokenTypes` | The Frictionless token type as defined by `IBasicFrictionlessToken.FrictionlessTokenTypes` |

**Returns**

| Name     | Type      | Description                                                                                                                                                                                                                                                                                         |
| -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<none>` | `address` | the address of the deployed compliance contract for the specified Frictionless token type throws `FrictionlessComplianceFactoryNotATreasuryManager` if the msg.sender is not the treasury manager emits FrictionlessComplianceDeployed event upon successful deployment of the compliance 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 |

### modularComplianceBeacon

*returns the ProxyBeacon of the ModularCompliance*

```solidity
function modularComplianceBeacon() external view returns (ProxyBeacon);
```

**Returns**

| Name     | Type          | Description                              |
| -------- | ------------- | ---------------------------------------- |
| `<none>` | `ProxyBeacon` | the ProxyBeacon of the ModularCompliance |

### getModularComplianceImpl

*returns the address of the ModularCompliance*

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

**Returns**

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

### getModularComplianceTokenType

*returns the `FrictionlessTokenTypes` which is bound by the ModularCompliance*

```solidity
function getModularComplianceTokenType(address modularComplianceAddr_)
    external
    view
    returns (IBasicFrictionlessToken.FrictionlessTokenTypes);
```

**Parameters**

| Name                     | Type      | Description                              |
| ------------------------ | --------- | ---------------------------------------- |
| `modularComplianceAddr_` | `address` | the address of the ModularComplianceImpl |

**Returns**

| Name     | Type                                             | Description                          |
| -------- | ------------------------------------------------ | ------------------------------------ |
| `<none>` | `IBasicFrictionlessToken.FrictionlessTokenTypes` | the address of the ModularCompliance |

### getSupportedComplianceModulesCount

*returns the amount of supported compliances ModularCompliance for the specified tokenType\_*

```solidity
function getSupportedComplianceModulesCount(IBasicFrictionlessToken.FrictionlessTokenTypes tokenType_)
    external
    view
    returns (uint256);
```

**Parameters**

| Name         | Type                                             | Description                                                                                          |
| ------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
| `tokenType_` | `IBasicFrictionlessToken.FrictionlessTokenTypes` | the type of token as defined by the `IBasicFrictionlessToken.FrictionlessTokenTypes` enumerated type |

**Returns**

| Name     | Type      | Description                         |
| -------- | --------- | ----------------------------------- |
| `<none>` | `uint256` | the amount of supported compliances |

### getSupportedComplianceModules

*returns the array of supported compliances ModularCompliance for the specified tokenType\_*

```solidity
function getSupportedComplianceModules(IBasicFrictionlessToken.FrictionlessTokenTypes tokenType_)
    external
    view
    returns (address[] memory);
```

**Parameters**

| Name         | Type                                             | Description                                                                                          |
| ------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
| `tokenType_` | `IBasicFrictionlessToken.FrictionlessTokenTypes` | the type of token as defined by the `IBasicFrictionlessToken.FrictionlessTokenTypes` enumerated type |

**Returns**

| Name     | Type        | Description                        |
| -------- | ----------- | ---------------------------------- |
| `<none>` | `address[]` | the array of supported compliances |

### getSupportedComplianceInfo

```solidity
function getSupportedComplianceInfo(IBasicFrictionlessToken.FrictionlessTokenTypes tokenType_)
    external
    view
    returns (ModularComplianceInfo memory);
```

### isSupportedComplianceModule

*returns true if the compliance module supports the Frictionless token type, otherwise false*

```solidity
function isSupportedComplianceModule(IBasicFrictionlessToken.FrictionlessTokenTypes tokenType_, address moduleToCheck_)
    external
    view
    returns (bool);
```

**Parameters**

| Name             | Type                                             | Description                                                                                          |
| ---------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
| `tokenType_`     | `IBasicFrictionlessToken.FrictionlessTokenTypes` | the type of token as defined by the `IBasicFrictionlessToken.FrictionlessTokenTypes` enumerated type |
| `moduleToCheck_` | `address`                                        | the address of the modular compliance contract to verify                                             |

**Returns**

| Name     | Type   | Description                                                                         |
| -------- | ------ | ----------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the compliance module supports the Frictionless token type, otherwise false |

### isModularCompliance

*Returns true if the address provided is a ModularCompliance contract*

```solidity
function isModularCompliance(address modularComplianceAddr_) external view returns (bool);
```

**Parameters**

| Name                     | Type      | Description                                   |
| ------------------------ | --------- | --------------------------------------------- |
| `modularComplianceAddr_` | `address` | the address of the ModularCompliance contract |

**Returns**

| Name     | Type   | Description                                                                   |
| -------- | ------ | ----------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the address provided is a ModularCompliance contract, otherwise false |

## Events

### FrictionlessComplianceDeployed

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

```solidity
event FrictionlessComplianceDeployed(
    IBasicFrictionlessToken.FrictionlessTokenTypes indexed tokenType, address newComplianceContract
);
```

## Errors

### FrictionlessComplianceFactoryZeroAddr

*error thrown if the specified contract address is a zero address, during `init`, `setTreasuryManager`, and `updateModularComplianceImpl`*

```solidity
error FrictionlessComplianceFactoryZeroAddr(string);
```

### FrictionlessComplianceFactoryNotATreasuryManager

*error thrown if the `msg.sender` is not the treasury manager during the function `deployCompliance`*

```solidity
error FrictionlessComplianceFactoryNotATreasuryManager(address);
```

### FrictionlessComplianceFactoryNotAModularCompliance

*error thrown if the modular compliance is invlaid for hte token type during the function `updateModularCompliancesModules`*

```solidity
error FrictionlessComplianceFactoryNotAModularCompliance(address);
```

### FrictionlessComplianceFactoryInvalidTokenType

*error thrown if an invalid tokenType is specified during `deployCompliance`*

```solidity
error FrictionlessComplianceFactoryInvalidTokenType();
```

### FrictionlessComplianceFactoryInvalidModularComplianceData

*error thrown if an invalid module is specified during `updateModularCompliancesModules`*

```solidity
error FrictionlessComplianceFactoryInvalidModularComplianceData(UpdateModularComplianceData modularComplianceData);
```

## Structs

### SupportedComplianceData

```solidity
struct SupportedComplianceData {
    uint256 maxModulesCount;
    EnumerableSet.AddressSet modules;
    bytes32[48] _gap;
}
```

### ModularComplianceInfo

```solidity
struct ModularComplianceInfo {
    uint256 maxModulesCount;
    address[] modules;
}
```

### UpdateModularComplianceData

*Structure to represent the update of modular compliance data.*

```solidity
struct UpdateModularComplianceData {
    address modularCompliance;
    ModularComplianceInfo complianceInfo;
    bool isAdding;
}
```

### UpdateSupportedComplianceData

*Structure to represent the update of modular compliance data for a given token type*

```solidity
struct UpdateSupportedComplianceData {
    IBasicFrictionlessToken.FrictionlessTokenTypes tokenType;
    ModularComplianceInfo complianceInfo;
    bool isAdding;
}
```


---

# 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.frictionless.markets/developer/smart-contracts/smart-contract-docs/compliance/ifrictionlesscompliancefactory.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.
