Skip to main content

distributionLimitOf

Contract: JBController​‌

Interface: IJBController

The amount of token that a project can distribute per funding cycle, and the currency it's in terms of.

The number of decimals in the returned fixed point amount is the same as that of the specified terminal.

Definition

function distributionLimitOf(
uint256 _projectId,
uint256 _configuration,
IJBPaymentTerminal _terminal,
address _token
) external view override returns (uint256, uint256) { ... }
  • Arguments:
  • _projectId is the ID of the project to get the distribution limit of.
  • _configuration is the configuration during which the distribution limit applies.
  • _terminal is the IJBPaymentTerminal from which distributions are being limited.
  • _token is the token for which the distribution limit applies.
  • 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:
    • distributionLimit is the distribution limit, as a fixed point number with the same number of decimals as the provided terminal.
    • distributionLimitCurrency is the currency from JBCurrencies that the returned distribution limit is in terms of.

Body

  1. Get a reference to the packed distribution limit data.

    // Get a reference to the packed data.
    uint256 _data = _packedDistributionLimitDataOf[_projectId][_configuration][_terminal][_token];

    Internal references:

  2. Return the distribution limit, which is in the first 248 bits, and the currency the distribution limit is in terms of, which is in the last 8 bits.

    // The limit is in bits 0-231. The currency is in bits 232-255.
    return (uint256(uint232(_data)), _data >> 232);