Delegate override vote (#5192)
Co-authored-by: Arr00 <13561405+arr00@users.noreply.github.com>
This commit is contained in:
@ -32,6 +32,13 @@ module.exports = mapValues(
|
||||
reason: 'string',
|
||||
params: 'bytes',
|
||||
},
|
||||
OverrideBallot: {
|
||||
proposalId: 'uint256',
|
||||
support: 'uint8',
|
||||
voter: 'address',
|
||||
nonce: 'uint256',
|
||||
reason: 'string',
|
||||
},
|
||||
Delegation: {
|
||||
delegatee: 'address',
|
||||
nonce: 'uint256',
|
||||
|
||||
@ -128,6 +128,23 @@ class GovernorHelper {
|
||||
return await this.governor[method](...args);
|
||||
}
|
||||
|
||||
async overrideVote(vote = {}) {
|
||||
let method = 'castOverrideVote';
|
||||
let args = [this.id, vote.support];
|
||||
|
||||
vote.reason = vote.reason ?? '';
|
||||
|
||||
if (vote.signature) {
|
||||
let message = this.forgeMessage(vote);
|
||||
message.reason = message.reason ?? '';
|
||||
const sign = await vote.signature(this.governor, message);
|
||||
method = 'castOverrideVoteBySig';
|
||||
args.push(vote.voter, vote.reason ?? '', sign);
|
||||
}
|
||||
|
||||
return await this.governor[method](...args);
|
||||
}
|
||||
|
||||
/// Clock helpers
|
||||
async waitForSnapshot(offset = 0n) {
|
||||
const timepoint = await this.governor.proposalSnapshot(this.id);
|
||||
|
||||
Reference in New Issue
Block a user