shouldRequireClaimingFor
Contract: JBTokenStore
Interface: IJBTokenStore
- Step by step
- Code
- Errors
- Events
- Bug bounty
Allows a project to force all future mints of its tokens to be claimed into the holder's wallet, or revoke the flag if it's already set.
Only a token holder or an operator can require claimed token.
Definition
function shouldRequireClaimingFor(uint256 _projectId, bool _flag)
external
override
requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.REQUIRE_CLAIM) { ... }
- Arguments:
_projectId
is the ID of the project being affected._flag
is a flag indicating whether or not claiming should be required.
- Through the
requirePermission
modifier, the function is only accessible by the project's owner, or from an operator that has been given theJBOperations.REQUIRE_CLAIM
permission by the project owner for the provided_projectId
. - The function overrides a function definition from the
IJBTokenStore
interface. - The function doesn't return anything.
Body
-
Get a reference to the project's current token.
// Get a reference to the project's current token.
IJBToken _token = tokenOf[_projectId];Internal references:
-
Make sure the project has a token. If it doesn't, there's nowhere to claim tokens onto.
// The project must have a token contract attached.
if (_token == IJBToken(address(0))) revert TOKEN_NOT_FOUND(); -
Store the flag for the project.
// Store the flag.
requireClaimFor[_projectId] = _flag;Internal references:
-
Emit a
ShouldRequireClaim
event with the relevant parameters.emit ShouldRequireClaim(_projectId, _flag, msg.sender);
Event references:
/**
@notice
Allows a project to force all future mints of its tokens to be claimed into the holder's wallet, or revoke the flag if it's already set.
@dev
Only a token holder or an operator can require claimed token.
@param _projectId The ID of the project being affected.
@param _flag A flag indicating whether or not claiming should be required.
*/
function shouldRequireClaimingFor(uint256 _projectId, bool _flag)
external
override
requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.REQUIRE_CLAIM)
{
// Get a reference to the project's current token.
IJBToken _token = tokenOf[_projectId];
// The project must have a token contract attached.
if (_token == IJBToken(address(0))) revert TOKEN_NOT_FOUND();
// Store the flag.
requireClaimFor[_projectId] = _flag;
emit ShouldRequireClaim(_projectId, _flag, msg.sender);
}
String | Description |
---|---|
TOKEN_NOT_FOUND | Thrown if the project doesn't have a token contract attached. |
Name | Data |
---|---|
ShouldRequireClaim |
|
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 |