use crate::prelude::*;
use cosmwasm_std::Event;
#[derive(Clone)]
pub struct DeltaNeutralityFeeEvent {
pub amount: Signed<Collateral>,
pub total_funds_before: Collateral,
pub total_funds_after: Collateral,
pub reason: DeltaNeutralityFeeReason,
pub protocol_amount: Collateral,
}
impl From<DeltaNeutralityFeeEvent> for Event {
fn from(src: DeltaNeutralityFeeEvent) -> Self {
Event::new("delta-neutrality-fee").add_attributes(vec![
("amount", src.amount.to_string()),
("total-funds-before", src.total_funds_before.to_string()),
("total-funds-after", src.total_funds_after.to_string()),
("reason", src.reason.as_str().to_string()),
])
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum DeltaNeutralityFeeReason {
PositionOpen,
PositionUpdate,
PositionClose,
}
impl DeltaNeutralityFeeReason {
pub const fn as_str(&self) -> &'static str {
match self {
Self::PositionOpen => "open",
Self::PositionUpdate => "update",
Self::PositionClose => "close",
}
}
}