Skip to content

Commit

Permalink
Merge branch 'feat/governance2-#294' of github.com:ericnordelo/cairo-…
Browse files Browse the repository at this point in the history
…contracts into feat/governance2-#294
  • Loading branch information
ericnordelo committed Nov 12, 2024
2 parents 1be0449 + 0152aa9 commit 502389f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions packages/governance/src/governor/governor.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ pub mod GovernorComponent {
GovernorSettings::voting_period(self)
}

/// Minimum number of cast voted required for a proposal to be successful.
/// Minimum number of casted votes required for a proposal to be successful.
///
/// NOTE: The `timepoint` parameter corresponds to the snapshot used for counting vote. This
/// allows to scale the quorum depending on values such as the total supply of a token at
/// NOTE: The `timepoint` parameter corresponds to the snapshot used for counting votes. This
/// allows the quorum to scale depending on values such as the total supply of a token at
/// this timepoint.
fn quorum(self: @ComponentState<TContractState>, timepoint: u64) -> u256 {
GovernorQuorum::quorum(self, timepoint)
Expand Down Expand Up @@ -400,7 +400,7 @@ pub mod GovernorComponent {
GovernorCounting::has_voted(self, proposal_id, account)
}

/// Creates a new proposal. Vote start after a delay specified by `voting_delay` and
/// Creates a new proposal. Voting starts after the delay specified by `voting_delay` and
/// lasts for a duration specified by `voting_period`. Returns the id of the proposal.
///
/// This function has opt-in frontrunning protection, described in
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/governor/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub trait IGovernor<TState> {
/// Minimum number of cast voted required for a proposal to be successful.
///
/// NOTE: The `timepoint` parameter corresponds to the snapshot used for counting vote. This
/// allows to scale the quorum depending on values such as the total supply of a token at this
/// allows the quorum to scale depending on values such as the total supply of a token at this
/// timepoint.
fn quorum(self: @TState, timepoint: u64) -> u256;

Expand Down Expand Up @@ -206,7 +206,7 @@ pub trait IGovernor<TState> {
///
/// In cases where the governance executor is some contract other than the governor itself, like
/// when using a timelock, this function can be invoked in a governance proposal to recover
/// tokens that was sent to the governor contract by mistake.
/// tokens that were sent to the governor contract by mistake.
///
/// NOTE: If the executor is simply the governor itself, use of `relay` is redundant.
fn relay(ref self: TState, call: Call);
Expand Down
16 changes: 8 additions & 8 deletions packages/governance/src/governor/proposal_core.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ const _1_BIT_MASK: u256 = 0x1;
///
/// The packing is done as follows:
///
/// - The first felt of the tuple contains `proposer` serialized.
/// - The second felt of the tuple contains `vote_start`, `vote_duration`, `executed`, `canceled`
/// and `eta_seconds` organized as presented next.
/// - `vote_start` is stored at range [4,67] bits (0-indexed), taking the most significant usable
/// 1. The first felt of the tuple contains `proposer` serialized.
/// 2. The second felt of the tuple contains `vote_start`, `vote_duration`, `executed`, `canceled`
/// and `eta_seconds` organized as:
/// - `vote_start` is stored at range [4,67] bits (0-indexed), taking the most significant usable
/// bits.
/// - `vote_duration` is stored at range [68, 131], following `vote_start`.
/// - `executed` is stored at range [132, 132], following `vote_duration`.
/// - `canceled` is stored at range [133, 133], following `executed`.
/// - `eta_seconds` is stored at range [134, 197], following `canceled`.
/// - `vote_duration` is stored at range [68, 131], following `vote_start`.
/// - `executed` is stored at range [132, 132], following `vote_duration`.
/// - `canceled` is stored at range [133, 133], following `executed`.
/// - `eta_seconds` is stored at range [134, 197], following `canceled`.
///
/// NOTE: In the second felt252, the first four bits are skipped to avoid representation errors due
/// to `felt252` max value being a bit less than a 252 bits number max value
Expand Down

0 comments on commit 502389f

Please sign in to comment.