1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Vault helpers.
use Address;
use ;
/// Derive a vault's on-chain address from its name.
///
/// Vault addresses are deterministic: the runtime seeds them with the vault
/// name (`sha256(name)`, taken as the 32-byte address) when handling
/// `CreateVault`. Computing it client-side lets you reference a vault right
/// after creating it — the trading API exposes no vault-address lookup, and
/// `CreateVault` emits no address-carrying event.
///
/// The name must match the one passed to `CreateVault` exactly (it is not
/// trimmed or normalized).
///
/// This mirrors the runtime's `generate_address_with_seed`, which lives in the
/// exchange crate (not `bullet-exchange-interface`), so there is no shared
/// source of truth to import — it's duplicated here by necessity. If the
/// runtime ever changes its seed scheme (a different hasher, a salt/prefix, or
/// name normalization), this function and its golden-vector test must be
/// updated to match.