Skip to main content

_feeAmount

Contract: JBPayoutRedemptionPaymentTerminal​‌

Returns the fee amount based on the provided amount for the specified project.

Definition

function _feeAmount(
uint256 _amount,
uint256 _fee,
uint256 _feeDiscount
) private pure returns (uint256) { ... }
  • Arguments:
    • _amount is the amount that the fee is based on, as a fixed point number with the same amount of decimals as this terminal.
    • _fee is the percentage of the fee, out of MAX_FEE.
    • _feeDiscount is the percentage discount that should be applied out of the max amount, out of MAX_FEE_DISCOUNT.
  • The view function is private to this contract.
  • The view function does not alter state on the blockchain.
  • The function returns the amount of the fee, as a fixed point number with the same amount of decimals as this terminal.

Body

  1. Calculate the discounted fee by subtracting the discount from the fee.

    // Calculate the discounted fee.
    uint256 _discountedFee = _fee -
    PRBMath.mulDiv(_fee, _feeDiscount, JBConstants.MAX_FEE_DISCOUNT);

    Library references:

  2. Return the amount of tokens from the specified amount that should be paid as a fee.

    // The amount of tokens from the `_amount` to pay as a fee.
    return
    _amount - PRBMath.mulDiv(_amount, JBConstants.MAX_FEE, _discountedFee + JBConstants.MAX_FEE);

    Library references: