> ## Documentation Index
> Fetch the complete documentation index at: https://thrackle.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# RulesEngineClientERC20

[Git Source](https://github.com/forte-service-company-ltd/forte-rules-engine/blob/1f7450a94147e76e3930c235a18534779130abee/src/client/RulesEngineClientERC20.sol)

**Inherits:**
[RulesEngineClient](/v2/reference/client/RulesEngineClient.sol/abstract.RulesEngineClient)

**Author:**
@mpetersoCode55, @ShaneDuncan602, @TJ-Everett, @VoR0220

This contract is intended to be inherited and implemented by ERC20 token contracts requiring Rules Engine integration.

*Abstract contract containing modifiers and functions for integrating ERC20 token operations with the Rules Engine.
This contract provides policy checks for `mint`, `transfer`, and `transferFrom` operations, both before and after execution.*

## Functions

### checksPoliciesERC20TransferBefore

Modifier for checking policies before executing the `transfer` function.

*Calls the `_checksPoliciesERC20Transfer` function to evaluate policies.*

```solidity
modifier checksPoliciesERC20TransferBefore(
    address to,
    uint256 value,
    uint256 balanceFrom,
    uint256 balanceTo,
    uint256 blockTime
);
```

**Parameters**

| Name          | Type      | Description                                 |
| ------------- | --------- | ------------------------------------------- |
| `to`          | `address` | The receiving address.                      |
| `value`       | `uint256` | The amount to transfer.                     |
| `balanceFrom` | `uint256` | The sender's balance before the transfer.   |
| `balanceTo`   | `uint256` | The receiver's balance before the transfer. |
| `blockTime`   | `uint256` | The current block timestamp.                |

### checksPoliciesERC20TransferAfter

Modifier for checking policies after executing the `transfer` function.

*Calls the `_checksPoliciesERC20Transfer` function to evaluate policies.*

```solidity
modifier checksPoliciesERC20TransferAfter(
    address to,
    uint256 value,
    uint256 balanceFrom,
    uint256 balanceTo,
    uint256 blockTime
);
```

**Parameters**

| Name          | Type      | Description                                |
| ------------- | --------- | ------------------------------------------ |
| `to`          | `address` | The receiving address.                     |
| `value`       | `uint256` | The amount to transfer.                    |
| `balanceFrom` | `uint256` | The sender's balance after the transfer.   |
| `balanceTo`   | `uint256` | The receiver's balance after the transfer. |
| `blockTime`   | `uint256` | The current block timestamp.               |

### checksPoliciesERC20TransferFromBefore

Modifier for checking policies before executing the `transferFrom` function.

*Calls the `_checksPoliciesERC20TransferFrom` function to evaluate policies.*

```solidity
modifier checksPoliciesERC20TransferFromBefore(
    address from,
    address to,
    uint256 value,
    uint256 balanceFrom,
    uint256 balanceTo,
    uint256 blockTime
);
```

**Parameters**

| Name          | Type      | Description                                 |
| ------------- | --------- | ------------------------------------------- |
| `from`        | `address` | The sending address.                        |
| `to`          | `address` | The receiving address.                      |
| `value`       | `uint256` | The amount to transfer.                     |
| `balanceFrom` | `uint256` | The sender's balance before the transfer.   |
| `balanceTo`   | `uint256` | The receiver's balance before the transfer. |
| `blockTime`   | `uint256` | The current block timestamp.                |

### checksPoliciesERC20TransferFromAfter

Modifier for checking policies after executing the `transferFrom` function.

*Calls the `_checksPoliciesERC20TransferFrom` function to evaluate policies.*

```solidity
modifier checksPoliciesERC20TransferFromAfter(
    address from,
    address to,
    uint256 value,
    uint256 balanceFrom,
    uint256 balanceTo,
    uint256 blockTime
);
```

**Parameters**

| Name          | Type      | Description                                |
| ------------- | --------- | ------------------------------------------ |
| `from`        | `address` | The sending address.                       |
| `to`          | `address` | The receiving address.                     |
| `value`       | `uint256` | The amount to transfer.                    |
| `balanceFrom` | `uint256` | The sender's balance after the transfer.   |
| `balanceTo`   | `uint256` | The receiver's balance after the transfer. |
| `blockTime`   | `uint256` | The current block timestamp.               |

### checksPoliciesERC20MintBefore

Modifier for checking policies before executing the `mint` function.

*Calls the `_checksPoliciesERC20Mint` function to evaluate policies.*

```solidity
modifier checksPoliciesERC20MintBefore(
    address to,
    uint256 amount,
    uint256 balanceFrom,
    uint256 balanceTo,
    uint256 blockTime
);
```

**Parameters**

| Name          | Type      | Description                             |
| ------------- | --------- | --------------------------------------- |
| `to`          | `address` | The receiving address.                  |
| `amount`      | `uint256` | The amount to mint.                     |
| `balanceFrom` | `uint256` | The sender's balance before the mint.   |
| `balanceTo`   | `uint256` | The receiver's balance before the mint. |
| `blockTime`   | `uint256` | The current block timestamp.            |

### checksPoliciesERC20MintAfter

Modifier for checking policies after executing the `mint` function.

*Calls the `_checksPoliciesERC20Mint` function to evaluate policies.*

```solidity
modifier checksPoliciesERC20MintAfter(
    address to,
    uint256 amount,
    uint256 balanceFrom,
    uint256 balanceTo,
    uint256 blockTime
);
```

**Parameters**

| Name          | Type      | Description                            |
| ------------- | --------- | -------------------------------------- |
| `to`          | `address` | The receiving address.                 |
| `amount`      | `uint256` | The amount to mint.                    |
| `balanceFrom` | `uint256` | The sender's balance after the mint.   |
| `balanceTo`   | `uint256` | The receiver's balance after the mint. |
| `blockTime`   | `uint256` | The current block timestamp.           |

### \_checksPoliciesERC20Transfer

Calls the Rules Engine to evaluate policies for an ERC20 `transfer` operation.

*Encodes the parameters and invokes the `_invokeRulesEngine` function.*

```solidity
function _checksPoliciesERC20Transfer(
    address _to,
    uint256 _value,
    uint256 _balanceFrom,
    uint256 _balanceTo,
    uint256 _blockTime
) internal;
```

**Parameters**

| Name           | Type      | Description                  |
| -------------- | --------- | ---------------------------- |
| `_to`          | `address` | The receiving address.       |
| `_value`       | `uint256` | The amount to transfer.      |
| `_balanceFrom` | `uint256` | The sender's balance.        |
| `_balanceTo`   | `uint256` | The receiver's balance.      |
| `_blockTime`   | `uint256` | The current block timestamp. |

### \_checksPoliciesERC20TransferFrom

Calls the Rules Engine to evaluate policies for an ERC20 `transferFrom` operation.

*Encodes the parameters and invokes the `_invokeRulesEngine` function.*

```solidity
function _checksPoliciesERC20TransferFrom(
    address _from,
    address _to,
    uint256 _value,
    uint256 _balanceFrom,
    uint256 _balanceTo,
    uint256 _blockTime
) internal;
```

**Parameters**

| Name           | Type      | Description                  |
| -------------- | --------- | ---------------------------- |
| `_from`        | `address` | The sending address.         |
| `_to`          | `address` | The receiving address.       |
| `_value`       | `uint256` | The amount to transfer.      |
| `_balanceFrom` | `uint256` | The sender's balance.        |
| `_balanceTo`   | `uint256` | The receiver's balance.      |
| `_blockTime`   | `uint256` | The current block timestamp. |

### \_checksPoliciesERC20Mint

Calls the Rules Engine to evaluate policies for an ERC20 `mint` operation.

*Encodes the parameters and invokes the `_invokeRulesEngine` function.*

```solidity
function _checksPoliciesERC20Mint(
    address _to,
    uint256 _amount,
    uint256 _balanceFrom,
    uint256 _balanceTo,
    uint256 _blockTime
) internal;
```

**Parameters**

| Name           | Type      | Description                  |
| -------------- | --------- | ---------------------------- |
| `_to`          | `address` | The receiving address.       |
| `_amount`      | `uint256` | The amount to mint.          |
| `_balanceFrom` | `uint256` | The sender's balance.        |
| `_balanceTo`   | `uint256` | The receiver's balance.      |
| `_blockTime`   | `uint256` | The current block timestamp. |
