The ERC1271 extension allows DAOs to collectively sign messages and typed data through signatures. ERC1271 is a contract signature standard that enables smart contract wallets to behave like EOAs (externally owned accounts). Signatures are critical when interacting with various types of decentralized applications. Developers use signatures for authentication, meta-transactions, order books, and anything that requires delegated permission or proof of ownership of an address. ERC1271 has widespread adoption and is used in applications like Argent and Snapshot.
In order to register a signature with the DAO, a member must submit a proposal in which they specify the signature message digest, the signature, and the magic value to return on success.
The message digest must be the hash of the message to sign. This can be a simple message hash, a personal signature (message with special prefix), or a typed data signature (message created using structured data).
The proposal enters the voting process.
If the vote passes, the extension returns the magic value when queried via the ERC1271 interface.
SIGN: right to store a signature into the contract signatures storage.
signatureProposals: all signature proposals handled by each DAO.
signature: the signature associated with this proposal. May be used to encode other attributes for efficiency, since it is not a real signature and would just be wasted storage space.
msgHash: the digest of the data to sign.
magicValue: the value to return if a signature proposal has passed.
The DAO address that this extension belongs to.
Internally tracks deployment under ERC-1167 proxy pattern.
Keeps track of all signatures provided through
sign function, so they can be verified.
/** * @notice Initialises the ERC1271 extension to be associated with a DAO * @dev Can only be called once * @param creator The DAO's creator, who will be an initial member */function initialize(DaoRegistry _dao, address creator) external
/** * @notice Registers a valid signature in the extension. * @dev Only adapters/extensions with `SIGN` ACL can call this function. * @param permissionHash The digest of the data to be signed. * @param signatureHash The hash of the signature. * @param magicValue The value to be returned by the ERC1271 interface upon success. */ function sign( bytes32 permissionHash, bytes32 signatureHash, bytes4 magicValue ) public hasExtensionAccess(AclFlag.SIGN)
/** * @notice Verifies if exists a signature based on the permissionHash, and checks if the provided signature matches the expected signatureHash. * @param permissionHash The digest of the data to be signed. * @param signature The signature in bytes to be encoded, hashed and verified. * @return The magic number in bytes4 in case the signature is valid, otherwise it reverts. */ function isValidSignature(bytes32 permissionHash, bytes memory signature) public view override returns (bytes4) function isValidSignature(bytes32 permissionHash, bytes memory signature) public view override returns (bytes4)
- No events are emitted.