DpExchange.Core.Types.DepositAddress (DpExchangeCore v0.3.22)

Copy Markdown View Source

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.

Summary

Functions

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

Types

t()

@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()
}

Functions

new(attrs)

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

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

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