Cryptography

ECDSA

Git Source

Elliptic Curve Digital Signature Algorithm (ECDSA) operations. These functions can be used to verify that a message was signed by the holder of the private keys of a given address.

Functions

recover

function recover(bytes32 _digest, bytes memory _signature) internal pure returns (address _signer);

toEthSignedMessageHash

Returns an Ethereum Signed Message, created from a hash. This produces hash corresponding to the one signed with the https://eth.wiki/json-rpc/API#eth_sign[eth_sign] JSON-RPC method as part of EIP-191. See recover.

function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32);

MerkleProofLib

Git Source

Authors: Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol), Modified from Solady (https://github.com/Vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)

Gas optimized merkle proof verification library.

Functions

verify

SignatureChecker

Git Source

Signature verification helper that can be used instead of ECDSA.recover to seamlessly support both ECDSA signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like Argent and Gnosis Safe.

State Variables

MAGICVALUE

Functions

isValidSignatureNow

modified OpenZeppelin's SignatureChecker to remove the signer recovery, since lazyMint and lazyBuy require the signed voucher (by an EOA) to contain the address of its contract wallet (AA), it is possible to skip signature validation as it is not needed, as erc1271 isValidSignatureNow is called directly instead.

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).

SSTORE2

Git Source

Authors: Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SSTORE2.sol), Modified from 0xSequence (https://github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol)

Read and write to persistent storage at a fraction of the cost.

State Variables

DATA_OFFSET

Functions

write

read

read

read

readBytecode

Last updated