mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-10 05:09:22 +00:00
Stub the genesis-liquidity pallet
This commit is contained in:
@@ -1,23 +1,38 @@
|
||||
use borsh::{BorshSerialize, BorshDeserialize};
|
||||
|
||||
use serai_primitives::{
|
||||
crypto::Signature, address::SeraiAddress, balance::ExternalBalance, genesis::GenesisValues,
|
||||
crypto::Signature, address::SeraiAddress, coin::ExternalCoin, balance::ExternalBalance,
|
||||
genesis_liquidity::GenesisValues,
|
||||
};
|
||||
|
||||
/// The address used for to hold genesis liquidity for a pool.
|
||||
pub fn address(coin: ExternalCoin) -> SeraiAddress {
|
||||
SeraiAddress::system(borsh::to_vec(&(b"GenesisLiquidity", coin)).unwrap())
|
||||
}
|
||||
|
||||
/// A call to the genesis liquidity.
|
||||
#[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)]
|
||||
pub enum Call {
|
||||
/// Oraclize the value of non-Bitcoin external coins relative to Bitcoin.
|
||||
/// Oraclize the values of the coins available on genesis, relative to BTC.
|
||||
///
|
||||
/// This will trigger the addition of the liquidity into the pools and their initialization.
|
||||
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 {
|
||||
/// Transfer genesis liquidity.
|
||||
transfer_genesis_liquidity {
|
||||
/// The account to transfer the liquidity to.
|
||||
to: SeraiAddress,
|
||||
/// The genesis liquidity to transfer.
|
||||
genesis_liquidity: ExternalBalance,
|
||||
},
|
||||
/// Remove genesis liquidity.
|
||||
remove_genesis_liquidity {
|
||||
/// The genesis liquidity to remove.
|
||||
balance: ExternalBalance,
|
||||
genesis_liquidity: ExternalBalance,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -25,7 +40,7 @@ impl Call {
|
||||
pub(crate) fn is_signed(&self) -> bool {
|
||||
match self {
|
||||
Call::oraclize_values { .. } => false,
|
||||
Call::remove_liquidity { .. } => true,
|
||||
Call::transfer_genesis_liquidity { .. } | Call::remove_genesis_liquidity { .. } => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,13 +53,22 @@ pub enum Event {
|
||||
/// The recipient of the genesis liquidity.
|
||||
recipient: SeraiAddress,
|
||||
/// The coins added as genesis liquidity.
|
||||
balance: ExternalBalance,
|
||||
genesis_liquidity: ExternalBalance,
|
||||
},
|
||||
/// Genesis liquidity added.
|
||||
GenesisLiquidityTransferred {
|
||||
/// The address transferred from.
|
||||
from: SeraiAddress,
|
||||
/// The address transferred to.
|
||||
to: SeraiAddress,
|
||||
/// The genesis liquidity transferred.
|
||||
genesis_liquidity: ExternalBalance,
|
||||
},
|
||||
/// Genesis liquidity removed.
|
||||
GenesisLiquidityRemoved {
|
||||
/// The account which removed the genesis liquidity.
|
||||
origin: SeraiAddress,
|
||||
from: SeraiAddress,
|
||||
/// The amount of genesis liquidity removed.
|
||||
balance: ExternalBalance,
|
||||
genesis_liquidity: ExternalBalance,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user