Skip to main content

Motions & Disputes Extension (VotingReputation)

This extension allows any member of your colony to propose a Motion to take an Action that will pass after a security delay unless somebody Objects. This applies to all Actions, such as creating an expenditure, managing funds, or managing teams.

See here for more information.

Interface Methods

claimMisalignedReward(uint256 _motionId, uint256 _permissionDomainId, uint256 _childSkillIndex, address _staker, uint256 _vote)

Claim the staker's reward from a motion that was created with v4 of the extension, and is now missing and cannot be interacted with via the normal claim function.

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_permissionDomainIduint256The domain where the extension has the arbitration permission
_childSkillIndexuint256For the domain in which the motion is occurring
_stakeraddressThe staker whose reward is being claimed
_voteuint256The side being supported (0 = NAY, 1 = YAY)

claimReward(uint256 _motionId, uint256 _permissionDomainId, uint256 _childSkillIndex, address _staker, uint256 _vote)

Claim the staker's reward

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_permissionDomainIduint256The domain where the extension has the arbitration permission
_childSkillIndexuint256For the domain in which the motion is occurring
_stakeraddressThe staker whose reward is being claimed
_voteuint256The side being supported (0 = NAY, 1 = YAY)

createClaimDelayAction(bytes memory _action, uint256 _value):bytes _delayAction

Create the action that should be taken based on the passed action to appropriately set the claim window of an expenditure from starting.

Note: Not expected to be used directly, could be made private in the future

Parameters

NameTypeDescription
_actionbytesThe action being voted on
_valueuint256The value to set the claim delay to

Return Parameters

NameTypeDescription
_delayActionbytesThe delay action

createMotion(uint256 _domainId, uint256 _childSkillIndex, address _altTarget, bytes memory _action, bytes memory _key, bytes memory _value, uint256 _branchMask, bytes32[] memory _siblings)

Create a motion

Parameters

NameTypeDescription
_domainIduint256The domain where we vote on the motion
_childSkillIndexuint256The childSkillIndex pointing to the domain of the action
_altTargetaddressThe contract to which we send the action (0x0 for the colony)
_actionbytesA bytes array encoding a function call
_keybytesReputation tree key for the root domain
_valuebytesReputation tree value for the root domain
_branchMaskuint256The branchmask of the proof
_siblingsbytes32[]The siblings of the proof

escalateMotion(uint256 _motionId, uint256 _newDomainId, uint256 _childSkillIndex, bytes memory _key, bytes memory _value, uint256 _branchMask, bytes32[] memory _siblings)

Escalate a motion to a higher domain

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_newDomainIduint256The desired domain of escalation
_childSkillIndexuint256For the current domain, relative to the escalated domain
_keybytesReputation tree key for the new domain
_valuebytesReputation tree value for the new domain
_branchMaskuint256The branchmask of the proof
_siblingsbytes32[]The siblings of the proof

failingExecutionAllowed(uint256 _motionId):bool _allowed

Return whether a motion, assuming it's in the finalizable state, is allowed to finalize without the call executing successfully.

Note: We are only expecting this to be called from finalize motion in the contracts. It is marked as external only so that the frontend can use it.

Parameters

NameTypeDescription
_motionIduint256The id of the motion

Return Parameters

NameTypeDescription
_allowedboolIf motion is allowed to finalize without successful action

finalizeMotion(uint256 _motionId)

Finalized a motion, executing its action if appropriate

Parameters

NameTypeDescription
_motionIduint256The id of the motion to finalize

getEscalationPeriod():uint256 _period

Get the escalation period

Return Parameters

NameTypeDescription
_perioduint256The escalation period

getExpenditureMotionCount(bytes32 _structHash):uint256 _count

Get the number of ongoing motions for a single expenditure / expenditure slot

Parameters

NameTypeDescription
_structHashbytes32The hash of the expenditureId or expenditureId*expenditureSlot

Return Parameters

NameTypeDescription
_countuint256The number of ongoing motions

getExpenditurePastVote(bytes32 _actionHash):uint256 _vote

Get the largest past vote on a single expenditure variable

Parameters

NameTypeDescription
_actionHashbytes32The hash of the particular expenditure action

Return Parameters

NameTypeDescription
_voteuint256The largest past vote on this variable

getMaxVoteFraction():uint256 _fraction

Get the max vote fraction

Return Parameters

NameTypeDescription
_fractionuint256The max vote fraction

getMotion(uint256 _motionId):Motion _motion

Get the data for a single motion

Parameters

NameTypeDescription
_motionIduint256The id of the motion

Return Parameters

NameTypeDescription
_motionMotionThe motion struct

getMotionCount():uint256 _count

Get the total motion count

Return Parameters

NameTypeDescription
_countuint256The total motion count

getMotionState(uint256 _motionId):MotionState _motionState

Get the current state of the motion

Parameters

NameTypeDescription
_motionIduint256The id of the motion

Return Parameters

NameTypeDescription
_motionStateMotionStateThe current motion state

getRevealPeriod():uint256 _period

Get the reveal period

Return Parameters

NameTypeDescription
_perioduint256The reveal period

getStake(uint256 _motionId, address _staker, uint256 _vote):uint256 _stake

Get a user's stake on a motion

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_stakeraddressThe staker address
_voteuint256The side being supported (0 = NAY, 1 = YAY)

Return Parameters

NameTypeDescription
_stakeuint256The user's stake

getStakePeriod():uint256 _period

Get the stake period

Return Parameters

NameTypeDescription
_perioduint256The stake period

getStakerReward(uint256 _motionId, address _staker, uint256 _vote):uint256 _reward, uint256 _penalty

Get the staker reward

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_stakeraddressThe staker's address
_voteuint256The vote (0 = NAY, 1 = YAY)

Return Parameters

NameTypeDescription
_rewarduint256The staker reward (if any)
_penaltyuint256The reputation penalty (if any)

getSubmitPeriod():uint256 _period

Get the submit period

Return Parameters

NameTypeDescription
_perioduint256The submit period

getTotalStakeFraction():uint256 _fraction

Get the total stake fraction

Return Parameters

NameTypeDescription
_fractionuint256The total stake fraction

getUserMinStakeFraction():uint256 _fraction

Get the user min stake fraction

Return Parameters

NameTypeDescription
_fractionuint256The user min stake fraction

getVoterReward(uint256 _motionId, uint256 _voterRep):uint256 _reward

Get the voter reward NB This function will only return a meaningful value if in the reveal state. Prior to the reveal state, getVoterRewardRange should be used.

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_voterRepuint256The reputation the voter has in the domain

Return Parameters

NameTypeDescription
_rewarduint256The voter reward

getVoterRewardFraction():uint256 _fraction

Get the voter reward fraction

Return Parameters

NameTypeDescription
_fractionuint256The voter reward fraction

getVoterRewardRange(uint256 _motionId, uint256 _voterRep, address _voterAddress):uint256 _rewardMin, uint256 _rewardMax

Get the range of potential rewards for a voter on a specific motion, intended to be used when the motion is in the reveal state. Once a motion is in the reveal state the reward is known, and getVoterRewardRange should be used.

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_voterRepuint256The reputation the voter has in the domain
_voterAddressaddressThe address the user will be voting as

Return Parameters

NameTypeDescription
_rewardMinuint256The voter reward range lower bound
_rewardMaxuint256The voter reward range upper bound

initialise(uint256 _totalStakeFraction, uint256 _voterRewardFraction, uint256 _userMinStakeFraction, uint256 _maxVoteFraction, uint256 _stakePeriod, uint256 _submitPeriod, uint256 _revealPeriod, uint256 _escalationPeriod)

Initialise the extension

Parameters

NameTypeDescription
_totalStakeFractionuint256The fraction of the domain's reputation we need to stake
_voterRewardFractionuint256The fraction of the total stake paid out to voters as rewards
_userMinStakeFractionuint256The minimum per-user stake as fraction of total stake
_maxVoteFractionuint256The fraction of the domain's reputation which must submit for quick-end
_stakePerioduint256The length of the staking period in seconds
_submitPerioduint256The length of the submit period in seconds
_revealPerioduint256The length of the reveal period in seconds
_escalationPerioduint256The length of the escalation period in seconds

revealVote(uint256 _motionId, bytes32 _salt, uint256 _vote, bytes memory _key, bytes memory _value, uint256 _branchMask, bytes32[] memory _siblings)

Reveal a vote secret for a motion

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_saltbytes32The salt used to hash the vote
_voteuint256The side being supported (0 = NAY, 1 = YAY)
_keybytesReputation tree key for the staker/domain
_valuebytesReputation tree value for the staker/domain
_branchMaskuint256The branchmask of the proof
_siblingsbytes32[]The siblings of the proof

stakeMotion(uint256 _motionId, uint256 _permissionDomainId, uint256 _childSkillIndex, uint256 _vote, uint256 _amount, bytes memory _key, bytes memory _value, uint256 _branchMask, bytes32[] memory _siblings)

Stake on a motion

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_permissionDomainIduint256The domain where the extension has the arbitration permission
_childSkillIndexuint256For the domain in which the motion is occurring
_voteuint256The side being supported (0 = NAY, 1 = YAY)
_amountuint256The amount of tokens being staked
_keybytesReputation tree key for the staker/domain
_valuebytesReputation tree value for the staker/domain
_branchMaskuint256The branchmask of the proof
_siblingsbytes32[]The siblings of the proof

submitVote(uint256 _motionId, bytes32 _voteSecret, bytes memory _key, bytes memory _value, uint256 _branchMask, bytes32[] memory _siblings)

Submit a vote secret for a motion

Parameters

NameTypeDescription
_motionIduint256The id of the motion
_voteSecretbytes32The hashed vote secret
_keybytesReputation tree key for the staker/domain
_valuebytesReputation tree value for the staker/domain
_branchMaskuint256The branchmask of the proof
_siblingsbytes32[]The siblings of the proof