#[non_exhaustive]pub enum PartnerFeePolicy {
Volume {
volume_bps: u16,
recipient: Address,
},
Surplus {
surplus_bps: u16,
max_volume_bps: u16,
recipient: Address,
},
PriceImprovement {
price_improvement_bps: u16,
max_volume_bps: u16,
recipient: Address,
},
}Expand description
One typed partner-fee policy object.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Volume
Fee paid from traded volume.
Fields
Surplus
Fee paid from surplus, capped by volume.
Fields
PriceImprovement
Fee paid from price improvement, capped by volume.
Implementations§
Source§impl PartnerFeePolicy
impl PartnerFeePolicy
Sourcepub fn volume(volume_bps: u16, recipient: Address) -> Result<Self, AppDataError>
pub fn volume(volume_bps: u16, recipient: Address) -> Result<Self, AppDataError>
Creates a volume-based partner-fee policy after validating the supplied basis-point value and recipient against the published partner-fee bounds.
§Errors
Returns AppDataError::InvalidPartnerFee when volume_bps falls
outside the documented [1..=9999] range, or when recipient is the
zero address.
Sourcepub fn surplus(
surplus_bps: u16,
max_volume_bps: u16,
recipient: Address,
) -> Result<Self, AppDataError>
pub fn surplus( surplus_bps: u16, max_volume_bps: u16, recipient: Address, ) -> Result<Self, AppDataError>
Creates a surplus-based partner-fee policy after validating the supplied basis-point values and recipient against the published partner-fee bounds.
§Errors
Returns AppDataError::InvalidPartnerFee when surplus_bps falls
outside [1..=9999], when max_volume_bps falls outside [1..=9999],
or when recipient is the zero address.
Sourcepub fn price_improvement(
price_improvement_bps: u16,
max_volume_bps: u16,
recipient: Address,
) -> Result<Self, AppDataError>
pub fn price_improvement( price_improvement_bps: u16, max_volume_bps: u16, recipient: Address, ) -> Result<Self, AppDataError>
Creates a price-improvement-based partner-fee policy after validating the supplied basis-point values and recipient against the published partner-fee bounds.
§Errors
Returns AppDataError::InvalidPartnerFee when
price_improvement_bps falls outside [1..=9999], when
max_volume_bps falls outside [1..=9999], or when recipient is the
zero address.
Sourcepub const fn volume_bps(&self) -> Option<u16>
pub const fn volume_bps(&self) -> Option<u16>
Returns the volume-basis-point fee when this policy uses the volume shape.
Sourcepub fn validate(&self) -> Result<(), AppDataError>
pub fn validate(&self) -> Result<(), AppDataError>
Validates this policy against the published partner-fee schema bounds.
The bounds the reviewed schema applies:
volumeBps— integer in[1..=9999]surplusBps— integer in[1..=9999]priceImprovementBps— integer in[1..=9999]maxVolumeBps— integer in[1..=9999]recipient— non-zero 20-byte address
§Errors
Returns AppDataError::InvalidPartnerFee on the first field that
falls outside the documented bounds, or when recipient is the zero
address.
Trait Implementations§
Source§impl Clone for PartnerFeePolicy
impl Clone for PartnerFeePolicy
Source§fn clone(&self) -> PartnerFeePolicy
fn clone(&self) -> PartnerFeePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PartnerFeePolicy
impl Debug for PartnerFeePolicy
Source§impl<'de> Deserialize<'de> for PartnerFeePolicy
impl<'de> Deserialize<'de> for PartnerFeePolicy
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for PartnerFeePolicy
Source§impl From<PartnerFeePolicy> for PartnerFee
impl From<PartnerFeePolicy> for PartnerFee
Source§fn from(value: PartnerFeePolicy) -> Self
fn from(value: PartnerFeePolicy) -> Self
Source§impl PartialEq for PartnerFeePolicy
impl PartialEq for PartnerFeePolicy
Source§fn eq(&self, other: &PartnerFeePolicy) -> bool
fn eq(&self, other: &PartnerFeePolicy) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PartnerFeePolicy
impl Serialize for PartnerFeePolicy
impl StructuralPartialEq for PartnerFeePolicy
Auto Trait Implementations§
impl Freeze for PartnerFeePolicy
impl RefUnwindSafe for PartnerFeePolicy
impl Send for PartnerFeePolicy
impl Sync for PartnerFeePolicy
impl Unpin for PartnerFeePolicy
impl UnsafeUnpin for PartnerFeePolicy
impl UnwindSafe for PartnerFeePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.