fn tally(reference_index: u64) -> Result {
        let vote = Self::votes(reference_index);
        let mut aye_count: u64 = 0;
        let mut nay_count: u64 = 0;
        match vote.vote_type {
            // normal vote tally
            0 => {
                aye_count = <VotedAccounts<T>>::get((reference_index, 0)).len() as u64;
                nay_count = <VotedAccounts<T>>::get((reference_index, 1)).len() as u64;
            }
            // lock vote tally
            // deposit amount * duration
            1 => {
                for account in <VotedAccounts<T>>::get((reference_index, 0)) {
                    let lock_vote = <LockBalance<T>>::get((reference_index, account));
                    let vote_power: u64 = lock_vote.deposit.saturated_into::<u64>() * lock_vote.duration.saturated_into::<u64>();
                    aye_count += vote_power;
                }
                for account in <VotedAccounts<T>>::get((reference_index, 0)) {
                    let lock_vote = <LockBalance<T>>::get((reference_index, account));
                    let vote_power: u64 = lock_vote.deposit.saturated_into::<u64>() * lock_vote.duration.saturated_into::<u64>();
                    nay_count += vote_power;
                }
            }
            _ => ensure!(vote.vote_type <= 1, "This vote_type is not covered."),
        }
        let mut result:Vec<u64> = Vec::new();
        result.push(aye_count);
        result.push(nay_count);
        <VoteResults>::insert(reference_index, result);
        Ok(())
    }
// only called after the vote expired
only called after the vote expired
only called after the vote expired
fn tally(reference_index: u64) -> Result {
        let vote = Self::votes(reference_index);
        let mut aye_count: u64 = 0;
        let mut nay_count: u64 = 0;
        match vote.vote_type {
            // normal vote tally
            0 => {
                aye_count = <VotedAccounts<T>>::get((reference_index, 0)).len() as u64;
                nay_count = <VotedAccounts<T>>::get((reference_index, 1)).len() as u64;
            }
            // lock vote tally
            // deposit amount * duration
            1 => {
                for account in <VotedAccounts<T>>::get((reference_index, 0)) {
                    let lock_vote = <LockBalance<T>>::get((reference_index, account));
                    let vote_power: u64 = lock_vote.deposit.saturated_into::<u64>() * lock_vote.duration.saturated_into::<u64>();
                    aye_count += vote_power;
                }
                for account in <VotedAccounts<T>>::get((reference_index, 0)) {
                    let lock_vote = <LockBalance<T>>::get((reference_index, account));
                    let vote_power: u64 = lock_vote.deposit.saturated_into::<u64>() * lock_vote.duration.saturated_into::<u64>();
                    nay_count += vote_power;
                }
            }
            _ => ensure!(vote.vote_type <= 1, "This vote_type is not covered."),
        }
        let mut result:Vec<u64> = Vec::new();
        result.push(aye_count);
        result.push(nay_count);
        <VoteResults>::insert(reference_index, result);
        Ok(())
    }
fn tally ( reference_index : u64 ) -> Result { let vote = Self :: votes ( reference_index ) ; let mut aye_count : u64 = 0 ; let mut nay_count : u64 = 0 ; match vote . vote_type { // normal vote tally 0 => { aye_count = < VotedAccounts < T > > :: get ( ( reference_index , 0 ) ) . len ( ) as u64 ; nay_count = < VotedAccounts < T > > :: get ( ( reference_index , 1 ) ) . len ( ) as u64 ; } // lock vote tally // deposit amount * duration 1 => { for account in < VotedAccounts < T > > :: get ( ( reference_index , 0 ) ) { let lock_vote = < LockBalance < T > > :: get ( ( reference_index , account ) ) ; let vote_power : u64 = lock_vote . deposit . saturated_into :: < u64 > ( ) * lock_vote . duration . saturated_into :: < u64 > ( ) ; aye_count += vote_power ; } for account in < VotedAccounts < T > > :: get ( ( reference_index , 0 ) ) { let lock_vote = < LockBalance < T > > :: get ( ( reference_index , account ) ) ; let vote_power : u64 = lock_vote . deposit . saturated_into :: < u64 > ( ) * lock_vote . duration . saturated_into :: < u64 > ( ) ; nay_count += vote_power ; } } _ => ensure ! ( vote vote_type 1 " " ) , } let mut result : Vec < u64 > = Vec :: new ( ) ; result . push ( aye_count ) ; result . push ( nay_count ) ; < VoteResults > :: insert ( reference_index , result ) ; Ok ( ( ) ) }
only called after the vote expired
only called after the vote expired
reference_index
u64
reference_index
u64