Last active
August 18, 2021 21:38
-
-
Save ajb413/9a70cf20f6c953ed3e2003bd7ce99246 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createVoteBySigMessage = (govAddress, proposalId, support, chainId = 1) => { | |
const types = { | |
EIP712Domain: [ | |
{ name: 'name', type: 'string' }, | |
{ name: 'chainId', type: 'uint256' }, | |
{ name: 'verifyingContract', type: 'address' }, | |
], | |
Ballot: [ | |
{ name: 'proposalId', type: 'uint256' }, | |
{ name: 'support', type: 'uint8' } | |
] | |
}; | |
const primaryType = 'Ballot'; | |
const domain = { name: 'Compound Governor Bravo', chainId, verifyingContract: govAddress }; | |
support = support.toString(); | |
const message = { proposalId, support }; | |
return JSON.stringify({ types, primaryType, domain, message }); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment