Skip to main content

df_hyperliquid_core/deploy/outcomes/actions/
activate.rs

1//! `activateOutcomeDeployer`: claiming a venue name and staking HYPE for it, or giving the venue up.
2
3use crate::deploy::outcomes::actions::venue::Venue;
4use crate::utils::sign::{L1Action, Map, Value};
5
6/// `activateOutcomeDeployer`, which only the account's own key may sign, never an agent. Activating claims the
7/// venue name for good and stakes HYPE for at least 183 days; deactivating needs those days behind it and no
8/// live outcomes, and cannot be undone.
9#[derive(Debug, Clone, PartialEq, Eq)]
10#[non_exhaustive]
11pub enum ActivateOutcomeDeployer {
12    /// `{"activate":{"venueName"}}`.
13    Activate(Venue),
14    /// `{"deactivate":null}`: the key is sent, with nil.
15    Deactivate,
16}
17
18impl L1Action for ActivateOutcomeDeployer {
19    fn action(&self) -> Map {
20        let map = Map::new().put("type", "activateOutcomeDeployer");
21        match self {
22            ActivateOutcomeDeployer::Activate(venue) => {
23                map.put("activate", Map::new().put("venueName", venue.as_str().to_owned()))
24            }
25            ActivateOutcomeDeployer::Deactivate => map.put("deactivate", Value::Nil),
26        }
27    }
28}