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

chore: add comments #537

Merged
merged 66 commits into from
Sep 8, 2023
Merged

chore: add comments #537

merged 66 commits into from
Sep 8, 2023

Conversation

pscott
Copy link
Contributor

@pscott pscott commented Sep 7, 2023

Adding documentation comments on the most important function

fn min_voting_duration(self: @TContractState) -> u32;

/// Returns the maximum voting duration. Once this duration has elasped, a proposal
/// can be finalized. No other votes can come in.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this duration has elapsed, no additional votes can be cast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn active_voting_strategies(self: @TContractState) -> u256;

/// The next voting strategy index. Starts at 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index of the next available voting strategy. Starts at 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

///
/// * `author` - The author of the proposal.
/// * `metadata_uri` - The metadata URI of the proposal. Could be a link to a discussion page, etc.
/// * `execution_strategy` - The execution strategy of the proposal. This is the contract that will be called
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The execution strategy for the proposal, consisting of a strategy address and an execution payload.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/// * `choice` - The choice to vote for.
/// * `user_voting_strategies` - The voting strategies that the user wants to vote with. This allows to only
/// query the `user_voting_strategies` for voting power instead of iterating through all
/// allowde voting strategies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The strategies to use to compute the voter's voting power, each consisting of a strategy index and an array of user provided parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,8 +1,12 @@
use sx::utils::math;

/// An indexed strategy is used to access a strategy in an array of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A strategy identified by a unique index.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -16,15 +16,26 @@ const TWO_POWER_32: u128 = 0x100000000;
const TWO_POWER_64: u128 = 0x10000000000000000;
const TWO_POWER_96: u128 = 0x1000000000000000000000000;

/// Definition of a proposal.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data stored when a proposal is created. The proposal state at any time consists of this struct along with the corresponding for, against, and abstain vote counts. The proposal status is a function of the proposal state as defined in the execution strategy for the proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

author: UserAddress,
/// A snapshot of the active voting strategies at the time of proposal creation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit array where the index of each each bit corresponds to whether the voting strategy at that index is active at the time of proposal creation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -3,7 +3,9 @@ use starknet::{StorageBaseAddress, Store, SyscallResult};

#[derive(Clone, Drop, Option, Serde, starknet::Store)]
struct Strategy {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A strategy identified by an address

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -17,6 +20,7 @@ struct UpdateSettingsCalldata {
voting_strategies_to_remove: Array<u8>,
}

// TODO: use `Default` trait
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be done yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to but wasn't working. Will try in another PR

Copy link
Contributor

@Orland0x Orland0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uTACK

@Orland0x Orland0x merged commit a4119c3 into develop Sep 8, 2023
@Orland0x Orland0x deleted the chore_add_comments branch September 8, 2023 11:53
@pscott pscott mentioned this pull request Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants