# Manager Contracts

The Manager Contracts are the main entry points to the Frictionless protocol, they perform market functions such as permission management, treasury operations, issuance, transfer and settlement of securities, and attestations of deposits (proof-of-reserve) for the underlying of FrictionlessFundDepositTokens.

There are four main manager contracts in the Frictionless protocol, as described below.

* [FrictionlessPermissionsManager](#frictionlesspermissionsmanager)
* [FrictionlessTransferManager](#frictionlesstransfermanager)
* [FrictionlessTreasuryManager](#frictionlesstreasurymanager)
* [FrictionlessAttestationManager](#frictionlessattestationmanager)

### [FrictionlessPermissionsManager](https://docs.frictionless.markets/developer/smart-contracts/smart-contract-docs/manager-contracts/ifrictionlesspermissionsmanager)

The FrictionlessPermissionsManager defines a set of functions and events related to managing participants' permissions in the Frictionless protocol.

The interface includes an enumeration `FrictionlessPermissionedUser` that enumerates different participants in the Frictionless protocol, such as PROTOCOL\_TREASURY, PERMISSIONED\_CUSTODIAN, etc.

Only valid agents can register, add or remove users and their associated claims.

### [FrictionlessTransferManager](https://docs.frictionless.markets/developer/smart-contracts/smart-contract-docs/manager-contracts/ifrictionlesstransfermanager)

The FrictionlessTransferManager manages the transfer of tokens within the Frictionless protocol. It is also responsible for the collection of fees associated with the exchange of tokens. These fees are mapped to specific fee schedules set by managers on their respective issuances.

The FrictionlessTransferManager overview is provided in the source [README](https://gitlab.com/dfyclabs/protocol/dfyclabs-tokens/-/blob/main/README.md#frictionlesstransfermanager).&#x20;

{% hint style="info" %}
The Frictionless protocol enables GPs and Managers to collect fees on the primary issuance and secondary trades of digital securities.
{% endhint %}

{% hint style="success" %}
The Frictionless protocol enables Investors to bilaterally trade digital securities via the FrictionlessTransferManager smart contract whilst enabling Managers to optionally collect fees on the transaction.

*See*[*`onlyCounterpart`*](#onlycounterpart-mode) *mode*
{% endhint %}

{% hint style="success" %}
The Frictionless protocol enables Managers and GPs to control cash distributions, waterfalls, and capital calls without the direct action of Investors, enabling sophisticated automation via the Frictionless Markets APIs and Manager automation interface.

*See* [*`onlyTreasury`*](#onlytreasury-mode) *mode*
{% endhint %}

#### onlyTreasury Mode

`exchangeTokens` , this function will execute the exchange of tokens between two counterparties, but it is executed by the PROTOCOL\_TREASURY as the transfer agent optionally collecting fees. For example, payment in FrictionlessFundDepositToken by an Investor for FricitonlessDigitalSecurityToken held by a custodian (Primary trade) or FricitonlessDigitalSecurityToken held by another Investor (secondary trade).

<figure><img src="https://257329724-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn1p8Xj3fTDixdW6ELAVY%2Fuploads%2FbUxVJfPl2k6tG3nFfLPY%2Ffrictionless-protocol-img-src-Frictionless-TransferManager-Treasury.drawio.png?alt=media&#x26;token=45db6467-cd1b-4303-93d9-e9fb5c75bdf6" alt=""><figcaption><p>Schematic of Frictionless transfer of tokens by the PROTOCOL_TREASURY</p></figcaption></figure>

The exchange flow is as follows:

1. The PROTOCOL\_ADMIN optionally sets the transfer fees for the token inbound and outbound.
2. The PROTOCOL\_TREASURY invokes the `exchangeTokens` function, indicating the polarity of the transaction, such as cash for cash, cash for security, security for cash, or security for security. There are many options, but they all result in the same outcome, the compliant transfer of a Frictionless token for another Frictionless token in a single atomic transaction on-chain.
3. The transfer is enacted using the ERC-3643-compliant token transfer `IToken.forcedTransfer`.

More scenarios for DvP are described in the source [README](https://gitlab.com/dfyclabs/protocol/dfyclabs-tokens/-/blob/main/README.md#frictionlessfunddeposittoken-delivery-versus-payment).

#### onlyCounterpart Mode

`createTransferOffer confirmTransferOffer`, `cancelTransferOffer` these functions will execute the exchange tokens in a bilateral P2P mode between two counterparties in a maker-taker mode. This mode also optionally enables the protocol to collect fees.

<figure><img src="https://257329724-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fn1p8Xj3fTDixdW6ELAVY%2Fuploads%2FL5uX9udpTwYq7QHHzdpN%2Ffrictionless-protocol-img-src-Frictionless-TransferManager-Bilateral.drawio.png?alt=media&#x26;token=961eebc1-c699-42b2-a70a-293ef2d0ca00" alt=""><figcaption><p>Schematic of Frictionless transfer of tokens bilaterally by Investors</p></figcaption></figure>

The exchange flow is as follows:

1. The PROTOCOL\_ADMIN optionally sets the transfer fees for the token inbound and outbound.
2. Investor X invokes the `createTransferOffer` function, indicating the offer, such as cash for cash, cash for security, security for cash, or security for security. There are many options, but they all result in the same outcome, the compliant transfer of a Frictionless token for another Frictionless token in a single atomic transaction on-chain.
3. Investor Y can accept the offer by invoking the `confirmTransferOffer` function, ensuring the ERC-3643-compliant token transfer using `IToken.transferFrom`.

### [FrictionlessTreasuryManager](https://docs.frictionless.markets/developer/smart-contracts/smart-contract-docs/manager-contracts/ifrictionlesstreasurymanager)

The FrictionlessTreasuryManager manages the minting, transfer, and burning of various [tokens](https://docs.frictionless.markets/developer/smart-contracts/smart-contract-docs/frictionless-tokens) within the Frictionless protocol

1. **Token Minting and Management:**
   * The contract provides functions to mint different types of tokens within the Frictionless protocol, including Fund Deposit Tokens (`mintFundDepositForTreasury`), Digital Security Tokens (`mintDigitalSecurity`), and On-Chain Asset Tokens (`mintOnChainAsset`).
   * Tokens are associated with compliance contracts, and their minting is subject to specific conditions, roles, and permissions.
2. **Token Transfer and Burning:**
   * The contract allows for the transfer and burning of tokens through functions like `transferToken` and `burnToken`. These actions are performed by an agent with the necessary permissions.
3. **Fund Deposit Token Management:**
   * The contract keeps track of existing Fund Deposit Tokens using a mapping `_existingFundDepositTokens`. It prevents the creation of duplicate Fund Deposit Tokens for the same currency and fund IBAN.

The PROTOCOL\_ADMIN is the only role permissioned to initially mint any Frictionless tokens, thereafter valid agents such as the PROTOCOL\_TREASURY are permitted to increase supply (mint to address), transfer and burn Frictionless tokens.

### [FrictionlessAttestationManager](https://docs.frictionless.markets/developer/smart-contracts/smart-contract-docs/manager-contracts/ifrictionlessattestationmanager)

The FrictionlessAttestationManager responsible for providing attestations of the balances held in the underlying funding account for each `FrictionlessFundDepositToken`. The attestation is provided and signed by an independent 3rd party, known as PERMISSIONED\_FUND\_ACCOUNTANT in the Frictionless protocol.

{% hint style="success" %}
Attestations are proof of balances in each currency on a regular basis for example, daily or hourly, the attestation data is based on the following snapshot of the currency account underpinning the FrictionlessFundDepositToken.
{% endhint %}

<table><thead><tr><th width="280">ATTESTATION FIELD</th><th>ATTESTATION COMMENT</th></tr></thead><tbody><tr><td>CASH_IBAN</td><td>The IBAN of the cash account </td></tr><tr><td>CURRENCY</td><td>The 3-letter currency code of the cash account </td></tr><tr><td>REPORT_START_DATE</td><td>The start of this report, for example, yesterday at 6AM </td></tr><tr><td>REPORT_END_DATE</td><td>The end of this report, for example, today at 6AM</td></tr><tr><td>CASH_BALANCE</td><td>The actual balance on the account as of <code>REPORT_END_DATE</code>for example, today 6AM</td></tr><tr><td>LAST_TX_COUNTERPARTY_ID</td><td>The ID of the counterparty in the last transaction on the account </td></tr><tr><td>LAST_TX_TIMESTAMP</td><td>The timestamp (same format as REPORT_END_DATE) in the last transaction on the account </td></tr><tr><td>LAST_TX_AMOUNT</td><td>The amount of the the last transaction on the account, A credit transaction is positive and a debit transaction is negative</td></tr></tbody></table>

The attestation workflows are described in the source [README](https://gitlab.com/dfyclabs/protocol/dfyclabs-tokens/-/blob/main/README.md#frictionlessfunddeposittoken-issueattestationredemption-flows).


---

# 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/manager-contracts.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.
