2025-02-12 03:41:50 -05:00
|
|
|
use borsh::{BorshSerialize, BorshDeserialize};
|
2024-07-19 02:30:19 +03:00
|
|
|
|
2025-02-12 03:41:50 -05:00
|
|
|
use serai_primitives::{
|
|
|
|
|
crypto::Signature, address::SeraiAddress, balance::ExternalBalance, genesis::GenesisValues,
|
|
|
|
|
};
|
2024-07-19 02:30:19 +03:00
|
|
|
|
2025-02-12 03:41:50 -05:00
|
|
|
/// A call to the genesis liquidity.
|
|
|
|
|
#[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)]
|
2024-07-19 02:30:19 +03:00
|
|
|
pub enum Call {
|
2025-02-12 03:41:50 -05:00
|
|
|
/// Oraclize the value of non-Bitcoin external coins relative to Bitcoin.
|
|
|
|
|
oraclize_values {
|
|
|
|
|
/// The values of the non-Bitcoin external coins.
|
|
|
|
|
values: GenesisValues,
|
|
|
|
|
/// The signature by the genesis validators for these values.
|
|
|
|
|
signature: Signature,
|
|
|
|
|
},
|
|
|
|
|
/// Remove liquidity.
|
|
|
|
|
remove_liquidity {
|
|
|
|
|
/// The genesis liquidity to remove.
|
|
|
|
|
balance: ExternalBalance,
|
|
|
|
|
},
|
2024-07-19 02:30:19 +03:00
|
|
|
}
|
|
|
|
|
|
2025-02-12 03:41:50 -05:00
|
|
|
impl Call {
|
|
|
|
|
pub(crate) fn is_signed(&self) -> bool {
|
|
|
|
|
match self {
|
|
|
|
|
Call::oraclize_values { .. } => false,
|
|
|
|
|
Call::remove_liquidity { .. } => true,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// An event from the genesis liquidity.
|
|
|
|
|
#[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)]
|
2024-07-19 02:30:19 +03:00
|
|
|
pub enum Event {
|
2025-02-12 03:41:50 -05:00
|
|
|
/// Genesis liquidity added.
|
|
|
|
|
GenesisLiquidityAdded {
|
|
|
|
|
/// The recipient of the genesis liquidity.
|
|
|
|
|
recipient: SeraiAddress,
|
|
|
|
|
/// The coins added as genesis liquidity.
|
|
|
|
|
balance: ExternalBalance,
|
|
|
|
|
},
|
|
|
|
|
/// Genesis liquidity removed.
|
|
|
|
|
GenesisLiquidityRemoved {
|
|
|
|
|
/// The account which removed the genesis liquidity.
|
|
|
|
|
origin: SeraiAddress,
|
|
|
|
|
/// The amount of genesis liquidity removed.
|
|
|
|
|
balance: ExternalBalance,
|
|
|
|
|
},
|
2024-07-19 02:30:19 +03:00
|
|
|
}
|