# `DpExchange.Core.Types.DepositAddress`
[🔗](https://github.com/DistortionPoint/dp-exchange-core/blob/v0.3.120/lib/dp_exchange/core/types/deposit_address.ex#L1)

An address to deposit an asset to, on a specific network.

## `:memo` is not optional metadata — it is part of the address

Some assets and some venues require a destination tag, memo or payment id alongside the
address. A deposit sent to the right address **without** the required memo arrives at the
venue's omnibus wallet and is not credited to anyone. Recovery is manual where it is
possible at all, and often it is not.

So `:memo_required` is carried separately from `:memo`, and the distinction matters:

  * `memo_required: true, memo: "12345"` — send it, and include the memo
  * `memo_required: false` — the network does not use one
  * **`memo_required: nil`** — the venue did not say, which is **not** the same as `false`

A package must not default `:memo_required` to `false`. "Nobody said" and "not needed" are
different facts, and the cost of confusing them is the deposit.

## `:network` is part of the identity

The same asset exists on several chains and the addresses are not interchangeable. USDC
sent to an Ethereum address over Tron is gone. An address without its network is not an
address a caller can safely use, which is why `:network` is enforced rather than optional.

# `t`

```elixir
@type t() :: %DpExchange.Core.Types.DepositAddress{
  address: String.t(),
  asset: String.t(),
  created_at: DateTime.t() | nil,
  label: String.t() | nil,
  memo: String.t() | nil,
  memo_required: boolean() | nil,
  network: String.t(),
  provider: atom()
}
```

# `new`

```elixir
@spec new(keyword() | map()) :: t()
```

Builds a `t:t/0`, failing closed if a required field is absent or `nil`.

`@enforce_keys` guards presence, not `nil` — see `DpExchange.Core.Types.Validate`.

Also raises on a blank `:asset`, `:network` or `:address`, and on a `:memo_required` that is
not `true`, `false` or `nil` (`nil` is "the venue did not say", never `false`).

---

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