---
description: Data (types, names) and functions (parameters, modifiers).
---

# Data and functions

This token is used to tokenize the energy assets from green energy producers.

## **constructor**

used to initialize the Token metadata and Initial supply

## **addFootprint**

| Name      | Type    | Description                                 |
| --------- | ------- | ------------------------------------------- |
| company   | address | address of the company                      |
| footprint | uint256 | units of footprint generated by the company |

## **allowance**

gets the allowances of the approved account

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| owner   | address | address of the owner   |
| spender | address | address of the spender |

Returns: the amount of tokens approved

| Name   | Type    | Description                   |
| ------ | ------- | ----------------------------- |
| amount | uint256 | the number of tokens approved |

## **approve**

Function to approve another account to transfer from the callers account

| Name    | Type    | Description                                    |
| ------- | ------- | ---------------------------------------------- |
| spender | address | address of the spender                         |
| amount  | uint256 | amount of tokens to be approved to the spender |

Returns:

| Name   | Type | Description        |
| ------ | ---- | ------------------ |
| status | bool | status of approval |

## **approveIot**

Should be executed before adding footprint

| Name    | Type    | Description               |
| ------- | ------- | ------------------------- |
| spender | address | address of the IOT device |

## **balanceOf**

returns the balance amount of the token holder

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| account | address | address of the account |

Returns:

| Name    | Type    | Description                  |
| ------- | ------- | ---------------------------- |
| balance | uint256 | Balance amount in an account |

## **buy**

uses StandardERC20 \_transfer function

| Name   | Type    | Description                               |
| ------ | ------- | ----------------------------------------- |
| amount | uint256 | amount of tokens to be bought by the user |

## **changeOwner**

Function to change the owner of the contract

| Name     | Type    | Description              |
| -------- | ------- | ------------------------ |
| newOwner | address | address of the new owner |

Returns:

| Name    | Type | Description                    |
| ------- | ---- | ------------------------------ |
| success | bool | return if owner changed or not |

## **compensate**

burns the specified amount of tokens

| Name   | Type    | Description                                      |
| ------ | ------- | ------------------------------------------------ |
| amount | uint256 | amount of tokens the company wants to compensate |

## **decimals**

returns the decimals of the token

No parameters

Returns:

| Name     | Type  | Description           |
| -------- | ----- | --------------------- |
| decimals | uint8 | Decimals of the token |

## **getFootPrint**

utility function to access the state of the company

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| company | address | address of the company |

Returns:

| Name      | Type    | Description                                       |
| --------- | ------- | ------------------------------------------------- |
| footprint | uint256 | total units of footprint generated by the company |

## **getIOT**

Returns the address of the IOT dec

| Name    | Type    | Description            |
| ------- | ------- | ---------------------- |
| company | address | address of the company |

Returns:

| Name | Type    | Description                          |
| ---- | ------- | ------------------------------------ |
| iot  | address | Returns the address of th IOT device |

## **mint**

calls the \_mint function from standard ERC20

| Name   | Type    | Description                                      |
| ------ | ------- | ------------------------------------------------ |
| amount | uint256 | specifies the amount of token to be newly minted |

## **name**

returns the name of the token

No parameters

Returns:

| Name | Type   | Description                  |
| ---- | ------ | ---------------------------- |
| name | string | return the name of the token |

## **owner**

Returns the address of the owner

No parameters

Returns:

| Name  | Type    | Description                      |
| ----- | ------- | -------------------------------- |
| owner | address | returns the address of the owner |

## **symbol**

returns the Symbol of the token

No parameters

Returns:

| Name   | Type   | Description                     |
| ------ | ------ | ------------------------------- |
| symbol | string | returns the Symbol of the token |

## **totalSupply**

returns the total supply of the token

No parameters

Returns:

| Name        | Type    | Description                           |
| ----------- | ------- | ------------------------------------- |
| totalSupply | uint256 | returns the total supply of the token |

## **transfer**

Function to transfer a specified amount to another address

| Name      | Type    | Description                        |
| --------- | ------- | ---------------------------------- |
| recipient | address | address of the recipient           |
| amount    | uint256 | amount of tokens to be transferred |

Returns:

| Name    | Type | Description                       |
| ------- | ---- | --------------------------------- |
| success | bool | returns if the transfer succeeded |

## **transferFrom**

facilitates transfer between two accounts other than the caller.

| Name      | Type    | Description                 |
| --------- | ------- | --------------------------- |
| sender    | address | address of the sender       |
| recipient | address | address of the recipient    |
| amount    | uint256 | amount of tokens to be sent |

Returns:

| Name    | Type | Description                       |
| ------- | ---- | --------------------------------- |
| success | bool | returns if the transfer succeeded |
