pub struct CollateralMarginSetParams {
pub margin_bp: u64,
}Expand description
control.collateral.margin.set params.
Fields§
§margin_bp: u64The margin in BASIS POINTS over the requirement (100 is +1%), at most
MAX_SAFETY_MARGIN_BP.
Basis points, never a percentage and never a float: it is the unit
dig_mirror_collateral::apply_safety_margin takes and the unit dig-app SPEC.md §3.7b
fixes for collateral.margin_bp. A 1 bp margin (0.01%) is a legal choice and any conversion
to whole percent would erase it.
Implementations§
Source§impl CollateralMarginSetParams
impl CollateralMarginSetParams
Sourcepub fn validated(self) -> Result<Self, ControlError>
pub fn validated(self) -> Result<Self, ControlError>
Refuse a margin above MAX_SAFETY_MARGIN_BP as -32602 INVALID_PARAMS.
Refused rather than clamped, and the asymmetry with dig-app is deliberate. dig-app CLAMPS a
stored margin that exceeds its own ceiling, because refusing a value already on disk would
leave the node posting the lower amount it was trying to move away from. This is the
opposite situation: a caller is stating an intent right now, and silently applying a
different number than the one requested would make a subsequent
CollateralMarginResult disagree with what the
caller believes it set — on the money path.
Trait Implementations§
Source§impl Clone for CollateralMarginSetParams
impl Clone for CollateralMarginSetParams
Source§fn clone(&self) -> CollateralMarginSetParams
fn clone(&self) -> CollateralMarginSetParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more