Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #12

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions packages/foundry/src/Notes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ contract Notes {
/// @dev The amount of different ratoings for a specific note
mapping(address contractAddress => mapping(uint16 index => mapping(CNDataTypes.Rating rating => uint32 amount))) public amountOfRating;

/// @dev store score info
mapping(address contractAddress => mapping(uint16 index => CNDataTypes.NoteScore scoreInfo)) public scoreInfoOf;

/// @dev The rating weight of a user
mapping(address user => mapping(CNDataTypes.Rating => uint40 amount)) public ratingWeightOf;

Expand All @@ -88,9 +85,9 @@ contract Notes {
*
* @param _useWorldId a boolan if we are using worldcoin id or not
* @param _worldId address of worldå
* @param _appId
* @param _noteId
* @param _voteId
* @param _appId worldcoin app id as string
* @param _noteId worldcoin action id for note
* @param _voteId worldcoin action id for vote
*
*/
constructor(
Expand Down Expand Up @@ -164,7 +161,7 @@ contract Notes {
});

// Notescore variable
CNDataTypes.NoteScore score = CNDataTypes.NoteScore({
CNDataTypes.NoteScore memory score = CNDataTypes.NoteScore({
score: 0,
consideredHelpful: false
});
Expand Down Expand Up @@ -268,7 +265,7 @@ contract Notes {
}

// Set the score info to the note
scoreInfoOf[_contractAddress][_noteIndex] = newScore;
scoresOf[_contractAddress][_noteIndex] = newScore;

// Toggle the voted on note stattus for user
userVotedOnNote[msg.sender][_contractAddress][_noteIndex] = true;
Expand Down Expand Up @@ -325,8 +322,14 @@ contract Notes {
* @return _notes array of notes associated with contract
*
*/
function retrieveContractNotes(address _contractAddress) external view returns (CNDataTypes.Note[] memory _notes) {
function retrieveContractNotes(address _contractAddress) external view returns (
CNDataTypes.Note[] memory _notes,
CNDataTypes.NoteScore[] memory _scores
) {
// retrieve notes
_notes = notesOf[_contractAddress];

// Retrieve score
_scores = scoresOf[_contractAddress];
}
}
2 changes: 1 addition & 1 deletion packages/foundry/src/interfaces/IWorldID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.26;
interface IWorldID {
/// @notice Reverts if the zero-knowledge proof is invalid.
/// @param root The of the Merkle tree
/// @param groupId The id of the Semaphore group
// @param groupId The id of the Semaphore group
/// @param signalHash A keccak256 hash of the Semaphore signal
/// @param nullifierHash The nullifier hash
/// @param externalNullifierHash A keccak256 hash of the external nullifier
Expand Down
Loading