Skip to main content

approve

Contract: JBToken​‌

Interface: IJBToken

Approves an account to spend tokens on the msg.senders behalf.

Definition

function approve(
uint256 _projectId,
address _spender,
uint256 _amount
) external override { ... }
  • Arguments:
    • _projectId is the ID of the project to which the token belongs. This is ignored.
    • _spender is the address that will be spending tokens on the msg.senders behalf.
    • _amount is the amount the _spender is allowed to spend.
  • The function overrides a function definition from the IJBToken interface.
  • The function doesn't return anything.

Body

  1. Make sure the project IDs match, or this contract's project ID is 0.

    // Can't approve for a wrong project.
    if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT();

    Internal references:

  2. Forward the call to the ERC20 implementation.

    approve(_spender, _amount);

    Inherited references: