Skip to content

Solidity smart contract library for verifying signature

Notifications You must be signed in to change notification settings

pixel8labs/signatures-verify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

@sigpub/signatures-verify

Solidity smart contract library for verifying signature

Installation

Use the following command to install @signatures-pub/signatures-verify:

npm install @sigpub/signatures-verify

Usage

Once installed, you can use the contracts in the library by importing them:

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@sigpub/signatures-verify/Signature.sol";

contract MyNFT is ERC721 {
    address private signerAddress;

    mapping(address => uint256) public claimed;

    constructor(address _signerAddress) ERC721("MyNFT", "MNFT") {
        signerAddress = _signerAddress;
    }

    function whitelistMint(
        uint256 quantity, 
        uint256 maxQuantity,
        bytes memory signature
    ) external 
    {
        require(Signature.verify(maxQuantity, msg.sender, signature) == signerAddress, "Address is not whitelisted");
        require(claimed[msg.sender] + quantity <= maxQuantity, "Exceed current max minted");
        claimed[msg.sender] += quantity; 
        _safeMint(msg.sender, quantity);
    }
}

About

Solidity smart contract library for verifying signature

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published