Skip to content

Commit

Permalink
feat: add interface id
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnordelo committed Nov 29, 2024
1 parent cba6f8c commit 17fc3e6
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/api/governance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Interface of a governor contract.
[.contract-index]
.{inner-src5}
--
0x1
0x1100a1f8546595b5bd75a6cd8fcc5b015370655e66f275963321c5cd0357ac9
--

[.contract-index]
Expand Down
73 changes: 72 additions & 1 deletion packages/governance/src/governor/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use starknet::ContractAddress;
use starknet::account::Call;

pub const IGOVERNOR_ID: felt252 = 0x1f; // TODO: Update this value.
pub const IGOVERNOR_ID: felt252 = 0x1100a1f8546595b5bd75a6cd8fcc5b015370655e66f275963321c5cd0357ac9;

/// Interface for a contract that implements the ERC-6372 standard.
#[starknet::interface]
Expand Down Expand Up @@ -215,3 +215,74 @@ pub trait IGovernor<TState> {
/// NOTE: If the executor is simply the governor itself, use of `relay` is redundant.
fn relay(ref self: TState, call: Call);
}

pub trait IGovernor2 {
fn name() -> felt252;

fn version() -> felt252;

fn COUNTING_MODE() -> ByteArray;

fn hash_proposal(calls: Span<Call>, description_hash: felt252) -> felt252;

// fn state(proposal_id: felt252) -> ProposalState;

fn proposal_threshold() -> u256;

fn proposal_snapshot(proposal_id: felt252) -> u64;

fn proposal_deadline(proposal_id: felt252) -> u64;

fn proposal_proposer(proposal_id: felt252) -> ContractAddress;

fn proposal_eta(proposal_id: felt252) -> u64;

fn proposal_needs_queuing(proposal_id: felt252) -> bool;

fn voting_delay() -> u64;

fn voting_period() -> u64;

fn quorum(timepoint: u64) -> u256;

fn get_votes(account: ContractAddress, timepoint: u64) -> u256;

fn get_votes_with_params(
account: ContractAddress, timepoint: u64, params: Span<felt252>
) -> u256;

fn has_voted(proposal_id: felt252, account: ContractAddress) -> bool;

fn propose(calls: Span<Call>, description: ByteArray) -> felt252;

fn queue(calls: Span<Call>, description_hash: felt252) -> felt252;

fn execute(calls: Span<Call>, description_hash: felt252) -> felt252;

fn cancel(calls: Span<Call>, description_hash: felt252) -> felt252;

fn cast_vote(proposal_id: felt252, support: u8) -> u256;

fn cast_vote_with_reason(proposal_id: felt252, support: u8, reason: ByteArray) -> u256;

fn cast_vote_with_reason_and_params(
proposal_id: felt252, support: u8, reason: ByteArray, params: Span<felt252>
) -> u256;

fn cast_vote_by_sig(
proposal_id: felt252, support: u8, voter: ContractAddress, signature: Span<felt252>
) -> u256;

fn cast_vote_with_reason_and_params_by_sig(
proposal_id: felt252,
support: u8,
voter: ContractAddress,
reason: ByteArray,
params: Span<felt252>,
signature: Span<felt252>
) -> u256;

fn nonces(voter: ContractAddress) -> felt252;

fn relay(call: Call);
}

0 comments on commit 17fc3e6

Please sign in to comment.