# `Ethers.Contracts.ERC165`
[🔗](https://github.com/ExWeb3/elixir_ethers/blob/v0.6.12/lib/ethers/contracts/erc165.ex#L1)

ERC-165 Standard Interface Detection

More info: https://eips.ethereum.org/EIPS/eip-165

## Modules as Interface IDs

Contract modules can opt to implement EIP-165 behaviour so that their name can be used
directly with the `supports_interface/1` function in this module. See below example:

```elixir
defmodule MyEIP165CompatibleContract do
  use Ethers.Contract, abi: ...
  @behaviour Ethers.Contracts.ERC165

  @impl true
  def erc165_interface_id, do: Ethers.Utils.hex_decode("[interface_id]")
end
```

Now module name can be used instead of interface_id and will have the same result.

```elixir
iex> Ethers.Contracts.ERC165.supports_interface("[interface_id]") ==
  Ethers.Contracts.ERC165.supports_interface(MyEIP165CompatibleContract)
true
```

# `erc165_interface_id`

```elixir
@callback erc165_interface_id() :: &lt;&lt;_::32&gt;&gt;
```

# `__default_address__`

```elixir
@spec __default_address__() :: nil
```

Default address of the contract. Returns `nil` if not specified.

To specify a default address see `Ethers.Contract`

# `constructor`

# `supports_interface`

```elixir
@spec supports_interface(&lt;&lt;_::32&gt;&gt; | atom()) :: Ethers.TxData.t()
```

Prepares `supportsInterface(bytes4 interfaceId)` call parameters on the contract.

This function also accepts a module that implements the ERC165 behaviour as input. Example:

```elixir
iex> Ethers.Contracts.ERC165.supports_interface(Ethers.Contracts.ERC721)
#Ethers.TxData<function supportsInterface(...)>
```

This function should only be called for result and never in a transaction on
its own. (Use Ethers.call/2)

State mutability: view

## Function Parameter Types

- interfaceId: `{:bytes, 4}`

## Return Types (when called with `Ethers.call/2`)

- :bool

---

*Consult [api-reference.md](api-reference.md) for complete listing*
