Created
July 7, 2020 21:35
-
-
Save ajb413/a5466a61558c0897491c378ce6682ad0 to your computer and use it in GitHub Desktop.
This file contains 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 createDelegateBySigMessage = (compAddress, delegatee, expiry = 10e9, chainId = 1, nonce = 0) => { | |
const types = { | |
EIP712Domain: [ | |
{ name: 'name', type: 'string' }, | |
{ name: 'chainId', type: 'uint256' }, | |
{ name: 'verifyingContract', type: 'address' }, | |
], | |
Delegation: [ | |
{ name: 'delegatee', type: 'address' }, | |
{ name: 'nonce', type: 'uint256' }, | |
{ name: 'expiry', type: 'uint256' } | |
] | |
}; | |
const primaryType = 'Delegation'; | |
const domain = { name: 'Compound', chainId, verifyingContract: compAddress }; | |
const message = { delegatee, nonce, expiry }; | |
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