setV1ProjectId
Contract: JBV1TokenPaymentTerminal
Interface: IJBV1TokenPaymentTerminal
- Step by step
- Code
- Errors
- Events
- Bug bounty
Allows a project owner to initialize the acceptance of a v1 project's tokens in exchange for its v2 project token.
Definition
function setV1ProjectId(uint256 _projectId, uint256 _v1ProjectId) external override { ... }
- Arguments:
_projectId
is the ID of the v2 project to set a v1 project ID for._v1ProjectId
is the ID of the v1 project to set.
- The function can be accessed externally by anyone.
- The resulting function overrides a function definition from the
IJBV1TokenPaymentTerminal
interface. - The function doesn't return anything.
Body
-
Make sure the v1 project and v2 project have the same owner.
// Can't set the v1 project ID if it isn't owned by the same address who owns the v2 project.
if (
msg.sender != projects.ownerOf(_projectId) ||
msg.sender != ticketBooth.projects().ownerOf(_v1ProjectId)
) revert NOT_ALLOWED();Internal references:
External references:
-
Set the v1 project ID.
// Store the mapping.
v1ProjectIdOf[_projectId] = _v1ProjectId;Internal references:
-
Emit a
SetV1ProjectId
event with the relevant parameters.emit SetV1ProjectId(_projectId, _v1ProjectId, msg.sender);
Event references:
/**
@notice
Allows a project owner to initialize the acceptance of a v1 project's tokens in exchange for its v2 project token.
@dev
Only a project owner can initiate token migration.
@param _projectId The ID of the v2 project to set a v1 project ID for.
@param _v1ProjectId The ID of the v1 project to set.
*/
function setV1ProjectId(uint256 _projectId, uint256 _v1ProjectId) external override {
// Can't set the v1 project ID if it isn't owned by the same address who owns the v2 project.
if (
msg.sender != projects.ownerOf(_projectId) ||
msg.sender != ticketBooth.projects().ownerOf(_v1ProjectId)
) revert NOT_ALLOWED();
// Store the mapping.
v1ProjectIdOf[_projectId] = _v1ProjectId;
emit SetV1ProjectId(_projectId, _v1ProjectId, msg.sender);
}
String | Description |
---|---|
NOT_ALLOWED | Thrown if the v1 and v2 project's don't have the same owner. |
Name | Data |
---|---|
SetV1ProjectId |
|
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 |