useAllowanceOf
Contract: JBPayoutRedemptionPaymentTerminal
Interface: IJBPayoutRedemptionPaymentTerminal
- Step by step
- Code
- Bug bounty
Allows a project to send funds from its overflow up to the preconfigured allowance.
Only a project's owner or a designated operator can use its allowance.
Incurs the protocol fee.
Definition
function useAllowanceOf(
uint256 _projectId,
uint256 _amount,
uint256 _currency,
address _token,
uint256 _minReturnedTokens,
address payable _beneficiary,
string memory _memo
)
external
virtual
override
requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.USE_ALLOWANCE)
returns (uint256 netDistributedAmount) { ... }
- Arguments:
_projectId
is the ID of the project to use the allowance of._amount
is the amount of terminal tokens to use from this project's current allowance, as a fixed point number with the same amount of decimals as this terminal._currency
is the expected currency of the amount being distributed. Must match the project's current funding cycle's overflow allowance currency._token
is the token being distributed. This terminal ignores this property since it only manages one token._minReturnedTokens
is the minimum number of tokens that the_amount
should be valued at in terms of this terminal's currency, as a fixed point number with the same amount of decimals as this terminal._beneficiary
is the address to send the funds to.
- Through the
requirePermission
modifier, the function is only accessible by the project's owner, or from an operator that has been given theJBOperations.USE_ALLOWANCE
permission by the project owner for the provided_projectId
. - The function can be overriden by inheriting contracts.
- The resulting function overrides a function definition from the
IJBPayoutRedemptionPaymentTerminal
interface. - The function returns the amount of tokens that was distributed to the beneficiary, as a fixed point number with the same amount of decimals as the terminal.
Body
-
Forward to the internal function.
return _useAllowanceOf(_projectId, _amount, _currency, _minReturnedTokens, _beneficiary, _memo);
Internal references:
/**
@notice
Allows a project to send funds from its overflow up to the preconfigured allowance.
@dev
Only a project's owner or a designated operator can use its allowance.
@dev
Incurs the protocol fee.
@param _projectId The ID of the project to use the allowance of.
@param _amount The amount of terminal tokens to use from this project's current allowance, as a fixed point number with the same amount of decimals as this terminal.
@param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's overflow allowance currency.
@param _token The token being distributed. This terminal ignores this property since it only manages one token.
@param _minReturnedTokens The minimum number of tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with the same amount of decimals as this terminal.
@param _beneficiary The address to send the funds to.
@param _memo A memo to pass along to the emitted event.
@return netDistributedAmount The amount of tokens that was distributed to the beneficiary, as a fixed point number with the same amount of decimals as the terminal.)
*/
function useAllowanceOf(
uint256 _projectId,
uint256 _amount,
uint256 _currency,
address _token,
uint256 _minReturnedTokens,
address payable _beneficiary,
string memory _memo
)
external
virtual
override
requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.USE_ALLOWANCE)
returns (uint256 netDistributedAmount)
{
_token; // Prevents unused var compiler and natspec complaints.
return _useAllowanceOf(_projectId, _amount, _currency, _minReturnedTokens, _beneficiary, _memo);
}
Category | Description | Reward |
---|---|---|
Optimization | Help make this operation more efficient. | 0.5ETH |
Low severity | Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. | 1ETH |
High severity | Identify a vulnerability in this operation that could lead to data corruption or loss of funds. | 5+ETH |