Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoAcosta committed Oct 12, 2024
1 parent 6d7d072 commit 68428a9
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@
Each question contract has a `getQuestionView(address user)` function that returns a `QuestionView` struct. This struct contains all the information about the question and the user's voting status.
It includes an array of `OptionView` structs, which contain information about each option.

```solidity
/// @notice Get a comprehensive view of the question for a specific user
/// @param user The address of the user to get the view for
/// @return A QuestionView struct with all question details
function getQuestionView(address user) external view returns (QuestionView memory);
```

```solidity
/// @dev Represents a comprehensive view of a question with all its details
struct QuestionView {
QuestionType questionType; // The type of question (Fixed or Open), set in the constructor of OpenQuestion or FixedQuestion
string title; // The title of the question, can be updated with Question.updateTitle()
string description; // The description of the question, can be updated with Question.updateDescription()
uint256 deadline; // The voting deadline, can be updated with Question.updateDeadline()
uint256 totalVoteCount; // The total number of votes across all options, calculated in Question.getQuestionView()
OptionView[] options; // Array of all voting options with their details, populated in Question.getQuestionView()
Status status; // The current status of the question (Active or Ended), determined by Question.getStatus()
address owner; // The owner of the question contract, set in the constructor and managed by Ownable
uint256 started; // The timestamp when the question was deployed, set in the Question constructor
uint256 userOptionVoted; // The option ID the user voted for (0 if not voted), set in Question.getQuestionView()
uint256 userPointsCurrent; // The user's current point balance, retrieved from the Points contract
uint256 userPointsDeadline; // The user's point balance at the voting deadline, retrieved from the Points contract
QuestionType questionType; // The type of question (Fixed or Open)
string title; // The title of the question
string description; // The description of the question
uint256 deadline; // The voting deadline
uint256 totalVoteCount; // The total number of votes across all options
OptionView[] options; // Array of all voting options with their details
Status status; // The current status of the question (Active or Ended)
address owner; // The owner of the question contract
uint256 started; // The timestamp when the question was deployed
uint256 userOptionVoted; // The option ID the user voted for (0 if not voted)
uint256 userPointsCurrent; // The user's current point balance
uint256 userPointsDeadline; // The user's point balance at the voting deadline
bool userCanAddOption; // Whether the user can add a new option (always false for FixedQuestion, conditional for OpenQuestion)
}
```
Expand Down

0 comments on commit 68428a9

Please sign in to comment.