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

# Disperse.sol

# Disperse

[Git Source](https://github.com/Unvest/protocol/blob/10af66632cb2249fdd76dc9760d2679b39ca2a8f/src/Disperse.sol)

**Inherits:**
Ownable

Gas optimized bulk transfers of ERC20 and ETH that collects any given amount of fee in ETH.

*Disclaimer: This is a forked and modified contract from PopPunkLLC/gaslite-core in order to collect fees.
Original contract without fees can be found on:
[https://github.com/PopPunkLLC/gaslite-core/blob/d62de3c70fb53d5a315e2e33bfd61587abdd7212/src/GasliteDrop.sol](https://github.com/PopPunkLLC/gaslite-core/blob/d62de3c70fb53d5a315e2e33bfd61587abdd7212/src/GasliteDrop.sol)*

## State Variables

### collector

```solidity theme={null}
address public collector;
```

## Functions

### constructor

Initializes the contract with a collector address

```solidity theme={null}
constructor(address _collector) Ownable(msg.sender);
```

**Parameters**

| Name         | Type      | Description                      |
| ------------ | --------- | -------------------------------- |
| `_collector` | `address` | The address of the fee collector |

### setCollector

Sets the collector address

*Only the contract owner can call this function*

```solidity theme={null}
function setCollector(address _collector) external onlyOwner;
```

**Parameters**

| Name         | Type      | Description                      |
| ------------ | --------- | -------------------------------- |
| `_collector` | `address` | The address of the fee collector |

### airdropERC20

Airdrop ERC20 tokens to a list of addresses

```solidity theme={null}
function airdropERC20(
    address _token,
    address[] calldata _addresses,
    uint256[] calldata _amounts,
    uint256 _totalAmount
)
    external
    payable;
```

**Parameters**

| Name           | Type        | Description                       |
| -------------- | ----------- | --------------------------------- |
| `_token`       | `address`   | The address of the ERC20 contract |
| `_addresses`   | `address[]` | The addresses to airdrop to       |
| `_amounts`     | `uint256[]` | The amounts to airdrop            |
| `_totalAmount` | `uint256`   | The total amount to airdrop       |

### airdropETH

Airdrop ETH to a list of addresses

```solidity theme={null}
function airdropETH(address[] calldata _addresses, uint256[] calldata _amounts) external payable;
```

**Parameters**

| Name         | Type        | Description                 |
| ------------ | ----------- | --------------------------- |
| `_addresses` | `address[]` | The addresses to airdrop to |
| `_amounts`   | `uint256[]` | The amounts to airdrop      |

### collectFees

Sends any received Ether to the collector address.

```solidity theme={null}
function collectFees() public;
```

### receive

Allows the contract to receive Ether directly with a call to this function.

*Any Ether received is stored in the contract's balance.*

```solidity theme={null}
receive() external payable;
```
