This repository contains the smart contracts for the VisualKey project, including an ERC-20 token and an ERC-721 NFT with advanced features.
- VisualKeyToken: ERC-20 compatible token with EIP-2612 permit, EIP-1363 (transfer/approve and call), EIP-3156 flash loans, and controlled minting.
- VisualKeyNft: ERC-721 NFT contract with EIP-712 signature-based minting, rarity system, and metadata management.
- Standard ERC-20 interface
- EIP-2612 permit (gasless approvals)
- EIP-1363 (transfer/approve and call)
- EIP-3156 flash loans
- Controlled minting with time windows and signature authorization
- Burnable tokens
- Ownership transfer with delay and renounce
- Standard ERC-721, ERC-721Enumerable, ERC-721Metadata
- EIP-712 signature-based minting (proves private key ownership)
- Rarity system (level, power, creation date)
- Metadata and contract URI management
- Power increase (with permit or allowance)
- Ownership transfer with delay and renounce
npm install
npx hardhat compile
npx hardhat test
You can use the provided npm scripts to spin up a local Hardhat node and deploy all contracts automatically:
# Start a local Hardhat node (in a separate terminal)
npm run start-local-node
# In another terminal, deploy contracts to the local node
npm run deploy-visualkey-contract
The deployment script will:
- Deploy the Token, Nft, and TokenSale contracts
- Transfer tokens to the TokenSale contract
- Deploy Multicall3 to a standard address
After deployment, contract addresses will be printed to the console.
contracts/
— Main smart contracts (Token, Nft, and supporting libraries)test/Token.ts
— ERC-20 token teststest/Nft.ts
— ERC-721 NFT testsscripts/deploy.ts
— Deployment script