-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Module: Smart Contracts (Flare Network – Solidity)
Description:
Introduce a Status enum to clearly define the lifecycle of an issue. Update the Issue struct to use this enum and implement a function that allows authorized entities to update the status of a given issue.
✅ Tasks
1. Define the Status Enum
- Add the following enum to
GroundUpIssue.sol:
enum Status { Pending, UnderReview, Resolved, Rejected }2. Update the Issue Struct
- Replace the
statusfield type fromstringtoStatus:
Status status;- Initialize to
Status.Pendingwhen reporting an issue (reportIssue).
3. Implement updateIssueStatus Function
- Add the function:
function updateIssueStatus(uint256 _issueId, Status _newStatus) public onlyOwner // or onlyAuthorized-
Requirements:
- Ensure the issue exists.
- Update the
statusfield in the correspondingIssuestruct. - Update
latestStatusUpdateTimestamptoblock.timestamp. - Emit a
StatusUpdatedevent.
4. Declare the Event
event StatusUpdated(
uint256 indexed issueId,
Status newStatus,
address indexed updater,
uint256 timestamp
);5. Access Control
- Restrict
updateIssueStatustoonlyOwneror use a customonlyAuthorizedmodifier, if already implemented.
6. Testing
-
Unit test the following:
- Status updates work for valid issue IDs.
- The enum transitions are properly reflected in storage.
- The
StatusUpdatedevent is emitted. - Unauthorized access is prevented.
✅ Acceptance Criteria
Statusenum is defined and used in theIssuestruct.reportIssueinitializes the issue withStatus.Pending.updateIssueStatusmodifies the issue status securely and updates timestamp.- Event logs are correctly emitted.
- All logic is tested and passes.
Metadata
Metadata
Assignees
Labels
No labels