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)]
10pub enum ActivateOutcomeDeployer {
11    /// `{"activate":{"venueName"}}`.
12    Activate(Venue),
13    /// `{"deactivate":null}`: the key is sent, with nil.
14    Deactivate,
15}
16
17impl L1Action for ActivateOutcomeDeployer {
18    fn action(&self) -> Map {
19        let map = Map::new().put("type", "activateOutcomeDeployer");
20        match self {
21            ActivateOutcomeDeployer::Activate(venue) => {
22                map.put("activate", Map::new().put("venueName", venue.as_str().to_owned()))
23            }
24            ActivateOutcomeDeployer::Deactivate => map.put("deactivate", Value::Nil),
25        }
26    }
27}