---
description: Reads an environment variable as address or address[]
---

## `envAddress`

### Signature

```solidity
function envAddress(string calldata key) external returns (address value);
function envAddress(string calldata key, string calldata delimiter) external returns (address[] memory values);
```

### Description

Reads an environment variable as `address` or `address[]`.

### Parameters

| Parameter   | Type     | Description                               |
|-------------|----------|-------------------------------------------|
| `key`       | `string` | The environment variable name             |
| `delimiter` | `string` | The delimiter used to separate array values (optional) |

### Returns

| Type        | Description                                     |
|-------------|-------------------------------------------------|
| `address`   | The environment variable value as an address    |
| `address[]` | The environment variable value as an address array |

### Examples

#### Single Value

With environment variable `ADDRESS_VALUE=0x7109709ECfa91a80626fF3989D68f67F5b1DD12D`:

```solidity [test/EnvAddress.t.sol]
string memory key = "ADDRESS_VALUE";
address expected = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D;
address output = vm.envAddress(key);
assert(output == expected);
```

#### Array

With environment variable `ADDRESS_VALUES=0x7109709ECfa91a80626fF3989D68f67F5b1DD12D,0x0000000000000000000000000000000000000000`:

```solidity [test/EnvAddress.t.sol]
string memory key = "ADDRESS_VALUES";
string memory delimiter = ",";
address[2] memory expected = [
    0x7109709ECfa91a80626fF3989D68f67F5b1DD12D,
    0x0000000000000000000000000000000000000000
];
address[] memory output = vm.envAddress(key, delimiter);
assert(keccak256(abi.encodePacked((output))) == keccak256(abi.encodePacked((expected))));
```

### Related Cheatcodes

- [`envOr`](/reference/cheatcodes/env-or) - Read environment variables with default values
- [`envString`](/reference/cheatcodes/env-string) - Read environment variables as string
- [`envBytes32`](/reference/cheatcodes/env-bytes32) - Read environment variables as bytes32
