Skip to main content

totalOutstandingTokensOf

Contract: JBController​‌

Interface: IJBController

Gets the current total amount of outstanding tokens for a project, given a reserved rate.

Definition

function totalOutstandingTokensOf(uint256 _projectId, uint256 _reservedRate)
external
view
override
returns (uint256) { ... }
  • Arguments:
    • _projectId is the ID of the project to get total outstanding tokens of.
    • _reservedRate is the reserved rate to use when making the calculation.
  • The view function can be accessed externally by anyone.
  • The view function does not alter state on the blockchain.
  • The function overrides a function definition from the IJBController interface.
  • The function returns the current total amount of outstanding tokens for the project.

Body

  1. Get the total supply of tokens in circulation.

    // Get the total number of tokens in circulation.
    uint256 _totalSupply = tokenStore.totalSupplyOf(_projectId);

    Internal references:

    External references:

  2. Get the number of outstanding reserved tokens the project has given the provided reserved rate.

    // Get the number of reserved tokens the project has.
    uint256 _reservedTokenAmount = _reservedTokenAmountFrom(
    _processedTokenTrackerOf[_projectId],
    _reservedRate,
    _totalSupply
    );

    Internal references:

  3. Return the sum of the total supply and the reserved tokens.

    // Add the reserved tokens to the total supply.
    return _totalSupply + _reservedTokenAmount;