Skip to content

Commit ca58848

Browse files
author
Collins C Augustine
committed
feat: integrity voting impl, struct & storage var
1 parent 274424d commit ca58848

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

contract_/src/BigIncGenesis.cairo

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ pub trait IBigIncGenesis<TContractState> {
6565
fn get_withdrawal_request(self: @TContractState, request_id: u256) -> WithdrawalRequest;
6666
fn get_vote_status(self: @TContractState, request_id: u256) -> VoteStatus;
6767
fn get_governance_parameters(self: @TContractState) -> (u256, u256);
68+
69+
/////////////////////////////////////////////////////////
70+
///////////////////Integrety Voting//////////////////////
71+
/////////////////////////////////////////////////////////
72+
fn trigger_integrity_vote(ref self: ContractState, request_id: u256);
73+
fn vote_on_integrity(ref self: ContractState, request_id: u256, met_expectation: bool);
74+
fn finalize_integrity_vote(ref self: ContractState, request_id: u256);
75+
fn get_integrity_vote_status(ref self: ContractState, request_id: u256)
76+
77+
///// View Functions //////
78+
fn get_artist_reputation_score(self: ContractState, artist: ContractAddress) -> u64;
79+
fn get_artist_reputation_info(self: ContractState, request_id: u256, artist: ContractAddress) -> ReputationInfo;
6880
}
6981

7082
#[derive(Drop, Serde, starknet::Store)]
@@ -91,6 +103,27 @@ pub struct VoteStatus {
91103
pub voting_ended: bool,
92104
}
93105

106+
/////////////for integrity vote/////////////
107+
#[derive(Copy, Drop, Serde, starknet::Store)]
108+
pub struct IntegrityVoteStatus {
109+
pub is_vote_triggered: bool,
110+
pub total_vote_met: u256,
111+
pub total_vote_not_reached: u256,
112+
pub total_vote_power: u256,
113+
pub quorum_reached: bool,
114+
pub expectation_met: bool,
115+
pub is_vote_ended: bool,
116+
pub vote_ended: u64
117+
}
118+
119+
#[derive(Copy, Drop)]
120+
pub struct ReputationInfo {
121+
pub artist_reputation_score: u64,
122+
pub total_request: u256,
123+
pub successful_deliveries: u256,
124+
pub failed_deliveries: u256
125+
}
126+
94127
#[starknet::contract]
95128
pub mod BigIncGenesis {
96129
use core::pedersen;
@@ -160,6 +193,19 @@ pub mod BigIncGenesis {
160193
vote_choices: Map<(u256, ContractAddress), bool>, // (request_id, voter) -> vote_choice
161194
quorum_percentage: u256, // percentage of total shares needed for quorum (e.g., 50 = 50%)
162195
voting_period_days: u256 // number of days for voting period (e.g., 2 = 2 days)
196+
197+
////////////integrety voting////////////
198+
integrity_vote_trigered: Map<u256, bool>, //request_id -> has integrity vote began(true or false)
199+
integrity_vote_deadline: Map<u256, u64>, // request_id -> when triggered integrity vote ends
200+
integrity_votes: Map<(u256, ContractAddress), bool>, // (request_id & voter) -> has voted on integrity
201+
integrity_vote_choice: Map<(u256, ContractAddress), bool> // (request_id, voter) -> met expectation (true or false)
202+
integrity_voter: Map<(u256, ContractAddress), IntegrityVoteStatus> // (request_id, voter) -> integrity vote status
203+
integrity_vote_days: u256, // configuration days for integrity vote
204+
205+
////////// reputation/accountability tracking ////////////
206+
artist_reputation_score: Map<ContractAddress, u64>,
207+
failed_deliveries: Map<ContractAddress, u256>,
208+
successful_deliveries: Map<ContractAddress, u256>,
163209
}
164210

165211
#[event]
@@ -914,6 +960,17 @@ pub mod BigIncGenesis {
914960
fn get_governance_parameters(self: @ContractState) -> (u256, u256) {
915961
(self.quorum_percentage.read(), self.voting_period_days.read())
916962
}
963+
964+
965+
966+
/////////////////////////////////////////////////////////
967+
///////////////////Integrety Voting Implementation//////////////////////
968+
/////////////////////////////////////////////////////////
969+
970+
fn integrety_vote(ref sef: ContractState, vote_id: u64, voter: ContractAddress, vote_cast: bool) -> bool {
971+
972+
}
973+
917974
}
918975

919976
#[generate_trait]

0 commit comments

Comments
 (0)