Skip to main content

currentEthOverflowOf

Contract: JBPayoutRedemptionPaymentTerminal​‌

Interface: IJBPaymentTerminal

Gets the current overflowed amount in this terminal for a specified project, in terms of ETH.

The current overflow is represented as a fixed point number with 18 decimals.

Definition

function currentEthOverflowOf(uint256 _projectId) external view override returns (uint256) { ... }
  • Arguments:
    • _projectId is the ID of the project to which the ETH overflow belongs.
  • The view function can be accessed externally by anyone.
  • The view function does not alter state on the blockchain.
  • The resulting function overrides a function definition from the IJBPaymentTerminal interface.
  • The function returns the current amount of ETH overflow that project has in this terminal, as a fixed point number with 18 decimals.

Body

  1. Get this terminal's current overflow, which is in terms of this terminal's token.

    // Get this terminal's current overflow.
    uint256 _overflow = store.currentOverflowOf(this, _projectId);

    Internal references:

    External references:

  2. If this terminal's fixed point accounting doesn't have 18 decimals, adjust the overflow to have 18 decimals.

    // Adjust the decimals of the fixed point number if needed to have 18 decimals.
    uint256 _adjustedOverflow = (decimals == 18)
    ? _overflow
    : JBFixedPointNumber.adjustDecimals(_overflow, decimals, 18);

    Library references:

  3. If this terminal's currency isn't ETH, convert the overflow to ETH. Return the 18 decimal ETH fixed point overflow value.

    // Return the amount converted to ETH.
    return
    (currency == JBCurrencies.ETH)
    ? _adjustedOverflow
    : PRBMath.mulDiv(
    _adjustedOverflow,
    10**decimals,
    prices.priceFor(currency, JBCurrencies.ETH, decimals)
    );

    Library references:

    Internal references:

    External references: