# 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);
```
