Exemple #1
0
def start() -> bool:
    """Starts a new vote. Voters pool and candidates set are frozen."""
    global vote_beginning

    _assert_no_vote_started()
    vote_beginning = datetime.utcnow().timestamp()

    # Transfer one vote token to each voter.
    for address in balance_of:
        if address not in candidates and address != vote_place:
            base.transfer(balance_of, vote_place, address, 1)

    started(voters_count=get_voters_count(), candidates=candidates)
    return True
Exemple #2
0
def transfer(to_address: str, amount: int) -> bool:
    """Execute a transfer from the sender to the specified address."""
    return base.transfer(balance_of, context.sender, to_address, amount)