Skip to content

Commit cb36825

Browse files
committed
Add overloads to VotingReputation
1 parent 7076f81 commit cb36825

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

contracts/extensions/VotingReputation.sol

+71
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,77 @@ contract VotingReputation is VotingBase {
123123
motions[motionCount].maxVotes = getReputationFromProof(motionCount, address(0x0), _key, _value, _branchMask, _siblings);
124124
}
125125

126+
/// @notice Stake on a motion
127+
/// @param _motionId The id of the motion
128+
/// @param _permissionDomainId The domain where the extension has the arbitration permission
129+
/// @param _childSkillIndex For the domain in which the motion is occurring
130+
/// @param _vote The side being supported (0 = NAY, 1 = YAY)
131+
/// @param _amount The amount of tokens being staked
132+
/// @param _key Reputation tree key for the staker/domain
133+
/// @param _value Reputation tree value for the staker/domain
134+
/// @param _branchMask The branchmask of the proof
135+
/// @param _siblings The siblings of the proof
136+
function stakeMotion(
137+
uint256 _motionId,
138+
uint256 _permissionDomainId,
139+
uint256 _childSkillIndex,
140+
uint256 _vote,
141+
uint256 _amount,
142+
bytes memory _key,
143+
bytes memory _value,
144+
uint256 _branchMask,
145+
bytes32[] memory _siblings
146+
)
147+
public
148+
{
149+
setInfluence(_motionId, _key, _value, _branchMask, _siblings);
150+
stakeMotion(_motionId, _permissionDomainId, _childSkillIndex, _vote, _amount);
151+
}
152+
153+
/// @notice Submit a vote secret for a motion
154+
/// @param _motionId The id of the motion
155+
/// @param _voteSecret The hashed vote secret
156+
/// @param _key Reputation tree key for the staker/domain
157+
/// @param _value Reputation tree value for the staker/domain
158+
/// @param _branchMask The branchmask of the proof
159+
/// @param _siblings The siblings of the proof
160+
function submitVote(
161+
uint256 _motionId,
162+
bytes32 _voteSecret,
163+
bytes memory _key,
164+
bytes memory _value,
165+
uint256 _branchMask,
166+
bytes32[] memory _siblings
167+
)
168+
public
169+
{
170+
setInfluence(_motionId, _key, _value, _branchMask, _siblings);
171+
submitVote(_motionId, _voteSecret);
172+
}
173+
174+
/// @notice Reveal a vote secret for a motion
175+
/// @param _motionId The id of the motion
176+
/// @param _salt The salt used to hash the vote
177+
/// @param _vote The side being supported (0 = NAY, 1 = YAY)
178+
/// @param _key Reputation tree key for the staker/domain
179+
/// @param _value Reputation tree value for the staker/domain
180+
/// @param _branchMask The branchmask of the proof
181+
/// @param _siblings The siblings of the proof
182+
function revealVote(
183+
uint256 _motionId,
184+
bytes32 _salt,
185+
uint256 _vote,
186+
bytes memory _key,
187+
bytes memory _value,
188+
uint256 _branchMask,
189+
bytes32[] memory _siblings
190+
)
191+
public
192+
{
193+
setInfluence(_motionId, _key, _value, _branchMask, _siblings);
194+
revealVote(_motionId, _salt, _vote);
195+
}
196+
126197
/// @notice Escalate a motion to a higher domain
127198
/// @param _motionId The id of the motion
128199
/// @param _newDomainId The desired domain of escalation

0 commit comments

Comments
 (0)