acceptsToken
Contract: JBV1TokenPaymentTerminal
Interface: IJBPaymentTerminal
- Step by step
- Code
- Bug bounty
A flag indicating if this terminal accepts the specified token.
Definition
function acceptsToken(address _token, uint256 _projectId) external view override returns (bool) { ... }
- Arguments:
_token
is the token to check if this terminal accepts or not._projectId
is the project ID to check for token acceptance.
- The view function can be accessed externally by anyone.
- The view function does not alter state on the blockchain.
- The resulting function overrides a function definition from the
IJBPaymentTerminal
interface. - The function returns the flag.
Body
-
Get a reference to the v1 project that has been attached to the specified v2 project.
// Get a reference to the V1 project for the provided project ID.
uint256 _v1ProjectId = v1ProjectIdOf[_projectId];Internal references:
-
This terminal should not accept a token if it's been explicitly set by the project, and the exchanging has not yet been finalized.
// Accept the token if it has been set and the exchange hasn't yet finalized.
return address(ticketBooth.ticketsOf(_v1ProjectId)) == _token && !finalized[_v1ProjectId];Internal references:
External references:
/**
@notice
A flag indicating if this terminal accepts the specified token.
@param _token The token to check if this terminal accepts or not.
@param _projectId The project ID to check for token acceptance.
@return The flag.
*/
function acceptsToken(address _token, uint256 _projectId) external view override returns (bool) {
_token; // Prevents unused var compiler and natspec complaints.
_projectId; // Prevents unused var compiler and natspec complaints.
// Get a reference to the V1 project for the provided project ID.
uint256 _v1ProjectId = v1ProjectIdOf[_projectId];
// Accept the token if it has been set and the exchange hasn't yet finalized.
return address(ticketBooth.ticketsOf(_v1ProjectId)) == _token && !finalized[_v1ProjectId];
}
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 |