Voting power โ
Tezos is based on proof of stake, meaning that key hashes have some voting power corresponding on all the delegations these key hashes received. voting_powers
must be included in .run(...)
as described in Calls to entrypoints.
Global properties โ
Total voting power โ
sp.total_voting_power
Return the total voting power as sp.TNat of all contracts.
The total voting power coincides with the sum of the rolls count of every contract in the voting listings.
The voting listings is calculated at the beginning of every voting period.
Example โ
# type: TNat
t_voting_power = sp.total_voting_power
Operations โ
Get voting power of a specific key hash โ
sp.voting_power(key_hash)
Return the voting power of a given contract. This voting power coincides with the weight of the contract in the voting listings (i.e., the rolls count) which is calculated at the beginning of every voting period.
It expects a single argument of type sp.TKeyHash and returns the associated voting power of type sp.TNat.
Example โ
voting_power = sp.voting_power(sp.key_hash("tz1e5Ynvimf9ic6RG7YgAkQVXmdMZ3JzXdT7"))