Add function documentation for SignatureChecker.

This commit is contained in:
Francisco Giordano
2022-01-28 22:44:32 -03:00
parent ae54e6de1d
commit f55d2716a8

View File

@ -8,16 +8,20 @@ import "../Address.sol";
import "../../interfaces/IERC1271.sol"; import "../../interfaces/IERC1271.sol";
/** /**
* @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
* ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
* smart contract wallets such as Argent and Gnosis. * Argent and Gnosis Safe.
*
* Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change
* through time. It could return true at block N and false at block N+1 (or the opposite).
* *
* _Available since v4.1._ * _Available since v4.1._
*/ */
library SignatureChecker { library SignatureChecker {
/**
* @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
* signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
*
* NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
* change through time. It could return true at block N and false at block N+1 (or the opposite).
*/
function isValidSignatureNow( function isValidSignatureNow(
address signer, address signer,
bytes32 hash, bytes32 hash,