跳到主要内容

totalSupplyOf

Contract: JBTokenStore​‌

Interface: IJBTokenStore

The total supply of tokens for each project, including claimed and unclaimed tokens.

Definition

function totalSupplyOf(uint256 _projectId) external view override returns (uint256 totalSupply) { ... }
  • Arguments:
    • _projectId is the ID of the project to get the total token supply of.
  • 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 IJBTokenStore interface.
  • The function returns the total supply of the project's tokens.

Body

  1. Get a reference to the total supply of the project's unclaimed tokens.

    // Get a reference to the total supply of the project's unclaimed tokens. Assign it to the return value.
    totalSupply = unclaimedTotalSupplyOf[_projectId];

    Internal references:

  2. Get a reference to the project's current token.

    // Get a reference to the project's current token.
    IJBToken _token = tokenOf[_projectId];

    Internal references:

  3. If the project has a current token, add its total supply to the total.

    // If the project has a current token, add its total supply to the total.
    if (_token != IJBToken(address(0))) totalSupply = totalSupply + _token.totalSupply(_projectId);

    External references: