# Compliance Interface

The Compliance contract interface defines the set of functions and events used to enforce regulatory compliance within the T-REX protocol. Below is a detailed breakdown of each function and event, explaining its purpose, source, and functionality.

**`TokenBound`**

**Event**

**Description**: Emitted when a token has been bound to the compliance contract.

```solidity
event TokenBound(address _token);
```

***

**`TokenUnbound`**

**Event**

**Description**: Emitted when a token has been unbound from the compliance contract.

```solidity
event TokenUnbound(address _token);
```

***

**`bindToken`**

**Source**: `ICompliance`

**Description**: Binds a token to the compliance contract. This function emits a `TokenBound` event.

```solidity
function bindToken(address _token) external;
```

***

**`unbindToken`**

**Source**: `ICompliance`

**Description**: Unbinds a token from the compliance contract. This function emits a `TokenUnbound` event.

```solidity
function unbindToken(address _token) external;
```

***

**`transferred`**

**Source**: `ICompliance`

**Description**: Called whenever tokens are transferred from one wallet to another. This function can update state variables in the compliance contract, which are used by `canTransfer` to decide if a transfer is compliant.

```solidity
function transferred(
    address _from,
    address _to,
    uint256 _amount
) external;
```

***

**`created`**

**Source**: `ICompliance`

**Description**: Called whenever tokens are created on a wallet. This function can update state variables in the compliance contract, which are used by `canTransfer` to decide if a transfer is compliant.

```solidity
function created(address _to, uint256 _amount) external;
```

***

**`destroyed`**

**Source**: `ICompliance`

**Description**: Called whenever tokens are destroyed. This function can update state variables in the compliance contract, which are used by `canTransfer` to decide if a transfer is compliant.

```solidity
function destroyed(address _from, uint256 _amount) external;
```

***

**`isTokenAgent`**

**Source**: `ICompliance`

**Description**: Returns true if the address given corresponds to a token agent.

```solidity
function isTokenAgent(address _agentAddress) external view returns (bool);
```

***

**`isTokenBound`**

**Source**: `ICompliance`

**Description**: Returns true if the address given corresponds to a token that is bound with the compliance contract.

```solidity
function isTokenBound(address _token) external view returns (bool);
```

***

**`canTransfer`**

**Source**: `ICompliance`

**Description**: Checks if a transfer is compliant. This is a read-only function that cannot be used to increment counters, emit events, or modify state variables.

```solidity
function canTransfer(
    address _from,
    address _to,
    uint256 _amount
) external view returns (bool);
```


---

# 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.erc3643.org/erc-3643/smart-contracts-library/compliance-management/compliance-interface.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.
