mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-17 07:26:52 +00:00
flush out
This commit is contained in:
@@ -64,6 +64,9 @@ pub const FEE_RATE_BPS: u64 = 100;
|
||||
/// Denominator for fee calculations.
|
||||
pub const DENOMINATOR_BPS: u64 = 10_000;
|
||||
|
||||
/// Window to submit hashes, in slots.
|
||||
pub const MINING_WINDOW: u64 = 1500;
|
||||
|
||||
/// Slot window size, used for sandwich resistance.
|
||||
pub const SLOT_WINDOW: u64 = 4;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ pub mod prelude {
|
||||
pub use crate::error::*;
|
||||
pub use crate::event::*;
|
||||
pub use crate::instruction::*;
|
||||
pub use crate::sdk::*;
|
||||
pub use crate::state::*;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,13 @@ pub struct Block {
|
||||
/// The authority of the miner who submitted the best hash.
|
||||
pub best_hash_miner: Pubkey,
|
||||
|
||||
/// The hash of the starting slot, used for random number generation.
|
||||
/// The slot at which the block starts trading.
|
||||
pub start_slot: u64,
|
||||
|
||||
/// The slot at which the block ends trading.
|
||||
pub end_slot: u64,
|
||||
|
||||
/// The hash of the end slot, provided by solana, used for random number generation.
|
||||
pub slot_hash: [u8; 32],
|
||||
|
||||
/// The total amount of hashpower bought in the block.
|
||||
|
||||
@@ -10,6 +10,9 @@ pub struct Config {
|
||||
// The address that can set the admin.
|
||||
pub admin: Pubkey,
|
||||
|
||||
// The block duration in slots.
|
||||
pub block_duration: u64,
|
||||
|
||||
// The address that receives fees.
|
||||
pub fee_collector: Pubkey,
|
||||
|
||||
|
||||
@@ -9,27 +9,27 @@ use super::Market;
|
||||
impl Market {
|
||||
/// Sanity check that vaults have reserves for all market debts.
|
||||
/// Assumes the token accounts have already been validated as the market's base and quote vaults.
|
||||
pub fn check_vaults(
|
||||
&self,
|
||||
base_vault: &TokenAccount,
|
||||
quote_vault: &TokenAccount,
|
||||
) -> Result<(), OreError> {
|
||||
self.check_base_vault(base_vault)?;
|
||||
self.check_quote_vault(quote_vault)?;
|
||||
Ok(())
|
||||
}
|
||||
// pub fn check_vaults(
|
||||
// &self,
|
||||
// base_vault: &TokenAccount,
|
||||
// quote_vault: &TokenAccount,
|
||||
// ) -> Result<(), OreError> {
|
||||
// self.check_base_vault(base_vault)?;
|
||||
// self.check_quote_vault(quote_vault)?;
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
/// Sanity check that base vault has reserves for all market debts.
|
||||
/// Assumes the token account has already been validated as the market's base vault.
|
||||
pub fn check_base_vault(&self, base_vault: &TokenAccount) -> Result<(), OreError> {
|
||||
if base_vault.amount() < self.base.balance {
|
||||
sol_log(&format!("A base_vault.amount: {}", base_vault.amount()));
|
||||
sol_log(&format!("A self.base.balance: {}", self.base.balance));
|
||||
sol_log("Insufficient base vault reserves");
|
||||
return Err(OreError::InsufficientVaultReserves.into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
// pub fn check_base_vault(&self, base_vault: &TokenAccount) -> Result<(), OreError> {
|
||||
// if base_vault.amount() < self.base.balance {
|
||||
// sol_log(&format!("A base_vault.amount: {}", base_vault.amount()));
|
||||
// sol_log(&format!("A self.base.balance: {}", self.base.balance));
|
||||
// sol_log("Insufficient base vault reserves");
|
||||
// return Err(OreError::InsufficientVaultReserves.into());
|
||||
// }
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
/// Sanity check that quote vault has reserves for all market debts.
|
||||
/// Assumes the token account has already been validated as the market's quote vault.
|
||||
|
||||
Reference in New Issue
Block a user