Skip to content

Instantly share code, notes, and snippets.

@ajb413
Last active August 18, 2021 21:38
Show Gist options
  • Save ajb413/9a70cf20f6c953ed3e2003bd7ce99246 to your computer and use it in GitHub Desktop.
Save ajb413/9a70cf20f6c953ed3e2003bd7ce99246 to your computer and use it in GitHub Desktop.
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