Solidity API
IRigoblockGovernance
RigoblockGovernance
constructor
Constructor has no inputs to guarantee same deterministic address across chains.
Setting high proposal threshold locks propose action, which also lock vote actions.
IGovernanceStrategy
assertValidInitParams
Reverts if initialization paramters are incorrect.
Only used at initialization, as params deleted from factory storage after setup.
Parameters
params
struct IRigoblockGovernanceFactory.Parameters
Tuple of factory parameters.
assertValidThresholds
Reverts if thresholds are incorrect.
Parameters
proposalThreshold
uint256
Number of votes required to make a proposal.
quorumThreshold
uint256
Number of votes required for a proposal to succeed.
getProposalState
Returns the state of a proposal for a required quorum.
Parameters
proposal
struct IGovernanceState.Proposal
Tuple of the proposal.
minimumQuorum
uint256
Number of votes required for a proposal to pass.
Return Values
[0]
enum IGovernanceState.ProposalState
Tuple of the proposal state.
votingPeriod
Return the voting period.
Return Values
[0]
uint256
Number of seconds of period duration.
votingTimestamps
Returns the voting timestamps.
Return Values
startBlockOrTime
uint256
Timestamp when proposal starts.
endBlockOrTime
uint256
Timestamp when voting ends.
getVotingPower
Return a user's voting power.
Parameters
account
address
Address to check votes for.
IRigoblockGovernanceFactory
GovernanceCreated
Emitted when a governance is created.
Parameters
governance
address
Address of the governance proxy.
createGovernance
Creates a new governance proxy.
Parameters
implementation
address
Address of the governance implementation contract.
governanceStrategy
address
Address of the voting strategy.
proposalThreshold
uint256
Number of votes required for creating a new proposal.
quorumThreshold
uint256
Number of votes required for execution.
timeType
enum IGovernanceState.TimeType
Enum of time type (block number or timestamp).
name
string
Human readable string of the name.
Return Values
governance
address
Address of the new governance.
Parameters
parameters
Returns the governance initialization parameters at proxy deploy.
Return Values
[0]
struct IRigoblockGovernanceFactory.Parameters
Tuple of the governance parameters.
IGovernanceEvents
ProposalCreated
Emitted when a new proposal is created.
Parameters
proposer
address
Address of the proposer.
proposalId
uint256
Number of the proposal.
actions
struct IGovernanceVoting.ProposedAction[]
Struct array of actions (targets, datas, values).
startBlockOrTime
uint256
Timestamp in seconds after which proposal can be voted on.
endBlockOrTime
uint256
Timestamp in seconds after which proposal can be executed.
description
string
String description of proposal.
ProposalExecuted
Emitted when a proposal is executed.
Parameters
proposalId
uint256
Number of the proposal.
StrategyUpgraded
Emmited when the governance strategy is upgraded.
Parameters
newStrategy
address
Address of the new strategy contract.
ThresholdsUpdated
Emitted when voting thresholds get updated.
Only governance can update thresholds.
Parameters
proposalThreshold
uint256
Number of votes required to add a proposal.
quorumThreshold
uint256
Number of votes required to execute a proposal.
Upgraded
Emitted when implementation written to proxy storage.
Emitted also at first variable initialization.
Parameters
newImplementation
address
Address of the new implementation.
VoteCast
Emitted when a voter votes.
Parameters
voter
address
Address of the voter.
proposalId
uint256
Number of the proposal.
voteType
enum IGovernanceVoting.VoteType
Number of vote type.
votingPower
uint256
Number of votes.
IGovernanceInitializer
initializeGovernance
Initializes the Rigoblock Governance.
Params are stored in factory and read from there.
IGovernanceState
ProposalState
TimeType
Proposal
ProposalWrapper
getActions
Returns the actions proposed for a given proposal.
Parameters
proposalId
uint256
Number of the proposal.
Return Values
proposedActions
struct IGovernanceVoting.ProposedAction[]
Array of tuple of proposed actions.
getProposalById
Returns a proposal for a given id.
Parameters
proposalId
uint256
The number of the proposal.
Return Values
proposalWrapper
struct IGovernanceState.ProposalWrapper
Tuple wrapper of the proposal and proposed actions tuples.
getProposalState
Returns the state of a proposal.
Parameters
proposalId
uint256
Number of the proposal.
Return Values
[0]
enum IGovernanceState.ProposalState
Number of proposal state.
Receipt
getReceipt
Returns the receipt of a voter for a given proposal.
Parameters
proposalId
uint256
Number of the proposal.
voter
address
Address of the voter.
Return Values
[0]
struct IGovernanceState.Receipt
Tuple of voter receipt.
getVotingPower
Computes the current voting power of the given account.
Parameters
account
address
The address of the account.
Return Values
votingPower
uint256
The current voting power of the given account.
GovernanceParameters
EnhancedParams
governanceParameters
Returns the governance parameters.
Return Values
[0]
struct IGovernanceState.EnhancedParams
Tuple of the governance parameters.
name
Returns the name of the governace.
Return Values
[0]
string
Human readable string of the name.
proposalCount
Returns the total number of proposals.
Return Values
count
uint256
The number of proposals.
proposals
Returns all proposals ever made to the governance.
Return Values
proposalWrapper
struct IGovernanceState.ProposalWrapper[]
Tuple array of all governance proposals.
votingPeriod
Returns the voting period.
Return Values
[0]
uint256
Number of blocks or seconds.
IGovernanceUpgrade
updateThresholds
Updates the proposal and quorum thresholds to the given values.
Only callable by the governance contract itself. Thresholds can only be updated via a successful governance proposal.
Parameters
newProposalThreshold
uint256
The new value for the proposal threshold.
newQuorumThreshold
uint256
The new value for the quorum threshold.
upgradeImplementation
Updates the governance implementation address.
Only callable after successful voting.
Parameters
newImplementation
address
Address of the new governance implementation contract.
upgradeStrategy
Updates the governance strategy plugin.
Only callable by the governance contract itself.
Parameters
newStrategy
address
Address of the new strategy contract.
IGovernanceVoting
VoteType
castVote
Casts a vote for the given proposal.
Only callable during the voting period for that proposal. One address can only vote once.
Parameters
proposalId
uint256
The ID of the proposal to vote on.
voteType
enum IGovernanceVoting.VoteType
Whether to support, not support or abstain.
castVoteBySignature
Casts a vote for the given proposal, by signature.
Only callable during the voting period for that proposal. One voter can only vote once.
Parameters
proposalId
uint256
The ID of the proposal to vote on.
voteType
enum IGovernanceVoting.VoteType
Whether to support, not support or abstain.
v
uint8
the v field of the signature.
r
bytes32
the r field of the signature.
s
bytes32
the s field of the signature.
execute
Executes a proposal that has passed and is currently executable.
Parameters
proposalId
uint256
The ID of the proposal to execute.
ProposedAction
propose
Creates a proposal on the the given actions. Must have at least proposalThreshold
.
Must have at least proposalThreshold
of voting power to call this function.
Parameters
actions
struct IGovernanceVoting.ProposedAction[]
The proposed actions. An action specifies a contract call.
description
string
A text description for the proposal.
Return Values
proposalId
uint256
The ID of the newly created proposal.
MixinAbstract
_getProposalCount
_getProposalState
_getVotingPower
MixinConstants
Constants are copied in the bytecode and not assigned a storage slot, can safely be added to this contract.
VERSION
Contract version
PROPOSAL_MAX_OPERATIONS
Maximum operations per proposal
DOMAIN_TYPEHASH
The EIP-712 typehash for the contract's domain
VOTE_TYPEHASH
The EIP-712 typehash for the vote struct
_GOVERNANCE_PARAMS_SLOT
_IMPLEMENTATION_SLOT
_NAME_SLOT
_PROPOSAL_SLOT
_PROPOSAL_COUNT_SLOT
_PROPOSED_ACTION_SLOT
_RECEIPT_SLOT
MixinImmutables
Immutables are copied in the bytecode and not assigned a storage slot
New immutables can safely be added to this contract without ordering.
constructor
MixinInitializer
onlyUninitialized
initializeGovernance
Initializes the Rigoblock Governance.
Params are stored in factory and read from there.
MixinState
getActions
Returns the actions proposed for a given proposal.
Parameters
proposalId
uint256
Number of the proposal.
Return Values
proposedActions
struct IGovernanceVoting.ProposedAction[]
Array of tuple of proposed actions.
getProposalState
Returns the state of a proposal.
Parameters
proposalId
uint256
Number of the proposal.
Return Values
[0]
enum IGovernanceState.ProposalState
Number of proposal state.
getReceipt
Returns the receipt of a voter for a given proposal.
Parameters
proposalId
uint256
Number of the proposal.
voter
address
Address of the voter.
Return Values
[0]
struct IGovernanceState.Receipt
Tuple of voter receipt.
getVotingPower
Computes the current voting power of the given account.
Parameters
account
address
The address of the account.
Return Values
[0]
uint256
governanceParameters
Returns the governance parameters.
Return Values
[0]
struct IGovernanceState.EnhancedParams
Tuple of the governance parameters.
name
Returns the name of the governace.
Return Values
[0]
string
Human readable string of the name.
proposalCount
Returns the total number of proposals.
Return Values
count
uint256
The number of proposals.
proposals
Returns all proposals ever made to the governance.
Return Values
proposalWrapper
struct IGovernanceState.ProposalWrapper[]
Tuple array of all governance proposals.
votingPeriod
Returns the voting period.
Return Values
[0]
uint256
Number of blocks or seconds.
getProposalById
Returns a proposal for a given id.
Parameters
proposalId
uint256
The number of the proposal.
Return Values
proposalWrapper
struct IGovernanceState.ProposalWrapper
Tuple wrapper of the proposal and proposed actions tuples.
_getProposalCount
_getProposalState
_getVotingPower
MixinStorage
constructor
_governanceParameters
AddressSlot
_implementation
StringSlot
_name
ParamsWrapper
_paramsWrapper
UintSlot
_proposalCount
ProposalByIndex
_proposal
ActionByIndex
_proposedAction
UserReceipt
_receipt
MixinUpgrade
onlyGovernance
updateThresholds
Updates the proposal and quorum thresholds to the given values.
Only callable by the governance contract itself. Thresholds can only be updated via a successful governance proposal.
Parameters
newProposalThreshold
uint256
The new value for the proposal threshold.
newQuorumThreshold
uint256
The new value for the quorum threshold.
upgradeImplementation
Updates the governance implementation address.
Only callable after successful voting.
Parameters
newImplementation
address
Address of the new governance implementation contract.
upgradeStrategy
Updates the governance strategy plugin.
Only callable by the governance contract itself.
Parameters
newStrategy
address
Address of the new strategy contract.
_isContract
Returns whether an address is a contract.
Return Values
[0]
bool
Bool target address has code.
MixinVoting
propose
Creates a proposal on the the given actions. Must have at least proposalThreshold
.
Must have at least proposalThreshold
of voting power to call this function.
Parameters
actions
struct IGovernanceVoting.ProposedAction[]
The proposed actions. An action specifies a contract call.
description
string
A text description for the proposal.
Return Values
proposalId
uint256
The ID of the newly created proposal.
castVote
Casts a vote for the given proposal.
Only callable during the voting period for that proposal. One address can only vote once.
Parameters
proposalId
uint256
The ID of the proposal to vote on.
voteType
enum IGovernanceVoting.VoteType
Whether to support, not support or abstain.
castVoteBySignature
Casts a vote for the given proposal, by signature.
Only callable during the voting period for that proposal. One voter can only vote once.
Parameters
proposalId
uint256
The ID of the proposal to vote on.
voteType
enum IGovernanceVoting.VoteType
Whether to support, not support or abstain.
v
uint8
the v field of the signature.
r
bytes32
the r field of the signature.
s
bytes32
the s field of the signature.
execute
Executes a proposal that has passed and is currently executable.
Parameters
proposalId
uint256
The ID of the proposal to execute.
_castVote
Casts a vote for the given proposal.
Only callable during the voting period for that proposal.
RigoblockGovernanceFactory
_parameters
createGovernance
Creates a new governance proxy.
Parameters
implementation
address
Address of the governance implementation contract.
governanceStrategy
address
Address of the voting strategy.
proposalThreshold
uint256
Number of votes required for creating a new proposal.
quorumThreshold
uint256
Number of votes required for execution.
timeType
enum IGovernanceState.TimeType
Enum of time type (block number or timestamp).
name
string
Human readable string of the name.
Return Values
governance
address
Address of the new governance.
parameters
Returns the governance initialization parameters at proxy deploy.
Return Values
[0]
struct IRigoblockGovernanceFactory.Parameters
Tuple of the governance parameters.
_isContract
Returns whether an address is a contract.
Return Values
[0]
bool
Bool target address has code.
RigoblockGovernanceProxy
Upgraded
Emitted when implementation written to proxy storage.
Emitted also at first variable initialization.
Parameters
newImplementation
address
Address of the new implementation.
_IMPLEMENTATION_SLOT
constructor
Sets address of implementation contract.
fallback
Fallback function forwards all transactions and returns all received return data.
receive
Allows this contract to receive ether.
ImplementationSlot
_getImplementation
Method to read/write from/to implementation slot.
Return Values
s
struct RigoblockGovernanceProxy.ImplementationSlot
Storage slot of the governance implementation.
RigoblockGovernanceStrategy
_stakingProxy
_votingPeriod
constructor
assertValidInitParams
Reverts if initialization paramters are incorrect.
Only used at initialization, as params deleted from factory storage after setup.
Parameters
params
struct IRigoblockGovernanceFactory.Parameters
Tuple of factory parameters.
assertValidThresholds
Reverts if thresholds are incorrect.
Parameters
proposalThreshold
uint256
Number of votes required to make a proposal.
quorumThreshold
uint256
Number of votes required for a proposal to succeed.
getProposalState
Returns the state of a proposal for a required quorum.
Parameters
proposal
struct IGovernanceState.Proposal
Tuple of the proposal.
minimumQuorum
uint256
Number of votes required for a proposal to pass.
Return Values
[0]
enum IGovernanceState.ProposalState
Tuple of the proposal state.
_qualifiedConsensus
getVotingPower
Return a user's voting power.
Parameters
account
address
Address to check votes for.
votingPeriod
Return the voting period.
Return Values
[0]
uint256
Number of seconds of period duration.
votingTimestamps
Returns the voting timestamps.
Return Values
startBlockOrTime
uint256
Timestamp when proposal starts.
endBlockOrTime
uint256
Timestamp when voting ends.
_assertValidProposalThreshold
_assertValidQuorumThreshold
_getStakingProxy
It is more gas efficient at deploy to reading immutable from internal method.
Last updated