Election
Celo0x8d6677192144292870907e3fa8a5527fe55a7ff6
Proxy 實作合約: 0xbd7d392bb2ef07063256e875f363d4fb2931780e
Solidity v0.5.13+commit.5b0b510c
概覽
讀取函式
Check whether the given address is allowed to vote even if it has reached the maximum number of groups.✨ AI
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True if the address is permitted to vote despite reaching the max groups; false otherwise.✨ AI |
Return the cached vote count for the specified account.✨ AI
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| totalVotes | uint256 | Total cached votes for the account as a uint256.✨ AI |
Returns whether or not a group can receive the specified number of votes.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the group. |
| value | uint256 | The number of votes. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | Whether or not a group can receive the specified number of votes. |
Checks a BLS proof of possession.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| sender | address | The address signed by the BLS key to generate the proof of possession. |
| blsKey | bytes | The BLS public key that the validator is using for consensus, should pass proof of possession. 48 bytes. |
| blsPop | bytes | The BLS public key proof-of-possession, which consists of a signature on the account address. 96 bytes. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Selects and returns a set of validator addresses within the requested size bounds.✨ AI
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| minElectableValidators | uint256 | Minimum number of validator accounts to select.✨ AI |
| maxElectableValidators | uint256 | Maximum number of validator accounts to select.✨ AI |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | Array of elected validator addresses; length will be between minElectableValidators and maxElectableValidators inclusive.✨ AI |
Return a list of validator signer addresses elected between the provided min and max bounds.✨ AI
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| minElectableValidators | uint256 | Minimum number of validators to elect (inclusive).✨ AI |
| maxElectableValidators | uint256 | Maximum number of validators to elect (inclusive).✨ AI |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | Array of elected validator signer addresses, with length between minElectableValidators and maxElectableValidators.✨ AI |
Returns a list of elected validators with seats allocated to groups via the D'Hondt method.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | The list of elected validators. |
Returns a list of elected validator signers with seats allocated to groups via the D'Hondt method.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | The list of elected validator signers. |
Returns the current numeric threshold a candidate must meet to be eligible for election.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| value | uint256 | The electability threshold as an unsigned integer (units depend on contract context, e.g., votes or token balance).✨ AI |
Returns the current minimum and maximum numbers of validators eligible for election.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| min | uint256 | min: the minimum number of validators that can be elected✨ AI |
| max | uint256 | max: the maximum number of validators that can be elected✨ AI |
calculate a * b^x for fractions a, b to `decimals` precision
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| aNumerator | uint256 | Numerator of first fraction |
| aDenominator | uint256 | Denominator of first fraction |
| bNumerator | uint256 | Numerator of exponentiated fraction |
| bDenominator | uint256 | Denominator of exponentiated fraction |
| exponent | uint256 | exponent to raise b to |
| _decimals | uint256 | precision |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Numerator of the computed quantity (not reduced). |
| — | uint256 | Denominator of the computed quantity (not reduced). |
Returns the total active vote units made for `group`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The total active vote units made for `group`. |
Returns the active vote units for `group` made by `account`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
| account | address | The address of the voting account. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The active vote units for `group` made by `account`. |
Returns the active votes received across all groups.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The active votes received across all groups. |
Returns the active votes made for `group`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The active votes made for `group`. |
Returns the active votes for `group` made by `account`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
| account | address | The address of the voting account. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The active votes for `group` made by `account`. |
Parses block number out of header.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| header | bytes | RLP encoded header |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Block number. |
Returns the address of the contract imposing the block.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| blockedBy | address |
Returns get current validator signers using the precompiles.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | List of current validator signers. |
Gets the election threshold.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Threshold value as unwrapped fraction. |
Returns the minimum and maximum number of validators that can be elected.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The minimum number of validators that can be elected. |
| — | uint256 | The maximum number of validators that can be elected. |
Returns the list of validator groups eligible to elect validators.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | The list of validator groups eligible to elect validators. |
Returns the epoch number at a block.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Current epoch number. |
Returns the epoch number at a block.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| blockNumber | uint256 | Block number where epoch number is calculated. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Epoch number. |
Returns the current epoch size in blocks.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The current epoch size in blocks. |
Returns whether or not a group is eligible to receive votes.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | Whether or not a group is eligible to receive votes. |
Returns the amount of rewards that voters for `group` are due at the end of an epoch.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The group to calculate epoch rewards for. |
| totalEpochRewards | uint256 | The total amount of rewards going to all voters. |
| groupScore | uint256 | The score of the group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The amount of rewards that voters for `group` are due at the end of an epoch. |
Returns the groups that `account` has voted for.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| account | address | The address of the account casting votes. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address[] | The groups that `account` has voted for. |
Returns the number of votes that a group can receive.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The number of votes that a group can receive. |
Gets the parent seal bitmap from the header at the given block number.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| blockNumber | uint256 | Block number to retrieve. Must be within 4 epochs of the current number. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bytes32 | Bitmap parent seal with set bits at indices corresponding to signing validators. |
Returns the pending votes made for `group`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The pending votes made for `group`. |
Returns the pending votes for `group` made by `account`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
| account | address | The address of the voting account. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The pending votes for `group` made by `account`. |
Returns the total votes received across all groups.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The total votes received across all groups. |
Returns the total number of votes cast by an account.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| account | address | The address of the account. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The total number of votes cast by an account. |
Returns list of all validator groups and the number of votes they've received.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| groups | address[] | List of all validator groups |
| values | uint256[] | Number of votes each validator group received. |
Returns the total votes made for `group`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The total votes made for `group`. |
Returns the total votes for `group` made by `account`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
| account | address | The address of the voting account. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | The total votes for `group` made by `account`. |
Verifies the BLS signature on the header and returns the seal bitmap. The validator set used for verification is retrieved based on the parent hash field of the header. If the parent hash is not in the blockchain, verification fails.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| header | bytes | RLP encoded header |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bytes32 | Bitmap parent seal with set bits at indices correspoinding to signing validators. |
Returns the storage, major, minor, and patch version of the contract.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Storage version of the contract. |
| — | uint256 | Major version of the contract. |
| — | uint256 | Minor version of the contract. |
| — | uint256 | Patch version of the contract. |
Returns whether or not an account's votes for the specified group can be activated.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| account | address | The account with pending votes. |
| group | address | The validator group that `account` has pending votes for. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | Whether or not `account` has activatable votes for `group`. |
Computes hash of header.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| header | bytes | RLP encoded header |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bytes32 | Header hash. |
Checks whether the election contract has been initialized.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True if the contract has completed its initialization process, otherwise false.✨ AI |
Checks if the contract is currently blocked.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | Returns true if the contract is blocked, otherwise false. |
Checks whether the caller is the contract owner.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | true if the caller is the contract owner, otherwise false.✨ AI |
Return the maximum number of groups a voter is allowed to vote for.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Maximum number of groups a voter may vote for (uint256).✨ AI |
Returns the minimum number of required signers for a given block number.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| blockNumber | uint256 |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 |
Computes byzantine quorum from current validator set size
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Byzantine quorum of validators. |
Gets the size of the current elected validator set.
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Size of the current elected validator set. |
Gets the size of the validator set that must sign the given block number.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| blockNumber | uint256 | Block number to retrieve the validator set from. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Size of the validator set. |
Returns the address of the contract owner.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address | The address of the current contract owner.✨ AI |
Get the address of the registry contract associated with this election.✨ AI
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address | The address of the registry contract used to manage eligible voters and candidates.✨ AI |
Gets a validator address from the current validator set.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| index | uint256 | Index of requested validator in the validator set. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address | Address of validator at the requested index. |
Gets a validator signer address from the current validator set.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| index | uint256 | Index of requested validator in the validator set. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address | Address of validator signer at the requested index. |
Gets a validator signer address from the validator set at the given block number.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| index | uint256 | Index of requested validator in the validator set. |
| blockNumber | uint256 | Block number to retrieve the validator set from. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | address | Address of validator signer at the requested index. |
寫入函式
Converts `account`'s pending votes for `group` to active votes.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The validator group to vote for. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Converts `account`'s pending votes for `group` to active votes.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The validator group to vote for. |
| account | address | The validateor group account's pending votes to active votes |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Distributes epoch rewards to voters for `group` in the form of active votes.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The group whose voters will receive rewards. |
| value | uint256 | The amount of rewards to distribute to voters for the group. |
| lesser | address | The group receiving fewer votes than `group` after the rewards are added. |
| greater | address | The group receiving more votes than `group` after the rewards are added. |
Reduces the total amount of `account`'s voting gold by `value` by iterating over all groups voted for by account.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| account | address | Address to revoke votes from. |
| value | uint256 | Maximum amount of votes to revoke. |
| lessers | address[] | The groups receiving fewer votes than the i'th `group`, or 0 if the i'th `group` has the fewest votes of any validator group. |
| greaters | address[] | The groups receivier more votes than the i'th `group`, or 0 if the i'th `group` has the most votes of any validator group. |
| indices | uint256[] | The indices of the i'th group in the account's voting list. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | uint256 | Number of votes successfully decremented. |
Used in place of the constructor to allow the contract to be upgradable via proxy.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| registryAddress | address | The address of the registry core smart contract. |
| minElectableValidators | uint256 | The minimum number of validators that can be elected. |
| maxElectableValidators | uint256 | |
| _maxNumGroupsVotedFor | uint256 | The maximum number of groups that an account can vote for at once. |
| _electabilityThreshold | uint256 | The minimum ratio of votes a group needs before its members can be elected. |
Marks a group eligible for electing validators.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
| lesser | address | The address of the group that has received fewer votes than this group. |
| greater | address | The address of the group that has received more votes than this group. |
Marks a group ineligible for electing validators.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The address of the validator group. |
Renounces ownership of the contract, leaving the contract without an owner.✨ AI
Revokes `value` active votes for `group`
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The validator group to revoke votes from. |
| value | uint256 | The number of votes to revoke. |
| lesser | address | The group receiving fewer votes than the group for which the vote was revoked, or 0 if that group has the fewest votes of any validator group. |
| greater | address | The group receiving more votes than the group for which the vote was revoked, or 0 if that group has the most votes of any validator group. |
| index | uint256 | The index of the group in the account's voting list. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Revokes all active votes for `group`
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The validator group to revoke votes from. |
| lesser | address | The group receiving fewer votes than the group for which the vote was revoked, or 0 if that group has the fewest votes of any validator group. |
| greater | address | The group receiving more votes than the group for which the vote was revoked, or 0 if that group has the most votes of any validator group. |
| index | uint256 | The index of the group in the account's voting list. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Revokes `value` pending votes for `group`
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The validator group to revoke votes from. |
| value | uint256 | The number of votes to revoke. |
| lesser | address | The group receiving fewer votes than the group for which the vote was revoked, or 0 if that group has the fewest votes of any validator group. |
| greater | address | The group receiving more votes than the group for which the vote was revoked, or 0 if that group has the most votes of any validator group. |
| index | uint256 | The index of the group in the account's voting list. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Allows to turn on/off voting over maxNumGroupsVotedFor. Once this is turned on and account voted for more than maxNumGroupsVotedFor, it is account's obligation to run updateTotalVotesByAccountForGroup once a day. If not run, voting power of account will not reflect rewards awarded.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| flag | bool | The on/off flag. |
Sets the address of the blocking contract.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| _blockedBy | address | The address of the contract that will determine if this contract is blocked. |
Sets the electability threshold.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| threshold | uint256 | Electability threshold as unwrapped Fraction. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Updates the minimum and maximum number of validators that can be elected.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| min | uint256 | The minimum number of validators that can be elected. |
| max | uint256 | The maximum number of validators that can be elected. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Updates the maximum number of groups an account can be voting for at once.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| _maxNumGroupsVotedFor | uint256 | The maximum number of groups an account can vote for. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
Updates the address pointing to a Registry contract.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| registryAddress | address | The address of a registry contract for routing to other contracts. |
Transfers ownership of the contract to the specified new owner address.✨ AI
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| newOwner | address | Address that will become the new owner of the contract.✨ AI |
Counts and caches account's votes for group.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| account | address | The address of the voting account. |
| group | address | The address of the validator group. |
Increments the number of total and pending votes for `group`.
參數
| 名稱 | 類型 | 描述 |
|---|---|---|
| group | address | The validator group to vote for. |
| value | uint256 | The amount of gold to use to vote. |
| lesser | address | The group receiving fewer votes than `group`, or 0 if `group` has the fewest votes of any validator group. |
| greater | address | The group receiving more votes than `group`, or 0 if `group` has the most votes of any validator group. |
回傳值
| 名稱 | 類型 | 描述 |
|---|---|---|
| — | bool | True upon success. |
事件
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| account | address | ✓ | |
| flag | bool |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| _blockedBy | address | ✓ |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| electabilityThreshold | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| min | uint256 | ||
| max | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| group | address | ✓ | |
| value | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| maxNumGroupsVotedFor | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| previousOwner | address | ✓ | |
| newOwner | address | ✓ |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| registryAddress | address | ✓ |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| account | address | ✓ | |
| group | address | ✓ | |
| value | uint256 | ||
| units | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| group | address | ✓ |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| group | address | ✓ |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| account | address | ✓ | |
| group | address | ✓ | |
| value | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| account | address | ✓ | |
| group | address | ✓ | |
| value | uint256 | ||
| units | uint256 |
| 名稱 | 類型 | 已索引 | 描述 |
|---|---|---|---|
| account | address | ✓ | |
| group | address | ✓ | |
| value | uint256 |