# accesses

Description: accesses cheatcode documentation

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/reference/cheatcodes/Environment/accesses.mdx

  Components used in this page:
    - :::note: An informational callout block. Supports custom title `:::note[Title]` and icon `:::note{icon="name"}` syntax.

{/* This document contains content copied/adapted from the Foundry Book (MIT licensed). See LICENSE in the parent directory. */}

### Signature

```solidity
function accesses(
  address
) external returns (bytes32[] memory reads, bytes32[] memory writes);
```

### Description

Gets all storage slots that have been read (`reads`) or written to (`writes`) on an address.

Note that [`record`](/docs/reference/cheatcodes/environment/record) must be called first.

:::note
Every write also counts as an additional read.
:::

### Examples

```solidity
/// contract NumsContract {
///     uint256 public num1 = 100; // slot 0
///     uint256 public num2 = 200; // slot 1
/// }

vm.record();
numsContract.num2();
(bytes32[] memory reads, bytes32[] memory writes) = vm.accesses(
  address(numsContract)
);
emit log_uint(uint256(reads[0])); // 1
```
