跳到主要内容

JBFundAccessLimits

Git Source

Inherits: JBControlled, IJBFundAccessLimits

Stores and manages terminal fund access limits for each project.

See the JBFundAccessLimitGroup struct to learn about payout limits and surplus allowances.

State Variables

_packedPayoutLimitsDataOf

An array of packed payout limits for a given project, ruleset, terminal, and token.

bits 0-223: The maximum amount (in a specific currency) of the terminal's tokens that the project can pay out during the ruleset.

bits 224-255: The currency that the payout limit is denominated in. If this currency is different from the terminal's token, the payout limit will vary depending on their exchange rate.

mapping(
uint256 projectId => mapping(uint256 rulesetId => mapping(address terminal => mapping(address token => uint256[])))
) internal _packedPayoutLimitsDataOf;

_packedSurplusAllowancesDataOf

An array of packed surplus allowances for a given project, ruleset, terminal, and token.

bits 0-223: The maximum amount (in a specific currency) of the terminal's tokens that the project can access from its surplus during the ruleset.

bits 224-255: The currency that the surplus allowance is denominated in. If this currency is different from the terminal's token, the surplus allowance will vary depending on their exchange rate.

mapping(
uint256 projectId => mapping(uint256 rulesetId => mapping(address terminal => mapping(address token => uint256[])))
) internal _packedSurplusAllowancesDataOf;

Functions

constructor

constructor(IJBDirectory directory) JBControlled(directory);

Parameters

NameTypeDescription
directoryIJBDirectoryA contract storing the terminals and the controller used by each project.

payoutLimitOf

A project's payout limit for a given ruleset, terminal, token, and currency.

The fixed point return amount will use the same number of decimals as the terminal.

function payoutLimitOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token,
uint256 currency
)
external
view
override
returns (uint256 payoutLimit);

Parameters

NameTypeDescription
projectIduint256The project's ID.
rulesetIduint256The ruleset's ID.
terminaladdressThe terminal the payout limit applies to.
tokenaddressThe token the payout limit applies to.
currencyuint256The currency the payout limit is denominated in.

Returns

NameTypeDescription
payoutLimituint256The payout limit, as a fixed point number with the same number of decimals as the provided terminal.

payoutLimitsOf

A project's payout limits for a given ruleset, terminal, and token.

The total value of tokens that a project can pay out from the terminal during the ruleset is dictated by a list of payout limits. Each payout limit is a fixed-point amount in terms of a currency.

The fixed point amounts returned will use the same number of decimals as the terminal.

function payoutLimitsOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token
)
external
view
override
returns (JBCurrencyAmount[] memory payoutLimits);

Parameters

NameTypeDescription
projectIduint256The project's ID.
rulesetIduint256The ruleset's ID.
terminaladdressThe terminal the payout limits apply to.
tokenaddressThe token the payout limits apply to.

Returns

NameTypeDescription
payoutLimitsJBCurrencyAmount[]The payout limits.

surplusAllowanceOf

A project's surplus allowance for a given ruleset, terminal, token, and currency.

The fixed point return amount will use the same number of decimals as the terminal.

function surplusAllowanceOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token,
uint256 currency
)
external
view
override
returns (uint256 surplusAllowance);

Parameters

NameTypeDescription
projectIduint256The project's ID.
rulesetIduint256The ruleset's ID.
terminaladdressThe terminal the surplus allowance applies to.
tokenaddressThe token the surplus allowance applies to.
currencyuint256The currency that the surplus allowance is denominated in.

Returns

NameTypeDescription
surplusAllowanceuint256The surplus allowance, as a fixed point number with the same number of decimals as the provided terminal.

surplusAllowancesOf

A project's surplus allowances for a given ruleset, terminal, and token.

The total value of tokens that a project can pay out from its surplus in a terminal during the ruleset is dictated by a list of surplus allowances. Each surplus allowance is a fixed-point amount in terms of a currency.

The fixed point amounts returned will use the same number of decimals as the terminal.

function surplusAllowancesOf(
uint256 projectId,
uint256 rulesetId,
address terminal,
address token
)
external
view
override
returns (JBCurrencyAmount[] memory surplusAllowances);

Parameters

NameTypeDescription
projectIduint256The project's ID.
rulesetIduint256The ruleset's ID.
terminaladdressThe terminal the surplus allowances apply to.
tokenaddressThe token the surplus allowances apply to.

Returns

NameTypeDescription
surplusAllowancesJBCurrencyAmount[]The surplus allowances.

setFundAccessLimitsFor

Sets limits on the amount of funds a project can access from its terminals during a ruleset.

Only a project's controller can set its fund access limits.

Payout limits and surplus allowances must be specified in strictly increasing order (by currency) to prevent duplicates.

function setFundAccessLimitsFor(
uint256 projectId,
uint256 rulesetId,
JBFundAccessLimitGroup[] calldata fundAccessLimitGroups
)
external
override
onlyControllerOf(projectId);

Parameters

NameTypeDescription
projectIduint256The ID of the project whose fund access limits are being set.
rulesetIduint256The ID of the ruleset that the limits will apply within.
fundAccessLimitGroupsJBFundAccessLimitGroup[]An array containing payout limits and surplus allowances for each payment terminal. Amounts are fixed point numbers using the same number of decimals as the associated terminal.

Errors

JBFundAccessLimits_InvalidPayoutLimitCurrencyOrdering

error JBFundAccessLimits_InvalidPayoutLimitCurrencyOrdering();

JBFundAccessLimits_InvalidSurplusAllowanceCurrencyOrdering

error JBFundAccessLimits_InvalidSurplusAllowanceCurrencyOrdering();