Skip to main content

processFees

Contract: JBPayoutRedemptionPaymentTerminal​‌

Interface: IJBPayoutRedemptionPaymentTerminal

Process any fees that are being held for the project.

Only a project owner, an operator, or the contract's owner can process held fees.

Definition

function processFees(uint256 _projectId)
external
virtual
override
requirePermissionAllowingOverride(
projects.ownerOf(_projectId),
_projectId,
JBOperations.PROCESS_FEES,
msg.sender == owner()
)
nonReentrant { ... }
  • Arguments:
    • _projectId is the ID of the project whos held fees should be processed.
  • Through the requirePermissionAllowingOverride modifier, the function is only accessible by the project's owner, from an operator that has been given the JBOperations.PROCESS_FEES permission by the project owner for the provided _projectId, or from the owner of this contract.
  • The function can be overriden by inheriting contracts.
  • The function cannot be accessed recursively or while other nonReentrant functions in this contract are in progress.
  • The resulting function overrides a function definition from the IJBPayoutRedemptionPaymentTerminal interface.
  • The function doesn't return anything.

Body

  1. Get a reference to all held fees for the project.

    // Get a reference to the project's held fees.
    JBFee[] memory _heldFees = _heldFeesOf[_projectId];

    Internal references:

  2. Remove all fees.

    // Delete the held fee's now that they've been processed.
    delete _heldFeesOf[_projectId];

    Internal references:

  3. Iterate through the array. Take fee's for each JBFee data structure. Emit a ProcessFee event with the relevant parameters for each fee processed.

    // Push array length in stack
    uint256 _heldFeeLength = _heldFees.length;

    // Process each fee.
    for (uint256 _i; _i < _heldFeeLength; ) {
    // Get the fee amount.
    uint256 _amount = _feeAmount(
    _heldFees[_i].amount,
    _heldFees[_i].fee,
    _heldFees[_i].feeDiscount
    );

    // Process the fee.
    _processFee(_amount, _heldFees[_i].beneficiary);

    emit ProcessFee(_projectId, _amount, _heldFees[_i].beneficiary, msg.sender);

    unchecked {
    ++_i;
    }
    }

    Internal references:

    Event references: