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);