pub struct PoolFee {
pub protocol_fee: Fee,
pub swap_fee: Fee,
pub burn_fee: Fee,
pub extra_fees: Vec<Fee>,
}Expand description
Represents the fee structure for transactions within a pool.
§Fields
protocol_fee: The fee percentage charged by the protocol on each transaction to support operational and developmental needs.swap_fee: The fee percentage allocated to liquidity providers as a reward for supplying liquidity to the pool, incentivizing participation and ensuring pool health.burn_fee: A fee percentage that is burned on each transaction, helping manage the token economy by reducing supply over time, potentially increasing token value.extra_fees: A vector of custom fees allowing for extensible and adaptable fee structures to meet diverse and evolving needs. Validation ensures that the total of all fees does not exceed 100%, maintaining fairness and avoiding overcharging.
Fields§
§protocol_fee: FeeFee percentage charged on each transaction for the protocol’s benefit.
swap_fee: FeeFee percentage allocated to liquidity providers on each swap.
burn_fee: FeeFee percentage that is burned on each transaction. Burning a portion of the transaction fee helps in reducing the overall token supply.
extra_fees: Vec<Fee>A list of custom, additional fees that can be defined for specific use cases or additional functionalities. This vector enables the flexibility to introduce new fees without altering the core fee structure. Total of all fees, including custom ones, is validated to not exceed 100%, ensuring a balanced and fair fee distribution.
Implementations§
Source§impl PoolFee
impl PoolFee
Sourcepub fn is_valid(&self) -> StdResult<()>
pub fn is_valid(&self) -> StdResult<()>
Validates the PoolFee structure to ensure the sum of all fees does not exceed 20%.
Sourcepub fn compute_and_apply_fees(&self, amount: Uint256) -> StdResult<Uint128>
pub fn compute_and_apply_fees(&self, amount: Uint256) -> StdResult<Uint128>
Computes and applies all defined fees to a given amount. Returns the total amount of fees deducted.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PoolFee
impl<'de> Deserialize<'de> for PoolFee
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>,
Source§impl JsonSchema for PoolFee
impl JsonSchema for PoolFee
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for PoolFee
Auto Trait Implementations§
impl Freeze for PoolFee
impl RefUnwindSafe for PoolFee
impl Send for PoolFee
impl Sync for PoolFee
impl Unpin for PoolFee
impl UnwindSafe for PoolFee
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more