Last active
June 29, 2024 10:53
-
-
Save OkoliEvans/c319de4805ff4ebc4416e76bd5f5c6ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[starknet::contract] | |
mod Demo { | |
#[storage] | |
struct Storage { | |
voters: LegacyMap::<ContractAddress, Voter>, | |
} | |
#[derive(Copy, Drop, Serde, starknet::Store)] | |
struct Voter { | |
address: ContractAddress, | |
is_verified: bool, | |
voted: bool, | |
} | |
fn verify(ref self: ContractState, vote_id: u256) { | |
let caller = self.get_caller_address(); | |
let voter = Voter { address: caller, is_verified: true, voted: false, }; | |
self.voters.write(caller, voter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment