Trait tidefi_primitives::pallet::FeesExt
source · pub trait FeesExt<AccountId, BlockNumber> {
fn era_blocks_count() -> BlockNumber;
fn calculate_swap_fees(
currency_id: CurrencyId,
total_amount_before_fees: Balance,
swap_type: SwapType,
is_market_maker: bool
) -> Fee;
fn register_swap_fees(
account_id: AccountId,
currency_id: CurrencyId,
total_amount_before_fees: Balance,
swap_type: SwapType,
is_market_maker: bool
) -> Result<Fee, DispatchError>;
fn account_id() -> AccountId;
fn current_era() -> Option<ActiveEraInfo<BlockNumber>>;
}
Required Methods§
sourcefn era_blocks_count() -> BlockNumber
fn era_blocks_count() -> BlockNumber
How many block per era (Eq; sessions_per_era * block_per_sessions)
sourcefn calculate_swap_fees(
currency_id: CurrencyId,
total_amount_before_fees: Balance,
swap_type: SwapType,
is_market_maker: bool
) -> Fee
fn calculate_swap_fees(
currency_id: CurrencyId,
total_amount_before_fees: Balance,
swap_type: SwapType,
is_market_maker: bool
) -> Fee
Calculate the fee to be deposited into the account_id()
wallet
You have to reduce the amount by the returned value manually and
deposit the funds into the wallet
sourcefn register_swap_fees(
account_id: AccountId,
currency_id: CurrencyId,
total_amount_before_fees: Balance,
swap_type: SwapType,
is_market_maker: bool
) -> Result<Fee, DispatchError>
fn register_swap_fees(
account_id: AccountId,
currency_id: CurrencyId,
total_amount_before_fees: Balance,
swap_type: SwapType,
is_market_maker: bool
) -> Result<Fee, DispatchError>
Register a new swap fees associated with the account for the current era. A percentage of the network profits will be re-distributed to the account at the end of the era.
sourcefn account_id() -> AccountId
fn account_id() -> AccountId
Get the account where the Swap fees are paid
sourcefn current_era() -> Option<ActiveEraInfo<BlockNumber>>
fn current_era() -> Option<ActiveEraInfo<BlockNumber>>
Get the active era for the DEX fees