---
# System prepended metadata

title: 'POSSIBLE SOLUTION FOR REVIEW SYSTEM:'

---

Sharing Notes



# POSSIBLE SOLUTION FOR REVIEW SYSTEM: 

## Emit event on factory instead

- Easy 
- Too much work to retrieve
- Introduces dependecy on round contract to factory
- Factory gets flooeded with all events from all rounds
- fetch approved grants is a nightmare




## Fire an event for each approval / rejection

Reason to not do this:  Expensive for operator

Cost: k + unindexedBytes * a + indexedTopics * b
k = 375
a = 8
b = 375


```
contract Round{
    questionaireSchemaMetaPtr;

    function applyToRound(projectID, answerToQuestionareHash) {
        // emit APPLY with (
        //    msg.sender,
        //    projectID`, 
        //    answerToQuestionareHash
        // ) 
    }

    // To be invoked only by ROUND_OPERATOR
    function approveProjects([projectId]) {
        for (...) {
            // emit APPROVED
        }
    }

    function rejectProjects([grantId]) {
        for (...) {
            // emits REJECTED
        }
    }
}
```

### How would it work ? 
**STEP 1:** Create entity by looking at Approval Event
```
    {
        projectID : 123
        answerProtcol: 1
        answerMetaPtr: "XYZ..."
        status: pending
    }
```


**STEP 2-a:** WHEN GRAPH SEES APPROVE EVENT for project 123
    - load object 123
    - set status approved


**STEP 2-b:** WHEN GRAPH SEES REJECT for project 123
    - load object 123
    - set status reject
    - feedbackMetaPtr // NOT REQUEST




## Can subgraph fetch Data from IPFS

```
contract Round {

    // [{ question: "your name? ", type: "text" }]
    questionaireSchemaMetaPtr  
    
    // IPFS hash of =>  [
    //     "projectId": {
    //         "status": "approved/deny",
    //         "reason": "..."
    //     }
    // ]
    /// THIS IS MEANT IDEALLY TO SERVER AS READ FOR SUBGRAPH 
    grantsMetaPtr 

    

    function applyToRound(projectID, answerToQuestionareHash) {
        // emit event APPLY_TO_ROUND with (msg.sender, projectID`, answerToQuestionareHash) 
        // used to build initial index on subgraph
    }


    // invoked by round operator
    function reviewProjects(updatedIPFS) {
        // update  grantsMetaPtr with new hash
        // fire event UPDATED_GRANT_METAPTR
        // will be consumed by subgraph which in turn will fetch grantsMetaPtr -> and update entity state
    }

}
```


