# EngenCredits

**Deployment Address:**

Mainnet: [<mark style="color:purple;">0xD1295F0d8789c3E0931A04F91049dB33549E9C8F</mark>](https://explorer.kinto.xyz/address/0xD1295F0d8789c3E0931A04F91049dB33549E9C8F?tab=read_proxy)

Interface: [<mark style="color:purple;">IEngenCredits.sol</mark>](https://github.com/KintoXYZ/kinto-id/tree/main/src/interfaces)

***

## Basics

This contracts holds Engen Credits minting and setup mechanisms

### State Variables

These are the key state variables used in the contract.

| Name             | Type    |
| ---------------- | ------- |
| transfersEnabled | bool    |
| burnsEnabled     | bool    |
| earnedCredits    | mapping |
| totalCredits     | uint256 |

Using the following call method, you can check if transfers are enabled:

```solidity
transfersEnabled()
```

### Earned Credits

Each wallet can earn credits based on their activity. These credits can be managed using the `setCredits` method.

For example, to set the earned credits for multiple wallets:

```solidity
setCredits(<WALLETS>, <POINTS>)
```

### State Functions

Privileged roles can call the following functions.

```solidity

function mint(address to, uint256 amount) external;

function setTransfersEnabled(bool _transfersEnabled) external;

function setBurnsEnabled(bool _burnsEnabled) external;

function setCredits(address[] calldata _wallets, uint256[] calldata _points) external;

```

**1. mint**

This function mints Engen tokens to a specified address. Only the contract owner can call this function.

Function Interface:

```solidity
function mint(address to, uint256 amount) external;
```

| Parameter | Type    | Explanation                   |
| --------- | ------- | ----------------------------- |
| to        | address | The address to mint tokens to |
| amount    | uint256 | The amount of tokens to mint  |

***

**2. setTransfersEnabled**

This function enables or disables the transfer of Engen tokens. Only the contract owner can call this function.

Function Interface:

```solidity
function setTransfersEnabled(bool _transfersEnabled) external;
```

| Parameter          | Type | Explanation                         |
| ------------------ | ---- | ----------------------------------- |
| \_transfersEnabled | bool | True if transfers should be enabled |

***

**3. setBurnsEnabled**

This function enables or disables the burning of Engen tokens. Only the contract owner can call this function.

Function Interface:

```solidity
function setBurnsEnabled(bool _burnsEnabled) external;
```

| Parameter      | Type | Explanation                       |
| -------------- | ---- | --------------------------------- |
| \_burnsEnabled | bool | True if burning should be enabled |

***

**4. setCredits**

This function sets the earned credits for multiple wallets. Only the contract owner can call this function.

Function Interface:

```solidity
function setCredits(address[] calldata _wallets, uint256[] calldata _points) external;
```

| Parameter | Type                | Explanation                       |
| --------- | ------------------- | --------------------------------- |
| \_wallets | address\[] calldata | The wallet addresses of the users |
| \_points  | uint256\[] calldata | The credits earned by each user   |

***

### **View Functions**

Anyone can call the following functions without a transaction to retrieve information from the contract.

```solidity
function transfersEnabled() external view returns (bool);

function burnsEnabled() external view returns (bool);

function earnedCredits(address account) external view returns (uint256);

function totalCredits() external view returns (uint256);

function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

function getPastTotalSupply(uint256 timepoint) external view returns (uint256);

function clock() external view returns (uint48);

function CLOCK_MODE() external pure returns (string memory);
```

**1. transfersEnabled**

This function checks if transfers are enabled.

Function Interface:

```solidity
function transfersEnabled() external view returns (bool);
```

| Parameter | Type | Explanation                           |
| --------- | ---- | ------------------------------------- |
|           |      | Returns true if transfers are enabled |

**2. burnsEnabled**

This function checks if burning is enabled.

Function Interface:

```solidity
function burnsEnabled() external view returns (bool);
```

| Parameter | Type | Explanation                        |
| --------- | ---- | ---------------------------------- |
|           |      | Returns true if burning is enabled |

***

**3. earnedCredits**

This function returns the earned credits of a specific wallet.

Function Interface:

```solidity
function earnedCredits(address account) external view returns (uint256);
```

| Parameter | Type    | Explanation               |
| --------- | ------- | ------------------------- |
| account   | address | The address of the wallet |

***

**4. totalCredits**

This function returns the total credits earned by all wallets.

Function Interface:

```solidity
function totalCredits() external view returns (uint256);
```

| Parameter | Type | Explanation               |
| --------- | ---- | ------------------------- |
|           |      | Returns the total credits |

***

**5. getPastVotes**

This function returns the past votes of a user at a specific timepoint.

Function Interface:

```solidity
function getPastVotes(address account, uint256 timepoint) external view returns (uint256);
```

| Parameter | Type    | Explanation                       |
| --------- | ------- | --------------------------------- |
| account   | address | The address of the user           |
| timepoint | uint256 | The timepoint to get the votes at |

***

**6. getPastTotalSupply**

This function returns the total supply of votes at a specific timepoint.

Function Interface:

```solidity
function getPastTotalSupply(uint256 timepoint) external view returns (uint256);
```

| Parameter | Type    | Explanation                       |
| --------- | ------- | --------------------------------- |
| timepoint | uint256 | The timepoint to get the votes at |

***

**7. clock**

This function returns the current timepoint.

Function Interface:

```solidity
function clock() external view returns (uint48);
```

| Parameter | Type | Explanation                   |
| --------- | ---- | ----------------------------- |
|           |      | Returns the current timepoint |

***

**8. CLOCK\_MODE**

This function returns the clock mode.

Function Interface:

```solidity
function CLOCK_MODE() external pure returns (string memory);
```

| Parameter | Type | Explanation            |
| --------- | ---- | ---------------------- |
|           |      | Returns the clock mode |
