# AbstractFrictionlessComplianceModule

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

**Inherits:** IFrictionlessComplianceModule, OwnableUpgradeable

**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.

See {IFrictionlessComplianceModule}

## State Variables

### permissionsManager

*The IFrictionlessPermissionsManager for the protocol.*

```solidity
IFrictionlessPermissionsManager public override permissionsManager;
```

### complianceFactory

*The IFrictionlessComplianceFactory for the protocol.*

```solidity
IFrictionlessComplianceFactory public override complianceFactory;
```

### \_complianceBound

*the mapping of compliance modules bound.*

```solidity
mapping(address => bool) private _complianceBound;
```

## Functions

### onlyApprovedCompliance

*modifier used to very that only approved compliance modules can be used.*

```solidity
modifier onlyApprovedCompliance();
```

### onlyBoundCompliance

*modifier used to very that only modules that are bound, can be used.*

```solidity
modifier onlyBoundCompliance();
```

### \_\_AbstractFrictionlessComplianceModule\_init

*Initiatizes the compliance module*

```solidity
function __AbstractFrictionlessComplianceModule_init(
    address frictionlessPermissionsManager_,
    address complianceFactory_
) internal onlyInitializing;
```

**Parameters**

| Name                              | Type      | Description                                         |
| --------------------------------- | --------- | --------------------------------------------------- |
| `frictionlessPermissionsManager_` | `address` | the address of the frictionless permissions manager |
| `complianceFactory_`              | `address` | the address of the compliance dfactory              |

### setPermissionsManager

*Sets the instance of the `IFrictionlessPermissionsManager` to determine permissions for users.*

```solidity
function setPermissionsManager(address frictionlessPermissionsManager_) external override onlyOwner;
```

**Parameters**

| Name                              | Type      | Description                                                   |
| --------------------------------- | --------- | ------------------------------------------------------------- |
| `frictionlessPermissionsManager_` | `address` | the address of the `IFrictionlessPermissionsManager` contract |

### setComplianceFactory

*Sets the instance of the `IFrictionlessComplianceFactory` to determine the compliance module for the protocol.*

```solidity
function setComplianceFactory(address newComplianceFactory_) external override onlyOwner;
```

**Parameters**

| Name                    | Type      | Description                                                  |
| ----------------------- | --------- | ------------------------------------------------------------ |
| `newComplianceFactory_` | `address` | the address of the `IFrictionlessComplianceFactory` contract |

### bindCompliance

```solidity
function bindCompliance(address compliance_) external override onlyApprovedCompliance;
```

### unbindCompliance

```solidity
function unbindCompliance(address compliance_) external override;
```

### moduleTransferAction

```solidity
function moduleTransferAction(address from_, address to_, uint256 value_)
    external
    virtual
    override
    onlyBoundCompliance;
```

### moduleMintAction

```solidity
function moduleMintAction(address to_, uint256 value_) external virtual override onlyBoundCompliance;
```

### moduleBurnAction

```solidity
function moduleBurnAction(address from_, uint256 value_) external virtual override onlyBoundCompliance;
```

### moduleCheck

```solidity
function moduleCheck(address, address, uint256, address) public view virtual override returns (bool);
```

### isComplianceBound

```solidity
function isComplianceBound(address compliance_) public view override returns (bool);
```

### isTreasury

*Verifies if the specified wallet address is a PROTOCOL\_TREASURY user.*

```solidity
function isTreasury(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                        |
| -------- | ------ | ---------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a PROTOCOL\_TREASURY user, otherwise false |

### isCustodian

*Verifies if the specified wallet address is a PERMISSIONED\_CUSTODIAN user.*

```solidity
function isCustodian(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                             |
| -------- | ------ | --------------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a PERMISSIONED\_CUSTODIAN user, otherwise false |

### isInvestor

*Verifies if the specified wallet address is a PERMISSIONED\_INVESTOR user.*

```solidity
function isInvestor(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                            |
| -------- | ------ | -------------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a PERMISSIONED\_INVESTOR user, otherwise false |

### isManager

*Verifies if the specified wallet address is a PERMISSIONED\_MANAGER user.*

```solidity
function isManager(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                           |
| -------- | ------ | ------------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a PERMISSIONED\_MANAGER user, otherwise false |

### isCalculatingAgent

*Verifies if the specified wallet address is a PERMISSIONED\_CALCULATING\_AGENT user.*

```solidity
function isCalculatingAgent(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                                      |
| -------- | ------ | ------------------------------------------------------------------------------------------------ |
| `<none>` | `bool` | true if the specified wallet address is a PERMISSIONED\_CALCULATING\_AGENT user, otherwise false |

### isTransferAgent

*Verifies if the specified wallet address is a PERMISSIONED\_TRANSFER\_AGENT user.*

```solidity
function isTransferAgent(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                                   |
| -------- | ------ | --------------------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a PERMISSIONED\_TRANSFER\_AGENT user, otherwise false |

### isFundAccountant

*Verifies if the specified wallet address is a PERMISSIONED\_FUND\_ACCOUNTANT user.*

```solidity
function isFundAccountant(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                                    |
| -------- | ------ | ---------------------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a PERMISSIONED\_FUND\_ACCOUNTANT user, otherwise false |

### isUser

*Verifies if the specified wallet address is a permissioned user in the Frictionless protocol.*

```solidity
function isUser(address userAddress_) public view override returns (bool);
```

**Parameters**

| Name           | Type      | Description |
| -------------- | --------- | ----------- |
| `userAddress_` | `address` |             |

**Returns**

| Name     | Type   | Description                                                                                               |
| -------- | ------ | --------------------------------------------------------------------------------------------------------- |
| `<none>` | `bool` | true if the specified wallet address is a permissioned user in the Frictionless protocol, otherwise false |

### hasClaim

*verify if the userAddress is permissioned in the Frictionless protocol and has a valid claim*

```solidity
function hasClaim(address userAddress_, IFrictionlessPermissionsManager.FrictionlessPermissionedUser userType_)
    public
    view
    override
    returns (bool);
```

**Parameters**

| Name           | Type                                                           | Description                                |
| -------------- | -------------------------------------------------------------- | ------------------------------------------ |
| `userAddress_` | `address`                                                      | the address of the user's wallet to verify |
| `userType_`    | `IFrictionlessPermissionsManager.FrictionlessPermissionedUser` | the type of the user as per the enum       |

**Returns**

| Name     | Type   | Description                                                               |
| -------- | ------ | ------------------------------------------------------------------------- |
| `<none>` | `bool` | true if a valid permissioned user and has a valid claim, otherwise false. |

### \_setPermissionsManager

*Impl of the setting of the permissions manager*

```solidity
function _setPermissionsManager(address newFrictionlessPermissionsManager_) internal;
```

### \_setComplianceFactory

*Impl of the setting of the compliance factory*

```solidity
function _setComplianceFactory(address newComplianceFactory_) internal;
```

### \_checkZeroAddr

*Verifies if an address is a zero address*

```solidity
function _checkZeroAddr(address addrToCheck_, string memory addrName_) internal pure;
```

### \_onlyBoundCompliance

*Verifies if the compliance\_ address supplied is bound as per the mapping*

```solidity
function _onlyBoundCompliance(address compliance_) internal view virtual;
```

### \_onlyValidCompliance

*Verifies if the compliance\_ address supplied is valid*

```solidity
function _onlyValidCompliance(address compliance_) internal view;
```

### \_onlyApprovedCompliance

*Verifies if the `msg.sender` is a valid modular compliance*

```solidity
function _onlyApprovedCompliance() internal view;
```

### \_getTokenBound

*Returns the address of the IToken bound by this compliance*

```solidity
function _getTokenBound(address compliance_) internal view returns (address);
```

### \_hasClaim

*Determine if a claim is present for a given userAddress and userType*

```solidity
function _hasClaim(address userAddress_, IFrictionlessPermissionsManager.FrictionlessPermissionedUser userType_)
    internal
    view
    virtual
    returns (bool);
```

**Parameters**

| Name           | Type                                                           | Description                                                                                                       |
| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `userAddress_` | `address`                                                      | the address if the users wallet                                                                                   |
| `userType_`    | `IFrictionlessPermissionsManager.FrictionlessPermissionedUser` | the type of the user as defined by the enumeration `IFrictionlessPermissionsManager.FrictionlessPermissionedUser` |


---

# 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/abstractfrictionlesscompliancemodule.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.
