Update Notifier

Complete Flow Influence

Explanations

This Clarity smart contract allows for the updating of a notifier through an election vote using a threshold, where each participant can vote only once. The contract starts by checking if the vote for the notifier is already active and sets the start and end block height for the voting period. If one miner meets the threshold while voting, the voting ends and it is elected as the new notifier. Once the voting period ends, the contract computes the maximum votes received by each proposed notifier, and if a proposed notifier receives more than half the votes, it is selected as the new notifier. The contract also deletes all previous entries for the voting period and sets the notifier-previous-entries-removed flag to true. Participants can vote for a notifier using the vote-notifier function, which checks for voting permission, whether the vote is within the voting period, and if the participant has already voted. The contract also includes election functions for accepting and rejecting votes based on the threshold and number of voters.

Smart Contract

Last updated