# `Rujira.Deployments`
[🔗](https://github.com/RujiraNetwork/rujira_ex/blob/v0.0.1/lib/rujira/deployments.ex#L1)

Resolves deployed Rujira contracts from THORChain's contract-info index.

Queries `Thorchain.Types.Query.Stub.contract_infos/2` via the configured
`Rujira.Node` implementation and maps each on-chain `ContractInfo` to a
`Rujira.Deployments.Target`.

## Configuration

    config :rujira_ex,
      # Map of contract-name string -> module implementing the resource.
      # Rujira's own protocols (e.g. "rujira-fin") are mapped by default;
      # consumers add their own entries here.
      protocol_modules: %{"rujira-bow" => MyApp.Bow},

      # Addresses to exclude from the resolved target list (e.g. legacy
      # or unmaintained deployments).
      deployments_omit: []

Consumers wire up cache invalidation themselves by calling
`invalidate/0` whenever a `MsgInstantiateContract`, `MsgInstantiateContract2`
or `MsgMigrateContract` is observed.

# `contract_infos`

```elixir
@spec contract_infos() :: {:ok, [Thorchain.Types.ContractInfo.t()]} | {:error, term()}
```

# `from_address`

```elixir
@spec from_address(String.t()) ::
  {:ok, Rujira.Deployments.Target.t()} | {:error, term()}
```

# `get_target`

```elixir
@spec get_target(module()) :: Rujira.Deployments.Target.t() | nil
```

# `invalidate`

```elixir
@spec invalidate() :: :ok
```

Invalidate all memoized deployment metadata.

# `list_all_targets`

```elixir
@spec list_all_targets() :: {:ok, [Rujira.Deployments.Target.t()]} | {:error, term()}
```

# `list_targets`

```elixir
@spec list_targets(module()) :: [Rujira.Deployments.Target.t()]
```

List all targets for a given module.

---

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